/* ==========================================================================
   FXNX operations console — shared visual system
   ==========================================================================

   THE IDEA: an instrument that shows its own confidence.

   Every valuable thing this system does is about provenance — who authored an
   exit, whether a total covers the whole mandate, whether `live: null` means
   flat or means we could not ask. So the palette carries FOUR semantic states,
   not three. Alongside gain / loss / neutral there is UNKNOWN, and it is a
   first-class citizen with its own colour and its own texture.

   That is the signature: an unverified figure is never a bare dash. It gets a
   diagonal hatch, so at a glance — without reading a word — you can tell a real
   zero from a number nobody could fetch. On a page showing somebody else's
   account balance that distinction is the entire ethical point.

   NO MONOSPACE. Financial columns need alignment, not typewriters:
   `font-variant-numeric: tabular-nums` does the job on a proportional face and
   keeps the page looking like an instrument rather than a terminal emulator.
   ========================================================================== */

:root {
  /* Ground: cool blue-black, so the warm metal accent reads as metal. */
  --void:        #0A0C10;
  --panel:       #10141B;
  --panel-hi:    #151A23;
  --edge:        #1C2430;
  --edge-soft:   #161C25;

  --ink:         #E6ECF3;
  --ink-2:       #9BAABB;
  --ink-3:       #64748B;

  /* Antique gold — the subject is XAUUSD. Muted on purpose: a neon gold reads
     as a crypto landing page, and this is somebody's client money. */
  --bullion:     #C8A951;
  --bullion-dim: #8A7436;

  --gain:        #3FB984;
  --loss:        #E05A4C;
  --warn:        #D89B3C;
  /* The fourth state. Not a shade of grey chosen by default — a deliberate
     slate that belongs to "we could not ask" and to nothing else. */
  --unknown:     #6B7A8C;

  --r:           14px;
  --r-sm:        9px;
  --pad:         18px;

  --display: "Segoe UI Variable Display", "SF Pro Display", ui-sans-serif,
             system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --text:    "Segoe UI Variable Text", "SF Pro Text", ui-sans-serif, system-ui,
             -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    /* Two very low-opacity washes give the ground depth without a visible
       gradient band. A flat #0A0C10 reads as cheap; a loud gradient reads as a
       template. */
    radial-gradient(1100px 600px at 12% -10%, rgba(200,169,81,.055), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(63,185,132,.04), transparent 55%),
    var(--void);
  background-attachment: fixed;
  color: var(--ink);
  font: 15px/1.55 var(--text);
  -webkit-font-smoothing: antialiased;
  padding: 22px 20px 60px;
}

.wrap { max-width: 1280px; margin: 0 auto; }

/* ── masthead ───────────────────────────────────────────────────────────── */

.top { display: flex; justify-content: space-between; align-items: flex-start;
       gap: 18px; flex-wrap: wrap; margin: 0 0 22px; }

.mark { display: flex; align-items: center; gap: 11px; }
.mark .glyph {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: linear-gradient(145deg, var(--bullion), var(--bullion-dim));
  box-shadow: 0 0 0 1px rgba(200,169,81,.28), 0 6px 18px -8px rgba(200,169,81,.7);
  display: grid; place-items: center;
  font: 700 13px/1 var(--display); color: #16120A; letter-spacing: -.02em;
}
.mark h1 { font: 600 19px/1.2 var(--display); margin: 0; letter-spacing: -.015em; }
.mark .sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }

.who { display: flex; align-items: center; gap: 12px; font-size: 12.5px;
       color: var(--ink-3); }
.who a { color: var(--ink-2); text-decoration: none; }
.who a:hover { color: var(--bullion); }

/* A quiet live indicator. The only ambient motion on the page. */
.pulse { display: inline-flex; align-items: center; gap: 7px; font-size: 12px;
         color: var(--ink-2); }
.pulse i { width: 6px; height: 6px; border-radius: 50%; background: var(--gain);
           box-shadow: 0 0 0 3px rgba(63,185,132,.16); animation: bp 2.4s ease-in-out infinite; }
.pulse.stale i { background: var(--warn); box-shadow: 0 0 0 3px rgba(216,155,60,.16); }
.pulse.down  i { background: var(--loss); box-shadow: 0 0 0 3px rgba(224,90,76,.16); animation: none; }
@keyframes bp { 0%,100% { opacity: 1 } 50% { opacity: .35 } }
@media (prefers-reduced-motion: reduce) { .pulse i { animation: none } }

/* ── buttons ────────────────────────────────────────────────────────────── */

