:root {
    color-scheme: dark;
    --bg: #07111f;
    --panel: rgba(15, 23, 42, .86);
    --panel-strong: rgba(15, 23, 42, .96);
    --card: rgba(30, 41, 59, .74);
    --line: rgba(148, 163, 184, .2);
    --text: #f8fafc;
    --muted: #94a3b8;
    --accent: #f97316;
    --accent-2: #facc15;
    --good: #22c55e;
    --bad: #ef4444;
    --shadow: 0 22px 80px rgba(0, 0, 0, .35);
    --radius: 24px;
    --radius-sm: 16px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(249, 115, 22, .28), transparent 36rem),
        radial-gradient(circle at top right, rgba(59, 130, 246, .16), transparent 32rem),
        linear-gradient(135deg, #07111f 0%, #101827 55%, #0f172a 100%);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: .85rem clamp(1rem, 3vw, 2rem);
    border-bottom: 1px solid var(--line);
    background: rgba(7, 17, 31, .82);
    backdrop-filter: blur(20px);
}

.logo {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: 1.05rem;
}
.logo span {
    display: grid;
    place-items: center;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 50%;
    background: linear-gradient(145deg, #f97316, #facc15);
    box-shadow: 0 10px 30px rgba(249, 115, 22, .28);
}

.topbar nav {
    display: flex;
    justify-content: center;
    gap: .35rem;
    flex-wrap: wrap;
}
.topbar nav a,
.ghost-btn {
    border: 1px solid transparent;
    border-radius: 999px;
    padding: .65rem .85rem;
    color: #dbeafe;
    background: transparent;
}
.topbar nav a:hover,
.ghost-btn:hover { background: rgba(148, 163, 184, .12); border-color: var(--line); }
.logout-form { margin: 0; }

.shell {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: clamp(1rem, 3vw, 2rem);
    padding-bottom: calc(2rem + var(--safe-bottom));
}

.hero {
    display: grid;
    grid-template-columns: 1fr minmax(220px, 320px);
    gap: 1.25rem;
    align-items: stretch;
    padding: clamp(1.25rem, 4vw, 2.25rem);
    border: 1px solid var(--line);
    border-radius: calc(var(--radius) + 10px);
    background:
        linear-gradient(135deg, rgba(249, 115, 22, .2), transparent),
        rgba(15, 23, 42, .74);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}
.hero::after {
    content: "";
    position: absolute;
    inset: auto -5rem -10rem auto;
    width: 19rem;
    height: 19rem;
    border-radius: 50%;
    background:
        linear-gradient(90deg, transparent 47%, rgba(255,255,255,.2) 48%, rgba(255,255,255,.2) 52%, transparent 53%),
        linear-gradient(0deg, transparent 47%, rgba(255,255,255,.2) 48%, rgba(255,255,255,.2) 52%, transparent 53%),
        radial-gradient(circle, #f97316, #c2410c);
    opacity: .22;
}
.hero h1 {
    max-width: 760px;
    margin: .1rem 0 .7rem;
    font-size: clamp(2rem, 5vw, 4.5rem);
    line-height: .95;
    letter-spacing: -.065em;
}
.hero-copy { max-width: 720px; color: #cbd5e1; font-size: 1.08rem; }
.hero-score {
    display: grid;
    align-content: center;
    min-height: 180px;
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid rgba(250, 204, 21, .25);
    background: rgba(2, 6, 23, .42);
    text-align: center;
}
.hero-score span, .hero-score small, .eyebrow, .muted, .tiny { color: var(--muted); }
.hero-score strong {
    font-size: clamp(2.4rem, 6vw, 4.8rem);
    line-height: 1;
    color: var(--accent-2);
}
.eyebrow {
    margin: 0 0 .4rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .75rem;
    font-weight: 800;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .9rem;
    margin: 1rem 0 1.6rem;
}
.metric-grid.compact { margin-top: 0; }
.metric-card {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, .68);
}
.metric-card span, .metric-card small { color: var(--muted); }
.metric-card strong {
    display: block;
    margin-top: .35rem;
    font-size: clamp(1.55rem, 4vw, 2.35rem);
    line-height: 1;
}

.player-scoreboard {
    align-content: start;
    gap: .75rem;
    text-align: left;
}
.hero-score.player-scoreboard > span,
.hero-score.player-scoreboard > small {
    text-align: center;
}
.hero-score.player-scoreboard strong {
    font-size: clamp(1.15rem, 2.6vw, 1.65rem);
    color: #fef3c7;
}
.hero-score.player-scoreboard .scoreboard-empty {
    display: block;
    text-align: center;
    font-size: clamp(2.2rem, 6vw, 4rem);
    color: var(--accent-2);
}
.hero-player-list {
    display: grid;
    gap: .45rem;
    margin: .25rem 0;
}
.hero-player-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
    border: 1px solid color-mix(in srgb, var(--accent) 38%, rgba(148, 163, 184, .18));
    border-radius: 16px;
    padding: .68rem .78rem;
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 18%, transparent), rgba(2, 6, 23, .34));
}
.hero-player-row span {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: .45rem;
    color: #dbeafe;
    font-weight: 850;
}
.hero-player-row span b {
    display: inline-grid;
    place-items: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 12px;
    background: color-mix(in srgb, var(--accent) 28%, rgba(2, 6, 23, .6));
}

