/*
 * Strata Portal design tokens.
 * Palette + type pulled directly from stratalang.com (computed styles / CSS vars), so the
 * portal reads as the same brand as the marketing site, not a generic admin skin.
 */

:root {
  /* Brand */
  --strata-navy: #0d2399;        /* primary — headers, nav, primary buttons */
  --strata-navy-dark: #0c1d7b;   /* hover/active state, deep backgrounds */
  --strata-blue: #37abff;        /* secondary accent — highlights, badges */
  --strata-link: #188bf6;        /* links, interactive text */
  --strata-tint: #e3f4f9;        /* light blue tint — section backgrounds, cards */

  /* Neutrals */
  --strata-black: #000000;
  --strata-ink: #414141;         /* body text */
  --strata-gray: #595959;        /* secondary text */
  --strata-border: #cdcdcd;      /* borders, dividers */
  --strata-smoke: #f5f5f5;       /* page background */
  --strata-white: #ffffff;

  /* Status (kept distinct from brand blues so state is scannable at a glance) */
  --strata-success: #2f9e44;
  --strata-warning: #f6ad55;
  --strata-danger: #e93d3d;

  /* Type */
  --font-heading: "Poppins", "Inter", system-ui, sans-serif;
  --font-body: "Inter", "Poppins", system-ui, sans-serif;

  /* Rhythm */
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(13, 35, 153, 0.08);
  --shadow-md: 0 4px 16px rgba(13, 35, 153, 0.12);

  /* GUI redesign Phase 1 (Shell) — new neutrals for surfaces/hairlines/text, layered on
     top of the brand tokens above (unchanged). See docs/redesign/handoff/HANDOFF-REDESIGN.md. */
  --surface-page:   #f2f5fa;
  --surface-card:   #ffffff;
  --surface-sunken: #f7f9fc;
  --hairline:       #e6eaf2;
  --hairline-soft:  #f0f3f8;
  --text-strong:    #1c2333;
  --text-body:      #3c4557;
  --text-muted:     #7a839a;
  --text-faint:     #9aa3b5;

  /* GUI redesign Phase 7, Slice 1 (mobile shell) — height of the new mobile-only bottom
     nav bar; referenced by its own layout rules below and by the assistant-widget mobile
     offset so the widget's launcher button doesn't sit under the bar. */
  --bottom-nav-height: 64px;
}

* { box-sizing: border-box; }

/* Visually-hidden but screen-reader-accessible label text — referenced by
   apps/comments/templates/comments/_thread.html and assistant/_transcript.html but never
   previously defined anywhere in this stylesheet; standard accessible-hiding pattern. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--surface-page); /* GUI redesign Phase 1: shell background, replaces --strata-smoke (unused elsewhere) */
  color: var(--strata-ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--strata-navy);
  font-weight: 600;
  margin: 0 0 0.5em;
}

a {
  color: var(--strata-link);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* --- Layout shell ---
   GUI redesign Phase 1 (Shell): header goes from navy to a white bar (brand + search +
   notifications + user menu), with a second white row of pill tabs (.header-tabs, its own
   sibling element — see templates/partials/header_tabs.html, included separately in
   base.html right after header.html) sitting flush beneath it. Navy moves to the active
   pill and primary buttons instead. See docs/redesign/handoff/HANDOFF-REDESIGN.md. */
.app-header {
  background: var(--surface-card);
  color: var(--text-body);
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--hairline-soft);
}
.app-header .brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--strata-navy);
  line-height: 1.2;
}
.app-header .brand .mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--strata-navy);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--strata-blue);
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.app-header .brand .role-label {
  display: block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  text-transform: uppercase;
}
.app-header .header-search {
  position: relative;
  flex: 1;
  max-width: 440px;
  margin-left: 0.75rem;
}
.app-header .header-search input[type="search"] {
  width: 100%;
  background: var(--surface-sunken);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-body);
}
.app-header .header-search input[type="search"]:focus {
  outline: none;
  border-color: var(--strata-blue);
  box-shadow: 0 0 0 3px rgba(55, 171, 255, 0.2);
}
.app-header .header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.1rem;
}
.app-header .icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  color: var(--text-muted);
  cursor: pointer;
}
.app-header .icon-btn:hover { color: var(--text-strong); }
.app-header .icon-btn-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--strata-danger);
  color: var(--strata-white);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  border: 1.5px solid var(--surface-card);
}
.app-header .user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--text-body);
}
.app-header .user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--strata-tint);
  color: var(--strata-navy);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.72rem;
  flex-shrink: 0;
}
.app-header .user-menu-name {
  font-size: 0.8rem;
  line-height: 1.2;
  text-align: left;
}
.app-header .user-menu-name .user-chip {
  display: block;
  font-weight: 600;
  color: var(--text-strong);
}
.app-header .user-menu-name .user-menu-sub {
  display: block;
  font-size: 0.7rem;
  color: var(--text-faint);
}
.app-header .user-menu-chevron { color: var(--text-faint); font-size: 0.7rem; }

/* --- Dropdown panels: global search results, notification bell, user menu ---
   One reusable surface for all three (templates/partials/header.html); each instance sets
   its own left/right/width/min-width via inline style (CSP allows unsafe-inline style-src
   already, same convention as .bar-fill's inline width elsewhere in this file). */
