/* ─────────────────────────────────────────────────────────────────────
   cally dashboard — refined, light, productivity-grade.
   Inspired by Retell AI's information density and restraint.
   Single signature accent: dark blue. Everything else is neutral.
   ───────────────────────────────────────────────────────────────────── */

:root {
  /* Surfaces */
  --surface-app:        #FBFBFD;
  --surface-rail:       #F4F5F8;
  --surface-card:       #FFFFFF;
  --surface-soft:       #F7F8FB;
  --surface-sunken:     #F0F1F5;
  --surface-overlay:    rgba(15, 17, 21, 0.45);

  /* Borders */
  --border-faint:       #ECEDF1;
  --border-soft:        #E4E6EC;
  --border:             #D8DAE2;
  --border-strong:      #C1C5D0;

  /* Text */
  --text-strong:        #0B0D12;
  --text:               #1A1D24;
  --text-soft:          #4F5564;
  --text-muted:         #757B8A;
  --text-quiet:         #A3A8B5;
  --text-on-accent:     #FFFFFF;

  /* Accent — Cally signature */
  --accent:             #03045E;
  --accent-strong:      #010135;
  --accent-deep:        #03045E;
  --accent-soft:        #E8ECF6;
  --accent-faint:       #F4F6FB;
  --accent-ring:        rgba(3, 4, 94, 0.22);
  --accent-grad:        linear-gradient(135deg, #023E8A 0%, #03045E 62%, #010135 100%);

  /* Semantic */
  --success:            #15803D;
  --success-bg:         #ECFDF3;
  --success-border:     #BBF7D0;
  --warning:            #B45309;
  --warning-bg:         #FFFBEB;
  --warning-border:     #FCD34D;
  --danger:             #B91C1C;
  --danger-bg:          #FEF2F2;
  --danger-border:      #FECACA;
  --info:               #1D4ED8;
  --info-bg:            #EFF6FF;
  --info-border:        #BFDBFE;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(15, 17, 21, 0.04);
  --shadow-sm:  0 1px 3px rgba(15, 17, 21, 0.06), 0 1px 2px rgba(15, 17, 21, 0.04);
  --shadow-md:  0 6px 18px -8px rgba(15, 17, 21, 0.10), 0 2px 4px -1px rgba(15, 17, 21, 0.05);
  --shadow-lg:  0 24px 48px -20px rgba(15, 17, 21, 0.20), 0 8px 16px -8px rgba(15, 17, 21, 0.08);
  --shadow-focus: 0 0 0 3px var(--accent-ring);

  /* Radius */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 9999px;

  /* Type */
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", "Menlo", monospace;

  /* Layout */
  --rail-w: 264px;
  --topbar-h: 60px;
  --page-max: 1180px;
  --gutter: 28px;

  /* Motion */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.4, 0, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

/* ─── Reset / base ────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11" on, "ss01" on, "ss03" on;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: var(--text); text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 0;
  box-shadow: var(--shadow-focus);
  border-color: var(--accent) !important;
}
img, svg { display: block; max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--border-faint); margin: 0; }

::selection { background: var(--accent-soft); color: var(--accent-deep); }

/* Skip link */
.skip-link {
  position: fixed;
  top: -64px;
  left: 16px;
  z-index: 999;
  background: var(--text-strong);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  transition: top .18s var(--ease-out);
}
.skip-link:focus { top: 16px; }

/* ─── Boot screen ─────────────────────────────────────────────────── */

.boot {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px;
  background: var(--surface-app);
}
.boot__spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--border-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.boot__label { color: var(--text-muted); font-size: 13px; margin: 0; }

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

/* ─── Auth view ───────────────────────────────────────────────────── */

.auth {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--surface-app);
}
.auth__form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  min-height: 100dvh;
}
.auth__form-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.auth__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}
.auth__brand-mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  color: var(--accent);
}
.auth__brand-mark svg { width: 26px; height: 26px; transform: translateY(-0.5px); }
.auth__brand-suffix { color: var(--accent); font-weight: 600; }

