/* Cabinet styles. One file, embedded in the binary — no build step, no CDN,
   and the strict CSP stays satisfiable. */

:root {
  --bg: #0f1418;
  --surface: #171f26;
  --surface-2: #1d262e;
  --line: #2a3641;
  --text: #e3e9ee;
  --muted: #93a2ae;
  --accent: #6fb3e8;
  --ok: #6cc09a;
  --warn: #d9a25a;
  --bad: #d98070;
  --radius: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-2: #eef2f5;
    --line: #d6dee5;
    --text: #16202b;
    --muted: #5b6b7a;
    --accent: #1f5c93;
    --ok: #2c7256;
    --warn: #8a5b12;
    --bad: #a2402f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 12px; text-transform: uppercase;
     letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }

.muted { color: var(--muted); }
.hint  { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em;
           text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }

/* layout */
.centered { min-height: 88vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.wrap { max-width: 720px; margin: 0 auto; padding: 28px 20px 60px; display: flex;
        flex-direction: column; gap: 32px; }

.topbar { display: flex; justify-content: space-between; align-items: center;
          padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.brand { font-weight: 600; text-decoration: none; color: var(--text); }

.card { background: var(--surface); border: 1px solid var(--line);
        border-radius: var(--radius); padding: 28px; }
.auth { width: 100%; max-width: 380px; }

/* account header */
.account { display: flex; justify-content: space-between; align-items: flex-start;
           gap: 16px; flex-wrap: wrap; background: var(--surface);
           border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.account-no { font-family: var(--mono); font-size: 22px; letter-spacing: 0.02em; }

.status { font-size: 13px; padding: 5px 10px; border-radius: 100px;
          border: 1px solid var(--line); white-space: nowrap; }
.status-ok    { color: var(--ok);    border-color: var(--ok); }
.status-bad   { color: var(--bad);   border-color: var(--bad); }
.status-wait  { color: var(--warn);  border-color: var(--warn); }
.status-muted { color: var(--muted); }

/* balances */
table.balances { width: 100%; border-collapse: collapse; background: var(--surface);
                 border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.balances th, .balances td { padding: 11px 16px; text-align: left;
                             border-bottom: 1px solid var(--line); }
.balances thead th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
                     color: var(--muted); background: var(--surface-2); font-weight: 600; }
.balances tbody tr:last-child td { border-bottom: 0; }
.balances .num { text-align: right; font-family: var(--mono);
                 font-variant-numeric: tabular-nums; }

/* forms */
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 5px; }
input, select {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row { grid-template-columns: 1fr; } }

button.primary, .primary.as-button {
  display: inline-block; margin-top: 18px; padding: 11px 18px;
  font: inherit; font-weight: 600; color: var(--bg); background: var(--accent);
  border: 0; border-radius: var(--radius); cursor: pointer; text-decoration: none;
}
button.primary:hover, .primary.as-button:hover { filter: brightness(1.08); }
button.primary:focus-visible, .primary.as-button:focus-visible {
  outline: 2px solid var(--text); outline-offset: 2px;
}

button.link { background: none; border: 0; color: var(--muted); font: inherit;
              cursor: pointer; padding: 0; text-decoration: underline; }
button.link:hover { color: var(--text); }

.kyc-form { margin-top: 8px; }

/* messages */
.error, .notice {
  padding: 10px 14px; border-radius: var(--radius); font-size: 14px; margin: 0 0 4px;
  border: 1px solid;
}
.error  { color: var(--bad); border-color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, transparent); }
.notice { color: var(--ok);  border-color: var(--ok);  background: color-mix(in srgb, var(--ok) 8%, transparent); }

.foot { max-width: 720px; margin: 0 auto; padding: 20px; display: flex;
        flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted);
        border-top: 1px solid var(--line); }

/* --- market and terminal --- */
.small { font-size: 12.5px; }
.up   { color: var(--ok); }
.down { color: var(--bad); }
.stale { color: var(--warn); }