.header-dropdown-panel {
  position: absolute;
  top: calc(100% + 0.6rem);
  z-index: 60;
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 420px;
  overflow-y: auto;
  padding: 0.4rem;
}
.header-dropdown-panel a {
  display: block;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  color: var(--text-body);
  font-size: 0.85rem;
}
.header-dropdown-panel a:hover {
  background: var(--surface-sunken);
  text-decoration: none;
}
.header-dropdown-panel p {
  margin: 0;
  padding: 0.5rem 0.6rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.header-dropdown-panel hr {
  border: none;
  border-top: 1px solid var(--hairline-soft);
  margin: 0.3rem 0;
}

/* Search-results dropdown content (templates/partials/_search_results.html) */
.search-result-group + .search-result-group { margin-top: 0.5rem; }
.search-result-group-label {
  padding: 0.35rem 0.6rem 0.15rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}
.search-result-item-label { display: block; font-weight: 600; color: var(--text-strong); font-size: 0.85rem; }
.search-result-item-sublabel { display: block; margin-top: 0.1rem; font-size: 0.75rem; color: var(--text-muted); }

/* --- Header tab strip — the primary nav for every authenticated role, pill-shaped, role-
   scoped (see templates/partials/header_tabs.html). Rendered as its own white row directly
   beneath .app-header, flush (no gap) so the two read as one two-row header. --- */
.header-tabs {
  display: flex;
  gap: 0.4rem;
  padding: 0.65rem 1.5rem 0.75rem;
  background: var(--surface-card);
  border-bottom: 1px solid var(--hairline);
  overflow-x: auto;
}
.header-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
}
.header-tab:hover {
  background: var(--surface-sunken);
  color: var(--text-strong);
  text-decoration: none;
}
.header-tab.active {
  background: var(--strata-navy);
  color: var(--strata-white);
}
.header-tab .badge { margin-left: 0.15rem; }
.header-tab.active .badge-warning { background: rgba(255, 255, 255, 0.25); color: var(--strata-white); }

.app-shell {
  display: flex;
  align-items: stretch;
  flex: 1;
  width: 100%;
}

.app-main {
  flex: 1;
  min-width: 0; /* allow horizontally-scrolling content (e.g. the interpretation kanban board) to shrink below its content size instead of overflowing the shell */
  /* Was a hard 1120px cap, which left large equal gutters on wide desktop/laptop screens and
     starved tables of usable width. Percentage-based with a generous upper cap instead: fills
     most of the viewport on typical desktop widths while still leaving breathing room (rather
     than going edge-to-edge) on ultra-wide monitors. */
  max-width: min(94%, 1600px);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* --- Icon rail (was a 240px text-link sidebar; GUI redesign Phase 1 narrows it to an 80px
   icon rail holding only admin/secondary destinations — service-line links moved up into
   .header-tabs). GUI redesign Phase 7, Slice 1: the rail is now desktop-only — its old
   mobile off-canvas hamburger-drawer behavior (max-width:767px block below) has been
   replaced by templates/partials/bottom_nav.html, which covers every destination the
   drawer used to. --- */
.app-sidebar {
  width: 80px;
  flex-shrink: 0;
  background: var(--surface-card);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0;
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  width: 100%;
  flex: 1;
  min-height: 0;
}

.sidebar-nav li { margin: 0; width: 100%; display: flex; justify-content: center; }

/* Pins the sign-out item to the bottom of the rail (sidebar-nav is a flex column) */
.sidebar-nav li.icon-rail-signout { margin-top: auto; }

.icon-rail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  width: 62px;
  padding: 0.55rem 0.25rem;
  border-radius: 10px;
  color: var(--text-faint);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-align: center;
}
.icon-rail-item:hover {
  background: var(--surface-sunken);
  color: var(--text-strong);
  text-decoration: none;
}
.icon-rail-item.active {
  background: var(--strata-tint);
  color: var(--strata-navy);
}

/* GUI redesign Phase 7, Slice 1: the icon rail is desktop-only now — templates/partials/
   bottom_nav.html (+ its More sheet) is the mobile equivalent below this breakpoint,
   covering the same destinations the rail's old off-canvas drawer used to. */
@media (max-width: 767px) {
  .app-sidebar {
    display: none;
  }
}

/* --- Bottom nav (GUI redesign Phase 7, Slice 1) — mobile-only role-scoped nav bar,
   templates/partials/bottom_nav.html, replacing the hamburger/off-canvas .app-sidebar
   drawer above on narrow viewports. Hidden by default (desktop); shown at the same
   max-width:767px threshold the off-canvas sidebar already used, no new breakpoint. --- */
.bottom-nav {
  display: none;
}

@media (max-width: 767px) {
  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    height: var(--bottom-nav-height);
    background: var(--surface-card);
    border-top: 1px solid var(--hairline);
    box-shadow: var(--shadow-md);
  }
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-height: 44px;
  padding: 0.4rem 0.25rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
}
.bottom-nav-item:hover {
  color: var(--text-strong);
  text-decoration: none;
}
.bottom-nav-item.active {
  color: var(--strata-navy);
}

.bottom-nav-sheet-wrap {
  flex: 1;
  display: flex;
  position: relative;
}
.bottom-nav-sheet-wrap .bottom-nav-item {
  width: 100%;
}

/* Bottom sheet (New / More menus) — same open/close idiom as .header-dropdown-panel
   (x-data + @click.outside + x-show), just laid out as a full-width sheet rising from the
   bottom of the viewport instead of an anchored panel. */