.auth__title {
  margin: 8px 0 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text-strong);
}
.auth__subtitle { margin: 0; color: var(--text-soft); font-size: 14px; }

.auth__tabs {
  display: inline-flex;
  padding: 4px;
  background: var(--surface-sunken);
  border-radius: var(--r-md);
  align-self: flex-start;
  margin-top: 8px;
}
.auth__tab {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  border-radius: var(--r-sm);
  transition: all .15s var(--ease-out);
}
.auth__tab[aria-selected="true"] {
  background: var(--surface-card);
  color: var(--text-strong);
  box-shadow: var(--shadow-xs);
}

.auth__google {
  width: 100%;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-card);
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out), transform .15s var(--ease-out);
}
.auth__google:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.auth__google:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.auth__google svg { flex: 0 0 auto; }

.auth__divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1;
}
.auth__divider::before,
.auth__divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border-soft);
}

.auth__form { display: grid; gap: 14px; margin-top: 4px; }
.auth__error {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  font-size: 13px;
  line-height: 1.45;
}
.auth__error svg { flex: 0 0 auto; margin-top: 1px; }

.auth__submit { width: 100%; }
.auth__legal {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.auth__legal a {
  color: var(--text);
  display: inline-block;
  padding: 2px 0;
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
}
.auth__legal a:hover { text-decoration-color: var(--text-muted); }

/* Hero side — never overwhelming, soft + atmospheric */
.auth__hero-side {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px;
  overflow: hidden;
  background:
    radial-gradient(1100px 600px at 110% -10%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(800px 700px at -20% 110%, rgba(99, 102, 241, 0.12), transparent 65%),
    linear-gradient(180deg, #11122A 0%, #0B0C1E 100%);
  color: #E5E7F0;
}
.auth__hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(900px 600px at 70% 40%, #000 30%, transparent 75%);
}
.auth__hero-eyebrow {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 500;
  color: rgba(229, 231, 240, 0.7);
  padding: 6px 10px;
  border-radius: var(--r-full);
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  width: max-content;
  backdrop-filter: blur(6px);
}
.auth__hero-eyebrow::before {
  content: "";
  width: 6px; height: 6px;
  background: #34D399; border-radius: 50%;
  box-shadow: 0 0 12px #34D399;
}
.auth__hero-headline {
  position: relative;
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 24px 0 0;
  max-width: 480px;
  color: #F4F5FB;
}
.auth__hero-headline em {
  font-style: normal;
  background: linear-gradient(120deg, #90E0EF 0%, #CAF0F8 50%, #FFFFFF 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth__hero-sub {
  position: relative;
  color: rgba(229, 231, 240, 0.66);
  font-size: 14.5px;
  line-height: 1.55;
  max-width: 440px;
  margin: 16px 0 0;
}
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth__hero-side { display: none; }
  .auth__form-side { min-height: auto; padding: 32px 24px; }
}

/* ─── App shell ───────────────────────────────────────────────────── */

.app {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  min-height: 100dvh;
  background: var(--surface-app);
}

/* ─── Rail (left sidebar) ─────────────────────────────────────────── */

.rail {
  position: sticky; top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface-rail);
  border-right: 1px solid var(--border-faint);
  padding: 14px 12px;
  overflow: hidden;
}
.rail__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 14px;
}
.rail__brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 600; font-size: 15px; letter-spacing: -0.015em;
  color: var(--text-strong);
}
.rail__brand-mark {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  color: var(--accent);
}
.rail__brand-mark svg { width: 22px; height: 22px; }
.rail__brand-suffix { color: var(--accent); }

.rail__head-icon {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  color: var(--text-muted);
}
.rail__head-icon:hover { color: var(--text); background: rgba(15,17,21,.04); }

