/* Duration Desk — the look agreed in the v2 mockup.
 *
 * One colour rule, applied everywhere: red and blue mean the direction of the
 * duration view and nothing else. Not "good and bad", not "up and down" —
 * bearish duration is red because it maps to TBT, bullish is blue because it
 * maps to TLT. A palette that also used red for errors would make the two
 * meanings compete on the same screen, so failures are carried by an amber
 * that appears nowhere else.
 */

:root {
  /* Neutral greys, not blue-tinted. The panels should read as glass lifted off
   * the background, and any hue in them competes with the only two colours
   * allowed to carry meaning here. */
  --nav: #090909;
  --canvas: #000000;
  --panel-top: #0f0f0f;
  --panel-bottom: #080808;
  --panel: #0b0b0b;
  --panel-2: #141414;
  --text: #f8f9fb;
  --text-soft: #e4e6eb;
  --muted: #9c9c9c;
  --muted-dark: #6e6e6e;

  /* Edges do the work, not shadows. On a near-black ground a drop shadow has
   * almost nothing to darken, so depth comes from lighting the top edge and
   * darkening the bottom one - the surface reads as tilted toward a light
   * above it. */
  --edge-top: #333333;
  --edge: #1c1c1c;
  --edge-bottom: #000000;

  /* The depth ladder. A raised surface needs three things: a lit top edge, a
   * shadow beneath it, and a darker ground to sit on. */
  --lift:
    inset 0 1px 0 rgba(255, 255, 255, 0.075),
    inset 0 -1px 0 rgba(0, 0, 0, 0.7),
    0 2px 4px rgba(0, 0, 0, 0.75),
    0 12px 30px rgba(0, 0, 0, 0.85);
  --lift-sm:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 1px 3px rgba(0, 0, 0, 0.7),
    0 5px 14px rgba(0, 0, 0, 0.6);
  --bear: #f4626f;
  --bull: #5b93ff;
  --warn: #e0a34a;
  --line: rgba(255, 255, 255, 0.075);
  --hair: rgba(255, 255, 255, 0.05);
  --mono: "JetBrains Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --sidebar: 244px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.mono { font-family: var(--mono); }

/* -- layout ------------------------------------------------------------ */

.shell { display: flex; min-height: 100vh; }

.side {
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  /* Lighter than the canvas rather than darker: the rail reads as the frame
   * the panels are mounted on, not as a hole beside them. */
  background: linear-gradient(180deg, #0b0b0b 0%, #050505 100%);
  border-right: 1px solid var(--edge);
  box-shadow: 3px 0 0 rgba(0, 0, 0, 0.55), 10px 0 30px rgba(0, 0, 0, 0.6);
  padding: 26px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.main { flex: 1; padding: 22px 28px 48px; min-width: 0; }

/* -- scrollbars -------------------------------------------------------- */

/* The rail's own scrollbar is the one that shows, because the sidebar is the
 * only fixed-height column. A default one paints a light grey trough straight
 * through the black and reads as a seam in the panel. Firefox takes the two
 * properties, everything else takes the pseudo-elements; both are given. */

* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.12) transparent; }

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.11);
  border-radius: 4px;
  /* Inset by a transparent border so the bar never touches the edge. */
  background-clip: padding-box;
  border: 1px solid transparent;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* The rail hides its bar until the pointer is over it: a permanent line down
 * the side of a black column is exactly the seam we are avoiding. */
.side { scrollbar-color: transparent transparent; }
.side:hover { scrollbar-color: rgba(255, 255, 255, 0.12) transparent; }
.side::-webkit-scrollbar-thumb { background: transparent; }
.side:hover::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  background-clip: padding-box;
}

/* -- sidebar ----------------------------------------------------------- */

