/* Meridian app theme (2026-10-19): the midnight-navy and warm-ivory look of
   the landing page, applied to the signed-in app and the public entry pages
   (login, signup, password reset, the lead capture form).

   Loaded AFTER style.css by base.html and public_base.html. It only
   re-declares the shared colour/radius tokens and layers visual refinements
   over existing components: no markup, text or behaviour depends on it, and
   deleting the <link> restores the previous look exactly. The landing page
   opts out (it pins its own palette in landing.css).

   Palette (dark): navy ground #0a1220, cards #0e1a2e, ivory text #f4efe6,
   dim text #b9c2cf, electric blue #2db6ff for text/icons. Palette (light):
   ivory ground #f4efe6, white cards, ink #101826, deep blue #08507f.
   Every foreground/background pair below is above the WCAG AA floor, and
   most text pairs are above 7:1 (checked, and enforced by the axe tests in
   tests/ui, which run in both colour schemes). The semantic trio
   (valid/attention/blocked) and clay stay separate from the brand blue and
   are never used alone: always with an icon and a word. */

@font-face {
  font-family: "IBM Plex Serif";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/ibm-plex-serif-600.woff2") format("woff2");
}

:root {
  --ground: #0a1220;
  --surface: #0e1a2e;
  --raised: #142238;
  --accent: #2db6ff;
  --accent-deep: #0b6aa8;
  --accent-glow: #1a67d1;
  --steel: #c3cad6;
  --steel-light: #dde3e8;
  --ink: #f4efe6;
  --ink-muted: #b9c2cf;
  --border: #26354f;
  --clay: #e8956d;
  --valid: #4cc88f;
  --attention: #e0b04f;
  --blocked: #f0766e;

  --radius: 6px;
  --radius-lg: 10px;
  --font-serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 16px 32px -26px rgba(0, 0, 0, 0.75);
  --shadow-raise: 0 18px 36px -24px rgba(0, 0, 0, 0.85);
}

@media (prefers-color-scheme: light) {
  :root {
    --ground: #f4efe6;
    --surface: #ffffff;
    --raised: #ebe4d5;
    --accent: #08507f;
    --accent-deep: #08507f;
    --accent-glow: #1a67d1;
    --steel: #4b5563;
    --steel-light: #cdc5b4;
    --ink: #101826;
    --ink-muted: #364152;
    --border: #d8d0bf;
    --clay: #a4451f;
    --valid: #1f6b43;
    --attention: #704b05;
    --blocked: #a6302b;

    --shadow-card: 0 1px 2px rgba(16, 24, 38, 0.05), 0 14px 30px -22px rgba(16, 24, 38, 0.3);
    --shadow-raise: 0 18px 36px -22px rgba(16, 24, 38, 0.38);
  }
}

::selection {
  background: color-mix(in srgb, var(--accent) 32%, transparent);
}

/* --------------------------------------------------------------- Page chrome */
.app-main {
  background: radial-gradient(
    900px 360px at 88% -8%,
    color-mix(in srgb, var(--accent) 7%, transparent),
    transparent 70%
  );
}

/* One deliberate motion: the page content settles a few pixels into place
   on load. Transform only (no fade), so nothing is ever transparent to a
   screen reader, a contrast checker or a slow device; the global
   prefers-reduced-motion rule in style.css switches it off. */
.app-main > main {
  animation: app-settle 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes app-settle {
  from {
    transform: translateY(8px);
  }
  to {
    transform: none;
  }
}

h1.display {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.005em;
  text-wrap: balance;
}
.subhead {
  color: var(--ink-muted);
  line-height: 1.6;
}
@media (max-width: 600px) {
  h1.display {
    font-size: 26px;
  }
}

/* ------------------------------------------------------------------ Sidebar */
.sidebar {
  background: color-mix(in srgb, var(--surface) 88%, var(--ground));
  border-right-color: var(--border);
}
.brand-wordmark .name {
  letter-spacing: 0.005em;
}
.nav-item {
  position: relative;
  border-radius: 8px;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast);
}
.nav-item:hover {
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  color: var(--ink);
}
.nav-item.active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--space-3));
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-divider {
  background: var(--border);
}

