/* FATHm Dispatch. Load after the existing page stylesheet.
   Local Open Sans fonts; no remote font requests or generated project data. */
@font-face {
  font-family: "Open Sans";
  src: url("dashboard/assets/fonts/OpenSans-Regular.ttf") format("truetype");
  font-style: normal; font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "Open Sans";
  src: url("dashboard/assets/fonts/OpenSans-SemiBold.ttf") format("truetype");
  font-style: normal; font-weight: 600; font-display: swap;
}

:root, :root[data-theme="light"], :root[data-theme="dark"] {
  --font-ui: "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: var(--font-ui);
  --bg: #0e1922; --bg-glow: #0e1922;
  --surface: #162630; --surface-2: #1a2a35; --surface-3: #2d3e49;
  --ink: #e5eced; --ink-2: #8fa7b1; --ink-3: #8fa7b1;
  --line: #2c414c; --line-2: #334754; --hairline: #2c414c;
  --accent: #92cabc; --accent-strong: #92cabc; --accent-ink: #a7d6bc;
  --accent-soft: #263f39; --accent-line: #426658; --on-accent: #16382f;
  --ok-soft: #263f39; --ok-ink: #a7d6bc; --ok-line: #426658;
  --guide-soft: #443c2b; --guide-ink: #ebc882; --guide-line: #89744b;
  --sidebar-bg: #131e27; --sidebar-edge: #2c414c;
  --sidebar-ink: #e5eced; --sidebar-muted: #8fa7b1;
  --sidebar-hover: #1a2a35; --sidebar-active: #1a2a35; --navy: #131e27;
  --fs-2xs: .75rem; --fs-xs: .8125rem; --fs-sm: .9375rem;
  --fs-base: 1rem; --fs-md: 1.0625rem; --fs-lg: 1.25rem; --fs-h1: 2.125rem;
  --r-xs: 6px; --r-sm: 6px; --r-md: 8px; --r-lg: 9px; --r-xl: 9px;
  --shadow-sm: none; --shadow-md: 0 8px 24px #0003;
  --shadow-lg: 0 16px 40px #0005; --shadow-pop: none; --glow: none;
  --focus: 0 0 0 3px #92cabc55;
  color-scheme: dark;
}

