/* Coretide Console: black identity, Linear-style density. No JS required. */
:root {
    --bg: #08090a;
    --surface: #101113;
    --surface-2: #16181b;
    --border: #232529;
    --text: #e8e8ea;
    --muted: #8a8f98;
    --accent: #f4f4f5;
    --ok: #4cc38a;
    --warn: #e5a64b;
    --err: #eb5757;
    --radius: 8px;
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1 { font-size: 20px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
h3 { font-size: 14px; font-weight: 600; margin: 0; }
p { margin: 4px 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.pre { white-space: pre-wrap; max-width: 520px; }

/* Shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 14px 10px; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: 0.02em; padding: 4px 8px; }
.mark { width: 14px; height: 14px; border-radius: 3px; background: var(--accent); display: inline-block; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a { padding: 6px 8px; border-radius: 6px; color: var(--muted); }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--surface-2); color: var(--text); }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 10px 8px 2px; }
.ws-switch summary { cursor: pointer; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; list-style: none; }
.ws-switch summary::-webkit-details-marker { display: none; }
.ws-switch summary::after { content: " ▾"; color: var(--muted); }
.ws-switch ul { list-style: none; margin: 4px 0 0; padding: 4px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); }
.ws-switch li a { display: block; padding: 5px 6px; border-radius: 4px; color: var(--muted); }
.ws-switch li a.active, .ws-switch li a:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding: 8px; border-top: 1px solid var(--border); }

.main { padding: 28px 40px 60px; max-width: 1100px; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }

/* Components */
.btn { display: inline-block; padding: 7px 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; }
.btn:hover { border-color: #3a3d42; text-decoration: none; }
.btn.primary { background: var(--accent); color: #08090a; border-color: var(--accent); }
.btn.primary:hover { background: #ffffff; }
.link { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; cursor: pointer; text-align: left; }
.link:hover { color: var(--text); text-decoration: underline; }
.link.danger:hover { color: var(--err); }

.cards { display: grid; gap: 12px; margin-bottom: 24px; }
.cards.two { grid-template-columns: repeat(2, 1fr); }
.cards.four { grid-template-columns: repeat(4, 1fr); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.card.action:hover { border-color: #3a3d42; text-decoration: none; }
.stat-value { font-size: 22px; font-weight: 600; margin-top: 4px; }

.panel { margin-bottom: 24px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }

.row-item { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.row-end { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.price { font-variant-numeric: tabular-nums; }
.tag { font-size: 12px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; }

.table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 8px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; font-variant-numeric: tabular-nums; }

.status { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.status.s-paid { color: var(--ok); border-color: rgba(76, 195, 138, 0.35); }
.status.s-pending { color: var(--warn); border-color: rgba(229, 166, 75, 0.35); }
.status.s-failed { color: var(--err); border-color: rgba(235, 87, 87, 0.35); }

.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 0; }
.facts dt { color: var(--muted); font-size: 12px; }
.facts dd { margin: 2px 0 0; }

.notice { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 16px; background: var(--surface); }
.notice.ok { border-color: rgba(76, 195, 138, 0.35); }
.notice.err { border-color: rgba(235, 87, 87, 0.45); }
.empty { color: var(--muted); padding: 12px 0; }

/* Forms */
.stack { display: flex; flex-direction: column; gap: 8px; }
.narrow { max-width: 520px; }
label { font-size: 13px; color: var(--muted); }
input, select, textarea { width: 100%; padding: 8px 10px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 6px; font: inherit; }
input[type=radio], input[type=checkbox] { width: auto; margin-right: 6px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid #5e6ad2; outline-offset: 1px; }
fieldset { border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
legend { color: var(--muted); font-size: 12px; padding: 0 4px; }
.checkout { display: flex; flex-direction: column; gap: 12px; max-width: 520px; }
.check { color: var(--text); }

/* Guest pages */
body.guest { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.auth-card .brand { padding: 0; margin-bottom: 8px; }

nav[role=navigation] { display: flex; gap: 12px; color: var(--muted); }

/* Mobile: sidebar becomes a top bar */
@media (max-width: 760px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
    .nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
    .sidebar-foot { flex-direction: row; justify-content: space-between; margin-top: 0; }
    .main { padding: 20px 16px 48px; }
    .cards.two, .cards.four, .facts { grid-template-columns: 1fr 1fr; }
    .row-item { flex-direction: column; align-items: flex-start; }
    .table { display: block; overflow-x: auto; }
}
@media (max-width: 480px) {
    .cards.two, .cards.four, .facts { grid-template-columns: 1fr; }
}
