/* National Highways Control — dashboard styles
   Visual idea: a motorway control room. The one loud element is the gantry sign
   (amber dot-matrix, like a variable message sign). Everything else stays calm. */

:root {
  --asphalt: #0A1621;
  --deck: #0F2030;
  --deck-hi: #15293D;
  --deck-lo: #0C1A27;
  --rule: #1F3A55;
  --rule-hi: #2C5073;
  --ink: #E7EEF5;
  --ink-dim: #8EA4B8;
  --ink-faint: #5E7489;
  --signal: #FFB000;
  --signal-glow: rgba(255, 176, 0, .55);
  --blue: #0078FF;
  --blue-soft: rgba(0, 120, 255, .16);
  --go: #64BF00;
  --stop: #E5322D;
  --warn: #FF8E01;

  --font-ui: 'Chakra Petch', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Instrument Sans', 'Segoe UI', system-ui, sans-serif;
  --font-matrix: 'Doto', 'Courier New', monospace;

  --r-panel: 14px;
  --r-field: 8px;
  --rail: 232px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(0, 120, 255, .12), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(255, 176, 0, .05), transparent 60%),
    var(--asphalt);
  color: var(--ink);
  font: 15px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: #6FB3FF; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3 { font-family: var(--font-ui); font-weight: 600; letter-spacing: .01em; margin: 0; }
h1 { font-size: 1.9rem; line-height: 1.15; }
h2 { font-size: 1.2rem; line-height: 1.25; }
h3 { font-size: 1rem; }
p { margin: 0; }
.dim { color: var(--ink-dim); }
.faint { color: var(--ink-faint); }
.small { font-size: .85rem; }

/* ───────── Splash / login / denied ───────── */

.splash, .gate {
  min-height: 100vh; display: grid; place-content: center; gap: 1.2rem; text-align: center; padding: 2rem;
}
.splash p { color: var(--ink-dim); }
.splash-sign {
  justify-self: center; font: 900 2.4rem var(--font-matrix); color: var(--signal);
  text-shadow: 0 0 12px var(--signal-glow); padding: .6rem 1.4rem; background: #040708; border-radius: 6px;
  border: 3px solid #26323B;
}
.gate { max-width: 560px; margin: 0 auto; }
.gate .gantry { margin-bottom: .6rem; }
.gate h1 { font-size: 1.6rem; }
.gate p { color: var(--ink-dim); }
.gate .btn { justify-self: center; }
.gate-user { display: flex; align-items: center; gap: .7rem; justify-content: center; }
.gate-user img { width: 36px; height: 36px; border-radius: 50%; }
.gate-note { font-size: .88rem; color: var(--ink-faint); }

/* ───────── Gantry sign ───────── */

