/* Athlete Performance Tracking System portal styling. Built for coaches working fast on a phone at the gym floor,
   so tap targets stay large and the primary action on every screen is unambiguous. */

:root {
    --brand: #f04e23;
    --brand-dark: #c93c17;
    --ink: #0f1419;
    --ink-2: #303b45;
    --muted: #6b7785;
    --line: #e3e8ee;
    --surface: #ffffff;
    --canvas: #f6f8fa;
    --good: #0f9d58;
    --warn: #d98218;
    --bad: #d13438;
    --info: #2b6cb0;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(15, 20, 25, .06), 0 4px 12px rgba(15, 20, 25, .05);
}

html, body {
    font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
    background: var(--canvas);
    color: var(--ink);
    margin: 0;
}

h1, h2, h3, h4 {
    color: var(--ink);
    font-weight: 650;
    letter-spacing: -.01em;
}

h1 { font-size: 1.6rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }

a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Shell -------------------------------------------------------------- */

.page {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    flex: 0 0 250px;
    background: var(--ink);
    color: #cfd6dd;
}

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 58px;
    padding: 0 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.tenant-chip { display: flex; align-items: center; gap: .6rem; }

.tenant-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border-radius: 8px;
    color: #fff;
    font-weight: 700;
    font-size: .8rem;
}

.tenant-name { font-weight: 600; }

.top-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: .9rem;
}

.top-actions form { margin: 0; }

.role-badge {
    background: var(--canvas);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .2rem .7rem;
    font-size: .78rem;
    color: var(--muted);
}

.btn-link {
    background: none;
    border: none;
    color: var(--info);
    cursor: pointer;
    padding: 0;
    font: inherit;
}

.content {
    padding: 1.5rem;
    flex: 1;
}

/* ---- Navigation --------------------------------------------------------- */

.nav-brand {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.nav-brand .wordmark {
    font-size: 1.35rem;
    font-weight: 750;
    color: #fff;
    letter-spacing: -.02em;
}

.nav-brand .tagline {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: #7d8894;
}

.nav-section {
    padding: .9rem 1.25rem .35rem;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: #6d7883;
}

.nav-item a {
    display: block;
    padding: .55rem 1.25rem;
    color: #cfd6dd;
    font-size: .92rem;
    border-left: 3px solid transparent;
}

.nav-item a:hover {
    background: rgba(255, 255, 255, .05);
    color: #fff;
    text-decoration: none;
}

.nav-item a.active {
    background: rgba(240, 78, 35, .14);
    border-left-color: var(--brand);
    color: #fff;
    font-weight: 600;
}

/* ---- Cards and layout helpers ------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .85rem;
}

.card-head h2, .card-head h3 { margin: 0; }

.grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    align-items: start;
}

.grid.two { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.subtitle { color: var(--muted); margin: 0; font-size: .92rem; }

/* ---- Stat tiles --------------------------------------------------------- */

.stats {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    margin-bottom: 1.25rem;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: .9rem 1rem;
}

.stat .label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--muted);
}

.stat .value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.stat .hint { font-size: .78rem; color: var(--muted); }

.stat.good .value { color: var(--good); }
.stat.warn .value { color: var(--warn); }
.stat.bad .value { color: var(--bad); }

/* ---- Tables ------------------------------------------------------------- */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .92rem;
}