.compact-heading { margin-bottom: .75rem; }
.player-total-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .9rem;
    margin: 0 0 1.6rem;
}
.player-total-card {
    position: relative;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--accent) 32%, rgba(148, 163, 184, .18));
    border-radius: var(--radius-sm);
    padding: .95rem;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, transparent), transparent 55%),
        rgba(15, 23, 42, .76);
    box-shadow: 0 16px 46px rgba(0, 0, 0, .18);
}
.player-total-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: .28rem;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.player-total-head {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .65rem;
    align-items: center;
    margin-bottom: .65rem;
}
.player-total-head h3 { margin: 0; font-size: 1.1rem; }
.player-total-head p { margin: .1rem 0 0; color: var(--muted); font-size: .85rem; }
.player-total-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .45rem;
    margin-top: .65rem;
}
.player-total-stats span {
    display: grid;
    gap: .12rem;
    border-radius: 13px;
    padding: .58rem .48rem;
    background: rgba(2, 6, 23, .34);
    border: 1px solid rgba(148, 163, 184, .12);
}
.player-total-stats strong { font-size: 1.05rem; line-height: 1; }
.player-total-stats small { color: var(--muted); font-size: .72rem; }

.section-heading,
.calendar-summary {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.6rem 0 .85rem;
}
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: -.03em; }
.section-heading h1, .section-heading h2, .calendar-summary h2 { margin-bottom: 0; }

.player-grid,
.challenge-grid,
.settings-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.player-card,
.challenge-card,
.form-card,
.info-card,
.empty-state,
.weekly-panel,
.toolbar-card,
.challenge-strip,
.calendar-wrap {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: 0 18px 60px rgba(0, 0, 0, .22);
}
.player-card {
    padding: 1.1rem;
    position: relative;
    overflow: hidden;
}
.player-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: .35rem;
    background: var(--accent);
}
.player-card-head {
    display: flex;
    gap: .8rem;
    align-items: center;
    margin-bottom: 1rem;
}
.avatar {
    display: grid;
    place-items: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 20px;
    background: color-mix(in srgb, var(--accent) 35%, transparent);
    font-size: 1.7rem;
}
.player-card h3 { margin-bottom: .1rem; font-size: 1.45rem; }
.player-card p { margin-bottom: 0; color: var(--muted); }
.goal-ring { margin: .8rem 0 1rem; }
.ring-track {
    height: .75rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, .15);
    overflow: hidden;
}
.ring-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.ring-track.slim { height: .45rem; margin: .35rem 0 .2rem; }
.goal-row {
    display: flex;
    align-items: baseline;
    gap: .4rem;
    margin-top: .35rem;
}
.goal-row strong { font-size: 1.65rem; }
.goal-row span { color: var(--muted); }
.mini-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .5rem;
    margin-bottom: 1rem;
}
.mini-metrics span {
    padding: .65rem;
    border-radius: 14px;
    background: rgba(2, 6, 23, .34);
    color: var(--muted);
    font-size: .85rem;
}
.mini-metrics strong { display: block; color: var(--text); font-size: 1rem; }

