/* Cadence — style.css */

:root {
    --bg: #f8f9fb;
    --bg-card: #ffffff;
    --bg-hover: #f1f3f7;
    --border: #e2e5ed;
    --text: #1a1d27;
    --text-muted: #6b7280;
    --text-dim: #9ca3af;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-light: #eef2ff;
    --green: #16a34a;
    --green-bg: #dcfce7;
    --yellow: #d97706;
    --yellow-bg: #fef3c7;
    --red: #dc2626;
    --red-bg: #fee2e2;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,.1);
}

/* ── LCARS Theme ──────────────────────────────────────────── */

:root[data-theme="lcars"] {
    --bg: #000000;
    --bg-card: #0a0a12;
    --bg-hover: #141420;
    --border: #1e1e30;
    --text: #cc99ff;
    --text-muted: #9977bb;
    --text-dim: #554477;
    --accent: #ff9900;
    --accent-hover: #ffbb44;
    --accent-light: #1a1000;
    --lcars-blue: #9999ff;
    --lcars-purple: #cc77ff;
    --lcars-peach: #ffaa77;
    --lcars-teal: #00cccc;
    --lcars-pink: #ff5588;
    --green: #00ee88;
    --green-bg: #002a18;
    --yellow: #ffcc00;
    --yellow-bg: #1a1800;
    --red: #ff4444;
    --red-bg: #1a0808;
    --radius: 0px;
    --shadow: none;
    --shadow-md: none;
    --font-body: "Rajdhani", "Segoe UI", system-ui, sans-serif;
    --font-display: "Orbitron", "Rajdhani", monospace;
}

:root[data-theme="lcars"] body {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 15px;
    letter-spacing: 0.02em;
}

/* ── LCARS Login ── */

:root[data-theme="lcars"] #login-screen {
    background: transparent;
    position: relative;
}

:root[data-theme="lcars"] .login-card {
    background: var(--bg-card);
    border: 2px solid var(--lcars-blue);
    border-radius: 0;
    box-shadow:
        0 0 20px rgba(153, 153, 255, 0.1),
        inset 0 0 40px rgba(0, 0, 0, 0.5);
    position: relative;
}
:root[data-theme="lcars"] .login-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--lcars-blue), var(--accent), var(--lcars-purple));
}

:root[data-theme="lcars"] .login-card h1 {
    font-family: var(--font-display);
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 20px;
}
:root[data-theme="lcars"] .login-card #login-desc {
    color: var(--lcars-blue);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: var(--font-body);
}

:root[data-theme="lcars"] .login-card input {
    border-radius: 0;
    border-color: var(--border);
    background: #050508;
    color: var(--lcars-teal);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 500;
}
:root[data-theme="lcars"] .login-card input:focus {
    border-color: var(--lcars-teal);
    box-shadow: 0 0 8px rgba(0, 204, 204, 0.2);
}
:root[data-theme="lcars"] .login-card input::placeholder { color: var(--text-dim); }

:root[data-theme="lcars"] .login-card button {
    background: var(--accent);
    color: #000;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    font-family: var(--font-display);
    border-radius: 0;
    transition: all 0.2s;
}
:root[data-theme="lcars"] .login-card button:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 16px rgba(255, 153, 0, 0.3);
}

/* ── LCARS Header ── */

:root[data-theme="lcars"] header {
    background: #050508;
    border-bottom: none;
    position: relative;
}
:root[data-theme="lcars"] header::after {
    content: "";
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        var(--lcars-blue) 0%, var(--lcars-blue) 15%,
        var(--accent) 15%, var(--accent) 40%,
        var(--lcars-purple) 40%, var(--lcars-purple) 60%,
        var(--lcars-peach) 60%, var(--lcars-peach) 75%,
        var(--lcars-teal) 75%, var(--lcars-teal) 100%
    );
}

