/* SaaS additions on top of base.css (the brand tokens of tokens.css: docs/UI_BRAND.md on docs/UI_CONTROL_TOWER.md) */
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--fs-body)/var(--lh-body) var(--font-ui); }
[hidden] { display: none !important; }
a { color: var(--accent-text); }
.small { font-size: var(--fs-small); }
.muted { color: var(--muted); }

/* ─── Sign in, sign up, two-factor, a new password: the one place the website's look comes in full (UI_BRAND.md 8.1) ───
   ≥960 px two parts: the brand panel (deep teal into turquoise: the white mark with "Autowhat · Operational AI", the
   eyebrow, one line with its highlighted word and the short rule, three proof lines, the Newsreader tagline, a route map
   in SVG over a fine grid) beside the white form card on the ice page. Below 960 px one column: the panel becomes a band
   with the mark and the line, and the card overlaps its foot. The form controls are forms.css's, a little roomier here
   (38 px fields, a 40 px button; the phone's 44 px and 16 px text from the tokens and components.css).
   The panel is a dark canvas in both themes (as the map chrome is), so its white and its light turquoise are its own;
   every text on it passes AA where it sits (white 9.3:1 on the middle stop and 6.3:1 at the foot, the highlighted word
   5.2:1, the eyebrow 5.8:1, the proof lines 7.1:1, the tagline in full white, 5.0:1 where the turquoise light reaches it at 960 px; nav.test.js). */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; background: var(--bg-glow), var(--bg); }