.rail__workspace {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  background: var(--surface-card);
  border: 1px solid var(--border-faint);
  box-shadow: var(--shadow-xs);
  margin: 0 0 16px;
  min-width: 0;
}
.rail__workspace-avatar {
  width: 26px; height: 26px;
  border-radius: 7px;
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft);
  flex: 0 0 auto;
}
.rail__workspace-name {
  font-size: 13px; font-weight: 500; color: var(--text-strong);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1;
}
.rail__workspace-meta {
  font-size: 11px; color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.rail__nav { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; flex: 1; padding-bottom: 8px; }
.rail__nav::-webkit-scrollbar { width: 6px; }
.rail__nav::-webkit-scrollbar-thumb { background: var(--border-soft); border-radius: 4px; }
.rail__section { display: flex; flex-direction: column; gap: 2px; }
.rail__section-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-quiet);
  padding: 8px 10px 4px;
}
.rail__item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-soft);
  cursor: pointer;
  position: relative;
  transition: background .12s var(--ease-out), color .12s var(--ease-out);
}
.rail__item:hover { background: rgba(15,17,21,.045); color: var(--text-strong); }
.rail__item[aria-current="page"] {
  background: var(--surface-card);
  color: var(--text-strong);
  box-shadow: var(--shadow-xs);
}
.rail__item[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -12px; top: 50%;
  width: 3px; height: 18px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
  transform: translateY(-50%);
}
.rail__item-icon { color: var(--text-muted); flex: 0 0 auto; }
.rail__item[aria-current="page"] .rail__item-icon { color: var(--accent); }
.rail__item-badge {
  margin-left: auto;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-quiet);
  background: var(--surface-sunken);
  padding: 2px 6px;
  border-radius: var(--r-xs);
}

/* Setup card pinned bottom-left */
.rail__foot {
  display: flex; flex-direction: column; gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-faint);
}
.rail__setup {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--surface-card);
  border: 1px solid var(--border-faint);
}
.rail__setup-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--text-soft);
}
.rail__setup-title { font-weight: 600; color: var(--text-strong); font-size: 12.5px; }
.rail__setup-progress {
  height: 4px; background: var(--surface-sunken);
  border-radius: var(--r-full); overflow: hidden;
}
.rail__setup-bar {
  height: 100%;
  background: var(--accent-grad);
  border-radius: inherit;
  transition: width .4s var(--ease-out);
}
.rail__setup-steps { display: flex; flex-direction: column; gap: 6px; }
.rail__setup-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
  color: var(--text-soft);
}
.rail__setup-step.is-done { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--border); }
.rail__setup-step-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px solid var(--border);
  color: transparent;
  flex: 0 0 auto;
}
.rail__setup-step.is-done .rail__setup-step-dot {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.rail__help {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-soft);
  border-radius: var(--r-sm);
}
.rail__help:hover { color: var(--text-strong); background: rgba(15,17,21,.04); }

/* ─── Topbar ──────────────────────────────────────────────────────── */

.topbar {
  position: sticky; top: 0;
  z-index: 10;
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 0 var(--gutter);
  background: rgba(251, 251, 253, 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border-faint);
}
.topbar__title {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-strong);
}
.topbar__title-icon {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  color: var(--text-soft);
}
.topbar__crumb-sep { color: var(--text-quiet); font-weight: 300; }
.topbar__crumb-faded { color: var(--text-muted); font-weight: 500; }
.topbar__actions { display: flex; align-items: center; gap: 8px; }
.topbar__avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent-grad);
  color: #fff;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: var(--shadow-xs), inset 0 0 0 1px rgba(255,255,255,0.18);
}

/* ─── Content frame ───────────────────────────────────────────────── */

.frame {
  display: flex; flex-direction: column;
  min-width: 0;
}
.page {
  flex: 1;
  padding: 28px var(--gutter) 64px;
  max-width: var(--page-max);
  width: 100%;
  margin: 0 auto;
}
.page__header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page__title {
  font-size: 24px;
  letter-spacing: -0.025em;
  font-weight: 600;
  color: var(--text-strong);
  margin: 0 0 4px;
}
.page__lead { color: var(--text-soft); font-size: 14px; margin: 0; max-width: 60ch; }
.page__actions { display: flex; gap: 8px; align-items: center; }