.brand { line-height: 1.1; }
.brand .lg { font-size: 17px; letter-spacing: 0.26em; font-weight: 600; }
.brand .sub { font-size: 10px; letter-spacing: 0.26em; color: var(--muted-dark); margin-top: 3px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-i {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 7px;
  color: var(--muted); font-size: 13.5px;
  border: 1px solid transparent;
}
.nav-i:hover { color: var(--text-soft); background: rgba(255, 255, 255, 0.03); }
.nav-i.on {
  color: var(--text);
  background: linear-gradient(180deg, #191919 0%, #0f0f0f 100%);
  border-color: var(--edge); border-top-color: var(--edge-top);
  border-bottom-color: var(--edge-bottom);
  box-shadow: var(--lift-sm);
}
.nav-i svg { width: 15px; height: 15px; flex: 0 0 15px; opacity: 0.85; }

.sec { font-size: 9.5px; letter-spacing: 0.22em; color: var(--muted-dark); margin-bottom: 10px; }

.uni-r, .curve-r {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 9px 0; border-bottom: 1px solid var(--hair);
}
.uni-r:last-child, .curve-r:last-child { border-bottom: none; }
.uni-r .k { font-size: 13px; font-weight: 500; }
.uni-r .d { font-size: 9px; letter-spacing: 0.14em; color: var(--muted-dark); }
.uni-r .v, .curve-r .v { text-align: right; font-family: var(--mono); font-size: 12.5px; }
.uni-r .u, .curve-r .u { font-size: 11px; font-family: var(--mono); }

.field {
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(180deg, var(--panel-top) 0%, var(--panel-bottom) 100%);
  border: 1px solid var(--edge); border-top-color: var(--edge-top);
  border-bottom-color: var(--edge-bottom); border-radius: 7px;
  padding: 9px 12px; margin-bottom: 8px;
  box-shadow: var(--lift-sm);
}
.field .lbl { font-size: 9.5px; letter-spacing: 0.16em; color: var(--muted-dark); }
.field .val { font-family: var(--mono); font-size: 12px; }

.legend { display: flex; flex-direction: column; gap: 7px; font-size: 12px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 9px; }
.dot { width: 7px; height: 7px; border-radius: 2px; flex: 0 0 7px; }

.side-foot { margin-top: auto; font-size: 9.5px; letter-spacing: 0.14em; color: var(--muted-dark); display: flex; align-items: center; gap: 8px; }

/* -- top bar ----------------------------------------------------------- */

.top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 20px; }
.top .lastrun { font-size: 10px; letter-spacing: 0.16em; color: var(--muted-dark); flex: 1; }
.top .title { font-size: 12.5px; letter-spacing: 0.34em; color: var(--text-soft); white-space: nowrap; }
.top .acts { display: flex; gap: 10px; flex: 1; justify-content: flex-end; }

.btn {
  font: inherit; font-size: 13px;
  background: linear-gradient(180deg, var(--panel-2) 0%, var(--panel) 100%);
  color: var(--text-soft);
  border: 1px solid var(--edge); border-top-color: var(--edge-top);
  border-bottom-color: var(--edge-bottom); border-radius: 7px;
  padding: 8px 16px; cursor: pointer;
  box-shadow: var(--lift-sm);
}
.btn:hover { background: linear-gradient(180deg, #1c1c1c 0%, #121212 100%); }
.btn:active { box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5); }
.btn.primary {
  background: linear-gradient(180deg, #ffffff 0%, #e9eaec 100%);
  color: #0b0d12; border-color: #ffffff; font-weight: 500;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 2px 10px rgba(0, 0, 0, 0.45);
}
.btn.primary:hover { background: #fff; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* -- cards ------------------------------------------------------------- */

.card {
  background: linear-gradient(180deg, var(--panel-top) 0%, var(--panel-bottom) 100%);
  border: 1px solid var(--edge);
  border-top-color: var(--edge-top);
  border-bottom-color: var(--edge-bottom);
  border-radius: 12px;
  box-shadow: var(--lift);
}
.card-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px; border-bottom: 1px solid var(--hair);
}
.card-h h2 { margin: 0; font-size: 9.5px; letter-spacing: 0.2em; color: var(--muted); font-weight: 500; }
.card-h .hint { font-size: 9.5px; letter-spacing: 0.16em; color: var(--muted-dark); }
.card-b { padding: 18px; }

.row { display: grid; gap: 16px; margin-bottom: 16px; }
.row.m4 { grid-template-columns: repeat(4, 1fr); }
.row.split { grid-template-columns: 1fr 380px; }

/* -- metrics ----------------------------------------------------------- */

.metric { padding: 18px; text-align: center; }
.metric .lbl { font-size: 9.5px; letter-spacing: 0.2em; color: var(--muted); }
.metric .n { font-family: var(--mono); font-size: 34px; margin: 10px 0 6px; letter-spacing: -0.01em; }
.metric .n small { font-size: 17px; color: var(--muted); }
.metric .note { font-size: 11px; color: var(--muted-dark); }

/* -- the call ---------------------------------------------------------- */

.call { display: grid; grid-template-columns: 1fr 1fr; }
.call-l { padding: 24px 26px; border-right: 1px solid var(--hair); }
.call-r { padding: 24px 26px; }

.tk { display: flex; align-items: baseline; gap: 18px; }
.tk .sym { font-family: var(--mono); font-size: 58px; line-height: 1; letter-spacing: -0.02em; }
.tk .who .t { font-size: 19px; }
.tk .who .s { font-size: 12px; color: var(--muted-dark); margin-top: 3px; }

.chip {
  display: inline-block; margin-top: 16px;
  font-size: 9.5px; letter-spacing: 0.18em;
  border: 1px solid; border-radius: 5px; padding: 5px 11px;
}

.gauge { margin-top: 26px; }
.gauge .track { position: relative; height: 34px; }
.gauge .ticks { display: flex; gap: 3px; height: 100%; align-items: center; }
.gauge .ticks i { flex: 1; height: 13px; background: var(--hair); border-radius: 1px; }
.gauge .ticks i.lit { height: 22px; }
.gauge .pin { position: absolute; top: -12px; transform: translateX(-50%); text-align: center; }
.gauge .pin b { display: block; font-family: var(--mono); font-size: 12px; font-weight: 400; }
.gauge .pin i { display: block; width: 9px; height: 9px; border-radius: 50%; margin: 3px auto 0; background: var(--text); }
.gauge .scale { display: flex; justify-content: space-between; font-size: 9px; letter-spacing: 0.14em; color: var(--muted-dark); margin-top: 8px; }

.read { font-size: 13.5px; line-height: 1.65; color: var(--text-soft); }
.read .stamp { font-size: 9.5px; letter-spacing: 0.16em; color: var(--muted-dark); margin-bottom: 14px; display: flex; justify-content: space-between; }
.read .why { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--hair); font-size: 12px; color: var(--muted); }

/* -- drivers ----------------------------------------------------------- */

.drv { display: flex; align-items: center; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--hair); }
.drv:last-child { border-bottom: none; }
.drv .tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em;
  border: 1px solid; border-radius: 5px; padding: 4px 8px; min-width: 62px; text-align: center;
}
.drv .body { flex: 1; min-width: 0; }
.drv .body .t { font-size: 14px; }
.drv .body .e { font-family: var(--mono); font-size: 11px; color: var(--muted-dark); margin-top: 3px; word-break: break-word; }
.drv .wbar { width: 110px; height: 2px; background: var(--hair); border-radius: 2px; flex: 0 0 110px; }
.drv .wbar i { display: block; height: 100%; border-radius: 2px; }

