/* Portal redesign theme — loaded last on the app-shell pages (officer + client screens).
   Re-points the original tokens at the portal palette and type, and restyles the shared shell. */
:root {
  --navy-900: #0B1F3F;
  --navy-850: #0B1F3F;
  --navy-800: #12305F;
  --navy-700: #1A4FBF;
  --ink: #0B1F3F;
  --ink-2: #0B1F3F;
  --ink-3: #2B3B57;
  --muted: #4A5A72;
  --muted-2: #4A5A72;
  --placeholder: #6B7A90;
  --sky-50: #EAF1FD;
  --blue-chip-border: #B8C5D8;
  --blue-chip-text: #12305F;
  --blue-link: #1A4FBF;
  --line: #D5DEEA;
  --line-2: #D5DEEA;
  --line-3: #E4EAF2;
  --border: #B8C5D8;
  --side-bg: #0B1F3F;
  --side-open: #12305F;
  --side-deep: #071630;
  --text-muted: #4A5A72;
  --page-bg: #F5F7FA;
  --font-th: "IBM Plex Sans Thai", "Noto Sans Thai", "Sarabun", sans-serif;
  --font-ui: "IBM Plex Sans Thai", "Noto Sans Thai", "Sarabun", sans-serif;
  --font-serif: "Noto Serif Thai", "Noto Serif", serif;
  --p-primary: #1A4FBF;
  --p-gold: #C9932B;
  --p-focus: #F2B33D;
}

body.app { font-family: var(--font-ui); color: var(--ink); line-height: 1.6; }
body.app :focus-visible { outline: 3px solid var(--p-focus); outline-offset: 2px; }

/* top header */
body.app .topbar { border-bottom: 1px solid var(--line); height: 68px; }
body.app .topbar .logo { display: flex; align-items: center; gap: 14px; }
body.app .topbar .logo img { width: auto; height: 46px; object-fit: contain; }
body.app .topbar .logo::after { content: "Trade Remedies Portal"; border-left: 2px solid var(--p-gold); padding-left: 14px; font: 600 15px/1.3 var(--font-ui); color: var(--ink); }
body.app .topbar .who .name { font-size: 14px; color: var(--ink); }
body.app .topbar .who .role { font-size: 12px; color: var(--muted); }
body.app .shell { min-height: calc(100vh - 68px); }

