/* LogicForms HTMX - Combined Styles */
/* Base + Components + Layout */

/* ==================== BASE STYLES ==================== */
/* Variables, Reset, Typography, Utilities */

/* Self-hosted Inter Font */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/inter-400.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/inter-500.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/inter-600.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/inter-700.woff2") format("woff2");
}

:root {
  /* Colors - Light Mode (OKLCh) */
  --background: oklch(1 0 0);
  --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.145 0 0);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.145 0 0);
  --primary: oklch(0.205 0 0);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.97 0 0);
  --secondary-foreground: oklch(0.205 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --accent: oklch(0.97 0 0);
  --accent-foreground: oklch(0.205 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --destructive-foreground: oklch(0.985 0 0);
  --border: oklch(0.922 0 0);
  --input: oklch(0.922 0 0);
  --ring: oklch(0.708 0 0);

  /* Status Colors */
  --success: oklch(0.627 0.194 149.214);
  --success-foreground: oklch(0.985 0 0);
  --warning: oklch(0.769 0.189 70.08);
  --warning-foreground: oklch(0.205 0 0);

  /* Radius */
  --radius: 0.625rem;
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
}

.dark {
  --background: oklch(0.175 0 0);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.205 0 0);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.205 0 0);
  --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(0.922 0 0);
  --primary-foreground: oklch(0.205 0 0);
  --secondary: oklch(0.269 0 0);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.269 0 0);
  --muted-foreground: oklch(0.708 0 0);
  --accent: oklch(0.269 0 0);
  --accent-foreground: oklch(0.985 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --destructive-foreground: oklch(0.985 0 0);
  --border: oklch(0.269 0 0);
  --input: oklch(0.269 0 0);
  --ring: oklch(0.556 0 0);
}

* {
  border-color: var(--border);
  box-sizing: border-box;
}

body {
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
}

/* Link styles */
a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* ==================== SCROLLBAR STYLES ==================== */
/* Custom scrollbars - shadcn-style thin scrollbars */

/* Firefox */
* {
  scrollbar-width: auto;
  scrollbar-color: oklch(0.7 0 0 / 0.5) transparent;
}

.dark * {
  scrollbar-color: oklch(0.5 0 0 / 0.5) transparent;
}