.ticker { display: flex; justify-content: space-between; align-items: flex-start;
          gap: 16px; flex-wrap: wrap; background: var(--surface);
          border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.ticker-price { text-align: right; }
.price { font-family: var(--mono); font-size: 26px; font-variant-numeric: tabular-nums; }

.tf { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tf-item { padding: 5px 11px; border: 1px solid var(--line); border-radius: var(--radius);
           font-size: 13px; text-decoration: none; color: var(--muted); font-family: var(--mono); }
.tf-item:hover { color: var(--text); }
.tf-on { color: var(--text); border-color: var(--accent); background: var(--surface-2); }

.chart { background: var(--surface); border: 1px solid var(--line);
         border-radius: var(--radius); padding: 10px 8px; overflow-x: auto; }
.chart svg { display: block; width: 100%; height: auto; min-width: 520px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 10px; font-family: var(--mono); }
.chart .wick.up, .chart .body.up     { stroke: var(--ok);  fill: var(--ok); }
.chart .wick.down, .chart .body.down { stroke: var(--bad); fill: var(--bad); }
.chart .wick { stroke-width: 1; }
.chart .body { stroke-width: 1; }

.nav { display: flex; gap: 18px; font-size: 14px; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--text); }

/* Autofill: browsers force their own white/yellow background on a filled
   field, which blows a hole in a dark form. There is no property for it —
   the only reliable fix is to paint over it with a huge inset shadow and
   set the text colour separately. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--bg) inset;
  box-shadow: 0 0 0 1000px var(--bg) inset;
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  transition: background-color 100000s ease-in-out 0s;
}

/* Text selection: the default highlight is a solid light block that hides
   the glyphs on a dark ground. */
::selection {
  background: color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--text);
}

/* --- order book --- */
table.book { width: 100%; border-collapse: collapse; background: var(--surface);
             border: 1px solid var(--line); border-radius: var(--radius);
             overflow: hidden; font-family: var(--mono); font-size: 13px;
             font-variant-numeric: tabular-nums; }
.book th { font-family: var(--font); font-size: 11px; text-transform: uppercase;
           letter-spacing: 0.06em; color: var(--muted); background: var(--surface-2);
           font-weight: 600; padding: 8px 14px; text-align: left; }
.book td { padding: 5px 14px; border: 0; }
.book .num { text-align: right; color: var(--muted); }

/* The price cell carries a depth bar: a gradient stop at --fill, so the bar
   length is the level's share of the deepest one. Cheaper and steadier than a
   nested element, and it cannot knock the row height about.

   The width arrives as a class, not as style="--fill: 42%": the CSP is
   style-src 'self', which blocks inline styles, so an attribute would be
   dropped silently and every bar would render empty. Hence the ladder below —
   5% steps, which is finer than the eye reads a bar anyway. */
.book td:first-child { position: relative; }
.book .f0   { --fill:   0%; }  .book .f5   { --fill:   5%; }
.book .f10  { --fill:  10%; }  .book .f15  { --fill:  15%; }
.book .f20  { --fill:  20%; }  .book .f25  { --fill:  25%; }
.book .f30  { --fill:  30%; }  .book .f35  { --fill:  35%; }
.book .f40  { --fill:  40%; }  .book .f45  { --fill:  45%; }
.book .f50  { --fill:  50%; }  .book .f55  { --fill:  55%; }
.book .f60  { --fill:  60%; }  .book .f65  { --fill:  65%; }
.book .f70  { --fill:  70%; }  .book .f75  { --fill:  75%; }
.book .f80  { --fill:  80%; }  .book .f85  { --fill:  85%; }
.book .f90  { --fill:  90%; }  .book .f95  { --fill:  95%; }
.book .f100 { --fill: 100%; }
.book .bid td:first-child { color: var(--ok);
  background: linear-gradient(to right,
    color-mix(in srgb, var(--ok) 16%, transparent) var(--fill, 0%),
    transparent var(--fill, 0%)); }
.book .ask td:first-child { color: var(--bad);
  background: linear-gradient(to right,
    color-mix(in srgb, var(--bad) 16%, transparent) var(--fill, 0%),
    transparent var(--fill, 0%)); }

.book .spread td { text-align: center; color: var(--muted); font-size: 11.5px;
                   padding: 7px 14px; background: var(--surface-2);
                   border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
