/* =============================================================================
   OWENTRA · MODERN SAAS DESIGN SYSTEM  v3
   ─────────────────────────────────────────────────────────────────────────────
   Floating capsule navbar · Playfair Display (display) · Inter (UI)
   Cloud Canvas background · white surfaces · black accent
============================================================================= */

/* ─── Tokens ────────────────────────────────────────────────────────────── */
:root {
  /* Surfaces */
  --cloud-canvas:  #f5f2f0;
  --bone:          #f5f2f0;
  --bone-deep:     #ece8e3;
  --paper:         #ffffff;
  --cream:         #eee9e2;

  /* Ink + text */
  --ink:         #000000;
  --ink-soft:    #333333;
  --ash:         #545454;
  /* #909090 → #6e6e6e: old value was 3.19:1 on white (WCAG AA fail for the
     captions/timestamps/footer text that use it). New value: 5.1:1 on white,
     4.57:1 on bone. */
  --ash-soft:    #6e6e6e;

  /* Brand accent */
  --moss:        #000000;
  --moss-deep:   #1a1a1a;
  --moss-bright: #3a3a3a;
  --moss-glow:   rgba(0, 0, 0, 0.06);
  --moss-line:   rgba(0, 0, 0, 0.12);

  /* Secondary */
  --clay:        #a3a3a3;
  --clay-deep:   #737373;
  --clay-soft:   rgba(163, 163, 163, 0.15);
  --olive:       #545454;

  /* State */
  --success:     #4F7A4A;
  /* #C58A2C → #92620C: old amber was 2.98:1 on white / 2.87:1 on the warning
     toast bg (AA fail as text). New: 5.28:1 / 5.1:1 — still amber. */
  --warn:        #92620C;
  --danger:      #B14242;

  /* Lines & panels */
  --rule:        rgba(214, 214, 214, 0.55);
  --rule-strong: #d6d6d6;
  --panel:       rgba(255, 255, 255, 0.80);
  --panel-solid: #ffffff;

  /* Plan tier */
  --plan-pro-bg:    #fff3e0;
  --plan-pro-text:  #b45309;
  --plan-pro-line:  #fbbf24;
  --plan-ent-bg:    #f4f4f5;
  --plan-ent-text:  #18181b;
  --plan-ent-line:  #52525b;

  /* Shadows */
  --shadow-1:    rgba(0, 0, 0, 0.04) 0px 8px 16px 0px;
  --shadow-2:    rgba(0, 0, 0, 0.06) 0px 12px 28px 0px;
  --shadow-3:    rgba(16, 24, 40, 0.10) 0px 20px 48px 0px;
  --shadow-navbar: 0 4px 24px rgba(0,0,0,0.10), 0 1px 4px rgba(0,0,0,0.06);

  /* Type */
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-sans:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  /* Radius */
  --r-sm:   6px;
  --r-md:   8px;
  --r-lg:   20px;
  --r-xl:   32px;
  --r-pill: 999px;

  /* Navbar layout */
  --navbar-h:          52px;
  --navbar-top-gap:    12px;
  --navbar-side-gap:   16px;
  --navbar-radius:     var(--r-pill);
  --page-top-offset:   calc(var(--navbar-h) + var(--navbar-top-gap) * 2 + 12px);
  --gutter:            32px;

  /* Motion */
  --ease-out:   cubic-bezier(.22, 1, .36, 1);
  --ease-in:    cubic-bezier(.55, 0, .68, .53);
  --ease-stand: cubic-bezier(.4, 0, .2, 1);

  /* Spacing */
  --space-1:  4px;  --space-2:  6px;  --space-3:  10px;
  --space-4:  14px; --space-5:  18px; --space-6:  22px;
  --space-8:  28px; --space-10: 36px; --space-12: 44px;
  --space-16: 56px;

  /* Heights */
  --height-sm: 28px;
  --height-md: 36px;
  --height-lg: 42px;

  /* Type scale */
  --text-xs:   0.8rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --leading-tight:  1.25;
  --leading-normal: 1.5;
  --leading-loose:  1.75;

  /* Semantic aliases */
  --color-primary:        var(--ink);
  --color-primary-hover:  var(--moss-deep);
  --color-primary-subtle: var(--moss-glow);
  --color-bg:             var(--cloud-canvas);
  --color-surface:        var(--paper);
  --color-text:           var(--ink);
  --color-text-muted:     var(--ash);
  --color-text-disabled:  var(--ash-soft);
  --color-border:         var(--rule);
  --color-border-strong:  var(--rule-strong);
  --color-success:        var(--success);
  --color-success-subtle: rgba(79, 122, 74, 0.12);
  --color-warning:        var(--warn);
  --color-warning-subtle: rgba(197, 138, 44, 0.12);
  --color-error:          var(--danger);
  --color-error-subtle:   rgba(177, 66, 66, 0.10);
  --color-info:           var(--ink);
  --color-info-subtle:    var(--moss-glow);

  /* ── Compatibility aliases ──────────────────────────────────────────────
     These tokens are referenced (without fallbacks) across many page
     templates but were never defined, causing properties to resolve to
     their *initial* values (e.g. transparent backgrounds, invisible text,
     zero border-radius, broken height calc() in the console).
     Keep them aliased to the core palette so every page renders correctly. */
  --accent:        var(--ink);
  --accent-deep:   var(--moss-deep);
  --accent-bright: var(--moss-bright);
  --accent-glow:   var(--moss-glow);
  --accent-line:   var(--moss-line);
  --rust:          var(--danger);
  --paper-dim:     var(--bone-deep);
  --border:        var(--rule-strong);
  --border-soft:   var(--rule);
  --radius-sm:     var(--r-sm);
  --radius-md:     var(--r-md);
  --radius-full:   var(--r-pill);
  --pb-ease-out:   var(--ease-out);
  --header-h:      var(--navbar-h);
}

/* ─── Resets ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; font-size: 14px; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

body {
  font-family: var(--font-sans);
  font-size: var(--text-base); /* 1rem = 16px — never below this on mobile */
  line-height: var(--leading-normal);
  color: var(--ink);
  background: var(--bone);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
  overflow-x: hidden; /* prevent horizontal scroll at the source */
}

::selection { background: var(--moss); color: var(--paper); }

/* ─── Global focus ring (keyboard navigation) ─────────────────────────── */
/* All interactive elements get a visible ring when focused via keyboard.
   Inputs/textareas use box-shadow instead (already handled in :focus rules). */
:focus-visible {
  outline: 2px solid var(--moss);
  outline-offset: 2px;
}
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none; /* box-shadow already applied in their :focus rules */
}

/* ─── Atmospheric layered backgrounds ───────────────────────────────────── */
/*
   Three stacked layers attached to body::before/::after and a noise SVG:
   - radial moss bloom top-left
   - radial clay glow bottom-right
   - faint contour lines via SVG data URI
*/
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
body::before {
  background:
    radial-gradient(ellipse 60% 50% at 8% 4%,  rgba(0, 0, 0, 0.05), transparent 65%),
    radial-gradient(ellipse 50% 45% at 95% 95%, rgba(163, 163, 163, 0.08), transparent 70%);
}
body::after {
  /* Very subtle warm grain — keep atmosphere minimal and clean */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.94  0 0 0 0 0.90  0 0 0 0 0.88  0 0 0 0.10 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.40'/></svg>");
  opacity: .40;
  mix-blend-mode: multiply;
}
body > * { position: relative; z-index: 1; }

/* Public marketing pages share the cloud canvas background */
body.landing-page,
body.auth-page {
  background: var(--cloud-canvas);
}

/* ─── Typography ────────────────────────────────────────────────────────── */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 .5em;
  line-height: 1.2;
  overflow-wrap: break-word;
  text-wrap: balance; /* avoid orphaned words; ignored where unsupported */
}
h4, h5 {
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 .5em;
  line-height: 1.3;
}
h1 { font-size: clamp(2.2rem, 4.2vw, 3.875rem); font-weight: 400; }
h2 { font-size: clamp(1.7rem, 3vw, 2.75rem); letter-spacing: -.025em; font-weight: 400; }
h3 { font-size: clamp(1.1rem, 1.5vw, 1.4rem); letter-spacing: -.015em; font-weight: 400; }
h4 { font-size: 1.05rem; }
h5 { font-size: .95rem; }

h1 em, h2 em, h3 em {
  font-style: italic;
  font-weight: 400;
  color: var(--ash);
}

p { margin: 0 0 1em; color: var(--ink-soft); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-size: .68rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ash);
  font-weight: 600;
}
.eyebrow::before {
  content: "";
  width: 22px; height: 1px;
  background: var(--ash);
  opacity: .55;
}

.lede { font-size: 1.15rem; color: var(--ash); max-width: 56ch; }

.mono { font-family: var(--font-mono); font-size: .82em; letter-spacing: -.01em; }

/* ─── Reveal animations (IntersectionObserver-driven) ───────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .9s var(--ease-out), transform .9s var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn,
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger,
.btn-outline,
.btn-cancel,
.btn-edit,
.btn-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);       /* 8px */
  padding: var(--space-3) var(--space-5); /* 12px 20px - standard on-grid vertical/horizontal padding */
  min-height: var(--height-md); /* 40px tap target */
  border-radius: var(--radius-full, 999px); /* pill-shape shape across all buttons */
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: var(--text-sm); /* 14px */
  font-weight: 500;
  letter-spacing: -.005em;
  cursor: pointer;
  text-decoration: none;
  transition: transform 150ms ease, background 150ms ease, color 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
  position: relative;
  white-space: nowrap;
  /* Ensure minimum tap target on touch devices */
  -webkit-tap-highlight-color: transparent;
}