.gantry {
  position: relative; display: flex; align-items: center; gap: 1.1rem;
  padding: .85rem 1.2rem; border-radius: 6px;
  background: #040708;
  border: 3px solid #2A3640;
  box-shadow: inset 0 0 0 1px #0D1418, 0 10px 30px rgba(0, 0, 0, .35);
  overflow: hidden;
}
.gantry::before { /* LED pixel grid */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1.2px);
  background-size: 4px 4px;
}
.gantry::after { /* mounting bolts */
  content: ''; position: absolute; top: 6px; left: 6px; right: 6px; height: 4px; pointer-events: none;
  background:
    radial-gradient(circle, #3B4852 1.6px, transparent 2px) left center / 8px 4px no-repeat,
    radial-gradient(circle, #3B4852 1.6px, transparent 2px) right center / 8px 4px no-repeat;
}
.roundel {
  flex: none; width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center;
  border: 6px solid var(--stop);
  box-shadow: 0 0 14px rgba(229, 50, 45, .45);
  font: 900 1.45rem/1 var(--font-matrix); color: #F4F6F8;
  text-shadow: 0 0 8px rgba(255, 255, 255, .5);
}
.roundel.clear { border-color: #2A3640; box-shadow: none; color: #53606A; text-shadow: none; }
.matrix {
  flex: 1; min-width: 0;
  font: 900 clamp(1.05rem, 2.4vw, 1.7rem)/1.1 var(--font-matrix);
  color: var(--signal); text-shadow: 0 0 10px var(--signal-glow);
  letter-spacing: .06em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.matrix .line2 { display: block; font-size: .62em; opacity: .85; margin-top: .25rem; }
.matrix.flick { animation: flick .45s steps(4) both; }
@keyframes flick { 0% { opacity: 0; } 30% { opacity: .9; } 45% { opacity: .15; } 100% { opacity: 1; } }
.matrix.boot { animation: boot 1.4s steps(12) both; }
@keyframes boot { 0% { opacity: 0; clip-path: inset(0 100% 0 0); } 60% { opacity: 1; } 100% { clip-path: inset(0 0 0 0); } }
.gantry-clock {
  flex: none; font: 700 1.25rem/1 var(--font-matrix); color: var(--signal); opacity: .8;
  text-shadow: 0 0 8px var(--signal-glow); letter-spacing: .08em;
}
.lanes { flex: none; display: flex; gap: 6px; }
.lane {
  width: 26px; height: 26px; border-radius: 3px; display: grid; place-items: center;
  font: 900 .9rem/1 var(--font-matrix); color: var(--go); text-shadow: 0 0 6px rgba(100, 191, 0, .6);
  background: #070B0D;
}
.lane svg { width: 16px; height: 16px; }
.lane.bad { color: var(--stop); text-shadow: 0 0 6px rgba(229, 50, 45, .6); }
.lane.warn { color: var(--signal); text-shadow: 0 0 6px var(--signal-glow); }

/* ───────── App shell ───────── */

.shell { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1.2rem;
  padding: 1.2rem .9rem; background: var(--deck-lo); border-right: 1px solid var(--rule);
}
.rail::after { /* lane marking */
  content: ''; position: absolute; top: 0; bottom: 0; right: -2px; width: 3px; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(231, 238, 245, .12) 0 22px, transparent 22px 44px);
}
.brand { display: flex; align-items: center; gap: .7rem; padding: .2rem .4rem; }
.brand img { width: 38px; height: 38px; border-radius: 9px; background: var(--deck); object-fit: contain; }
.brand b { display: block; font: 600 1rem/1.15 var(--font-ui); }
.brand span { font-size: .8rem; color: var(--ink-dim); }
.nav { display: grid; gap: 2px; }
.nav button {
  display: flex; align-items: center; gap: .75rem; width: 100%; padding: .62rem .75rem;
  background: none; border: 0; border-radius: 9px; cursor: pointer; text-align: left;
  font: 500 .95rem var(--font-ui); color: var(--ink-dim);
  transition: background .15s, color .15s;
}
.nav button svg { width: 19px; height: 19px; flex: none; }
.nav button:hover { background: var(--deck); color: var(--ink); }
.nav button[aria-current="page"] { background: var(--blue-soft); color: var(--ink); box-shadow: inset 3px 0 0 var(--blue); }
.rail-foot { margin-top: auto; display: grid; gap: .6rem; }
.me { display: flex; align-items: center; gap: .6rem; padding: .55rem; border-radius: 10px; background: var(--deck); }
.me img { width: 34px; height: 34px; border-radius: 50%; }
.me b { display: block; font: 600 .9rem/1.2 var(--font-ui); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me span { font-size: .75rem; color: var(--ink-dim); }
.me > div { min-width: 0; flex: 1; }

.main { min-width: 0; padding: 1.2rem clamp(1rem, 3vw, 2.4rem) 4rem; }
.topbar { position: sticky; top: 0; z-index: 5; padding: .2rem 0 1rem; background: linear-gradient(var(--asphalt) 80%, transparent); }
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; margin: .6rem 0 1.4rem; }
.page-head p { color: var(--ink-dim); margin-top: .35rem; max-width: 62ch; }
.btn.menu-btn { display: none; }

/* ───────── Panels & layout ───────── */

.grid { display: grid; gap: 1.1rem; }
.cols-2 { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); }
.cols-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel {
  background: var(--deck); border: 1px solid var(--rule); border-radius: var(--r-panel);
  padding: 1.15rem 1.2rem;
}
.panel > header { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .9rem; }
.panel > header p { font-size: .88rem; color: var(--ink-dim); }
.panel.sticky { position: sticky; top: 118px; }
.stack { display: grid; gap: .9rem; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.empty { padding: 1.4rem 1rem; text-align: center; color: var(--ink-dim); border: 1px dashed var(--rule); border-radius: 10px; }

/* Readouts */
.readouts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--r-panel); overflow: hidden; margin-bottom: 1.1rem; }
.readout { background: var(--deck); padding: .95rem 1.1rem; }
.readout b { display: block; font: 700 1.7rem/1.1 var(--font-ui); }
.readout span { font-size: .85rem; color: var(--ink-dim); }
.readout.live b { color: var(--go); }
.readout.alert b { color: var(--signal); }

.quick { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1.1rem; }

/* ───────── Buttons ───────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .6rem 1rem; border-radius: 9px; border: 1px solid var(--rule-hi);
  background: var(--deck-hi); color: var(--ink); cursor: pointer; text-decoration: none;
  font: 600 .92rem/1.1 var(--font-ui); letter-spacing: .01em;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: #1B3450; border-color: #3A6590; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: #1A88FF; }
.btn.go { background: rgba(100, 191, 0, .16); border-color: rgba(100, 191, 0, .45); color: #B4EC7A; }
.btn.danger { background: rgba(229, 50, 45, .12); border-color: rgba(229, 50, 45, .45); color: #FF9D99; }
.btn.ghost { background: none; border-color: transparent; color: var(--ink-dim); }
.btn.ghost:hover { background: var(--deck-hi); color: var(--ink); }
.btn.sm { padding: .42rem .7rem; font-size: .84rem; border-radius: 7px; }
.btn.discord { background: #5865F2; border-color: #5865F2; color: #fff; padding: .8rem 1.3rem; font-size: 1rem; }
.btn.discord:hover { background: #6C77F4; }
.btn.busy { pointer-events: none; opacity: .7; }
.btn.busy::after { content: ''; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────── Forms ───────── */

.field { display: grid; gap: .35rem; align-content: start; }
.field > label, .field > .label { font: 600 .86rem var(--font-ui); color: var(--ink); }
.field .hint { font-size: .8rem; color: var(--ink-faint); }
.field .hint.bad { color: #FF9D99; }
.field .hint.good { color: #B4EC7A; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.triple { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; }

input[type=text], input[type=number], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: .6rem .75rem; border-radius: var(--r-field);
  background: var(--deck-lo); border: 1px solid var(--rule); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
input:disabled, select:disabled, textarea:disabled { opacity: .55; }
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
textarea.tall { min-height: 200px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-dim) 50%), linear-gradient(135deg, var(--ink-dim) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2rem; }
select option, select optgroup { background: var(--deck); }

.colour-input { display: flex; gap: .5rem; }
.colour-input input[type=color] { width: 46px; height: 40px; padding: 3px; border-radius: var(--r-field); border: 1px solid var(--rule); background: var(--deck-lo); cursor: pointer; }
.colour-input input[type=text] { font-family: var(--font-ui); text-transform: uppercase; }

.counter { font-size: .78rem; color: var(--ink-faint); justify-self: end; }
.counter.over { color: #FF9D99; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  display: inline-flex; align-items: center; gap: .35rem; padding: .28rem .6rem; border-radius: 999px;
  background: var(--deck-hi); border: 1px solid var(--rule); font-size: .82rem; cursor: pointer; color: var(--ink-dim);
}
.chip:hover { color: var(--ink); border-color: var(--rule-hi); }
.chip.code { font-family: var(--font-ui); }

.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--deck-lo); border: 1px solid var(--rule); }
.seg button { border: 0; background: none; padding: .45rem .9rem; border-radius: 7px; cursor: pointer; font: 600 .88rem var(--font-ui); color: var(--ink-dim); }
.seg button[aria-pressed="true"] { background: var(--deck-hi); color: var(--ink); box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset; }
.seg button:disabled { opacity: .4; cursor: not-allowed; }

