/* New site pages (account, link, dashboard, servers, server pages, inhouse, quiz, LFG, overlay, owner panel):
   Facet look shared by routes/me.js, link.js, dashboard.js, servers.js, panel2.js (services/pageShell.js). */
:root {
    --g: #10141A; --s1: #171C24; --s2: #1E2530; --s3: #26303D; --s4: #3A4453;
    --ink: #ECE8E1; --ink2: #BDB8AF; --ink3: #8E949C;
    --red: #FF4655; --win: #3ED1B3; --gold: #F2C94C; --violet: #B48CFF; --blurple: #5865F2;
    --accent: var(--red);
    --cut: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
    --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; background: var(--g); color: var(--ink); font: 16px/1.55 'Archivo', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--ink); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.1; }
h1 { font-size: clamp(30px, 5vw, 46px); font-weight: 800; font-stretch: 112%; letter-spacing: -.01em; }
h2 { font-size: 22px; font-weight: 800; }
h3 { font-size: 17px; font-weight: 800; }
p { margin: 0; }
.n { font-stretch: 78%; font-weight: 800; font-variant-numeric: tabular-nums; }
.muted { color: var(--ink3); }
.soft { color: var(--ink2); }
.small { font-size: 13px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; padding: 10px 14px; background: var(--red); color: var(--g); z-index: 9; }

