/* OSPOW console. Only the colour palette is shared with the marketing site
   (Ospow-Website/shell/engine.css); the layout is a classic admin console. */
:root {
  color-scheme: dark;
  --paper: #060b10;            /* page background */
  --panel: #0b121a;            /* top bar, sidebar, cards */
  --surface: rgba(255, 255, 255, .04);
  --surface-2: rgba(255, 255, 255, .07);
  --ink: #eaf1f5;
  --muted: #8ea1ae;
  --line: rgba(255, 255, 255, .09);
  --accent: #5b86ff;
  --accent2: #2de2b0;
  --accent-ink: #04101a;
  --warn: #f5b942;
  --danger: #ef4455;
  --grad: linear-gradient(135deg, #5b86ff 0%, #2de2b0 100%);
  --bar-h: 56px;
  --side-w: 240px;
  --radius: 12px;
  --radius-s: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); font: 400 .95rem/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
::selection { background: rgba(91, 134, 255, .45); }
:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; border-radius: 4px; }
[x-cloak] { display: none !important; }
code { font: .9em var(--mono); background: var(--surface-2); padding: 2px 6px; border-radius: 4px; }
h1, h2, h3 { letter-spacing: -0.02em; line-height: 1.2; margin: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 14px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---- Shell: top bar + sidebar + content ---- */
.shell { display: grid; grid-template-rows: var(--bar-h) 1fr; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.topbar { grid-column: 1 / -1; position: sticky; top: 0; z-index: 40; height: var(--bar-h); display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.sidebar { position: sticky; top: var(--bar-h); height: calc(100vh - var(--bar-h)); overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.content { min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 48px; }
.content-inner { max-width: 1200px; margin: 0 auto; }

/* Top bar */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; letter-spacing: -0.03em; text-decoration: none; margin-right: auto; }
.brand::before { content: ""; width: 18px; height: 18px; background: var(--grad); border-radius: 5px 12px 5px 12px; box-shadow: 0 0 14px rgba(91, 134, 255, .5); }
.brand small { font-weight: 500; font-size: .78rem; color: var(--muted); letter-spacing: 0; }
.burger { display: none; width: 36px; height: 36px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-s); cursor: pointer; position: relative; }
.burger span { position: absolute; left: 9px; right: 9px; height: 2px; background: var(--ink); }
.burger span:first-child { top: 13px; } .burger span:last-child { top: 21px; }
.iconbtn { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid transparent; border-radius: var(--radius-s); background: transparent; color: var(--muted); cursor: pointer; position: relative; }
.iconbtn:hover, .iconbtn[aria-expanded="true"] { background: var(--surface-2); color: var(--ink); }
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn .dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent2); border: 2px solid var(--panel); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--grad); color: var(--accent-ink); font-weight: 800; display: grid; place-items: center; font-size: .8rem; border: 0; cursor: pointer; }
.userbtn { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--ink); cursor: pointer; font: 500 .9rem var(--font); }
.userbtn:hover, .userbtn[aria-expanded="true"] { background: var(--surface-2); }
.userbtn .name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: relative; }
.pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 240px; padding: 6px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .8); z-index: 50; }
.pop .head { padding: 8px 10px 10px; font-size: .85rem; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; word-break: break-all; }
.pop a, .pop button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; font: 500 .9rem var(--font); color: var(--ink); text-decoration: none; background: none; border: 0; cursor: pointer; }
.pop a:hover, .pop button:hover { background: var(--surface-2); }
.pop .empty { padding: 20px 10px; text-align: center; color: var(--muted); font-size: .9rem; }
.lang { display: flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.lang button { font: 600 .72rem var(--font); padding: 4px 9px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* Sidebar */
.side-title { padding: 14px 12px 6px; font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.side-link { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-s); text-decoration: none; color: var(--muted); font-weight: 500; }
.side-link svg { width: 18px; height: 18px; flex: none; }
.side-link:hover { color: var(--ink); background: var(--surface); }
.side-link[aria-current="page"] { color: var(--ink); background: var(--surface-2); box-shadow: inset 2px 0 0 var(--accent); }
.side-link.staff[aria-current="page"] { box-shadow: inset 2px 0 0 var(--accent2); }
.side-foot { margin-top: auto; padding: 12px; font-size: .78rem; color: var(--muted); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .burger { display: block; }
  .sidebar { position: fixed; left: 0; top: var(--bar-h); bottom: 0; width: var(--side-w); z-index: 45; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .userbtn .name { display: none; }
  .content { padding: 20px 16px 40px; }
}

/* ---- Page header ---- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 1.5rem; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent2); margin: 0 0 4px; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius-s); background: var(--accent); color: #fff; font: 600 .9rem var(--font); text-decoration: none; border: 1px solid transparent; cursor: pointer; line-height: 1.2; transition: background .15s, border-color .15s; }
.btn:hover { background: #6e95ff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.primary { background: var(--grad); color: var(--accent-ink); font-weight: 700; }
.btn.danger { background: rgba(239, 68, 85, .12); color: #ff8b97; border-color: rgba(239, 68, 85, .4); }
.btn.sm { padding: 6px 11px; font-size: .82rem; }
.btn.wide { width: 100%; }

/* ---- Cards ---- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
a.card { text-decoration: none; display: block; }
.card.lift:hover { border-color: rgba(91, 134, 255, .5); }
.card h3 { font-size: 1.05rem; margin-bottom: 6px; }
.card p { color: var(--muted); margin: 0 0 8px; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
.stat .v { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.03em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: .85rem; }

/* Product tile (store) */
.product { display: flex; flex-direction: column; gap: 10px; }
.product .logo { width: 44px; height: 44px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-weight: 800; color: var(--accent2); font-size: 1.1rem; }
.product .meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.product .price { font-weight: 700; white-space: nowrap; }
.product .price small { color: var(--muted); font-weight: 400; }
.product .tag { font-size: .75rem; color: var(--muted); }

.product .shot { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: top; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--surface-2); }
.screenshot { margin: 0 0 16px; }
.screenshot img { display: block; max-width: 100%; border-radius: var(--radius-s); border: 1px solid var(--line); }
.screenshot.small { margin-bottom: 8px; }
.screenshot.small img { max-height: 220px; }
.field .field.check { margin-bottom: 8px; }
table.data img.thumb { float: left; width: 56px; height: 36px; object-fit: cover; object-position: top; border-radius: 4px; border: 1px solid var(--line); margin: 0 10px 4px 0; }

/* Store sections (one per category) */
.store-nav { margin-bottom: 20px; }
.store-nav a.chip { text-decoration: none; }
.store-nav a.chip:hover { color: var(--text); }
.store-nav .count { opacity: .7; margin-left: 2px; }
.store-section + .store-section { margin-top: 28px; }
.store-section h2 { font-size: 1.1rem; margin: 0 0 12px; scroll-margin-top: calc(var(--bar-h) + 16px); }

/* ---- Forms ---- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: .88rem; }
.field .help { color: var(--muted); font-size: .82rem; }
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea, .input {
  width: 100%; padding: 9px 12px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 400 .95rem var(--font);
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91, 134, 255, .25); }
.field select option { background: var(--panel); }
.field.check { flex-direction: row; align-items: center; gap: 10px; }
.field.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.errorlist { list-style: none; padding: 0; margin: 0; color: #ff8b97; font-size: .85rem; }
.form-error { padding: 10px 12px; border-radius: var(--radius-s); background: rgba(239, 68, 85, .12); border: 1px solid rgba(239, 68, 85, .35); color: #ffb3bb; margin-bottom: 14px; font-size: .9rem; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { text-align: left; padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
table.data thead th { border-top: 0; color: var(--muted); font-weight: 600; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; background: var(--surface); }
table.data tbody tr:hover { background: var(--surface); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.trunc { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
table.data td.wrap { white-space: normal; }
table.data td.nowrap .btn { margin-left: 4px; }

/* ---- Badges ---- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--accent2); background: rgba(45, 226, 176, .12); }
.badge.info { color: #9db6ff; background: rgba(91, 134, 255, .15); }
.badge.warn { color: var(--warn); background: rgba(245, 185, 66, .14); }
.badge.bad { color: #ff8b97; background: rgba(239, 68, 85, .14); }

/* ---- Toasts, modal, empty ---- */
.messages { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: min(400px, calc(100vw - 32px)); }
.toast { padding: 10px 14px; border-radius: var(--radius-s); background: var(--panel); border: 1px solid var(--line); box-shadow: 0 16px 40px -16px rgba(0, 0, 0, .8); font-size: .9rem; display: flex; gap: 12px; align-items: flex-start; }
.toast.success { border-color: rgba(45, 226, 176, .5); } .toast.error { border-color: rgba(239, 68, 85, .5); } .toast.warning { border-color: rgba(245, 185, 66, .5); }
.toast button { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1.1rem; line-height: 1; }
.modal-bg { position: fixed; inset: 0; background: rgba(2, 6, 10, .7); z-index: 70; display: grid; place-items: center; padding: 20px; }
.modal { width: min(520px, 100%); }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

/* ---- Entrance (login, signup, allauth pages) ---- */
.entrance { max-width: 420px; margin: 24px auto; }
.entrance h1 { font-size: 1.4rem; margin-bottom: 4px; }
.entrance .lead { color: var(--muted); margin: 0 0 18px; font-size: .9rem; }
.providers, .providers ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.providers li { margin: 0; padding: 0; }
.providers a { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--surface); text-decoration: none; font-weight: 600; }
.providers a:hover { background: var(--surface-2); }
.providers svg { width: 18px; height: 18px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .8rem; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

@media (max-width: 860px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }

/* ---- Tabs (sub navigation inside an area) ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabs a.disabled { opacity: .45; cursor: not-allowed; }

/* ---- Misc ---- */
.muted { color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid.cols-2-1 { grid-template-columns: 2fr 1fr; }
.sticky { position: sticky; top: calc(var(--bar-h) + 20px); align-self: start; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
table.data.plain { background: transparent; }
table.data.plain td { padding-left: 0; white-space: normal; }
table.data.plain tr:first-child td { border-top: 0; }
.quote-result { margin-top: 8px; padding: 14px 16px; border-radius: var(--radius-s); background: var(--surface); border: 1px solid var(--line); }
.quote-result .l { font-size: .8rem; color: var(--muted); }
.quote-result .v { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.03em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.quote-result .err { color: #ff8b97; font-size: .85rem; margin-top: 6px; }
details summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
@media (max-width: 860px) { .grid.cols-2-1 { grid-template-columns: 1fr; } .sticky { position: static; } }