.switch { display: flex; align-items: center; gap: .7rem; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { width: 40px; height: 22px; border-radius: 999px; background: var(--deck-lo); border: 1px solid var(--rule-hi); position: relative; flex: none; transition: background .15s; }
.switch i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-dim); transition: transform .18s var(--ease), background .15s; }
.switch input:checked + i { background: var(--blue); border-color: var(--blue); }
.switch input:checked + i::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + i { outline: 2px solid var(--signal); outline-offset: 2px; }
.switch span { font-size: .9rem; }

.dest { display: flex; align-items: center; gap: .5rem; font-size: .88rem; color: var(--ink-dim); padding: .55rem .75rem; border-radius: var(--r-field); background: var(--deck-lo); border: 1px dashed var(--rule); }
.dest b { color: var(--ink); font-weight: 600; }

/* Preset tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.tile {
  position: relative; display: flex; align-items: center; gap: .55rem; padding: .6rem .7rem .6rem .85rem;
  border-radius: 9px; background: var(--deck-lo); border: 1px solid var(--rule); cursor: pointer;
  font-size: .86rem; text-align: left; line-height: 1.25;
}
.tile::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--c, var(--blue)); }
.tile:hover { border-color: var(--rule-hi); }
.tile[aria-pressed="true"] { border-color: var(--c, var(--blue)); background: var(--deck-hi); }
.tile .em { font-size: 1.1rem; }

/* Role picker */
.picker { position: relative; }
.picker-box { display: flex; flex-wrap: wrap; gap: .35rem; padding: .4rem; min-height: 44px; border-radius: var(--r-field); background: var(--deck-lo); border: 1px solid var(--rule); }
.picker-box:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.picker-box input { flex: 1; min-width: 120px; border: 0; background: none; padding: .3rem .4rem; box-shadow: none; }
.picker-box input:focus { box-shadow: none; }
.role-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .22rem .3rem .22rem .55rem; border-radius: 999px; background: var(--deck-hi); border: 1px solid var(--rule-hi); font-size: .84rem; }
.role-chip button { border: 0; background: none; color: var(--ink-dim); cursor: pointer; padding: 0 .3rem; font-size: 1rem; line-height: 1; }
.role-chip button:hover { color: var(--stop); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-faint); flex: none; }
.picker-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); max-height: 260px; overflow: auto; padding: .3rem; border-radius: 10px; background: var(--deck-hi); border: 1px solid var(--rule-hi); box-shadow: 0 16px 40px rgba(0, 0, 0, .45); }
.picker-list button { display: flex; align-items: center; gap: .55rem; width: 100%; padding: .45rem .55rem; border: 0; border-radius: 7px; background: none; cursor: pointer; text-align: left; font-size: .9rem; }
.picker-list button:hover, .picker-list button.hl { background: var(--blue-soft); }
.picker-list .none { padding: .55rem; color: var(--ink-faint); font-size: .88rem; }