:root[data-theme="lcars"] header h1 {
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    font-size: 15px;
}
:root[data-theme="lcars"] .tagline {
    color: var(--lcars-blue);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
:root[data-theme="lcars"] #signed-in-as { color: var(--lcars-teal); }
:root[data-theme="lcars"] #sign-out-btn {
    border-color: var(--border);
    color: var(--text-muted);
    border-radius: 0;
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
:root[data-theme="lcars"] #sign-out-btn:hover {
    border-color: var(--lcars-pink);
    color: var(--lcars-pink);
}

/* ── LCARS Stats ── */

:root[data-theme="lcars"] .stat-card.countdown {
    background: linear-gradient(135deg, #0a0510 0%, #100818 100%);
    border: 2px solid var(--lcars-purple);
    color: var(--lcars-purple);
    position: relative;
}
:root[data-theme="lcars"] .stat-card.countdown::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--lcars-purple), transparent);
}
:root[data-theme="lcars"] .stat-card.countdown .stat-label {
    color: var(--text-muted);
    font-family: var(--font-display);
    font-size: 9px;
    letter-spacing: 0.15em;
}
:root[data-theme="lcars"] .stat-card.countdown .stat-sub {
    color: var(--lcars-purple);
}
:root[data-theme="lcars"] .stat-card.countdown .stat-value {
    font-family: var(--font-display);
    color: #ffffff;
    text-shadow: 0 0 20px rgba(204, 119, 255, 0.6);
}

:root[data-theme="lcars"] .stat-label {
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 9px;
}

:root[data-theme="lcars"] .stat-value {
    font-family: var(--font-display);
}

:root[data-theme="lcars"] .user-card {
    border: 1px solid var(--border);
    position: relative;
}
:root[data-theme="lcars"] .user-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 3px;
    background: var(--lcars-blue);
}
:root[data-theme="lcars"] .user-card.is-me {
    border-color: var(--accent);
    background: rgba(255, 153, 0, 0.03);
}
:root[data-theme="lcars"] .user-card.is-me::before {
    background: var(--accent);
}

:root[data-theme="lcars"] .user-name {
    font-family: var(--font-display);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 13px;
}

:root[data-theme="lcars"] .you-badge {
    background: var(--accent);
    color: #000;
    font-family: var(--font-display);
    border-radius: 0;
}

:root[data-theme="lcars"] .pace-badge {
    border-radius: 0;
    font-family: var(--font-body);
}

:root[data-theme="lcars"] .progress-bar-wrap {
    background: var(--border);
    border-radius: 0;
    height: 4px;
}
:root[data-theme="lcars"] .progress-bar-fill {
    background: linear-gradient(90deg, var(--lcars-teal), var(--green));
    border-radius: 0;
    box-shadow: 0 0 8px rgba(0, 238, 136, 0.3);
}

:root[data-theme="lcars"] .progress-text {
    font-variant-numeric: tabular-nums;
}

/* ── LCARS Periods ── */

:root[data-theme="lcars"] .period {
    border-color: var(--border);
    border-radius: 0;
}
:root[data-theme="lcars"] .period.open {
    border-color: var(--lcars-blue);
}

:root[data-theme="lcars"] .period-header {
    border-radius: 0;
}
:root[data-theme="lcars"] .period-header:hover {
    background: var(--bg-hover);
}

:root[data-theme="lcars"] .period-chevron {
    color: var(--lcars-blue);
}

:root[data-theme="lcars"] .period-label {
    font-family: var(--font-display);
    color: var(--accent);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 13px;
}

:root[data-theme="lcars"] .period-desc {
    color: var(--lcars-blue);
}

:root[data-theme="lcars"] .period-hours {
    color: var(--lcars-teal);
    border-color: var(--border);
    background: var(--bg);
    border-radius: 0;
}

:root[data-theme="lcars"] .period-user-badge {
    border-radius: 0;
}

/* ── LCARS Table ── */

:root[data-theme="lcars"] table th {
    border-bottom: 2px solid var(--lcars-blue);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: var(--font-display);
    font-size: 10px;
    color: var(--lcars-blue);
}

:root[data-theme="lcars"] table tr:hover td {
    background: rgba(153, 153, 255, 0.03);
}