body { background: var(--bg); color: var(--ink); font: 400 16px/1.6 var(--font-ui); }
button, input, select, textarea { font-family: var(--font-ui); }
h1, h2, h3, .brand, .brand-name, .page-title h1, .login-hero h1 {
  font-family: var(--font-ui); font-weight: 600; letter-spacing: -.025em;
}
h1, .page-title h1, .login-hero h1 { font-size: 34px; line-height: 1.25; }
h2, .tile-head h2 { font-size: 20px; line-height: 1.4; }
h3 { font-size: 19px; line-height: 1.4; }
.muted, .empty, .today-date, .dock-meta, .login-foot, .login-tag { color: var(--ink-2); }
.today-date, .login-tag, .login-foot { font-size: 13px; letter-spacing: 0; text-transform: none; }
strong, b { font-weight: 600; }
a { color: #92cabc; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid #92cabc; outline-offset: 3px; }
.hidden, [hidden] { display: none !important; }
:disabled, [aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

/* Existing dashboard sidebar becomes a compact, shared horizontal header. */
.layout { display: flex; flex-direction: column; min-height: 100vh; }
.layout > .sidebar {
  position: relative; top: auto; width: 100%; min-width: 0; height: auto;
  min-height: 84px; padding: 16px 28px; border-right: 0;
  border-bottom: 1px solid var(--line); background: #131e27;
  display: flex; flex-direction: row; align-items: center; gap: 24px;
}
.sidebar .brand { flex: 0 0 auto; padding: 0; gap: 10px; }
.sidebar .brand-text { display: flex; }
.sidebar .user-meta, .sidebar nav a .label { display: block; }
.sidebar .logo-mark { width: 35px; filter: none; }
.sidebar .brand-name { font-size: 20px; letter-spacing: -.03em; }
.sidebar .brand-sub { font-size: 11px; letter-spacing: .04em; margin-top: 4px; }
.sidebar nav { flex: 1 1 auto; min-width: 0; flex-direction: row; align-items: center; gap: 4px; }
.sidebar nav a { padding: 10px 11px; gap: 7px; border-radius: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; letter-spacing: 0; justify-content: flex-start; }
.sidebar nav a .icon { width: 16px; }
.sidebar nav a.active { color: var(--ink); background: #1a2a35; box-shadow: none; }
.sidebar nav a.active::before { left: 11px; right: 11px; top: auto; bottom: 2px; width: auto; height: 2px; background: #92cabc; border-radius: 0; }
.sidebar .sidebar-foot { flex: 0 1 190px; min-width: 0; margin: 0; padding: 0; border: 0; justify-content: flex-start; }
.sidebar .avatar { background: #2d3e49; color: #b0c4ce; font-weight: 600; box-shadow: none; }
.sidebar .user-email { max-width: 155px; font-size: 12px; }
.sidebar .linklike { color: var(--ink-2); font-size: 12px; }
.content { width: 100%; max-width: 1600px; align-self: center; padding: 32px 28px 40px; }
.page-head { gap: 24px; margin-bottom: 28px; }
.page-title { margin-right: auto; }
.page-title { display: flex; flex-direction: column; }
.page-title .today-date { order: -1; margin: 0 0 10px; }
.head-actions { gap: 12px; }

/* Flat, bordered panels preserve the existing grid and interaction semantics. */
.grid-stack > .grid-stack-item > .tile,
.card, .card-list > div, .an-card, .review-card, .modal-body {
  background: #162630; border: 1px solid #2c414c; border-radius: 9px; box-shadow: none;
}
.grid-stack > .grid-stack-item > .tile:hover { transform: none; border-color: #334754; box-shadow: none; }
.tile-head { background: #162630; padding: 22px 24px 18px; border-bottom: 1px solid #2c414c; gap: 12px; }
.tile-head h2 { color: var(--ink); font-weight: 600; letter-spacing: -.02em; text-transform: none; transform: none; }
.tile-body { padding: 24px; }
.card, .card-list > div, .an-card, .review-card, .modal-body { padding: 24px; }
.an-card h2, .review-card h3 { font-size: 20px; font-weight: 600; color: #e5eced; }
.item { padding: 16px; background: #1a2a35; border-color: #2c414c; border-radius: 8px; }
.item.clickable:hover { transform: none; box-shadow: none; }
.item-main strong { font-size: 17px; font-weight: 600; }
.item.overdue { border-left-color: #ebc882; background: #443c2b; }
.count, .chip, .pill { background: #2d3e49; border-color: #334754; color: #b0c4ce; font-size: 12px; font-weight: 600; }
.count.state, .chip.chip-state { background: #2d3e49; color: #b0c4ce; border-color: #334754; }
.pill.done, .pill.confirmed, .dispatch-status.confirmed {
  background: #263f39; color: #a7d6bc; border-color: #426658;
}
.pill.pending, .pill.overdue, .pill.overdue-pill, .dispatch-status.review {
  background: #443c2b; color: #ebc882; border-color: #89744b;
}
.chip.chip-state::before { background: #b0c4ce; box-shadow: none; }

button.primary, .primary, #login-btn, #app-view button:not(.ghost):not(.close):not(.citation-chip) {
  background: #92cabc; color: #16382f; border: 1px solid #92cabc;
  border-radius: 6px; font-size: 15px; font-weight: 600; box-shadow: none;
}
.primary { padding: 10px 16px; }
.primary:hover, #login-btn:hover { filter: brightness(1.06); box-shadow: none; }
button.ghost, .ghost, .new-chat { border-color: #334754; background: transparent; color: #e5eced; border-radius: 6px; box-shadow: none; }
.ghost:hover, .new-chat:hover { background: #1a2a35; box-shadow: none; }
input, select, textarea, .chat-composer textarea { background: #0e1922; color: #e5eced; border-color: #334754; border-radius: 6px; }
input::placeholder, textarea::placeholder { color: #8fa7b1; opacity: 1; }
.error, .error-text, .login-card .error { color: #ebc882; }

/* Grounded answers and source chips stay distinct from review guidance. */
.chat-history { background: #131e27; border-color: #2c414c; }
.chat-empty h3 { font: 600 20px/1.4 var(--font-ui); }
.chat-messages { padding: 24px; gap: 16px; }
.msg { font-size: 16px; line-height: 1.7; border-radius: 8px; padding: 18px 20px; }
.msg.assistant { background: #1a2a35; color: #e5eced; border-color: #334754; box-shadow: none; }
.msg.user { background: #263f39; color: #e5eced; border: 1px solid #426658; }
.citation-chip, #app-view button.citation-chip { background: #263f39; color: #a7d6bc; border: 1px solid #426658; border-radius: 6px; font-size: 12px; }
.citation-chip.guidance, #app-view button.citation-chip.guidance { background: #443c2b; color: #ebc882; border-color: #89744b; border-style: dashed; }
.citation-chip:hover { background: #2d4a40; color: #e5eced; }
.citation-chip.guidance:hover { background: #514730; color: #ebc882; }
.chat-composer { background: #162630; border-color: #2c414c; padding: 16px 24px; }
.modal { background: #0e1922cc; }
.notice, #runtime-status { background: #1a2a35; border-color: #334754; color: #b0c4ce; border-radius: 8px; }
.dock-name { font-size: 16px; }
.dock-meta, .dock-doc-note, .dock-review, .msg .flag button { font-size: 12px; }

/* Root app and login share the same colors and typography. */
#login-view { background: #0e1922; }
#login-view::before { background: none; }
.login-hero { width: min(440px, 94vw); padding: 28px; }
.login-hero h1 { color: #e5eced; letter-spacing: -.025em; text-indent: 0; }
.login-card { background: #162630; border: 1px solid #2c414c; border-radius: 9px; padding: 28px; gap: 16px; }
.login-card input { background: #0e1922; border-color: #334754; border-radius: 6px; color: #e5eced; }
#app-view > header { background: #131e27; border-bottom: 1px solid #2c414c; padding: 16px 28px; gap: 24px; }
#app-view > header .brand { font-size: 20px; letter-spacing: -.025em; }
#app-view > main { max-width: 1500px; margin: auto; padding: 28px; }
#app-view nav a { color: #8fa7b1; font-size: 14px; }
#app-view nav a.active { color: #e5eced; border-bottom-color: #92cabc; }

/* Optional structure hooks for Dispatch deals supplied by the page. */
.dispatch-deals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-bottom: 28px; }
.dispatch-deal { min-width: 0; padding: 24px; border: 1px solid #334754; border-radius: 9px; background: #162630; }
.dispatch-deal h2, .dispatch-deal-title { font-size: 25px; line-height: 1.3; font-weight: 600; margin: 0 0 12px; }
.dispatch-featured, .dispatch-deal.featured { background: #1a2a35; }
.dispatch-featured.tile { border: 1px solid #334754; border-radius: 9px; padding: 28px; margin-bottom: 24px; }
.dispatch-featured-main { display: flex; flex-direction: row; align-items: center; gap: 24px; }
.dispatch-deal-heading { flex: 1; min-width: 0; }
.dispatch-eyebrow { color: #8fa7b1; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.dispatch-open-deal { white-space: nowrap; padding: 10px 16px; }
.dispatch-transaction-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.dispatch-featured-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
#dispatch-transaction { max-width: 100%; padding: 9px 12px; border: 1px solid #334754; font-size: 14px; }
.dispatch-deal-title { color: #e5eced; overflow-wrap: anywhere; }
.dispatch-deal-meta { color: #8fa7b1; font-size: 13px; margin: 0 0 16px; }
.dispatch-deal-fields { display: flex; flex-wrap: wrap; gap: 16px 32px; font-size: 16px; }
.dispatch-deal-fields > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dispatch-deal-fields dt, .dispatch-deal-fields .muted { color: #8fa7b1; font-size: 12px; }
.dispatch-deal-fields dd { margin: 4px 0 0; color: #e5eced; }
.dispatch-action-row { display: flex; align-items: flex-start; gap: 16px; padding: 16px 0; border-bottom: 1px solid #2c414c; text-decoration: none; color: #e5eced; }
.dispatch-action-row:first-child { padding-top: 0; }
.dispatch-action-row:last-child { border-bottom: 0; padding-bottom: 0; }
.dispatch-action-row:hover { color: #92cabc; }
.dispatch-action-number { flex: 0 0 30px; width: 30px; height: 30px; display: grid; place-items: center; background: #2d3e49; color: #b0c4ce; font-size: 13px; border-radius: 6px; }
.dispatch-action-copy { flex: 1; min-width: 0; font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
.dispatch-action-meta { display: block; color: #8fa7b1; font-size: 12px; margin-top: 5px; }
.dispatch-status { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 6px; background: #2d3e49; color: #b0c4ce; font-size: 12px; font-weight: 600; }

@media (max-width: 1280px) {
  .layout > .sidebar { flex-wrap: wrap; gap: 12px 24px; }
  .sidebar .sidebar-foot { margin-left: auto; }
  .sidebar nav { order: 3; flex-basis: 100%; overflow-x: auto; padding-bottom: 4px; }
}
@media (max-width: 720px) {
  .layout > .sidebar { min-height: 0; padding: 16px; }
  .sidebar .brand-text, .sidebar nav a .label { display: block; }
  .sidebar nav a .icon { display: none; }
  .sidebar nav a { padding: 9px 10px; font-size: 13px; }
  .sidebar .sidebar-foot { display: flex; flex-basis: 150px; }
  .sidebar .user-email { max-width: 116px; }
  .content { padding: 24px 16px; }
  .page-head { gap: 16px; }
  .dispatch-deals { grid-template-columns: 1fr; }
  .dispatch-featured-main { flex-direction: column; align-items: stretch; }
  .dispatch-deal-fields { flex-direction: column; align-items: stretch; gap: 16px; }
  .dispatch-open-deal { align-self: flex-start; }
  .tile-head { padding: 18px 20px; }
  .tile-body, .chat-messages, .card, .an-card, .review-card { padding: 20px; }
  #app-view > header { flex-wrap: wrap; padding: 16px; gap: 12px; }
  #app-view > main { padding: 20px 16px; }
  .msg { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