/* ───────── Session & road cards ───────── */

.cards { display: grid; gap: .6rem; }
.card { display: grid; gap: .55rem; padding: .85rem 1rem; border-radius: 11px; background: var(--deck-lo); border: 1px solid var(--rule); }
.card-top { display: flex; align-items: flex-start; gap: .7rem; }
.card-title { font: 600 1rem/1.3 var(--font-ui); }
.card-meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .86rem; color: var(--ink-dim); }
.card-meta b { color: var(--ink); font-weight: 600; }
.card-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.card.closed { opacity: .62; }
.pill { display: inline-flex; align-items: center; gap: .35rem; padding: .18rem .55rem; border-radius: 999px; font: 600 .76rem/1.4 var(--font-ui); white-space: nowrap; background: var(--deck-hi); color: var(--ink-dim); border: 1px solid var(--rule); }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.scheduled { color: var(--signal); border-color: rgba(255, 176, 0, .35); }
.pill.started { color: var(--go); border-color: rgba(100, 191, 0, .4); }
.pill.started::before { animation: pulse 1.6s ease-in-out infinite; }
.pill.cancelled { color: #FF9D99; border-color: rgba(229, 50, 45, .35); }
.pill.cleared { color: var(--go); border-color: rgba(100, 191, 0, .35); }
.pill.open { color: var(--signal); border-color: rgba(255, 176, 0, .35); }
@keyframes pulse { 50% { opacity: .3; } }
.bar { height: 5px; border-radius: 999px; background: var(--deck-hi); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--blue); border-radius: inherit; }
.road-em { font-size: 1.35rem; line-height: 1; margin-top: .1rem; }
.edge { border-left: 3px solid var(--c, var(--rule)); }