/* Identical hover translating and shadow effects across all buttons */
.btn:hover,
.btn-primary:hover,
.btn-secondary:hover,
.btn-ghost:hover,
.btn-danger:hover,
.btn-outline:hover,
.btn-cancel:hover,
.btn-edit:hover,
.btn-delete:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}

.btn:active,
.btn-primary:active,
.btn-secondary:active,
.btn-ghost:active,
.btn-danger:active,
.btn-outline:active,
.btn-cancel:active,
.btn-edit:active,
.btn-delete:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--moss);
  color: var(--paper);
  border-color: var(--moss);
  box-shadow: var(--shadow-1);
}
.btn-primary:hover {
  background: var(--moss-deep);
  border-color: var(--moss-deep);
  color: var(--paper);
}

.btn-secondary,
.btn-edit {
  background: var(--bone-deep);
  color: var(--ink);
  border-color: var(--rule);
}
.btn-secondary:hover,
.btn-edit:hover {
  background: var(--cream);
  border-color: var(--rule-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--rule-strong);
}
.btn-ghost:hover {
  background: var(--moss-glow);
  color: var(--moss-deep);
  border-color: var(--moss-line);
}

.btn-danger,
.btn-delete {
  background: transparent;
  color: var(--danger);
  border-color: rgba(177, 66, 66, .35);
}
.btn-danger:hover,
.btn-delete:hover {
  background: var(--danger);
  color: var(--paper);
  border-color: var(--danger);
}

.btn-outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn-outline:hover {
  background: var(--ink);
  color: var(--paper);
}

.btn-cancel {
  background: transparent;
  color: var(--ash);
  border-color: var(--rule);
}
.btn-cancel:hover {
  color: var(--ink);
  border-color: var(--ink);
}

/* Sm and edit/delete size scales sharing same traits */
.btn-sm,
.btn-edit,
.btn-delete {
  padding: var(--space-2) var(--space-4); /* 8px 16px horizontal padding */
  font-size: var(--text-xs); /* 12px */
  min-height: var(--height-sm); /* 32px standard small target, becomes 44px on mobile touch */
}

/* Block style */
.btn-block {
  width: 100%;
}

button:disabled, .btn:disabled, .btn-primary:disabled, .btn-secondary:disabled, .btn-ghost:disabled, .btn-danger:disabled, .btn-edit:disabled, .btn-delete:disabled {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
}

/* ─── Loading state (CSS spinner, no JS library needed) ───────────────── */
.btn-loading {
  pointer-events: none;
  cursor: wait;
  color: transparent !important;
}
.btn-loading::after {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid rgba(0, 0, 0, 0.20);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: btn-spin 0.65s linear infinite;
}
/* For ghost/outline/secondary buttons the spinner should use ink colour */
.btn-ghost.btn-loading::after,
.btn-secondary.btn-loading::after,
.btn-outline.btn-loading::after,
.btn-cancel.btn-loading::after,
.btn-edit.btn-loading::after {
  border-color: rgba(0, 0, 0, 0.15);
  border-top-color: var(--ink);
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* ─── Forms ─────────────────────────────────────────────────────────────── */
/* Gap rhythm: label → input → helper text: --space-2 between each.
   Gap between sibling fields: --space-4. */
.form-group { margin-bottom: var(--space-4); position: relative; } /* 16px — on-grid */

.form-group > label,
form label {
  display: block;
  font-family: var(--font-sans);
  font-size: var(--text-xs);   /* 12px */
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ash);
  font-weight: 600;
  margin-bottom: var(--space-2); /* 8px */
}

.form-input,
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: var(--space-3) var(--space-4); /* 12px 16px — on-grid */
  min-height: var(--height-md);           /* 40px */
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-md);
  font-family: var(--font-sans);
  font-size: var(--text-base); /* 1rem — never shrinks on mobile */
  color: var(--ink);
  outline: none;
  transition: border-color .2s var(--ease-out), background .2s var(--ease-out),
              box-shadow .2s var(--ease-out);
}
textarea { resize: vertical; min-height: 120px; line-height: var(--leading-normal); }

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23545454' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px;
  padding-right: 36px !important;
  cursor: pointer;
}

/* ── Global Modals overlay and sheets ───────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(var(--page-top-offset, 100px) + 20px) 20px 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-card {
    background: var(--paper);
    border: 1px solid var(--rule-strong);
    border-radius: 16px;
    width: 100%;
    max-width: 580px;
    height: auto;
    min-height: 280px;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.05) inset;
    transform: translateY(24px) scale(0.96);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}
.modal-overlay.active .modal-card {
    transform: translateY(0) scale(1);
}
.modal-header {
    padding: 24px 32px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--ink);
    letter-spacing: -0.01em;
}
.modal-close {
    background: var(--bone-deep);
    border: none;
    border-radius: 50%;
    color: var(--ash);
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.modal-close:hover {
    background: var(--rule-strong);
    color: var(--ink);
}
.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 32px 32px;
}
.modal-footer {
    padding: 20px 32px;
    border-top: 1px solid var(--rule);
    background: rgba(0,0,0,0.1);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
}

/* Modal Form Groups */
.modal-body .form-group {
    margin-bottom: 24px;
}
.modal-body label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ash);
    margin-bottom: 8px;
    display: block;
}
.modal-body .form-control {
    background: var(--panel-solid);
    border: 1px solid var(--rule-strong);
    border-radius: var(--r-md);
    padding: 12px 16px;
    color: var(--ink);
    font-size: 0.95rem;
    width: 100%;
    transition: all 0.2s;
}
.modal-body .form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--paper);
}

/* Topbar Search */
.topbar-search {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.topbar-search input {
    background: var(--panel-solid);
    border: 1px solid var(--rule);
    border-radius: var(--r-pill);
    padding: 8px 36px 8px 38px;
    font-size: 0.85rem;
    color: var(--ink);
    min-width: 240px;
    transition: all 0.2s;
}
.topbar-search input:focus {
    background: var(--paper);
    border-color: var(--accent-line);
    box-shadow: 0 0 0 3px var(--accent-glow);
    outline: none;
}
.topbar-search .search-icon {
    position: absolute;
    left: 14px;
    color: var(--ash);
    width: 16px;
    height: 16px;
    pointer-events: none;
}
.topbar-search .search-clear {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--ash);
    padding: 2px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
}
.topbar-search .search-clear:hover {
    background: var(--rule-strong);
    color: var(--ink);
}
.topbar-search input:not(:placeholder-shown) ~ .search-clear {
    display: inline-flex;
}.form-input:focus,
input:focus,
textarea:focus,
select:focus {
  border-color: var(--moss);
  background: var(--paper);
  box-shadow: 0 0 0 4px var(--moss-glow);
}

input::placeholder, textarea::placeholder { color: var(--ash-soft); }

/* Required marker uses the error colour (was --clay #a3a3a3 — 2.52:1, near-invisible) */
.required-star { color: var(--danger); margin-left: 2px; }
.field-errors, .errorlist { list-style: none; padding: 0; margin: var(--space-2) 0 0; }
.error-text, .errorlist li {
  color: var(--color-error);
  font-size: var(--text-xs); /* 12px — helper text scale */
  padding: var(--space-1) 0;
}
/* Field-level error state — border turns red */
.form-group.has-error input,
.form-group.has-error textarea,
.form-group.has-error select {
  border-color: var(--color-error);
  background: var(--color-error-subtle);
}
/* Helper / hint text beneath fields */
.field-hint {
  display: block;
  font-size: var(--text-xs);
  color: var(--ash);
  margin-top: var(--space-2);
  line-height: var(--leading-normal);
}
/* Inline validation error shown by JS */
.field-error-inline {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-error);
  margin-top: var(--space-2);
  line-height: var(--leading-normal);
  animation: fadeInDown .2s var(--ease-out);
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Messages / flashes (dismissible) ─────────────────────────────────── */
.messages {
  position: fixed;
  top: calc(var(--navbar-top-gap) + var(--navbar-h) + 12px);
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 360px;
  max-width: calc(100vw - 48px);
  pointer-events: none;
  list-style: none;
  padding: 0;
  margin: 0;
}
.message {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4); /* 12px 16px */
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  border: 1px solid var(--rule-strong);
  border-left: 4px solid var(--moss);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  animation: toastSlideIn .35s cubic-bezier(0.16, 1, 0.3, 1) both;
  transition: opacity .3s, transform .3s, margin .3s, padding .3s, height .3s;
}
@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(40px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
.toast-fade-out {
  opacity: 0;
  transform: translateX(40px) scale(0.95);
}
.message-success, .message.success {
  border-left-color: var(--color-success);
  background: #f4f9f4;
  color: var(--success);
}
.message-error, .message.error {
  border-left-color: var(--color-error);
  background: #fdf2f2;
  color: var(--danger);
}
.message-warning, .message.warning {
  border-left-color: var(--color-warning);
  background: #fffbeb;
  color: var(--warn);
}
/* Dismiss button inside each message */
.message-dismiss {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 24px; height: 24px;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  color: currentColor;
  opacity: .55;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
  transition: opacity .15s, background .15s;
}
.message-dismiss:hover { opacity: 1; background: rgba(0,0,0,.04); }

/* =============================================================================
   AUTHENTICATED SHELL — FLOATING CAPSULE NAVBAR
============================================================================= */

/* ─── Navbar outer wrapper ─────────────────────────────────────────────── */
.navbar-float-wrap {
  position: fixed;
  top: var(--navbar-top-gap);
  left: var(--navbar-side-gap);
  right: var(--navbar-side-gap);
  z-index: 100;
  pointer-events: none; /* allow clicks to pass through the gap */
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}
.navbar-float-wrap.navbar-hidden {
  transform: translateY(calc(-100% - var(--navbar-top-gap) - 20px));
  opacity: 0;
}

/* ─── Capsule navbar ───────────────────────────────────────────────────── */
.navbar-capsule {
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--navbar-h);
  padding: 0 10px 0 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(220, 220, 220, 0.60);
  border-radius: var(--navbar-radius);
  box-shadow: var(--shadow-navbar);
  transition: background .3s var(--ease-out), box-shadow .3s var(--ease-out), padding .3s var(--ease-out);
}
.navbar-capsule.scrolled {
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 6px 32px rgba(0,0,0,0.13), 0 1px 4px rgba(0,0,0,0.07);
}

