:root {
    /* Brand colors, matching the iOS app's DuoColor.primary/complementary.
       --primary-ink is a darker shade for text: #13bdec itself is too
       light to read as small text on white. */
    --primary: #13bdec;
    --primary-dark: #0f9bc2;
    --primary-ink: #0a7fa0;
    --complementary: #ec4213;
    --complementary-ink: #c1360f;
    --ink: #3c3c3c;
    --body-text: #4b4b4b;
    --hairline: #e5e5e5;
    --bg: #fafafa;
    --card: #ffffff;
    --danger: #ec4213;
    --danger-bg: #fbd9d0;
    --warning: #ffc800;
    --warning-bg: #fff8e0;
    --good: #13bdec;
    --good-bg: #d0f2fb;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
}

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

.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--card);
    border-right: 1px solid var(--hairline);
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.brand {
    font-weight: 800;
    font-size: 17px;
    margin-bottom: 24px;
    color: var(--ink);
}
.brand .brand-sub {
    font-weight: 700;
    font-size: 12px;
    color: var(--primary-ink);
    letter-spacing: 0.04em;
}

.org-switch-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--body-text);
    margin-bottom: 4px;
}
.org-switch {
    width: 100%;
    padding: 10px 10px;
    border-radius: 10px;
    border: 1.5px solid var(--hairline);
    font-size: 14px;
    font-weight: 600;
    background: var(--bg);
    color: var(--ink);
    margin-bottom: 8px;
}