.feed { display: grid; gap: 0; }
.feed li { display: grid; grid-template-columns: auto 1fr; gap: .15rem .8rem; padding: .6rem 0; border-top: 1px solid var(--rule); font-size: .9rem; }
.feed li:first-child { border-top: 0; }
.feed time { color: var(--ink-faint); font-size: .8rem; white-space: nowrap; }
.feed .d { grid-column: 2; color: var(--ink-dim); font-size: .84rem; }
ul.feed { list-style: none; margin: 0; padding: 0; }

/* ───────── Config tabs ───────── */

.tabs { display: flex; gap: .3rem; overflow-x: auto; padding-bottom: .2rem; margin-bottom: 1.1rem; border-bottom: 1px solid var(--rule); }
.tabs button { flex: none; border: 0; background: none; padding: .6rem .85rem; cursor: pointer; font: 600 .9rem var(--font-ui); color: var(--ink-dim); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--signal); }
.preset-list { display: grid; gap: .3rem; align-content: start; }
.preset-list button { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border-radius: 9px; border: 1px solid transparent; background: none; cursor: pointer; text-align: left; font-size: .9rem; color: var(--ink-dim); }
.preset-list button:hover { background: var(--deck-hi); color: var(--ink); }
.preset-list svg { width: 18px; height: 18px; flex: none; }
.preset-list button[aria-current="true"] { background: var(--deck-hi); border-color: var(--rule-hi); color: var(--ink); }
.cols-presets { grid-template-columns: 230px minmax(0, 1fr) minmax(0, .9fr); }
.level-list { display: grid; gap: .9rem; }
.level-note { font-size: .82rem; color: var(--ink-faint); }

/* ───────── Discord embed preview ───────── */