/* ─── Brand ────────────────────────────────────────────────────────────── */
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  padding: 0 6px 0 2px;
  text-decoration: none;
}
.navbar-brand-icon {
  width: 30px; height: 30px;
  border-radius: 50%;
  overflow: hidden;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.navbar-brand-icon img { width: 100%; height: 100%; object-fit: contain; }
.navbar-brand-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.025em;
  color: var(--ink);
  white-space: nowrap;
}
.navbar-brand-name::after {
  content: "®";
  font-size: .45rem;
  vertical-align: super;
  margin-left: 1px;
  color: var(--ash-soft);
}

/* ─── Nav divider ──────────────────────────────────────────────────────── */
.navbar-capsule::after {
  /* invisible — we use the nav items gap itself */
  display: none;
}

/* ─── Center nav items ─────────────────────────────────────────────────── */
.navbar-nav {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}
.navbar-nav-list {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  padding: 0; margin: 0;
}

/* Nav item — pill/capsule shape */
.navbar-nav-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  font-family: var(--font-sans);
  font-size: .82rem;
  font-weight: 500;
  color: var(--ash);
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  background: transparent;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: -.01em;
  transition:
    background .18s var(--ease-out),
    color .18s var(--ease-out),
    border-color .18s var(--ease-out),
    box-shadow .18s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
}
.navbar-nav-item svg {
  flex-shrink: 0;
  transition: color .18s var(--ease-out);
}
.navbar-nav-item:hover {
  background: var(--bone-deep);
  color: var(--ink);
}
.navbar-nav-item.active {
  background: var(--ink);
  color: var(--paper);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.navbar-nav-item.active svg { color: var(--paper); }

/* Chevron for group triggers */
.nav-chevron {
  margin-left: 1px;
  opacity: .55;
  transition: transform .25s var(--ease-out), opacity .18s;
  flex-shrink: 0;
}
.navbar-nav-group-trigger[aria-expanded="true"] .nav-chevron {
  transform: rotate(180deg);
  opacity: 1;
}

/* ─── Navbar dropdown (Bots, Agents) ───────────────────────────────────── */
.navbar-nav-group {
  position: relative;
  list-style: none;
}
.navbar-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 180px;
  background: var(--panel-solid);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  overflow: hidden;
  padding: 6px;
  z-index: 200;
  /* hidden by default — toggled via data-open */
  display: none;
  animation: dropdownFade .18s var(--ease-out);
}
.navbar-dropdown[data-open] { display: block; }

.navbar-dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  font-size: .84rem;
  font-weight: 500;
  color: var(--ink-soft);
  border-radius: var(--r-md);
  text-decoration: none;
  transition: background .15s var(--ease-out), color .15s var(--ease-out);
  cursor: pointer;
  border: none; background-color: transparent;
}
.navbar-dropdown-item:hover { background: var(--bone-deep); color: var(--ink); }
.navbar-dropdown-item.active { color: var(--ink); font-weight: 600; }
.navbar-dropdown-item svg { flex-shrink: 0; color: var(--ash); }

@keyframes dropdownFade {
  from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ─── Right side ───────────────────────────────────────────────────────── */
.navbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── Profile avatar button ────────────────────────────────────────────── */
.navbar-profile { position: relative; }

.navbar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: grid; place-items: center;
  font-family: var(--font-sans);
  font-size: .88rem;
  font-weight: 600;
  border: 2px solid transparent;
  outline: none;
  cursor: pointer;
  user-select: none;
  transition:
    transform .2s var(--ease-out),
    box-shadow .2s var(--ease-out),
    border-color .2s var(--ease-out);
}
.navbar-avatar:hover {
  transform: scale(1.06);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.10);
}
.navbar-avatar[aria-expanded="true"] {
  box-shadow: 0 0 0 3px rgba(0,0,0,0.18);
}

/* ─── Profile dropdown ─────────────────────────────────────────────────── */
.profile-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: 260px;
  background: var(--panel-solid);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  z-index: 200;
  overflow: hidden;
  animation: profileFade .2s var(--ease-out);
}
.profile-dropdown[hidden] { display: none; }

@keyframes profileFade {
  from { opacity: 0; transform: translateY(-8px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.profile-dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bone-deep);
  border-bottom: 1px solid var(--rule);
}
.profile-dropdown-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: grid; place-items: center;
  font-weight: 600;
  font-size: 1rem;
  flex-shrink: 0;
}
.profile-dropdown-info { min-width: 0; }
.profile-dropdown-name {
  font-weight: 600;
  font-size: .9rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-dropdown-email {
  font-size: .72rem;
  color: var(--ash); /* sits on --bone-deep; --ash-soft would fall below AA here */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
/* Plan badge rendered inside the profile dropdown header (mobile only) */
.profile-dropdown-plan-badge {
  display: none; /* hidden on desktop — shown via media query below */
  margin-top: 6px;
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  border: 1px solid var(--rule-strong);
  background: var(--bone-deep);
  color: var(--ash);
  width: fit-content;
}

.profile-dropdown-role {
  display: inline-block;
  margin-top: 5px;
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ash-soft);
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-pill);
  padding: 2px 8px;
}

.profile-dropdown-body { padding: 8px; }

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-sans);
  border-radius: var(--r-md);
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink-soft);
  transition: background .15s var(--ease-out);
}
.profile-dropdown-item svg {
  flex-shrink: 0;
  color: var(--ash);
  transition: color .15s;
}
.profile-dropdown-item span {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.profile-dropdown-item strong {
  font-size: .86rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.2;
}
.profile-dropdown-item small {
  font-size: .72rem;
  color: var(--ash);
  line-height: 1.2;
}
.profile-dropdown-item:hover {
  background: var(--bone-deep);
  color: var(--ink);
}
.profile-dropdown-item:hover svg { color: var(--ink); }

.profile-dropdown-divider {
  height: 1px;
  background: var(--rule);
  margin: 4px 0;
}

.profile-dropdown-logout strong { color: var(--danger); }
.profile-dropdown-logout svg { color: var(--danger); opacity: .75; }
.profile-dropdown-logout:hover { background: rgba(177,66,66,.07); }
.profile-dropdown-logout:hover svg { opacity: 1; }

/* ─── Public CTA button in navbar ─────────────────────────────────────── */
.navbar-cta {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-pill);
  font-family: var(--font-sans);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: -.01em;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid var(--ink);
  transition: background .18s var(--ease-out), transform .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
.navbar-cta:hover {
  background: var(--moss-deep);
  border-color: var(--moss-deep);
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}

/* Mobile-panel CTA: hidden on desktop (only shown inside the mobile nav panel) */
.navbar-mobile-cta { display: none; }

/* ─── Mobile hamburger ─────────────────────────────────────────────────── */
.navbar-mobile-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 38px; height: 38px;
  background: transparent;
  border: 1px solid var(--rule-strong);
  border-radius: 50%;          /* circular to match the pill capsule */
  cursor: pointer;
  padding: 0;
  transition: background .18s;
}
.navbar-mobile-toggle span {
  display: block;
  width: 16px; height: 1.5px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform .25s var(--ease-out), opacity .25s;
}
.navbar-mobile-toggle.is-open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.navbar-mobile-toggle.is-open span:nth-child(2) { opacity: 0; }
.navbar-mobile-toggle.is-open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }
.navbar-mobile-toggle:hover { background: var(--bone-deep); }

/* ─── Mobile nav overlay ───────────────────────────────────────────────── */
.navbar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.30);
  z-index: 90;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.navbar-overlay[data-active] { display: block; }

/* ─── Page shell (below floating navbar) ───────────────────────────────── */
.page-shell {
  padding-top: var(--page-top-offset);
  min-height: 100dvh;
}
.page-main {
  max-width: 1560px;    /* wider — full use of reclaimed sidebar space */
  margin: 0 auto;
  padding: 0 var(--gutter) var(--space-16);
}
.page-body { min-width: 0; }

/* Legacy alias */
.dashboard-body { padding: 0; }