/* -- lists ------------------------------------------------------------- */

.line-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--hair); }
.line-row:last-child { border-bottom: none; }
.line-row .n1 { font-size: 13.5px; }
.line-row .n2 { font-size: 10.5px; color: var(--muted-dark); font-family: var(--mono); margin-top: 2px; }
.line-row .r { font-size: 9.5px; letter-spacing: 0.16em; color: var(--muted); white-space: nowrap; }

.pill { font-size: 9px; letter-spacing: 0.12em; border: 1px solid var(--line); border-radius: 4px; padding: 3px 7px; color: var(--muted); font-family: var(--mono); }

/* -- table ------------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 9.5px; letter-spacing: 0.18em; font-weight: 500;
  color: var(--muted-dark); padding: 0 12px 12px; border-bottom: 1px solid var(--hair);
}
td { padding: 13px 12px; border-bottom: 1px solid var(--hair); font-size: 13px; }
tr:last-child td { border-bottom: none; }
td.num { font-family: var(--mono); }
.tick { font-family: var(--mono); font-size: 11px; border: 1px solid; border-radius: 5px; padding: 3px 9px; }

/* -- chart ------------------------------------------------------------- */

.chart { width: 100%; height: 210px; display: block; }
.chart-x { display: flex; justify-content: space-between; font-size: 9.5px; letter-spacing: 0.14em; color: var(--muted-dark); margin-top: 10px; }