:root[data-theme="lcars"] .item-title a {
    color: var(--lcars-teal);
}
:root[data-theme="lcars"] .item-title a:hover {
    color: var(--accent);
}

:root[data-theme="lcars"] .hours-badge {
    border-radius: 0;
    color: var(--lcars-peach);
    border-color: var(--border);
}

/* ── LCARS Checkboxes ── */

:root[data-theme="lcars"] .check-btn {
    background: #050508;
    border-color: var(--border);
    border-radius: 0;
}
:root[data-theme="lcars"] .check-btn:hover {
    border-color: var(--lcars-teal);
    box-shadow: 0 0 6px rgba(0, 204, 204, 0.2);
}
:root[data-theme="lcars"] .check-btn.checked {
    background: var(--green);
    border-color: var(--green);
    color: #000;
    box-shadow: 0 0 8px rgba(0, 238, 136, 0.4);
}
:root[data-theme="lcars"] .check-btn.readonly {
    opacity: 0.5;
}
:root[data-theme="lcars"] .check-btn.readonly.checked {
    background: var(--lcars-blue);
    border-color: var(--lcars-blue);
    box-shadow: none;
    opacity: 0.5;
}

:root[data-theme="lcars"] .mobile-check {
    border-radius: 0;
}
:root[data-theme="lcars"] .mobile-check.checked {
    background: var(--green-bg);
    border-color: var(--green);
    color: var(--green);
}

/* ── LCARS Status colours ── */

:root[data-theme="lcars"] .pace-good { background: var(--green-bg); color: var(--green); }
:root[data-theme="lcars"] .pace-warn { background: var(--yellow-bg); color: var(--yellow); }
:root[data-theme="lcars"] .pace-bad  { background: var(--red-bg); color: var(--red); }

/* ── LCARS Celebration ── */

:root[data-theme="lcars"] .celebration-card {
    background: var(--bg-card);
    border: 2px solid var(--green);
    border-radius: 0;
    box-shadow: 0 0 60px rgba(0, 238, 136, 0.15);
}
:root[data-theme="lcars"] .celebration-card h2 {
    font-family: var(--font-display);
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
:root[data-theme="lcars"] .celebration-card p { color: var(--text-muted); }
:root[data-theme="lcars"] .celebration-card button {
    background: var(--green);
    color: #000;
    border-radius: 0;
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ── LCARS Countdown override ── */

:root[data-theme="lcars"] .stat-card.countdown .stat-value {
    font-size: 52px;
    font-family: var(--font-display);
    line-height: 1.1;
}

/* ── LCARS Effects ── */

/* Animated grid background */
@keyframes lcars-grid-drift {
    0% { transform: translate(0, 0); }
    100% { transform: translate(40px, 40px); }
}

:root[data-theme="lcars"] body {
    background:
        linear-gradient(135deg,
            rgba(153, 153, 255, 0.02) 0%,
            transparent 40%,
            rgba(255, 153, 0, 0.015) 70%,
            rgba(204, 119, 255, 0.02) 100%
        ),
        #000000;
}
:root[data-theme="lcars"] body::before {
    content: "";
    position: fixed;
    inset: -40px;
    background-image:
        linear-gradient(rgba(153, 153, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(153, 153, 255, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    animation: lcars-grid-drift 8s linear infinite;
    pointer-events: none;
    z-index: 0;
}

:root[data-theme="lcars"] #app,
:root[data-theme="lcars"] #login-screen {
    position: relative;
    z-index: 1;
}

/* CRT effects — dedicated overlay divs instead of pseudo-elements on #app,
   to guarantee no touch interception on Android browsers */
#crt-overlay { display: none; pointer-events: none; }
:root[data-theme="lcars"] #crt-overlay { display: block; }

#crt-scanlines, #crt-vignette {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 9998;
}
#crt-scanlines {
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.12) 2px,
        rgba(0, 0, 0, 0.12) 4px
    );
}
#crt-vignette {
    background: radial-gradient(
        ellipse at center,
        transparent 45%,
        rgba(0, 0, 0, 0.55) 100%
    );
}