/* ─── Page top bar (title + actions, replaces old sidebar header) ──────── */
.page-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  padding: var(--space-5) 0 var(--space-4);
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
}
.page-topbar-left { min-width: 0; }
.page-topbar h2 {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--ink);
  margin: 0 0 2px;
}
.page-topbar .page-meta {
  font-size: var(--text-xs);
  color: var(--ash);
  margin: 0;
  letter-spacing: .02em;
}
.page-topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ─── Filter tabs (used in ticket_list etc.) — capsule style ───────────── */
.filter-tabs {
  display: flex;
  gap: 3px;
  background: var(--bone-deep);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-pill);
  padding: 3px;
}
.filter-tab {
  padding: 5px 14px;
  border-radius: var(--r-pill);
  font-size: var(--text-xs);
  font-weight: 500;
  text-decoration: none;
  color: var(--ash);
  background: transparent;
  border: none;
  transition: background .15s var(--ease-out), color .15s var(--ease-out);
  white-space: nowrap;
  cursor: pointer;
  line-height: 1.5;
}
.filter-tab:hover { color: var(--ink); }
.filter-tab.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

/* ─── Pagination ───────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--rule);
  flex-wrap: wrap;
}
.pagination-info {
  font-size: var(--text-sm);
  color: var(--ash);
  white-space: nowrap;
}
.pagination-controls {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ash);
  background: transparent;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: background .15s var(--ease-out), color .15s var(--ease-out), border-color .15s var(--ease-out);
  cursor: pointer;
}
.page-link:hover { background: var(--bone-deep); color: var(--ink); border-color: var(--rule-strong); }
.page-link.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  pointer-events: none;
}
.page-link.disabled {
  opacity: .38;
  pointer-events: none;
}
.page-link svg { flex-shrink: 0; }

/* ─── Sidebar usage bars (legacy — kept for potential use) ─────────────── */
.su-row { display: flex; flex-direction: column; gap: 5px; }
.su-label { display: flex; justify-content: space-between; font-family: var(--font-sans); font-size: .62rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ash); }
.su-nums { color: var(--ink-soft); }
.su-track { height: 5px; background: var(--bone-deep); border-radius: 99px; overflow: hidden; }
.su-fill { height: 100%; background: var(--ink); border-radius: 99px; transition: width .6s var(--ease-out); }
.su-fill--warn   { background: var(--warn); }
.su-fill--danger { background: var(--clay); }

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card,
.dashboard-card {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
}
.dashboard-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 60px; height: 1px;
  background: var(--clay);
}

.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.card-header h3 { margin: 0; font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; }
.card-subtitle { font-family: var(--font-sans); font-size: .7rem; letter-spacing: .10em; text-transform: uppercase; color: var(--ash); }
.view-all-link { font-size: .82rem; color: var(--ink); border-bottom: 1px solid var(--rule-strong); padding-bottom: 1px; }
.view-all-link:hover { color: var(--ash); border-color: var(--ash); }

/* ─── Metrics ───────────────────────────────────────────────────────────── */
.metrics-grid {
  display: grid;
  /* 5 cols on wide screens, auto-fit on smaller — full use of horizontal space */
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.metric-card {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  overflow: hidden;
  transition: transform .35s var(--ease-out), box-shadow .35s var(--ease-out);
}
.metric-card::after {
  content: "";
  position: absolute;
  inset: auto -30% -50% auto;
  width: 200px; height: 200px;
  background: radial-gradient(circle, var(--moss-glow), transparent 60%);
  pointer-events: none;
}
.metric-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.metric-icon {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  position: relative;
  z-index: 1;
}
.metric-icon svg { width: 20px; height: 20px; }
.metric-info { display: flex; flex-direction: column; gap: 4px; position: relative; z-index: 1; }
.metric-label {
  font-family: var(--font-sans);
  font-size: .68rem;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--ash);
}
.metric-value {
  font-family: var(--font-sans);
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--ink);
  line-height: 1;
}

/* Dashboard grid — 3 cols on wide, 2 on medium, 1 on mobile */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.dashboard-grid > *:first-child { grid-column: 1 / -1; }
@media (max-width: 1200px) { .dashboard-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 780px)  { .dashboard-grid { grid-template-columns: 1fr; } }

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-md);
  font-size: .9rem;
  color: var(--ink);
  text-decoration: none;
  transition: all .25s var(--ease-out);
}
.action-btn svg { color: var(--ash); }
.action-btn:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); transform: translateY(-2px); }
.action-btn:hover svg { color: var(--paper); }

/* ─── List items ────────────────────────────────────────────────────────── */
.items-list { display: flex; flex-direction: column; gap: 6px; }

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  transition: background .2s, border-color .2s;
}
.list-item:hover { background: var(--bone-deep); border-color: var(--rule); }

.item-info { display: flex; align-items: center; gap: 14px; min-width: 0; }
.item-icon {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--bone-deep);
  color: var(--ink);
  border-radius: 10px;
  font-size: .95rem;
  border: 1px solid var(--rule);
}
.item-details h4 { font-size: .96rem; font-weight: 500; margin: 0 0 2px; font-family: var(--font-sans); letter-spacing: -.005em; }
.item-email { font-size: .8rem; color: var(--ash); font-family: var(--font-sans); }

.item-actions { display: flex; gap: 6px; }
.btn-icon {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  text-decoration: none;
  font-size: .9rem;
  transition: all .2s;
}
.btn-icon:hover { background: var(--paper); border-color: var(--rule-strong); }

/* ─── Empty states ──────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  color: var(--ash);
  gap: 14px;
}
.empty-state svg { color: var(--ash-soft); opacity: .55; }
.empty-state p { margin: 0; font-size: .95rem; }

/* ─── Tables ────────────────────────────────────────────────────────────── */
.bots-table,
.agents-table,
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  overflow: hidden;
  font-size: .9rem;
}
.bots-table th, .agents-table th, .data-table th, .leads-table th {
  text-align: left;
  padding: 16px 20px;
  font-family: var(--font-mono);
  font-size: .65rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ash);
  font-weight: 600;
  background: transparent;
  border-bottom: 1px solid var(--rule);
}
.bots-table td, .agents-table td, .data-table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}
.bots-table tr:last-child td, .agents-table tr:last-child td, .data-table tr:last-child td {
  border-bottom: none;
}
.bots-table tr:hover td, .agents-table tr:hover td, .data-table tr:hover td {
  background: var(--moss-glow);
}
.bots-table a, .agents-table a, .data-table a { color: var(--ink); border-bottom: 1px solid var(--rule-strong); }
.bots-table a:hover, .agents-table a:hover, .data-table a:hover { color: var(--ink); border-color: var(--ink); }

.actions, .action-cell { display: flex; gap: 8px; flex-wrap: wrap; }
/* Handled uniformly by global .btn-edit and .btn-delete button styles */

.inline-action-form { display: inline; margin: 0; }

.status, .status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-family: var(--font-sans);
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid var(--rule-strong);
  background: var(--paper);
  color: var(--ink-soft);
}
.status::before, .status-badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ash);
}
.status-completed, .status-active { color: var(--success); border-color: rgba(79,122,74,.4); }
.status-completed::before, .status-active::before { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-pending { color: var(--warn); border-color: rgba(197,138,44,.4); }
.status-pending::before { background: var(--warn); }
.status-failed, .status-inactive { color: var(--danger); border-color: rgba(177,66,66,.4); }
.status-failed::before, .status-inactive::before { background: var(--danger); }

/* ─── Delete confirmation block ─────────────────────────────────────────── */
.delete-confirmation {
  max-width: 540px;
  margin: 40px auto;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.delete-confirmation::before {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 80px; height: 3px;
  background: var(--clay);
}
.delete-confirmation h2 { font-size: 2rem; margin: 0 0 12px; }
.delete-confirmation form { display: flex; gap: 12px; justify-content: center; margin-top: 20px; }

/* =============================================================================
   AUTH (LOGIN / SIGNUP) PAGES
============================================================================= */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
}

.auth-container {
  width: 100%;
  max-width: 1080px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 0;
  background: var(--panel-solid);
  border: 1px solid var(--rule);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-3);
  min-height: 620px;
}
@media (max-width: 880px) { .auth-container { grid-template-columns: 1fr; } }

.auth-aside {
  position: relative;
  padding: 48px 44px;
  background:
    radial-gradient(ellipse 70% 50% at 20% 10%, rgba(71,85,105,.35), transparent 60%),
    radial-gradient(ellipse 60% 60% at 85% 85%, rgba(176, 196, 216, .12), transparent 65%),
    var(--ink);
  color: var(--paper);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.auth-aside::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 800' opacity='0.12'><path d='M0 700 Q150 500 300 600 T 600 500' stroke='%23ffffff' stroke-width='1' fill='none'/><path d='M0 600 Q150 400 300 500 T 600 400' stroke='%23ffffff' stroke-width='1' fill='none'/><path d='M0 500 Q150 300 300 400 T 600 300' stroke='%23ffffff' stroke-width='1' fill='none'/><path d='M0 400 Q150 200 300 300 T 600 200' stroke='%23ffffff' stroke-width='1' fill='none'/></svg>");
  background-size: cover;
  pointer-events: none;
}
.auth-aside > * { position: relative; z-index: 1; }
.auth-aside .eyebrow { color: rgba(255,255,255,.6); }
.auth-aside .eyebrow::before { background: var(--moss); opacity: 1; }
.auth-aside h2 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 3vw, 3rem);
  font-weight: 400;
  color: var(--paper);
  margin: 24px 0 16px;
}
.auth-aside h2 em { color: var(--moss); font-style: italic; font-weight: 400; }
.auth-aside p { color: rgba(255,255,255,.65); }
.auth-quote {
  border-left: 2px solid var(--moss);
  padding: 8px 0 8px 16px;
  margin-top: auto;
}
.auth-quote p {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--paper);
}
.auth-quote cite {
  font-family: var(--font-sans);
  font-style: normal;
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.55);
}