form label {
    display: grid;
    gap: .35rem;
    color: #dbeafe;
    font-weight: 700;
    font-size: .9rem;
}
input, select, textarea {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 14px;
    padding: .85rem .9rem;
    color: var(--text);
    background: rgba(2, 6, 23, .48);
    outline: none;
}
input:focus, select:focus, textarea:focus { border-color: rgba(250, 204, 21, .75); box-shadow: 0 0 0 4px rgba(250, 204, 21, .12); }
.shot-form {
    display: grid;
    grid-template-columns: 1.2fr .8fr auto;
    gap: .6rem;
    align-items: end;
}
.quick-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .45rem;
    margin-top: .6rem;
}
.quick-buttons button {
    border: 1px solid rgba(250, 204, 21, .2);
    border-radius: 14px;
    padding: .78rem .5rem;
    color: #fef3c7;
    background: rgba(249, 115, 22, .15);
    font-weight: 900;
}
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: .4rem;
    min-height: 46px;
    border: 0;
    border-radius: 999px;
    padding: .8rem 1rem;
    font-weight: 900;
    text-align: center;
}
.btn.primary { color: #111827; background: linear-gradient(135deg, #facc15, #fb923c); }
.btn.secondary { color: #e2e8f0; background: rgba(148, 163, 184, .12); border: 1px solid var(--line); }

.alert {
    margin-bottom: 1rem;
    border-radius: 16px;
    padding: .85rem 1rem;
    border: 1px solid var(--line);
    background: rgba(15, 23, 42, .9);
}
.alert.success { border-color: rgba(34, 197, 94, .35); color: #bbf7d0; }
.alert.error { border-color: rgba(239, 68, 68, .35); color: #fecaca; }
.warning-text { color: #fde68a; }

.challenge-strip {
    margin-top: 1rem;
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, rgba(250, 204, 21, .12), rgba(249, 115, 22, .08)), var(--panel);
}
.challenge-card { padding: 1rem; }
.challenge-title { display: flex; gap: .7rem; align-items: start; }
.challenge-title > span { font-size: 1.7rem; }
.challenge-title h3 { margin-bottom: .15rem; }
.challenge-title p, .challenge-card p, .challenge-card small { color: var(--muted); }
.challenge-progress-list { display: grid; gap: .5rem; margin-top: .9rem; }
.challenge-progress-row { display: flex; justify-content: space-between; gap: 1rem; }
.inline-toggle {
    margin: -.4rem 1rem 1rem;
    padding: .65rem 1rem;
    border: 1px solid var(--line);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    background: rgba(2, 6, 23, .28);
}
.inline-toggle label, .check { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: .5rem; }
.inline-toggle input, .check input { width: auto; }

.form-card, .info-card, .empty-state, .weekly-panel { padding: 1.1rem; }
.form-card.small { padding: .9rem; }
.player-form, .challenge-form, .stack { display: grid; gap: .8rem; }
.two-col, .toolbar-card, .calendar-nav { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
.toolbar-card {
    grid-template-columns: minmax(170px, 1fr) minmax(170px, 1fr) auto;
    align-items: end;
    padding: 1rem;
    margin-bottom: 1rem;
}
.checkbox-grid {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: .85rem;
    display: grid;
    gap: .45rem;
}
.checkbox-grid label { display: flex; flex-direction: row; align-items: center; gap: .5rem; }
.checkbox-grid input { width: auto; }

.calendar-summary { align-items: center; }
.calendar-wrap { padding: .7rem; overflow: auto; }
.weekday-row, .calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(110px, 1fr));
    gap: .45rem;
    min-width: 760px;
}
.weekday-row { margin-bottom: .45rem; }
.weekday-row span {
    color: var(--muted);
    font-size: .8rem;
    font-weight: 900;
    text-align: center;
}
.day-card {
    min-height: 116px;
    display: grid;
    align-content: start;
    gap: .25rem;
    text-align: left;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: .7rem;
    color: var(--text);
    background: rgba(2, 6, 23, .32);
}
.day-card:hover { border-color: rgba(250, 204, 21, .55); transform: translateY(-1px); }
.day-card.faded { opacity: .42; }
.day-card.done { background: linear-gradient(135deg, rgba(34, 197, 94, .2), rgba(250, 204, 21, .1)); border-color: rgba(34, 197, 94, .45); }
.day-card.today { outline: 2px solid rgba(250, 204, 21, .48); }
.day-num { color: var(--muted); font-size: .82rem; font-weight: 900; }
.day-card strong { font-size: 1.35rem; }
.day-card small { color: var(--muted); }
.weekly-list { display: grid; gap: .45rem; }
.weekly-list div { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding: .5rem 0; }
.weekly-list div:last-child { border-bottom: 0; }

.day-modal {
    width: min(460px, calc(100% - 2rem));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem;
    color: var(--text);
    background: var(--panel-strong);
    box-shadow: var(--shadow);
}
.day-modal::backdrop { background: rgba(2, 6, 23, .78); backdrop-filter: blur(8px); }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }

.login-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 1rem;
}
.login-card {
    width: min(430px, 100%);
    border: 1px solid var(--line);
    border-radius: calc(var(--radius) + 8px);
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 1.4rem;
    text-align: center;
}
.brand-ball {
    width: 5rem;
    height: 5rem;
    display: grid;
    place-items: center;
    margin: 0 auto 1rem;
    border-radius: 50%;
    font-size: 2.5rem;
    background: linear-gradient(145deg, #f97316, #facc15);
}
.login-card h1 { font-size: 2.4rem; margin-bottom: .35rem; }
.login-card p { color: var(--muted); }
.tiny { font-size: .78rem; }
code {
    padding: .12rem .35rem;
    border-radius: 8px;
    background: rgba(2, 6, 23, .5);
    color: #fde68a;
}

@media (max-width: 900px) {
    .topbar { grid-template-columns: 1fr; }
    .topbar nav { justify-content: start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: .25rem; }
    .logout-form { position: absolute; top: .7rem; right: 1rem; }
    .hero, .player-grid, .challenge-grid, .settings-list { grid-template-columns: 1fr; }
    .player-total-grid { grid-template-columns: 1fr; }
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .shot-form, .toolbar-card { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .shell { padding: .85rem; }
    .hero { padding: 1rem; }
    .metric-grid { gap: .55rem; }
    .metric-card { padding: .85rem; }
    .player-total-stats { grid-template-columns: repeat(2, 1fr); }
    .mini-metrics { grid-template-columns: 1fr; }
    .quick-buttons { grid-template-columns: repeat(2, 1fr); }
    .section-heading, .calendar-summary, .challenge-strip { align-items: stretch; flex-direction: column; }
    .two-col, .calendar-nav { grid-template-columns: 1fr; }
}

.role-pill {
    justify-self: end;
    border: 1px solid rgba(250, 204, 21, .25);
    border-radius: 999px;
    padding: .52rem .75rem;
    color: #fef3c7;
    background: rgba(249, 115, 22, .14);
    font-size: .82rem;
    font-weight: 900;
}
.day-card.read-only { cursor: default; }
.day-card.read-only:hover { transform: none; border-color: var(--line); }

@media (min-width: 901px) {
    .topbar { grid-template-columns: auto 1fr auto auto auto; }
}

@media (max-width: 900px) {
    .role-pill { justify-self: start; }
}

/* Admin Center 1.2.0 */
.admin-hero {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr minmax(240px, 340px);
    gap: 1.25rem;
    align-items: stretch;
    padding: clamp(1.25rem, 4vw, 2.4rem);
    border: 1px solid rgba(250, 204, 21, .22);
    border-radius: calc(var(--radius) + 8px);
    background:
        radial-gradient(circle at 18% 12%, rgba(250, 204, 21, .22), transparent 18rem),
        radial-gradient(circle at 86% 55%, rgba(249, 115, 22, .28), transparent 16rem),
        linear-gradient(135deg, rgba(15, 23, 42, .98), rgba(30, 41, 59, .72));
    box-shadow: var(--shadow);
}
.admin-hero::after {
    content: '';
    position: absolute;
    inset: auto -7rem -9rem auto;
    width: 22rem;
    height: 22rem;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(250, 204, 21, .28), rgba(249, 115, 22, .18));
    filter: blur(2px);
}
.admin-hero > * { position: relative; z-index: 1; }
.admin-hero h1 { max-width: 760px; font-size: clamp(2.2rem, 6vw, 4.6rem); line-height: .92; margin-bottom: .8rem; }
.admin-orb {
    display: grid;
    align-content: center;
    justify-items: center;
    min-height: 210px;
    padding: 1.25rem;
    border: 1px solid rgba(250, 204, 21, .26);
    border-radius: var(--radius);
    background: rgba(2, 6, 23, .52);
    text-align: center;
    box-shadow: inset 0 0 44px rgba(250, 204, 21, .08);
}
.admin-orb span, .admin-orb small { color: var(--muted); }
.admin-orb strong { margin: .25rem 0; font-size: clamp(2.2rem, 5vw, 3.6rem); color: #fef3c7; }
.admin-metrics { margin-top: 1rem; }
.admin-command-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
    gap: 1rem;
    margin-top: 1rem;
}
.admin-command-grid.lower { align-items: start; }
.admin-panel, .admin-kid-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .015)),
        rgba(15, 23, 42, .78);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .22);
}
.admin-panel { padding: 1.1rem; }
.panel-title {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 1rem;
    margin-bottom: .85rem;
}
.panel-title h2 { margin: .1rem 0 0; }
.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .42rem .7rem;
    font-size: .78rem;
    font-weight: 950;
    color: #e2e8f0;
    background: rgba(148, 163, 184, .12);
}
.status-pill.good { color: #bbf7d0; border-color: rgba(34, 197, 94, .42); background: rgba(34, 197, 94, .14); }
.status-pill.warn { color: #fde68a; border-color: rgba(250, 204, 21, .38); background: rgba(250, 204, 21, .12); }
.status-pill.quiet { color: #cbd5e1; }
.admin-form { display: grid; gap: .75rem; margin-top: .9rem; }
.switch-line {
    display: flex;
    align-items: center;
    gap: .7rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: .8rem;
    background: rgba(2, 6, 23, .24);
    font-weight: 900;
}
.switch-line input { width: auto; transform: scale(1.2); }
.button-row { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }
.btn.ghost { color: #dbeafe; background: rgba(2, 6, 23, .24); border: 1px solid rgba(148, 163, 184, .2); }
.quick-admin-actions { display: grid; gap: .65rem; }
.admin-action {
    display: grid;
    gap: .2rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: .9rem;
    background: rgba(2, 6, 23, .25);
    transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.admin-action:hover { transform: translateY(-1px); border-color: rgba(250, 204, 21, .36); background: rgba(250, 204, 21, .08); }
.admin-action span, .mini-note span { color: var(--muted); font-size: .9rem; }
.mini-note {
    display: grid;
    gap: .25rem;
    margin-top: .9rem;
    border-radius: 18px;
    padding: .9rem;
    background: linear-gradient(135deg, rgba(34, 197, 94, .12), rgba(59, 130, 246, .08));
}
.admin-kid-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.admin-kid-card {
    position: relative;
    overflow: hidden;
    padding: 1rem;
}
.admin-kid-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: var(--accent);
    opacity: .9;
}
.admin-kid-head {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: .75rem;
    margin-bottom: .85rem;
}
.admin-kid-head h3 { margin-bottom: .1rem; }
.admin-kid-head p { margin: 0; color: var(--muted); font-size: .9rem; }
.avatar.mini, .admin-kid-head .avatar {
    background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 55%, #111827), rgba(250, 204, 21, .25));
}
.admin-kid-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .55rem;
    margin-top: .85rem;
}
.admin-kid-stats span {
    display: grid;
    gap: .12rem;
    border: 1px solid rgba(148, 163, 184, .14);
    border-radius: 16px;
    padding: .7rem;
    background: rgba(2, 6, 23, .28);
}
.admin-kid-stats strong { font-size: 1.18rem; }
.admin-kid-stats small, .admin-kid-meta { color: var(--muted); }
.admin-kid-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    margin: .85rem 0;
    font-size: .88rem;
}
.admin-kid-meta span {
    border: 1px solid rgba(148, 163, 184, .14);
    border-radius: 999px;
    padding: .42rem .58rem;
    background: rgba(148, 163, 184, .08);
}
.activity-list { display: grid; gap: .65rem; }
.activity-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .75rem;
    align-items: start;
    border: 1px solid rgba(148, 163, 184, .14);
    border-radius: 18px;
    padding: .8rem;
    background: rgba(2, 6, 23, .24);
}
.avatar.mini {
    width: 2.2rem;
    height: 2.2rem;
    font-size: 1.1rem;
}
.activity-item strong { display: block; }
.activity-item small, .activity-item p { color: var(--muted); }
.activity-item p { margin: .25rem 0 0; font-size: .9rem; }
.log-lines { display: grid; gap: .45rem; }
.log-lines code {
    display: block;
    white-space: normal;
    line-height: 1.35;
    color: #dbeafe;
    border: 1px solid rgba(148, 163, 184, .14);
}

@media (max-width: 980px) {
    .admin-hero, .admin-command-grid, .admin-kid-grid { grid-template-columns: 1fr; }
    .admin-kid-head { grid-template-columns: auto 1fr; }
    .admin-kid-head .status-pill { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 560px) {
    .admin-kid-stats { grid-template-columns: repeat(2, 1fr); }
    .admin-orb { min-height: 160px; }
    .button-row .btn { width: 100%; }
}


.mail-health {
  margin: 1rem 0 0.9rem;
  padding: 0.85rem 0.95rem;
  border-radius: 1.1rem;
  display: grid;
  gap: 0.2rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.42);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.mail-health strong {
  color: #f8fafc;
  font-size: 0.95rem;
}

.mail-health span {
  color: #a9b9d6;
  font-size: 0.82rem;
  line-height: 1.35;
}

.mail-health.good {
  border-color: rgba(34, 197, 94, 0.38);
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.18), rgba(15, 23, 42, 0.52));
}