.btn {
  background: linear-gradient(180deg, var(--panel-hi), var(--panel));
  color: var(--ink-2); border: 1px solid var(--edge); border-radius: var(--r-sm);
  padding: 7px 13px; font: 500 12.5px/1 var(--text); cursor: pointer;
  transition: border-color .15s, color .15s, transform .1s;
}
.btn:hover { border-color: var(--bullion-dim); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--bullion); outline-offset: 2px; }

/* ── the readout strip ──────────────────────────────────────────────────── */

.readout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  background: linear-gradient(180deg, var(--panel-hi), var(--panel));
  border: 1px solid var(--edge); border-radius: var(--r);
  overflow: hidden; margin: 0 0 16px;
}
.metric { padding: 15px 18px; border-right: 1px solid var(--edge-soft);
          position: relative; }
.metric:last-child { border-right: 0; }
.metric .k { font-size: 10px; font-weight: 600; letter-spacing: .11em;
             text-transform: uppercase; color: var(--ink-3); margin: 0 0 7px; }
.metric .v { font: 600 25px/1.05 var(--display); letter-spacing: -.025em;
             font-variant-numeric: tabular-nums; }
.metric .n { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.metric.lead .v { font-size: 31px; }
.metric.lead::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 2px;
  background: linear-gradient(180deg, var(--bullion), transparent);
}

.up { color: var(--gain); } .dn { color: var(--loss); }
.muted { color: var(--ink-3); }

/* ── panels ─────────────────────────────────────────────────────────────── */

.panel { background: var(--panel); border: 1px solid var(--edge);
         border-radius: var(--r); overflow: hidden; margin: 0 0 14px;
         position: relative; }

/* THE STATUS RAIL — the page is scannable peripherally, without reading.
   A 3px spine on each panel encodes its state in colour alone. */
.panel::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
                 background: var(--edge); }
.panel.is-master::before { background: linear-gradient(180deg, var(--bullion), var(--bullion-dim)); }
.panel.is-live::before   { background: var(--gain); }
.panel.is-idle::before   { background: var(--edge); }
.panel.is-alert::before  { background: var(--loss); }
.panel.is-unknown::before{ background: repeating-linear-gradient(
                             180deg, var(--unknown) 0 4px, transparent 4px 8px); }

.panel > header {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 13px 18px; border-bottom: 1px solid var(--edge-soft);
  background: linear-gradient(180deg, rgba(255,255,255,.022), transparent);
}
.panel > header .title { font: 600 15px/1.2 var(--display); letter-spacing: -.01em; }
.panel > header .id { font-size: 11.5px; color: var(--ink-3);
                      font-variant-numeric: tabular-nums; }
.panel > header .right { margin-left: auto; font-size: 12.5px; color: var(--ink-2);
                         font-variant-numeric: tabular-nums; }
.panel .void { padding: 16px 18px; color: var(--ink-3); font-size: 13px; }

.sechead { font: 600 11px/1 var(--display); letter-spacing: .13em;
           text-transform: uppercase; color: var(--ink-3);
           margin: 28px 0 12px; display: flex; align-items: baseline; gap: 10px; }
.sechead em { font-style: normal; letter-spacing: 0; text-transform: none;
              font-weight: 400; font-size: 12px; color: var(--ink-3); }
.sechead::after { content: ""; flex: 1; height: 1px;
                  background: linear-gradient(90deg, var(--edge), transparent); }

/* ── tables ─────────────────────────────────────────────────────────────── */

.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { padding: 11px 14px; text-align: right; white-space: nowrap;
         border-bottom: 1px solid var(--edge-soft); }
th:first-child, td:first-child { text-align: left; }
th { font: 600 10px/1 var(--display); letter-spacing: .1em; text-transform: uppercase;
     color: var(--ink-3); background: rgba(255,255,255,.015); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: rgba(255,255,255,.022); }
td.num { font-variant-numeric: tabular-nums; letter-spacing: -.005em; }
td.big { font: 600 14.5px/1 var(--display); font-variant-numeric: tabular-nums; }

/* ── THE SIGNATURE: unverified is not zero ──────────────────────────────── */

.noread {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 2px 9px 2px 7px; border-radius: 6px;
  color: var(--unknown); font-size: 11.5px; font-weight: 500;
  background: repeating-linear-gradient(-45deg,
    rgba(107,122,140,.16) 0 5px, transparent 5px 10px);
  box-shadow: inset 0 0 0 1px rgba(107,122,140,.22);
}
.noread::before { content: ""; width: 5px; height: 5px; border-radius: 1px;
                  background: var(--unknown); opacity: .7; }