.bottom-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 54;
  background: rgba(28, 35, 51, 0.4);
}
.bottom-sheet-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--bottom-nav-height);
  z-index: 55;
  max-height: min(70vh, 420px);
  overflow-y: auto;
  background: var(--surface-card);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow-md);
  padding: 0.5rem;
}
.bottom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.6rem;
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text-strong);
}
.bottom-sheet-panel a {
  display: block;
  padding: 0.7rem 0.6rem;
  border-radius: 6px;
  color: var(--text-body);
  font-size: 0.9rem;
}
.bottom-sheet-panel a:hover {
  background: var(--surface-sunken);
  text-decoration: none;
}
.bottom-sheet-panel hr {
  border: none;
  border-top: 1px solid var(--hairline-soft);
  margin: 0.3rem 0;
}

.app-footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--strata-gray);
  font-size: 0.85rem;
  border-top: 1px solid var(--strata-border);
}

/* --- Components --- */
.card {
  background: var(--strata-white);
  border: 1px solid var(--strata-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card + .card { margin-top: 1rem; }

/* Collapsed "Show comments" panel (comments/_thread.html) — once the thread's body is
   hidden via x-show, the surrounding .card still carried full 1.5rem padding/border/shadow
   chrome, so it never visually shrank back down to something resembling the original
   trigger button. Alpine toggles this modifier alongside x-show so the collapsed card reads
   as noticeably smaller/lighter than the expanded one, without touching .card's own rules
   (used everywhere else in the app) or reverting to htmx re-swapping the button back in. */
.card--compact { padding: 0.5rem 0.75rem; box-shadow: none; }

.tint-panel {
  background: var(--strata-tint);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

/* Native <details>/<summary> (Version history, _file_card.html) — no existing rules for
   these elements anywhere in the app. Match the tint-panel heading convention already used
   by every sibling panel's <h4 style="font-size:.85rem;">: same font-heading family, navy
   color, 600 weight — just applied to <summary> so the collapsed header reads as a clickable
   version of that same heading style. */
details.tint-panel > summary {
  font-family: var(--font-heading);
  color: var(--strata-navy);
  font-weight: 600;
  cursor: pointer;
}
details.tint-panel[open] > summary { margin-bottom: 0.5rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  border-radius: var(--radius);
  padding: 0.55rem 1.1rem;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary {
  background: var(--strata-navy);
  color: var(--strata-white);
}
.btn-primary:hover { background: var(--strata-navy-dark); text-decoration: none; }
.btn-secondary {
  background: var(--strata-blue);
  color: var(--strata-navy-dark);
}
.btn-secondary:hover { filter: brightness(0.95); text-decoration: none; }
.btn-outline {
  background: transparent;
  color: var(--strata-navy);
  border: 1px solid var(--strata-navy);
}
/* Confirm/Decline action buttons (owner QA feedback) — same --strata-success/--strata-danger
   vars .badge-success/.badge-danger already use, just applied to a solid button instead of a
   pill, matching .btn-primary's structure. */
.btn-success {
  background: var(--strata-success);
  color: var(--strata-white);
}
.btn-success:hover { filter: brightness(0.92); text-decoration: none; }
.btn-danger {
  background: var(--strata-danger);
  color: var(--strata-white);
}
.btn-danger:hover { filter: brightness(0.92); text-decoration: none; }

.badge {
  display: inline-block;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--strata-tint);
  color: var(--strata-navy);
}
.badge-success { background: #eafaf0; color: var(--strata-success); }
.badge-warning { background: #fff6ea; color: #b9770e; }
.badge-danger  { background: #fdecec; color: var(--strata-danger); }
/* Status-badge color palette (TStatus/IStatus/OStatus color-coding task) — a fuller set
   of variants alongside the 3 above so every internal status value can get its own
   distinct, sensibly-themed color instead of everything reading as the same plain badge.
   Reuses the app's existing brand/neutral tokens where they fit (navy, link, gray,
   smoke); .badge-purple/.badge-teal introduce two small new hexes in the same pastel-bg
   + saturated-text shape as the existing variants, since no existing token covers those
   hues. Wired via apps.common.templatetags.status_badges' status_badge_class filter. */
.badge-neutral { background: var(--strata-smoke); color: var(--strata-gray); }
.badge-primary { background: var(--strata-tint); color: var(--strata-navy); }
.badge-info    { background: #eaf6ff; color: var(--strata-link); }
.badge-purple  { background: #f2ecfc; color: #7c3aed; }
.badge-teal    { background: #e6f7f7; color: #0f8b8d; }

/* "New comment" chat icon (unseen-activity indicators task) — hidden by default via inline
   style="display:none" in each host template; static/assets/js/comment_badges.js reveals it
   for whichever rows the comment_activity endpoint reports as unseen. Text-glyph, not an
   icon font/SVG sprite — this app has no icon library, matching its existing plain-text
   badge convention. Sized up from the original 0.95rem (owner request: these icons should
   read bigger at a glance) and made an inline-flex container so the numbered count pill
   below sits cleanly next to the glyph instead of trailing the line as plain text. */
.comment-unseen-icon {
  margin-left: 0.35rem;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--strata-warning);
  cursor: default;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

/* Numbered count pill inside .comment-unseen-icon (upgrade from a presence-only glyph to a
   real count — comment_badges.js appends this span once the comment_activity endpoint
   reports a count for that row). Deliberately reuses .app-header .icon-btn-badge's exact
   visual language (same min-width/height/padding/radius/colors/font) — that's this app's
   only existing precedent for "small numbered badge" styling — just laid out inline next to
   the chat glyph instead of position:absolute over a corner, since there's no icon-button
   corner to anchor to here. */
.comment-unseen-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  margin-left: 0.2rem;
  border-radius: 999px;
  background: var(--strata-danger);
  color: var(--strata-white);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 15px;
}

/* Per-row "you haven't opened this yet" title treatment (unseen-activity indicators task,
   PM board + contractor assignment list) — distinct from .comment-unseen-icon (new comment)
   and the aggregate "N new" badge; this bolds/colors just the row's own title so it reads at
   a glance without being garish. */
.unseen-card-title { color: var(--strata-navy-dark); }

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--strata-white);
  border-radius: var(--radius);
  overflow: hidden;
}
table.data-table th, table.data-table td {
  text-align: left;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--strata-border);
}
table.data-table th {
  background: var(--strata-tint);
  color: var(--strata-navy);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* GUI redesign Phase 7, Slice 3 — universal mobile scroll fallback for every
   table.data-table in the app (34 templates, none of which wrap the table in a
   dedicated .table-wrap-style container — it's a bare table, usually inside .card).
   Zero template edits: below the same max-width:767px breakpoint Slice 1 uses for the
   shell, make the table itself the horizontal-scroll container and stop cells from
   wrapping so columns keep their natural width instead of getting crushed illegibly.
   The ~9 highest-traffic client/contractor lists get a richer .data-table-cards
   card transform on top of this (see below); every other table just scrolls. */
@media (max-width: 767px) {
  table.data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
}

/* GUI redesign Phase 7, Slice 3 — data-label card transform for the ~9 highest-traffic
   client/contractor list templates (client_list.html x3, client_quote_list.html,
   client_deliveries.html, contractor_list.html x2, contractor_payment_list.html,
   contractor_profile.html). These tables carry an extra .data-table-cards class
   (added only on these tables, not the other ~25, which stay scroll-only per the
   table.data-table rule above) so that below 767px each row renders as a labeled card
   instead of a horizontally-scrolling table. Requires a data-label="<Column Header>"
   attribute on every <td> (added in the templates), matching the standard "responsive
   table" CSS pattern. table.data-table.data-table-cards below matches the specificity of
   table.data-table above so it wins the cascade and opts these tables out of the scroll
   treatment in favor of the card layout. */
@media (max-width: 767px) {
  table.data-table.data-table-cards {
    display: block;
    overflow-x: visible;
    white-space: normal;
  }
  .data-table-cards thead,
  .data-table-cards tbody,
  .data-table-cards tr,
  .data-table-cards td {
    display: block;
  }
  .data-table-cards thead { display: none; }
  .data-table-cards tr {
    margin-bottom: 0.85rem;
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    padding: 0.6rem 0.85rem;
    background: var(--strata-white);
  }
  .data-table-cards tr:last-child { margin-bottom: 0; }
  .data-table-cards td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0;
    border: none;
    border-bottom: 1px solid var(--hairline-soft);
    text-align: right;
    white-space: normal;
  }
  .data-table-cards td:last-child { border-bottom: none; }
  .data-table-cards td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: left;
    margin-right: 1rem;
    flex-shrink: 0;
  }
  /* First cell in each row is the row's primary identifier (request/quote/payment number,
     certification name, etc.) — render it as the card's headline instead of a
     label/value pair, same "first field is the title, rest is metadata" convention used
     elsewhere in the app (e.g. .activity-feed-row's primary text vs. secondary time). */
  .data-table-cards td:first-child {
    display: block;
    text-align: left;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    color: var(--strata-navy);
    border-bottom: 1px solid var(--hairline);
    padding-bottom: 0.5rem;
    margin-bottom: 0.35rem;
  }
  .data-table-cards td:first-child::before { content: none; }
  /* partials/empty_state_row.html renders a single colspan'd <td> — it isn't a
     label/value pair, so it should render as a plain block, not a headline or a
     flex row with a ::before label. */
  .data-table-cards td[colspan] {
    display: block;
    text-align: left;
    border-bottom: none;
    padding: 0;
    margin-bottom: 0;
  }
  .data-table-cards td[colspan]::before { content: none; }
}

.form-field { margin-bottom: 1.1rem; }
.form-field label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--strata-navy);
  margin-bottom: 0.3rem;
}
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--strata-border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--strata-blue);
  box-shadow: 0 0 0 3px rgba(55, 171, 255, 0.25);
}

/* --- htmx loading indicators (AI draft / routing-suggestion buttons) ---
   htmx itself injects a default `.htmx-indicator { opacity: 0 }` /
   `.htmx-request .htmx-indicator { opacity: 1 }` stylesheet, but that default is only
   guaranteed while htmx.config.includeIndicatorStyles stays at its default (true) — pin
   it explicitly here so the "Thinking…" affordance doesn't silently disappear if that
   config is ever changed. */
.htmx-indicator { opacity: 0; transition: opacity 150ms ease-in; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { opacity: 1; }

/* --- Admin "View As" banner (templates/partials/view_as_banner.html) --- */
.view-as-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  width: 100%;
  padding: 0.6rem 1.5rem;
  background: var(--strata-warning);
  color: var(--strata-navy-dark);
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
}
.view-as-banner form { margin: 0; }
.view-as-banner-exit {
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  background: var(--strata-white);
  color: var(--strata-navy-dark);
  border: 1px solid var(--strata-navy-dark);
}
.view-as-banner-exit:hover {
  background: var(--strata-navy-dark);
  color: var(--strata-white);
}

/* --- QuickBooks reauth/refresh-expiry banner (templates/partials/qbo_banner.html) --- */
.qbo-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  width: 100%;
  padding: 0.6rem 1.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
}
.qbo-banner-urgent {
  background: var(--strata-danger);
  color: var(--strata-white);
}
.qbo-banner-warning {
  background: var(--strata-warning);
  color: var(--strata-navy-dark);
}
.qbo-banner-action {
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  background: var(--strata-white);
  color: var(--strata-navy-dark);
  border: 1px solid var(--strata-navy-dark);
}
.qbo-banner-action:hover {
  background: var(--strata-navy-dark);
  color: var(--strata-white);
}