/* Ambient glow on main content */
:root[data-theme="lcars"] main {
    position: relative;
}
:root[data-theme="lcars"] main::before {
    content: "";
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        var(--lcars-blue) 20%,
        var(--accent) 50%,
        var(--lcars-purple) 80%,
        transparent
    );
    opacity: 0.4;
}

/* Blinking cursor on the logo */
@keyframes lcars-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
:root[data-theme="lcars"] .logo {
    animation: lcars-blink 2s ease-in-out infinite;
}

/* CRT flicker on countdown — more prominent */
@keyframes lcars-flicker {
    0%, 100% { opacity: 1; text-shadow: 0 0 20px rgba(204, 119, 255, 0.6); }
    4% { opacity: 0.65; text-shadow: 0 0 10px rgba(204, 119, 255, 0.3); }
    6% { opacity: 1; text-shadow: 0 0 20px rgba(204, 119, 255, 0.6); }
    42% { opacity: 1; text-shadow: 0 0 20px rgba(204, 119, 255, 0.6); }
    44% { opacity: 0.8; text-shadow: 0 0 25px rgba(204, 119, 255, 0.8); }
    45% { opacity: 0.7; text-shadow: 0 0 15px rgba(204, 119, 255, 0.4); }
    46% { opacity: 1; text-shadow: 0 0 20px rgba(204, 119, 255, 0.6); }
    78% { opacity: 1; text-shadow: 0 0 20px rgba(204, 119, 255, 0.6); }
    80% { opacity: 0.75; text-shadow: 0 0 30px rgba(204, 119, 255, 0.9); }
    81% { opacity: 1; text-shadow: 0 0 20px rgba(204, 119, 255, 0.6); }
}
:root[data-theme="lcars"] .stat-card.countdown .stat-value {
    animation: lcars-flicker 5s ease-in-out infinite;
}

/* Glow pulse on checked items */
@keyframes lcars-check-glow {
    0%, 100% { box-shadow: 0 0 6px rgba(0, 238, 136, 0.3); }
    50% { box-shadow: 0 0 12px rgba(0, 238, 136, 0.5); }
}
:root[data-theme="lcars"] .check-btn.checked:not(.readonly) {
    animation: lcars-check-glow 3s ease-in-out infinite;
}

/* Progress bar shimmer */
@keyframes lcars-shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: 200px 0; }
}
:root[data-theme="lcars"] .progress-bar-fill {
    background: linear-gradient(
        90deg,
        var(--lcars-teal) 0%,
        var(--green) 40%,
        rgba(255, 255, 255, 0.15) 50%,
        var(--green) 60%,
        var(--lcars-teal) 100%
    );
    background-size: 400px 100%;
    animation: lcars-shimmer 3s linear infinite;
}

/* Horizontal scan bar — sweeps down the screen */
@keyframes lcars-scanbar {
    0% { top: -4px; }
    100% { top: 100vh; }
}
#crt-overlay #crt-scanbar {
    position: fixed;
    left: 0; right: 0;
    height: 4px;
    background: linear-gradient(180deg,
        transparent,
        rgba(153, 153, 255, 0.08),
        rgba(153, 153, 255, 0.12),
        rgba(153, 153, 255, 0.08),
        transparent
    );
    animation: lcars-scanbar 6s linear infinite;
    pointer-events: none;
    z-index: 9999;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden;
}

.hidden { display: none !important; }

/* ── Login ────────────────────────────────────────────────── */

#login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef2ff 0%, #f8f9fb 60%);
    padding: 16px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 360px;
    box-shadow: var(--shadow-md);
    text-align: center;
}