/* Webkit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: oklch(0.7 0 0 / 0.4);
  border-radius: 9999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: oklch(0.6 0 0 / 0.6);
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Dark mode scrollbar */
.dark ::-webkit-scrollbar-thumb {
  background: oklch(0.5 0 0 / 0.4);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: oklch(0.6 0 0 / 0.6);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* HTMX loading states */
.htmx-request {
  opacity: 0.5;
  pointer-events: none;
}

.htmx-request .spinner {
  display: inline-block;
}

/* Utilities */
.text-muted {
  color: var(--muted-foreground);
}

.text-sm {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.75rem;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

.font-normal {
  font-weight: 400;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mt-1 {
  margin-top: 0.25rem;
}
.mt-2 {
  margin-top: 0.5rem;
}
.mt-4 {
  margin-top: 1rem;
}
.mt-6 {
  margin-top: 1.5rem;
}
.mt-8 {
  margin-top: 2rem;
}

.mb-1 {
  margin-bottom: 0.25rem;
}
.mb-2 {
  margin-bottom: 0.5rem;
}
.mb-4 {
  margin-bottom: 1rem;
}
.mb-6 {
  margin-bottom: 1.5rem;
}
.mb-8 {
  margin-bottom: 2rem;
}

.gap-1 {
  gap: 0.25rem;
}
.gap-2 {
  gap: 0.5rem;
}
.gap-4 {
  gap: 1rem;
}
.gap-6 {
  gap: 1.5rem;
}

.flex {
  display: flex;
}
.inline-flex {
  display: inline-flex;
}
.items-center {
  align-items: center;
}
.justify-between {
  justify-content: space-between;
}
.justify-center {
  justify-content: center;
}
.flex-1 {
  flex: 1;
}

.w-full {
  width: 100%;
}
.max-w-sm {
  max-width: 24rem;
}
.max-w-md {
  max-width: 28rem;
}
.max-w-lg {
  max-width: 32rem;
}
.max-w-3xl {
  max-width: 48rem;
}

.min-h-screen {
  min-height: 100vh;
}

.p-4 {
  padding: 1rem;
}
.p-6 {
  padding: 1.5rem;
}
.p-8 {
  padding: 2rem;
}
.px-4 {
  padding-left: 1rem;
  padding-right: 1rem;
}
.py-2 {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}
.py-8 {
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.space-y-2 > * + * {
  margin-top: 0.5rem;
}
.space-y-4 > * + * {
  margin-top: 1rem;
}
.space-y-6 > * + * {
  margin-top: 1.5rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==================== COMPONENT STYLES ==================== */
/* Buttons, Inputs, Cards, Badges, Alerts, Tables, Dropdown, Spinner */

/* Button Base */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  height: 2.25rem;
  padding: 0 1rem;
  transition: all 0.15s ease;
  cursor: pointer;
  border: none;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-secondary {
  background-color: var(--secondary);
  color: var(--secondary-foreground);
}

.btn-secondary:hover {
  background-color: var(--accent);
}

.btn-outline {
  background-color: var(--background);
  border: 1px solid var(--border);
  color: var(--foreground);
}

.btn-outline:hover {
  background-color: var(--accent);
}

.btn-ghost {
  background-color: transparent;
  color: var(--foreground);
}

.btn-ghost:hover {
  background-color: var(--accent);
}

.btn-destructive {
  background-color: var(--destructive);
  color: var(--destructive-foreground);
}

.btn-destructive:hover {
  opacity: 0.9;
}

.btn-sm {
  height: 2rem;
  padding: 0 0.75rem;
  font-size: 0.75rem;
}

.btn-lg {
  height: 2.5rem;
  padding: 0 1.5rem;
}

.btn-icon {
  width: 2.25rem;
  padding: 0;
}

.btn-icon-sm {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.btn-icon-sm:hover {
  background: var(--destructive);
  color: var(--destructive-foreground);
}

/* Button Group */
.btn-group {
  display: inline-flex;
}

.btn-group .btn {
  border-radius: 0;
}

.btn-group .btn:first-child {
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
}

.btn-group .btn:last-child {
  border-top-right-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

.btn-group .btn:not(:last-child) {
  border-right: none;
}

/* Input */
.input {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--input);
  background-color: var(--background);
  color: var(--foreground);
  padding: 0 0.75rem;
  font-size: 0.875rem;
  transition: all 0.15s ease;
}

input.input {
  height: 2.25rem;
}

.input:focus {
  outline: none;
  ring: 2px;
  ring-color: var(--ring);
  border-color: var(--ring);
}

.input::placeholder {
  color: var(--muted-foreground);
}

/* Textarea variant */
textarea.input {
  height: auto;
  min-height: 4.5rem;
  padding: 0.5rem 0.75rem;
  resize: vertical;
  line-height: 1.5;
}

/* Select variant */
select.input {
  height: 2.25rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  padding-right: 2rem;
}

.dark select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

/* Label */
.label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

/* Card */
.card {
  background-color: var(--card);
  color: var(--card-foreground);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.card-header {
  padding: 1.5rem 1.5rem 0;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.25;
}

.card-description {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
}

.card-content {
  padding: 1.5rem;
}

.card-footer {
  padding: 0 1.5rem 1.5rem;
  display: flex;
  align-items: center;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 9999px;
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-default {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.badge-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.badge-secondary {
  background-color: var(--secondary);
  color: var(--secondary-foreground);
}

.badge-outline {
  background-color: transparent;
  border: 1px solid var(--border);
  color: var(--foreground);
}

.badge-success {
  background-color: oklch(0.9 0.15 145);
  color: oklch(0.3 0.15 145);
}

.badge-destructive {
  background-color: var(--destructive);
  color: var(--destructive-foreground);
}

/* Alert */
.alert {
  position: relative;
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 1rem;
  background-color: var(--background);
}

.alert-destructive {
  border-color: var(--destructive);
  color: var(--destructive);
}

.alert-warning {
  background-color: oklch(0.98 0.05 85);
  border-color: oklch(0.8 0.15 85);
  color: oklch(0.4 0.15 85);
}

/* Table */
.table {
  width: 100%;
  caption-side: bottom;
  font-size: 0.875rem;
  border-collapse: collapse;
}

.table th {
  height: 3rem;
  padding: 0 1rem;
  text-align: left;
  vertical-align: middle;
  font-weight: 500;
  color: var(--muted-foreground);
  background-color: var(--muted);
}

.table th:first-child {
  border-top-left-radius: var(--radius-md);
}

.table th:last-child {
  border-top-right-radius: var(--radius-md);
}

.table td {
  padding: 0.75rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

.table tr:hover {
  background-color: var(--muted);
}

.table-wrapper {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* Dropdown */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 50;
  min-width: 12rem;
  padding: 0.25rem;
  margin-top: 0.25rem;
  background-color: var(--popover);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  display: none;
}

.dropdown.open .dropdown-menu {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--foreground);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover {
  background-color: var(--accent);
}

.dropdown-separator {
  height: 1px;
  margin: 0.25rem 0;
  background-color: var(--border);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
}

.empty-state-icon {
  width: 3rem;
  height: 3rem;
  color: var(--muted-foreground);
  margin-bottom: 1rem;
}

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.empty-state-description {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-bottom: 1.5rem;
}

/* Form Group */
.form-group {
  margin-bottom: 1rem;
}

/* Spinner */
.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 9999px;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Required indicator */
.required {
  color: var(--destructive);
  margin-left: 0.25rem;
}

/* Radio/Checkbox groups */
.checkbox-label,
.radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}


/* Code Block */
.code-block {
  background-color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  overflow-x: auto;
  font-family: "Monaco", "Menlo", monospace;
  font-size: 0.75rem;
  line-height: 1.5;
}

.code-block code {
  white-space: pre;
}

/* Dialog (native <dialog>) */
dialog.dialog {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--card);
  color: var(--card-foreground);
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  max-width: 28rem;
  width: calc(100% - 2rem);
}

dialog.dialog::backdrop {
  background-color: oklch(0 0 0 / 0.5);
}

.dialog-content {
  padding: 1.5rem;
  background-color: var(--card);
  color: var(--card-foreground);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

.dialog-header-text {
  flex: 1;
  min-width: 0;
}

.dialog-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
}

.dialog-description {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin: 0;
}

.dialog-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.dialog-close:hover {
  background-color: var(--muted);
  color: var(--foreground);
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* Tabs */
.tabs {
  display: flex;
  flex-direction: column;
}

.tabs-list {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 0;
}

.tabs-trigger {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: -1px;
}

.tabs-trigger:hover {
  color: var(--foreground);
}

.tabs-trigger.active {
  color: var(--foreground);
  border-bottom-color: var(--primary);
}

.tabs-content {
  padding-top: 1rem;
}

.tabs-content[hidden] {
  display: none;
}

/* Dropdown Submenu */
.dropdown-sub {
  position: relative;
}

.dropdown-sub-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--foreground);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown-sub-trigger:hover {
  background-color: var(--accent);
}

.dropdown-sub-trigger .trigger-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dropdown-sub-trigger .trigger-arrow {
  margin-left: auto;
}

.dropdown-sub-content {
  position: absolute;
  right: calc(100% - 0.5rem);
  top: 0;
  z-index: 51;
  min-width: 8rem;
  padding: 0.25rem;
  padding-right: 0.75rem;
  background-color: var(--popover);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  display: none;
}

/* Invisible bridge to keep submenu open when moving mouse */
.dropdown-sub-content::after {
  content: "";
  position: absolute;
  top: 0;
  right: -0.5rem;
  width: 0.5rem;
  height: 100%;
}

.dropdown-sub:hover > .dropdown-sub-content,
.dropdown-sub.open > .dropdown-sub-content {
  display: block;
}

/* Theme Radio Item */
.theme-radio-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--foreground);
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.theme-radio-item:hover {
  background-color: var(--accent);
}

.theme-radio-item.active {
  background-color: var(--accent);
}

.theme-radio-item .radio-indicator {
  width: 1rem;
  height: 1rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.theme-radio-item.active .radio-indicator {
  border-color: var(--primary);
  background-color: var(--primary);
}

.theme-radio-item.active .radio-indicator::after {
  content: "";
  width: 0.375rem;
  height: 0.375rem;
  background-color: var(--primary-foreground);
  border-radius: 50%;
}

/* ==================== Webhooks ==================== */

/* Webhooks Tab */
.webhooks-tab {
  padding: 1.5rem;
  height: 100%;
  overflow-y: auto;
}

.webhooks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.webhooks-header-text h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

.webhooks-header-text p {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin: 0.25rem 0 0 0;
}

/* Webhook Grid */
.webhooks-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 1024px) {
  .webhooks-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1280px) {
  .webhooks-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Webhook Card */
.webhook-card .card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem 1rem 0.5rem;
}

.webhook-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.webhook-actions {
  display: flex;
  gap: 0.25rem;
}

.webhook-card .card-content {
  padding: 0 1rem 1rem;
}

.webhook-url {
  font-family: monospace;
  font-size: 0.875rem;
  word-break: break-all;
  margin: 0 0 0.5rem 0;
}

.webhook-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--primary);
  background: none;
  border: none;
  padding: 0;
  margin-top: 0.75rem;
  cursor: pointer;
  text-decoration: none;
}

.btn-link:hover {
  text-decoration: underline;
}

/* Dialog Variants */
dialog.dialog-lg {
  max-width: 32rem;
}

dialog.dialog-xl {
  max-width: 48rem;
}

/* Form Help Text */
.form-help {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin: 0.25rem 0 0 0;
}

/* Input Group */
.input-group {
  display: flex;
  gap: 0.5rem;
}

.input-group .input {
  flex: 1;
}

/* Field Selection List */
.field-selection-list {
  margin-top: 0.5rem;
  max-height: 8rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem;
}

.field-selection-list .checkbox-label {
  padding: 0.25rem 0;
}

/* Collapsible Headers */
.collapsible-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.5rem 0;
  background: none;
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
  cursor: pointer;
}

.collapsible-trigger:hover {
  color: var(--primary);
}

.collapsible-trigger svg {
  transition: transform 0.2s;
}

.headers-section {
  padding-top: 0.5rem;
}

.header-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.header-row .input {
  flex: 1;
}

/* Switch Toggle */
.switch-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.switch {
  position: relative;
  display: inline-block;
  width: 2.75rem;
  height: 1.5rem;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--muted);
  border-radius: 9999px;
  transition: 0.2s;
}

.switch-slider::before {
  position: absolute;
  content: "";
  height: 1.25rem;
  width: 1.25rem;
  left: 0.125rem;
  bottom: 0.125rem;
  background-color: white;
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.switch input:checked + .switch-slider {
  background-color: var(--primary);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(1.25rem);
}

/* Deliveries */
.deliveries-content {
  max-height: 50vh;
  overflow-y: auto;
}

.deliveries-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.delivery-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.delivery-item.success {
  border-left: 3px solid oklch(0.6 0.15 145);
}

.delivery-item.failed {
  border-left: 3px solid var(--destructive);
}

.delivery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
}

.delivery-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.delivery-icon.success {
  color: oklch(0.5 0.15 145);
}

.delivery-icon.failed {
  color: var(--destructive);
}

.delivery-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.delivery-details {
  border-top: 1px solid var(--border);
}

.delivery-summary {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  cursor: pointer;
}

.delivery-summary:hover {
  color: var(--foreground);
}

.delivery-response {
  margin: 0;
  padding: 0.75rem 1rem;
  background-color: var(--muted);
  font-size: 0.75rem;
  overflow-x: auto;
  max-height: 8rem;
}

/* Loading Spinner in context */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  gap: 0.75rem;
  color: var(--muted-foreground);
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  padding: 0.75rem 1rem;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 0.875rem;
  z-index: 100;
  opacity: 0;
  transform: translateY(1rem);
  transition: all 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  border-left: 3px solid oklch(0.6 0.15 145);
}

.toast-error {
  border-left: 3px solid var(--destructive);
}

/* ==================== Integrations Tab ==================== */

/* Integrations Sub-Layout (sidebar + content) */
.integrations-layout {
  display: flex;
  height: 100%;
  overflow: hidden;
}

.integrations-sub-sidebar {
  width: 13rem;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 0.75rem;
}

.integrations-sub-sidebar .settings-nav-link {
  font-size: 0.8125rem;
  padding: 0.4375rem 0.625rem;
  position: relative;
}

.integrations-content {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
  padding: 1.5rem;
  max-width: 56rem;
}

/* Integration Page (individual integration view) */
.integration-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.integration-page-info {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.integration-page-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

.integration-page-desc {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin: 0.25rem 0 0;
}

.integration-page-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.integration-page-body {
  max-width: 40rem;
}

/* Nav status dot */
.integration-nav-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: var(--muted);
  margin-left: auto;
  flex-shrink: 0;
}

.integration-nav-dot.active {
  background: oklch(0.627 0.194 149.214);
}

/* Integration icon */
.integration-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.integration-icon.recaptcha-icon {
  background: linear-gradient(135deg, #4285f4 0%, #34a853 50%, #fbbc04 75%, #ea4335 100%);
  padding: 0.25rem;
}

.integration-icon.recaptcha-icon svg {
  border-radius: var(--radius-sm);
}

/* View Transitions for Integrations Sidebar */
@supports (view-transition-name: none) {
  .integrations-sub-sidebar {
    view-transition-name: integrations-sidebar;
  }
  ::view-transition-group(integrations-sidebar) {
    animation-duration: 0s;
  }
}

/* Integrations Sidebar Responsive */
@media (max-width: 768px) {
  .integrations-layout {
    flex-direction: column;
  }
  .integrations-sub-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0.5rem;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .integrations-sub-sidebar .settings-nav-list {
    flex-direction: row;
    gap: 0.25rem;
    flex-wrap: nowrap;
  }
  .integrations-sub-sidebar .settings-nav-link {
    white-space: nowrap;
    font-size: 0.75rem;
    padding: 0.375rem 0.5rem;
  }
  .integrations-content {
    padding: 1rem;
  }
}

.integration-status {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--muted);
  color: var(--muted-foreground);
}

.integration-status.active {
  background: oklch(from var(--primary) l c h / 0.15);
  color: var(--primary);
}

/* Form row for side-by-side inputs */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* Inline form actions */
.form-actions-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* Small button variant */
.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

/* Small spinner */
.spinner-sm {
  width: 1rem;
  height: 1rem;
  border-width: 2px;
}

/* Info box compact variant */
.info-box-compact {
  padding: 0.625rem 0.875rem;
  font-size: 0.8125rem;
  align-items: center;
}

.info-box-compact svg {
  margin-top: 0;
}


/* Version Selection Cards */
.version-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.version-card {
  position: relative;
  cursor: pointer;
}

.version-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.version-card-content {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  transition: all 0.15s ease;
}

.version-card:hover .version-card-content {
  border-color: var(--muted-foreground);
}

.version-card.selected .version-card-content {
  border-color: var(--primary);
  background: oklch(from var(--primary) l c h / 0.05);
}

.version-card-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-sm);
  background: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--muted-foreground);
}