/* --- PM console list/board polish (PM console polish spec) --- */

/* Sortable column header links (translation/services pm_list.html) */
.sort-link {
  color: var(--strata-navy);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.sort-link:hover { text-decoration: underline; }
.sort-indicator { font-size: 0.7rem; }

/* Reusable prev/next pagination control (templates/partials/pagination.html) */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
}
.pagination-status {
  color: var(--strata-gray);
  font-size: 0.85rem;
}

/* Per-file line-item cards (translation/pm_detail.html) */
.file-card { padding: 1.25rem; }
.file-card + .file-card { margin-top: 1rem; }
.file-info-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.file-assignments-panel {
  margin-top: 0.85rem;
  /* Two sub-sections share this tint-panel: "who's currently assigned" (badges + Remove/
     Show comments) and "assign someone new" (production details + AI suggestions +
     dropdown/Assign). The divider below keeps them visually distinct instead of blending
     into one undifferentiated block (owner QA feedback). */
  /* Scoped override, NOT a change to the shared --strata-tint variable (#e3f4f9) other
     panels still use — one shade lighter, per owner request that this specific block read
     less heavy than the rest of the tint-panel family. */
  background: #eef9fc;
}
/* Same scoped lighter-tint override as .file-assignments-panel above, extended to the rest
   of the .file-card's tint-panel family per owner request (Item 2, follow-up round) — reuses
   the identical #eef9fc value for visual consistency across the whole card. Deliberately NOT
   a change to the shared .tint-panel/--strata-tint rule itself, so every other .tint-panel
   elsewhere in the app stays its current color. */