/* ── chips ──────────────────────────────────────────────────────────────── */

.chip { display: inline-block; font: 600 10px/1 var(--display); letter-spacing: .07em;
        text-transform: uppercase; padding: 4px 8px; border-radius: 5px; }
.chip.live    { color: var(--gain);    background: rgba(63,185,132,.13);
                box-shadow: inset 0 0 0 1px rgba(63,185,132,.24); }
.chip.master  { color: var(--bullion); background: rgba(200,169,81,.13);
                box-shadow: inset 0 0 0 1px rgba(200,169,81,.26); }
.chip.out     { color: var(--loss);    background: rgba(224,90,76,.12);
                box-shadow: inset 0 0 0 1px rgba(224,90,76,.24); }
.chip.idle    { color: var(--ink-3);   background: rgba(255,255,255,.04);
                box-shadow: inset 0 0 0 1px var(--edge); }
.chip.unknown { color: var(--unknown); background: rgba(107,122,140,.12);
                box-shadow: inset 0 0 0 1px rgba(107,122,140,.24); }

/* ── row action button + the paused chip ────────────────────────────────── */
/* Small enough to sit in a dense table row without stretching it. */
.btn.mini { padding: 4px 10px; font-size: 11.5px; line-height: 1.1; }
/* Resume puts new money to work, so it reads as the consequential one. */
.btn.mini.resume { color: var(--gain); border-color: rgba(63,185,132,.4); }
.btn.mini.resume:hover { border-color: var(--gain); }
.chip.warn { color: #EBC98C; background: rgba(216,155,60,.12);
             box-shadow: inset 0 0 0 1px rgba(216,155,60,.28); }

/* ── side pills (exposure) ──────────────────────────────────────────────── */
/* The SAME two colours the position rows use for their side chip, so buy and
   sell mean one thing on this page. Tabular numerals: these sit under a figure
   and must not jitter as the book moves. */
.pill { display: inline-block; font: 600 11px/1 var(--display);
        letter-spacing: .04em; padding: 4px 7px; border-radius: 5px;
        font-variant-numeric: tabular-nums; margin-right: 5px; }
.pill.buy  { color: var(--gain); background: rgba(63,185,132,.13);
             box-shadow: inset 0 0 0 1px rgba(63,185,132,.24); }
.pill.sell { color: var(--loss); background: rgba(224,90,76,.12);
             box-shadow: inset 0 0 0 1px rgba(224,90,76,.24); }
/* "lots" rides with the number at a whisper, so the figure stays the loud part. */
.metric .v .unit { font-size: 13px; font-weight: 500; color: var(--ink-3);
                   letter-spacing: 0; }

/* ── notices ────────────────────────────────────────────────────────────── */

.notice { border-radius: var(--r-sm); padding: 12px 15px; margin: 0 0 12px;
          font-size: 13.5px; border: 1px solid; }
.notice b { font-weight: 600; }
.notice.warn { background: rgba(216,155,60,.09);  border-color: rgba(216,155,60,.3);  color: #EBC98C; }
.notice.err  { background: rgba(224,90,76,.09);   border-color: rgba(224,90,76,.32);  color: #F2A79C; }

/* ── editable label ─────────────────────────────────────────────────────── */

.rename { background: transparent; border: 1px solid transparent; color: inherit;
          font: 600 14px/1.2 var(--display); letter-spacing: -.01em;
          padding: 3px 7px; margin: -3px -7px; border-radius: 6px;
          max-width: 210px; transition: border-color .15s, background .15s; }
.rename:hover { border-color: var(--edge); background: rgba(255,255,255,.02); }
.rename:focus { outline: none; border-color: var(--bullion);
                background: rgba(200,169,81,.06); }
.rename::placeholder { color: var(--ink-3); font-weight: 400; font-style: italic; }
.subid { display: block; font-size: 11px; color: var(--ink-3); margin-top: 3px;
         font-variant-numeric: tabular-nums; }
.tag { font-size: 9.5px; font-weight: 600; letter-spacing: .08em;
       text-transform: uppercase; color: var(--ink-3); margin-left: 6px; }

.foot { margin: 26px 0 0; font-size: 11.5px; color: var(--ink-3); line-height: 1.6; }

@media (max-width: 640px) {
  body { padding: 16px 13px 40px; }
  .metric { padding: 13px 15px; }
  .metric .v { font-size: 21px; } .metric.lead .v { font-size: 25px; }
  th, td { padding: 9px 11px; }
}