.preview-wrap { background: #313338; border-radius: 10px; padding: 1rem; font-family: 'gg sans', 'Noto Sans', 'Helvetica Neue', Arial, sans-serif; color: #DBDEE1; font-size: 15px; line-height: 1.375; }
.preview-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; font: 600 .82rem var(--font-ui); color: var(--ink-dim); }
.dc-msg { display: grid; grid-template-columns: 40px 1fr; gap: 0 16px; }
.dc-av { width: 40px; height: 40px; border-radius: 50%; }
.dc-head { display: flex; align-items: center; gap: .4rem; font-size: 1rem; }
.dc-head b { color: #F2F3F5; font-weight: 500; }
.dc-app { background: #5865F2; color: #fff; font-size: .62rem; font-weight: 600; padding: 1px 5px; border-radius: 3px; }
.dc-time { color: #949BA4; font-size: .75rem; }
.dc-content { white-space: pre-wrap; word-wrap: break-word; }
.dc-embed { margin-top: 6px; max-width: 520px; display: grid; background: #2B2D31; border-radius: 4px; border-left: 4px solid #1E1F22; padding: .5rem 1rem 1rem .75rem; gap: 8px; }
.dc-author { display: flex; align-items: center; gap: 8px; font-size: .875rem; font-weight: 600; color: #F2F3F5; margin-top: 8px; }
.dc-author img { width: 24px; height: 24px; border-radius: 50%; object-fit: contain; }
.dc-title { font-weight: 600; color: #F2F3F5; font-size: 1rem; }
.dc-desc { font-size: .875rem; white-space: pre-wrap; word-wrap: break-word; }
.dc-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.dc-field { font-size: .875rem; min-width: 0; }
.dc-field.full { grid-column: 1 / -1; }
.dc-field > b { display: block; color: #F2F3F5; font-weight: 600; margin-bottom: 2px; }
.dc-field div { white-space: pre-wrap; word-wrap: break-word; }
.dc-image { border-radius: 4px; max-height: 300px; object-fit: contain; justify-self: start; }
.dc-footer { display: flex; align-items: center; gap: 8px; font-size: .75rem; color: #B5BAC1; }
.dc-footer img { width: 20px; height: 20px; border-radius: 50%; object-fit: contain; }
.dc-buttons { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.dc-btn { padding: 2px 16px; min-height: 32px; display: inline-flex; align-items: center; gap: 6px; border-radius: 3px; font-size: .875rem; font-weight: 500; color: #fff; background: #4E5058; }
.dc-btn.success { background: #248046; }
.dc-mention { background: rgba(88, 101, 242, .3); color: #C9CDFB; border-radius: 3px; padding: 0 2px; font-weight: 500; }
.dc-code { background: #1E1F22; border-radius: 3px; padding: 0 .2em; font-size: 85%; font-family: Consolas, monospace; }
.dc-quote { display: block; border-left: 4px solid #4E5058; padding-left: 12px; }
.dc-sub { display: block; font-size: .78rem; color: #949BA4; }
.dc-ts { background: rgba(255, 255, 255, .06); border-radius: 3px; padding: 0 2px; }

/* ───────── Dialog & toasts ───────── */

dialog {
  width: min(560px, calc(100vw - 2rem)); padding: 0; border: 1px solid var(--rule-hi); border-radius: 16px;
  background: var(--deck); color: var(--ink); box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
}
dialog::backdrop { background: rgba(3, 8, 12, .7); backdrop-filter: blur(3px); }
dialog[open] { animation: rise .22s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.dlg-body { padding: 1.3rem 1.3rem 1rem; display: grid; gap: .9rem; }
.dlg-body > p { color: var(--ink-dim); }
.dlg-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: .9rem 1.3rem 1.2rem; }

.toasts { position: fixed; z-index: 100; right: 1rem; bottom: 1rem; display: grid; gap: .5rem; width: min(400px, calc(100vw - 2rem)); }
.toast {
  display: flex; gap: .7rem; align-items: flex-start; padding: .8rem 1rem; border-radius: 11px;
  background: var(--deck-hi); border: 1px solid var(--rule-hi); box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
  font-size: .92rem; animation: rise .25s var(--ease);
}
.toast::before { content: ''; flex: none; width: 4px; align-self: stretch; border-radius: 4px; background: var(--go); }
.toast.bad::before { background: var(--stop); }
.toast a { white-space: nowrap; }
.toast.out { opacity: 0; transform: translateY(6px); transition: .25s; }

.noscript { padding: 2rem; text-align: center; }

/* ───────── Responsive ───────── */

@media (max-width: 1280px) {
  .cols-presets { grid-template-columns: 210px minmax(0, 1fr); }
  .cols-presets > :last-child { grid-column: 2; }
}
@media (max-width: 1100px) {
  .cols-2, .cols-even { grid-template-columns: 1fr; }
  .panel.sticky { position: static; }
  .readouts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; z-index: 50; inset: 0 auto 0 0; width: min(280px, 84vw); transform: translateX(-105%); transition: transform .25s var(--ease); box-shadow: 20px 0 60px rgba(0, 0, 0, .5); }
  .rail.open { transform: none; }
  .rail::after { display: none; }
  .btn.menu-btn { display: inline-flex; flex: none; }
  .topbar { display: flex; gap: .6rem; align-items: center; }
  .topbar .gantry { flex: 1; min-width: 0; }
  .lanes, .gantry-clock { display: none; }
  .cols-presets { grid-template-columns: 1fr; }
  .cols-presets > :last-child { grid-column: auto; }
  .pair, .triple { grid-template-columns: 1fr; }
  .dc-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: 1.5rem; }
  .roundel { width: 46px; height: 46px; border-width: 5px; font-size: 1.1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