.file-comments-panel,
.file-translator-copy-panel,
.file-visual-reference-panel,
.file-pm-self-serve-panel,
.file-version-history-panel {
  background: #eef9fc;
}
.file-assignments-current { margin-bottom: 0.85rem; }
.assignment-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.assignment-row + .assignment-row { margin-top: 0.4rem; }
.assignment-row-secondary {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin: 0.2rem 0 0.4rem;
}
/* Columnar assignment layout (one lane per TranslationAssignment.Kind) — flex row of
   fixed-width columns, matching .stage-strip/.stage-seg's existing "N items side by
   side" precedent above rather than a new pattern. Collapses to a single stacked column
   under the same 767px breakpoint the rest of the app already uses for mobile. */
.file-assignments-columns {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}
.assignment-col {
  flex: 1 1 0;
  min-width: 0;
  background: var(--surface-sunken);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 0.5rem 0.6rem;
}
.assignment-col-header {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--strata-gray);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.4rem;
}
.assignment-col-empty {
  color: var(--strata-gray);
  font-size: 0.8rem;
}
.assignment-col .assignment-row { align-items: flex-start; }
@media (max-width: 767px) {
  .file-assignments-columns { flex-direction: column; }
}
.file-assignments-divider {
  margin: 0 0 0.85rem;
  border: none;
  border-top: 1px solid var(--strata-border);
}
.file-advance-row {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--strata-border);
}

/* --- Status-change control (translation/interpretation/services pm_detail.html) ---
   Replaces the old pill-row of buttons (one per legal next status) — clicking one made
   the others visually vanish, which read as a bug rather than a real dropdown (owner QA
   feedback). This <select> + submit button posts to the exact same view/URL the pill
   links used to, with the same `to` field name — presentation-only change. */
.status-change-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.status-change-form select {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--strata-border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: var(--strata-white);
}
.status-change-form select:focus {
  outline: none;
  border-color: var(--strata-blue);
  box-shadow: 0 0 0 3px rgba(55, 171, 255, 0.25);
}
/* Compact variant for the per-file row in translation/pm_detail.html, which sits inside
   an already-dense line-item card alongside other .8rem controls. */
.status-change-form.status-change-compact select {
  font-size: 0.8rem;
  padding: 0.25rem 0.4rem;
}

/* --- Reporting (Phase 7): period selector, KPI stat cards, CSS-only bar charts ---
   No JS charting library — deliberate architecture decision to match this codebase's
   no-CDN, no-build-step CSP constraint. Bar widths are set via inline `style="width: NN%"`
   (CSP-safe since style-src already allows 'unsafe-inline'), with the percentage computed
   in-template via the built-in {% widthratio %} tag against each row-set's own max value —
   no new Python code, no custom template filter. */