/* ─── Components: buttons ─────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--text-strong);
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-xs);
  transition:
    background .12s var(--ease-out),
    border-color .12s var(--ease-out),
    color .12s var(--ease-out),
    transform .12s var(--ease-out);
}
.btn:hover { background: var(--surface-soft); border-color: var(--border); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.55; cursor: not-allowed; transform: none;
}
.btn--primary {
  color: var(--text-on-accent);
  background: var(--text-strong);
  border-color: var(--text-strong);
}
.btn--primary:hover { background: #000; border-color: #000; }
.btn--accent {
  color: var(--text-on-accent);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px rgba(255,255,255,0.12);
}
.btn--accent:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn--ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--text-soft);
}
.btn--ghost:hover { background: rgba(15,17,21,.04); color: var(--text-strong); }
.btn--danger {
  color: var(--danger);
  background: var(--surface-card);
  border-color: var(--danger-border);
}
.btn--danger:hover { background: var(--danger-bg); }
.btn--sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn--icon { width: 36px; padding: 0; }
.btn--icon.btn--sm { width: 30px; }
.btn--block { width: 100%; }

.btn[aria-busy="true"] {
  pointer-events: none;
  position: relative;
  color: transparent !important;
}
.btn[aria-busy="true"]::after {
  content: "";
  position: absolute; inset: 0;
  margin: auto;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-color: rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  color: #fff;
}
.btn--ghost[aria-busy="true"]::after,
.btn:not(.btn--primary):not(.btn--accent)[aria-busy="true"]::after {
  border-color: var(--border);
  border-top-color: var(--accent);
}

/* ─── Components: cards ───────────────────────────────────────────── */

.card {
  background: var(--surface-card);
  border: 1px solid var(--border-faint);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}
.card__head {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border-faint);
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px;
}
.card__title-wrap { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.card__title {
  font-size: 14.5px; font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text-strong);
  margin: 0;
}
.card__sub { color: var(--text-muted); font-size: 12.5px; margin: 0; }
.card__body { padding: 18px 22px 22px; }
.card__foot {
  padding: 12px 22px;
  border-top: 1px solid var(--border-faint);
  background: var(--surface-soft);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ─── Components: pills / badges ──────────────────────────────────── */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px;
  padding: 0 8px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: var(--r-full);
  border: 1px solid transparent;
  background: var(--surface-sunken);
  color: var(--text-soft);
  letter-spacing: 0.005em;
  white-space: nowrap;
}
.pill__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
  flex: 0 0 auto;
}
.pill--success { color: var(--success); background: var(--success-bg); border-color: var(--success-border); }
.pill--warning { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-border); }
.pill--danger  { color: var(--danger);  background: var(--danger-bg);  border-color: var(--danger-border); }
.pill--info    { color: var(--info);    background: var(--info-bg);    border-color: var(--info-border); }
.pill--accent  { color: var(--accent-deep); background: var(--accent-soft); border-color: var(--accent-soft); }
.pill--muted   { color: var(--text-soft); background: var(--surface-sunken); border-color: var(--border-faint); }

