/* Peakline Manager: the dashboard wears the Peakline Performance world.
   Black ground, neon red for the one accent, chrome silver for labels,
   Exo 2 throughout, and the logo's light trail as the rule under every page title. */

@font-face { font-family: "Exo 2"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/exo2.woff2") format("woff2"); }
@font-face { font-family: "Exo 2"; font-style: italic; font-weight: 100 900; font-display: swap; src: url("fonts/exo2-italic.woff2") format("woff2"); }

:root {
  --bg: #07080a;
  --panel: #0f1114;
  --panel-2: #171a1f;
  --line: #23282f;
  --line-strong: #5c6573;
  --text: #e9ebef;
  --muted: #9aa3ae;
  --chrome: #c9ced6;
  --accent: #ff2b2b;
  --accent-text: #ff5c5c;
  --accent-soft: rgba(255, 43, 43, 0.12);
  --on-accent: #160303;
  --focus: #ff5c5c;
  --ok: #3ccf8e;
  --ok-soft: rgba(60, 207, 142, 0.12);
  --warn: #f5b942;
  --warn-soft: rgba(245, 185, 66, 0.12);
  --bad: #ff5c5c;
  --bad-soft: rgba(255, 43, 43, 0.12);
  --r-sm: 6px;
  --r-md: 10px;
  --shadow-float: 0 18px 48px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.4);
  --font: "Exo 2", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scrollbar-color: var(--line-strong) transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.5 var(--font); min-height: 100vh; caret-color: var(--accent); }
::selection { background: var(--accent); color: var(--on-accent); }
a { color: var(--accent-text); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
h1 { font-size: 28px; line-height: 1.15; margin: 0; font-weight: 700; font-style: italic; letter-spacing: -0.01em; text-wrap: balance; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 700; }
h3 { font-size: 11.5px; margin: 20px 0 8px; color: var(--chrome); text-transform: uppercase; letter-spacing: 0.14em; font-weight: 600; }
.boot { padding: 40px; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--accent); color: var(--on-accent); padding: 10px 14px; border-radius: var(--r-sm); font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }
.num { font-variant-numeric: tabular-nums; }

/* layout */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: #000; border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.logo { display: block; padding: 4px 6px 16px; text-decoration: none; color: var(--chrome); }
.logo img { display: block; width: 100%; height: auto; }
.logo small { display: block; margin-top: 2px; padding-left: 4px; font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-sm); color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.side .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px 6px 0; border-top: 1px solid var(--line); }
.me img { width: 30px; height: 30px; border-radius: 50%; background: var(--panel-2); }
.me .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
main.content { padding: 28px 32px 60px; min-width: 0; max-width: 1280px; }
main.content:focus { outline: none; }

/* page title with the logo's light trail under it: the one signature move */
.head { position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 24px; padding-bottom: 14px; flex-wrap: wrap; }
.head::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: linear-gradient(90deg, var(--accent) 0, var(--accent) 120px, rgba(255, 43, 43, 0.35) 420px, transparent 100%); box-shadow: 0 0 12px rgba(255, 43, 43, 0.45); }
.head p { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }

/* building blocks */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px; min-width: 0; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px 12px; }
.tile .label { color: var(--chrome); font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; font-weight: 600; }
.tile .value { font-size: 34px; line-height: 1.1; font-weight: 700; font-style: italic; margin-top: 6px; font-variant-numeric: tabular-nums; }
.tile .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.stack > * + * { margin-top: 12px; }
.mb { margin-bottom: 16px; }
.mt { margin-top: 16px; }

