/* Badlands Command - admin panel. Dusk-slate base, sand type, amber signal accent; red is reserved for danger/admin. */
:root {
  --bg: #19212B;
  --bg-deep: #141A22;
  --panel: #202A36;
  --panel-2: #26323F;
  --line: #334252;
  --line-soft: #2A3644;
  --sand: #E9DDC8;
  --text: #D8D2C6;
  --muted: #94A0AE;
  --faint: #6B7887;
  --amber: #F2A541;
  --amber-ink: #2A1B05;
  --amber-soft: rgba(242, 165, 65, .14);
  --red: #E5484D;
  --red-soft: rgba(229, 72, 77, .14);
  --green: #4CC38A;
  --green-soft: rgba(76, 195, 138, .13);
  --cyan: #5BB6D6;
  --cyan-soft: rgba(91, 182, 214, .13);
  --violet: #A68BEF;
  --radius-s: 4px;
  --radius: 8px;
  --radius-l: 14px;
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: 'Barlow', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --rail: 232px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
a { color: var(--amber); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
::selection { background: var(--amber); color: var(--amber-ink); }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); font-family: var(--display); font-size: 20px; letter-spacing: .02em; }

h1, h2, h3 { font-family: var(--display); color: var(--sand); margin: 0; font-weight: 600; letter-spacing: .01em; }
h1 { font-size: 34px; line-height: 1.1; }
h2 { font-size: 22px; line-height: 1.2; }
h3 { font-size: 17px; line-height: 1.25; }
.num, td.num, .tab { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.red { color: var(--red); } .green { color: var(--green); } .amber { color: var(--amber); } .cyan { color: var(--cyan); }

/* ------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail { background: var(--bg-deep); border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 18px 14px; }
.brand svg { flex: none; }
.brand b { font-family: var(--display); font-size: 21px; color: var(--sand); font-weight: 700; line-height: 1; display: block; }
.brand span { font-size: 12px; color: var(--faint); }
.nav { padding: 4px 10px 14px; display: flex; flex-direction: column; gap: 1px; }
.nav .group { font-size: 12px; color: var(--faint); padding: 14px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-s); color: var(--text); font-size: 14.5px; }
.nav a:hover { background: var(--panel); text-decoration: none; }
.nav a.on { background: var(--panel-2); color: var(--sand); box-shadow: inset 3px 0 0 var(--amber); }
.nav a svg { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.nav .count { margin-left: auto; background: var(--red); color: #fff; font-size: 11.5px; font-weight: 600; border-radius: 10px; padding: 0 7px; line-height: 18px; }
.rail-foot { margin-top: auto; padding: 12px 18px 16px; border-top: 1px solid var(--line-soft); font-size: 13px; }
.rail-foot .who { color: var(--sand); font-weight: 600; }
.rail-foot .role { color: var(--muted); }
.rail-foot .links { display: flex; gap: 14px; margin-top: 6px; }
.rail-foot button { background: none; border: 0; padding: 0; color: var(--amber); cursor: pointer; }

.main { min-width: 0; display: flex; flex-direction: column; }
.strip { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; padding: 10px 28px; background: rgba(25, 33, 43, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.strip .menu { display: none; background: none; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 4px 8px; cursor: pointer; }
.strip .item { display: flex; align-items: center; gap: 7px; white-space: nowrap; color: var(--muted); }
.strip .item b { color: var(--sand); font-weight: 600; }
.strip .spacer { flex: 1; }
.page { padding: 26px 28px 60px; max-width: 1500px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* status light */
.light { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.light.online { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.light.booting { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); animation: blink 1.2s infinite; }
.light.stopped, .light.unresponsive { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
@keyframes blink { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .light.booting { animation: none; } }

/* ------------------------------------------------------------- building blocks */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-dash { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.box { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.box > h2, .box > h3 { margin-bottom: 12px; }
.box-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.box-head h2, .box-head h3 { margin: 0; }
.box-head .r { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.flat { background: none; border: 0; padding: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.stack > * { min-width: 0; }
.sep { height: 1px; background: var(--line-soft); margin: 14px 0; }
.empty { color: var(--muted); padding: 22px 0; text-align: center; }
.notice { border-left: 3px solid var(--amber); background: var(--amber-soft); padding: 10px 14px; border-radius: 0 var(--radius-s) var(--radius-s) 0; margin-bottom: 16px; color: var(--sand); }
.notice.red { border-color: var(--red); background: var(--red-soft); }
.notice.cyan { border-color: var(--cyan); background: var(--cyan-soft); }

.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--panel-2); color: var(--sand); border-radius: var(--radius-s); padding: 7px 13px; cursor: pointer; font-weight: 500; font-size: 14px; line-height: 1.25; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: #F7B865; }
.btn.danger { background: transparent; border-color: rgba(229, 72, 77, .6); color: #F48B8E; }
.btn.danger:hover:not(:disabled) { background: var(--red-soft); border-color: var(--red); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 4px 9px; font-size: 13px; }
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

label.f { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
input.i, select.i, textarea.i { background: var(--bg-deep); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 7px 10px; color: var(--sand); font-size: 14.5px; min-width: 0; }
input.i:focus, select.i:focus, textarea.i:focus { border-color: var(--amber); outline: none; box-shadow: 0 0 0 3px var(--amber-soft); }
.row > div > .i, .row > div > select.i { width: 100%; }
textarea.i { resize: vertical; min-height: 80px; line-height: 1.45; }
textarea.code { font-family: var(--mono); font-size: 12.5px; line-height: 1.55; white-space: pre; tab-size: 4; min-height: 60vh; width: 100%; }
.check { display: inline-flex; gap: 7px; align-items: center; font-size: 14px; cursor: pointer; }
.check input { accent-color: var(--amber); }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 20px; font-size: 12.5px; font-weight: 500; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.green { color: var(--green); border-color: rgba(76, 195, 138, .45); background: var(--green-soft); }
.chip.red { color: #F48B8E; border-color: rgba(229, 72, 77, .5); background: var(--red-soft); }
.chip.amber { color: var(--amber); border-color: rgba(242, 165, 65, .45); background: var(--amber-soft); }
.chip.cyan { color: var(--cyan); border-color: rgba(91, 182, 214, .45); background: var(--cyan-soft); }

/* tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--panel); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); position: sticky; top: 0; white-space: nowrap; }
table.t td { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: rgba(255, 255, 255, .025); }
table.t td.num, table.t th.num { text-align: right; }
table.t td.nowrap { white-space: nowrap; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 8px 14px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tabs button.on { color: var(--sand); border-color: var(--amber); }

/* ------------------------------------------------------------- dashboard */
.hero { display: grid; grid-template-columns: auto 1fr; gap: 6px 28px; align-items: center; padding: 22px 24px; background: linear-gradient(115deg, var(--panel) 40%, var(--panel-2)); border: 1px solid var(--line-soft); border-radius: var(--radius-l); margin-bottom: 16px; position: relative; overflow: hidden; }
.hero .phase { font-family: var(--display); font-size: 52px; line-height: 1; font-weight: 700; color: var(--sand); display: flex; align-items: center; gap: 14px; }
.hero .phase .light { width: 14px; height: 14px; }
.hero .facts { display: flex; gap: 34px; flex-wrap: wrap; justify-self: end; }
.hero .fact b { display: block; font-family: var(--display); font-size: 30px; line-height: 1.05; color: var(--sand); font-weight: 600; font-variant-numeric: tabular-nums; }
.hero .fact span { font-size: 13px; color: var(--muted); }
.hero .sub { grid-column: 1 / -1; color: var(--muted); font-size: 14px; }

.meter { margin-bottom: 12px; }
.meter .top { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 4px; }
.meter .top b { color: var(--sand); font-weight: 500; font-variant-numeric: tabular-nums; }
.meter .bar { height: 6px; background: var(--bg-deep); border-radius: 3px; overflow: hidden; }
.meter .bar i { display: block; height: 100%; background: var(--cyan); border-radius: 3px; transition: width .6s ease; }
.meter .bar i.warn { background: var(--amber); }
.meter .bar i.bad { background: var(--red); }

.feed { list-style: none; margin: 0; padding: 0; max-height: 430px; overflow-y: auto; font-size: 13.5px; }
.feed li { display: grid; grid-template-columns: 44px 62px 1fr; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line-soft); }
.feed li:last-child { border: 0; }
.feed .k { font-size: 12px; color: var(--faint); }
.feed time { color: var(--faint); font-variant-numeric: tabular-nums; }
.k-death, .k-pvp, .k-hit { color: #F48B8E !important; }
.k-admin { color: var(--violet) !important; }
.k-connect { color: var(--green) !important; }
.k-disconnect { color: var(--muted) !important; }
.k-report { color: var(--amber) !important; }
.k-buy, .k-sell { color: var(--cyan) !important; }
.flash { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: var(--amber-soft); } to { background: transparent; } }

.report-item { display: block; padding: 9px 0; border-bottom: 1px solid var(--line-soft); color: var(--text); }
.report-item:last-child { border: 0; }
.report-item:hover { text-decoration: none; color: var(--sand); }
.report-item .meta { font-size: 12.5px; color: var(--muted); }

/* ------------------------------------------------------------- map */
.map-wrap { position: relative; height: calc(100vh - 160px); min-height: 420px; border-radius: var(--radius-l); overflow: hidden; border: 1px solid var(--line-soft); background: #1C2630; touch-action: none; }
.map-wrap.mini { height: 340px; min-height: 0; }
.map-wrap canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.map-wrap canvas.drag { cursor: grabbing; }
.map-ui { position: absolute; top: 12px; right: 12px; align-items: flex-end; display: flex; flex-direction: column; gap: 8px; z-index: 2; }
.map-layers { background: rgba(20, 26, 34, .88); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.map-zoom { display: flex; gap: 4px; }
.map-tip { position: absolute; z-index: 3; background: rgba(20, 26, 34, .96); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; font-size: 13.5px; min-width: 200px; max-width: 280px; pointer-events: auto; box-shadow: 0 12px 30px rgba(0, 0, 0, .35); }
.map-tip h3 { margin-bottom: 4px; }
.map-coords { position: absolute; right: 12px; bottom: 10px; z-index: 2; font-family: var(--mono); font-size: 12px; color: var(--muted); background: rgba(20, 26, 34, .8); padding: 3px 8px; border-radius: var(--radius-s); }
.map-legend { position: absolute; left: 12px; bottom: 10px; z-index: 2; display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); background: rgba(20, 26, 34, .8); padding: 4px 10px; border-radius: var(--radius-s); }
.map-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }

/* ------------------------------------------------------------- player / reports */
.player-head { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px; }
.player-head .facts { display: flex; gap: 26px; flex-wrap: wrap; margin-top: 10px; }
.player-head .facts div b { display: block; font-family: var(--display); font-size: 22px; color: var(--sand); font-weight: 600; font-variant-numeric: tabular-nums; }
.player-head .facts div span { font-size: 12.5px; color: var(--muted); }
.actionbar { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); margin-bottom: 18px; }
.actionbar .split { width: 1px; background: var(--line); margin: 0 4px; }

.items { list-style: none; margin: 0; padding: 0 0 0 2px; font-size: 13.5px; }
.items ul { list-style: none; margin: 0; padding-left: 18px; border-left: 1px dashed var(--line); }
.items li { padding: 2px 0; }
.items .slot { color: var(--faint); font-size: 12px; margin-left: 6px; }
.items .hp-bad { color: #F48B8E; }

.split-view { display: grid; grid-template-columns: minmax(280px, 400px) 1fr; gap: 16px; align-items: start; }
.list-pick { display: flex; flex-direction: column; border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; background: var(--panel); max-height: calc(100vh - 210px); overflow-y: auto; }
.list-pick button { text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line-soft); padding: 10px 14px; cursor: pointer; color: var(--text); }
.list-pick button:hover { background: rgba(255, 255, 255, .03); }
.list-pick button.on { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--amber); }
.list-pick .t1 { display: flex; gap: 8px; align-items: center; color: var(--sand); font-weight: 500; }
.list-pick .t2 { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.msg { background: var(--bg-deep); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 10px 12px; max-width: 640px; }
.msg.admin { align-self: flex-end; border-color: rgba(229, 72, 77, .35); }
.msg .from { font-size: 12.5px; color: var(--muted); margin-bottom: 3px; }
.msg.admin .from { color: #F48B8E; }
.msg p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* events */
.sys { display: flex; flex-direction: column; gap: 10px; }
.sys .top { display: flex; gap: 10px; align-items: center; }
.sys .status { color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.switch { position: relative; width: 40px; height: 22px; flex: none; margin-left: auto; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; position: absolute; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--bg-deep); border: 1px solid var(--line); border-radius: 12px; transition: background .2s; }
.switch span::after { content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: var(--muted); border-radius: 50%; transition: transform .2s, background .2s; }
.switch input:checked + span { background: var(--green-soft); border-color: rgba(76, 195, 138, .6); }
.switch input:checked + span::after { transform: translateX(18px); background: var(--green); }
.switch input:focus-visible + span { outline: 2px solid var(--amber); outline-offset: 2px; }
.switch input:disabled { cursor: not-allowed; }

/* logs */
.logview { background: var(--bg-deep); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 12px 14px; font-family: var(--mono); font-size: 12.3px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; height: calc(100vh - 250px); min-height: 300px; overflow-y: auto; color: #C7CCD3; }
.logview .e { color: #F48B8E; }
.logview .w { color: var(--amber); }
.logview mark { background: var(--amber); color: var(--amber-ink); border-radius: 2px; }
.diff { background: var(--bg-deep); border: 1px solid var(--line-soft); border-radius: var(--radius); font-family: var(--mono); font-size: 12.3px; line-height: 1.5; max-height: 50vh; overflow: auto; padding: 8px 0; }
.diff div { padding: 0 12px; white-space: pre; }
.diff .a { background: rgba(76, 195, 138, .12); color: #9FE3BF; }
.diff .d { background: rgba(229, 72, 77, .12); color: #F4A3A5; }
.diff .h { color: var(--faint); font-style: italic; }

/* ------------------------------------------------------------- modal / toast */
.modal-back { position: fixed; inset: 0; background: rgba(8, 11, 15, .66); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .15s ease-out; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 22px; width: min(520px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.modal.wide { width: min(880px, 100%); }
.modal h2 { margin-bottom: 6px; }
.modal .lead { color: var(--muted); margin: 0 0 16px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
@keyframes fade { from { opacity: 0; } }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--green); border-radius: var(--radius); padding: 10px 14px; box-shadow: 0 12px 30px rgba(0, 0, 0, .4); font-size: 14px; color: var(--sand); animation: fade .2s ease-out; overflow-wrap: anywhere; }
.toast.bad { border-left-color: var(--red); }

/* ------------------------------------------------------------- login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login .art { position: relative; overflow: hidden; background: var(--bg-deep); display: flex; flex-direction: column; justify-content: flex-end; padding: 48px; }
.login .art canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.login .art .words { position: relative; }
.login .art h1 { font-size: clamp(44px, 6vw, 76px); line-height: .95; font-weight: 700; max-width: 9ch; }
.login .art p { color: var(--muted); max-width: 40ch; margin: 14px 0 0; }
.login .form-side { display: grid; place-items: center; padding: 32px 20px; }
.login form { width: min(360px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login form h2 { font-size: 28px; }
.login .err { color: #F48B8E; font-size: 14px; min-height: 1.4em; }

/* ------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .g-dash, .g3 { grid-template-columns: minmax(0, 1fr); }
  .split-view { grid-template-columns: 1fr; }
  .list-pick { max-height: 340px; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; z-index: 50; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; box-shadow: 20px 0 60px rgba(0, 0, 0, .5); }
  .shell.nav-open .rail { transform: none; }
  .strip { padding: 10px 16px; gap: 12px; overflow-x: auto; }
  .strip .menu { display: block; }
  .page { padding: 20px 16px 50px; }
  .g2 { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-columns: 1fr; padding: 18px; }
  .hero .facts { justify-self: start; gap: 22px; }
  .hero .phase { font-size: 40px; }
  .login { grid-template-columns: 1fr; }
  .login .art { min-height: 220px; padding: 28px 20px; }
  .map-wrap { height: calc(100vh - 140px); }
  .strip .hide-s { display: none; }
}

/* ================================================================ motion
   One entrance sequence per page (sections rise in, staggered), numbers count up, meters fill,
   live items slide in, dialogs scale in. Everything is off with "reduce motion". */
:root { --ease-out: cubic-bezier(.16, 1, .3, 1); --ease-io: cubic-bezier(.65, 0, .35, 1); }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes slidein-r { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes slideout-r { to { opacity: 0; transform: translateX(28px); } }
@keyframes slidein-t { from { opacity: 0; transform: translateY(-8px); max-height: 0; } to { opacity: 1; transform: none; max-height: 120px; } }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 3px var(--green-soft); } 50% { box-shadow: 0 0 0 7px rgba(76, 195, 138, .05); } }
@keyframes shimmer { from { background-position: -400px 0; } to { background-position: 400px 0; } }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(400%); } }

/* page entrance: direct children of the page rise in one after another (set by JS: --i) */
.page.enter > * { animation: rise .55s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 70ms); }
.page.enter .grid > *, .page.enter .stack > .box { animation: rise .55s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 70ms + 120ms); }
.page.leave { opacity: 0; transform: translateY(6px); transition: opacity .14s ease, transform .14s ease; }

/* table rows cascade in */
.page.enter table.t tbody tr { animation: fadein .4s ease both; animation-delay: calc(min(var(--r, 0), 20) * 22ms + 160ms); }

/* route progress bar under the status strip */
.strip { position: sticky; }
.strip::after { content: ''; position: absolute; left: 0; bottom: -1px; height: 2px; width: 25%; background: linear-gradient(90deg, transparent, var(--amber), transparent); opacity: 0; }
.strip.loading::after { opacity: 1; animation: sweep 1s var(--ease-io) infinite; }

/* live status light breathes while online */
.light.online { animation: breathe 2.6s ease-in-out infinite; }

/* interactive feedback */
.btn { transition: background .18s, border-color .18s, color .18s, transform .12s var(--ease-out), box-shadow .18s; }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.98); }
.btn.primary:hover:not(:disabled) { box-shadow: 0 6px 18px rgba(242, 165, 65, .22); }
.nav a { transition: background .18s, color .18s, box-shadow .25s var(--ease-out), padding-left .25s var(--ease-out); }
.nav a:hover { padding-left: 14px; }
.nav a.on svg { color: var(--amber); }
table.t td { transition: background .15s; }
.list-pick button { transition: background .18s, box-shadow .25s var(--ease-out); }
.tabs button { transition: color .2s, border-color .25s var(--ease-out); }
input.i, select.i, textarea.i { transition: border-color .18s, box-shadow .18s; }
.box { transition: border-color .25s; }
.box:hover { border-color: var(--line); }
.report-item { transition: color .15s, padding-left .25s var(--ease-out); }
.report-item:hover { padding-left: 4px; }
.chip { transition: background .2s, color .2s, border-color .2s; }
.meter .bar i { transition: width 1.1s var(--ease-out), background .4s; }
.nav .count { animation: pop .35s var(--ease-out); }

/* live arrivals */
.feed li.flash, .logview .new, .msg.new { animation: slidein-t .45s var(--ease-out) both, flash 2s ease-out .1s; }
.msg { animation: pop .35s var(--ease-out) both; animation-delay: calc(min(var(--m, 0), 12) * 40ms); }

/* dialogs and toasts */
.modal-back { animation: fadein .18s ease; }
.modal { animation: pop .3s var(--ease-out); }
.modal-back.closing { animation: fadein .16s ease reverse forwards; }
.modal-back.closing .modal { animation: pop .16s ease reverse forwards; }
.toast { animation: slidein-r .35s var(--ease-out); }
.toast.out { animation: slideout-r .3s ease forwards; }

/* loading skeleton */
.skeleton { display: grid; gap: 14px; }
.skeleton i { display: block; height: 18px; border-radius: 6px; background: linear-gradient(90deg, var(--panel) 0, var(--panel-2) 120px, var(--panel) 240px) var(--panel); background-size: 800px 100%; animation: shimmer 1.3s linear infinite; }
.skeleton i.big { height: 120px; border-radius: var(--radius-l); }

/* login: form rises in after the art */
.login .form-side form { animation: rise .7s var(--ease-out) .15s both; }
.login .art .words > * { animation: rise .9s var(--ease-out) both; }
.login .art .words > :nth-child(2) { animation-delay: .12s; }

/* mobile rail slides with easing */
.rail { transition: transform .32s var(--ease-out); }

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