/* The Office: TMA1's own tokens (the :root block below is the trade shell's, copied whole; a test keeps the two the same), its face and
   its components, laid out for a desk: dense, quiet, every number in tabular figures. Nothing here is a brand: the header says "Office". */

/* Manrope, the trade shell's file (this project's own copy, the same bytes), served from this origin. */
@font-face {
  font-family: 'Manrope';
  src: url('../fonts/manrope-wght.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #131720;
  --surface: #1a1f2b;
  --border: #293046;
  --border-hover: #5c6b94;
  --footer: #10141c;
  --text: #fff;
  --text-80: rgba(255, 255, 255, .8);
  --text-56: rgba(255, 255, 255, .56);
  --text-50: rgba(255, 255, 255, .5);
  --buy: #05df72;
  --sell: #ff6467;
  --buy-solid: #34a365;
  --sell-solid: #c51e37;
  --cta: #f54b2a;
  --view-blue: #57c1f2;
  --badge: #0eb3ff;
  --tab-active: #363e4e;
  --inset: rgba(0, 0, 0, .12);
  --hover: rgba(255, 255, 255, .09);
  /* The Portfolio's account colours (decision 022, answer 1): an account keeps its own, by its place among the owner's accounts, round
     again past the last. None is the buy or sell colour, so no area reads as a gain or a loss by its colour. */
  --acct-1: #57c1f2;
  --acct-2: #a78bfa;
  --acct-3: #f5b74a;
  --acct-4: #2dd4bf;
  --acct-5: #f472b6;
  --acct-6: #94a3b8;
  --acct-7: #818cf8;
  --acct-8: #bef264;
  --acct-9: #fb923c;
  --acct-10: #22d3ee;
  --acct-11: #e879f9;

  /* The one family token: every rule that sets a family uses it. */
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --r-card: 16px;
  --r-ctl: 8px;
  --gap: 16px;
  --pad-x: 24px;
  --header-h: 127px;
  --footer-h: 36px;
  --bar-h: 73px;
  --table-h: 360px;
  --side-w: 320px;
  /* The chart/book/form row fills what's left, between 495 and 630px (handoff, desktop resizing). */
  --row-h: clamp(495px, calc(100dvh - var(--header-h) - var(--footer-h) - var(--bar-h) - var(--table-h) - 4 * var(--gap)), 630px);
  /* A page that fills the window between the pinned header and footer (Notifications, Accounts: handoff, other pages), down to a 1040px
     window, the content's minimum height; below it the page scrolls under them, as the trade page does below its own row's 495px. */
  --page-h: calc(max(1040px, 100dvh) - var(--header-h) - 8px - var(--footer-h) - var(--gap));
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 400 14px/20px var(--font); font-synthesis: none; word-spacing: .08em; }
button, input, select, textarea { word-spacing: inherit; font: inherit; color: inherit; }
a { color: var(--view-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { margin: 0; font-size: 22px; line-height: 28px; font-weight: 700; }
h2 { margin: 0; font-size: 16px; line-height: 22px; font-weight: 700; }
:focus-visible { outline: 2px solid var(--view-blue); outline-offset: 2px; }

/* ---------- shell: a header, the page ---------- */
.office-header {
  position: sticky; top: 0; z-index: 20;
  min-height: 64px; padding: 8px 24px;
  display: flex; align-items: center; gap: 32px;
  background: var(--footer); border-bottom: 1px solid var(--border);
}
.office-name { font-weight: 800; font-size: 16px; letter-spacing: .18em; text-transform: uppercase; }
/* The links wrap to a second row in a narrow window (step E7 adds two), so none is ever hidden and the page never scrolls sideways. */
.office-nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; min-width: 0; }
.office-nav a { padding: 8px 12px; border-radius: var(--r-ctl); color: var(--text-80); font-weight: 500; white-space: nowrap; }
.office-nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.office-nav a.active { background: var(--tab-active); color: var(--text); }
.who { display: flex; align-items: center; gap: 12px; flex: none; color: var(--text-80); }
.who .handle { color: var(--text); font-weight: 600; }
.office-main { padding: 24px; display: flex; flex-direction: column; gap: var(--gap); min-width: 960px; }

/* ---------- the sign-in and enrol screens: one card in the middle ---------- */
.plain { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.plain-card { width: min(420px, 100%); padding: 32px; display: flex; flex-direction: column; gap: 20px; }
.plain-card .office-name { text-align: center; }
.plain-card p { margin: 0; color: var(--text-80); }

/* ---------- components ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  min-width: 0; min-height: 0;
}
.card.pad { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card-head .as-of { color: var(--text-56); font-size: 12px; font-variant-numeric: tabular-nums; }
.btn { height: 40px; padding: 0 16px; white-space: nowrap; border-radius: var(--r-ctl); border: 1px solid transparent; background: none; cursor: pointer; font-weight: 600; }
.btn.outline { border-color: rgba(255, 255, 255, .16); }
.btn.outline:hover:not(:disabled) { outline: 1px solid #fff; }
.btn.primary { background: var(--tab-active); }
.btn.primary:hover:not(:disabled) { background: #444d60; }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn:disabled { cursor: default; opacity: .5; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { color: var(--text-80); font-size: 13px; line-height: 16px; font-weight: 500; letter-spacing: .2px; }
.field input, .field select {
  height: 40px; padding: 8px 12px; border-radius: var(--r-ctl); border: 1px solid var(--border); background: var(--inset); color: var(--text);
  font: 400 15px/22px var(--font); letter-spacing: .4px;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--border-hover); }
.field input::placeholder { color: var(--text-50); }
.field .hint { color: var(--text-56); font-size: 12px; }
.message { padding: 10px 12px; border-radius: var(--r-ctl); border: 1px solid var(--border); background: var(--inset); color: var(--text-80); }
.message.bad { border-color: rgba(255, 100, 103, .5); color: var(--sell); }
.message.ok { border-color: rgba(5, 223, 114, .4); color: var(--buy); }
.badge { display: inline-block; font-weight: 700; font-size: 12px; line-height: 16px; color: var(--badge); background: rgba(14, 179, 255, .1); border-radius: 5px; padding: 2px 6px; }
/* A state: good, warn, bad, unknown. Each is words too, never only a colour. */
.state { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; }
.state::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--text-56); }
.state.good::before { background: var(--buy); }
.state.warn::before { background: #ffce00; }
.state.bad::before { background: var(--sell); }
.muted { color: var(--text-56); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .02em; word-break: break-all; }
.tabs { display: flex; gap: 4px; padding: 2px; border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--inset); width: fit-content; }
.tabs button { border: none; background: none; padding: 4px 12px; border-radius: 6px; color: var(--text-80); cursor: pointer; font-size: 12px; font-weight: 600; text-transform: uppercase; }
.tabs button:hover { background: var(--hover); }
.tabs button.on { background: var(--tab-active); color: var(--text); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--gap); }
.kv { display: grid; grid-template-columns: fit-content(50%) minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.kv dt { color: var(--text-56); overflow-wrap: anywhere; }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.grid-scroll { overflow: auto; }
.grid { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.grid th { padding: 8px 12px; text-align: left; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--text-56); border-bottom: 1px solid var(--border);
           white-space: nowrap; }
.grid td { padding: 10px 12px; font-size: 13px; line-height: 18px; border-bottom: 1px solid var(--border); vertical-align: top; }
.grid td.r, .grid th.r { text-align: right; }
.grid td.at { white-space: nowrap; }
.grid tr:last-child td { border-bottom: none; }
.empty { padding: 24px; text-align: center; color: var(--text-56); }
/* A form's fields in a row, wrapping; a toolbar on a card stays a row (.card.pad is a column). */
.toolbar, .card.toolbar { display: flex; flex-direction: row; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.toolbar .field { min-width: 200px; }
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 16px; }
.pre { margin: 0; padding: 12px; border-radius: var(--r-ctl); background: var(--inset); font-size: 12px; line-height: 18px; white-space: pre-wrap;
       overflow-wrap: anywhere; max-height: 360px; overflow: auto; }
.plain-form { display: flex; flex-direction: column; gap: 16px; }
/* The host page's note for a boot that failed (App.razor): a .plain page of its own, shown only once the boot has failed. */
.boot-failed[hidden] { display: none; }
#blazor-error-ui { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; padding: 10px 24px; background: var(--sell-solid); color: var(--text); }
#blazor-error-ui .reload { color: var(--text); text-decoration: underline; margin-left: 8px; }
.link-btn { display: grid; place-items: center; }

/* ---------- the board and investigation ---------- */
h3 { margin: 4px 0 0; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--text-80); }
.page-head .as-of { color: var(--text-56); font-size: 12px; font-variant-numeric: tabular-nums; }
.need-list { margin: 0; padding: 0 0 0 18px; display: flex; flex-direction: column; gap: 6px; }
/* A need's words can hold a person's (a bridge's pause reason): a run with no space or hyphen in it breaks anywhere rather than leave
   its card, as a line's note does. */