/* ─── Components: form ────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-strong);
  display: flex; align-items: center; gap: 6px;
}
.field__hint { font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.field__error {
  font-size: 12px; color: var(--danger);
  display: flex; align-items: center; gap: 6px;
}
.field--inline { display: grid; grid-template-columns: 200px 1fr; align-items: center; gap: 16px; }
.field--inline .field__label { margin: 0; }

.input,
.select,
.textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  font-size: 13.5px;
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  color: var(--text-strong);
  transition: border-color .12s var(--ease-out), box-shadow .12s var(--ease-out);
  box-shadow: var(--shadow-xs);
}
.input::placeholder, .textarea::placeholder { color: var(--text-quiet); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border); }
.input:focus, .select:focus, .textarea:focus {
  outline: 0;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.input--mono { font-family: var(--font-mono); font-size: 13px; letter-spacing: -0.005em; }
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.55; }

.select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237B8090' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.input-group { position: relative; }
.input-group .input { padding-right: 40px; }
.input-group__btn {
  position: absolute; right: 4px; top: 4px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  color: var(--text-muted);
}
.input-group__btn:hover { color: var(--text-strong); background: rgba(15,17,21,.04); }
.input-group__prefix {
  position: absolute; left: 12px; top: 0; bottom: 0;
  display: flex; align-items: center;
  color: var(--text-muted);
  font-size: 13.5px;
  pointer-events: none;
}
.input-group .input--with-prefix { padding-left: 36px; }

/* Segmented control */
.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--r-md);
  background: var(--surface-sunken);
  border: 1px solid var(--border-faint);
  align-self: flex-start;
  min-width: 0;
}
.segmented__btn {
  padding: 5px 12px;
  font-size: 12.5px;
  color: var(--text-soft);
  font-weight: 500;
  border-radius: 7px;
}
.segmented__btn[aria-pressed="true"] {
  background: var(--surface-card);
  color: var(--text-strong);
  box-shadow: var(--shadow-xs);
}

/* ─── Page: overview ──────────────────────────────────────────────── */

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.kpi {
  background: var(--surface-card);
  border: 1px solid var(--border-faint);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-xs);
  min-width: 0;
  transition: transform .15s var(--ease-out), border-color .15s var(--ease-out);
}
.kpi:hover { border-color: var(--border-soft); }
.kpi__label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-muted); font-weight: 500;
}
.kpi__label-icon { color: var(--text-quiet); }
.kpi__value {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text-strong);
  font-feature-settings: "tnum" on, "lnum" on;
  word-break: break-word;
}
.kpi__value--mono { font-family: var(--font-mono); font-size: 18px; letter-spacing: -0.01em; }
.kpi__delta {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--text-muted);
}
.kpi__delta--up { color: var(--success); }
.kpi__delta--down { color: var(--danger); }

@media (max-width: 1080px) { .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 560px) { .kpis { grid-template-columns: 1fr; } }

.row-2 {
  display: grid; grid-template-columns: 2fr 1fr; gap: 14px;
  margin-bottom: 22px;
}
@media (max-width: 980px) { .row-2 { grid-template-columns: 1fr; } }

/* Onboarding banner */
.onboarding {
  position: relative;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-faint);
  background:
    radial-gradient(800px 280px at 100% -10%, rgba(99, 102, 241, 0.10), transparent 60%),
    linear-gradient(180deg, var(--surface-card) 0%, var(--surface-card) 100%);
  padding: 22px;
  margin-bottom: 22px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  overflow: hidden;
}
.onboarding::after {
  content: "";
  position: absolute;
  right: -120px; top: -80px;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(99,102,241,0.10), transparent 70%);
  pointer-events: none;
}
.onboarding__eyebrow {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.onboarding__title {
  margin: 6px 0 6px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-strong);
}
.onboarding__lead {
  margin: 0;
  color: var(--text-soft);
  max-width: 58ch;
  font-size: 13.5px;
}
.onboarding__steps {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.onboarding__step {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border-radius: var(--r-full);
  background: var(--surface-soft);
  border: 1px solid var(--border-faint);
  font-size: 12.5px;
  color: var(--text-soft);
  font-weight: 500;
}
.onboarding__step.is-done { color: var(--text-muted); }
.onboarding__step-dot {
  width: 14px; height: 14px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-sunken);
  color: transparent;
  border: 1.5px solid var(--border);
}
.onboarding__step.is-done .onboarding__step-dot {
  background: var(--success); border-color: var(--success); color: #fff;
}

/* ─── Detail rows ─────────────────────────────────────────────────── */

