/* Desk-only additions. The shared design system does the heavy lifting; this
   file only adds what the publishing surface needs, so the two sites stay
   visually the same product. */

/* A slightly cooler page tint distinguishes "back office" from the public site
   at a glance, without becoming a different design. */
body.desk { background: #eef1f7; }

/* ---------------------------------------------------------- sign-in ----- */
.signin-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
/* The card and the legal links, stacked. Without this they become two flex
   children of .signin-wrap and sit side by side. */
.signin-col {
  width: min(420px, 100%);
}
.signin {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 28px 24px;
}
.signin .mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: #1c2437;
  display: grid; place-items: center;
  margin-bottom: 16px;
}
.signin h1 {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}
.signin .sub { color: var(--text-dim); font-size: 13.5px; margin-bottom: 20px; }
.signin label.lbl { margin-top: 14px; }
.signin .field { width: 100%; }
.signin .btn { width: 100%; justify-content: center; margin-top: 18px; }
.signin .foot-note {
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-mute);
  line-height: 1.55;
}

/* ------------------------------------------------------------ chrome ---- */
.whoami { text-align: right; line-height: 1.25; }
.whoami .who { font-size: 12.5px; font-weight: 550; }
.whoami .role {
  font-size: 10.5px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-mute);
}

/* ---------------------------------------------------------- composer ---- */
.compose-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 940px) { .compose-grid { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.card-head h2 {
  margin: 0;
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
}
.card-head .note { margin-left: auto; font-size: 12px; color: var(--text-mute); }
.card-body { padding: 18px; }

.quote {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 6px;
}
.quote .px { font-family: var(--mono); font-size: 15px; color: var(--text); }
.quote.warn { background: var(--warn-dim); border-color: var(--warn-line); color: #7a5309; }

.preview-note {
  font-size: 12px;
  color: var(--text-mute);
  margin-bottom: 10px;
}

.stat-row { display: flex; gap: 10px; flex-wrap: wrap; }
.stat {
  flex: 1;
  min-width: 104px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
}
.stat .k {
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-mute);
}
.stat .v { font-family: var(--mono); font-size: 18px; margin-top: 2px; }

/* ------------------------------------------------------------- tables --- */
.dt { width: 100%; border-collapse: collapse; }
.dt th {
  text-align: left;
  padding: 9px 14px;
  font-size: 10.5px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-mute);
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  white-space: nowrap;
}
.dt td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  vertical-align: middle;
}
.dt tr:last-child td { border-bottom: 0; }
.dt .sym { font-family: var(--mono); font-weight: 600; }
.dt .hl {
  color: var(--text-dim);
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dt .right { text-align: right; }
.table-scroll { overflow-x: auto; }

.inactive td { opacity: .5; }

.actions { display: flex; gap: 6px; justify-content: flex-end; }
.btn.danger { color: var(--bear); border-color: var(--bear-line); background: var(--bear-dim); }
.btn.danger:hover { background: #fbdede; border-color: #ecaeae; }

.ok-flash {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bull-dim);
  border: 1px solid var(--bull-line);
  color: #0b6a4c;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ========================================================== research ===== */
.pip {
  display: inline-block;
  min-width: 17px;
  padding: 0 5px;
  margin-left: 5px;
  border-radius: 100px;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 17px;
  text-align: center;
  vertical-align: 1px;
}

.machine-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 18px;
  border-radius: var(--radius-sm);
  background: var(--warn-dim);
  border: 1px solid var(--warn-line);
  color: #7a5309;
  font-size: 12.5px;
  line-height: 1.55;
}
.machine-banner b { color: #5f4108; }

.draft { margin-bottom: 14px; }
.draft .card-head { cursor: pointer; gap: 12px; align-items: center; }
.draft .card-head:hover { background: var(--surface-2); }
.draft-sym { font-family: var(--mono); font-weight: 600; font-size: 15px; }
.draft-headline {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--text);
  flex: 1;
  min-width: 180px;
}
.draft-meta {
  display: flex; align-items: center; gap: 10px;
  font-size: 11.5px; color: var(--text-mute); white-space: nowrap;
}
.draft-body { padding: 0 18px 18px; }

.analyst-tag {
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 100px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-mute);
  white-space: nowrap;
}

.thesis-block {
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--text-body);
  max-width: 68ch;
  margin: 12px 0 4px;
}
.thesis-block p { margin: 0 0 11px; }

/* A citation is a link to the actual source, never a bare token. */
a.cite {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  padding: 0 5px;
  margin: 0 1px;
  border-radius: var(--radius-xs);
  background: var(--accent-dim);
  border: 1px solid var(--accent-line);
  color: var(--accent-2);
  text-decoration: none;
  vertical-align: 1px;
}
a.cite:hover { background: #dfe5fd; }
a.cite.dead {
  background: var(--bear-dim); border-color: var(--bear-line); color: var(--bear);
}

.sources { margin-top: 14px; }
.sources h5, .facts h5 {
  margin: 0 0 8px;
  font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-mute); font-weight: 600;
}
.source {
  display: flex; gap: 9px; align-items: baseline;
  padding: 6px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.source .ref {
  font-family: var(--mono); font-size: 11px; color: var(--accent-2);
  min-width: 30px;
}
.source .meta { color: var(--text-mute); font-size: 11.5px; white-space: nowrap; }
.source a { color: var(--text-dim); text-decoration: none; }
.source a:hover { color: var(--accent-2); text-decoration: underline; }

.facts { margin-top: 16px; }
.fact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
}
.fact {
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.fact .k {
  font-size: 9.5px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-mute);
}
.fact .v { font-family: var(--mono); font-size: 14px; margin-top: 2px; }