.period-selector {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.period-pill {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: var(--strata-tint);
  color: var(--strata-navy);
  font-weight: 600;
  font-size: 0.85rem;
  border: 1px solid transparent;
}
.period-pill:hover { background: var(--strata-blue); color: var(--strata-navy-dark); text-decoration: none; }
.period-pill.active { background: var(--strata-navy); color: var(--strata-white); }

/* KPI stat cards (overview + section summaries) — a `.card` with a big number */
.stat-card .stat-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--strata-gray);
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.stat-card .stat-value {
  font-family: var(--font-heading);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--strata-navy);
  line-height: 1.2;
}
.stat-card .stat-sub {
  font-size: 0.85rem;
  color: var(--strata-gray);
  margin-top: 0.3rem;
}

/* CSS-only bar charts */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.bar-chart-title {
  margin: 0 0 0.75rem;
}
.bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 160px) 1fr auto;
  align-items: center;
  gap: 0.75rem;
}
.bar-row-label {
  font-size: 0.85rem;
  color: var(--strata-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-track {
  background: var(--strata-tint);
  border-radius: 999px;
  height: 14px;
  overflow: hidden;
  width: 100%;
}
.bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  max-width: 100%;
  background: var(--strata-blue);
}
.bar-fill-navy { background: var(--strata-navy); }
.bar-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--strata-navy);
  white-space: nowrap;
  min-width: 3.5rem;
  text-align: right;
}

/* Two-series bar groups (e.g. quoted vs. accepted per client) */
.bar-group + .bar-group {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--strata-border);
}
.bar-group-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--strata-navy);
  margin-bottom: 0.4rem;
}
.bar-group .bar-row { grid-template-columns: minmax(70px, 110px) 1fr auto; margin-bottom: 0.3rem; }

.bar-legend {
  display: flex;
  gap: 1.25rem;
  font-size: 0.8rem;
  color: var(--strata-gray);
  margin-bottom: 0.75rem;
}
.bar-legend-swatch {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 3px;
  margin-right: 0.35rem;
  vertical-align: middle;
}

@media (max-width: 600px) {
  .bar-row { grid-template-columns: 1fr; row-gap: 0.2rem; }
  .bar-value { text-align: left; }
}

/* --- Page header block (templates/partials/page_header.html, GUI redesign Phase 1) ---
   Not consumed by any page yet in this pass (Slice B rollout is a later step) — this is
   just the reusable style for when pages start including the partial. */
.page-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.page-header-crumb {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}
.page-header-title { margin: 0.15rem 0 0; }
.page-header-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.page-header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

/* --- Per-file production stage strip (pm_detail.html file cards) --- */
.stage-strip { display: flex; gap: .4rem; margin: .5rem 0; }
.stage-seg {
  flex: 1;
  text-align: center;
  padding: .3rem .2rem;
  border-top: 3px solid var(--strata-border);
}
.stage-seg--active { border-top-color: var(--strata-navy); }
.stage-seg--done { border-top-color: var(--strata-success); }
.stage-seg-label { display: block; font-size: .65rem; font-weight: 600; color: var(--strata-gray); text-transform: uppercase; letter-spacing: .03em; }
.stage-seg-who { display: block; font-size: .7rem; color: var(--strata-gray); margin-top: .1rem; min-height: 1em; }

/* --- Comment-thread tab strip (pm_detail.html) --- */
.tab-strip { margin-bottom: 1rem; }
.tab-btn {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: .5rem .9rem; font-size: .85rem; font-weight: 600; color: var(--strata-gray); cursor: pointer;
}
.tab-btn.active { color: var(--strata-navy); border-bottom-color: var(--strata-navy); }

/* --- Activity feed (pm_detail.html "Activity" tab, _activity_feed.html) --- */
.activity-feed { list-style: none; margin: 0; padding: 0; }
.activity-feed-row { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--strata-border); }
.activity-feed-row:last-child { border-bottom: none; }
.activity-feed-text { flex: 1; }
.activity-feed-time { color: var(--strata-gray); font-size: .8rem; white-space: nowrap; }
.activity-feed-note { color: var(--strata-gray); font-size: .8rem; margin-top: .5rem; }

/* --- 2-column detail page shell (pm_detail.html) --- */
.detail-layout { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; align-items: start; }
.detail-sidebar { display: flex; flex-direction: column; gap: 1rem; }
@media (max-width: 900px) {
  .detail-layout { grid-template-columns: 1fr; }
  .detail-sidebar { order: -1; }
}

/* --- Interpretation PM Kanban board (pm_board.html, GUI redesign Phase 4) ---
   Row of status columns, horizontally scrollable when they overflow. Columns sit on
   --surface-sunken (the same "recessed panel" token used elsewhere — e.g. the header
   search input) so the white .card cards read as raised above the column background. */