.version-card.selected .version-card-icon {
  background: var(--primary);
  color: var(--primary-foreground);
}

.version-card-text {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.version-card-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
}

.version-card-desc {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* Threshold Slider */
.threshold-slider-container {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.threshold-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 0.5rem;
  border-radius: 9999px;
  background: var(--muted);
  outline: none;
  cursor: pointer;
}

.threshold-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 9999px;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid var(--background);
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
  transition: transform 0.1s ease;
}

.threshold-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.threshold-slider::-moz-range-thumb {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 9999px;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid var(--background);
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.threshold-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.6875rem;
  color: var(--muted-foreground);
}

.threshold-value-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.125rem 0.5rem;
  margin-left: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--muted);
  color: var(--muted-foreground);
  border-radius: var(--radius-sm);
}

/* Inline icon helper */
.inline-icon {
  vertical-align: -2px;
  margin-right: 0.25rem;
}

/* Info box for integration tips */
.info-box {
  display: flex;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--muted);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--foreground);
  margin-top: 1rem;
}

.info-box svg {
  flex-shrink: 0;
  color: var(--muted-foreground);
  margin-top: 0.125rem;
}

.info-box strong {
  display: block;
  margin-bottom: 0.25rem;
}

.info-box ul {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.info-box code {
  font-family: monospace;
  font-size: 0.75rem;
  background: var(--background);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
}

/* Checkbox label for settings */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
}