.auth-card {
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-header { margin-bottom: 28px; }
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.auth-logo h1 { font-size: 1.4rem; margin: 0; font-family: var(--font-sans); font-weight: 600; }

.auth-header h2 {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 600;
  margin: 0 0 6px;
}
.auth-header p { color: var(--ash); font-size: .95rem; margin: 0; }

.auth-form { display: flex; flex-direction: column; gap: 4px; }
.auth-form .form-group { margin-bottom: 18px; }

.auth-footer {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
  font-size: .9rem;
  color: var(--ash);
}
.auth-footer a { color: var(--ink); border-bottom: 1px solid var(--rule-strong); }
.auth-footer a:hover { color: var(--ink); border-color: var(--ink); }

/* Google OAuth button */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 18px;
  background: var(--paper);
  border: 1.5px solid var(--rule-strong);
  border-radius: var(--r-md);
  font-family: var(--font-sans);
  font-size: .95rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: border-color .18s var(--ease-out), box-shadow .18s var(--ease-out);
  margin-bottom: 4px;
}
.btn-google:hover {
  border-color: #4285F4;
  box-shadow: 0 2px 8px rgba(66,133,244,.15);
  color: var(--ink);
}

/* Divider between Google and email form */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--ash-soft);
  font-size: .82rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}

/* =============================================================================
   PUBLIC / MARKETING SHELL
============================================================================= */

.container-wide { max-width: 1240px; margin: 0 auto; padding: 0 32px; }

.public-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245, 242, 240, 0.88);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--rule);
}
.public-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
}

.brand-row { display: flex; align-items: center; }
.brand-link { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: transparent;
  color: var(--paper);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  position: relative;
  overflow: hidden;
}
.brand-logo::after {
  content: "";
  position: absolute;
  inset: -50%;
  background: radial-gradient(circle at 30% 30%, rgba(176, 196, 216, .4), transparent 60%);
  display: none;
}
.brand-logo img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
}
.brand-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: -.02em;
  font-weight: 600;
}

.public-menu { display: flex; align-items: center; gap: 28px; }
.public-menu a {
  font-size: .92rem;
  color: var(--ink-soft);
  position: relative;
  padding: 6px 0;
}
.public-menu a:hover { color: var(--ink); }
.public-menu a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 0; height: 2px;
  background: var(--moss);
  transition: width .25s var(--ease-out);
}
.public-menu a:hover::after { width: 100%; }
.public-menu a.cta {
  padding: 9px 18px;
  border-radius: 10px;
  background: var(--moss);
  color: var(--paper);
}
.public-menu a.cta:hover { background: var(--moss-deep); color: var(--paper); }
.public-menu a.cta::after { display: none; }

.public-main { padding-top: 40px; }

.public-footer {
  margin-top: 80px;
  padding: 50px 0 36px;
  border-top: 1px solid var(--rule);
  background: var(--bone-deep);  /* slightly deeper canvas */
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: .88rem;
  color: var(--ash);
}
.footer-links { display: flex; gap: 22px; }
.footer-links a:hover { color: var(--ink); }

/* ─── Landing sections ──────────────────────────────────────────────────── */
.hero-section {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 60px;
  align-items: center;
  padding: 80px 32px 40px;
  position: relative;
}
@media (max-width: 980px) { .hero-section { grid-template-columns: 1fr; gap: 40px; padding-top: 50px; } }

.hero-copy h1 {
  font-size: clamp(2.6rem, 5.5vw, 5rem);
  margin: 22px 0 20px;
}
.hero-copy h1 em {
  color: var(--ink);
  font-style: italic;
  font-weight: 400;
  position: relative;
  white-space: nowrap;
}
.hero-copy h1 em::after {
  content: "";
  position: absolute;
  left: 0; bottom: 4%;
  background: rgba(163, 163, 163, 0.25);
  z-index: -1;
  border-radius: 4px;
}
.hero-copy p { font-size: 1.15rem; max-width: 52ch; color: var(--ash); }

.hero-actions { display: flex; gap: 12px; margin: 28px 0; flex-wrap: wrap; }

.hero-trust {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px dashed var(--rule-strong);
}
.trust-pill { font-size: .85rem; color: var(--ash); }
.trust-pill strong { font-family: var(--font-sans); color: var(--ink); font-size: 1.4rem; font-weight: 700; display: block; line-height: 1; margin-bottom: 4px; letter-spacing: -.02em; }

/* Visual card on hero right */
.hero-visual {
  position: relative;
  min-width: 0;          /* prevent grid blowout */
}
.hero-visual-card {
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-xl);
  padding: 26px;
  box-shadow: var(--shadow-3);
  position: relative;
  overflow: hidden;
}
.hero-visual-card::before {
  content: "";
  position: absolute;
  inset: -80% -40% auto auto;
  width: 320px; height: 320px;
  background: radial-gradient(circle, var(--moss-glow), transparent 60%);
}
.visual-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-sans);
  font-size: .72rem;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--ash);
  margin-bottom: 22px;
  position: relative;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--success);
  font-weight: 500;
}
.status-pill::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
  animation: livePulse 1.6s var(--ease-stand) infinite;
}
@keyframes livePulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.visual-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 22px;
  position: relative;
}
.visual-metric {
  padding: 18px;
  border-radius: var(--r-md);
  background: var(--bone-deep);
  border: 1px solid var(--rule);
}
.visual-metric strong {
  display: block;
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -.02em;
  line-height: 1;
  margin-bottom: 6px;
}
.visual-metric span { font-size: .78rem; color: var(--ash); }

.visual-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
}
.visual-footer p { margin: 0 0 4px; font-family: var(--font-sans); font-size: .68rem; letter-spacing: .10em; text-transform: uppercase; color: var(--ash); }
.visual-footer strong { font-family: var(--font-sans); font-size: 1.4rem; color: var(--ink); font-weight: 700; letter-spacing: -.02em; }

/* Partner strip */
.partner-strip {
  margin-top: 80px;
  padding: 40px 32px;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 40px;
  align-items: center;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
@media (max-width: 880px) { .partner-strip { grid-template-columns: 1fr; gap: 24px; } }
.partner-copy p { font-size: .92rem; color: var(--ash); margin: 6px 0 0; }
.partner-logos {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.partner-logo {
  font-family: var(--font-sans);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--ash);
  font-style: normal;
  opacity: .7;
  transition: all .3s var(--ease-out);
}
.partner-logo:hover { color: var(--ink); opacity: 1; transform: translateY(-2px); }

/* Feature section */
.feature-section { padding: 100px 32px; }
.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 60px;
  align-items: start;
}
@media (max-width: 980px) { .feature-grid { grid-template-columns: 1fr; gap: 40px; } }
.feature-copy h2 { margin: 22px 0 18px; }
.feature-copy p { color: var(--ash); font-size: 1.05rem; max-width: 44ch; }
.feature-pill-grid { display: flex; flex-direction: column; gap: 10px; margin-top: 28px; }
.feature-pill {
  padding: 12px 16px;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-left: 3px solid var(--ink);
  border-radius: var(--r-md);
  font-size: .92rem;
  color: var(--ink-soft);
  font-family: var(--font-sans);
}

.feature-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 720px) { .feature-cards { grid-template-columns: 1fr; } }

.feature-card {
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-lg);
  padding: 28px;
  position: relative;
  overflow: hidden;
  transition: transform .35s var(--ease-out), box-shadow .35s var(--ease-out);
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); }
.feature-card-hero {
  grid-column: 1 / -1;
  background:
    radial-gradient(ellipse 60% 70% at 100% 0%, rgba(71,85,105,.08), transparent 65%),
    var(--paper);
  border-color: var(--rule);
}
.feature-card-hero h3 { font-size: 1.6rem; margin-bottom: 12px; }
.feature-card-hero ul { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-direction: column; gap: 10px; }
.feature-card-hero li {
  padding-left: 22px;
  position: relative;
  font-size: .95rem;
  color: var(--ink-soft);
}
.feature-card-hero li::before {
  content: "";
  position: absolute;
  left: 0; top: .65em;
  width: 12px; height: 1px;
  background: var(--ash);
}
.feature-card h3 { font-size: 1.2rem; margin-bottom: 8px; }
.feature-card p { color: var(--ash); font-size: .95rem; margin: 0; }

.feature-card.accent-card {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.accent-card h3 { color: var(--paper); }
.accent-card p { color: rgba(255,255,255,.65); }

/* Process section */
.process-section { padding: 80px 32px; border-top: 1px solid var(--rule); }
.section-intro { text-align: center; max-width: 720px; margin: 0 auto 56px; }
.section-intro h2 { margin-top: 16px; }

.process-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  position: relative;
}
@media (max-width: 880px) { .process-grid { grid-template-columns: 1fr; } }