/* ------------------------------------------------------------------ Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--ground) 84%, transparent);
  backdrop-filter: blur(10px);
}
.topbar-search {
  border-radius: 8px;
  background: var(--surface);
}
.topbar-search input {
  background: transparent;
}
.ask-ak-teck-btn {
  white-space: nowrap;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  font-weight: 600;
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast);
}
.ask-ak-teck-btn:hover {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-color: var(--accent);
}
.user-chip .avatar {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent);
}

/* -------------------------------------------------------------------- Cards */
.queue-card,
.metric-card,
.stat-card,
.side-panel,
.command-bar,
.analytics-panel,
.pipeline-column,
.automation-card,
.task-item,
.task-add,
.consent-rail,
.auth-card,
.capture-card,
.price-card,
.coming-soon-state {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.coming-soon-state {
  border-style: dashed;
  box-shadow: none;
  background: transparent;
}
.command-bar::before,
.queue-card[data-spotlight="true"]::before {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
/* Pipeline cards stay still on hover (2026-11-15): a board full of cards
   that each lift is busy, so there only the border changes (style.css). */
.queue-card {
  transition:
    border-color var(--transition-fast),
    translate var(--transition-fast),
    box-shadow var(--transition-fast);
}
.queue-card:hover {
  translate: 0 -2px;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: var(--shadow-raise);
}
.pipeline-card,
.bubble {
  border-radius: 8px;
}
.metric-icon {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 13%, transparent);
}
.metric-value {
  color: var(--ink);
}

/* ------------------------------------------------------------------ Buttons */
.btn {
  border-radius: 8px;
  font-weight: 500;
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast);
}
.btn:hover {
  background: color-mix(in srgb, var(--ink) 6%, var(--surface));
  border-color: color-mix(in srgb, var(--ink) 38%, var(--border));
}
/* The primary action is ivory with navy text on the dark theme and navy
   with ivory text on the light one: --ink on --ground, so both themes keep
   the landing page's ~15:1 contrast and the blue stays an accent. */
.btn-primary,
.cta-button {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--ground);
  font-weight: 600;
  border-radius: 8px;
  transition:
    background-color var(--transition-fast),
    box-shadow var(--transition-fast);
}
.btn-primary:hover,
.cta-button:hover {
  background: color-mix(in srgb, var(--ink) 90%, var(--accent));
  border-color: transparent;
  color: var(--ground);
  box-shadow: 0 10px 22px -14px color-mix(in srgb, var(--ink) 70%, transparent);
}
.chip {
  border-radius: 999px;
  transition:
    border-color var(--transition-fast),
    background-color var(--transition-fast);
}
.chip:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.public-login-link {
  border-radius: 8px;
}

/* ------------------------------------------------------------------- Tables */
.data-table th {
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}
.data-table tbody tr {
  transition: background-color var(--transition-fast);
}
.data-table tbody tr:hover {
  background: color-mix(in srgb, var(--ink) 4%, transparent);
}

/* ------------------------------------------------------------- Conversation
   The 280px consent rail left only ~180px for the thread and the reply box
   between about 770px and 1000px wide. Below 1000px the page stacks, and the
   rail comes first: the agent sees the lawful basis before writing. */
@media (max-width: 1000px) {
  .conversation-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .conversation-layout > .consent-rail {
    order: -1;
    position: static;
  }
}

.composer label {
  display: block;
  margin: var(--space-3) 0 var(--space-1);
  font-weight: 500;
}

/* ------------------------------------------------------- House backdrop
   The landing page's twilight house photo sits fixed behind every page,
   under a heavy ground-coloured wash so it reads as atmosphere only. Cards,
   tables and forms keep their solid surfaces on top, so text contrast is
   decided by the surface tokens, never by the photo. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--ground) 80%, transparent),
      color-mix(in srgb, var(--ground) 90%, transparent)
    ),
    url("/static/img/hero-960.webp") center / cover no-repeat;
}
@media (min-width: 1000px) {
  body::before {
    background:
      linear-gradient(
        90deg,
        color-mix(in srgb, var(--ground) 94%, transparent),
        color-mix(in srgb, var(--ground) 72%, transparent) 70%,
        color-mix(in srgb, var(--ground) 62%, transparent)
      ),
      url("/static/img/hero-1600.webp") center / cover no-repeat;
  }
}

/* ======================================================= Shared components
   Section 1 of the 2026-10-20 redesign: one scale and one set of component
   rules that every page reuses. */