.checkbox-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
}

/* Badge muted variant */
.badge-muted {
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}

/* Integration icon variants */
.integration-icon.email-icon,
.integration-icon.slack-icon,
.integration-icon.discord-icon,
.integration-icon.analytics-icon,
.integration-icon.sheets-icon,
.integration-icon.firstspirit-icon {
  background: var(--muted);
}

.integration-icon.turnstile-icon {
  background: #FFF4E5;
}

.dark .integration-icon.turnstile-icon {
  background: rgba(243, 128, 32, 0.15);
}

/* ==================== Submissions Tab ==================== */

.submissions-tab {
  padding: 1.5rem;
  height: 100%;
  overflow-y: auto;
}

.submissions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.submissions-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.submissions-header-left h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

.submissions-header-left p {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin: 0.25rem 0 0 0;
}

.submissions-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.pagination-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  font-size: 0.875rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pagination-item:hover:not(.active):not(:disabled) {
  background: var(--accent);
}

.pagination-item.active {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.pagination-item:disabled,
.pagination-item.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.pagination-info {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

/* Submission Detail Dialog */
.submission-detail .metadata-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 640px) {
  .submission-detail .metadata-grid {
    grid-template-columns: 1fr;
  }
}

.submission-detail .metadata-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.submission-detail .metadata-item.full-width {
  grid-column: 1 / -1;
}

.submission-detail .metadata-label {
  font-size: 0.625rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
}

.submission-detail .metadata-value {
  font-size: 0.875rem;
  word-break: break-all;
}

.submission-detail .data-list {
  display: flex;
  flex-direction: column;
}

.submission-detail .data-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.submission-detail .data-item:last-child {
  border-bottom: none;
}

.submission-detail .data-key {
  font-weight: 500;
  color: var(--muted-foreground);
  flex-shrink: 0;
}

.submission-detail .data-value {
  text-align: right;
  word-break: break-word;
  white-space: pre-wrap;
}

.submission-detail .data-value.empty {
  font-style: italic;
  color: var(--muted-foreground);
}

/* Large dialog variant */
dialog.dialog-2xl {
  max-width: 70vw;
  width: 70vw;
  max-height: 75vh;
}

dialog.dialog-2xl .dialog-content {
  display: flex;
  flex-direction: column;
  max-height: calc(75vh - 2rem);
}

dialog.dialog-2xl .dialog-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 1.5rem;
}

