/* Strike Street — console styling.
 *
 * Three conventions run through every screen (Draft 0.1 §5):
 *   1. Live and paper are visually distinct EVERYWHERE.
 *   2. Status is a word plus a colour, never colour alone.
 *   3. The kill switch is in the same place on every screen.
 */

:root {
  --bg:        #0b1017;
  --panel:     #141c26;
  --panel-2:   #101821;
  --line:      #1f2a37;
  --line-soft: #1a232e;

  --ink:       #e9eff5;
  --text:      #b9c5d3;
  --muted:     #68778a;
  --faint:     #4a5766;

  --accent:    #1f6feb;
  --accent-dk: #17408a;

  --green:     #4ec97f;
  --green-bg:  #17351f;
  --red:       #f0736a;
  --red-bg:    #3a1a17;
  --amber:     #e3b341;
  --amber-bg:  #382f16;
  --blue:      #58a6ff;
  --blue-bg:   #14304f;
  --neutral-bg:#232d39;

  --live:      #c2453c;
  --live-bg:   #7a1d18;

  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 13px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
button { font-family: inherit; font-size: inherit; }

/* ---------- title bar (the Tauri shell draws this natively) ---------- */
.titlebar {
  height: 28px; background: #0e151d; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 12px;
  font-size: 11px; color: var(--muted); user-select: none;
}
.titlebar .dots { letter-spacing: 3px; color: #2e3a49; margin-right: 10px; }
.titlebar .right { margin-left: auto; display: flex; gap: 14px; align-items: center; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--green); }
.dot.warn { background: var(--amber); }
.dot.bad { background: var(--red); }
.dot.off { background: var(--faint); }

/* ---------- nav ---------- */
nav {
  display: flex; align-items: center; gap: 4px;
  padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.brand { display: flex; align-items: center; gap: 8px; margin-right: 12px; }
.logo {
  width: 22px; height: 22px; border-radius: 6px; background: var(--accent);
  color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.brand span { font-weight: 700; color: var(--ink); font-size: 14px; }
.tab {
  padding: 5px 11px; border-radius: 5px; color: var(--muted);
  cursor: pointer; border: none; background: none; white-space: nowrap;
}
.tab:hover { color: var(--text); background: #18212c; }
.tab.on { background: #22303f; color: #fff; font-weight: 600; }
nav .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.pill {
  font-size: 11px; padding: 5px 10px; border-radius: 5px;
  background: #1d2733; color: #9fb0c2; border: none;
}
.pill.stop {
  background: var(--live-bg); color: #ffd9d5; font-weight: 700; cursor: pointer;
  border: 1px solid #94271f;
}
.pill.stop:hover { background: #94271f; }

/* ---------- layout ---------- */
main { padding: 14px; max-width: 1680px; margin: 0 auto; }
.row { display: flex; gap: 10px; margin-bottom: 10px; align-items: stretch; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 7px; padding: 11px 13px; min-width: 0;
}
.card.tight { padding: 8px 10px; }
.card h3 {
  margin: 0 0 8px; font-size: 12.5px; color: var(--ink); font-weight: 700;
  display: flex; align-items: baseline; gap: 7px;
}
.card h3 small { font-weight: 400; color: var(--muted); font-size: 11px; }
.card h3 .right { margin-left: auto; font-weight: 400; font-size: 11px; color: var(--muted); }

.label {
  font-size: 10px; letter-spacing: .7px; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin-bottom: 3px;
}
.big { font-size: 22px; font-weight: 700; color: var(--ink); line-height: 1.1;
       font-variant-numeric: tabular-nums; }
.mid { font-size: 15px; font-weight: 700; color: var(--ink); }
.kv { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

.green { color: var(--green); } .red { color: var(--red); }
.amber { color: var(--amber); } .blue { color: var(--blue); }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th {
  text-align: left; font-size: 10px; letter-spacing: .6px; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 0 8px 6px 0;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
td {
  padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line-soft);
  color: var(--text); vertical-align: top;
}
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #18212c; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums;
                 font-family: var(--mono); }

/* ---------- badges ---------- */
.badge {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .4px;
  text-transform: uppercase; padding: 2px 7px; border-radius: 3px; white-space: nowrap;
}
.b-buy   { background: var(--green-bg);  color: var(--green); }
.b-sell  { background: var(--red-bg);    color: var(--red); }
.b-neu   { background: var(--neutral-bg);color: #93a3b5; }
.b-warn  { background: var(--amber-bg);  color: var(--amber); }
.b-info  { background: var(--blue-bg);   color: var(--blue); }
.b-live  { background: var(--live-bg);   color: #ffd9d5; }
.b-paper { background: #1d2733;          color: #8fa3ba; }
.b-na    { background: #161e28;          color: var(--faint); }

/* ---------- timeframe tabs / toggles ---------- */
.tfbar { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.tf {
  font-size: 11px; padding: 3px 9px; border-radius: 4px; background: #1a232e;
  color: #8394a6; cursor: pointer; border: 1px solid transparent;
}
.tf:hover { color: var(--ink); }
.tf.on { background: var(--accent); color: #fff; font-weight: 700; }
.tf.toggle.on { background: var(--accent-dk); border-color: var(--accent); color: #cfe2ff; }

/* ---------- chart ---------- */
#chart { height: 300px; width: 100%; }
.chart-wrap { position: relative; }

/* ---------- meter ---------- */
.meter { height: 7px; border-radius: 4px; overflow: hidden; display: flex;
         background: #1b2430; margin: 6px 0 4px; }
.meter i { display: block; height: 100%; }
.meter .s { background: #c2453c; }
.meter .n { background: #3b4756; }
.meter .b { background: #3d9960; }

/* ---------- instrument rail ---------- */
.rail { width: 208px; flex: 0 0 208px; }
.rail .item {
  padding: 7px 9px; border-radius: 6px; cursor: pointer;
  border: 1px solid transparent; margin-bottom: 3px;
}
.rail .item:hover { background: #18212c; }
.rail .item.on { background: #1b2735; border-color: #2b3f56; }
.rail .item .code { font-weight: 700; color: var(--ink); font-size: 12.5px; }
.rail .item .px { float: right; font-family: var(--mono); font-size: 12px; }

/* ---------- the symbol browser ----------
 * `flat` is the rail without the fixed 208px column: the same row styling
 * inside a modal, where it is a list rather than a sidebar. */
.rail.flat { width: auto; flex: 1 1 auto; max-height: 420px; overflow-y: auto; }
.rail.flat .item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 10px;
}
.rail.flat .item > div:first-child {
  display: flex; align-items: baseline; gap: 8px; min-width: 0;
}
.rail.flat .item .kv {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rail.flat .item.folder { padding: 10px; }
.rail.flat .item.folder .code { font-size: 13px; }
.folder-ico { margin-right: 7px; }

/* ---------- observations ---------- */
.obs { font-size: 12px; line-height: 1.6; }
.obs b { color: var(--ink); }
.obs .conflict { color: var(--muted); }

/* ---------- forms ---------- */
input[type=text], input[type=number], input[type=email],
input[type=password], select, textarea {
  background: #0e151d; border: 1px solid var(--line); color: var(--ink);
  border-radius: 5px; padding: 6px 9px; font-family: inherit; font-size: 12px;
  width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
label.field { display: block; margin-bottom: 10px; }
label.field .label { margin-bottom: 4px; }
label.field .help { font-size: 11px; color: var(--muted); margin-top: 3px; }
.btn {
  background: var(--accent); color: #fff; border: none; border-radius: 5px;
  padding: 7px 14px; font-weight: 600; cursor: pointer;
}
.btn:hover { background: #2b7cf6; }
.btn.ghost { background: #1d2733; color: var(--text); }
.btn.ghost:hover { background: #26333f; }
.btn.danger { background: var(--live); }
.btn.danger:hover { background: #d4544a; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { padding: 3px 9px; font-size: 11px; font-weight: 600; }

/* ---------- modal ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(4,8,12,.72);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  padding: 18px 20px; width: 520px; max-width: 92vw; max-height: 88vh;
  overflow: auto;
}
.modal h2 { margin: 0 0 4px; font-size: 16px; color: var(--ink); }
.modal .sub { color: var(--muted); font-size: 12px; margin-bottom: 14px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.warn-box {
  border: 1px solid #7a2c26; background: #2a1512; border-radius: 6px;
  padding: 10px 12px; margin: 12px 0; font-size: 12px; color: #ffcfcb;
}

/* ---------- status bar ---------- */
.statusbar {
  position: sticky; bottom: 0; margin-top: 14px;
  background: var(--panel-2); border-top: 1px solid var(--line);
  padding: 7px 14px; display: flex; gap: 16px; align-items: center;
  font-size: 11px; color: var(--muted);
}
.statusbar .right { margin-left: auto; }
.statusbar.live { border-top-color: #7a2c26; background: #1a1012; }

/* ---------- misc ---------- */
.empty { padding: 26px; text-align: center; color: var(--muted); font-size: 12px; }
.spark { display: flex; gap: 1.5px; align-items: flex-end; height: 18px; }
.spark i { width: 3px; background: var(--green); border-radius: 1px; display: block; }
.spark i.bad { background: var(--red); }
.note {
  font-size: 11px; color: var(--muted); border-left: 2px solid var(--line);
  padding-left: 9px; margin-top: 8px; line-height: 1.5;
}
.sim-banner {
  background: #241d10; border: 1px solid #4a3a16; color: #e3c471;
  border-radius: 6px; padding: 7px 11px; font-size: 11.5px; margin-bottom: 10px;
}
/* A failing feed is not the same colour as a caveat about it. */
.sim-banner.bad { background: #2a1618; border-color: #5a2a2e; color: #f0a3a3; }

/* ===========================================================================
 * Draft 0.2 — sign-in, accounts, the symbol picker
 * ======================================================================== */

/* ---------- sign-in ----------
 * Centred and narrow, and deliberately nothing like the console behind it:
 * signing in is a different activity, and a form floating on a half-drawn
 * dashboard invites people to try clicking past it.
 */
.signin {
  display: flex; align-items: center; justify-content: center;
  min-height: 72vh; padding: 20px;
}
.signin .card { width: 100%; max-width: 380px; }
.signin-brand {
  display: flex; align-items: center; gap: 9px;
  font-size: 16px; font-weight: 650; color: var(--ink); margin-bottom: 3px;
}
.signin .field { margin-bottom: 12px; }
.signin input { width: 100%; }

/* `hidden` has to be said in CSS, not left to the UA stylesheet.
 * `nav { display: flex }` is a more specific match than the browser's
 * `[hidden] { display: none }`, so the nav rendered its whole tab list to
 * someone who had not signed in — the shape of the desk, given away on the
 * login screen. The same applies to the status bar and to the tabs a role
 * cannot use.
 */
nav[hidden], .statusbar[hidden] { display: none !important; }
nav .tab[hidden] { display: none !important; }
.signin .warn-box { margin-top: 0; }

/* ---------- role pill ---------- */
.pill.admin { border-color: var(--accent-dk); color: var(--blue); }

/* ---------- the statusbar's loss reading ----------
 * Amber, not red. Red is for something that has already happened; this is a
 * number getting close to a cap, which is a different thing to say.
 */
.statusbar.hot { border-top-color: #4a3a16; background: #1a1610; }
.statusbar.hot #sb-loss { color: var(--amber); }

/* ---------- key / value grid ---------- */
.kvgrid { display: grid; gap: 1px; background: var(--line-soft); border-radius: 6px; }
.kvrow {
  display: grid; grid-template-columns: 130px 1fr; gap: 10px;
  background: var(--panel-2); padding: 7px 11px; font-size: 12px;
  color: var(--text);
}
.kvrow .label { margin: 0; color: var(--muted); }
.hr { height: 1px; background: var(--line); margin: 12px 0; }

/* ---------- the symbol picker ----------
 * A grid of the broker's OWN spellings. Typing is not offered, because a typed
 * XAUUSD on a broker that calls it XAUUSD.m becomes a refused order weeks
 * later rather than an empty box now.
 */
.picker {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px; margin-top: 8px; max-height: 260px; overflow-y: auto;
  padding: 2px;
}
.pick {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 5px;
  padding: 6px 9px; font-size: 12px; cursor: pointer;
  background: var(--panel-2); color: var(--text);
}
.pick:hover { border-color: var(--accent-dk); }
.pick.on { border-color: var(--accent); background: #0f1b2d; color: var(--ink); }
.pick input { margin: 0; }
.pick .kv { margin-left: auto; }
.pick input:disabled { opacity: .5; }
.pick:has(input:disabled) { cursor: default; }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip {
  border: 1px solid var(--line); border-radius: 12px; padding: 3px 10px;
  font-size: 11.5px; color: var(--text); background: var(--panel-2);
}
.chip.bad { border-color: #7a2c26; background: var(--red-bg); color: #ffcfcb; }

/* ---------- small numeric inputs, for the caps table ---------- */
input.tiny { width: 72px; text-align: right; padding: 4px 6px; font-size: 12px; }

/* ---------- toast ----------
 * For the sentence after an action that says whether it reached the machine:
 * "applied and sent to the machine" and "applied — the machine is offline, so
 * it takes effect when it next connects" are different facts, and collapsing
 * them would be the kind of reassurance that gets someone hurt.
 */
.toast {
  position: fixed; bottom: 46px; left: 50%; transform: translate(-50%, 14px);
  background: var(--panel); border: 1px solid var(--line); border-radius: 7px;
  padding: 10px 15px; font-size: 12px; color: var(--ink); max-width: 460px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .5); opacity: 0; z-index: 60;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.go { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: #7a2c26; background: #2a1512; color: #ffcfcb; }

/* ---------- a disabled control says why in its title ---------- */
button:disabled, select:disabled { opacity: .45; cursor: not-allowed; }

/* A `.label` that carries a right-hand note needs to be a row, or the note
 * butts straight up against the label text — "PERMITTED INSTRUMENTS8 OFFERED
 * BY THIS BROKER" rather than the two separate things it is.
 */
.label:has(> .right) { display: flex; align-items: baseline; gap: 10px; }
.label > .right { margin-left: auto; font-weight: 500; letter-spacing: 0; }

/* The account modal is the longest screen in the product — identity, live,
 * suspension, a symbol picker, six limits and the day's pauses. It scrolls
 * rather than running off the bottom of the window.
 */
.modal { max-height: 90vh; }
.modal-bg { padding: 20px 0; }

/* ---------- the strike desk ---------- */

/* The spot on the side the skew favours. A left edge rather than a fill:
 * both spots are real results and the lean is one more fact about them, not a
 * verdict that the other one is wrong.
 */
.card.favoured { border-left: 2px solid var(--accent); }

/* The chosen strike in the full table. */
table tr.spot > td { background: #0f1b2d; }
table tr.spot > td:first-child { box-shadow: inset 2px 0 0 var(--accent); }

table.tight th, table.tight td { padding: 4px 7px; font-size: 11.5px; }
table.tight .badge { font-size: 9.5px; padding: 1px 5px; }

textarea {
  width: 100%; resize: vertical; font-family: var(--mono, ui-monospace,
  SFMono-Regular, Menlo, monospace); font-size: 11.5px; line-height: 1.45;
}
input[type=file] { font-size: 11.5px; color: var(--text); }
input[type=date] { color-scheme: dark; }

/* A modal that has to hold a whole option chain — a column per greek, a
 * reason per row, and a promote button at the end. */
.modal.wide { width: 1040px; }
.kv.clip {
  max-width: 260px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
/* A right-aligned numeric header sits hard against the next one — "STRIKES
 * LEAN" reads as a single column name. */
th.num { padding-right: 12px; }
