:root {
  /* --- Legacy aliases → Design Guide v5 tokens ---
   * All 25 views consume these. Remapping here cascades everywhere. */
  --bg: var(--fc-surface-canvas, #f7f8fa);
  --panel: var(--fc-surface-raised, #ffffff);
  --ink: var(--fc-text-default, #1f2535);
  --muted: var(--fc-text-muted, #6b7385);
  --line: var(--fc-border-default, #d6dae3);
  --custody-navy: #0a1628;
  --custody-navy-soft: #0f2035;
  --custody-cyan: var(--fc-color-brand-400, #3877f7);
  --custody-blue: var(--fc-color-brand-500, #1f5fe6);
  --accent: var(--fc-color-brand-500, #1f5fe6);
  --accent-strong: var(--fc-color-brand-600, #154bc2);
  --gold: var(--fc-color-warning-500, #c97a0c);
  --red: var(--fc-color-danger-500, #d6342a);
  --blue: var(--fc-color-brand-500, #1f5fe6);
  --focus: var(--fc-color-brand-400, #3877f7);
  --shadow: var(--fc-shadow-lg, 0 12px 24px -8px rgba(11, 16, 32, 0.14), 0 4px 8px -4px rgba(11, 16, 32, 0.06));
  --shadow-sm: var(--fc-shadow-sm, 0 1px 2px rgba(11, 16, 32, 0.06), 0 1px 3px rgba(11, 16, 32, 0.04));
  --shadow-md: var(--fc-shadow-md, 0 4px 8px -2px rgba(11, 16, 32, 0.08), 0 2px 4px -2px rgba(11, 16, 32, 0.04));
  --shadow-hover: 0 8px 25px rgba(11, 16, 32, 0.12);
  --shadow-lg: var(--fc-shadow-xl, 0 24px 48px -12px rgba(11, 16, 32, 0.22));
  --radius: var(--fc-radius-lg, 10px);
  --radius-sm: var(--fc-radius-md, 6px);
  --radius-lg: var(--fc-radius-xl, 16px);
  --transition: var(--fc-motion-duration-base, 180ms) var(--fc-motion-ease-standard, cubic-bezier(0.2, 0, 0, 1));
}

* {
  box-sizing: border-box;
}

*:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body.large-text {
  font-size: 18px;
}

body.high-contrast {
  --bg: var(--fc-color-neutral-0, #ffffff);
  --panel: var(--fc-color-neutral-0, #ffffff);
  --ink: #000000;
  --muted: var(--fc-color-neutral-700, #353c4d);
  --line: var(--fc-color-neutral-900, #0b1020);
  --accent: var(--fc-color-brand-700, #0f3a99);
  --accent-strong: var(--fc-color-brand-800, #0a2a70);
  --shadow: none;
}

body.high-contrast .sidebar {
  background: #000000;
  /* Black surface: flip the wordmark to white so it stays legible. */
  --fc-sidebar-brand-text: #ffffff;
}

body.high-contrast .record,
body.high-contrast .fc-record,
body.high-contrast .decision,
body.high-contrast .queue-item,
body.high-contrast .agent-card,
body.high-contrast .memory-card,
body.high-contrast .fallback-card {
  background: var(--fc-surface-raised, #ffffff);
}

button,
input,
select,
textarea {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: 1rem;
  z-index: 1000;
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  background: var(--accent-strong);
  color: #ffffff;
  font-weight: 800;
  transform: translateY(-180%);
  transition: transform 0.15s ease;
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.app-shell {
  display: grid;
  grid-template-columns: 276px 1fr;
  min-height: 100vh;
}

.sidebar {
  /* Canonical white surface — literal hex per the June 25 2026 spec. The
   * per-surface dark overrides (surface-platform-command, surface-client-portal)
   * have been removed; the only surface that flips this is body.high-contrast.
   * Using a literal value (not a var() fallback) keeps non-browser agents like
   * jsdom resolving the canonical white background. */
  background-color: #ffffff;
  color: var(--fc-sidebar-text, #5f6d84);
  border-right: 1px solid var(--fc-sidebar-border, #e2e6ed);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: var(--fc-sidebar-width, 220px);
}

.brand {
  display: flex;
  align-items: center;
  min-height: 72px;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  /* Wordmark color is governed by the context-aware token: dark on the light
   * sidebar, white under dark surfaces (high-contrast / platform-command /
   * client-portal). Replaces the old shared #b9c5be governor. */
  color: var(--fc-sidebar-brand-text, #0b152b);
  font-size: 13px;
}

.side-panel p {
  color: #b9c5be;
  font-size: 13px;
}

.brand-link {
  display: block;
  width: 100%;
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
  max-height: 120px;
  object-fit: contain;
  object-position: center;
  border-radius: var(--radius);
}

.nav-list {
  display: grid;
  gap: 6px;
  flex: 1 1 auto;
  overflow: auto;
  padding-right: 4px;
}

.nav-item,
.fc-nav-item {
  background: transparent;
  border: 0;
  color: var(--fc-sidebar-text, rgba(255, 255, 255, 0.65));
  text-align: left;
  padding: 9px 12px;
  border-left: 3px solid transparent;
  border-radius: 0 var(--fc-radius-sm, 4px) var(--fc-radius-sm, 4px) 0;
  font-size: 14px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.nav-item.active,
.fc-nav-item.active {
  background: var(--fc-sidebar-active-bg, rgba(59, 130, 246, 0.25));
  border-left-color: var(--fc-sidebar-active-border, #3877f7);
  color: var(--fc-sidebar-text-active, #ffffff);
}

.nav-item:hover,
.fc-nav-item:hover {
  background: var(--fc-sidebar-hover-bg, rgba(255, 255, 255, 0.08));
  color: var(--fc-sidebar-text-active, #ffffff);
}

/* Today-v2 sidebar (mirrors .fc-nav-item v1 rail) */
.nav-v2-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
  overflow: auto;
  padding-right: 4px;
  list-style: none;
  margin: 0;
}

.nav-v2-item {
  background: transparent;
  border: 0;
  color: var(--fc-sidebar-text, rgba(255, 255, 255, 0.65));
  text-align: left;
  padding: 9px 12px;
  border-left: 3px solid transparent;
  border-radius: 0 var(--fc-radius-sm, 4px) var(--fc-radius-sm, 4px) 0;
  font-size: 14px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  width: 100%;
  text-decoration: none;
}

.nav-v2-item.active {
  background: var(--fc-sidebar-active-bg, rgba(59, 130, 246, 0.25));
  border-left-color: var(--fc-sidebar-active-border, #3877f7);
  color: var(--fc-sidebar-text-active, #ffffff);
}

.nav-v2-item:hover {
  background: var(--fc-sidebar-hover-bg, rgba(255, 255, 255, 0.08));
  color: var(--fc-sidebar-text-active, #ffffff);
}

.nav-v2-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

.nav-v2-label {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-v2-badge {
  flex: 0 0 auto;
  margin-left: auto;
  min-width: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  line-height: 1.4;
}

/* ----------------------------------------------------------------------------
 * Canonical light sidebar (June 25, 2026 — applies uniformly to attorney,
 * admin/platform-command, and client-portal surfaces).
 * The high-contrast override (body.high-contrast .sidebar) remains untouched.
 * -------------------------------------------------------------------------- */

.fc-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  letter-spacing: 0.02em;
}

.fc-brand-wordmark {
  font-size: 15px;
  font-weight: 700;
  color: var(--fc-sidebar-brand-text, #0b152b);
}

.fc-sidebar-search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid #e2e6ed;
  border-radius: 6px;
  padding: 6px 8px;
}

.fc-sidebar-search input[type="search"] {
  flex: 1 1 auto;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 13px;
  color: var(--fc-text-default, #0b152b);
  min-width: 0;
}

.fc-sidebar-search input[type="search"]::placeholder {
  color: #5f6d84;
}

.fc-sidebar-search-kbd {
  background: #f1f5f9;
  color: #5f6d84;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  flex: 0 0 auto;
}

/* Timer widget is hidden on canonical sidebar surfaces.
 * Excludes the high-contrast override so accessibility users keep parity. */
body:not(.high-contrast) .sidebar .time-tracker,
body:not(.high-contrast) .sidebar-bottom .time-tracker {
  display: none;
}

/* v2.6 product pillars: Evidence / Draft / Trial */
.pillar-bar,
.fc-pillar-bar {
  display: grid;
  gap: 6px;
  margin: 0 0 10px;
  padding: 0 0 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.pillar-item,
.fc-pillar-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  row-gap: 2px;
  align-items: center;
  background: transparent;
  border: 0;
  border-left: 3px solid transparent;
  color: #d9e5de;
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.pillar-item:hover,
.fc-pillar-item:hover {
  background: rgba(255, 255, 255, 0.06);
}
.pillar-item.active,
.fc-pillar-item.active {
  background: rgba(255, 255, 255, 0.10);
  border-left-color: var(--custody-cyan);
}
.pillar-icon,
.fc-pillar-icon {
  grid-row: 1 / span 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--custody-cyan);
}
.pillar-label,
.fc-pillar-label {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.1;
}
.pillar-tm,
.fc-pillar-tm {
  font-size: 0.65em;
  vertical-align: super;
  margin-left: 1px;
  opacity: 0.75;
}
.pillar-blurb,
.fc-pillar-blurb {
  font-size: 0.72rem;
  line-height: 1.25;
  color: rgba(217, 229, 222, 0.7);
  grid-column: 2;
}
.pillar-discover,
.fc-pillar-discover {
  display: grid;
  gap: 2px;
  text-align: left;
  background: rgba(0, 184, 217, 0.08);
  border: 1px solid rgba(0, 184, 217, 0.25);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-top: 4px;
  color: #d9e5de;
  cursor: pointer;
}
.pillar-discover:hover,
.fc-pillar-discover:hover {
  background: rgba(0, 184, 217, 0.14);
}
.pillar-discover-tag,
.fc-pillar-discover-tag {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--custody-cyan);
  font-weight: 700;
}
.pillar-discover-feature,
.fc-pillar-discover-feature {
  font-size: 0.85rem;
  font-weight: 600;
}
.pillar-discover-teaser,
.fc-pillar-discover-teaser {
  font-size: 0.72rem;
  color: rgba(217, 229, 222, 0.75);
  line-height: 1.3;
}

.sidebar-bottom {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.sidebar-search input {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  color: #f8fbf8;
  padding: 9px 10px;
}

.sidebar-search input::placeholder {
  color: #b9c5be;
}

.ai-prompt-shell {
  display: none;
}
.document-ai-prompt-panel {
  min-width: 0;
}

.ai-prompt-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(219, 228, 240, 0.22);
  border-radius: var(--radius);
  background: rgba(6, 24, 59, 0.88);
  color: #ffffff;
}

.document-ai-prompt-panel {
  margin-bottom: 14px;
}

.draft-ai-prompt {
  margin-top: 12px;
}

.document-ai-prompt-panel .ai-prompt-box {
  background: var(--fc-surface-canvas, #f7f8fa);
  color: var(--ink);
  border-color: var(--line);
}

.draft-ai-prompt .ai-prompt-box {
  background: var(--fc-surface-raised, #ffffff);
  color: var(--ink);
  border-color: var(--line);
}

.ai-prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ai-prompt-box textarea {
  width: 100%;
  min-height: 92px;
  border-radius: var(--radius);
  border: 1px solid rgba(219, 228, 240, 0.34);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  resize: vertical;
}

.document-ai-prompt-panel .ai-prompt-box textarea {
  min-height: 74px;
  background: var(--fc-surface-raised, #ffffff);
  color: var(--ink);
}

.draft-ai-prompt .ai-prompt-box textarea {
  min-height: 74px;
  background: var(--fc-surface-raised, #ffffff);
  color: var(--ink);
}

.ai-prompt-box textarea::placeholder {
  color: var(--fc-text-muted, #6b7385);
}

.document-ai-prompt-panel .ai-prompt-box textarea::placeholder {
  color: var(--muted);
}

.draft-ai-prompt .ai-prompt-box textarea::placeholder {
  color: var(--muted);
}

.ai-prompt-suggestions,
.ai-scope-options {
  display: grid;
  gap: 6px;
}

.ai-scope-options {
  border: 0;
  padding: 0;
  margin: 0;
}

.ai-scope-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fc-text-muted, #6b7385);
  font-size: 12px;
}

.document-ai-prompt-panel .ai-scope-options label {
  color: var(--muted);
}

.draft-ai-prompt .ai-scope-options label {
  color: var(--muted);
}

.ai-scope-options input {
  width: auto;
}

.ai-prompt-box .ghost-btn,
.ai-prompt-box .primary-btn {
  width: 100%;
}

.ai-prompt-box small {
  color: var(--fc-text-muted, #6b7385);
}

.document-ai-prompt-panel .ai-prompt-box small {
  color: var(--muted);
}

.draft-ai-prompt .ai-prompt-box small {
  color: var(--muted);
}

.sidebar-command {
  justify-content: center;
  width: 100%;
}

.recent-matters {
  display: grid;
  gap: 6px;
}

.recent-matter,
.fc-recent-matter {
  min-height: 34px;
  border: 0;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.07);
  color: #d9e5de;
  cursor: pointer;
  font: inherit;
  padding: 8px 10px;
  text-align: left;
}

.recent-matter:hover,
.recent-matter:focus-visible,
.fc-recent-matter:hover,
.fc-recent-matter:focus-visible {
  background: rgba(21, 203, 221, 0.18);
  outline: 2px solid rgba(21, 203, 221, 0.45);
}

.settings-nav-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #d9e5de;
  text-align: left;
  padding: 10px 12px;
  border-left: 3px solid transparent;
}

.settings-nav-button.active,
.settings-nav-button:hover,
.settings-nav-button:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  border-left-color: var(--custody-cyan);
  outline: none;
}

.firm-admin-nav-button {
  margin-top: 8px;
}

.nav-icon {
  width: 18px;
  text-align: center;
}

body.surface-client-portal {
  --bg: var(--fc-color-brand-50, #eaf1ff);
  --accent: var(--fc-color-brand-500, #1f5fe6);
  --accent-strong: var(--fc-color-brand-600, #154bc2);
}

body.surface-client-portal .side-panel,
body.surface-client-portal #run-autonomous,
body.surface-client-portal #run-learning,
body.surface-client-portal #new-matter {
  display: none;
}

body.surface-client-portal .nav-item,
body.surface-client-portal .fc-nav-item {
  padding: 14px 12px;
  font-weight: 750;
}

body.surface-platform-command .nav-item.active,
body.surface-platform-command .nav-item:hover,
body.surface-platform-command .fc-nav-item.active,
body.surface-platform-command .fc-nav-item:hover,
body.surface-platform-command .nav-v2-item.active,
body.surface-platform-command .nav-v2-item:hover {
  border-left-color: var(--custody-cyan);
}

body.auth-required .sidebar,
body.auth-required .view:not(#command-view),
body.auth-required #user-selector,
body.auth-required #logout,
body.auth-required #new-matter,
body.auth-required #run-learning,
body.auth-required [data-write-action],
body.auth-required .topbar-search,
body.auth-required #resume-work,
body.auth-required #quick-create,
body.auth-required #voice-input,
body.auth-required #hearing-countdown,
body.auth-required #language-selector,
body.auth-required #role-status,
body.auth-required #api-status,
body.auth-required #plain-language-toggle,
body.auth-required #large-text-toggle,
body.auth-required #contrast-toggle,
body.auth-required .metric-grid,
body.auth-required .two-col,
body.auth-required #command-view > :not(.auth-required-panel) {
  display: none !important;
}

html.has-session-hint body.auth-required .top-actions,
html.has-session-hint body.auth-required .auth-required-panel {
  visibility: hidden;
}

body.auth-required {
  background: var(--bg, #f6f8fb);
}

body.auth-required .app-shell {
  grid-template-columns: 1fr;
  min-height: 100vh;
  background: transparent;
}

body.auth-required .main {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 0.82fr);
  gap: clamp(32px, 6vw, 86px);
  align-items: center;
  max-width: 1320px;
  min-height: 100vh;
  width: 100%;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 72px);
  overflow: hidden;
}

body.auth-required .topbar {
  grid-column: 2;
  grid-row: 1;
  align-items: stretch;
  background: transparent;
  margin: 0;
  position: relative;
  z-index: 2;
}

body.auth-required .topbar-firm {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

body.auth-required .login-form {
  width: 100%;
  max-width: none;
  grid-template-columns: 1fr;
  gap: 18px;
}

body.auth-required .top-actions {
  flex: none;
  width: 100%;
  justify-content: center;
}

body:not(.auth-required) .topbar > .top-actions > :not(#logout) {
  display: none !important;
}

.topbar #logout {
  background: var(--panel, #1a2340);
  color: #fff;
  border: 1px solid var(--line, #2a3450);
}
.topbar #logout:hover {
  background: var(--bg, #0d1525);
}

.auth-required-panel {
  grid-column: 1;
  grid-row: 1;
  max-width: 560px;
  overflow: hidden;
  color: var(--ink, #0b152b);
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  position: relative;
  z-index: 1;
}

.auth-required-panel::before {
  content: "";
  position: absolute;
  left: -80px;
  top: -120px;
  width: 560px;
  height: 560px;
  border: 2px solid rgba(11, 132, 255, 0.08);
  border-radius: 50%;
  pointer-events: none;
}

.auth-hero {
  display: block;
}

.auth-copy {
  display: grid;
  gap: 22px;
}

.auth-brand-lockup {
  width: min(420px, 86vw);
  height: auto;
  margin-bottom: 8px;
  filter: drop-shadow(0 20px 38px rgba(0, 10, 34, 0.10));
}

.auth-kicker {
  color: var(--accent, #0b84ff);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-kicker::before {
  content: "";
  display: block;
  width: 44px;
  height: 3px;
  margin-bottom: 26px;
  background: var(--accent, #0b84ff);
  border-radius: 999px;
}

.auth-copy h2 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 1.06;
  letter-spacing: 0;
}

.auth-copy p {
  max-width: 520px;
  color: var(--muted, #5f6d84);
  font-size: 1.08rem;
  line-height: 1.6;
}

.auth-value-grid,
.auth-trust-grid {
  display: grid;
  gap: 0;
}

.auth-value-grid {
  grid-template-columns: 1fr;
  margin-top: 18px;
}

.auth-value,
.auth-trust-item {
  border: 0;
  border-top: 1px solid var(--line, #dbe4f0);
  background: transparent;
  padding: 22px 0 22px 92px;
  position: relative;
}

.auth-value::before,
.auth-trust-item::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 22px;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  color: var(--accent, #0b84ff);
  background: rgba(11, 132, 255, 0.08);
  border: 1px solid rgba(11, 132, 255, 0.12);
}

.auth-value strong,
.auth-trust-item strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ink, #0b152b);
  font-size: 1.04rem;
}

.auth-value small,
.auth-trust-item small {
  color: var(--muted, #5f6d84);
  line-height: 1.45;
}

.auth-path {
  display: none;
}

.auth-path h3 {
  margin: 0 0 10px;
}

.auth-path ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.auth-path li strong {
  color: var(--ink);
}

.auth-required-panel ul {
  margin: 14px 0 0;
  padding-left: 22px;
  color: var(--muted);
}

.auth-required-panel li + li {
  margin-top: 8px;
}

.auth-form-card {
  width: min(100%, 610px);
  min-height: 610px;
  display: grid;
  gap: 22px;
  padding: clamp(30px, 4vw, 64px);
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #e2e6ed;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.auth-card-copy {
  display: grid;
  gap: 8px;
}

.auth-card-copy h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
}

.auth-card-copy p,
.dialog-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.auth-field {
  display: grid;
  gap: 10px;
  color: var(--ink);
  font-weight: 750;
}

.input-shell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  min-height: 48px;
  border: 1px solid #e2e6ed;
  border-radius: 8px;
  background: #ffffff;
  padding: 0 16px;
}

.password-shell {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.input-icon {
  color: var(--fc-text-muted, #8a94a6);
  margin-right: 14px;
}

.login-form .input-shell input:focus {
  outline: 0;
}

.password-toggle {
  color: var(--fc-text-muted, #718096);
  background: transparent;
  border: 0;
  box-shadow: none;
}

.auth-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.remember-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.remember-control input {
  width: 18px;
  height: 18px;
  accent-color: var(--custody-blue);
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font: inherit;
  font-weight: 650;
  padding: 0;
  cursor: pointer;
}

.auth-submit,
.google-btn {
  min-height: 58px;
  width: 100%;
  justify-content: center;
}

.auth-submit {
  border: 0;
  background: linear-gradient(90deg, var(--fc-color-brand-400, #3877f7), var(--fc-color-brand-600, #154bc2));
  box-shadow: 0 14px 28px rgba(0, 78, 232, 0.25);
}

.auth-status-message {
  min-height: 22px;
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.35;
}

.auth-status-message[data-state="error"] {
  color: var(--fc-color-danger-500, #d6342a);
}

.auth-status-message[data-state="success"] {
  color: var(--fc-color-success-500, #1f9d55);
}

.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  color: var(--fc-text-muted, #8a94a6);
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.google-btn {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--fc-surface-raised, #ffffff);
  color: var(--ink);
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.google-btn span {
  color: var(--fc-color-danger-500, #ea4335);
  font-weight: 850;
}

.auth-create-copy {
  margin: 0;
  text-align: center;
  color: var(--muted);
}

.auth-request-steps {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--fc-surface-canvas, #f7f8fa);
}

.side-panel {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow-sm);
}

.eyebrow,
.fc-eyebrow {
  color: var(--fc-text-muted);
  font-size: var(--fc-font-size-xs);
  text-transform: uppercase;
  font-weight: var(--fc-font-weight-semibold);
  letter-spacing: var(--fc-letter-spacing-wide);
}

.main {
  padding: 24px;
  min-width: 0;
  overflow: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 22px;
}

.topbar-firm {
  flex: 1 1 100%;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.firm-logo {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: contain;
}

.topbar-search {
  flex: 1 1 280px;
  min-width: min(100%, 260px);
}

.topbar-search input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--fc-border-default);
  border-radius: var(--fc-radius-lg);
  background: var(--fc-surface-raised);
  color: var(--fc-text-default);
  padding: var(--fc-space-3) var(--fc-space-4);
}

.view,
.panel,
.metric,
.record,
.fc-record,
.decision,
.queue-item,
.agent-card,
.memory-card,
.fallback-card {
  min-width: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: var(--fc-space-2);
  font-size: var(--fc-font-size-2xl);
  font-weight: var(--fc-font-weight-bold);
  color: var(--fc-text-strong);
  letter-spacing: var(--fc-letter-spacing-tight);
}

h2 {
  margin-bottom: 0;
  font-size: var(--fc-font-size-lg);
  font-weight: var(--fc-font-weight-semibold);
  color: var(--fc-text-strong);
}

.topbar p,
.panel p,
small {
  color: var(--fc-text-muted);
  font-size: var(--fc-font-size-sm);
}

.top-actions,
.panel-head,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: var(--fc-space-3);
}

.top-actions {
  flex: 1 1 420px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.login-form {
  display: grid;
  grid-template-columns: minmax(9rem, 13rem) minmax(9rem, 13rem) minmax(4.75rem, 6rem) auto;
  gap: 8px;
  align-items: center;
}

.login-form input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.58rem 0.7rem;
  background: var(--panel);
  color: var(--ink);
}

.login-form input[hidden] {
  display: none;
}

.login-form .mfa-input {
  max-width: 6rem;
}

.review-task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.review-packet {
  display: grid;
  gap: 4px;
  margin: 10px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--fc-surface-raised, #ffffff);
}

#action-handoff > .queue-item {
  grid-column: 1 / -1;
}

#action-handoff .review-packet small {
  overflow-wrap: anywhere;
}

.review-command {
  display: block;
  margin-top: 3px;
  color: var(--accent-strong);
  font-size: 12px;
}

.packet-action-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
  align-items: end;
  margin: 6px 0;
}

.packet-action-filters label {
  display: grid;
  gap: 3px;
  font-size: 12px;
  color: var(--muted);
}

.packet-action-filters button {
  min-height: 38px;
}

.risk-note {
  color: var(--red);
}

.compact-action {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.panel-head {
  flex-wrap: wrap;
}

.primary-btn,
.ghost-btn,
.icon-btn,
.segment {
  min-height: 38px;
  border: 1px solid var(--fc-border-default);
  border-radius: var(--fc-radius-md);
  background: var(--fc-surface-raised);
  color: var(--fc-text-default);
  padding: 0 var(--fc-space-5);
  font-size: var(--fc-font-size-sm);
  font-weight: var(--fc-font-weight-medium);
  transition: all 0.15s ease;
}

.primary-btn {
  background: var(--fc-color-brand-500);
  border-color: var(--fc-color-brand-500);
  color: var(--fc-text-inverse);
  font-weight: var(--fc-font-weight-semibold);
  border-radius: var(--fc-radius-md);
}

.primary-btn:hover {
  background: var(--fc-color-brand-600);
  border-color: var(--fc-color-brand-600);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(31, 95, 230, 0.25);
}

.primary-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.ghost-btn:hover,
.icon-btn:hover,
.segment:hover {
  border-color: var(--fc-border-focus);
  background: var(--fc-color-brand-50);
}

.active-toggle {
  border-color: var(--fc-color-brand-500);
  background: var(--fc-color-brand-50);
  color: var(--fc-color-brand-600);
  font-weight: var(--fc-font-weight-semibold);
}

.icon-btn {
  width: 40px;
  padding: 0;
}

.step-list {
  display: grid;
  gap: var(--fc-space-3);
  margin: var(--fc-space-4) 0;
  padding: 0;
  list-style: none;
}

.step-list li {
  display: grid;
  grid-template-columns: 26px 1fr 40px;
  align-items: center;
  gap: var(--fc-space-3);
  color: var(--fc-text-muted);
}

.step-list span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--fc-border-default);
  border-radius: 50%;
  background: var(--fc-surface-raised);
  color: var(--fc-text-muted);
  font-size: var(--fc-font-size-xs);
  font-weight: var(--fc-font-weight-bold);
  transition: all 0.15s ease;
}

.step-list .step-active span,
.step-list .step-complete span {
  border-color: var(--fc-color-brand-500);
  background: var(--fc-color-brand-50);
  color: var(--fc-color-brand-600);
}

.step-list .step-complete small {
  color: var(--fc-text-default);
  font-weight: var(--fc-font-weight-bold);
}

.improvement-note {
  border-left: 3px solid var(--fc-color-brand-500);
  padding-left: var(--fc-space-4);
  color: var(--fc-text-muted);
  font-size: var(--fc-font-size-sm);
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

.feature-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.feature-card {
  background: var(--custody-navy-soft, #0f2847);
  color: var(--fc-text-inverse, #fff);
  border: 1px solid rgba(25, 217, 239, 0.22);
  border-radius: var(--radius, 8px);
  padding: 18px 20px;
  text-align: center;
  cursor: pointer;
  transition: box-shadow var(--transition, 0.15s), transform var(--transition, 0.15s);
}

.feature-card:hover {
  box-shadow: 0 6px 18px rgba(20, 30, 60, 0.25);
  transform: translateY(-2px);
}

.feature-card-icon {
  color: rgba(25, 217, 239, 0.7);
  margin-bottom: 6px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.feature-card strong {
  display: block;
  font-size: 16px;
  margin-bottom: 6px;
}

.feature-card small {
  display: block;
  color: var(--fc-text-muted, #b9c5be);
  font-size: 12px;
  line-height: 1.4;
}

.dashboard-scroll-list {
  max-height: 240px;
  overflow-y: auto;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric,
.panel {
  background: var(--fc-surface-raised);
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-lg);
  box-shadow: var(--fc-shadow-xs, 0 1px 1px rgba(11,16,32,0.04));
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.metric:hover,
.panel:hover {
  box-shadow: var(--fc-shadow-sm, 0 1px 3px rgba(11,16,32,0.06), 0 1px 2px rgba(11,16,32,0.04));
}

.metric {
  padding: var(--fc-space-4) var(--fc-space-5);
  min-height: 0;
}

.metric-link {
  background: var(--fc-color-brand-500);
  color: var(--fc-text-inverse);
  border: none;
  cursor: pointer;
  text-align: left;
}

.metric-link:hover {
  background: var(--fc-color-brand-600);
}

.metric-label {
  font-size: var(--fc-font-size-xs);
  text-transform: uppercase;
  letter-spacing: var(--fc-letter-spacing-wide);
  font-weight: var(--fc-font-weight-medium);
  opacity: 0.85;
}

.metric-link .metric-label,
.metric-link small {
  color: rgba(255, 255, 255, 0.85);
}

.metric span,
.metric small {
  display: block;
}

.metric strong {
  display: block;
  margin: 4px 0 2px;
  font-size: 22px;
}

.metric-link strong {
  color: var(--fc-text-inverse);
}

.panel {
  padding: var(--fc-space-6);
}

body.auth-required .auth-required-panel {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

body.auth-required .auth-copy h2 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 1.06;
}

.panel-head {
  justify-content: space-between;
  margin-bottom: var(--fc-space-5);
  font-size: var(--fc-font-size-md);
  font-weight: var(--fc-font-weight-semibold);
  color: var(--fc-text-strong);
}

.two-col,
.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 18px;
}

.stack,
.record-list,
.learning-list,
.ledger {
  display: grid;
  gap: 10px;
}

.record,
.fc-record,
.decision,
.queue-item,
.agent-card,
.memory-card,
.fallback-card {
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-md);
  background: var(--fc-surface-raised);
  padding: var(--fc-space-4);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.record:hover,
.fc-record:hover,
.decision:hover,
.queue-item:hover,
.agent-card:hover,
.memory-card:hover,
.fallback-card:hover {
  border-color: var(--fc-color-brand-200);
  box-shadow: var(--fc-shadow-xs, 0 1px 1px rgba(11,16,32,0.04));
}

.record,
.fc-record {
  display: grid;
  gap: var(--fc-space-3);
}

.operating-workspace {
  display: grid;
  gap: var(--fc-space-6);
}

.operating-head {
  align-items: flex-start;
}

.operating-head p {
  max-width: 820px;
  color: var(--fc-text-muted);
  font-size: var(--fc-font-size-sm);
  line-height: var(--fc-line-height-sm);
}

.operating-metric-grid {
  display: grid;
  gap: var(--fc-space-4);
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.operating-metric {
  border: 1px solid var(--fc-border-subtle);
  background: var(--fc-surface-raised);
  border-radius: var(--fc-radius-lg);
  min-height: 104px;
  padding: var(--fc-space-5);
  transition: box-shadow 0.15s ease;
}

.operating-metric:hover {
  box-shadow: var(--fc-shadow-xs, 0 1px 1px rgba(11,16,32,0.04));
}

.operating-metric span,
.operating-metric small {
  color: var(--fc-text-muted);
  display: block;
  font-size: var(--fc-font-size-xs);
  text-transform: uppercase;
  letter-spacing: var(--fc-letter-spacing-wide);
  font-weight: var(--fc-font-weight-medium);
}

.operating-metric strong {
  display: block;
  font-size: var(--fc-font-size-xl);
  font-weight: var(--fc-font-weight-bold);
  color: var(--fc-text-strong);
  margin: var(--fc-space-3) 0 var(--fc-space-1);
}

.operating-grid {
  display: grid;
  gap: var(--fc-space-5);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.operating-section {
  border: 1px solid var(--fc-border-subtle);
  background: var(--fc-surface-raised);
  border-radius: var(--fc-radius-lg);
  display: grid;
  gap: var(--fc-space-4);
  min-width: 0;
  padding: var(--fc-space-5);
  transition: box-shadow 0.15s ease;
}

.operating-section:hover {
  box-shadow: var(--fc-shadow-xs, 0 1px 1px rgba(11,16,32,0.04));
}

.operating-section h3 {
  margin: 0;
  font-size: var(--fc-font-size-sm);
  font-weight: var(--fc-font-weight-semibold);
  color: var(--fc-text-strong);
}

.operating-record {
  min-width: 0;
}

.phase-two-note {
  border: 1px dashed var(--fc-border-default);
  background: var(--fc-surface-canvas);
  border-radius: var(--fc-radius-md);
  display: grid;
  gap: var(--fc-space-2);
  padding: var(--fc-space-4);
  font-size: var(--fc-font-size-sm);
  color: var(--fc-text-muted);
}

.roadmap-list {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.roadmap-step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: var(--fc-space-4);
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-md);
  background: var(--fc-surface-canvas);
  padding: var(--fc-space-4);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.roadmap-step:hover {
  box-shadow: var(--fc-shadow-xs, 0 1px 1px rgba(11,16,32,0.04));
}

.roadmap-step.current {
  border-color: var(--fc-color-brand-400);
  background: var(--fc-color-brand-50);
}

.roadmap-dot {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--fc-radius-sm);
  background: var(--fc-color-neutral-800);
  color: var(--fc-text-inverse);
  font-weight: var(--fc-font-weight-bold);
  font-size: var(--fc-font-size-xs);
}

.resource-link {
  color: var(--fc-text-link);
  font-weight: var(--fc-font-weight-semibold);
  text-decoration: none;
}

.resource-link:hover {
  text-decoration: underline;
  color: var(--fc-text-link-hover);
}

.matter-button.selected {
  border-color: var(--fc-color-brand-400);
  background: var(--fc-color-brand-50);
}

.record-row,
.fc-record-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--fc-space-4);
  min-width: 0;
}

.status-pill,
.risk,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: var(--fc-radius-pill);
  font-size: var(--fc-font-size-xs);
  font-weight: var(--fc-font-weight-semibold);
  letter-spacing: var(--fc-letter-spacing-wide);
  background: var(--fc-color-success-50);
  color: var(--fc-color-success-700);
}

.risk.high {
  background: var(--fc-color-danger-50);
  color: var(--fc-color-danger-700);
}

.risk.medium {
  background: var(--fc-color-warning-50);
  color: var(--fc-color-warning-700);
}

.api-online {
  background: var(--fc-color-success-50);
  color: var(--fc-color-success-700);
}

.api-local {
  background: var(--fc-color-warning-50);
  color: var(--fc-color-warning-700);
}

.queue-grid,
.board-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.board-grid {
  grid-template-columns: 1fr;
}

.advisor-board-dashboard {
  display: grid;
  gap: 16px;
}

.advisor-hero,
.advisor-summary-grid,
.judge-card-grid,
.advisor-report-grid,
.scenario-grid {
  display: grid;
  gap: 12px;
}

.advisor-hero {
  grid-template-columns: minmax(0, 1.5fr) minmax(220px, 0.5fr);
  align-items: stretch;
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-lg);
  background: var(--fc-surface-canvas);
  padding: var(--fc-space-5);
}

.advisor-hero h3 {
  margin: 10px 0 6px;
  font-size: 22px;
}

.advisor-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.advisor-summary-grid article,
.confidence-card,
.advisor-panel,
.judge-card,
.scenario-grid article,
.advisor-empty-state {
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-lg);
  background: var(--fc-surface-raised);
  padding: var(--fc-space-4);
  transition: box-shadow 0.15s ease;
}

.advisor-summary-grid article:hover,
.judge-card:hover,
.scenario-grid article:hover {
  box-shadow: var(--fc-shadow-xs, 0 1px 1px rgba(11,16,32,0.04));
}

.advisor-summary-grid span,
.confidence-card span {
  color: var(--fc-text-muted);
  font-size: var(--fc-font-size-xs);
  font-weight: var(--fc-font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--fc-letter-spacing-wide);
}

.advisor-summary-grid strong,
.confidence-card strong {
  display: block;
  margin: 6px 0;
  font-size: 20px;
}

.confidence-track {
  height: 8px;
  background: var(--fc-color-neutral-150);
  border-radius: var(--fc-radius-pill);
  overflow: hidden;
}

.confidence-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--fc-color-brand-500), var(--fc-color-brand-400));
}

.judge-card-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.judge-card {
  display: grid;
  gap: 9px;
  min-height: 260px;
}

.judge-card dl {
  display: grid;
  gap: 5px;
  margin: 0;
}

.judge-card dt {
  color: var(--fc-text-muted);
  font-size: 11px;
  font-weight: var(--fc-font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--fc-letter-spacing-wide);
}

.judge-card dd {
  margin: 0;
  font-size: 12px;
}

.advisor-report-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.advisor-panel.wide {
  grid-column: 1 / -1;
}

.advisor-panel h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

.risk-heat-map,
.influence-map {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prediction-list,
.attack-row {
  display: grid;
  gap: 8px;
}

.prediction-list div,
.attack-row {
  border-top: 1px solid var(--line);
  padding-top: 9px;
}

.prediction-list div:first-child,
.attack-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.prediction-list strong,
.prediction-list span {
  display: block;
}

.scenario-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.queue-item strong,
.agent-card strong,
.memory-card strong {
  display: block;
  margin-bottom: 6px;
}

.queue-item p,
.agent-card p,
.memory-card p,
.fallback-card p {
  margin-bottom: 0;
  font-size: 13px;
}

.detail-panel {
  min-height: 520px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--fc-space-3);
  margin: var(--fc-space-5) 0;
}

.detail-stat {
  background: var(--fc-surface-canvas);
  padding: var(--fc-space-4);
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-md);
  transition: box-shadow 0.15s ease;
}

.detail-stat:hover {
  box-shadow: var(--fc-shadow-xs, 0 1px 1px rgba(11,16,32,0.04));
}

.detail-stat span {
  display: block;
  color: var(--fc-text-muted);
  font-size: var(--fc-font-size-xs);
  text-transform: uppercase;
  letter-spacing: var(--fc-letter-spacing-wide);
  font-weight: var(--fc-font-weight-medium);
}

.detail-stat strong {
  display: block;
  margin-top: var(--fc-space-2);
  font-size: var(--fc-font-size-md);
  font-weight: var(--fc-font-weight-bold);
  color: var(--fc-text-strong);
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--fc-border-default);
  border-radius: var(--fc-radius-md);
  background: var(--fc-surface-canvas);
  overflow: hidden;
}

.segment {
  border: 0;
  border-right: 1px solid var(--fc-border-default);
}

.segment:last-child {
  border-right: 0;
}

.segment.active {
  background: var(--fc-color-neutral-800);
  color: var(--fc-text-inverse);
}

.evidence-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(310px, 0.8fr);
  gap: var(--fc-space-6);
}

.timeline {
  display: grid;
  gap: 0;
}

.timeline-item {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: var(--fc-space-4);
  padding: var(--fc-space-4) 0;
  border-bottom: 1px solid var(--fc-border-subtle);
}

.timeline-date {
  color: var(--fc-text-muted);
  font-weight: var(--fc-font-weight-semibold);
  font-size: var(--fc-font-size-sm);
}

.timeline-body strong {
  display: block;
}

.timeline-body p {
  margin: 4px 0 7px;
}

.insights {
  display: grid;
  gap: 10px;
  align-content: start;
}

.mini-chronology {
  display: grid;
  gap: 8px;
}

.chronology-card {
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-md);
  background: var(--fc-surface-raised);
  padding: var(--fc-space-4);
  box-shadow: var(--fc-shadow-xs, 0 1px 1px rgba(11,16,32,0.04));
  transition: box-shadow 0.15s ease;
}

.chronology-card:hover {
  box-shadow: var(--fc-shadow-sm, 0 1px 3px rgba(11,16,32,0.06), 0 1px 2px rgba(11,16,32,0.04));
}

.chronology-card p {
  margin: 6px 0;
}

/* Swimlane timeline grid */
.swimlane-scroll-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.swimlane-grid {
  display: grid;
  min-width: 480px;
}
.swimlane-corner {
  border-bottom: 1px solid var(--fc-border-default);
}
.swimlane-col-header {
  font-size: var(--fc-font-size-xs);
  color: var(--fc-text-muted);
  text-align: center;
  padding: var(--fc-space-3) var(--fc-space-2);
  border-bottom: 1px solid var(--fc-border-default);
}
.swimlane-lane-label {
  font-size: var(--fc-font-size-sm);
  font-weight: var(--fc-font-weight-semibold);
  padding: var(--fc-space-4) var(--fc-space-3);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--fc-border-subtle);
  border-radius: 0 var(--fc-radius-sm) var(--fc-radius-sm) 0;
}
.swimlane-cell {
  display: flex;
  flex-direction: column;
  gap: var(--fc-space-2);
  padding: var(--fc-space-3);
  border-bottom: 1px solid var(--fc-border-subtle);
  min-height: 48px;
  align-items: center;
  justify-content: center;
}
.swimlane-event {
  padding: var(--fc-space-3) var(--fc-space-4);
  border-radius: 0 var(--fc-radius-md) var(--fc-radius-md) 0;
  width: 100%;
}
.swimlane-event-title {
  display: block;
  font-size: var(--fc-font-size-xs);
  font-weight: var(--fc-font-weight-semibold);
  line-height: var(--fc-line-height-sm);
}
.swimlane-event-date {
  display: block;
  font-size: 11px;
  opacity: 0.8;
  margin-top: 2px;
}

.draft-form,
.evidence-form,
.communication-form {
  display: grid;
  gap: var(--fc-space-4);
}

.communication-form {
  margin-bottom: var(--fc-space-4);
}

.evidence-form {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: end;
  margin-bottom: var(--fc-space-5);
}

.evidence-drop-zone {
  display: grid;
  gap: var(--fc-space-3);
  min-height: 96px;
  align-content: center;
  border: 1px dashed var(--fc-border-default);
  border-radius: var(--fc-radius-md);
  padding: var(--fc-space-4);
  background: var(--fc-surface-raised);
}

.evidence-upload-queue {
  display: grid;
  gap: 8px;
}

.evidence-upload-row {
  display: flex;
  justify-content: space-between;
  gap: var(--fc-space-4);
  padding: var(--fc-space-3) var(--fc-space-4);
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-md);
  background: var(--fc-surface-raised);
}

.checkbox-line {
  display: flex;
  align-items: center;
  min-height: 42px;
}

.inline-form {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.checkbox-line input {
  width: auto;
}

label {
  display: grid;
  gap: var(--fc-space-2);
  color: var(--fc-text-muted);
  font-size: var(--fc-font-size-sm);
  font-weight: var(--fc-font-weight-medium);
}

input,
select,
textarea {
  border: 1px solid var(--fc-border-default);
  border-radius: var(--fc-radius-md);
  background: var(--fc-surface-raised);
  color: var(--fc-text-default);
  padding: var(--fc-space-3) var(--fc-space-4);
  font-size: var(--fc-font-size-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--fc-border-focus);
  box-shadow: 0 0 0 3px var(--fc-color-brand-50);
}

.login-form .input-shell input {
  border: 0;
  border-radius: 0;
  padding: 0;
  min-height: 56px;
  width: 100%;
}

#user-selector,
#language-selector {
  min-height: 38px;
  max-width: 230px;
}

textarea {
  resize: vertical;
}

.check-row {
  display: flex;
  align-items: center;
  color: var(--fc-text-default);
}

.draft-preview {
  min-height: 210px;
  white-space: pre-wrap;
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-md);
  background: var(--fc-surface-canvas);
  padding: var(--fc-space-5);
  overflow: auto;
  margin-bottom: var(--fc-space-5);
  font-size: var(--fc-font-size-sm);
  line-height: var(--fc-line-height-sm);
}

.law-head {
  margin-top: 6px;
}

.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;
}

.settings-shortcut-strip {
  display: flex;
  justify-content: space-between;
  gap: var(--fc-space-4);
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-lg);
  background: var(--fc-surface-canvas);
  padding: var(--fc-space-5);
  transition: box-shadow 0.15s ease;
}

.settings-shortcut-strip:hover {
  box-shadow: var(--fc-shadow-xs, 0 1px 1px rgba(11,16,32,0.04));
}

.settings-shell {
  display: grid;
  gap: 16px;
}

.settings-title-row p {
  margin-top: 6px;
}

.settings-search input {
  width: 100%;
  min-height: 44px;
}

.settings-layout {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: 16px;
}

.settings-category-list {
  display: grid;
  align-content: start;
  gap: 8px;
}

.settings-category-button,
.fc-settings-category-button {
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-md);
  background: var(--fc-surface-raised);
  color: var(--fc-text-default);
  padding: var(--fc-space-3) var(--fc-space-4);
  text-align: left;
  font-weight: var(--fc-font-weight-semibold);
  font-size: var(--fc-font-size-sm);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.settings-category-button.active,
.settings-category-button:hover,
.settings-category-button:focus-visible,
.fc-settings-category-button.active,
.fc-settings-category-button:hover,
.fc-settings-category-button:focus-visible {
  border-color: var(--fc-color-brand-400);
  background: var(--fc-color-brand-50);
  outline: none;
}

.settings-content {
  display: grid;
  gap: 12px;
}

.settings-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.settings-card,
.document-source-card,
.document-check-card {
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-md);
  background: var(--fc-surface-raised);
  padding: var(--fc-space-4);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.settings-card:hover,
.document-source-card:hover,
.document-check-card:hover {
  border-color: var(--fc-color-brand-200);
  box-shadow: var(--fc-shadow-xs, 0 1px 1px rgba(11,16,32,0.04));
}

.settings-card.locked {
  background: var(--fc-surface-canvas);
  opacity: 0.74;
}

.settings-actions,
.document-workflow-actions {
  display: flex;
  justify-content: space-between;
  gap: var(--fc-space-4);
  border-top: 1px solid var(--fc-border-subtle);
  padding-top: var(--fc-space-4);
}

.firm-admin-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--fc-space-6);
  padding: var(--fc-space-5);
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-md);
  background: var(--fc-surface-raised);
}

.firm-admin-hero h2 {
  margin: var(--fc-space-1) 0 var(--fc-space-2);
  color: var(--fc-text-strong);
  font-size: var(--fc-font-size-2xl);
  line-height: var(--fc-line-height-2xl);
}

.firm-admin-hero p {
  max-width: 760px;
  margin: 0;
  color: var(--fc-text-default);
  font-size: var(--fc-font-size-sm);
  line-height: var(--fc-line-height-md);
}

.firm-admin-eyebrow {
  display: block;
  color: var(--fc-color-brand-600);
  font-size: var(--fc-font-size-xs);
  font-weight: var(--fc-font-weight-semibold);
  letter-spacing: 0;
  text-transform: uppercase;
}

.firm-admin-meta,
.firm-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--fc-space-2);
}

.firm-admin-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--fc-space-3);
}

.firm-admin-metric,
.firm-admin-card,
.firm-admin-denied {
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-md);
  background: var(--fc-surface-raised);
  padding: var(--fc-space-4);
}

.firm-admin-metric {
  display: grid;
  gap: var(--fc-space-1);
}

.firm-admin-metric strong {
  color: var(--fc-text-strong);
  font-size: var(--fc-font-size-xl);
  line-height: var(--fc-line-height-xl);
}

.firm-admin-metric span,
.firm-admin-metric small,
.firm-admin-card p,
.firm-admin-list {
  color: var(--fc-text-muted);
  font-size: var(--fc-font-size-sm);
  line-height: var(--fc-line-height-md);
}

.firm-admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--fc-space-4);
}

.firm-admin-card {
  display: flex;
  flex-direction: column;
  gap: var(--fc-space-3);
}

.firm-admin-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--fc-space-3);
}

.firm-admin-card h3 {
  margin: var(--fc-space-1) 0 0;
  color: var(--fc-text-strong);
  font-size: var(--fc-font-size-lg);
  line-height: var(--fc-line-height-lg);
}

.firm-admin-card p {
  margin: 0;
}

.firm-admin-list {
  display: grid;
  gap: var(--fc-space-2);
  margin: 0;
  padding-left: var(--fc-space-5);
}

.firm-admin-denied {
  display: grid;
  gap: var(--fc-space-3);
}

.firm-admin-denied h3,
.firm-admin-denied p {
  margin: 0;
}

@media (max-width: 1100px) {
  .firm-admin-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .firm-admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  .firm-admin-hero {
    flex-direction: column;
  }

  .firm-admin-metrics {
    grid-template-columns: 1fr;
  }
}

#document-dialog {
  width: min(980px, calc(100vw - 32px));
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.document-workflow-grid {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 16px;
}

.workflow-steps,
.document-type-picker,
.document-sources,
.document-safety-grid,
.document-output-grid {
  display: grid;
  gap: 8px;
}

.workflow-step {
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-md);
  background: var(--fc-surface-canvas);
  padding: var(--fc-space-3) var(--fc-space-4);
  color: var(--fc-text-muted);
  font-weight: var(--fc-font-weight-semibold);
  font-size: var(--fc-font-size-sm);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.workflow-step:hover {
  border-color: var(--fc-color-brand-400);
  background: var(--fc-color-brand-50);
}

.workflow-step.active {
  background: var(--fc-color-brand-50);
  border-color: var(--fc-color-brand-500);
  color: var(--fc-text-default);
}

.document-type-button {
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-md);
  background: var(--fc-surface-raised);
  color: var(--fc-text-default);
  min-height: 40px;
  padding: 0 var(--fc-space-4);
  text-align: left;
  font-size: var(--fc-font-size-sm);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.document-type-button.active,
.document-type-button:hover,
.document-type-button:focus-visible {
  border-color: var(--fc-color-brand-400);
  background: var(--fc-color-brand-50);
  outline: none;
}

.workflow-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.document-context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.document-source-card label {
  color: var(--fc-text-default);
  font-weight: var(--fc-font-weight-semibold);
}

.document-draft-preview {
  white-space: pre-wrap;
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-md);
  background: var(--fc-surface-canvas);
  padding: var(--fc-space-5);
  max-height: 340px;
  overflow: auto;
  font-size: var(--fc-font-size-sm);
  line-height: var(--fc-line-height-sm);
}

.agent-card {
  min-height: 150px;
}

.agent-card.lawyer {
  border-color: var(--fc-color-warning-500);
  background: var(--fc-color-warning-50);
}

dialog {
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-xl);
  box-shadow: 0 24px 80px rgba(11, 16, 32, 0.18), 0 8px 24px rgba(11, 16, 32, 0.08);
  padding: 0;
  width: min(460px, calc(100vw - 32px));
}

dialog.wide-dialog {
  width: min(980px, calc(100vw - 32px));
  max-height: min(88vh, 920px);
  overflow: auto;
}

dialog::backdrop {
  background: var(--fc-surface-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

dialog form {
  padding: var(--fc-space-6);
  display: grid;
  gap: var(--fc-space-5);
}

.law-firm-signup-form {
  gap: 18px;
}

.signup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.signup-section {
  display: grid;
  align-content: start;
  gap: var(--fc-space-4);
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-lg);
  padding: var(--fc-space-5);
  background: var(--fc-surface-raised);
}

.signup-section.full-width {
  grid-column: 1 / -1;
}

.signup-section h3 {
  margin: 0;
  color: var(--fc-text-strong);
  font-size: var(--fc-font-size-md);
  font-weight: var(--fc-font-weight-semibold);
}

.signup-section textarea {
  resize: vertical;
}

.signup-policy-note,
.auth-request-steps {
  display: grid;
  gap: var(--fc-space-2);
  border: 1px solid var(--fc-border-default);
  border-radius: var(--fc-radius-lg);
  padding: var(--fc-space-4);
  background: var(--fc-surface-canvas);
  color: var(--fc-text-default);
}

.signup-policy-note span,
.auth-request-steps span {
  color: var(--fc-text-muted);
  line-height: 1.45;
  font-size: var(--fc-font-size-sm);
}

.signup-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px 16px;
}

/* ── Signup agreement block (replaces individual checkboxes) ── */
.signup-agreement-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.signup-agreement-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--panel);
  border: 1.5px solid var(--border);
  font-size: 14px;
  color: var(--text-secondary, #666);
}
.signup-agreement-status.accepted {
  background: var(--fc-color-success-50, #f0fdf4);
  border-color: var(--fc-color-success-500, #22c55e);
  color: var(--fc-color-success-700, #15803d);
}
.signup-agreement-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.signup-agreement-status.accepted .signup-agreement-icon {
  color: var(--fc-color-success-500, #22c55e);
}
.signup-agreement-note {
  font-size: 12px;
  color: var(--text-secondary, #888);
  line-height: 1.5;
  margin: 0;
}

/* ── Registration agreement dialog ── */
.registration-agreement-dialog {
  width: min(680px, 96vw);
  max-height: 92vh;
  max-height: 92dvh;
  padding: 0;
  border: none;
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.18), 0 8px 24px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--fc-surface-canvas, #f5f5f7);
}
.registration-agreement-dialog::backdrop {
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.reg-agreement-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: rgba(255,255,255,0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--fc-border-default, #d2d2d7);
  flex-shrink: 0;
}
.reg-agreement-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.reg-agreement-logo {
  font-size: 18px;
  color: var(--fc-text-default, #0d0d1a);
}
.reg-agreement-version {
  margin-left: auto;
  font-size: 11px;
  color: var(--fc-text-muted, #86868b);
  background: var(--fc-surface-canvas, #f5f5f7);
  border: 1px solid var(--fc-border-default, #e8e8ed);
  padding: 2px 8px;
  border-radius: 20px;
}
.reg-agreement-topbar .icon-btn {
  margin-left: 8px;
}

.reg-agreement-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 24px 24px;
  -webkit-overflow-scrolling: touch;
}

.reg-agreement-hero {
  text-align: center;
  padding: 36px 0 28px;
}
.reg-agreement-hero .eyebrow,
.reg-agreement-hero .fc-eyebrow {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--fc-color-brand-500, #0071e3);
  margin-bottom: 8px;
  display: block;
}
.reg-agreement-hero h2 {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--fc-text-default, #1d1d1f);
  margin-bottom: 8px;
  border: none;
  padding: 0;
  text-transform: none;
}
.reg-agreement-hero p {
  font-size: 14px;
  color: var(--fc-text-muted, #6e6e73);
  line-height: 1.5;
  max-width: 440px;
  margin: 0 auto;
}
.reg-agreement-date {
  display: inline-block;
  margin-top: 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--fc-text-muted, #86868b);
  background: var(--fc-surface-raised, #fff);
  border: 1px solid var(--fc-border-default, #e8e8ed);
  padding: 3px 10px;
  border-radius: 20px;
}

.reg-agreement-linked {
  background: var(--fc-surface-raised, #fff);
  border: 1px solid var(--fc-border-default, #e8e8ed);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
}
.reg-agreement-linked-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--fc-text-muted, #86868b);
  margin-bottom: 10px;
}
.reg-agreement-linked-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.reg-agreement-linked-grid a {
  font-size: 13px;
  font-weight: 500;
  color: var(--fc-color-brand-500, #0071e3);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.15s;
}
.reg-agreement-linked-grid a:hover {
  background: var(--fc-color-brand-50, #f0f5ff);
}

/* ── Accordion sections ── */
.reg-section {
  background: var(--fc-surface-raised, #fff);
  border: 1px solid var(--fc-border-default, #e8e8ed);
  border-radius: 12px;
  margin-bottom: 8px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.reg-section:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.reg-section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.reg-section-head:hover {
  background: var(--fc-surface-canvas, #fbfbfd);
}
.reg-section-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--fc-surface-canvas, #f5f5f7);
  border: 1.5px solid var(--fc-border-default, #e8e8ed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--fc-text-muted, #6e6e73);
  flex-shrink: 0;
  transition: all 0.2s;
}
.reg-section.open .reg-section-num {
  background: var(--fc-color-brand-500, #0071e3);
  border-color: var(--fc-color-brand-500, #0071e3);
  color: var(--fc-text-inverse, #fff);
}
.reg-section-titles {
  flex: 1;
  min-width: 0;
}
.reg-section-titles strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--fc-text-default, #1d1d1f);
  line-height: 1.3;
}
.reg-section-titles small {
  font-size: 12px;
  color: var(--fc-text-muted, #86868b);
  line-height: 1.3;
}
.reg-chevron {
  font-size: 10px;
  color: var(--fc-text-muted, #86868b);
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
  flex-shrink: 0;
}
.reg-section.open .reg-chevron {
  transform: rotate(180deg);
}
.reg-section-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4,0,0.2,1);
}
.reg-section.open .reg-section-body {
  max-height: 1200px;
}
.reg-section-body p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--fc-text-muted, #6e6e73);
  margin: 0 18px 10px 58px;
}
.reg-section-body p:last-child {
  margin-bottom: 18px;
}

.reg-callout {
  border-radius: 8px;
  padding: 12px 14px;
  margin: 8px 18px 10px 58px;
  font-size: 13px;
  line-height: 1.55;
}
.reg-callout strong {
  font-weight: 600;
}
.reg-callout.info {
  background: var(--fc-color-brand-50, #f0f5ff);
  border-left: 3px solid var(--fc-color-brand-500, #0071e3);
  color: var(--fc-color-brand-800, #1a3a5c);
}
.reg-callout.important {
  background: var(--fc-color-warning-50, #fff8f0);
  border-left: 3px solid var(--fc-color-warning-500, #f5a623);
  color: var(--fc-color-warning-800, #5c3a1a);
}

.reg-usage-table {
  width: calc(100% - 76px);
  margin: 10px 18px 10px 58px;
  border-collapse: collapse;
  font-size: 12px;
}
.reg-usage-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--fc-text-muted, #86868b);
  padding: 6px 10px;
  border-bottom: 1.5px solid var(--fc-border-default, #d2d2d7);
}
.reg-usage-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--fc-border-default, #e8e8ed);
  color: var(--fc-text-muted, #6e6e73);
}
.reg-usage-table tr:last-child td {
  border-bottom: none;
}
.reg-usage-table td:last-child {
  font-weight: 600;
  color: var(--fc-text-default, #1d1d1f);
}

/* ── Accept bar ── */
.reg-agreement-accept {
  padding: 16px 24px 20px;
  background: rgba(255,255,255,0.88);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--fc-border-default, #d2d2d7);
  flex-shrink: 0;
}
.reg-agreement-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  cursor: pointer;
}
.reg-agreement-checkbox-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--fc-border-default, #d2d2d7);
  border-radius: 6px;
  flex-shrink: 0;
  margin-top: 1px;
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
  background: var(--fc-surface-raised, #fff);
}
.reg-agreement-checkbox-row input[type="checkbox"]:checked {
  background: var(--fc-color-brand-500, #0071e3);
  border-color: var(--fc-color-brand-500, #0071e3);
}
.reg-agreement-checkbox-row input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 6px;
  height: 10px;
  border: solid var(--fc-text-inverse, #fff);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.reg-agreement-checkbox-row span {
  font-size: 13px;
  line-height: 1.45;
  color: var(--fc-text-muted, #6e6e73);
}
.reg-agreement-checkbox-row span strong {
  color: var(--fc-text-default, #1d1d1f);
}
.reg-agreement-accept .primary-btn {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
}
.reg-agreement-accept .primary-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.reg-agreement-footnote {
  text-align: center;
  font-size: 11px;
  color: var(--fc-text-muted, #86868b);
  margin: 10px 0 0;
}

@media (max-width: 600px) {
  .registration-agreement-dialog {
    width: 100vw;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .reg-agreement-linked-grid {
    grid-template-columns: 1fr;
  }
  .reg-section-body p,
  .reg-callout,
  .reg-usage-table {
    margin-left: 18px;
  }
}

@media (max-width: 1700px) {
  .two-col,
  .workspace-grid,
  .evidence-layout {
    grid-template-columns: 1fr;
  }

  .queue-grid,
  .board-grid,
  .judge-card-grid,
  .scenario-grid,
  .operating-metric-grid,
  .operating-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .advisor-summary-grid,
  .advisor-report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1060px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  body.auth-required .main {
    grid-template-columns: 1fr;
    align-items: start;
    overflow: auto;
  }

  body.auth-required .topbar,
  body.auth-required .auth-required-panel {
    grid-column: 1;
  }

  body.auth-required .topbar {
    grid-row: 2;
  }

  body.auth-required .auth-required-panel {
    grid-row: 1;
    max-width: none;
  }

  .sidebar {
    position: static;
  }

  .advisor-hero,
  .advisor-summary-grid,
  .judge-card-grid,
  .advisor-report-grid,
  .scenario-grid {
    grid-template-columns: 1fr;
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sidebar-bottom {
    margin-top: 0;
  }

  .side-panel {
    display: none;
  }

  .metric-grid,
  .queue-grid,
  .board-grid,
  .operating-metric-grid,
  .operating-grid,
  .login-form,
  .evidence-form,
  .two-col,
  .workspace-grid,
  .evidence-layout,
  .auth-hero,
  .auth-value-grid,
  .settings-layout,
  .signup-grid,
  .document-workflow-grid {
    grid-template-columns: 1fr;
  }

  .top-actions {
    flex: 0 1 auto;
    justify-content: flex-start;
    width: 100%;
  }

  .topbar > div:first-child {
    flex: 0 1 auto;
  }

  .brand {
    min-height: 88px;
  }

  .brand-logo {
    max-width: 168px;
    height: 82px;
  }
}

@media (max-width: 620px) {
  .main,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    justify-content: flex-start;
  }

  .topbar .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.auth-required .topbar .top-actions {
    display: block;
  }

  .topbar .login-form {
    grid-column: 1 / -1;
  }

  .topbar .primary-btn,
  .topbar .ghost-btn,
  .topbar .icon-btn,
  .topbar select,
  .topbar input {
    width: 100%;
  }

  .topbar .status-pill {
    justify-content: center;
  }

  .nav-list {
    grid-template-columns: 1fr 1fr;
  }

  .settings-shortcut-strip,
  .settings-actions,
  .document-workflow-actions {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    font-size: 24px;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }
}

/* ===================================================================
   RESPONSIVE SYSTEM — 375 px → 1920 px
   Mobile-first, additive layer on top of existing desktop styles.
   =================================================================== */

/* ── Global layout variables ──────────────────────────────────────── */
:root {
  --sidebar-width: 276px;
  --mobile-header-height: 56px;
}

/* ── Mobile header (hamburger bar) ───────────────────────────────── */
.mobile-header {
  display: none;
  position: sticky;
  top: 0;
  z-index: 300;
  background: linear-gradient(135deg, var(--custody-navy), var(--custody-navy-soft));
  color: #f8fbf8;
  padding: 0 16px;
  height: var(--mobile-header-height);
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0, 10, 34, 0.4);
  flex-shrink: 0;
}

.mobile-header-logo {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.3px;
  color: #f8fbf8;
}

.hamburger-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  cursor: pointer;
  color: #f8fbf8;
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.15s;
}

.hamburger-btn:hover,
.hamburger-btn:focus-visible {
  background: rgba(255, 255, 255, 0.18);
}

/* ── Sidebar backdrop (mobile only) ──────────────────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 10, 34, 0.55);
  z-index: 199;
  -webkit-tap-highlight-color: transparent;
}

/* ================================================================
   MOBILE — 767px and below
   ================================================================ */
@media (max-width: 767px) {

  /* Show mobile header */
  .mobile-header {
    display: flex;
  }

  /* App shell: single column, sidebar is off-canvas */
  .app-shell {
    grid-template-columns: 1fr !important;
    display: flex !important;
    flex-direction: column !important;
  }

  /* Sidebar: slide in from left as overlay */
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: var(--sidebar-width) !important;
    max-width: 85vw !important;
    transform: translateX(-100%) !important;
    transition: transform 0.25s ease, box-shadow 0.25s ease !important;
    z-index: 200 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar.sidebar-open {
    transform: translateX(0) !important;
    box-shadow: 4px 0 24px rgba(0, 10, 34, 0.45) !important;
  }

  /* Backdrop becomes visible when sidebar opens */
  .sidebar-backdrop.active {
    display: block;
  }

  /* Main content: full width, no left margin */
  .main {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 16px !important;
    min-height: calc(100vh - var(--mobile-header-height));
  }

  /* ── Touch targets: minimum 44×44 px ──────────────────────────── */
  button,
  [role="button"],
  .nav-item,
  .fc-nav-item,
  .nav-v2-item,
  .matter-button,
  .record,
  .fc-record,
  .primary-btn,
  .ghost-btn,
  .icon-btn,
  .link-btn,
  .settings-nav-button {
    min-height: 44px;
  }

  /* Exception: inline text links */
  p a,
  .link-inline {
    min-height: auto;
    min-width: auto;
    padding: 4px 0;
  }

  /* Nav items: bigger tap area */
  .nav-item,
  .fc-nav-item,
  .nav-v2-item,
  .settings-nav-button {
    padding: 13px 14px !important;
    font-size: 15px;
  }

  /* ── iOS input zoom prevention (must be >= 16 px) ─────────────── */
  input[type="text"],
  input[type="email"],
  input[type="date"],
  input[type="datetime-local"],
  input[type="number"],
  input[type="password"],
  input[type="search"],
  input[type="tel"],
  input[type="url"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* ── Topbar: stack vertically ────────────────────────────────── */
  .topbar {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
    margin-bottom: 16px !important;
  }

  .topbar > div:first-child {
    width: 100%;
    flex: none !important;
  }

  .topbar-search {
    width: 100% !important;
    flex: none !important;
  }

  .top-actions {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    width: 100% !important;
    gap: 8px !important;
  }

  .top-actions button,
  .top-actions select,
  .top-actions .status-pill {
    width: 100% !important;
  }

  /* ── Typography: fluid scaling ────────────────────────────────── */
  h1 {
    font-size: clamp(20px, 5.5vw, 32px) !important;
  }

  h2 {
    font-size: clamp(16px, 4.5vw, 24px) !important;
  }

  h3 {
    font-size: clamp(14px, 3.5vw, 20px) !important;
  }

  /* ── Grids -> single column ────────────────────────────────────── */
  .metric-grid,
  .queue-grid,
  .board-grid,
  .judge-card-grid,
  .scenario-grid,
  .operating-metric-grid,
  .operating-grid,
  .advisor-summary-grid,
  .advisor-report-grid,
  .two-col,
  .workspace-grid,
  .evidence-layout,
  .signup-grid,
  .document-workflow-grid,
  .login-form,
  .evidence-form,
  .settings-layout,
  .auth-hero,
  .auth-value-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── Dialog -> full-screen on mobile ──────────────────────────── */
  dialog {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    margin: 0 !important;
    top: 0 !important;
    left: 0 !important;
  }

  dialog.wide-dialog {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    overflow-y: auto !important;
  }

  dialog::backdrop {
    background: rgba(0, 10, 34, 0.7);
  }

  /* ── Calendar: compact on small screens ──────────────────────── */
  .cal-event {
    font-size: 10px !important;
    padding: 2px 4px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .cal-day-num {
    font-size: 12px !important;
  }

  .cal-toolbar {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .cal-views {
    flex-wrap: wrap !important;
  }

  .cal-month-grid {
    font-size: 12px !important;
  }

  /* ── Upload drop zone: simpler on mobile ─────────────────────── */
  .upload-drop-zone {
    padding: 20px 12px !important;
  }

  /* ── Panels: tighter padding ─────────────────────────────────── */
  .panel,
  .view,
  .section-panel,
  .content-panel {
    padding: 12px !important;
  }

  /* ── Side panel (search / recent matters): hide on mobile ─────── */
  .side-panel {
    display: none !important;
  }

  /* ── Settings layout ─────────────────────────────────────────── */
  .settings-category-list {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  /* ── Timeline ────────────────────────────────────────────────── */
  .timeline-item {
    grid-template-columns: 1fr !important;
  }

  /* ── Overflow tables -> stacked cards ─────────────────────────── */
  .data-table,
  table.responsive-table {
    display: block;
  }

  .data-table thead,
  table.responsive-table thead {
    display: none;
  }

  .data-table tbody,
  table.responsive-table tbody {
    display: block;
  }

  .data-table tr,
  table.responsive-table tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 12px;
    padding: 12px;
    background: var(--panel);
  }

  .data-table td,
  table.responsive-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 6px 0;
    border: none;
    font-size: 14px;
    gap: 8px;
  }

  .data-table td::before,
  table.responsive-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted);
    flex: 0 0 40%;
    font-size: 12px;
  }

  /* ── Matter list: full-width cards ──────────────────────────── */
  .matter-button {
    width: 100% !important;
  }

  /* ── Record cards ────────────────────────────────────────────── */
  .record,
  .fc-record {
    padding: 12px !important;
  }

  /* ── Upload file name: allow more space ──────────────────────── */
  .upload-item-name {
    max-width: 50vw !important;
  }

  /* ── Nav list: horizontal wrap on mobile ─────────────────────── */
  .nav-list {
    grid-template-columns: repeat(3, 1fr) !important;
    max-height: none !important;
    gap: 4px !important;
  }

  .sidebar-bottom {
    margin-top: 12px !important;
  }
}

/* ================================================================
   TABLET — 768 px to 1023 px
   Sidebar visible, layout intact, but tighter.
   ================================================================ */
@media (min-width: 768px) and (max-width: 1023px) {

  :root {
    --sidebar-width: 200px;
  }

  .app-shell {
    grid-template-columns: 200px 1fr !important;
  }

  .sidebar {
    width: 200px !important;
    padding: 16px !important;
  }

  .brand-logo {
    max-width: 160px !important;
    height: 68px !important;
  }

  .main {
    padding: 18px !important;
  }

  /* Two-column grids -> single on tablet */
  .advisor-summary-grid,
  .advisor-report-grid {
    grid-template-columns: 1fr !important;
  }

  /* Wide grids -> 2 columns on tablet */
  .queue-grid,
  .board-grid,
  .judge-card-grid,
  .scenario-grid,
  .operating-metric-grid,
  .operating-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  /* Side panel: hide on narrow tablet */
  .side-panel {
    display: none !important;
  }
}

/* ================================================================
   DESKTOP — 1024 px+
   Default grid layout; hamburger hidden.
   ================================================================ */
@media (min-width: 1024px) {

  .mobile-header {
    display: none !important;
  }

  .hamburger-btn {
    display: none !important;
  }

  .sidebar-backdrop {
    display: none !important;
  }

  /* Ensure sidebar is always visible and not transformed */
  .sidebar {
    position: sticky !important;
    top: 0 !important;
    height: 100vh !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ================================================================
   LARGE DESKTOP — 1440 px+
   ================================================================ */
@media (min-width: 1440px) {
  .main {
    padding: 32px !important;
  }
}

/* ================================================================
   TIMER WIDGET
   ================================================================ */
.timer-widget {
  background: var(--custody-navy-soft);
  color: var(--fc-text-inverse, #f6f8fb);
  border: 1px solid rgba(25, 217, 239, 0.22);
  border-radius: 8px;
  padding: 12px 14px;
  display: grid;
  gap: 7px;
}

.timer-widget-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fc-text-muted, #94a3b8);
}

.timer-display {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--fc-text-inverse, #f6f8fb);
  line-height: 1.1;
}

.timer-widget--running .timer-display {
  color: var(--custody-cyan);
}

.timer-client-select {
  display: grid;
  gap: 4px;
  font-size: 11px;
  color: var(--fc-border-default, #dbe4f0);
}

.timer-client-select span {
  color: var(--fc-border-default, #dbe4f0);
  font-weight: 600;
}

.timer-client-select input {
  width: 100%;
  min-height: 34px;
  border: 1px solid rgba(219, 228, 240, 0.22);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  padding: 8px 9px;
  font: inherit;
}

.timer-client-select input::placeholder {
  color: var(--fc-border-default, #dbe4f0);
}

.timer-client-select input:disabled {
  opacity: 0.72;
}

.timer-matter {
  font-size: 11px;
  color: var(--fc-text-muted, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.timer-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.timer-btn {
  padding: 4px 10px;
  border: 1px solid rgba(219, 228, 240, 0.18);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  background: var(--custody-navy, #0a1628);
  color: var(--fc-text-inverse, #f6f8fb);
  line-height: 1.4;
  transition: background 0.15s;
}

.timer-btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.timer-btn:focus-visible {
  outline: 2px solid var(--custody-cyan);
  outline-offset: 2px;
}

.timer-btn--start:hover {
  background: var(--fc-color-brand-400, #3877f7);
}

.timer-btn--stop:hover {
  background: var(--fc-color-danger-500, #d6342a);
}

.timer-btn--save {
  background: var(--fc-color-brand-500, #1f5fe6);
}

.timer-btn--save:hover {
  background: var(--fc-color-brand-600, #154bc2);
}

/* ================================================================
   TIME ENTRY PANEL — billing view
   ================================================================ */
.time-entry-billable-tag {
  font-size: 10px;
  background: var(--bg);
  color: var(--muted);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
}

/* Log Time dialog uses existing dialog styles; add only specific overrides */
#log-time-dialog label {
  display: block;
  margin-bottom: 10px;
}

#log-time-dialog .check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

/* ── Messaging panel ───────────────────────────────────────────────────── */
.msg-panel {
  display: flex;
  flex-direction: column;
  height: 420px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel, #fff);
  margin-top: 8px;
}

.msg-thread {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg-bubble-row {
  display: flex;
}

.msg-bubble-row--out {
  justify-content: flex-end;
}

.msg-bubble-row--in {
  justify-content: flex-start;
}

.msg-bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  word-break: break-word;
}

.msg-bubble--out {
  background: var(--accent);
  color: var(--fc-text-inverse, #fff);
  border-bottom-right-radius: 2px;
}

.msg-bubble--in {
  background: var(--bg);
  color: var(--fc-text-default, #111827);
  border-bottom-left-radius: 2px;
}

.msg-sender {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 2px;
  opacity: 0.75;
}

.msg-text {
  line-height: 1.45;
  white-space: pre-wrap;
}

.msg-time {
  font-size: 11px;
  margin-top: 4px;
  opacity: 0.6;
  text-align: right;
}

.msg-attachments {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.msg-attachment {
  display: inline-block;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  font-size: 12px;
  text-decoration: none;
  color: inherit;
}

.msg-bubble--in .msg-attachment {
  background: rgba(0, 0, 0, 0.08);
}

.msg-composer {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel, #fff);
}

.msg-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  resize: none;
  font-family: inherit;
  box-sizing: border-box;
  line-height: 1.4;
}

.msg-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(11, 132, 255, 0.15);
}

.msg-composer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.msg-attach-btn {
  cursor: pointer;
  font-size: 18px;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--fc-text-muted, #6b7280);
  transition: background 0.15s;
}

.msg-attach-btn:hover {
  background: var(--fc-surface-canvas, #f3f4f6);
}

.msg-send-btn {
  padding: 8px 18px;
  font-size: 14px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--fc-text-inverse, #fff);
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s;
}

.msg-send-btn:hover {
  background: var(--accent-strong);
}

.msg-empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.msg-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  line-height: 1;
}

.msg-empty-headline {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 4px;
}

.msg-empty-sub {
  font-size: 14px;
  margin: 0;
  max-width: 280px;
}

/* Sidebar unread badge */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--fc-color-danger-500, #ef4444);
  color: var(--fc-text-inverse, #fff);
  font-size: 10px;
  font-weight: 700;
  border-radius: 9999px;
  padding: 1px 5px;
  min-width: 16px;
  height: 16px;
  margin-left: 6px;
  vertical-align: middle;
  line-height: 1;
}

.nav-badge[hidden] {
  display: none;
}

/* Matter detail messaging section wrapper */
.record-section {
  margin-top: 24px;
}

/* Floating AI chat widget (v2.6) */
.ai-chat-widget-root {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9000;
}
body.auth-required .ai-chat-widget-root { display: none; }

.floating-logout-btn {
  position: fixed;
  bottom: 70px;
  right: 24px;
  z-index: 8999;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 14px;
  background: var(--panel, #1a2340);
  color: var(--muted, #8899aa);
  border: 1px solid var(--line, #2a3450);
  cursor: pointer;
  opacity: 0.8;
}
.floating-logout-btn:hover { opacity: 1; background: var(--bg, #0d1525); }
body.auth-required .floating-logout-btn { display: none; }
.ai-chat-widget-bubble {
  height: 44px;
  padding: 0 20px;
  border-radius: 22px;
  border: none;
  background: var(--accent, #2f6df5);
  color: var(--fc-text-inverse, #fff);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(20, 30, 60, 0.22);
}
.ai-chat-widget-bubble:focus-visible {
  outline: 3px solid var(--focus, #ffbf47);
  outline-offset: 2px;
}
.ai-chat-widget-panel {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 360px;
  height: 480px;
  background: var(--panel, #fff);
  color: var(--text, #14223d);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(20, 30, 60, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(20, 30, 60, 0.08);
}
.ai-chat-widget-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(20, 30, 60, 0.08);
  gap: 8px;
}
.ai-chat-widget-head h2 {
  margin: 0;
  font-size: 15px;
}
.ai-chat-widget-subtitle {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--muted, #5a6783);
}
.ai-chat-widget-close {
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted, #5a6783);
}
.ai-chat-widget-close:focus-visible {
  outline: 2px solid var(--focus, #ffbf47);
}
.ai-chat-widget-log {
  list-style: none;
  margin: 0;
  padding: 12px 14px;
  flex: 1;
  overflow-y: auto;
  font-size: 13px;
}
.ai-chat-widget-empty {
  color: var(--muted, #5a6783);
  font-style: italic;
}
.ai-chat-widget-turn {
  margin-bottom: 10px;
}
.ai-chat-widget-role {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted, #5a6783);
  margin-bottom: 2px;
}
.ai-chat-widget-text {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(47, 109, 245, 0.06);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.ai-chat-widget-turn-user .ai-chat-widget-text {
  background: rgba(47, 109, 245, 0.14);
}
.ai-chat-widget-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 8px;
}
.ai-chat-widget-suggestion {
  background: rgba(47, 109, 245, 0.08);
  border: 1px solid rgba(47, 109, 245, 0.18);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  color: var(--accent, #2f6df5);
}
.ai-chat-widget-suggestion:focus-visible {
  outline: 2px solid var(--focus, #ffbf47);
}
.ai-chat-widget-form {
  display: flex;
  gap: 8px;
  padding: 10px 14px 12px;
  border-top: 1px solid rgba(20, 30, 60, 0.08);
}
.ai-chat-widget-label { flex: 1; }
.ai-chat-widget-form textarea {
  width: 100%;
  resize: none;
  border: 1px solid rgba(20, 30, 60, 0.18);
  border-radius: 6px;
  padding: 6px 8px;
  font: inherit;
  font-size: 13px;
}
.ai-chat-widget-form textarea:focus-visible {
  outline: 2px solid var(--focus, #ffbf47);
  border-color: var(--accent, #2f6df5);
}
.ai-chat-widget-send {
  background: var(--accent, #2f6df5);
  color: var(--fc-text-inverse, #fff);
  border: none;
  border-radius: 6px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.ai-chat-widget-send:focus-visible {
  outline: 2px solid var(--focus, #ffbf47);
}
.ai-chat-widget-foot {
  display: block;
  padding: 0 14px 10px;
  font-size: 10px;
  color: var(--muted, #5a6783);
}

/* ── fc-* utility classes (design-convergence) ────────────────────── */

.fc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 var(--fc-space-5, 20px);
  border: 1px solid var(--fc-border-default, #d6dae3);
  border-radius: var(--fc-radius-md, 6px);
  background: var(--fc-surface-raised, #ffffff);
  color: var(--fc-text-default, #1f2535);
  font-size: var(--fc-font-size-sm, 14px);
  font-weight: var(--fc-font-weight-medium, 500);
  cursor: pointer;
  transition: all var(--fc-motion-duration-base, 180ms) var(--fc-motion-ease-standard, cubic-bezier(0.2, 0, 0, 1));
}

.fc-btn:hover {
  border-color: var(--fc-border-focus, #3877f7);
  background: var(--fc-color-brand-50, #eef3fe);
}

.fc-btn--primary {
  background: var(--fc-color-brand-500, #1f5fe6);
  border-color: var(--fc-color-brand-500, #1f5fe6);
  color: var(--fc-text-inverse, #ffffff);
  font-weight: var(--fc-font-weight-semibold, 600);
}

.fc-btn--primary:hover {
  background: var(--fc-color-brand-600, #154bc2);
  border-color: var(--fc-color-brand-600, #154bc2);
}

.fc-btn--ghost {
  background: transparent;
  border-color: var(--fc-border-default, #d6dae3);
}

.fc-btn--secondary {
  background: var(--fc-surface-raised, #ffffff);
  border-color: var(--fc-border-default, #d6dae3);
}

.fc-btn--danger {
  background: var(--fc-color-danger-500, #d6342a);
  border-color: var(--fc-color-danger-500, #d6342a);
  color: var(--fc-text-inverse, #ffffff);
}

.fc-btn--sm {
  min-height: 30px;
  padding: 0 var(--fc-space-4, 16px);
  font-size: var(--fc-font-size-xs, 12px);
}

.fc-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: var(--fc-radius-pill, 9999px);
  font-size: var(--fc-font-size-xs, 12px);
  font-weight: var(--fc-font-weight-semibold, 600);
  letter-spacing: var(--fc-letter-spacing-wide, 0.01em);
  background: var(--fc-color-success-50, #ecfdf5);
  color: var(--fc-color-success-700, #047857);
}

.fc-pill--info {
  background: var(--fc-color-brand-50, #eef3fe);
  color: var(--fc-color-brand-700, #0f3a99);
}

.fc-pill--success {
  background: var(--fc-color-success-50, #ecfdf5);
  color: var(--fc-color-success-700, #047857);
}

.fc-pill--warning {
  background: var(--fc-color-warning-50, #fffbeb);
  color: var(--fc-color-warning-700, #92400e);
}

.fc-pill--danger {
  background: var(--fc-color-danger-50, #fef2f2);
  color: var(--fc-color-danger-700, #b91c1c);
}

.fc-card {
  border: 1px solid var(--fc-border-subtle, #e8eaef);
  border-radius: var(--fc-radius-md, 6px);
  background: var(--fc-surface-raised, #ffffff);
  padding: var(--fc-space-4, 16px);
  transition: border-color var(--fc-motion-duration-base, 180ms) ease,
              box-shadow var(--fc-motion-duration-base, 180ms) ease;
}

.fc-card:hover {
  border-color: var(--fc-color-brand-200, #bdd0fb);
  box-shadow: var(--fc-shadow-xs, 0 1px 1px rgba(11,16,32,0.04));
}

.fc-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: var(--fc-radius-pill, 9999px);
  font-size: var(--fc-font-size-xs, 12px);
  font-weight: var(--fc-font-weight-semibold, 600);
  letter-spacing: var(--fc-letter-spacing-wide, 0.01em);
}

.fc-badge--warning {
  background: var(--fc-color-warning-50, #fffbeb);
  color: var(--fc-color-warning-700, #92400e);
}

.fc-badge--danger {
  background: var(--fc-color-danger-50, #fef2f2);
  color: var(--fc-color-danger-700, #b91c1c);
}

.fc-badge--success {
  background: var(--fc-color-success-50, #ecfdf5);
  color: var(--fc-color-success-700, #047857);
}

.fc-toolbar {
  display: flex;
  align-items: center;
  gap: var(--fc-space-3, 12px);
  flex-wrap: wrap;
}