/* ==================== Email Verification Banner ==================== */

.verification-banner {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-size: 0.875rem;
}

.verification-banner svg {
  flex-shrink: 0;
}

.verification-banner span {
  flex: 1;
  text-align: center;
}

.verification-banner strong {
  font-weight: 600;
}

.verification-banner .btn {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.verification-banner .btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.verification-cooldown {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  flex-shrink: 0;
  flex: none;
}

.verification-cooldown svg {
  flex-shrink: 0;
}

.cooldown-text {
  font-variant-numeric: tabular-nums;
  min-width: 3ch;
}

@media (max-width: 640px) {
  .verification-banner {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
    padding: 1rem;
  }

  .verification-banner span {
    text-align: center;
  }

  .verification-cooldown {
    width: 100%;
    justify-content: center;
  }
}

/* ==================== LAYOUT STYLES ==================== */
/* Header, Sidebar, Navigation, Logo, Avatar */

/* Header */
.header {
  height: 3.5rem;
  border-bottom: 1px solid var(--border);
  background-color: var(--background);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-nav-link {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  text-decoration: none;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.header-nav-link:hover {
  color: var(--foreground);
}

.header-nav-link.active {
  color: var(--foreground);
}

/* Sidebar Navigation */
.sidebar {
  width: 14rem;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background-color: var(--background);
  padding: 1rem;
}

.sidebar-section {
  margin-bottom: 0.5rem;
  padding: 0 0.75rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
}

.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav-item {
  margin-bottom: 0.125rem;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  text-decoration: none;
  transition: all 0.15s ease;
}

.sidebar-nav-link:hover {
  background-color: var(--accent);
  color: var(--accent-foreground);
}

.sidebar-nav-link.active {
  background-color: var(--accent);
  color: var(--accent-foreground);
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--foreground);
  text-decoration: none;
}

.logo svg {
  width: 1.75rem;
  height: 1.75rem;
}

/* Avatar */
.avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  background-color: var(--primary);
  color: var(--primary-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 500;
}

/* Settings Layout */
.settings-layout {
  display: flex;
  height: calc(100vh - 3.5rem);
}

.settings-sidebar {
  width: 14rem;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background-color: var(--background);
  padding: 1rem;
}

.settings-nav {
  display: flex;
  flex-direction: column;
}

.settings-nav-section {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.settings-nav-title {
  padding: 0 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
}

.settings-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.settings-nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  text-decoration: none;
  transition: all 0.15s ease;
}

.settings-nav-link:hover {
  background-color: var(--accent);
  color: var(--accent-foreground);
  text-decoration: none;
}

.settings-nav-link.active {
  background-color: var(--accent);
  color: var(--accent-foreground);
}

.settings-nav-link-danger {
  color: var(--destructive);
}

.settings-nav-link-danger:hover {
  background-color: oklch(0.577 0.245 27.325 / 0.1);
  color: var(--destructive);
}

.settings-nav-link-danger.active {
  background-color: oklch(0.577 0.245 27.325 / 0.1);
  color: var(--destructive);
}

.settings-nav-separator {
  height: 1px;
  background-color: var(--border);
  margin: 0.25rem 0;
}

.settings-content {
  flex: 1;
  overflow: auto;
  padding: 2rem;
}

.settings-content-inner {
  max-width: 48rem;
  margin: 0 auto;
}

.settings-page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

/* Settings Cards - Danger variants */
.card-danger {
  border-color: oklch(0.577 0.245 27.325 / 0.5);
}

.card-warning {
  border-color: oklch(0.769 0.189 70.08 / 0.5);
}

/* Organization Switcher */
.org-switcher {
  position: relative;
}

.org-switcher-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--background);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 160px;
  max-width: 200px;
}