.btn { appearance: none; border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--text); padding: 8px 14px; min-height: 36px; border-radius: var(--r-sm); font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--chrome); }
.btn .icon { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.sm { padding: 5px 10px; min-height: 32px; font-size: 12.5px; }
.btn.icon-only { padding: 0; width: 36px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.discord { background: #5865f2; border-color: #5865f2; color: #fff; padding: 12px 20px; font-size: 15px; }
.linklike { appearance: none; background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; font-weight: 600; }
.linklike:hover { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }

.alert { border-radius: var(--r-md); padding: 10px 14px; background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); display: flex; gap: 10px; align-items: flex-start; }
.alert > .icon { color: var(--warn); margin-top: 1px; }
.alert + .alert { margin-top: 8px; }
.alert.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.alert.ok > .icon { color: var(--ok); }
.alert.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.alert.bad > .icon { color: var(--bad); }
.alert.info { background: var(--panel-2); border-color: var(--line); }
.alert.info > .icon { color: var(--muted); }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -18px -18px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 18px; border-top: 1px solid var(--line); vertical-align: middle; }
th { color: var(--chrome); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; border-top: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--panel-2); }
td.num { font-variant-numeric: tabular-nums; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* forms */
label.field, .field { display: block; }
.field > span, .field > legend { display: block; font-size: 12px; font-weight: 600; color: var(--chrome); margin-bottom: 5px; padding: 0; }
fieldset.field { border: 0; margin-inline: 0; margin-bottom: 0; padding: 0; min-width: 0; }
input[type="text"], input[type="number"], input[type="search"], input[type="url"], input[type="file"], select, textarea {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 8px 11px; min-height: 36px; font: inherit;
}
input[type="file"] { padding: 6px 8px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
textarea { min-height: 84px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
input:user-invalid, select:user-invalid, textarea:user-invalid { border-color: var(--bad); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; min-height: 28px; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: none; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.checks.scroll { flex-direction: column; flex-wrap: nowrap; max-height: 188px; overflow-y: auto; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--bg); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.section-title { font-size: 11.5px; font-weight: 600; margin: 0; padding-top: 4px; color: var(--chrome); text-transform: uppercase; letter-spacing: 0.14em; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 18px 0 14px; }

/* products */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.product { position: relative; transition: border-color 0.15s; display: flex; flex-direction: column; gap: 8px; }
.product:hover, .product:focus-within { border-color: var(--accent); }
.product .product-name { margin: 0; font-size: 15px; }
.product .title { font-weight: 700; }
/* The title button's hit area covers the whole card, so the card is one keyboard stop. */
.product .title::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-md); }
.product .title:focus-visible { outline: none; }
.product:has(.title:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.product .desc { color: var(--muted); font-size: 13px; flex: 1; }
.product .file { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.product .file .icon { width: 14px; height: 14px; }

/* chart */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 18px; }
.bar { flex: 1; background: var(--accent); border-radius: 2px 2px 0 0; min-height: 2px; position: relative; }
.bar span { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-labels { display: flex; gap: 6px; margin-top: 6px; }
.bar-labels span { flex: 1; min-width: 0; text-align: center; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: visible; }

/* status */
.status-list { display: grid; gap: 8px; }
.status-list > div { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.state-ok { color: var(--ok); }
.state-bad { color: var(--bad); }
.status-list .icon { width: 16px; height: 16px; }
.access-row .icon { width: 16px; height: 16px; }

/* dialog */
dialog.modal { width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 40px); padding: 0; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--panel); color: var(--text); box-shadow: var(--shadow-float); overflow: hidden; }
dialog.modal.wide { width: min(980px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(0, 0, 0, 0.7); }
dialog.modal > .modal-body { padding: 18px; max-height: calc(100vh - 42px); overflow: auto; }
dialog.modal .head { margin-bottom: 14px; }
dialog.modal h2 { font-size: 20px; margin: 0; font-style: italic; }

/* sticky save bar */
.savebar { position: sticky; bottom: 12px; z-index: 20; margin-top: 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; background: var(--panel); border: 1px solid var(--accent); border-radius: var(--r-md); box-shadow: var(--shadow-float); }
.savebar[hidden] { display: none; }
.savebar b { margin-right: auto; }

/* toasts */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { display: flex; gap: 8px; align-items: flex-start; background: var(--panel-2); border: 1px solid var(--line-strong); padding: 10px 14px; border-radius: var(--r-md); box-shadow: var(--shadow-float); max-width: 380px; }
.toast > .icon { color: var(--ok); margin-top: 1px; }
.toast.bad { border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
.toast.bad > .icon { color: var(--bad); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: #000; }
.login .card { max-width: 460px; text-align: center; padding: 28px 28px 34px; background: transparent; border: 0; }
.login .hero { display: block; width: min(420px, 100%); height: auto; margin: 0 auto 10px; }
.login .kicker { color: var(--chrome); text-transform: uppercase; letter-spacing: 0.2em; font-size: 12px; font-weight: 600; margin: 0 0 22px; }
.login p { margin: 0 0 18px; }
.progress { height: 6px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform 0.2s ease-out; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.chat-you { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r-md); background: var(--accent-soft); }
.chat-you .icon { color: var(--accent-text); margin-top: 1px; }
.prewrap { white-space: pre-wrap; }
.wrap-any { overflow-wrap: anywhere; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { min-width: 0; position: sticky; top: 0; z-index: 30; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px 10px 0; gap: 0; }
  .logo { padding: 2px 4px; width: 150px; }
  .logo small { display: none; }
  /* One scrollable row instead of wrapping into a tall block. */
  .nav { order: 3; flex-direction: row; flex-wrap: nowrap; width: calc(100% + 20px); margin: 6px -10px 0; padding: 0 6px 6px; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 8px 12px; min-height: 44px; white-space: nowrap; }
  .side .me { margin: 0 0 0 auto; border: 0; padding: 4px; }
  .side .me .name, .side .me img { display: none; }
  main.content { padding: 18px 16px 48px; }
  h1 { font-size: 24px; }
  .grid.two, .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 110px 1fr; }
}

/* Small screens: tables become labelled stacks so row actions stay on screen. */
@media (max-width: 640px) {
  .table-wrap { overflow: visible; }
  .table-wrap thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table-wrap tr { display: block; padding: 10px 18px; border-top: 1px solid var(--line); }
  .table-wrap td { display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 4px 0; border: 0; }
  .table-wrap td > * { justify-self: start; }
  .table-wrap td:empty { display: none; }
  .table-wrap td::before { content: attr(data-label); color: var(--chrome); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; }
  .table-wrap td[data-label=""] { grid-template-columns: 1fr; }
  .table-wrap td[data-label=""]::before { display: none; }
  #toasts { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
}

@media (pointer: coarse), (max-width: 640px) {
  .btn, .btn.sm, input[type="text"], input[type="number"], input[type="search"], input[type="url"], select { min-height: 44px; }
  .btn.icon-only { width: 44px; }
  .check { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