.pm-board {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
}
.pm-board-column {
  min-width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-sunken);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: .75rem;
}
.pm-board-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin: 0 0 .6rem;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--strata-gray);
}
.pm-board-column-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  overflow-y: auto;
  max-height: 65vh;
}
.pm-board-card-link { display: block; text-decoration: none; }
.pm-board-card {
  margin-bottom: 0;
  cursor: grab;
}
.pm-board-card:active { cursor: grabbing; }
.pm-board-card-subject {
  margin: .3rem 0 0;
  font-size: .9rem;
  color: var(--strata-ink);
}
.pm-board-card-meta {
  margin: .3rem 0 0;
  font-size: .8rem;
  color: var(--strata-gray);
}
.pm-board-card-subject.unseen-card-title,
.pm-board-card-meta.unseen-card-title {
  font-weight: 600;
}
.pm-board-empty {
  margin: 0;
  font-size: .85rem;
  color: var(--strata-gray);
}

/* --- Force-status override reason dialog (pm_board.html "Override status" <dialog>) --- */
.pm-board-dialog {
  border: none;
  border-radius: var(--radius);
  padding: 1.25rem;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-sm);
}
.pm-board-dialog h3 { margin-top: 0; }
.pm-board-dialog-description {
  font-size: .85rem;
  color: var(--strata-gray);
}
.pm-board-dialog-error {
  display: none;
  font-size: .85rem;
  color: var(--strata-danger);
}
.pm-board-dialog-actions {
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
  margin-top: .75rem;
}

/* --- Mobile stage-picker (GUI redesign Phase 7, Slice 2) — shared by both PM Kanban
   boards (interpretation/pm_board.html + translation/partials/pm_board_view.html). Native
   HTML5 drag-and-drop already doesn't fire on touch browsers, so both boards are read-only
   on mobile in practice already; status changes there go through each item's detail page,
   same as today. Below max-width:767px (the same breakpoint the bottom nav uses, no new
   breakpoint) this hides every .pm-board-column except the one carrying is-active-stage
   (toggled by Alpine's activeStage, set on the board root) and shows a horizontally-
   scrollable chip strip to switch between them. Desktop is untouched — .stage-picker is
   display:none by default and the column-hiding rule only exists inside the media query. */
.stage-picker {
  display: none;
}
.stage-picker-chip {
  flex-shrink: 0;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: var(--strata-tint);
  color: var(--strata-navy);
  font-weight: 600;
  font-size: 0.85rem;
  font-family: var(--font-body);
  border: 1px solid transparent;
  cursor: pointer;
}
.stage-picker-chip.is-active { background: var(--strata-navy); color: var(--strata-white); }

@media (max-width: 767px) {
  .stage-picker {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    padding-bottom: .75rem;
    margin-bottom: .75rem;
  }
  .pm-board {
    flex-direction: column;
    overflow-x: visible;
  }
  .pm-board-column:not(.is-active-stage) {
    display: none;
  }
  .pm-board-column {
    min-width: 0;
    width: 100%;
  }
}

/* --- Empty-state block (templates/partials/empty_state_row.html) --- */
.empty-state {
  text-align: center;
  padding: 2.25rem 1.5rem;
}
.empty-state-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  color: var(--strata-navy);
  margin: 0 0 0.4rem;
}
.empty-state-body {
  font-size: 0.9rem;
  color: var(--strata-gray);
  margin: 0 0 1rem;
}
.empty-state-body:last-child { margin-bottom: 0; }
.empty-state .btn { margin-top: 0.25rem; }

/* --- PM "Today" dashboard (core/dashboard_pm.html, GUI redesign Phase 5) ---
   Stat-card row: reuses .card/.stat-card/.stat-label/.stat-value from the Phase 7 reporting
   KPI cards above (same look, just wrapped in a full-card <a> and using an explicit 4-col
   grid instead of grid-cards' auto-fit, so it stacks to 1 column at the same 900px
   breakpoint the detail-page 2-column layout above uses, for consistency). */
.pm-today-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.stat-card-link:hover {
  text-decoration: none;
  border-color: var(--strata-blue);
  box-shadow: var(--shadow-md);
}
@media (max-width: 900px) {
  .pm-today-stats { grid-template-columns: 1fr; }
}

/* --- Client "Home" dashboard (core/dashboard_client.html, GUI redesign Phase 6, Round 1) ---
   Same 3-card stat row treatment as `.pm-today-stats` above (reuses .card/.stat-card/
   .stat-label/.stat-value, same .stat-card-link hover/box-shadow), just a 3-column sibling
   since this page's stat_cards list is always exactly 3 items, not 4 — a shared 4-col grid
   would leave a lopsided empty column on wide viewports. Same 900px single-column stack
   breakpoint as `.pm-today-stats` for consistency. */
.client-home-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 900px) {
  .client-home-stats { grid-template-columns: 1fr; }
}

/* "Needs you today" rows — label/sublabel on the left, due date + reason tags on the
   right, each row separated by a hairline (same divider pattern as .activity-feed-row). */
.needs-you-list { list-style: none; margin: 0; padding: 0; }
.needs-you-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--strata-border);
}
.needs-you-row:last-child { border-bottom: none; }
.needs-you-main { display: flex; flex-direction: column; gap: 0.15rem; min-width: 200px; }
.needs-you-label { font-weight: 600; }
.needs-you-sublabel { font-size: 0.85rem; color: var(--strata-gray); }
.needs-you-side { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; justify-content: flex-end; }
.needs-you-due { font-size: 0.85rem; font-weight: 600; color: var(--strata-navy); white-space: nowrap; }
.needs-you-reasons { display: flex; gap: 0.35rem; flex-wrap: wrap; }
@media (max-width: 900px) {
  .needs-you-row { flex-direction: column; align-items: flex-start; }
  .needs-you-side { justify-content: flex-start; }
}