.auth-hero {
  position: relative; isolation: isolate; overflow: hidden; color: #fff;
  background:
    radial-gradient(680px 520px at 108% 108%, color-mix(in srgb, var(--brand) 64%, transparent), transparent 68%),
    radial-gradient(420px 300px at 92% -8%, color-mix(in srgb, var(--brand) 24%, transparent), transparent 70%),
    linear-gradient(162deg, var(--brand-ink) 0%, color-mix(in srgb, var(--brand-ink) 74%, var(--brand)) 55%, color-mix(in srgb, var(--brand-ink) 52%, var(--brand)) 100%);
}
/* the fine grid, strongest where the routes are and gone under the words */
.auth-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, .055) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .055) 1px, transparent 1px);
  background-size: 32px 32px; background-position: -1px -1px;
  -webkit-mask-image: radial-gradient(110% 85% at 90% 85%, #000 15%, transparent 72%); mask-image: radial-gradient(110% 85% at 90% 85%, #000 15%, transparent 72%);
}
.auth-routes {
  position: absolute; right: -36px; bottom: -28px; z-index: -1; width: min(560px, 88%); height: auto; pointer-events: none;
  -webkit-mask-image: linear-gradient(105deg, transparent 8%, #000 52%); mask-image: linear-gradient(105deg, transparent 8%, #000 52%);
}
.auth-routes .rt { fill: none; stroke: rgba(255, 255, 255, .2); stroke-width: 1.3; stroke-dasharray: 1.5 7; stroke-linecap: round; }
.auth-routes .rt-hot {
  fill: none; stroke: color-mix(in srgb, var(--brand) 72%, #fff); stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 14 10;
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--brand) 80%, transparent)); animation: auth-route 2.4s linear infinite;
}
.auth-routes .hub { fill: color-mix(in srgb, var(--brand) 60%, #fff); }
.auth-routes .hub-halo { fill: color-mix(in srgb, var(--brand) 22%, transparent); stroke: color-mix(in srgb, var(--brand) 55%, transparent); stroke-width: 1; }
.auth-routes .stop { fill: var(--brand-ink); stroke: rgba(255, 255, 255, .6); stroke-width: 1.5; }
@keyframes auth-route { to { stroke-dashoffset: -48; } }
.auth-hero-in { position: relative; display: flex; flex-direction: column; gap: 28px; min-height: 100%; padding: 32px 48px 30px; }
.auth-logo { display: flex; align-items: center; gap: 11px; }
.auth-mark { flex: none; width: 36px; height: 36px; display: block; filter: brightness(0) invert(1); } /* the black mark drawn white */
.auth-bt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.auth-name { font: 600 calc(var(--fs-topbar) + 4px)/22px var(--font-head); letter-spacing: -.01em; color: #fff; }
/* the sub-line as the website sets it under its logo: "Operational AI" in sentence case, Source Sans 3, a little
   letter-spaced (500 here, not the site's 400 on white, so it holds on the deep teal) */
.auth-sub { font: 500 var(--fs-small)/14px var(--font-ui); letter-spacing: .04em; color: color-mix(in srgb, var(--brand) 40%, #fff); }
.auth-pitch { margin: auto 0; max-width: 470px; }
.auth-hero .auth-eyebrow { margin: 0 0 14px; color: color-mix(in srgb, var(--brand) 45%, #fff); }
.auth-title {
  margin: 0; font: 400 clamp(calc(var(--fs-h2) * 1.35), 1.6vw + 14px, calc(var(--fs-h2) * 1.75))/1.12 var(--font-head); letter-spacing: -.02em; color: #fff;
  font-optical-sizing: auto; text-wrap: balance;
}
.auth-hero .hl { color: color-mix(in srgb, var(--brand) 55%, #fff); }
.auth-title.h-rule::after { width: 40px; height: 3px; margin-top: 18px; background: color-mix(in srgb, var(--brand) 85%, #fff); }
.auth-proof { display: grid; gap: 14px; margin: 26px 0 0; padding: 0; list-style: none; }
.auth-proof li { display: flex; align-items: flex-start; gap: 12px; color: rgba(255, 255, 255, .84); font-size: calc(var(--fs-body) + 1px); line-height: 20px; }
.auth-proof li b { color: #fff; font-weight: 600; }
.auth-proof svg { flex: none; width: 20px; height: 20px; fill: color-mix(in srgb, var(--brand) 22%, transparent); stroke: color-mix(in srgb, var(--brand) 45%, #fff); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
/* a soft deep-teal halo under the letters: where the panel is narrow (960–1100 px) the lit route runs beneath the
   tagline, and the halo keeps the words on the deep teal (5:1 or more on the rendered pixels, as at 1440 px) */
.auth-tagline {
  margin: 0; max-width: 21em; font: 500 calc(var(--fs-body) + 3px)/1.45 var(--font-serif); color: #fff;
  text-shadow: 0 1px 2px color-mix(in srgb, var(--brand-ink) 70%, transparent), 0 0 14px color-mix(in srgb, var(--brand-ink) 85%, transparent);
}

/* the form side: the white card on the ice page */
.auth-main { position: relative; isolation: isolate; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-width: 0; padding: 40px var(--gutter); }
/* a soft turquoise light behind the card */
.auth-main::before {
  content: ""; position: absolute; left: 50%; top: 50%; z-index: -1; width: min(720px, 100%); aspect-ratio: 1; transform: translate(-50%, -50%); pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--brand) 13%, transparent), transparent);
}
.auth .auth-card {
  width: min(412px, 100%); padding: 30px 32px 26px; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: linear-gradient(90deg, var(--brand), var(--accent)) top / 100% 3px no-repeat, var(--surface); box-shadow: var(--e2);
}
.auth .auth-form { gap: 14px; }
.auth-h { display: flex; flex-direction: column; gap: 4px; }
.auth-h .eyebrow { margin: 0 0 2px; }
.auth .auth-form h2 { margin: 0; font: 600 var(--fs-h2)/var(--lh-h2) var(--font-head); letter-spacing: var(--ls-title); color: var(--ink); }
.auth .auth-form h2.h-rule::after { margin-top: 8px; }
.auth .auth-form .auth-h p { margin: 6px 0 0; line-height: var(--lh-small); }
.auth .auth-form .fld { gap: 5px; }
.auth .auth-form .fld > label { font: 600 var(--fs-small)/16px var(--font-ui); color: var(--ink-2); letter-spacing: 0; }
/* the text fields 38 px (44 px on a phone, from --control-h): the selector out-weighs forms.css's and modern.css's
   `.fld input:not(…)×3` (0,4,1) with its own three :not()s (0,6,1), and leaves a checkbox alone */
.auth .auth-form .fld input:not([type=checkbox]):not([type=file]):not([type=radio]) {
  height: max(var(--control-h), 38px); min-height: max(var(--control-h), 38px); padding: 0 12px; border-radius: var(--r-sm); font-size: var(--fs-body);
}
.auth .auth-form .btn.primary {
  height: max(var(--control-h), 40px); min-height: max(var(--control-h), 40px); margin-top: 4px; border-radius: var(--r-sm);
  font-size: calc(var(--fs-body) + 1px); font-weight: 600; letter-spacing: .005em;
}
.auth .auth-form .btn.primary:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.auth .auth-form > p.small { margin: 0; padding-top: 14px; border-top: 1px solid var(--line); text-align: center; }
.auth a { color: var(--accent-text); font-weight: 600; text-decoration: none; border-radius: var(--r-xs); }
.auth a:hover { text-decoration: underline; text-underline-offset: 3px; }
.auth a:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.auth .auth-err { font-size: var(--fs-small); line-height: var(--lh-small); min-height: 0; }
.auth .auth-err:not(:empty) { padding: 7px 10px; border: 1px solid var(--crit-line); border-radius: var(--r-sm); background: var(--crit-soft); color: var(--crit-text); }
.auth .auth-err:empty { margin-bottom: -14px; } /* an empty error line takes no room (it stays in the page: role="alert") */
/* --ink-2, not --muted: under the card the glow and the card's shadow darken the page to about #ccdfe3, where --muted is 4.0:1 */
.auth-foot { margin: 0; color: var(--ink-2); font-size: var(--fs-meta); line-height: var(--lh-meta); text-align: center; }
@media (min-width: 960px) {
  .auth { grid-template-columns: minmax(420px, 5fr) minmax(0, 6fr); }
  .auth-hero { position: sticky; top: 0; height: 100vh; height: 100dvh; }
}
/* one column: the panel is a band (the mark and the line; the motif's eyebrow and rule stay on the card, once a column) */
@media (max-width: 959px) {
  .auth-hero-in { gap: 14px; padding: 20px var(--gutter) 66px; }
  .auth-hero .auth-eyebrow, .auth-proof, .auth-tagline { display: none; }
  .auth-pitch { margin: 0; }
  .auth-mark { width: 30px; height: 30px; }
  .auth-title { max-width: 22em; font-size: calc(var(--fs-h2) + 2px); line-height: 1.22; }
  .auth-title.h-rule::after { display: none; }
  /* the band is short: its turquoise light sits low at the right, under the card's edge, so the line above stays on the
     deep teal (the highlighted word 4.5:1 or more where the wide panel's light reached it at 3:1) */
  .auth-hero {
    background:
      radial-gradient(320px 210px at 104% 130%, color-mix(in srgb, var(--brand) 60%, transparent), transparent 70%),
      radial-gradient(280px 180px at 96% -24%, color-mix(in srgb, var(--brand) 20%, transparent), transparent 70%),
      linear-gradient(162deg, var(--brand-ink) 0%, color-mix(in srgb, var(--brand-ink) 76%, var(--brand)) 60%, color-mix(in srgb, var(--brand-ink) 58%, var(--brand)) 100%);
  }
  /* the routes keep to the right half, faded, so no stop sits under a word of the line */
  .auth-routes {
    width: 380px; right: -70px; bottom: -96px; opacity: .8;
    -webkit-mask-image: linear-gradient(100deg, transparent 36%, #000 82%); mask-image: linear-gradient(100deg, transparent 36%, #000 82%);
  }
  .auth-main { justify-content: flex-start; margin-top: -46px; padding: 0 var(--gutter) 28px; }
  .auth .auth-card { padding: 22px 20px 20px; box-shadow: var(--e3); }
}
@media (max-width: 767px) { .auth .auth-card { padding: 20px 16px 18px; } }
@media (prefers-reduced-motion: reduce) { .auth-routes .rt-hot { animation: none; } }
/* auth + form controls → css/forms.css */

/* menu filter (the box above the sidebar; core/nav.js) and the sidebar's section headers */
.nav-search { padding: 4px 10px 6px; }
.nav-search input { width: 100%; height: var(--control-h); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 0 8px; background: var(--surface-2); color: var(--ink); font: inherit; font-size: var(--fs-small); }
.nav-group { font: 600 var(--fs-xs) var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); cursor: pointer; user-select: none; display: flex; justify-content: space-between; }
.nav-group[aria-expanded="false"] + .nav-items { display: none; }
.nav-count { font: 500 var(--fs-xs) var(--font-mono); color: var(--muted); }

/* list screen */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.toolbar input[type=search], .toolbar select, .toolbar input[type=date], .toolbar input[type=number] { height: var(--control-h); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 0 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-small); }
.toolbar input[type=search] { width: 260px; max-width: 100%; }
.toolbar .spacer { flex: 1; }
.tbl th[data-sort] { cursor: pointer; user-select: none; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tbl tbody tr.clickable:hover td { background: var(--accent-soft); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 8px 2px; color: var(--muted); font-size: var(--fs-small); font-variant-numeric: tabular-nums; }

/* ref picker in list toolbar (not full record forms) */
.toolbar .ref-pick { flex-direction: row; align-items: center; gap: 6px; }
.toolbar .ref-pick .ref-q { width: 150px; height: var(--control-h); min-height: 0; }
.toolbar input[type=number] { width: 110px; }

/* detail */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; }
.detail-grid dt { font-size: var(--fs-meta); color: var(--muted); }
.detail-grid dd { margin: 0 0 6px; font-weight: 500; word-break: break-word; }

/* modal */
.modal-back { position: fixed; inset: 0; background: color-mix(in srgb, var(--brand-ink) 55%, transparent); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal { width: min(980px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--line-2); box-shadow: var(--e3); }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-h h3 { font: 600 var(--fs-topbar)/20px var(--font-head); letter-spacing: -.01em; margin: 0; flex: 1; }
.modal-b { padding: 12px 14px 14px; }

/* home */
.module-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.module-tile { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-tile); background: var(--surface); box-shadow: var(--e1); text-decoration: none; color: var(--ink); }
.module-tile:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.module-tile b { font-weight: 600; }
.module-tile span { font-size: var(--fs-meta); color: var(--muted); }
@media (max-width: 720px) {
  .toolbar input[type=search] { width: 100%; }
  /* phone: a page's title and its buttons wrap instead of pushing the screen sideways */
  .page-h { flex-wrap: wrap; align-items: flex-start; }
  .page-h .actions { flex-wrap: wrap; margin-left: 0; }
}

/* WhatsApp bot */
.wa-shell { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 12px; align-items: start; }
.wa-chat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; min-height: 520px; }
.wa-bar, .wa-roles, .wa-suggest { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.wa-bar { justify-content: space-between; }
.wa-thread { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; max-height: 420px; background: var(--bg); }
.wa-msg { max-width: 85%; padding: 8px 10px; border-radius: 10px; white-space: pre-wrap; line-height: 1.4; }
.wa-msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.wa-msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); }
.wa-compose { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.wa-compose input[type=text] { flex: 1; height: 32px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 10px; background: var(--surface); color: var(--ink); }
.wa-hood .wa-trace { display: grid; grid-template-columns: 72px 1fr; gap: 4px 8px; margin: 0; }
.wa-hood .wa-trace dt { color: var(--muted); }
.wa-hood .wa-trace dd { margin: 0; }
.wa-apis { margin: 8px 0 0; padding-left: 16px; }
@media (max-width: 900px) { .wa-shell { grid-template-columns: 1fr; } }