.org-switcher-trigger:hover {
  background-color: var(--accent);
}

.org-switcher-name {
  flex: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.org-switcher-menu {
  width: 280px;
  max-height: 400px;
  overflow: hidden;
  flex-direction: column;
  left: 0;
  right: auto;
}

.dropdown.open .org-switcher-menu {
  display: flex;
}

.org-switcher-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
}

.org-switcher-search svg {
  color: var(--muted-foreground);
  flex-shrink: 0;
}

.org-switcher-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.875rem;
  color: var(--foreground);
  outline: none;
}

.org-switcher-input::placeholder {
  color: var(--muted-foreground);
}

.org-switcher-list {
  max-height: 200px;
  overflow-y: auto;
}

.org-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.org-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.org-item-badge {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  margin-left: 0.5rem;
}

.org-item.active {
  background-color: var(--accent);
}

/* ==================== API Key Display ==================== */

.api-key-display {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--muted);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.api-key-value {
  flex: 1;
  font-family: monospace;
  font-size: 0.875rem;
  word-break: break-all;
  color: var(--foreground);
  background: transparent;
  padding: 0;
}

.copy-api-key-btn .copy-btn-copied {
  color: oklch(0.55 0.2 145);
}

/* Dialog Icon */
.dialog-icon-danger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: oklch(0.577 0.245 27.325 / 0.1);
  color: var(--destructive);
  margin-bottom: 1rem;
}