.process-step {
  padding: 32px 24px;
  position: relative;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  transition: transform .35s var(--ease-out), border-color .3s var(--ease-out);
}
.process-step:hover { transform: translateY(-4px); border-color: var(--moss-line); }
.step-badge {
  position: absolute;
  top: -22px; left: 24px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-sans);
  font-size: 1.2rem;
  font-weight: 700;
  border: 4px solid var(--paper);
}
.process-step h3 { font-size: 1.25rem; margin: 14px 0 8px; }
.process-step p { color: var(--ash); font-size: .92rem; margin: 0; }

/* Testimonial */
.testimonial-section { padding: 60px 32px; }
.testimonial-card {
  max-width: 880px;
  margin: 0 auto;
  background: var(--bone-deep);
  border: 1px solid var(--rule);
  border-radius: var(--r-xl);
  padding: 50px 60px;
  text-align: center;
  position: relative;
}
.testimonial-card::before {
  content: "\201C";
  position: absolute;
  top: 6px; left: 32px;
  font-family: var(--font-display);
  font-size: 6rem;
  color: var(--moss);
  line-height: 1;
}
.testimonial-card p {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2vw, 1.7rem);
  font-style: italic;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 18px;
  line-height: 1.4;
}
.testimonial-card strong {
  font-family: var(--font-sans);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ash);
  font-weight: 500;
}

/* CTA */
.cta-section { padding: 60px 32px 100px; }
.cta-card {
  display: grid;
  grid-template-columns: 1.4fr auto;
  gap: 40px;
  align-items: center;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-lg);
  padding: 60px;
  position: relative;
  overflow: hidden;
}
.cta-card::before {
  content: "";
  position: absolute;
  inset: -50% -30% auto auto;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(71,85,105,.30), transparent 60%);
}
.cta-card::after {
  content: "";
  position: absolute;
  bottom: -100px; left: -100px;
  width: 400px; height: 400px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
}
.cta-card > * { position: relative; }
.cta-card h2 {
  color: var(--paper);
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  margin: 14px 0 12px;
}
.cta-card p { color: rgba(255,255,255,.65); margin: 0; max-width: 50ch; }
.cta-card .eyebrow { color: rgba(255,255,255,.5); }
.cta-card .eyebrow::before { background: var(--moss); opacity: 1; }
.cta-card .btn-primary {
  background: var(--paper);
  border-color: var(--paper);
  color: var(--ink);
}
.cta-card .btn-primary:hover { background: var(--bone-deep); border-color: var(--bone-deep); color: var(--ink); }
@media (max-width: 720px) { .cta-card { grid-template-columns: 1fr; padding: 40px; gap: 24px; } }

/* =============================================================================
   AGENT CHAT (legacy single-conversation view)
============================================================================= */
.agent-chat-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 22px;
  height: calc(100dvh - var(--page-top-offset) - 80px);
  min-height: 560px;
}
@media (max-width: 880px) { .agent-chat-shell { grid-template-columns: 1fr; height: auto; } }

.chat-sidebar {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.chat-sidebar h3 {
  font-family: var(--font-sans);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--ash);
  margin: 0 0 12px;
}
.chat-meta dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 14px;
  font-size: .85rem;
  margin: 0;
}
.chat-meta dt { color: var(--ash); font-family: var(--font-sans); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }
.chat-meta dd { color: var(--ink); margin: 0; word-break: break-all; }
.chat-meta dd.mono { font-family: var(--font-sans); font-size: .78rem; background: var(--bone-deep); padding: 2px 8px; border-radius: 6px; display: inline-block; }

.connection-status {
  display: flex; align-items: center; gap: 8px;
  font-size: .85rem; color: var(--ink-soft);
  padding: 12px;
  background: var(--bone-deep);
  border-radius: var(--r-md);
  border: 1px solid var(--rule);
}
.ws-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ash-soft); }
.ws-dot.connected { background: var(--success); box-shadow: 0 0 12px var(--success); animation: livePulse 2s var(--ease-stand) infinite; }
.ws-dot.disconnected { background: var(--danger); }

.typing-indicator {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  background: var(--moss-glow);
  border-radius: var(--r-md);
  border: 1px solid var(--moss-line);
}
.typing-indicator .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ash);
  animation: typingBounce 1.4s infinite ease-in-out;
}
.typing-indicator .dot:nth-child(1) { animation-delay: -.32s; }
.typing-indicator .dot:nth-child(2) { animation-delay: -.16s; }
@keyframes typingBounce { 0%, 80%, 100% { transform: scale(.55); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

.chat-actions-aside { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--rule); }
.btn-back { font-size: .85rem; color: var(--ink); text-align: center; padding: 8px; border-radius: var(--r-md); }
.btn-back:hover { background: var(--moss-glow); }

.chat-main {
  background: var(--panel-solid);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  min-height: 540px;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex; flex-direction: column; gap: 14px;
  background:
    linear-gradient(180deg, var(--paper) 0%, transparent 60px),
    var(--cloud-canvas);
}
.msg { display: flex; flex-direction: column; max-width: 75%; animation: msgFade .3s var(--ease-out); }
.msg-user { align-self: flex-start; }
.msg-agent { align-self: flex-end; }
.msg-assistant { align-self: flex-start; }
.msg-system { align-self: center; max-width: 90%; }

.msg-bubble {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: .92rem;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}
.msg-user .msg-bubble {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-bottom-left-radius: 4px;
}
.msg-agent .msg-bubble {
  background: var(--ink);
  color: var(--paper);
  border-bottom-right-radius: 4px;
}
.msg-assistant .msg-bubble {
  background: var(--moss-glow);
  color: var(--ink-soft);
  border: 1px solid var(--moss-line);
  border-bottom-left-radius: 4px;
}
.msg-system .msg-bubble {
  background: transparent;
  color: var(--ash);
  border: 1px dashed var(--rule-strong);
  font-family: var(--font-sans);
  font-size: .78rem;
  text-align: center;
}
.msg-time { font-size: .68rem; color: var(--ash); margin-top: 4px; padding: 0 4px; font-family: var(--font-sans); letter-spacing: .04em; }
.msg-agent .msg-time { text-align: right; }
@keyframes msgFade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.chat-input-area {
  border-top: 1px solid var(--rule);
  padding: 16px;
  display: flex; gap: 10px; align-items: flex-end;
  background: var(--paper);
}
#agent-input {
  flex: 1; resize: none;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-family: var(--font-sans);
  font-size: .92rem; line-height: 1.5;
  background: var(--bone);
  outline: none;
  transition: all .2s;
}
#agent-input:focus { background: var(--paper); border-color: var(--rule-strong); box-shadow: 0 0 0 4px var(--moss-glow); }
#send-btn {
  background: var(--moss);
  color: var(--paper);
  border: none;
  border-radius: var(--r-md);
  padding: 12px 24px;
  font-weight: 600;
  font-size: .9rem;
  transition: background .2s;
}
#send-btn:hover:not(:disabled) { background: var(--moss-deep); }
.hidden { display: none !important; }

/* ─── Table wrapper — only the table scrolls, not the whole page ────────── */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r-lg);
}
/* Prevent table from forcing horizontal page scroll */
.bots-table,
.agents-table,
.data-table {
  min-width: 560px; /* tables won't collapse below this */
}

/* =============================================================================
   RESPONSIVE — NAVBAR + PAGE
============================================================================= */

/* Tablet: shrink side gaps */
@media (max-width: 900px) {
  :root {
    --navbar-side-gap: 12px;
    --navbar-top-gap: 10px;
  }
  .page-main { padding: 0 var(--space-5) var(--space-12); }
}