.mail-health.warn {
  border-color: rgba(251, 191, 36, 0.42);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.16), rgba(15, 23, 42, 0.52));
}

.mail-health.quiet {
  border-color: rgba(148, 163, 184, 0.26);
}


[hidden] { display: none !important; }

.install-card {
    margin-top: 1.1rem;
    padding: 1rem;
    display: grid;
    gap: .85rem;
    border: 1px solid rgba(250, 204, 21, .28);
    border-radius: 22px;
    background:
        linear-gradient(135deg, rgba(249, 115, 22, .16), rgba(59, 130, 246, .08)),
        rgba(15, 23, 42, .74);
    box-shadow: 0 18px 55px rgba(0, 0, 0, .22);
}
.install-card strong,
.install-card span {
    display: block;
}
.install-card span {
    margin-top: .25rem;
    color: #cbd5e1;
    font-size: .92rem;
    line-height: 1.4;
}
.install-card .btn {
    width: 100%;
    justify-content: center;
}
.ios-install-help {
    margin: 0;
    padding: .75rem .85rem;
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 16px;
    background: rgba(2, 6, 23, .28);
    color: #dbeafe;
}
.pwa-install-button {
    justify-self: end;
    white-space: nowrap;
}
.is-standalone .pwa-install-button,
.is-standalone .install-card {
    display: none !important;
}