.login-logo { font-size: 40px; margin-bottom: 12px; }
.login-card h1 { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.login-card #login-desc { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }

.login-card input {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 10px;
    background: var(--bg);
    color: var(--text);
    transition: border 0.15s;
}
.login-card input:focus { outline: none; border-color: var(--accent); }

.login-card button {
    display: block;
    width: 100%;
    padding: 10px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 4px;
}
.login-card button:hover { background: var(--accent-hover); }
.login-card button:disabled { opacity: 0.6; cursor: not-allowed; }

.error { color: var(--red); font-size: 13px; margin-top: 10px; }

#new-password-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ── Header ───────────────────────────────────────────────── */

header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-left { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 24px; }
header h1 { font-size: 18px; font-weight: 700; }
.tagline { color: var(--text-muted); font-size: 12px; }

.header-right { display: flex; align-items: center; gap: 12px; }
#signed-in-as { color: var(--text-muted); font-size: 13px; }

#sign-out-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
    white-space: nowrap;
}
#sign-out-btn:hover { border-color: var(--text-muted); color: var(--text); }

#app-footer {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-dim);
    font-size: 12px;
}
#app-footer a {
    color: var(--text-dim);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s;
}
#app-footer a:hover { color: var(--text-muted); }

/* ── Main ─────────────────────────────────────────────────── */

main {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px;
}

/* ── Stats bar ────────────────────────────────────────────── */

.stats-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 22px;
    box-shadow: var(--shadow);
    min-width: 140px;
}
.stat-card.countdown {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}
.stat-card.countdown .stat-label { color: rgba(255,255,255,.75); }
.stat-card.countdown .stat-sub   { color: rgba(255,255,255,.65); }

.stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.stat-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
}
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── User cards ───────────────────────────────────────────── */

#user-progress-cards {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 22px;
    box-shadow: var(--shadow);
    flex: 1 1 0;
    min-width: 180px;
}
.user-card.is-me {
    border-color: var(--accent);
    background: var(--accent-light);
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.you-badge {
    font-size: 10px;
    font-weight: 600;
    background: var(--accent);
    color: white;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* Pace indicator */
.pace-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    margin-left: auto;
    min-width: 100px;
    text-align: center;
}
.pace-good { background: var(--green-bg); color: var(--green); }
.pace-warn { background: var(--yellow-bg); color: var(--yellow); }
.pace-bad  { background: var(--red-bg);    color: var(--red);    }

.progress-bar-wrap {
    background: var(--border);
    border-radius: 99px;
    height: 6px;
    margin-bottom: 6px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 99px;
    background: var(--accent);
    transition: width 0.4s ease;
}
.progress-text {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

/* ── Periods ──────────────────────────────────────────────── */

.period {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.period.current-period { border-color: var(--accent); }

.period-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    gap: 12px;
}
.period-header:hover { background: var(--bg-hover); }

.period-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.period-chevron {
    color: var(--text-dim);
    font-size: 11px;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.period.open .period-chevron { transform: rotate(90deg); }

.period-label {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}
.period.current-period .period-label { color: var(--accent); }

/* Period description */
.period-desc {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.period-hours {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 99px;
    flex-shrink: 0;
}

.period-user-summary { display: flex; gap: 12px; flex-shrink: 0; }
.period-user-badge { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 70px; text-align: right; }
.period-user-badge.done { color: var(--green); font-weight: 600; }

/* ── Items table ──────────────────────────────────────────── */

.period-items {
    display: none;
    border-top: 1px solid var(--border);
    overflow-x: auto;
}
.period.open .period-items { display: block; }

table { width: 100%; border-collapse: collapse; }

th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 8px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
th.check-col { text-align: center; width: 70px; }

td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }

/* Item title */
.item-title { font-size: 13px; }
.item-link {
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: color 0.15s, border-color 0.15s;
}
.item-link:hover { color: var(--accent); border-color: var(--accent); }

/* Hours */
.hours-badge {
    font-size: 11px;
    color: var(--text-dim);
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 1px 6px;
    border-radius: 4px;
    white-space: nowrap;
}
.hours-inline { display: none; } /* shown on mobile only */

/* Checkboxes */
td.check-col { text-align: center; }

.check-btn {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    border: 2px solid var(--border);
    background: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    transition: all 0.15s;
    font-size: 13px;
    line-height: 1;
    padding: 0;
}
.check-btn:hover { border-color: var(--accent); }
.check-btn.checked { background: var(--green); border-color: var(--green); color: white; }
.check-btn.readonly { cursor: default; opacity: .7; }
.check-btn.readonly:hover { border-color: var(--border); }
.check-btn.readonly.checked { background: var(--text-dim); border-color: var(--text-dim); }

/* Mobile checks (hidden on desktop) */
.mobile-checks { display: none; margin-top: 6px; gap: 8px; flex-wrap: wrap; }
.mobile-check {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 99px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    cursor: default;
    user-select: none;
}
.mobile-check:not(.readonly) { cursor: pointer; }
.mobile-check:not(.readonly):hover { border-color: var(--accent); color: var(--accent); }
.mobile-check.checked { background: var(--green-bg); border-color: var(--green); color: var(--green); font-weight: 600; }
.mobile-check.readonly.checked { background: #f3f4f6; border-color: var(--text-dim); color: var(--text-dim); }

/* ── Period completion ─────────────────────────────────────── */

@keyframes period-flash {
    0% { border-color: var(--green); box-shadow: 0 0 0 rgba(22, 163, 74, 0); }
    30% { border-color: var(--green); box-shadow: 0 0 20px rgba(22, 163, 74, 0.25); }
    100% { border-color: var(--border); box-shadow: none; }
}
.period-complete-flash {
    animation: period-flash 1.5s ease-out;
}

.period-complete-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--green);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    white-space: nowrap;
}
.period-complete-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

:root[data-theme="lcars"] .period-complete-toast {
    background: var(--bg-card);
    color: var(--green);
    border: 2px solid var(--green);
    border-radius: 0;
    box-shadow: 0 0 20px rgba(0, 238, 136, 0.2);
    font-family: var(--font-display);
    letter-spacing: 0.04em;
}

:root[data-theme="lcars"] .period-complete-flash {
    animation: lcars-period-flash 1.5s ease-out;
}
@keyframes lcars-period-flash {
    0% { border-color: var(--green); box-shadow: 0 0 0 rgba(0, 238, 136, 0); }
    30% { border-color: var(--green); box-shadow: 0 0 24px rgba(0, 238, 136, 0.2); }
    100% { border-color: var(--border); box-shadow: none; }
}

/* ── Celebration ──────────────────────────────────────────── */

.confetti-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999;
}

.celebration-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s;
    padding: 16px;
}
.celebration-overlay.visible { opacity: 1; }