/* Top bar */
.top { display: flex; align-items: center; gap: 22px; padding: 14px 24px; border-bottom: 1px solid var(--s3); background: var(--g); position: sticky; top: 0; z-index: 5; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-stretch: 112%; font-size: 19px; text-decoration: none; }
.brand i { width: 20px; height: 20px; background: var(--red); clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 0 100%); }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; }
.top nav a { padding: 6px 10px; color: var(--ink2); font-weight: 600; font-size: 15px; text-decoration: none; }
.top nav a:hover, .top nav a[aria-current] { color: var(--ink); }
.top .grow { flex: 1; }
.me { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px 0 4px; background: var(--s2); text-decoration: none; font-weight: 700; font-size: 14px; }
.me img, .avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; background: var(--s3); }
.avatar { display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; color: #fff; }
.rplus { display: inline-block; width: max-content; background: var(--gold); color: var(--g); font-weight: 800; font-size: 11px; padding: 1px 6px; line-height: 1.5; vertical-align: middle; }
.foot { margin-top: auto; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 22px 24px 32px; border-top: 1px solid var(--s3); color: var(--ink3); font-size: 14px; }
.foot a { color: var(--ink3); }

/* Page layouts */
.page { width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 24px 56px; display: flex; flex-direction: column; gap: 18px; }
.page.narrow { max-width: 560px; }
.app { display: flex; min-height: calc(100dvh - 65px); }
.side { width: 250px; flex: none; border-right: 1px solid var(--s3); padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 65px; align-self: flex-start; max-height: calc(100dvh - 65px); overflow: auto; }
.side .who { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; }
.side .who b { display: block; font-size: 15px; }
.side select { width: 100%; }
.side a { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 10px; font-size: 14px; color: var(--ink2); text-decoration: none; }
.side a:hover { color: var(--ink); background: var(--s1); }
.side a[aria-current] { background: var(--s2); color: var(--ink); font-weight: 800; box-shadow: inset 3px 0 var(--accent); }
.side a .rplus { margin-left: auto; }
.main { flex: 1; min-width: 0; padding: 26px 28px 56px; display: flex; flex-direction: column; gap: 18px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.head > div { display: flex; flex-direction: column; gap: 4px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 8px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g12 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
/* Tiles inside a panel wrap before they get too narrow */
.panel .g3, .panel .g4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* Blocks */
.panel { background: var(--s1); padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel.tight { padding: 14px; gap: 10px; }
.panel > header { display: flex; flex-direction: column; gap: 2px; }
.tile { background: var(--s1); padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile span { font-size: 13px; color: var(--ink2); font-weight: 600; }
.tile b { font-size: 32px; line-height: 1.1; font-stretch: 78%; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile small { font-size: 12px; color: var(--ink3); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; background: var(--s3); color: var(--ink2); font-size: 12px; font-weight: 700; white-space: nowrap; border: 0; font-family: inherit; }
button.chip { cursor: pointer; }
.chip[aria-pressed="true"], .chip.on { background: var(--ink); color: var(--g); }
.chip.ok { background: #173b34; color: var(--win); }
.chip.warn { background: #2a2410; color: var(--gold); }
.chip.bad { background: #3b1a1d; color: var(--red); }
.chip.role { background: #2b2350; color: #C9B8FF; }
.note { padding: 12px 14px; font-size: 14px; display: flex; gap: 12px; align-items: center; background: var(--s2); }
.note.warn { background: #2a2410; }
.note.bad { background: #3b1a1d; }
.note.ok { background: #173b34; }
.empty { padding: 28px; text-align: center; color: var(--ink3); background: var(--s1); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 18px; border: 0; background: var(--accent); color: var(--g); font: inherit; font-weight: 800; font-size: 15px; text-decoration: none; cursor: pointer; clip-path: var(--cut); white-space: nowrap; transition: transform .15s var(--ease), filter .15s var(--ease); }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.dark { background: var(--s2); color: var(--ink); }
.btn.gold { background: var(--gold); }
.btn.ghost { background: transparent; color: var(--ink2); clip-path: none; padding: 0 8px; }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn.big { min-height: 50px; padding: 0 26px; font-size: 17px; }
.link-danger { color: var(--red); background: none; border: 0; font: inherit; font-size: 14px; cursor: pointer; padding: 0; text-align: left; }

/* Forms */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink2); min-width: 0; }
input[type=text], input[type=url], input[type=search], input[type=number], input[type=date], select, textarea {
    width: 100%; min-height: 40px; padding: 8px 12px; background: var(--g); border: 1px solid var(--s3); color: var(--ink); font: inherit; font-size: 14px; font-weight: 500; border-radius: 0;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--ink3); }
input[type=color] { width: 44px; height: 40px; padding: 2px; background: var(--g); border: 1px solid var(--s3); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 14px; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; flex: none; width: 40px; height: 24px; margin: 0; border-radius: 12px; background: var(--s4); position: relative; cursor: pointer; transition: background .2s var(--ease); }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); transition: transform .2s var(--ease); }
.switch input:checked { background: var(--win); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:disabled { opacity: .5; cursor: not-allowed; }
.radio { display: flex; gap: 10px; align-items: center; font-size: 14px; cursor: pointer; }
.radio input { accent-color: var(--accent); width: 18px; height: 18px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 32px; height: 32px; border: 0; cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 700; color: var(--ink3); padding: 0 8px 8px; border-bottom: 1px solid var(--s3); white-space: nowrap; }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--s3); vertical-align: middle; }
.table td.r, .table th.r { text-align: right; }
.table tr:last-child td { border-bottom: 0; }
.scroll-x { overflow-x: auto; }
.who-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who-cell b { display: block; }
.who-cell span { font-size: 12px; color: var(--ink3); }
.bar { height: 8px; background: var(--s3); position: relative; min-width: 60px; }
.bar i { position: absolute; inset: 0 auto 0 0; background: var(--accent); }
.spark { display: block; width: 100%; height: 80px; }
.cols { display: flex; align-items: flex-end; gap: 4px; height: 90px; }
.cols i { flex: 1; background: var(--ink); min-height: 3px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; background: var(--ink); color: var(--g); padding: 10px 16px; font-weight: 700; font-size: 14px; z-index: 20; transition: opacity .2s var(--ease), transform .2s var(--ease); pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--red); }

/* Mobile */
.menu-btn { display: none; }
@media (max-width: 900px) {
    .top { padding: 12px 16px; gap: 12px; }
    .top nav { display: none; }
    .app { flex-direction: column; }
    .side { position: static; width: 100%; max-height: none; border-right: 0; border-bottom: 1px solid var(--s3); flex-direction: row; overflow-x: auto; padding: 8px 12px; gap: 2px; }
    .side .who { display: none; }
    .side a { white-space: nowrap; min-height: 36px; }
    .side a[aria-current] { box-shadow: inset 0 -3px var(--accent); }
    .main, .page { padding: 20px 16px 48px; }
    .g3, .g4, .g5, .g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .g2, .g21, .g12 { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { *, *::after { transition: none !important; } }