.detail-list { display: flex; flex-direction: column; }
.detail-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border-faint);
  align-items: baseline;
}
.detail-row:last-child { border-bottom: 0; }
.detail-row__label {
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
}
.detail-row__value {
  color: var(--text-strong);
  font-size: 13.5px;
  word-break: break-word;
}
.detail-row__value--mono { font-family: var(--font-mono); font-size: 12.5px; }
.detail-row__value--muted { color: var(--text-muted); font-style: italic; }

/* ─── Activity / how-it-works ─────────────────────────────────────── */

.howit-steps {
  display: grid; gap: 4px;
  counter-reset: step;
}
.howit-step {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border-faint);
}
.howit-step:last-child { border-bottom: 0; }
.howit-step::before {
  counter-increment: step;
  content: counter(step);
  width: 22px; height: 22px;
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 50%;
  margin-top: 1px;
}
.howit-step__title { font-weight: 600; color: var(--text-strong); font-size: 13.5px; margin: 0 0 2px; }
.howit-step__body { color: var(--text-soft); font-size: 13px; margin: 0; line-height: 1.5; }

/* ─── Page: assistant form ────────────────────────────────────────── */

.form-card { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.form-grid--single .field { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }

.hours {
  display: flex; flex-direction: column;
  border: 1px solid var(--border-faint);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-card);
}
.hours__row {
  display: grid;
  grid-template-columns: 130px 1fr 1fr auto;
  gap: 12px;
  padding: 10px 14px;
  align-items: center;
  border-bottom: 1px solid var(--border-faint);
}
.hours__row:last-child { border-bottom: 0; }
.hours__day { font-size: 13px; font-weight: 500; color: var(--text-strong); }
.hours__row .input { height: 32px; font-size: 13px; }
.hours__row[data-closed="true"] .input { opacity: 0.4; pointer-events: none; background: var(--surface-sunken); }
.hours__toggle {
  font-size: 12px;
  color: var(--text-muted);
  display: inline-flex; align-items: center; gap: 8px;
  min-width: 124px;
  justify-content: flex-start;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.switch {
  position: relative;
  display: inline-block;
  flex: 0 0 32px;
  width: 32px; height: 18px;
}
.switch input {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  margin: 0; padding: 0;
  opacity: 0; cursor: pointer;
  z-index: 2;
}
.switch__track {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: var(--r-full);
  transition: background .15s var(--ease-out);
  pointer-events: none;
}
.switch__thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-xs);
  transition: transform .15s var(--ease-spring);
  pointer-events: none;
}
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track .switch__thumb,
.switch input:checked ~ .switch__thumb { transform: translateX(14px); }
.hours__toggle-label {
  display: inline-block;
  width: 84px;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

/* Sticky save bar */
.sticky-bar {
  position: sticky; bottom: 0;
  margin: 22px calc(var(--gutter) * -1) -64px;
  padding: 14px var(--gutter);
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(10px);
  border-top: 1px solid var(--border-faint);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 13px;
  color: var(--text-soft);
  z-index: 5;
}
.sticky-bar__hint { display: inline-flex; align-items: center; gap: 8px; }

/* ─── Integrations ────────────────────────────────────────────────── */

.integration {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border-faint);
  border-radius: var(--r-lg);
  background: var(--surface-card);
  box-shadow: var(--shadow-xs);
}
.integration + .integration { margin-top: 12px; }
.integration__logo {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: var(--surface-soft);
  border: 1px solid var(--border-faint);
}
.integration__title-wrap { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.integration__title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14.5px; font-weight: 600; color: var(--text-strong); margin: 0;
}
.integration__sub {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
  max-width: 56ch;
}
.integration__action { display: flex; gap: 8px; }

/* ─── Empty state ─────────────────────────────────────────────────── */