.plan-badge {
    font-size: 12px;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    width: fit-content;
}
.plan-teacher { background: var(--good-bg); color: var(--primary-ink); }
.plan-school { background: #f3e6ff; color: #a568cc; }

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.nav-item {
    text-align: left;
    padding: 10px 12px;
    border-radius: 10px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: var(--body-text);
    cursor: pointer;
}
.nav-item:hover { background: var(--bg); }
.nav-item.active { background: var(--good-bg); color: var(--primary-ink); }

.sidebar-note {
    margin-top: auto;
    font-size: 12px;
    color: var(--body-text);
    line-height: 1.5;
    padding-top: 20px;
    border-top: 1px solid var(--hairline);
}

.content {
    flex: 1;
    padding: 40px 48px;
    max-width: 760px;
}

h1 {
    font-size: 24px;
    font-weight: 800;
    margin: 0 0 4px;
}
.subtitle {
    color: var(--body-text);
    font-size: 14px;
    margin: 0 0 24px;
}

.card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.weak-row {
    background: var(--card);
    border: 1.5px solid var(--hairline);
    border-radius: 14px;
    padding: 14px 16px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
}
.weak-row-label {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 14px;
}
.muted { color: var(--body-text); font-weight: 500; font-size: 13px; }

.bar-track {
    height: 8px;
    background: var(--hairline);
    border-radius: 6px;
    overflow: hidden;
}
.bar-fill { height: 100%; border-radius: 6px; }
.bar-fill.good { background: var(--good); }
.bar-fill.warning { background: var(--warning); }
.bar-fill.danger { background: var(--danger); }
.bar-pct { font-weight: 800; font-size: 13px; text-align: right; }
.bar-pct.good { color: var(--primary-ink); }
.bar-pct.warning { color: #b48a00; }
.bar-pct.danger { color: var(--danger); }

.student-row {
    width: 100%;
    text-align: left;
    background: var(--card);
    border: 1.5px solid var(--hairline);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    color: var(--ink);
}
.student-row:hover { border-color: var(--primary); }

.row-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.streak-chip {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 8px;
}
.streak-active { background: var(--danger-bg); color: var(--complementary-ink); }
.streak-none { background: var(--bg); color: var(--body-text); }

.back-link {
    background: none;
    border: none;
    color: var(--primary-ink);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    margin-bottom: 16px;
}

.empty {
    color: var(--body-text);
    font-size: 13px;
    padding: 8px 2px;
}

.code {
    font-family: ui-monospace, "SF Mono", monospace;
    letter-spacing: 0.02em;
}

.primary-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 3px 0 var(--primary-dark);
}
.primary-btn:active { box-shadow: 0 1px 0 var(--primary-dark); transform: translateY(2px); }

.class-code-card {
    background: var(--card);
    border: 1px solid var(--hairline);
    border-radius: 16px;
    padding: 24px;
    max-width: 340px;
    text-align: center;
}
.class-code-card .qr svg { width: 220px; height: 220px; display: block; margin: 0 auto; }
.class-code { font-size: 30px; font-weight: 800; margin-top: 10px; }
.print-only { display: none; }
.print-title { font-weight: 800; font-size: 20px; margin: 8px 0 12px; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.secondary-btn {
    background: var(--card);
    border: 1.5px solid var(--hairline);
    border-radius: 10px;
    padding: 10px 18px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}
.secondary-btn { color: var(--ink, inherit); }
.remove-btn { color: var(--complementary); }

/* Printing the Class code page prints just the card, big enough to pin up. */
@media print {
    .sidebar, .content > h1, .content > .subtitle, .button-row, .content > .empty { display: none !important; }
    .shell { display: block !important; }
    .class-code-card { border: none; margin: 40px auto; max-width: none; }
    .class-code-card .qr svg { width: 320px; height: 320px; }
    .print-only { display: block; }
}

/* Sign-in gate (live mode) */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.gate-card { background: var(--card); border: 1px solid var(--hairline); border-radius: 16px; padding: 28px; width: 100%; max-width: 380px; }
.gate-card .brand { margin-bottom: 20px; }
.gate-form { display: flex; flex-direction: column; gap: 6px; }
.gate-form label { font-size: 12px; font-weight: 700; color: var(--body-text); margin-top: 6px; }
.gate-form input { padding: 10px; border-radius: 10px; border: 1.5px solid var(--hairline); font-size: 14px; }
.gate-form .primary-btn { margin-top: 14px; }
.gate-note { color: var(--body-text); font-size: 13px; line-height: 1.5; }
.form-error { color: var(--complementary-ink); font-weight: 600; font-size: 13px; width: 100%; }
.sign-out { margin-top: auto; background: none; border: none; padding: 8px 10px; text-align: left; color: var(--primary-ink); font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; }

/* Songfish wordmark (logo 1d). Always on a light background. */
.wordmark { font-family: "Baloo 2", ui-rounded, system-ui, sans-serif; font-weight: 800; line-height: 1; letter-spacing: -0.01em; display: inline-flex; align-items: baseline; white-space: nowrap; }
.wm-song { color: #0a3342; }
.wm-fish { color: #13bdec; }
.wm-i { position: relative; }
.wm-i::after { content: ""; position: absolute; left: 50%; top: 0.045em; width: 0.26em; height: 0.2em; margin-left: -0.13em; border-radius: 50%; background: #ec4213; transform: rotate(-20deg); }
.brand-sub { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin-top: 4px; }

/* Sign-in gate: tabs, school enquiry */
.gate-tabs { display: flex; gap: 4px; background: var(--bg); border-radius: 14px; padding: 4px; margin-bottom: 14px; }
.gate-tab { flex: 1; height: 38px; border: none; border-radius: 11px; background: transparent; font: inherit; font-weight: 800; font-size: 13px; color: var(--body-text); cursor: pointer; }
.gate-tab.active { background: var(--primary); color: #fff; }
.gate-title { font-size: 20px; margin: 0 0 6px; color: var(--ink); }
.gate-form select, .gate-form textarea { padding: 10px; border-radius: 10px; border: 1.5px solid var(--hairline); font: inherit; font-size: 14px; background: #fff; }
.gate-check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; font-weight: 700; color: var(--ink); margin-top: 10px; line-height: 1.4; }
.gate-check input { margin-top: 2px; }
.form-notice { color: var(--primary-ink); font-weight: 600; font-size: 13px; line-height: 1.45; }

/* Teachers page (school owners invite teachers) */
.section-title { font-size: 16px; margin: 22px 0 4px; }
.row-actions { grid-column: 1 / -1; display: flex; gap: 6px; }
.row-actions .secondary-btn { padding: 6px 12px; font-size: 13px; }
.invite-form { display: flex; gap: 8px; margin-top: 8px; max-width: 480px; }
.invite-form input { flex: 1; border: 1.5px solid var(--hairline); border-radius: 10px; padding: 10px 12px; font-size: 14px; }

/* Whose students: My students | Whole school */
.scope-switch { margin: 4px 0 10px; }
.student-teacher { display: block; font-size: 12px; margin-top: 2px; }
