/* Rustyard control panel — "blueprint & oxide"
 *
 * The palette comes from Rust's own two visual registers: the cyan technical
 * drawing of a blueprint, and the oxide orange of the scrap it builds. Cyan
 * carries structure (labels, rules, axes); oxide is reserved for actions and
 * nothing else, so a button that can change the server always looks different
 * from a button that only navigates. Numbers are always mono, always
 * tabular — a gauge that reflows as digits change is a gauge you stop reading.
 */

:root {
  --ground:      #0f151b;
  --ground-2:    #131b23;
  --panel:       #17212a;
  --panel-2:     #1c2832;
  --panel-3:     #223140;
  --line:        #26343f;
  --line-bright: #35495a;
  --blueprint:      #5aa8cf;
  --blueprint-dim:  #3d7794;
  --blueprint-wash: rgba(90, 168, 207, 0.10);
  --oxide:        #cd6234;
  --oxide-bright: #e5793f;
  --oxide-wash:   rgba(205, 98, 52, 0.13);
  --bone:  #e9e4d9;
  --bone-2:#c3bfb5;
  --muted: #8296a4;
  --faint: #5d6f7c;
  --live: #62a96e;
  --warn: #dba63f;
  --down: #bf4a41;

  --display: "Saira Condensed", "Arial Narrow", sans-serif;
  --body: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  --rail-w: 218px;
  --vitals-h: 78px;
  --radius: 3px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

/* The hidden attribute only sets display:none at the UA level, so any of our
 * own display rules (.app, .gate and .modal are all grid) silently defeat it.
 * This makes [hidden] mean hidden everywhere. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background-color: var(--ground);
  /* Faint blueprint grid: the drafting surface everything sits on. */
  background-image:
    linear-gradient(to right, rgba(90, 168, 207, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(90, 168, 207, 0.045) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--bone);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; margin: 0; letter-spacing: 0.01em; }

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

::selection { background: var(--oxide); color: #fff; }

:focus-visible {
  outline: 2px solid var(--blueprint);
  outline-offset: 2px;
}

/* ---------- typographic utilities ---------- */
.eyebrow {
  font-family: var(--display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blueprint-dim);
}
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }

/* ---------- login gate ---------- */
.gate {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}
.gate-card {
  width: 100%;
  max-width: 372px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 34px 30px 30px;
  box-shadow: var(--shadow);
  position: relative;
}
/* Corner ticks: the registration marks of a technical drawing. */
.gate-card::before,
.gate-card::after {
  content: "";
  position: absolute;
  width: 10px; height: 10px;
  border: 1px solid var(--blueprint-dim);
}
.gate-card::before { top: 8px; left: 8px; border-right: 0; border-bottom: 0; }
.gate-card::after { bottom: 8px; right: 8px; border-left: 0; border-top: 0; }

.gate-mark { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.gate-mark-rule { flex: 1; height: 1px; background: var(--line-bright); }
.gate-mark-text {
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--oxide);
}
.gate-title { font-size: 30px; line-height: 1.05; }
.gate-sub { color: var(--muted); margin: 6px 0 24px; font-size: 13px; }
.gate-error {
  margin: 0 0 16px;
  padding: 9px 11px;
  background: rgba(191, 74, 65, 0.14);
  border-left: 2px solid var(--down);
  color: #eba9a3;
  font-size: 13px;
}

/* ---------- form primitives ---------- */
.field { display: block; margin-bottom: 16px; }
.field-label {
  display: block;
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%;
  background: var(--ground-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--bone);
  font-family: var(--body);
  font-size: 14px;
  padding: 9px 11px;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blueprint-dim);
  outline: none;
  box-shadow: 0 0 0 3px var(--blueprint-wash);
}
textarea { resize: vertical; min-height: 90px; font-family: var(--mono); font-size: 13px; line-height: 1.55; }
input[type=checkbox] { accent-color: var(--oxide); width: 15px; height: 15px; }
/* A bare box does not read as a dropdown, so draw a chevron. */
select {
  appearance: none;
  padding-right: 30px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) center, calc(100% - 10px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
select:hover { background-image:
    linear-gradient(45deg, transparent 50%, var(--bone) 50%),
    linear-gradient(135deg, var(--bone) 50%, transparent 50%); }

/* Chromium's autofill paints its own near-white background, which wrecks the
 * dark form. The inset shadow is the only way to override it. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--bone);
  -webkit-box-shadow: 0 0 0 40px var(--ground-2) inset;
  caret-color: var(--bone);
}

/* ---------- buttons ---------- */
.btn {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--line-bright);
  background: var(--panel-2);
  color: var(--bone);
  border-radius: var(--radius);
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--panel-3); border-color: var(--blueprint-dim); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--oxide); border-color: var(--oxide); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--oxide-bright); border-color: var(--oxide-bright); }
.btn-danger { background: transparent; border-color: var(--down); color: #e08b84; }
.btn-danger:hover:not(:disabled) { background: rgba(191, 74, 65, 0.16); border-color: var(--down); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-ghost:hover:not(:disabled) { color: var(--bone); border-color: var(--line-bright); background: var(--panel-2); }
.btn-wide { width: 100%; padding: 11px; }
.btn-tiny { font-size: 11px; padding: 5px 9px; letter-spacing: 0.06em; }

/* ---------- app frame ---------- */
.app {
  min-height: 100%;
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  grid-template-rows: var(--vitals-h) 1fr;
  grid-template-areas: "rail vitals" "rail stage";
}

/* ---------- left rail ---------- */
.rail {
  grid-area: rail;
  background: var(--ground-2);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.rail-brand { padding: 18px 20px 16px; border-bottom: 1px solid var(--line); }
.rail-brand-name {
  display: block;
  font-family: var(--display);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bone);
}
.rail-brand-meta { display: block; font-family: var(--mono); font-size: 11px; color: var(--faint); margin-top: 2px; }

.rail-nav { list-style: none; margin: 0; padding: 10px 0; flex: 1; overflow-y: auto; }
.rail-link {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  border: 0;
  background: none;
  color: var(--bone-2);
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: left;
  padding: 9px 20px;
  cursor: pointer;
  border-left: 2px solid transparent;
}
.rail-link:hover { background: var(--panel); color: var(--bone); }
.rail-link[aria-current="page"] {
  border-left-color: var(--oxide);
  background: var(--panel);
  color: var(--bone);
}
.rail-link-index { font-family: var(--mono); font-size: 10px; color: var(--faint); width: 14px; }
.rail-link[aria-current="page"] .rail-link-index { color: var(--oxide); }
.rail-badge {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  background: var(--panel-3);
  color: var(--blueprint);
  padding: 1px 6px;
  border-radius: 8px;
}

.rail-foot {
  border-top: 1px solid var(--line);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.rail-user { font-family: var(--mono); font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

/* ---------- vitals strip (signature) ---------- */
.vitals {
  grid-area: vitals;
  background: linear-gradient(180deg, var(--panel) 0%, var(--ground-2) 100%);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
  overflow: hidden;
}
.vitals-state { display: flex; align-items: center; gap: 11px; min-width: 150px; }
.pulse {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--faint);
  box-shadow: 0 0 0 0 rgba(0,0,0,0);
  flex: none;
}
.pulse[data-state="live"] { background: var(--live); animation: beat 2.4s ease-out infinite; }
.pulse[data-state="warn"] { background: var(--warn); }
.pulse[data-state="down"] { background: var(--down); animation: beat 1s ease-out infinite; }
@keyframes beat {
  0%   { box-shadow: 0 0 0 0 rgba(98, 169, 110, 0.5); }
  70%  { box-shadow: 0 0 0 9px rgba(98, 169, 110, 0); }
  100% { box-shadow: 0 0 0 0 rgba(98, 169, 110, 0); }
}
.vitals-state-text { display: flex; flex-direction: column; }
.vitals-state-main {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.1;
}
.vitals-state-sub { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }

.gauges { display: flex; gap: 22px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.gauges::-webkit-scrollbar { display: none; }
.gauge { display: flex; flex-direction: column; gap: 1px; min-width: 62px; }
.gauge-label {
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blueprint-dim);
  white-space: nowrap;
}
.gauge-value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 19px;
  font-weight: 500;
  line-height: 1.15;
  color: var(--bone);
}
.gauge-value[data-tone="warn"] { color: var(--warn); }
.gauge-value[data-tone="down"] { color: var(--down); }
.gauge-value[data-tone="live"] { color: var(--live); }
.gauge-unit { font-size: 11px; color: var(--faint); margin-left: 2px; }

.vitals-spark { position: relative; width: 240px; flex: none; }
.vitals-spark svg { width: 240px; height: 44px; display: block; }
.vitals-spark-label {
  position: absolute;
  right: 0; bottom: -3px;
  font-family: var(--display);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ---------- stage ---------- */
.stage { grid-area: stage; padding: 26px 28px 60px; min-width: 0; }

.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.head-title { font-size: 27px; line-height: 1; text-transform: uppercase; letter-spacing: 0.02em; }
.head-sub { color: var(--muted); font-size: 13px; margin-top: 5px; max-width: 62ch; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- panels ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  position: relative;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.panel-title { font-size: 15px; text-transform: uppercase; letter-spacing: 0.09em; }
.panel-body { padding: 16px; }
.panel-body-flush { padding: 0; }
.panel-tools { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.panel-note { padding: 10px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-wide { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }

/* ---------- stat tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(154px, 1fr)); gap: 12px; }
.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tile-label {
  font-family: var(--display);
  font-size: 10.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--blueprint-dim);
}
.tile-value { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 23px; line-height: 1.1; }
.tile-foot { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.tile-bar { height: 3px; background: var(--ground); border-radius: 2px; overflow: hidden; margin-top: 5px; }
.tile-bar-fill { height: 100%; background: var(--blueprint-dim); transition: width 0.4s ease; }
.tile-bar-fill[data-tone="warn"] { background: var(--warn); }
.tile-bar-fill[data-tone="down"] { background: var(--down); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left;
  font-family: var(--display);
  font-size: 10.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--blueprint-dim);
  font-weight: 600;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--ground-2);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
table.data td { padding: 9px 14px; border-bottom: 1px solid rgba(38, 52, 63, 0.6); vertical-align: middle; }
table.data tbody tr:hover { background: var(--panel-2); }
table.data td.num, table.data td .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
table.data td.actions { text-align: right; white-space: nowrap; }
table.data td.actions .btn { margin-left: 5px; }
.row-name { font-weight: 500; }
.row-sub { display: block; font-family: var(--mono); font-size: 11px; color: var(--faint); }

.empty { padding: 34px 18px; text-align: center; color: var(--muted); }
.empty-title { font-family: var(--display); font-size: 17px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--bone-2); }
.empty-hint { font-size: 13px; margin-top: 5px; }

/* ---------- pills ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: 9px;
  border: 1px solid var(--line-bright);
  color: var(--muted);
  white-space: nowrap;
}
.pill[data-tone="live"]  { color: #92d19c; border-color: rgba(98,169,110,0.5); background: rgba(98,169,110,0.10); }
.pill[data-tone="warn"]  { color: #e6c37e; border-color: rgba(219,166,63,0.5); background: rgba(219,166,63,0.10); }
.pill[data-tone="down"]  { color: #e08b84; border-color: rgba(191,74,65,0.5); background: rgba(191,74,65,0.10); }
.pill[data-tone="info"]  { color: #93c9e2; border-color: rgba(90,168,207,0.45); background: var(--blueprint-wash); }
.pill[data-tone="oxide"] { color: #eba07a; border-color: rgba(205,98,52,0.5); background: var(--oxide-wash); }

/* ---------- console ---------- */
.console-shell { display: flex; flex-direction: column; height: calc(100vh - var(--vitals-h) - 150px); min-height: 340px; }
.console-out {
  flex: 1;
  overflow-y: auto;
  background: #0b1116;
  border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.58;
}
.cline { display: flex; gap: 11px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cline-ts { color: #3f5462; flex: none; }
.cline-body { flex: 1; color: var(--bone-2); }
.cline[data-kind="Chat"]    .cline-body { color: #9ed6b0; }
.cline[data-kind="Warning"] .cline-body { color: var(--warn); }
.cline[data-kind="Error"]   .cline-body { color: #e08b84; }
.cline[data-kind="Panel"]   .cline-body { color: var(--blueprint); }
.cline[data-echo="1"]       .cline-body { color: var(--oxide-bright); font-weight: 500; }

.console-in {
  display: flex;
  gap: 0;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--ground-2);
  align-items: stretch;
}
.console-caret {
  display: grid;
  place-items: center;
  padding: 0 12px;
  color: var(--oxide);
  font-family: var(--mono);
  font-size: 15px;
  border-right: 1px solid var(--line);
}
.console-in input {
  border: 0;
  background: transparent;
  border-radius: 0;
  font-family: var(--mono);
  font-size: 13px;
  padding: 11px 12px;
}
.console-in input:focus { box-shadow: none; }
.console-in .btn { border: 0; border-left: 1px solid var(--line); border-radius: 0; }

/* ---------- code / editor ---------- */
.code {
  width: 100%;
  min-height: 420px;
  background: #0b1116;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--bone-2);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  padding: 13px;
  tab-size: 4;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
}
.log-out {
  background: #0b1116;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  height: calc(100vh - var(--vitals-h) - 210px);
  min-height: 300px;
  overflow-y: auto;
  color: var(--bone-2);
}

/* ---------- file manager ---------- */
.files-layout { display: grid; grid-template-columns: 196px minmax(0, 1fr); gap: 16px; }
.crumbs { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; font-family: var(--mono); font-size: 12px; }
.crumb { background: none; border: 0; color: var(--blueprint); cursor: pointer; padding: 2px 3px; font: inherit; }
.crumb:hover { text-decoration: underline; }
.crumb-sep { color: var(--faint); }
.crumb-here { color: var(--bone); }
.bookmarks { list-style: none; margin: 0; padding: 0; }
.bookmark {
  display: block; width: 100%; text-align: left;
  background: none; border: 0; border-left: 2px solid transparent;
  color: var(--bone-2); font-family: var(--body); font-size: 13px;
  padding: 7px 12px; cursor: pointer;
}
.bookmark:hover { background: var(--panel-2); color: var(--bone); }
.bookmark[aria-current="true"] { border-left-color: var(--oxide); color: var(--bone); background: var(--panel-2); }
.fname { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; text-align: left; padding: 0; }
.fname:hover { color: var(--blueprint); text-decoration: underline; }
.ficon { color: var(--blueprint-dim); margin-right: 7px; font-family: var(--mono); }
.drop-zone { border: 1px dashed var(--line-bright); border-radius: var(--radius); padding: 14px; text-align: center; color: var(--muted); font-size: 12.5px; }
.drop-zone[data-active="true"] { border-color: var(--oxide); background: var(--oxide-wash); color: var(--bone); }

/* ---------- charts ---------- */
.chart { width: 100%; height: 176px; display: block; }
.chart-axis { stroke: var(--line); stroke-width: 1; }
.chart-grid { stroke: rgba(90,168,207,0.10); stroke-width: 1; }
.chart-label { fill: var(--faint); font-family: var(--mono); font-size: 9.5px; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 9px; }
.chart-key { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.chart-swatch { width: 11px; height: 3px; border-radius: 2px; }
.window-tabs { display: flex; gap: 3px; }
.window-tab {
  background: var(--ground-2); border: 1px solid var(--line); color: var(--muted);
  font-family: var(--mono); font-size: 11px; padding: 4px 9px; cursor: pointer; border-radius: var(--radius);
}
.window-tab[aria-pressed="true"] { background: var(--panel-3); color: var(--bone); border-color: var(--blueprint-dim); }

/* ---------- settings ---------- */
.setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 300px) auto;
  gap: 14px;
  align-items: center;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(38, 52, 63, 0.6);
}
.setting-row:last-child { border-bottom: 0; }
.setting-name { font-weight: 500; }
.setting-key { display: block; font-family: var(--mono); font-size: 11px; color: var(--faint); }
.setting-help { font-size: 12px; color: var(--muted); margin-top: 3px; max-width: 60ch; }
.setting-row.is-dirty { background: rgba(205, 98, 52, 0.06); }

/* ---------- countdown ---------- */
.countdown { display: flex; gap: 12px; align-items: baseline; }
.count-part { display: flex; flex-direction: column; align-items: center; }
.count-num { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 34px; line-height: 1; color: var(--bone); }
.count-unit { font-family: var(--display); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); margin-top: 3px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 9px; max-width: 380px; }
.toast {
  background: var(--panel-2);
  border: 1px solid var(--line-bright);
  border-left: 3px solid var(--blueprint);
  border-radius: var(--radius);
  padding: 11px 14px;
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: rise 0.18s ease-out;
}
.toast[data-tone="ok"]   { border-left-color: var(--live); }
.toast[data-tone="err"]  { border-left-color: var(--down); }
.toast[data-tone="warn"] { border-left-color: var(--warn); }
.toast-title { font-family: var(--display); font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 2px; }
.toast-body { color: var(--bone-2); overflow-wrap: anywhere; }
@keyframes rise { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(7, 11, 14, 0.76); display: grid; place-items: center; z-index: 300; padding: 20px; }
.modal-card {
  background: var(--panel);
  border: 1px solid var(--line-bright);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  padding: 22px;
  box-shadow: var(--shadow);
  max-height: 88vh;
  overflow-y: auto;
}
.modal-title { font-size: 20px; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 11px; }
.modal-body { color: var(--bone-2); font-size: 13.5px; }
.modal-body p { margin: 0 0 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.danger-note {
  background: rgba(191, 74, 65, 0.12);
  border-left: 2px solid var(--down);
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 13px;
}

/* ---------- misc ---------- */
.spinner {
  width: 13px; height: 13px;
  border: 2px solid var(--line-bright);
  border-top-color: var(--oxide);
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.row { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.row-end { margin-left: auto; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.inline-form { display: flex; gap: 9px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { margin-bottom: 0; flex: 1 1 150px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--muted); font-family: var(--display); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; }
.kv dd { margin: 0; font-family: var(--mono); overflow-wrap: anywhere; }
.hr { height: 1px; background: var(--line); border: 0; margin: 16px 0; }

/* ---------- player profile ---------- */
.profile-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.profile-avatar {
  width: 84px; height: 84px; flex: none;
  border: 1px solid var(--line-bright);
  border-radius: var(--radius);
  background: var(--ground-2);
  object-fit: cover;
}
.profile-avatar-blank {
  display: grid; place-items: center;
  font-family: var(--display); font-size: 30px; color: var(--faint);
}
.profile-name { font-family: var(--display); font-size: 24px; line-height: 1.1; text-transform: uppercase; letter-spacing: 0.02em; }
.profile-id { font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
.profile-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; margin: 16px 0; }
.pstat { background: var(--ground-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 11px; }
.pstat-label { display: block; font-family: var(--display); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--blueprint-dim); }
.pstat-value { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 19px; }
.chat-log { max-height: 190px; overflow-y: auto; background: #0b1116; border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 11px; }
.chat-row { display: flex; gap: 9px; font-family: var(--mono); font-size: 12px; line-height: 1.55; }
.chat-row-ts { color: #3f5462; flex: none; }
.chat-row-msg { color: #9ed6b0; overflow-wrap: anywhere; }
.tally { display: flex; flex-wrap: wrap; gap: 6px; }
.tally-item { font-family: var(--mono); font-size: 11px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 2px 8px; color: var(--bone-2); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .grid-wide { grid-template-columns: 1fr; }
  .vitals-spark { display: none; }
}
@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto var(--vitals-h) 1fr;
    grid-template-areas: "rail" "vitals" "stage";
  }
  .rail { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail-brand { border-bottom: 0; padding: 12px 16px; }
  .rail-nav { display: flex; overflow-x: auto; padding: 0; flex: 1 1 100%; border-top: 1px solid var(--line); }
  .rail-link { padding: 10px 14px; border-left: 0; border-bottom: 2px solid transparent; white-space: nowrap; }
  .rail-link[aria-current="page"] { border-left-color: transparent; border-bottom-color: var(--oxide); }
  .rail-link-index, .rail-badge { display: none; }
  .rail-foot { border-top: 0; padding: 8px 16px; }
  .stage { padding: 18px 14px 50px; }
  .files-layout { grid-template-columns: 1fr; }
  .setting-row { grid-template-columns: 1fr; }
  .vitals { gap: 16px; padding: 0 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