.need-list a { color: var(--text); overflow-wrap: anywhere; }
.panel { border-top: 3px solid var(--border); }
.panel.tone-healthy { border-top-color: var(--buy); }
.panel.tone-warn { border-top-color: #ffce00; }
.panel.tone-alert { border-top-color: var(--sell); }
/* A line's value wraps inside its panel, never past its edge, and only at an ordinary space: never inside a word, nor between a figure
   and its unit (a no-break space). A figure that may run wide breaks only inside its fraction, at the server's <wbr>s (fix 10). Its
   column is at least as wide as its longest run, and the labels, at most half, wrap first, at their spaces, and are never narrower
   than 7em. A note may still break inside a long word, so it never widens the column; one with figures (.figures) breaks only at its
   spaces and its <wbr>s, as a value does. */
.lines { grid-template-columns: fit-content(50%) minmax(min-content, 1fr); }
.lines dt { min-width: 7em; overflow-wrap: break-word; }
.lines dd { overflow-wrap: break-word; }
.lines .state { white-space: normal; overflow-wrap: break-word; align-items: flex-start; }
/* Its dot stays whole, centred on the value's first line. */
.lines .state::before { flex: none; margin-top: calc((1lh - 8px) / 2); }
.lines .note { display: block; color: var(--text-56); font-size: 12px; line-height: 16px; margin-top: 2px; overflow-wrap: anywhere; }
.lines .note.figures { overflow-wrap: break-word; }
.tabs a { padding: 4px 12px; border-radius: 6px; color: var(--text-80); font-size: 12px; font-weight: 600; text-transform: uppercase; }
.tabs a:hover { background: var(--hover); text-decoration: none; }
.tabs a.on { background: var(--tab-active); color: var(--text); }
.grid tr.tone-warn td:first-child { box-shadow: inset 3px 0 0 #ffce00; }
.grid tr.tone-alert td:first-child { box-shadow: inset 3px 0 0 var(--sell); }
.grid td.body { font-size: 12px; min-width: 280px; max-width: 560px; color: var(--text-80); }
.toolbar .field.wide { flex: 1; min-width: 280px; }
.toolbar .field.time { min-width: 264px; } /* a time's placeholder, whole */
.split { display: grid; grid-template-columns: minmax(300px, 1fr) 2fr; gap: var(--gap); align-items: start; }

/* ---------- the restrictive acts (step C): in the sell colour; a card over a scrim; a toast ---------- */
.acts { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.act { color: var(--sell); border-color: rgba(255, 100, 103, .5); }
.btn.act:hover:not(:disabled) { outline: 1px solid var(--sell); }
.btn.act.solid { background: var(--sell-solid); border-color: transparent; color: var(--text); }
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .6); }
.modal-card {
  position: fixed; z-index: 41; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(500px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px); overflow: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
}
.modal-title { display: flex; flex-direction: column; gap: 8px; }
.modal-title h2 { font-size: 18px; line-height: 24px; }
.modal-title p { margin: 0; color: var(--text-80); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.field textarea {
  min-height: 72px; padding: 8px 12px; border-radius: var(--r-ctl); border: 1px solid var(--border); background: var(--inset); color: var(--text);
  font: 400 15px/22px var(--font); resize: vertical;
}
.field textarea:focus { outline: none; border-color: var(--border-hover); }
.toast {
  position: fixed; z-index: 50; right: 24px; bottom: 24px; width: min(480px, calc(100vw - 48px)); padding: 12px 16px;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; border-radius: var(--r-ctl); border: 1px solid var(--border);
  background: var(--surface); box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}
.toast.ok { border-color: rgba(5, 223, 114, .5); }
.toast.ok strong { color: var(--buy); }
.toast.bad { border-color: rgba(255, 100, 103, .5); }
.toast.bad strong { color: var(--sell); }
.toast.warn { border-color: rgba(255, 206, 0, .5); }
.toast.warn strong { color: #ffce00; }
.toast .btn { margin-left: auto; }
.announcement-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- the permissive acts (step D): in the call-to-action colour; break-glass carries an amber stripe ---------- */
.btn.permit { color: var(--cta); border-color: rgba(245, 75, 42, .5); }
.btn.permit:hover:not(:disabled) { outline: 1px solid var(--cta); }
.btn.permit.solid { background: var(--cta); border-color: transparent; color: var(--text); }
.modal-card.break-glass, .toast.break-glass { box-shadow: inset 4px 0 0 #ffce00, 0 16px 40px rgba(0, 0, 0, .45); }
.grid tr.break-glass td:first-child { box-shadow: inset 3px 0 0 #ffce00; }
.grid td.reason { min-width: 200px; max-width: 420px; white-space: pre-wrap; overflow-wrap: anywhere; }
.field .check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.field .check input { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: #ffce00; }
.why { font-size: 12px; align-self: center; }
.alarms { margin: 6px 0 0; padding-left: 18px; font-variant-numeric: tabular-nums; }

/* ---------- alerts, cases and the rules (step E7) ---------- */
/* Text a person wrote (an alert's text, a reason, a note) keeps its lines and breaks a long token rather than widening the page. */
.prose { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.breaks { overflow-wrap: anywhere; }
/* An act case on a break-glass act carries the amber stripe. */
.card.break-glass-card { box-shadow: inset 4px 0 0 #ffce00; }
/* Desktop first: an alert's and a case's two cards sit side by side from 1280 wide, and stack below it. */
@media (max-width: 1279px) { .split.case-split { grid-template-columns: minmax(0, 1fr); } }
/* Below 1280 wide, a table's cells are tighter and an event's body narrower, so a wide table (an alert's evidence, eleven columns) fits
   its card at 1024 rather than scrolling sideways in it (ruling 8). */
@media (max-width: 1279px) {
    .grid th, .grid td { padding-left: 8px; padding-right: 8px; }
    .grid td.body { min-width: 220px; }
}
/* A run joined by a hyphen (a date, a market's symbol, an approval id) on one line when it fits its column: a board line breaks only at an
   ordinary space (Words). One wider than its column breaks inside itself rather than leave its card (SE-B-M1), and copies as it is. A
   link's underline reaches it. */
.whole { display: inline-block; max-width: 100%; overflow-wrap: anywhere; text-decoration: inherit; }