.celebration-card {
    background: white;
    border-radius: 20px;
    padding: 48px 40px;
    text-align: center;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    transform: translateY(0);
}
.celebration-emoji { font-size: 56px; margin-bottom: 16px; }
.celebration-card h2 { font-size: 28px; font-weight: 800; margin-bottom: 12px; }
.celebration-card p { color: var(--text-muted); font-size: 16px; margin-bottom: 28px; line-height: 1.6; }
.celebration-card button {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 32px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.celebration-card button:hover { background: var(--accent-hover); }

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 640px) {
    header { padding: 12px 16px; }
    .tagline { display: none; }
    #signed-in-as { display: none; }

    main { padding: 12px; }

    .stats-bar { gap: 10px; }
    .stat-card { padding: 14px 16px; min-width: 0; flex: 1; }
    .stat-value { font-size: 22px; }

    .user-card { padding: 14px 16px; min-width: 0; }

    .period-user-summary { display: none; }
    .period-desc { display: none; } /* shown in expanded view only would need more work */

    /* Switch table to single-column card layout */
    table, thead, tbody, tr, th, td { display: block; }
    thead { display: none; }

    tr {
        padding: 12px 16px;
        border-bottom: 1px solid var(--border);
    }
    tr:last-child { border-bottom: none; }
    tr:hover td { background: none; }

    td { padding: 0; border: none; }
    td.hours-cell { display: none; }
    td.check-col { display: none; }
    td.item-title-cell { width: 100%; }

    .item-title { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; }
    .hours-inline { display: inline; margin-left: 6px; }
    .mobile-checks { display: flex; }

    :root[data-theme="lcars"] .stat-card.countdown .stat-value { font-size: 32px; }
    :root[data-theme="lcars"] table tr:hover td { background: none; }
}