:root {
  --text-xs: 12px;
  --text-sm: 13.5px;
  --text-md: 15px;
  --text-lg: 18px;
  --text-xl: 22px;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Status badge (macros.status_badge): icon + word, never colour alone. */
.badge {
  --tone: var(--ink-muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px 2px 7px;
  border: 1px solid color-mix(in srgb, var(--tone) 45%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--tone) 12%, transparent);
  color: var(--tone);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.badge[data-tone="neutral"] { --tone: var(--ink-muted); }
.badge[data-tone="accent"] { --tone: var(--accent); }
.badge[data-tone="valid"] { --tone: var(--valid); }
.badge[data-tone="attention"] { --tone: var(--attention); }
.badge[data-tone="blocked"] { --tone: var(--blocked); }

/* Disabled controls look inert and never take hover/lift effects. */
button:disabled,
.btn[aria-disabled="true"],
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn:disabled:hover,
.btn[aria-disabled="true"]:hover {
  background: var(--surface);
  border-color: var(--border);
}

/* Loading: htmx marks the requesting element, and spinners can sit inline. */
.htmx-request.btn,
.btn.htmx-request {
  opacity: 0.7;
  pointer-events: none;
}
.htmx-indicator {
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid color-mix(in srgb, var(--ink) 25%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  vertical-align: -2px;
  animation: spinner-turn 0.8s linear infinite;
}
@keyframes spinner-turn {
  to {
    transform: rotate(360deg);
  }
}

/* Dropdown menu (the account menu uses this): a details/summary pair, so it
   works with the keyboard and without JavaScript. */
.menu {
  position: relative;
}
.menu > summary {
  list-style: none;
  cursor: pointer;
}
.menu > summary::-webkit-details-marker {
  display: none;
}
.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  min-width: 200px;
  padding: var(--space-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-raise);
  animation: app-settle 0.18s var(--ease-out) both;
}
.menu-panel a,
.menu-panel button {
  display: block;
  width: 100%;
  min-height: var(--control-height-sm);
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu-panel a:hover,
.menu-panel button:hover {
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}
.menu-panel hr {
  margin: var(--space-2) 0;
  border: 0;
  border-top: 1px solid var(--border);
}

/* Toast and pagination follow the theme surfaces. */
.toast {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-raise);
}
.pagination-link {
  border-radius: 8px;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}
.pagination-link:hover:not([aria-disabled="true"]) {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2.4s;
  }
  .menu-panel {
    animation: none;
  }
}

/* ------------------------------------------------------------ Account menu
   The signed-in user's chip in the top bar opens Change password / Settings /
   Log out. It is a <details>, so it is keyboard-operable by default. */
.account-menu {
  margin-left: auto;
}
.account-menu > summary.user-chip {
  margin-left: 0;
  min-height: var(--control-height-md);
  padding: 0 var(--space-3) 0 var(--space-2);
  border: 1px solid transparent;
  border-radius: 999px;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}
.account-menu > summary.user-chip:hover,
.account-menu[open] > summary.user-chip {
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  border-color: var(--border);
}
.chip-caret {
  transition: transform var(--transition-fast);
}
.account-menu[open] .chip-caret {
  transform: rotate(180deg);
}
.menu-who {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  color: var(--ink-muted);
  font-size: var(--text-xs);
  overflow-wrap: anywhere;
}

/* A one-line explanation under a form field (sign-up, team invite). */
.field-hint {
  margin: 0;
  color: var(--ink-muted);
  font-size: var(--text-sm);
}

/* ------------------------------------------------------------- Dashboard
   A photographic header band (the only place the photo is vivid inside the
   app), then solid, data-friendly surfaces. The band pins its own light text
   over a navy overlay, like the landing hero, in both colour schemes. */
.dash-hero {
  position: relative;
  isolation: isolate;
  margin-bottom: var(--space-5);
  padding: var(--space-6) var(--space-6);
  border-radius: var(--radius-lg);
  overflow: hidden;
  color: #f4efe6;
  background:
    linear-gradient(90deg, rgba(8, 15, 28, 0.94) 0%, rgba(8, 15, 28, 0.78) 55%, rgba(8, 15, 28, 0.45) 100%),
    url("/static/img/hero-960.webp") center 42% / cover no-repeat;
  box-shadow: var(--shadow-card);
}
@media (min-width: 1000px) {
  .dash-hero {
    background:
      linear-gradient(90deg, rgba(8, 15, 28, 0.94) 0%, rgba(8, 15, 28, 0.78) 55%, rgba(8, 15, 28, 0.4) 100%),
      url("/static/img/hero-1600.webp") center 42% / cover no-repeat;
  }
}
.dash-hero h1.display {
  margin: var(--space-1) 0 var(--space-2);
  color: #f4efe6;
}
.dash-hero .subhead {
  max-width: 56ch;
  margin: 0;
  color: #d3dae4;
}
.dash-welcome {
  margin: 0;
  color: #9fd8ff;
  font-size: var(--text-sm);
  font-weight: 600;
}
@media (max-width: 600px) {
  .dash-hero {
    padding: var(--space-5) var(--space-4);
  }
}

/* KPI cards: a real link only when there is a destination. */
a.metric-card {
  color: inherit;
  text-decoration: none;
  transition:
    border-color var(--transition-fast),
    translate var(--transition-fast),
    box-shadow var(--transition-fast);
}
a.metric-card:hover {
  translate: 0 -2px;
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  box-shadow: var(--shadow-raise);
}
.metric-card {
  min-height: 112px;
}
.metric-label {
  font-size: var(--text-sm);
}

/* Command center and empty states. */
.command-bar-eyebrow {
  text-transform: none;
  letter-spacing: 0;
  font-size: var(--text-sm);
  font-weight: 600;
}
.empty-state {
  padding: var(--space-6) var(--space-5);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}
.empty-state svg {
  color: var(--valid);
}
.side-panel h2 {
  font-size: var(--text-md);
  letter-spacing: 0;
  text-transform: none;
}

/* -------------------------------------------- Conversations inbox + Assistant
   Reading surfaces sit on solid panels, never bare text on the photo. */
.inbox-list {
  list-style: none;
  margin: var(--space-4) 0 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.inbox-list .activity-item {
  border-bottom: 1px solid var(--border);
}
.inbox-list .activity-item:last-child {
  border-bottom: 0;
}
.inbox-list .activity-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  min-height: 56px;
  transition: background-color var(--transition-fast);
}
.inbox-list .activity-link:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.inbox-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent);
  font-weight: 600;
  font-size: var(--text-sm);
}
.inbox-list .activity-body {
  min-width: 0;
}
.inbox-list .activity-summary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-sessions,
.assistant-context {
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.assistant-chat {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  min-height: 420px;
}
.assistant-new-chat {
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.chat-bubble {
  border-radius: 10px;
}
@media (max-width: 860px) {
  .assistant-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  .assistant-chat {
    order: -1;
  }
  .assistant-sessions {
    height: auto;
    max-height: 240px;
  }
}

/* Conversation thread: the reply form sits on a solid panel, and the thread
   gets a quiet one so bubbles never float directly on the photo. */
.conversation-layout .composer {
  margin-top: var(--space-4);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.conversation-layout .timeline {
  padding: var(--space-4);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.conversation-layout .timeline:not(:has(.bubble)) {
  display: none;
}

/* ------------------------------------------- Leads, Pipeline, Tasks panels */
.table-scroll {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.table-scroll .data-table {
  margin: 0;
}
.table-scroll .data-table th {
  background: color-mix(in srgb, var(--raised) 55%, var(--surface));
  font-size: var(--text-xs);
}
.table-scroll .data-table tbody tr:last-child td {
  border-bottom: 0;
}
.task-meta .badge {
  margin-right: var(--space-2);
}

/* ------------------------------------- Approvals, Calendar, Properties */
.approvals-list {
  list-style: none;
  margin: var(--space-4) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.approvals-list .approval-item {
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.approvals-list .activity-summary .badge {
  margin-left: var(--space-2);
  vertical-align: 1px;
}
.calendar-panel {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.microsite-slug {
  margin-left: var(--space-2);
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

/* ------------------------------------------------------ Analytics, Automations */
.automation-head .badge {
  flex: none;
}
.bar-fill {
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
}
.stat-value {
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------ Data requests, Privacy, Settings */
.settings-section,
.privacy-section {
  margin: 0 0 var(--space-4);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.settings-section > h2,
.privacy-section > h2 {
  margin-top: 0;
  font-size: var(--text-lg);
}
.table-scroll .subprocessor-table {
  width: 100%;
  margin: 0;
}
.dsr-deadline {
  display: inline-block;
}

/* A table inside a panel scrolls on its own instead of widening the page. */
.table-wrap {
  overflow-x: auto;
  max-width: 100%;
}
