/* TubCode pages. Tokens mirrored from site/setup.html so the create and admin
   pages read as part of tubplayer.com rather than as a bolt-on. */
:root {
    --teal-400: #73D8FF;
    --teal-500: #65A7F0;
    --teal-600: #5B6EE1;
    --gradient-strong: linear-gradient(135deg, #65A7F0, #5B6EE1);
    --text-primary: #F5F5F5;
    --text-secondary: #A1A1AA;
    --text-muted: #71717A;
    --bg-black: #000000;
    --bg-elevated: #0A0A0A;
    --bg-card: #111111;
    --border: rgba(255,255,255,0.08);
    --border-strong: rgba(255,255,255,0.14);
    --danger: #F87171;
    --ok: #4ADE80;
    --warn: #FBBF24;
    --radius: 16px;
    --radius-sm: 10px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
    background: var(--bg-black);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}
.glow {
    position: fixed;
    top: -180px; right: -120px;
    width: 420px; height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(101,167,240,0.18) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}
header {
    position: relative; z-index: 1;
    max-width: 640px; margin: 0 auto;
    padding: 28px 20px 8px;
    display: flex; align-items: center; gap: 12px;
}
header img { width: 36px; height: 36px; }
header .brand { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.02em; }
main {
    position: relative; z-index: 1;
    max-width: 640px; margin: 0 auto;
    padding: 12px 20px 48px;
}
h1 { font-size: 1.65rem; font-weight: 800; letter-spacing: -0.03em; margin: 12px 0 8px; }
h2 { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 12px; }
.lede { color: var(--text-secondary); font-size: 0.98rem; margin-bottom: 20px; }
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}
.status { font-size: 0.9rem; color: var(--text-secondary); }
.status:empty { display: none; }
.status.error { color: var(--danger); }
.status.ok { color: var(--ok); }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.tab {
    appearance: none;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 12px 8px;
    font: inherit; font-weight: 600; font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.tab[aria-selected="true"] {
    color: var(--text-primary);
    border-color: rgba(101,167,240,0.55);
    background: rgba(101,167,240,0.12);
}
label {
    display: block;
    font-size: 0.8rem; font-weight: 600;
    color: var(--text-secondary);
    margin: 14px 0 6px;
}
label:first-of-type { margin-top: 0; }
input {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font: inherit; font-size: 1rem;
}
input:focus { outline: 2px solid rgba(101,167,240,0.55); outline-offset: 1px; border-color: transparent; }
input::placeholder { color: var(--text-muted); }
.hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 6px; }
.panel[hidden] { display: none !important; }
.actions { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.btn {
    appearance: none; border: none; border-radius: 12px;
    padding: 14px 18px;
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    font: inherit; font-weight: 700; font-size: 1rem;
    cursor: pointer;
    background: var(--gradient-strong); color: #fff;
    box-shadow: 0 10px 30px rgba(91,110,225,0.28);
    text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn-secondary {
    background: transparent; color: var(--text-secondary);
    border: 1px solid var(--border-strong); box-shadow: none; font-weight: 600;
}
footer {
    max-width: 640px; margin: 0 auto;
    padding: 8px 20px 32px;
    color: var(--text-muted); font-size: 0.78rem; text-align: center;
}
footer a { color: var(--teal-400); text-decoration: none; }

/* The create page is a phone form and stays narrow. Admin is a seven-column
   table read on a desktop, and at 640px every column after Status fell off the
   right-hand edge into a scrollbar. */
body.admin header,
body.admin main,
body.admin footer { max-width: 1180px; }

/* Site navigation, copied from index.html's so the create page belongs to the
   site it is now linked from. Only the create page carries it — admin is not a
   public destination and keeps its own plain header. */
nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
}
.nav-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 32px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}
.nav-brand img { height: 36px; width: 36px; }
.nav-brand span { font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em; }
.nav-links { display: flex; align-items: center; gap: 28px; list-style: none; }
.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}
.nav-links a:hover { color: var(--teal-400); }
.nav-links a.active { color: var(--teal-400); }
.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    width: 40px; height: 40px;
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s, border-color 0.2s;
}
.nav-toggle:hover { background: rgba(255,255,255,0.04); border-color: var(--teal-400); }
.nav-toggle svg { width: 22px; height: 22px; display: block; }
.nav-toggle .icon-close { display: none; }
nav.nav-open .nav-toggle .icon-menu { display: none; }
nav.nav-open .nav-toggle .icon-close { display: block; }

/* The nav is fixed, so the page below it needs clearing. */
body.with-nav main { padding-top: 88px; }

@media (max-width: 720px) {
    .nav-inner { padding: 0 20px; }
    .nav-toggle { display: inline-flex; }
    .nav-links {
        position: absolute;
        top: 64px; left: 0; right: 0;
        flex-direction: column;
        background: rgba(0,0,0,0.95);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border-bottom: 1px solid var(--border);
        padding: 12px 24px 16px;
        gap: 0;
        display: none;
    }
    nav.nav-open .nav-links { display: flex; }
    .nav-links li { width: 100%; }
    .nav-links a {
        display: block;
        padding: 14px 4px;
        font-size: 1rem;
        border-bottom: 1px solid var(--border);
    }
    .nav-links li:last-child a { border-bottom: none; }
}

/* The code, once issued. Large, spaced and selectable — it gets read aloud
   and retyped on a TV remote, so legibility beats elegance here. */
.code-box { text-align: center; padding: 28px 12px; }
.code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: clamp(1.6rem, 7vw, 2.4rem);
    font-weight: 700;
    /* Deliberately tight. At 0.16em the tracking read as spaces between every
       character, and people copy what they see — the dashes are already the
       only grouping the code needs. */
    letter-spacing: 0.02em;
    color: var(--teal-400);
    word-break: break-word;
    margin: 10px 0 6px;
    user-select: all;
}

/* Admin table */
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-muted); font-weight: 600; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.badge {
    display: inline-block; padding: 3px 9px; border-radius: 100px;
    font-size: 0.74rem; font-weight: 600;
    border: 1px solid var(--border-strong);
}
.badge.pending { color: var(--warn); }
.badge.retrieved { color: var(--ok); }
.stats { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-bottom: 4px; }
.stat-value { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }
.stat-label { font-size: 0.76rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