.empty {
  border: 1px dashed var(--border);
  border-radius: var(--r-lg);
  padding: 56px 28px;
  text-align: center;
  background:
    repeating-linear-gradient(45deg, var(--surface-card) 0 8px, var(--surface-soft) 8px 16px);
}
.empty__icon {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px;
  margin: 0 auto 12px;
  border-radius: var(--r-md);
  background: var(--surface-card);
  border: 1px solid var(--border-faint);
  color: var(--text-muted);
  box-shadow: var(--shadow-xs);
}
.empty__title { font-size: 15px; font-weight: 600; color: var(--text-strong); margin: 0 0 4px; }
.empty__sub { color: var(--text-muted); font-size: 13px; max-width: 44ch; margin: 0 auto; }

/* ─── Calls placeholder table ─────────────────────────────────────── */

.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.toolbar__group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.table-wrap {
  border: 1px solid var(--border-faint);
  border-radius: var(--r-lg);
  background: var(--surface-card);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th, .table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-faint);
  vertical-align: middle;
}
.table th {
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border-faint);
}
.table tbody tr { transition: background .12s var(--ease-out); }
.table tbody tr:hover { background: var(--surface-soft); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .cell--mono { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-soft); }
.table .cell--right { text-align: right; }
.table__placeholder-bar {
  display: inline-block;
  height: 8px;
  background: var(--surface-sunken);
  border-radius: var(--r-full);
  width: 160px;
}

.table-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border-faint);
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 12.5px;
}
.pagination { display: flex; gap: 4px; align-items: center; }
.pagination__btn {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  font-size: 12.5px;
  border-radius: var(--r-sm);
  color: var(--text-soft);
}
.pagination__btn[aria-current="page"] {
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  color: var(--text-strong);
}
.pagination__btn:hover { background: var(--surface-card); }

/* ─── Toasts ──────────────────────────────────────────────────────── */

.toast-stack {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column;
  gap: 8px;
  z-index: 999;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--text-strong);
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  max-width: 360px;
  animation: toast-in .25s var(--ease-spring);
}
.toast--success { background: #0F2A1B; }
.toast--success .toast__icon { color: #6EE7A7; }
.toast--danger  { background: #2A0F12; }
.toast--danger .toast__icon { color: #FCA5A5; }
.toast__icon { flex: 0 0 auto; margin-top: 1px; }
.toast__body { flex: 1; line-height: 1.45; }
.toast__close {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: var(--r-xs);
  color: rgba(255,255,255,0.55);
}
.toast__close:hover { color: #fff; background: rgba(255,255,255,0.08); }
.toast.is-leaving { animation: toast-out .2s var(--ease-in-out) forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to { opacity: 1; transform: none; }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px) scale(.97); }
}

/* ─── Util ────────────────────────────────────────────────────────── */

.sr-only {
  position: absolute !important;
  width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important;
  overflow: hidden !important; clip: rect(0,0,0,0) !important;
  white-space: nowrap !important; border: 0 !important;
}
.mono { font-family: var(--font-mono); font-size: 12.5px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-md { display: flex; flex-direction: column; gap: 14px; }
.stack-lg { display: flex; flex-direction: column; gap: 22px; }
.cluster { display: inline-flex; align-items: center; gap: 8px; }
.dim { color: var(--text-muted); }

.fade-in { animation: fadeIn .25s var(--ease-out); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ─── Mobile ──────────────────────────────────────────────────────── */

@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .rail {
    position: fixed; top: 0; left: 0;
    width: 80%; max-width: 320px;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform .25s var(--ease-out);
    box-shadow: var(--shadow-lg);
  }
  body.is-nav-open .rail { transform: translateX(0); }
  body.is-nav-open::after {
    content: "";
    position: fixed; inset: 0;
    background: var(--surface-overlay);
    z-index: 40;
  }
  .topbar__menu { display: grid !important; }
  .field--inline { grid-template-columns: 1fr; gap: 6px; }
  .detail-row { grid-template-columns: 1fr; gap: 4px; }
}
.topbar__menu { display: none; }