/* Mobile: show hamburger, collapse nav into dropdown panel */
@media (max-width: 720px) {
  :root {
    --navbar-side-gap: 8px;
    --navbar-top-gap: 8px;
    --navbar-h: 56px;
  }

  .navbar-mobile-toggle { display: flex; }
  /* Keep brand name visible — fills the empty space between logo and hamburger */
  .navbar-brand-name { display: block; font-size: 1.05rem; }
  /* Hide the CTA from the capsule — it lives in the mobile panel instead */
  .navbar-cta { display: none; }
  /* Hide the plan badge from the capsule — it moves into the profile dropdown header */
  .navbar-right > .plan-badge { display: none; }
  /* Show the in-dropdown plan badge on mobile */
  .profile-dropdown-plan-badge { display: block; }
  /* Push the hamburger to the far right of the capsule.
     Without navbar-nav (flex:1) in the flow, nothing else does this. */
  .navbar-right { margin-left: auto; }

  /* Nav slides in from top as a panel */
  .navbar-nav {
    position: fixed;
    top: calc(var(--navbar-h) + var(--navbar-top-gap) * 2 + 8px);
    left: var(--navbar-side-gap);
    right: var(--navbar-side-gap);
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid var(--rule-strong);
    border-radius: 20px;
    box-shadow: var(--shadow-3);
    padding: 10px 10px 14px;
    z-index: 95;
    justify-content: flex-start;
    /* hidden until [data-mobile-open] */
    display: none;
  }
  .navbar-nav[data-mobile-open] { display: flex; flex-direction: column; align-items: stretch; }

  /* Keep the panel scrollable on short / landscape viewports */
  .navbar-nav {
    max-height: calc(100dvh - var(--navbar-h) - var(--navbar-top-gap) * 2 - 24px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .navbar-nav-list {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 2px;
  }
  .navbar-nav-item {
    justify-content: flex-start;
    padding: 10px 14px;
    border-radius: var(--r-md);
    font-size: .9rem;
  }
  /* Mobile group dropdowns — inline expand */
  .navbar-nav-group { position: static; }
  .navbar-dropdown {
    position: static;
    transform: none;
    border: none;
    box-shadow: none;
    background: var(--bone-deep);
    border-radius: var(--r-md);
    margin: 4px 0 4px 14px;
    padding: 4px;
  }
  .navbar-dropdown[data-open] { display: block; }
  @keyframes dropdownFade {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
  }

  /* CTA inside the mobile panel — full-width pill button at the bottom */
  .navbar-mobile-cta {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 12px 18px;
    background: var(--ink);
    color: var(--paper);
    border-radius: var(--r-md);
    font-family: var(--font-sans);
    font-size: .92rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    letter-spacing: -.01em;
    transition: background .18s var(--ease-out);
  }
  .navbar-mobile-cta:hover { background: var(--moss-deep); color: var(--paper); }

  .page-main { padding: 0 var(--space-4) var(--space-10); }
  .page-header { padding: 20px 0 16px; margin-bottom: 24px; }

  .auth-form input,
  .auth-form select,
  .auth-form textarea { width: 100%; }
}

/* ── Touch devices: enforce ≥44px targets & visible tap states ─────────── */
@media (pointer: coarse) {
  .btn, .btn-primary, .btn-secondary, .btn-ghost, .btn-danger,
  .btn-outline, .btn-cancel, .btn-edit, .btn-delete, .btn-sm {
    min-height: 44px;
  }
  .btn-icon, .page-link, .message-dismiss, .filter-tab,
  .navbar-mobile-toggle, .navbar-avatar {
    min-width: 44px;
    min-height: 44px;
  }
  .navbar-nav-item, .navbar-dropdown-item, .profile-dropdown-item {
    min-height: 44px;
  }
  /* Distinct tap feedback (hover-only affordances don't exist on touch) */
  .btn:active, .btn-primary:active, .btn-secondary:active, .btn-ghost:active,
  .btn-danger:active, .btn-outline:active, .btn-cancel:active,
  .btn-edit:active, .btn-delete:active, .action-btn:active,
  .navbar-nav-item:active, .page-link:active, .filter-tab:active {
    transform: scale(.97);
    opacity: .85;
  }
}

@media (max-width: 640px) {
  .btn-block-mobile { width: 100%; }
  .form-grid { grid-template-columns: 1fr !important; }

  :root {
    --height-md: 48px;
    --height-lg: 56px;
  }

  /* Card transform applies regardless of base table class, and unlocks
     the min-width floor so cards can shrink to the viewport */
  .data-table--card { min-width: 0; table-layout: auto; }
  .data-table--card thead { display: none; }
  .data-table--card tr {
    display: block;
    border: 1px solid var(--rule);
    border-radius: var(--r-md);
    margin-bottom: var(--space-3);
    background: var(--paper);
  }
  .data-table--card td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
    border-bottom: 1px solid var(--rule);
    font-size: var(--text-sm);
    min-height: 36px;
  }
  .data-table--card td:last-child { border-bottom: none; }
  .data-table--card td::before {
    content: attr(data-label);
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ash);
    font-weight: 600;
    flex-shrink: 0;
  }
}

@media (max-width: 640px) {
  .public-nav { padding: 14px 20px; }
  .container-wide { padding: 0 20px; }
  .public-menu { gap: 14px; }
  .public-menu a { font-size: .85rem; }
  .auth-card, .auth-aside { padding: 32px 24px; }
  h1 { font-size: 2.4rem; }
  h2 { font-size: 1.7rem; }
  .feature-section, .process-section, .cta-section { padding: 60px 20px; }
}

/* =============================================================================
   LANDING PAGE — NEW SECTIONS (v2)
============================================================================= */

/* ─── Hero trust line ───────────────────────────────────────────────────── */
.hero-trust-line {
  font-size: .85rem;
  color: var(--ash);
  margin: 0 0 16px;
  letter-spacing: .01em;
}

/* ─── Stats strip ───────────────────────────────────────────────────────── */
.stats-strip {
  margin-top: 80px;
  padding: 44px 32px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.stats-strip-top { margin-bottom: 4px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}
@media (max-width: 720px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 24px; }
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-right: 28px;
  border-right: 1px solid var(--rule-strong);
}
.stat-item:last-child { border-right: none; padding-right: 0; }

.stat-item strong {
  font-family: var(--font-sans);
  font-size: clamp(2rem, 3.2vw, 2.8rem);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.035em;
  line-height: 1;
}
.stat-item span {
  font-family: var(--font-sans);
  font-size: .68rem;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--ash);
}

.stats-strip .partner-logos {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 36px;
  flex-wrap: wrap;
  padding-top: 18px;
  border-top: 1px dashed var(--rule-strong);
}

/* ─── Use Cases ─────────────────────────────────────────────────────────── */
.usecase-section {
  padding: 100px 32px;
  border-top: 1px solid var(--rule);
}

.usecase-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-top: 56px;
}
@media (max-width: 880px) { .usecase-grid { grid-template-columns: 1fr; } }

.usecase-card {
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-lg);
  padding: 34px 28px;
  position: relative;
  overflow: hidden;
  transition: transform .35s var(--ease-out), box-shadow .35s var(--ease-out);
}
.usecase-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 52px; height: 2px;
  background: var(--ink);
}
.usecase-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); }

.usecase-icon {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  background: var(--bone-deep);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-md);
  color: var(--ink);
  margin-bottom: 20px;
}

.usecase-card h3 { font-size: 1.25rem; margin-bottom: 6px; }

.usecase-outcome {
  display: block;
  font-family: var(--font-sans);
  font-size: .7rem;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--ash);
  font-weight: 600;
  margin: 0 0 14px;
}

.usecase-card > p { font-size: .95rem; color: var(--ash); margin: 0; }

/* ─── Testimonials grid ─────────────────────────────────────────────────── */
.testimonials-section {
  padding: 80px 32px;
  border-top: 1px solid var(--rule);
  background:
    radial-gradient(ellipse 70% 60% at 95% 10%, rgba(176, 196, 216, .10), transparent 65%),
    radial-gradient(ellipse 50% 40% at 5% 90%, rgba(71,85,105,.07), transparent 60%),
    var(--bone-deep);
}

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-top: 52px;
}
@media (max-width: 880px) { .testimonials-grid { grid-template-columns: 1fr; } }

.testimonial-grid-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 34px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  overflow: hidden;
  transition: transform .35s var(--ease-out), box-shadow .35s var(--ease-out);
}
.testimonial-grid-card::before {
  content: "\201C";
  position: absolute;
  top: 4px; right: 18px;
  font-family: var(--font-display);
  font-size: 5.5rem;
  color: var(--moss);
  line-height: 1;
  opacity: .55;
  pointer-events: none;
}
.testimonial-grid-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }

.testimonial-grid-card > p {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-style: italic;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.55;
  margin: 0;
  flex: 1;
}

.testimonial-grid-card footer {
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.testimonial-grid-card footer strong {
  font-family: var(--font-sans);
  font-size: .92rem;
  font-weight: 500;
  color: var(--ink);
}
.testimonial-grid-card footer span {
  font-family: var(--font-sans);
  font-size: .67rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ash);
}

/* ─── Pricing teaser ────────────────────────────────────────────────────── */
.pricing-section {
  padding: 80px 32px;
  border-top: 1px solid var(--rule);
}

.pricing-card {
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-xl);
  padding: 60px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 64px;
  align-items: start;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-2);
}
.pricing-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto auto;
  width: 450px; height: 350px;
  background: radial-gradient(ellipse at 80% 20%, rgba(176, 196, 216, .12), transparent 65%);
  pointer-events: none;
}
.pricing-card::after {
  content: "";
  position: absolute;
  bottom: -80px; left: -80px;
  width: 300px; height: 300px;
  border: 1px solid rgba(71,85,105,.18);
  border-radius: 50%;
  pointer-events: none;
}
.pricing-card > * { position: relative; }

@media (max-width: 880px) {
  .pricing-card { grid-template-columns: 1fr; padding: 40px 32px; gap: 36px; }
}

.pricing-header .eyebrow { margin-bottom: 16px; }
.pricing-header h2 { margin: 0 0 14px; }
.pricing-header p {
  color: var(--ash);
  font-size: 1.02rem;
  max-width: 44ch;
  margin: 0;
  line-height: 1.65;
}

.pricing-highlights {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 28px;
}
.pricing-highlight {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .95rem;
  color: var(--ink-soft);
}
.pricing-highlight svg {
  flex-shrink: 0;
  color: var(--ink);
  background: var(--moss-glow);
  border-radius: 50%;
  padding: 3px;
  width: 24px; height: 24px;
}

.pricing-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pricing-actions .btn-primary,
.pricing-actions .btn-outline {
  width: 100%;
  justify-content: center;
  text-align: center;
}

/* ─── FAQ ───────────────────────────────────────────────────────────────── */
.faq-section {
  padding: 80px 32px;
  border-top: 1px solid var(--rule);
}