/* Mobile install + iPhone/iPad hardening 1.6.0 */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    -webkit-tap-highlight-color: rgba(250, 204, 21, .18);
    overscroll-behavior-y: none;
}

button, .btn, .ghost-btn, .day-card, input, select, textarea {
    touch-action: manipulation;
}

input, select, textarea {
    font-size: max(16px, 1rem);
}

.avatar {
    background: rgba(249, 115, 22, .24);
    background: color-mix(in srgb, var(--accent) 35%, transparent);
}

.avatar.mini,
.admin-kid-head .avatar {
    background: rgba(249, 115, 22, .26);
    background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 55%, #111827), rgba(250, 204, 21, .25));
}

.install-sheet {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: end center;
    padding: 1rem;
    padding-bottom: calc(1rem + var(--safe-bottom));
    background: rgba(2, 6, 23, .72);
    backdrop-filter: blur(10px);
}

.install-sheet-card {
    position: relative;
    width: min(520px, 100%);
    border: 1px solid rgba(250, 204, 21, .32);
    border-radius: calc(var(--radius) + 4px);
    padding: 1.15rem;
    background:
        radial-gradient(circle at 12% 0%, rgba(250, 204, 21, .20), transparent 15rem),
        linear-gradient(180deg, rgba(15, 23, 42, .98), rgba(2, 6, 23, .98));
    box-shadow: var(--shadow);
}