.draft-actions {
  display: flex; gap: 9px; align-items: center; flex-wrap: wrap;
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.draft-actions .spacer { flex: 1; }

.run-strip {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.run-note { font-size: 12px; color: var(--text-mute); }

/* --- pre-open automation ------------------------------------------------
   A switch that spends money on a schedule. Styled to look deliberate rather
   than incidental: armed state is visible at a glance from across the room,
   and the reason it will not fire is shown next to the switch, not hidden. */
.automation {
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 14px 16px;
}
.automation.on {
  border-color: var(--bull-line);
  background: var(--bull-dim);
}
.auto-main { display: flex; align-items: center; gap: 14px; }
.auto-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
}
.auto-note { margin-top: 3px; font-size: 13px; color: var(--text-dim); }
.auto-note .warn { color: var(--bear); }
.auto-foot {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-mute);
}
.auto-foot .mute { display: block; margin-top: 3px; }

.pill {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-dim);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pill.on { background: var(--bull); color: #fff; }

/* The knob is centred with flex + padding, not margins. A block child's top
   margin collapses with its block parent's, so `margin: 3px` on the knob
   produced a 3px horizontal inset and a 0px vertical one — the knob sat flush
   against the top of the track and looked like it was escaping the pill.
   Padding does not collapse. The label is inline-flex because an inline
   element wrapping a block has no measurable box of its own. */
.switch {
  flex: none;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  display: inline-flex;
  align-items: center;
  width: 44px;
  height: 25px;
  padding: 3px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background 140ms ease;
}
.switch .knob {
  display: block;
  flex: none;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(20, 30, 60, 0.28);
  transition: transform 140ms ease;
}
.switch input:checked + .track { background: var(--bull); }
.switch input:checked + .track .knob { transform: translateX(19px); }
.switch input:disabled + .track { opacity: 0.45; cursor: not-allowed; }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- the gate ------------------------------------------------------------
 * The sign-in and create-account screens are all a signed-out visitor ever
 * sees, so they carry the page background themselves rather than relying on
 * a body class that only the old desk site set.
 */
body.gated { background: #eef1f7; }

.signin .hint {
  color: var(--text-dim);
  font-size: 12.5px;
  margin-top: 6px;
}

.gate-notice {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #3730a3;
  border-radius: 9px;
  padding: 9px 11px;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.45;
}

.gate-notice.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.signin .err a { color: inherit; font-weight: 600; }

/* The signed-in identity block moved from the desk header into the one shared
   appbar, so it has to survive next to the market clock on a narrow screen. */
.appbar-right .whoami { min-width: 0; }
.appbar-right .whoami .who,
.appbar-right .whoami .role {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 22ch;
}

/* A compact form control, for the role selector sitting inside a table row
   and the member filter sitting in a card header. */
.field.sm {
  padding: 5px 8px;
  font-size: 12.5px;
  height: auto;
}
.card-head #member-filter { margin-left: auto; }
.dt td .field.sm { max-width: 15rem; }

/* --- one appbar for seven tabs -------------------------------------------
 * The reader site had three tabs and the desk had four, each in its own
 * header. Merged, they share a bar that also carries the market clock, the
 * data-source chips and the signed-in identity — and at that point the tab
 * labels start wrapping onto two lines and the header grows a second row.
 * Keep every label on one line and let the strip scroll sideways instead;
 * a nav that scrolls is better than a header that reflows.
 */
.appbar .nav button { white-space: nowrap; }

.appbar .nav {
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}
.appbar .nav::-webkit-scrollbar { display: none; }

/* The identity block is the one part that may shrink; the tabs and the clock
   are either fully readable or not worth showing. */
.appbar-right .whoami { flex: 0 1 auto; min-width: 0; }
.appbar-right .whoami .who,
.appbar-right .whoami .role {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- previewing the member view ------------------------------------------
 * Amber rather than the brand indigo, and deliberately not a colour used
 * anywhere else in the app: the whole job of this strip is to be impossible
 * to stop noticing. It sits above the sticky appbar and scrolls away with the
 * page, so the header keeps its own behaviour.
 */
.preview-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 26px;
  background: #fdf3d7;
  border-bottom: 1px solid #f0dda4;
  color: #7a5b12;
  font-size: 12.5px;
  line-height: 1.45;
}
.preview-bar b { color: #5c440d; }

/* The toggle while it is on. Matches the strip so the two read as one thing. */
.appbar-right .btn.on {
  background: #fdf3d7;
  border-color: #e6cf92;
  color: #7a5b12;
}

@media (max-width: 720px) {
  .preview-bar { padding: 9px 16px; }
}

/* The desk's read-back of a notice that is already live. */
.notice-preview {
  background: var(--bg);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.6;
}

/* --- the support inbox ---------------------------------------------------
 * An open message gets a coloured edge. There is no support mailbox behind
 * this screen, so an unread one here is genuinely unread by anybody — worth
 * more than the usual amount of visual weight. */
.support-msg.is-open {
  border-left: 3px solid var(--accent);
}
.support-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 12px 0 14px;
  padding: 12px 14px;
  background: var(--surface-2, rgba(127, 127, 127, 0.07));
  border-radius: 8px;
  line-height: 1.6;
}
.support-msg .card-head { justify-content: space-between; }

/* The model provider rejected our key. Loud on purpose: it is the one
   condition where the schedule fires on time, reports success, and still
   leaves the desk empty — so the only thing that explains the morning is
   this line. */
.auto-alert {
  margin: 0 0 12px;
  padding: 11px 14px;
  border-radius: 8px;
  background: var(--warn-dim, rgba(180, 83, 9, 0.12));
  border: 1px solid var(--warn-line, rgba(180, 83, 9, 0.35));
  color: var(--warn, #b45309);
  font-size: 13px;
  line-height: 1.55;
}
.auto-alert b { display: block; margin-bottom: 2px; }