.faq-grid {
  max-width: 780px;
  margin: 52px auto 0;
  display: flex;
  flex-direction: column;
}

.faq-item {
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-top: none;
  overflow: hidden;
  transition: box-shadow .25s var(--ease-out);
}
.faq-item:first-child {
  border-top: 1px solid var(--rule-strong);
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.faq-item:last-child {
  border-radius: 0 0 var(--r-md) var(--r-md);
}
.faq-item[open] {
  box-shadow: var(--shadow-1);
  z-index: 1;
  position: relative;
  border-color: var(--rule-strong);
}

.faq-item summary {
  padding: 20px 24px;
  font-family: var(--font-sans);
  font-size: .97rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: background .2s var(--ease-out);
  user-select: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--ash);
  flex-shrink: 0;
  line-height: 1;
  transition: transform .3s var(--ease-out);
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item summary:hover { background: var(--bone-deep); }

.faq-item > p {
  padding: 0 24px 22px;
  font-size: .95rem;
  color: var(--ash);
  line-height: 1.65;
  margin: 0;
  border-top: 1px solid var(--rule);
  padding-top: 16px;
}

/* ─── Enhanced footer ───────────────────────────────────────────────────── */
.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.footer-tagline {
  font-size: .88rem;
  color: var(--ash);
  line-height: 1.6;
  margin: 0;
  max-width: 22ch;
}

/* Override the old flex-based footer-inner for the new grid layout */
.public-footer .footer-inner {
  display: grid;
  grid-template-columns: 1.1fr 2fr;
  gap: 56px;
  align-items: start;
  padding-bottom: 44px;
  flex-direction: unset;
  justify-content: unset;
}
@media (max-width: 800px) {
  .public-footer .footer-inner { grid-template-columns: 1fr; gap: 36px; }
}

.footer-columns {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
}
@media (max-width: 720px) { .footer-columns { grid-template-columns: repeat(2, 1fr); gap: 22px; } }

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.footer-col h4 {
  font-family: var(--font-sans);
  font-size: .64rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ash-soft);
  margin: 0 0 6px;
}
.footer-col a {
  font-size: .87rem;
  color: var(--ash);
  transition: color .2s var(--ease-out);
}
.footer-col a:hover { color: var(--ink); }

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}
.footer-bottom p {
  font-size: .82rem;
  color: var(--ash-soft);
  margin: 0;
}

/* ─── Additional responsive tweaks ─────────────────────────────────────── */
@media (max-width: 640px) {
  .usecase-section,
  .testimonials-section,
  .pricing-section,
  .faq-section { padding: 60px 20px; }
  .pricing-card { padding: 32px 24px; }
  .stats-strip { padding: 36px 20px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PLAN BADGE & UPGRADE BANNERS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Plan badge in header */
.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3); /* 4px 12px */
  border-radius: 20px;
  font-size: var(--text-xs);  /* 12px — consistent with scale */
  font-weight: 600;
  letter-spacing: .03em;
  text-decoration: none;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: opacity .15s;
}
.plan-badge:hover { opacity: .8; }

.plan-badge--free       { background: var(--bone-deep); color: var(--ash); border-color: var(--rule-strong); }
.plan-badge--growth     { background: var(--moss-glow); color: var(--moss);      border-color: var(--moss-line); }
.plan-badge--pro        { background: var(--plan-pro-bg); color: var(--plan-pro-text); border-color: var(--plan-pro-line); }
.plan-badge--enterprise { background: var(--plan-ent-bg); color: var(--plan-ent-text); border-color: var(--plan-ent-line); }

/* Trial badge pulses gently */
.plan-badge--growth .plan-badge--trial-active {
  animation: badge-pulse 2.5s ease-in-out infinite;
}
@keyframes badge-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .7; }
}

/* Plan banners */
.plan-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-5); /* 8px 20px */
  border-radius: var(--r-md);
  font-size: var(--text-sm); /* 14px — on scale */
  margin-bottom: var(--space-4);
  border: 1px solid transparent;
  flex-wrap: wrap;
}
.plan-banner--trial   { background: var(--moss-glow); color: var(--moss);      border-color: var(--moss-line); }
.plan-banner--warning { background: rgba(197,138,44,.12); color: var(--warn); border-color: rgba(197,138,44,.4); }
.plan-banner--free    { background: var(--bone-deep);   color: var(--ash);       border-color: var(--rule-strong); }

.plan-banner__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-4); /* Remove vertical padding, rely on height + flex centering */
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-md);
  font-size: var(--text-xs); /* 12px */
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s var(--ease-out);
  height: 28px;
  align-self: center;
}
.plan-banner__cta:hover { background: var(--ash); }

/* Inline upgrade gate — shown when a feature is locked */
.upgrade-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-8) var(--space-6); /* 32px 24px */
  border: 1.5px dashed var(--rule-strong);
  border-radius: var(--r-md);
  background: var(--paper);
  text-align: center;
  color: var(--ash);
  font-size: var(--text-sm);
}
.upgrade-gate svg { opacity: .4; }
.upgrade-gate strong { color: var(--ink-soft); font-size: var(--text-base); }
.upgrade-gate a {
  display: inline-block;
  padding: var(--space-2) var(--space-5);
  background: var(--moss);
  color: var(--paper);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  margin-top: var(--space-1);
  min-height: var(--height-sm);
  transition: background .15s var(--ease-out);
}
.upgrade-gate a:hover { background: var(--moss-deep); }

/* Usage bar */
.usage-bar-wrap { margin-top: 6px; }
.usage-bar-label {
  font-size: var(--text-xs);
  color: var(--ash);
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-1);
}
.usage-bar { height: 5px; background: var(--cream); border-radius: 99px; overflow: hidden; }
.usage-bar__fill { height: 100%; background: var(--ink); border-radius: 99px; transition: width .5s ease; }
.usage-bar__fill--warn  { background: var(--warn); }
.usage-bar__fill--limit { background: var(--clay); }

/* ─── Responsive Webhook Parameter Grids ─────────────────────────────────── */
.webhook-param-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 100px 80px;
  gap: var(--space-2);
  align-items: end;
}
.webhook-param-subgrid {
  display: grid;
  grid-template-columns: 1fr 60px;
  gap: var(--space-2);
  margin-top: var(--space-2);
  align-items: end;
}
@media (max-width: 640px) {
  .webhook-param-grid,
  .webhook-param-subgrid {
    grid-template-columns: 1fr !important;
    gap: var(--space-3) !important;
  }
}

/* ─── Global Custom Dropdowns (Theme Matching) ────────────────────────── */
.custom-dropdown {
  position: relative;
  display: inline-block;
}
.custom-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: .82rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--r-md); /* standard select rounded corner 10px */
  border: 1px solid var(--rule);
  background-color: var(--panel-solid);
  color: var(--ink);
  cursor: pointer;
  transition: border-color .18s, color .18s, background-color .18s, box-shadow .18s;
  min-height: 36px;
  width: 100%;
}
.custom-dropdown-trigger:hover,
.custom-dropdown-trigger:focus {
  border-color: var(--rule-strong);
  background-color: var(--paper);
  outline: none;
}
.custom-dropdown-trigger:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.custom-dropdown-chevron {
  margin-left: auto;
  opacity: .55;
  transition: transform .25s var(--ease-out);
  flex-shrink: 0;
}
.custom-dropdown-trigger[aria-expanded="true"] .custom-dropdown-chevron {
  transform: rotate(180deg);
  opacity: 1;
}

.custom-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 180px;
  background: var(--panel-solid);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-3);
  margin: 0;
  padding: 4px;
  list-style: none;
  z-index: 200;
  display: none;
  animation: customDropdownFade .18s var(--ease-out);
}
.custom-dropdown-menu[data-open] {
  display: block;
}

@keyframes customDropdownFade {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.custom-dropdown-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  font-family: var(--font-sans);
  font-size: .82rem;
  font-weight: 500;
  color: var(--ink-soft);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .15s var(--ease-out), color .15s var(--ease-out);
  text-align: left;
}
.custom-dropdown-item:hover {
  background: var(--bone-deep);
  color: var(--ink);
}
.custom-dropdown-item.active {
  background: var(--ink);
  color: var(--paper);
}

/* Modifier: Pill shape for dashboard filters */
.custom-dropdown--pill .custom-dropdown-trigger {
  border-radius: 999px;
  background-color: var(--bone-deep);
  color: var(--ash);
  min-height: 32px;
  padding: 6px 14px;
  width: auto;
}
.custom-dropdown--pill .custom-dropdown-trigger:hover,
.custom-dropdown--pill .custom-dropdown-trigger:focus {
  border-color: var(--rule-strong);
  color: var(--ink);
  background-color: var(--paper);
}

/* ─── Skip-to-content link (keyboard navigation) ────────────────────────── */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 1000;
  padding: 10px 18px;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-pill);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-2);
  transition: top .2s var(--ease-out);
}
.skip-link:focus-visible {
  top: 16px;
  outline: 2px solid var(--paper);
  outline-offset: 2px;
}

/* ─── Global reduced-motion guard ───────────────────────────────────────
   Disables animations/transitions/smooth-scroll for users who request it.
   The button loading spinner is exempted: its motion conveys state. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .btn-loading::after {
    animation-duration: 0.65s !important;
    animation-iteration-count: infinite !important;
  }
}