/* --- Auth pages (allauth login/logout/password-reset — templates/allauth/) --- */
body.auth-page .app-main {
  max-width: 440px;
  margin: 3rem auto;
  background: var(--strata-white);
  border: 1px solid var(--strata-border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}
body.auth-page form p { margin: 0 0 1.1rem; }
body.auth-page form label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--strata-navy);
  margin-bottom: 0.3rem;
}
body.auth-page form input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--strata-border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.95rem;
}
body.auth-page form input:focus {
  outline: none;
  border-color: var(--strata-blue);
  box-shadow: 0 0 0 3px rgba(55, 171, 255, 0.25);
}
body.auth-page .btn { width: 100%; justify-content: center; margin-top: 0.25rem; }
body.auth-page .errorlist {
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 0;
  color: var(--strata-danger);
  font-size: 0.85rem;
}

/* --- In-app assistant widget (apps/assistant/templates/assistant/_widget.html,
   _transcript.html) --- */
.assistant-widget {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 50;
}

.assistant-launcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.25rem;
  background: var(--strata-navy);
  color: var(--strata-white);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}
.assistant-launcher-btn:hover { background: var(--strata-navy-dark); }

.assistant-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.75rem);
  width: min(380px, calc(100vw - 3rem));
  max-height: min(560px, calc(100vh - 8rem));
  display: flex;
  flex-direction: column;
  background: var(--strata-white);
  border: 1px solid var(--strata-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.assistant-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  background: var(--strata-navy);
  color: var(--strata-white);
  flex-shrink: 0;
}
.assistant-panel-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
}
.assistant-new-conversation-btn {
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  background: transparent;
  color: var(--strata-white);
  border-color: var(--strata-white);
}
.assistant-new-conversation-btn:hover {
  background: var(--strata-white);
  color: var(--strata-navy);
}

.assistant-panel-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.assistant-transcript {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.assistant-transcript-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.assistant-transcript-empty {
  color: var(--strata-gray);
  font-size: 0.85rem;
  margin: 0;
}

.assistant-message {
  display: flex;
}
.assistant-message-bubble {
  max-width: 85%;
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.assistant-message-user {
  justify-content: flex-end;
}
.assistant-message-user .assistant-message-bubble {
  background: var(--strata-navy);
  color: var(--strata-white);
}

.assistant-message-assistant {
  justify-content: flex-start;
}
.assistant-message-assistant .assistant-message-bubble {
  background: var(--strata-tint);
  color: var(--strata-ink);
}

.assistant-message-notice {
  justify-content: center;
}
.assistant-message-notice .assistant-message-bubble {
  background: transparent;
  color: var(--strata-gray);
  font-style: italic;
  font-size: 0.8rem;
  text-align: center;
  max-width: 100%;
  padding: 0.3rem 0.5rem;
}

.assistant-thinking {
  padding: 0 1rem 0.5rem;
  color: var(--strata-gray);
  font-size: 0.8rem;
  font-style: italic;
  flex-shrink: 0;
}

.assistant-message-form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--strata-border);
  flex-shrink: 0;
}
.assistant-message-input {
  flex: 1;
  resize: none;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--strata-border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.88rem;
}
.assistant-message-input:focus {
  outline: none;
  border-color: var(--strata-blue);
  box-shadow: 0 0 0 3px rgba(55, 171, 255, 0.25);
}
.assistant-send-btn {
  flex-shrink: 0;
  padding: 0.5rem 0.9rem;
}
.assistant-message-form.htmx-request .assistant-send-btn,
.assistant-message-form.htmx-request .assistant-message-input {
  opacity: 0.6;
}

@media (max-width: 600px) {
  .assistant-widget { right: 1rem; bottom: 1rem; }
  .assistant-panel { width: calc(100vw - 2rem); right: -0.25rem; }
}

/* GUI redesign Phase 7, Slice 1 — the new mobile bottom nav bar (see .bottom-nav above)
   sits fixed at the bottom of the same max-width:767px viewport range, so push the
   assistant widget's launcher/panel up above it. Declared after the max-width:600px block
   above so it wins the cascade for the 0-600px range too (same specificity, later wins),
   not just the 601-767px range it would otherwise be alone in. */
@media (max-width: 767px) {
  .assistant-widget { bottom: calc(var(--bottom-nav-height) + 1rem); }
}

/* GUI redesign Phase 7, Slice 4 — hit-target sizing + full-width card actions. Every rule
   here is min-height/padding on already-existing classes; no markup changes anywhere.
   .header-tab was ~30px tall, .btn ~35px, .app-header .icon-btn had no explicit size (relies
   on its ~19px SVG) — all bumped to a 44px minimum, the standard touch-target floor, only
   below the mobile breakpoint (desktop sizing is untouched). Buttons/links that are a card's
   own primary action go full-width so they read as a tappable action, not a small text link
   lost at the end of a card. */
@media (max-width: 767px) {
  .btn, .header-tab, .app-header .icon-btn {
    min-height: 44px;
  }
  .btn, .header-tab {
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
  }
  .app-header .icon-btn {
    min-width: 44px;
  }
  .card > .btn:only-of-type,
  .card > form:only-of-type > .btn,
  .pm-board-card .btn,
  .data-table-cards .btn {
    display: flex;
    width: 100%;
    justify-content: center;
  }
}