.table th {
    text-align: left;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    padding: .5rem .6rem;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.table td {
    padding: .6rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.table tbody tr:hover { background: #fafbfc; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

.table-scroll { overflow-x: auto; }

/* ---- Pills and badges --------------------------------------------------- */

.pill {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}

.pill.neutral { background: #eef1f5; color: var(--ink-2); }
.pill.good { background: #e4f4ea; color: #0b6b3c; }
.pill.warn { background: #fdf1de; color: #8a5407; }
.pill.bad { background: #fdeaea; color: #a1272b; }
.pill.info { background: #e7f0fa; color: #1c4e80; }
.pill.pr { background: #fff2e8; color: #b23c0c; }

.delta.up { color: var(--good); font-weight: 600; }
.delta.down { color: var(--bad); font-weight: 600; }
.delta.flat { color: var(--muted); }

/* ---- Buttons ------------------------------------------------------------ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .5rem .9rem;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    font-size: .9rem;
    font-weight: 550;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover { background: #f2f4f7; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn.primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.small { padding: .3rem .6rem; font-size: .82rem; }

/* Attendance roster: big, obvious, one-tap targets. */
.mark-group { display: inline-flex; gap: .25rem; }

.mark {
    min-width: 44px;
    padding: .45rem .5rem;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 7px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--ink-2);
    cursor: pointer;
}

.mark:hover { background: #f2f4f7; }
.mark.on.present { background: var(--good); border-color: var(--good); color: #fff; }
.mark.on.late { background: var(--warn); border-color: var(--warn); color: #fff; }
.mark.on.absent { background: var(--bad); border-color: var(--bad); color: #fff; }
.mark.on.excused { background: var(--muted); border-color: var(--muted); color: #fff; }

/* ---- Forms -------------------------------------------------------------- */

.field { margin-bottom: .9rem; }

.field label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--ink-2);
    margin-bottom: .25rem;
}

.field .hint { font-size: .78rem; color: var(--muted); margin-top: .2rem; }

.input, .select, .textarea {
    width: 100%;
    padding: .5rem .65rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: .92rem;
    background: var(--surface);
    color: var(--ink);
}

.input:focus, .select:focus, .textarea:focus {
    outline: 2px solid rgba(240, 78, 35, .35);
    border-color: var(--brand);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: flex-end;
    margin-bottom: 1rem;
}

.filters .field { margin: 0; min-width: 165px; }

/* ---- Charts ------------------------------------------------------------- */

.chart { width: 100%; height: 220px; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .series { fill: none; stroke: var(--brand); stroke-width: 2.5; }
.chart .dot { fill: var(--brand); }
.chart .dot.pr { fill: var(--good); }
.chart .gridline { stroke: var(--line); stroke-dasharray: 3 3; }
.chart text { font-size: 10px; fill: var(--muted); }

/* ---- Alerts and empty states -------------------------------------------- */

.alert-row {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    padding: .7rem 0;
    border-bottom: 1px solid var(--line);
}

.alert-row:last-child { border-bottom: none; }

.alert-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    margin-top: .4rem;
    flex: 0 0 auto;
}

.alert-dot.info { background: var(--info); }
.alert-dot.warning { background: var(--warn); }
.alert-dot.critical { background: var(--bad); }

.alert-body { flex: 1; min-width: 0; }
.alert-body .title { font-weight: 600; font-size: .92rem; }
.alert-body .detail { font-size: .85rem; color: var(--muted); }

.empty {
    padding: 1.75rem 1rem;
    text-align: center;
    color: var(--muted);
    font-size: .92rem;
}

.notice {
    padding: .7rem .9rem;
    border-radius: 8px;
    font-size: .88rem;
    margin-bottom: 1rem;
    border: 1px solid;
}

.notice.info { background: #eff5fc; border-color: #cfe0f2; color: #1c4e80; }
.notice.good { background: #eaf6ee; border-color: #cbe8d5; color: #0b6b3c; }
.notice.warn { background: #fdf6ea; border-color: #f2e0c0; color: #8a5407; }
.notice.bad { background: #fdeeee; border-color: #f4d2d3; color: #a1272b; }

/* ---- Identity pages ----------------------------------------------------- */

.validation-message, .text-danger { color: var(--bad); font-size: .85rem; }

.auth-shell {
    max-width: 460px;
    margin: 3rem auto;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: var(--bad);
    padding: 1rem;
    color: white;
    border-radius: var(--radius);
}

/* ---- Responsive --------------------------------------------------------- */

@media (max-width: 900px) {
    .page { flex-direction: column; }

    .sidebar {
        width: 100%;
        flex: none;
    }

    .content { padding: 1rem; }

    .top-row { padding: 0 1rem; }
}

/* ---- Reports ------------------------------------------------------------ */

/* The report is a document, not a dashboard: serif-free but generous, and styled so the
   screen view and the printed PDF are the same artefact. */

.report-frame { padding: 0; overflow: hidden; }

.document-shell { padding: 1.5rem; background: var(--canvas); min-height: 100vh; }

.print-toolbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    max-width: 860px;
    margin: 0 auto 1rem;
    padding: .7rem .9rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: .88rem;
    color: var(--muted);
}

.print-toolbar span { flex: 1; }

.print-page {
    max-width: 860px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.report { padding: 2rem 2.25rem; color: var(--ink); }

.report-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--report-accent);
    margin-bottom: 1.5rem;
}

.report-org {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--report-accent);
    font-weight: 700;
}

.report-title { font-size: 1.7rem; margin: .15rem 0 .35rem; }
.report-meta { margin: 0; color: var(--muted); font-size: .9rem; }
.report-stamp { text-align: right; white-space: nowrap; }

.report-kind {
    font-size: .78rem;
    font-weight: 650;
    text-transform: capitalize;
    color: var(--ink-2);
}

.report-generated { font-size: .78rem; color: var(--muted); }

.report-section { margin-bottom: 1.6rem; break-inside: avoid; }

.report-section h2 {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    padding-bottom: .3rem;
    margin-bottom: .8rem;
}

.report-callout {
    border-left: 4px solid var(--warn);
    background: #fdf6ea;
    padding: .8rem 1rem;
    border-radius: 0 8px 8px 0;
    margin-bottom: 1.5rem;
}

.report-callout h2 {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #8a5407;
    margin: 0 0 .3rem;
}

.report-callout p { margin: 0; font-size: .9rem; }

.report-figures {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.report-figure { display: flex; flex-direction: column; gap: .1rem; }

.figure-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.figure-label { font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.figure-note { font-size: .75rem; color: var(--muted); }
.figure-note.up { color: var(--good); font-weight: 600; }
.figure-note.down { color: var(--bad); font-weight: 600; }

.report-table { width: 100%; border-collapse: collapse; font-size: .88rem; }

.report-table th {
    text-align: left;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    padding: .35rem .5rem;
    border-bottom: 1px solid var(--line);
}

.report-table td {
    padding: .5rem;
    border-bottom: 1px solid #f0f3f6;
    vertical-align: top;
}

.report-table td.up { color: var(--good); font-weight: 650; }
.report-table td.down { color: var(--bad); font-weight: 650; }

.report-sub { display: block; font-size: .76rem; color: var(--muted); font-weight: 400; }
.report-empty { color: var(--muted); font-size: .88rem; font-style: italic; margin: 0; }

.report-goal { margin-bottom: .9rem; break-inside: avoid; }

.report-goal-head {
    display: flex;
    justify-content: space-between;
    font-size: .9rem;
    margin-bottom: .3rem;
}

.report-bar {
    height: 7px;
    background: #eef1f5;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: .25rem;
}

.report-bar span {
    display: block;
    height: 100%;
    background: var(--report-accent);
}

.report-note, .report-focus {
    padding: .7rem .9rem;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid var(--line);
    margin-bottom: .7rem;
    break-inside: avoid;
}

.report-note p, .report-focus p { margin: .25rem 0 0; font-size: .88rem; }

.report-note-head, .report-focus-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: baseline;
    font-size: .92rem;
}

.report-focus.urgent { border-left: 4px solid var(--bad); background: #fdeeee; }
.report-focus.recommended { border-left: 4px solid var(--warn); background: #fdf6ea; }
.report-focus.suggestion { border-left: 4px solid var(--good); background: #f2f9f4; }

.report-flag {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 700;
    color: var(--warn);
}

.report-flag.urgent { color: var(--bad); }
.report-flag.suggestion { color: var(--good); }

.report-foot {
    border-top: 1px solid var(--line);
    padding-top: .8rem;
    margin-top: 1.5rem;
    font-size: .8rem;
    color: var(--muted);
}

.report-foot p { margin: 0 0 .25rem; }

@media (max-width: 700px) {
    .report { padding: 1.25rem; }
    .report-head { flex-direction: column; }
    .report-stamp { text-align: left; }
    .report-figures { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Print -------------------------------------------------------------- */

@media print {
    .no-print, .sidebar, .top-row, #blazor-error-ui { display: none !important; }

    html, body { background: #fff; }

    .document-shell, .content { padding: 0; }

    .print-page, .report-frame, .card {
        border: none;
        box-shadow: none;
        border-radius: 0;
        margin: 0;
        max-width: none;
    }

    .report { padding: 0; }

    /* Keep a section and its heading together across a page break. */
    .report-section, .report-goal, .report-note, .report-focus { break-inside: avoid; }
    .report-table { break-inside: auto; }
    .report-table tr { break-inside: avoid; }
}

/* ---- Schedule editor ----------------------------------------------------- */

/* Checkbox rows read as a list of decisions rather than a wall of inputs. */
.field label > input[type="checkbox"] {
    margin-right: .45rem;
    vertical-align: middle;
}

.stack-check {
    display: block;
    font-weight: 400;
    font-size: .9rem;
    padding: .3rem 0;
    color: var(--ink-2);
}

.stack-check input[type="checkbox"] { margin-right: .45rem; }

.btn.danger {
    background: var(--bad);
    border-color: var(--bad);
    color: #fff;
}

.btn.danger:hover { background: #b02a2e; border-color: #b02a2e; }

.card-head > div { display: flex; align-items: center; gap: .6rem; }

/* ---- Administration ------------------------------------------------------ */

/* A disabled fieldset must not look like a styling accident. */
.bare-fieldset { border: none; margin: 0; padding: 0; }
.bare-fieldset:disabled { opacity: .6; }

.brand-preview {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .8rem;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    background: var(--canvas);
}

.brand-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    border-radius: 9px;
    background: var(--preview);
    color: #fff;
    font-weight: 700;
}

.brand-name { font-weight: 650; }

.field input[type="color"] {
    height: 38px;
    padding: .2rem;
    cursor: pointer;
}

.perm-group {
    margin: 1.25rem 0 .4rem;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
}

.perm-group:first-of-type { margin-top: 0; }

/* Shown once and never stored, so it has to be easy to select and copy. */
.setup-link {
    display: block;
    padding: .5rem .6rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: .8rem;
    word-break: break-all;
    user-select: all;
}

/* ---- Self-service portals ------------------------------------------------ */

.child-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 1.25rem;
}

.child-chip {
    padding: .4rem .85rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-size: .9rem;
    font-weight: 550;
    color: var(--ink-2);
    text-decoration: none;
}

.child-chip:hover { background: #f2f4f7; text-decoration: none; }

.child-chip.on {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.consent-request {
    padding: 1rem;
    border: 1px solid var(--line);
    border-left: 4px solid var(--warn);
    border-radius: 0 var(--radius) var(--radius) 0;
    background: #fdfaf5;
    margin-bottom: 1rem;
}

.consent-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
}

/* This is the text somebody agrees to, so it gets room to breathe. */
.consent-statement {
    margin: .6rem 0 .9rem;
    font-size: .95rem;
    line-height: 1.55;
    max-width: 62ch;
}