/* -- tones ------------------------------------------------------------- */

.bull { color: var(--bull); }
.bear { color: var(--bear); }
.flat { color: var(--muted); }
.b-bull { border-color: rgba(91, 147, 255, 0.45); }
.b-bear { border-color: rgba(244, 98, 111, 0.45); }
.b-flat { border-color: var(--line); }
.bg-bull { background: var(--bull); }
.bg-bear { background: var(--bear); }
.bg-flat { background: var(--muted-dark); }

/* -- flashes ----------------------------------------------------------- */

.flash { border: 1px solid; border-radius: 9px; padding: 12px 16px; margin-bottom: 16px; font-size: 13px; }
.flash.ok { border-color: rgba(91, 147, 255, 0.4); color: var(--bull); }
.flash.error { border-color: rgba(224, 163, 74, 0.5); color: var(--warn); }
.flash.warning { border-color: rgba(224, 163, 74, 0.5); color: var(--warn); }

.warnbox {
  border: 1px solid rgba(224, 163, 74, 0.3); border-radius: 12px;
  padding: 14px 18px; margin-bottom: 16px;
  background: linear-gradient(180deg, rgba(224, 163, 74, 0.045) 0%, rgba(0, 0, 0, 0) 100%);
  box-shadow: var(--lift-sm);
}
.warnbox .h { font-size: 9.5px; letter-spacing: 0.2em; color: var(--warn); margin-bottom: 9px; }
.warnbox li { font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.warnbox ul { margin: 0; padding-left: 18px; }

/* -- empty state ------------------------------------------------------- */

.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty .big { font-size: 17px; color: var(--text-soft); margin-bottom: 10px; }

/* -- login ------------------------------------------------------------- */

.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.gate .box { width: 100%; max-width: 350px; }
.gate .brand { text-align: center; margin-bottom: 30px; }
.gate label { display: block; font-size: 9.5px; letter-spacing: 0.2em; color: var(--muted); margin-bottom: 9px; }
.gate .hint { text-align: center; font-size: 11px; color: var(--muted-dark); margin-top: 20px; }

input[type="password"], input[type="text"], input[type="number"] {
  width: 100%; font: inherit; font-family: var(--mono); font-size: 13px;
  /* Sunk rather than raised: a field is a recess in the panel. */
  background: #050505; color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.06); border-radius: 7px; padding: 10px 13px;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.55);
}
input:focus { outline: none; border-color: rgba(91, 147, 255, 0.5); }

/* -- settings ---------------------------------------------------------- */

.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; }
.set-f label { display: block; font-size: 12.5px; margin-bottom: 6px; color: var(--text-soft); }
.set-f .u { font-size: 10px; letter-spacing: 0.12em; color: var(--muted-dark); margin-left: 7px; }
.blurb { font-size: 12.5px; color: var(--muted); margin: 0 0 18px; max-width: 62ch; line-height: 1.6; }

@media (max-width: 1120px) {
  .row.m4 { grid-template-columns: repeat(2, 1fr); }
  .row.split { grid-template-columns: 1fr; }
  .call { grid-template-columns: 1fr; }
  .call-l { border-right: none; border-bottom: 1px solid var(--hair); }
  .set-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .side { width: 100%; flex: none; height: auto; position: static; }
  .row.m4 { grid-template-columns: 1fr; }
  .main { padding: 18px 16px 40px; }
  .tk .sym { font-size: 44px; }
}