.dialog-icon-danger svg {
  width: 1.5rem;
  height: 1.5rem;
}

/* ==================== Dashboard ==================== */

.dash-summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 1024px) {
  .dash-summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .dash-summary-cards {
    grid-template-columns: 1fr;
  }
}

.dash-stat-card .card-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
}

.dash-stat-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dash-stat-icon-blue {
  background: oklch(0.93 0.08 240);
  color: oklch(0.5 0.2 240);
}

.dash-stat-icon-green {
  background: oklch(0.93 0.08 150);
  color: oklch(0.45 0.2 150);
}

.dash-stat-icon-purple {
  background: oklch(0.93 0.08 300);
  color: oklch(0.5 0.2 300);
}

.dash-stat-icon-orange {
  background: oklch(0.93 0.08 70);
  color: oklch(0.55 0.2 70);
}

.dark .dash-stat-icon-blue {
  background: oklch(0.25 0.08 240);
  color: oklch(0.7 0.15 240);
}

.dark .dash-stat-icon-green {
  background: oklch(0.25 0.08 150);
  color: oklch(0.7 0.15 150);
}

.dark .dash-stat-icon-purple {
  background: oklch(0.25 0.08 300);
  color: oklch(0.7 0.15 300);
}

.dark .dash-stat-icon-orange {
  background: oklch(0.25 0.08 70);
  color: oklch(0.7 0.15 70);
}