.install-sheet-card h2 {
    margin-bottom: .75rem;
    font-size: clamp(1.55rem, 6vw, 2.2rem);
}

.install-sheet-card ol {
    display: grid;
    gap: .65rem;
    margin: 0 0 .85rem;
    padding-left: 1.25rem;
    color: #dbeafe;
}

.install-sheet-card li {
    line-height: 1.35;
}

.install-sheet-close {
    position: absolute;
    top: .75rem;
    right: .75rem;
    width: 2.35rem;
    height: 2.35rem;
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: 50%;
    color: #e2e8f0;
    background: rgba(2, 6, 23, .42);
    font-size: 1.45rem;
    line-height: 1;
}

.install-sheet-open,
.modal-open {
    overflow: hidden;
}

.day-modal[open] {
    position: fixed;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    z-index: 90;
}

@media (display-mode: standalone) {
    .pwa-install-button,
    .install-card,
    .install-sheet {
        display: none !important;
    }
}

@media (max-width: 900px) {
    .topbar {
        grid-template-columns: 1fr auto;
        align-items: start;
    }
    .topbar .logo {
        min-width: 0;
        padding-right: 4.5rem;
    }
    .topbar nav {
        grid-column: 1 / -1;
        width: 100%;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }
    .role-pill,
    .pwa-install-button {
        justify-self: start;
    }
    .pwa-install-button {
        grid-column: 1 / -1;
        width: 100%;
        border-color: rgba(250, 204, 21, .3);
        background: rgba(249, 115, 22, .13);
        color: #fef3c7;
    }
    .logout-form {
        position: absolute;
        top: .85rem;
        right: .85rem;
    }
}

@media (max-width: 640px) {
    .login-page {
        align-content: start;
        padding-top: max(1rem, env(safe-area-inset-top, 0px));
    }
    .login-card {
        padding: 1rem;
        border-radius: 24px;
    }
    .brand-ball {
        width: 4rem;
        height: 4rem;
        font-size: 2rem;
    }
    .login-card h1 {
        font-size: 2rem;
    }
    .install-card {
        padding: .9rem;
    }
    .calendar-wrap {
        margin-left: -.85rem;
        margin-right: -.85rem;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }
    .weekday-row,
    .calendar-grid {
        grid-template-columns: repeat(7, minmax(82px, 1fr));
        min-width: 610px;
    }
    .day-card {
        min-height: 94px;
        padding: .55rem;
    }
    .admin-panel,
    .admin-kid-card,
    .player-card,
    .challenge-card,
    .form-card,
    .info-card,
    .empty-state,
    .weekly-panel {
        border-radius: 20px;
    }
}