/* side bar */
body.app .sidebar .inner { top: 68px; box-shadow: none; }
body.app .menu-head, body.app .menu-item { min-height: 44px; font-size: 15px; color: #D5DEEA; }
body.app .menu-head:hover, body.app .menu-item:hover { background: #12305F; color: #fff; }
body.app .menu-item.active, body.app .menu-head.active,
body.app .sidebar.collapsed .menu-head.active { background: var(--p-primary); color: #fff; }

/* shared controls */
body.app .btn { min-height: 40px; height: auto; border-radius: 8px; font-weight: 600; font-family: var(--font-ui); }
body.app .btn-primary { background: var(--p-primary); color: #fff; }
body.app .btn-primary:hover { background: #12305F; }
body.app .btn-outline { border: 1.5px solid #12305F; color: #12305F; }
body.app .btn-outline:hover { background: #EAF1FD; }
body.app .card { border-color: var(--line); border-radius: 12px; }
body.app input[type="text"], body.app input[type="search"], body.app select, body.app textarea { border-radius: 8px; }
body.app a:not(.btn):not(.menu-head):not(.menu-item):not(.logo):hover { color: var(--p-primary); }

/* page headings use the portal display face */
body.app .page-title, body.app h1 { font-family: var(--font-serif); font-weight: 700; color: var(--ink); }
body.app .o-section h2 { font-weight: 600; }

/* officer screens keep their own token names; point them at the same palette */
body.app.officer-page, body.app { --o-ink: #0B1F3F; --o-muted: #4A5A72; --oc-ink: #0B1F3F; }

@media (prefers-reduced-motion: no-preference) {
  body.app .btn, body.app .menu-head, body.app .menu-item { transition: background-color .18s ease, border-color .18s ease, color .18s ease; }
}

/* officer-c screens */
:root, body.oc, .oc { --oc-ink: #0B1F3F; --oc-muted: #4A5A72; --oc-line: #D5DEEA; --oc-navy: #0B1F3F; --oc-navy-2: #12305F; --oc-blue: #1A4FBF; }

/* officer pages: staff-workspace sidebar (matches staff.html) */
body.p-officer .shell { min-height: 100vh; align-items: stretch; }
body.p-officer .p-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
body.p-officer .p-col > .main { flex: 1 1 auto; }
body.p-officer .topbar { justify-content: flex-end; }
body.p-officer .topbar .logo { display: none; }
.p-side { flex: none; width: 248px; background: #0B1F3F; color: #D5DEEA; padding: 24px 16px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; overflow-y: auto; align-self: flex-start; font-family: var(--font-ui); font-size: 16px; line-height: 1.65; }
.p-brand { display: flex; gap: 12px; align-items: center; color: #fff; padding: 0 8px 20px; font-size: 14px; line-height: 1.4; }
.p-tile { flex: none; background: #fff; border-radius: 8px; padding: 6px 8px; display: flex; }
.p-tile img { height: 40px; width: auto; max-width: none; }
.p-item { display: flex; gap: 12px; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 8px; color: #D5DEEA; }
.p-item svg { flex: none; }
body.app a.p-item:hover { background: #12305F; color: #fff; }
body.app a.p-item[aria-current="page"] { background: #1A4FBF; color: #fff; font-weight: 600; }
.p-sep { margin-top: 24px; border-top: 1px solid #263A5E; padding-top: 6px; }
@media (max-width: 900px) {
  body.p-officer .shell { flex-wrap: wrap; }
  .p-side { position: static; width: 100%; height: auto; }
  body.p-officer .p-col { flex-basis: 100%; }
}

/* ---------- client pages (requests, case detail, AI chat) ---------- */
body.app[data-side="client"] .topbar .who .name { font: 600 15px var(--font-ui); color: var(--ink); }
body.app .page-head h1, body.app .page h1 { font-family: var(--font-serif); font-weight: 700; font-size: 28px; line-height: 1.4; color: #0B1F3F; }
body.app .crumb { font-size: 14px; color: #4A5A72; }

/* requests list */
body.app .page { max-width: 1200px; }
body.app .btn-new { width: auto; min-height: 44px; height: auto; padding: 0 18px; gap: 8px; border: 0; border-radius: 8px; background: #1A4FBF; color: #fff; font-weight: 600; }
body.app .btn-new:hover { background: #12305F; }
body.app .panel { border: 1px solid #D5DEEA; border-radius: 12px; padding: 16px; overflow-x: auto; }
body.app .panel .tabs { height: auto; margin-bottom: 14px; }
body.app .panel .tab { min-height: 44px; padding: 0 18px; border: 1.5px solid #B8C5D8; border-radius: 999px; background: #fff; color: #0B1F3F; font-size: 15px; }
body.app .panel .tab[aria-selected="true"] { background: #12305F; border-color: #12305F; color: #fff; font-weight: 600; }
body.app .tbl { width: 100%; min-width: 980px; font-size: 15px; color: #0B1F3F; }
body.app .tr > div { height: 52px; border-bottom: 1px solid #E4EAF2; border-right: 0; }
body.app .thead > div { background: #F5F7FA; align-items: center; font-size: 13px; font-weight: 600; color: #4A5A72; }
body.app .tbody .row + .row { border-top: 1px solid #D5DEEA; }
body.app .tr .pill { height: 26px; padding: 0 12px; border: 1px solid #B8C5D8; background: #EAF1FD; color: #12305F; font-size: 13px; font-weight: 600; }
body.app .act { width: auto; min-width: 104px; height: 36px; padding: 0 14px; border-radius: 8px; background: #1A4FBF; font-weight: 600; }
body.app .act:hover { background: #12305F; }
body.app .act.disabled { background: #E4EAF2; color: #4A5A72; }
body.app .progress { background: #F5F7FA; }
body.app .hstep .lbl { font-size: 13px; }
body.app .hstep .lbl small { font-size: 11px; color: #4A5A72; white-space: normal; width: 104px; line-height: 1.35; }

/* AI chat */
body.app .chat-card { border: 1px solid #D5DEEA; border-radius: 12px; }
body.app .chat-top { border-bottom: 1px solid #D5DEEA; }
body.app .ava { background: #0B1F3F; }
body.app .ava.staff { background: #C9932B; color: #0B1F3F; }
body.app .chat-top .sub { font-size: 13px; color: #4A5A72; }
body.app .context { background: #F5F7FA; border-color: #D5DEEA; color: #4A5A72; }
body.app .bubble { background: #EEF2F8; color: #0B1F3F; font-size: 15px; border-radius: 16px 16px 16px 4px; }
body.app .bubble.staff { background: #FFF4DC; border: 1px solid #E9CF95; }
body.app .me .bubble { background: #1A4FBF; color: #fff; border-radius: 16px 16px 4px 16px; }
body.app .chips button { min-height: 36px; padding: 0 16px; border: 1.5px solid #B8C5D8; color: #12305F; font-size: 14.5px; font-family: var(--font-ui); }
body.app .chips button:hover, body.app .chips button.used { background: #EAF1FD; border-color: #1A4FBF; }
body.app .time, body.app .who, body.app .day, body.app .disclaimer { color: #4A5A72; font-size: 12.5px; }
body.app .sys span { background: #EAF1FD; color: #12305F; }
body.app .compose { background: #fff; border: 1.5px solid #B8C5D8; border-radius: 12px; }
body.app .compose:focus-within { border-color: #1A4FBF; }
body.app .compose input::placeholder { color: #6B7A90; }
body.app .compose button { width: 44px; height: 44px; border-radius: 8px; background: #1A4FBF; }
body.app .compose button:hover { background: #12305F; }

/* floating assistant widget */
.chat-fab { background: #1A4FBF; filter: none; box-shadow: 0 8px 20px rgba(11,31,63,.25); width: 64px; height: 64px; }
.chat-head { background: #0B1F3F; }
.chat-dialog { border-color: #D5DEEA; border-radius: 14px; }
.news-card { border-color: #D5DEEA; }