.dash-stat-label {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  margin: 0 0 0.125rem 0;
}

.dash-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}

/* Chart Section */
.dash-chart-section {
  margin-bottom: 1.5rem;
}

.dash-chart-svg {
  width: 100%;
  height: 120px;
}

.dash-chart-grid {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.dash-chart-area {
  fill: oklch(0.55 0.2 150 / 0.1);
}

.dash-chart-line {
  fill: none;
  stroke: oklch(0.55 0.2 150);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.dark .dash-chart-area {
  fill: oklch(0.55 0.2 150 / 0.15);
}

.dash-chart-labels {
  display: flex;
  justify-content: space-between;
  padding-top: 0.375rem;
  font-size: 0.6875rem;
  color: var(--muted-foreground);
}

/* Two-column grid */
.dash-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 768px) {
  .dash-grid-2col {
    grid-template-columns: 1fr;
  }
}

/* Form list */
.dash-form-list {
  display: flex;
  flex-direction: column;
}

.dash-form-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--foreground);
  transition: background-color 0.15s;
}

.dash-form-item:last-child {
  border-bottom: none;
}

.dash-form-item:hover {
  text-decoration: none;
  opacity: 0.8;
}

.dash-form-item-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.dash-form-item-name {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Submissions feed */
.dash-feed {
  display: flex;
  flex-direction: column;
}

.dash-feed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--foreground);
  transition: opacity 0.15s;
}

.dash-feed-item:last-child {
  border-bottom: none;
}

.dash-feed-item:hover {
  text-decoration: none;
  opacity: 0.8;
}

.dash-feed-item-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.dash-feed-flag {
  font-size: 1rem;
  line-height: 1;
}

.dash-feed-form-name {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Bar chart */
.dash-bar-chart {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.dash-bar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dash-bar-label {
  width: 10rem;
  flex-shrink: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--foreground);
  text-decoration: none;
}

.dash-bar-label:hover {
  text-decoration: underline;
}

.dash-bar-track {
  flex: 1;
  height: 1.25rem;
  background: var(--muted);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.dash-bar-fill {
  height: 100%;
  background: oklch(0.55 0.2 150);
  border-radius: var(--radius-sm);
  min-width: 2px;
  transition: width 0.3s ease;
}

.dash-bar-value {
  width: 2.5rem;
  text-align: right;
  font-size: 0.8125rem;
  font-weight: 600;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .dash-bar-label {
    width: 6rem;
  }
}

/* Empty state */
.dash-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  color: var(--muted-foreground);
  text-align: center;
  gap: 0.5rem;
}

.dash-empty p {
  font-size: 0.875rem;
  margin: 0;
}
