:root {
    --bg: #e7efee;
    --ink: #0e171b;
    --muted: #53656d;
    --line: rgba(255, 255, 255, .44);
    --panel: rgba(255, 255, 255, .34);
    --primary: #0c6070;
    --primary-strong: #092f38;
    --accent: #c99a5d;
    --plum: #49345d;
    --aqua: #77c8ca;
    --glass-edge: rgba(255, 255, 255, .72);
    --danger: #a7353d;
    --success: #257454;
    --surface: #f8fbfa;
    --shadow: 0 34px 110px rgba(11, 24, 31, .24);
    --soft-shadow: 0 20px 64px rgba(11, 24, 31, .18);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
    font-size: 16px;
    background:
        radial-gradient(circle at 14% 10%, rgba(119, 200, 202, .34), transparent 28%),
        radial-gradient(circle at 86% 12%, rgba(201, 154, 93, .30), transparent 28%),
        radial-gradient(circle at 74% 82%, rgba(73, 52, 93, .20), transparent 34%),
        linear-gradient(135deg, #fbfcfb 0%, #e8f1ef 44%, #dce7e8 100%),
        var(--bg);
    color: var(--ink);
    background-attachment: fixed;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background:
        linear-gradient(120deg, transparent 0 16%, rgba(255,255,255,.32) 18%, transparent 22% 100%),
        linear-gradient(300deg, transparent 0 52%, rgba(255,255,255,.20) 55%, transparent 60% 100%);
    mix-blend-mode: screen;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: .30;
    background-image:
        linear-gradient(rgba(255,255,255,.35) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.22) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(circle at 50% 24%, #000 0%, transparent 68%);
}

a {
    color: inherit;
    text-decoration: none;
}

.shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0 64px;
}

.hero {
    min-height: 280px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    align-items: end;
    padding: 34px;
    color: #fff;
    background:
        linear-gradient(rgba(10, 41, 37, .72), rgba(10, 41, 37, .62)),
        url("https://images.unsplash.com/photo-1581093588401-fbb62a02f120?auto=format&fit=crop&w=1600&q=80") center/cover;
    border-radius: 8px;
}

.hero h1,
.panel h1,
.panel h2,
.login-panel h1 {
    margin: 0 0 10px;
    line-height: 1.05;
}

.hero h1 {
    max-width: 850px;
    font-size: 42px;
}

.hero p {
    max-width: 760px;
    margin: 0;
    color: rgba(255,255,255,.86);
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.panel,
.login-panel {
    margin-top: 18px;
    padding: 26px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

hr {
    width: 100%;
    margin: 22px 0;
    border: 0;
    border-top: 1px solid var(--line);
}

.student-start {
    display: grid;
    gap: 20px;
    max-width: 760px;
    margin: 62px auto;
    perspective: 1200px;
}

.course-box {
    position: relative;
    overflow: hidden;
    padding: 38px 34px 36px;
    background:
        linear-gradient(135deg, rgba(255,255,255,.72), rgba(255,255,255,.26)),
        linear-gradient(180deg, rgba(255,255,255,.38), rgba(255,255,255,.12));
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 18px;
    text-align: center;
    box-shadow:
        var(--soft-shadow),
        inset 0 1px 0 rgba(255,255,255,.78),
        inset 0 -1px 0 rgba(255,255,255,.20);
    backdrop-filter: blur(30px) saturate(155%);
}

.course-box > * {
    position: relative;
    z-index: 1;
}

.course-box .eyebrow,
.course-box h1 {
    text-shadow: 0 1px 0 rgba(255,255,255,.65);
}

.course-box::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 6px;
    background:
        linear-gradient(90deg, rgba(119,200,202,.95), rgba(12,96,112,.95), rgba(201,154,93,.95), rgba(73,52,93,.95));
    box-shadow: 0 8px 26px rgba(12, 96, 112, .22);
}

.course-box::after {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: 17px;
    pointer-events: none;
    background:
        linear-gradient(125deg, rgba(255,255,255,.76), transparent 28%),
        radial-gradient(circle at 88% 24%, rgba(255,255,255,.48), transparent 18%);
    opacity: .68;
}

.course-box h1 {
    margin: 0;
    color: #11181b;
    font-size: clamp(38px, 5.4vw, 58px);
    font-weight: 780;
    line-height: .98;
}

.start-card {
    position: relative;
    overflow: hidden;
    margin-top: 0;
    padding: 34px;
    background:
        linear-gradient(145deg, rgba(255,255,255,.46), rgba(255,255,255,.15)),
        linear-gradient(180deg, rgba(255,255,255,.24), rgba(255,255,255,.08));
    border: 1px solid rgba(255,255,255,.70);
    border-radius: 18px;
    box-shadow:
        0 34px 110px rgba(8, 25, 32, .22),
        inset 0 1px 0 rgba(255,255,255,.76),
        inset 0 -1px 0 rgba(255,255,255,.16);
    backdrop-filter: blur(34px) saturate(165%);
}

.start-card::before {
    content: "";
    position: absolute;
    inset: 1px;
    pointer-events: none;
    border-radius: 17px;
    background:
        linear-gradient(122deg, rgba(255,255,255,.76), transparent 27%),
        radial-gradient(circle at 96% 4%, rgba(255,255,255,.52), transparent 22%),
        linear-gradient(305deg, rgba(255,255,255,.28), transparent 46%);
    opacity: .72;
}

.start-card::after {
    content: "";
    position: absolute;
    left: 34px;
    right: 34px;
    top: 0;
    height: 1px;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.95), transparent);
}

.start-card > * {
    position: relative;
    z-index: 1;
}

.start-card .muted {
    margin: 18px 0 0;
    max-width: 560px;
    color: #5b686c;
    line-height: 1.55;
}

.start-form {
    --start-field-font: 20px;
    width: min(100%, 320px);
    margin: 0 auto;
    gap: 10px;
}

.start-field {
    gap: 6px;
    color: #10191d;
    font-size: 19px;
    font-weight: 820;
    text-align: center;
}

.start-field input {
    min-height: 44px;
    padding: 8px 14px;
    border: 1.5px solid rgba(9, 47, 56, .86);
    border-radius: 7px;
    background: rgba(255,255,255,.58);
    color: #11181b;
    font-size: var(--start-field-font);
    font-weight: 520;
    text-align: center;
}

.start-field input::placeholder {
    color: rgba(17, 24, 27, .26);
    opacity: 1;
    text-align: center;
}

.start-field input:disabled {
    color: rgba(17, 24, 27, .54);
    background: rgba(255,255,255,.28);
    border-color: rgba(9, 47, 56, .34);
}

.start-form .button.primary {
    position: relative;
    isolation: isolate;
    width: 100%;
    min-height: 44px;
    border-color: rgba(9, 47, 56, .86);
    border-radius: 7px;
    font-size: 20px;
    font-weight: 520;
}

.start-form .button.primary::before {
    content: "";
    position: absolute;
    inset: -8px;
    z-index: -1;
    border-radius: 14px;
    background:
        radial-gradient(circle at 50% 50%, rgba(119, 200, 202, .48), transparent 68%),
        linear-gradient(90deg, rgba(201, 154, 93, .24), rgba(119, 200, 202, .24));
    opacity: 0;
    filter: blur(10px);
    transition: opacity .25s ease;
}

.start-form .button.primary.is-ready {
    box-shadow:
        0 20px 48px rgba(12, 96, 112, .30),
        inset 0 1px 0 rgba(255,255,255,.42);
}

.start-form .button.primary.is-ready::before {
    opacity: 1;
    animation: readyButtonGlow 1.65s ease-in-out infinite;
}

.start-form .button.primary:disabled {
    opacity: .48;
    cursor: not-allowed;
    transform: none;
}

.start-form .button.primary:disabled::before {
    display: none;
}

.student-name-box {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 8px 10px;
    border: 1.5px solid rgba(9, 47, 56, .86);
    border-radius: 7px;
    background: rgba(255,255,255,.58);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.62),
        0 10px 24px rgba(8, 25, 32, .06);
    color: #11181b;
    font-size: var(--start-field-font);
    font-weight: 520;
    line-height: 1.1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
}

.sample-upload-card {
    position: relative;
    overflow: hidden;
    width: 100%;
    margin: 8px 0 20px;
    border: 1.5px solid rgba(9, 47, 56, .86);
    border-radius: 26px;
    background:
        linear-gradient(145deg, rgba(255,255,255,.58), rgba(255,255,255,.22)),
        rgba(238, 247, 244, .30);
    box-shadow:
        0 18px 44px rgba(8, 25, 32, .18),
        inset 0 1px 0 rgba(255,255,255,.74);
    transition: opacity .18s ease, filter .18s ease, transform .18s ease;
}

.sample-upload-card::before {
    content: "";
    position: absolute;
    inset: 10px;
    border: 1px dashed rgba(9, 47, 56, .78);
    border-radius: 20px;
    pointer-events: none;
}

.sample-upload-card.is-disabled {
    opacity: .45;
    filter: grayscale(.18);
}

.sample-upload-drop {
    min-height: 180px;
    display: grid;
    place-items: center;
    margin: 0;
    padding: 18px;
    cursor: pointer;
}

.sample-upload-drop input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
}

.sample-upload-empty {
    display: grid;
    place-items: center;
    gap: 14px;
    color: var(--primary-strong);
    text-align: center;
}

.sample-upload-empty strong {
    padding: 7px 14px;
    border: 1px solid rgba(9, 47, 56, .20);
    border-radius: 0;
    background: rgba(255,255,255,.70);
    color: #1f292d;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    box-shadow: 0 6px 18px rgba(8, 25, 32, .10);
}

.sample-camera {
    position: relative;
    width: 82px;
    height: 62px;
    border: 3px solid var(--primary-strong);
    border-radius: 12px;
}

.sample-camera::before {
    content: "";
    position: absolute;
    left: 22px;
    top: -12px;
    width: 34px;
    height: 14px;
    border: 3px solid var(--primary-strong);
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
}

.sample-camera::after {
    content: "";
    position: absolute;
    left: 22px;
    top: 13px;
    width: 32px;
    height: 32px;
    border: 3px solid var(--primary-strong);
    border-radius: 50%;
    box-shadow: inset 0 0 0 4px rgba(119, 200, 202, .18), 34px -11px 0 -13px var(--primary-strong);
}

.sample-upload-preview {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 22px;
    box-shadow: 0 18px 46px rgba(8, 25, 32, .22);
    background: rgba(8, 25, 32, .10);
}

.sample-upload-card.has-preview {
    border-radius: 24px;
    background:
        linear-gradient(145deg, rgba(255,255,255,.32), rgba(255,255,255,.12)),
        rgba(8, 25, 32, .10);
}

.sample-upload-card.has-preview::before {
    display: none;
}

.sample-upload-card.has-preview::after {
    display: none;
}

.sample-upload-card.has-preview .sample-upload-drop {
    position: relative;
    min-height: 184px;
    padding: 0;
}

.sample-upload-card.has-preview .sample-upload-empty {
    display: none;
}

.change-image-button {
    width: fit-content;
    justify-self: center;
    margin: -10px auto 12px;
    padding: 5px 12px;
    border: 1px solid rgba(9, 47, 56, .28);
    border-radius: 999px;
    background: rgba(255,255,255,.48);
    color: var(--primary-strong);
    font-size: 12px;
    font-weight: 760;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(8, 25, 32, .08);
}

.change-image-button:hover {
    background: rgba(255,255,255,.78);
}

@keyframes readyButtonGlow {
    0%, 100% {
        opacity: .45;
        transform: scale(.985);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

.master-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
    gap: 18px;
    align-items: stretch;
    padding: 24px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.master-header h1 {
    margin: 0 0 8px;
    font-size: 30px;
    line-height: 1.08;
}

.sample-side {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px;
    gap: 10px;
    align-items: stretch;
}

.sample-card {
    display: grid;
    place-items: center;
    gap: 8px;
    min-height: 132px;
    padding: 18px;
    border: 1px solid #b9d4ce;
    border-radius: 8px;
    background: #eef7f4;
    text-align: center;
}

.sample-card span {
    color: var(--muted);
    font-weight: 700;
}

.sample-card strong {
    font-size: 30px;
    color: var(--primary-strong);
}

.sample-image-thumb {
    width: 100%;
    min-height: 132px;
    padding: 0;
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 12px;
    background: rgba(255,255,255,.45);
    box-shadow:
        0 16px 38px rgba(8, 25, 32, .16),
        inset 0 1px 0 rgba(255,255,255,.76);
    backdrop-filter: blur(18px);
    cursor: zoom-in;
    transition:
        inset .32s ease,
        width .32s ease,
        height .32s ease,
        transform .32s ease,
        background-color .32s ease,
        box-shadow .32s ease;
}

.sample-image-thumb img {
    width: 100%;
    height: 132px;
    display: block;
    object-fit: contain;
    border-radius: 11px;
    transition: height .32s ease, object-fit .32s ease;
    background: rgba(8, 25, 32, .08);
}

.sample-image-empty {
    min-height: 132px;
    display: grid;
    place-items: center;
    padding: 16px;
    border: 1px dashed #b9d4ce;
    border-radius: 12px;
    background: rgba(238, 247, 244, .72);
    color: var(--muted);
    text-align: center;
    font-weight: 700;
}

body.sample-image-open {
    overflow: hidden;
}

body.sample-image-open::before {
    display: none;
}

.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
    padding: 0;
    background: #050d11;
    cursor: zoom-out;
}

.image-lightbox img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100vw;
    max-height: 100vh;
    object-fit: contain;
    object-position: center center;
    image-rendering: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

.sample-image-thumb.is-expanded {
    position: fixed;
    inset: 0;
    z-index: 1000;
    width: 100vw;
    height: 100vh;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #050d11;
    box-shadow: 0 42px 130px rgba(0,0,0,.48);
    cursor: zoom-out;
}

.sample-upload-card.is-expanded {
    position: fixed;
    inset: 0;
    z-index: 1000;
    width: 100vw;
    height: 100vh;
    margin: 0;
    border: 0;
    border-radius: 0;
    display: grid;
    place-items: center;
    background: #050d11;
    box-shadow: none;
    cursor: zoom-out;
}

.sample-upload-card.is-expanded .sample-upload-drop,
.test-image-upload.is-expanded .sample-upload-drop,
.sample-upload-card.has-preview.is-expanded .sample-upload-drop {
    width: 100%;
    height: 100%;
    min-height: 100vh;
    padding: 0;
}

.sample-upload-card.is-expanded .sample-upload-preview {
    position: static !important;
    inset: auto;
    width: auto !important;
    height: auto !important;
    max-width: 100vw;
    max-height: 100vh;
    object-fit: contain !important;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.sample-image-thumb.is-expanded img {
    width: auto !important;
    height: auto !important;
    max-width: 100vw;
    max-height: 100vh;
    object-fit: contain !important;
    border-radius: 0;
    background: transparent;
}

.instruction-panel p {
    max-width: 980px;
    margin: 0 0 12px;
    color: #2d3a37;
    line-height: 1.55;
}

.status-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.status-legend span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.status-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: #fff;
    font-size: 19px;
    font-weight: 800;
    line-height: 1;
}

.status-mark.reviewed {
    background: var(--success);
}

.status-mark.pending {
    background: var(--danger);
}

.analysis-menu {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 18px;
}

.analysis-card {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    align-content: stretch;
    gap: 18px;
    min-height: 420px;
    padding: 22px;
    background: #fff;
    border: 1px solid rgba(9, 47, 56, .18);
    border-radius: 8px;
    box-shadow: 0 14px 36px rgba(13, 43, 52, .08);
}

.analysis-card-head {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.analysis-card-head h2 {
    margin: 0;
    font-size: 22px;
}

.analysis-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 22px;
    font-weight: 800;
}

.analysis-subgroup {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px;
    padding: 14px;
    border: 2px solid rgba(12, 96, 112, .22);
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(255,255,255,.82), rgba(242, 248, 249, .78));
}

.analysis-subgroup h3 {
    margin: 0;
    color: var(--primary-strong);
    font-size: 17px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(12, 96, 112, .16);
}

.analysis-list {
    display: grid;
    gap: 10px;
}

.analysis-card-direct .analysis-list {
    grid-template-rows: repeat(4, minmax(0, 1fr));
}

.analysis-card-direct .analysis-item {
    height: 100%;
    min-height: 82px;
}

.analysis-card-solutions {
    grid-template-rows: auto repeat(2, minmax(0, 1fr));
}

.analysis-card-solutions .analysis-list {
    grid-auto-rows: minmax(86px, 1fr);
}

.analysis-card-solutions .analysis-item {
    height: 100%;
    min-height: 86px;
}

.analysis-item {
    display: grid;
    grid-template-columns: 28px minmax(0, .82fr) minmax(220px, 1fr);
    gap: 12px;
    align-items: center;
    min-height: 64px;
    padding: 12px;
    border: 2px solid rgba(12, 96, 112, .24);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255,255,255,.98), rgba(247, 251, 251, .94));
    color: var(--ink);
    font: inherit;
    font-weight: 700;
    text-align: left;
}

.analysis-item-missing {
    border-color: rgba(183, 42, 54, .92) !important;
    background:
        linear-gradient(180deg, rgba(255,246,246,.98), rgba(253,232,234,.94)) !important;
    box-shadow: 0 0 0 4px rgba(183, 42, 54, .12);
}

.analysis-missing-list {
    grid-column: 2 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.analysis-missing-list[hidden] {
    display: none;
}

.analysis-missing-list span {
    padding: 4px 8px;
    border-radius: 999px;
    background: #b72a36;
    color: #fff;
    font-size: .78rem;
    font-weight: 850;
}

.master-submit-zone {
    display: grid;
    justify-items: center;
    gap: 8px;
    margin: 18px 0 4px;
}

.master-submit-zone .button {
    min-width: min(100%, 320px);
}

.master-submit-zone .button.is-ready {
    box-shadow:
        0 0 0 5px rgba(38, 164, 95, .16),
        0 18px 44px rgba(18, 126, 78, .32),
        inset 0 1px 0 rgba(255,255,255,.36);
    animation: readyButtonGlow 1.65s ease-in-out infinite;
}

.resolution-panel {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.resolution-panel[hidden] {
    display: none;
}

.resolution-title-card {
    min-height: 62px;
    display: grid;
    place-items: center;
    padding: 16px;
    border: 1px solid rgba(12, 96, 112, .22);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255,255,255,.82), rgba(234, 247, 244, .76));
    color: var(--primary-strong);
    font-size: clamp(1.15rem, 2vw, 1.55rem);
    font-weight: 900;
    text-align: center;
    box-shadow:
        0 18px 42px rgba(8, 34, 42, .08),
        inset 0 1px 0 rgba(255,255,255,.82);
}

.resolution-block {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid rgba(12, 96, 112, .20);
    border-radius: 12px;
    background: rgba(255,255,255,.58);
    box-shadow:
        0 16px 36px rgba(8, 34, 42, .07),
        inset 0 1px 0 rgba(255,255,255,.72);
}

.resolution-block h2 {
    margin: 0;
    color: var(--primary-strong);
    font-size: 1.15rem;
    text-align: center;
}

.resolution-cations {
    display: grid;
    grid-template-columns: minmax(220px, .42fr) minmax(0, 1fr);
    gap: 16px;
}

.resolution-cation-list {
    display: grid;
    align-content: center;
    gap: 14px;
    margin: 0;
    min-height: 172px;
    padding: 18px;
    border: 1px solid rgba(12, 96, 112, .24);
    border-radius: 10px;
    background: rgba(255,255,255,.72);
}

.resolution-cation-list label {
    display: grid;
    grid-template-columns: 22px 1fr;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
}

.resolution-cation-list input {
    width: 20px;
    height: 20px;
}

.resolution-justification {
    min-height: 172px;
}

.resolution-justification textarea,
.resolution-anion-row textarea {
    min-height: 100%;
    height: 100%;
}

.resolution-anion-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.resolution-anion-heading h2 {
    flex: 1;
}

.resolution-anion-control {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border: 1px solid rgba(12, 96, 112, .18);
    border-radius: 999px;
    background: rgba(255,255,255,.62);
    color: var(--primary-strong);
}

.anion-count-toggle {
    display: inline-grid;
    grid-template-columns: repeat(2, 54px);
    padding: 4px;
    border-radius: 999px;
    background: rgba(9, 47, 56, .10);
}

.anion-count-toggle button {
    min-height: 38px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--primary-strong);
    font: inherit;
    font-weight: 900;
    cursor: pointer;
}

.anion-count-toggle button.is-active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 18px rgba(12, 96, 112, .22);
}

.resolution-anion-list {
    display: grid;
    gap: 14px;
}

.resolution-anion-row {
    display: grid;
    grid-template-columns: minmax(220px, .38fr) minmax(0, 1fr);
    gap: 16px;
    min-height: 148px;
    padding: 16px;
    border: 1px solid rgba(12, 96, 112, .18);
    border-radius: 10px;
    background: rgba(255,255,255,.66);
}

.resolution-anion-select,
.resolution-anion-justification {
    display: grid;
    align-content: stretch;
    gap: 8px;
    min-height: 100%;
}

.resolution-anion-select {
    align-content: center;
}

.resolution-anion-row select {
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0 12px;
    background: rgba(255,255,255,.86);
    color: var(--ink);
    font: inherit;
    font-weight: 800;
}

.resolution-submit-zone {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 6px 0 0;
}

.resolution-submit-zone .button {
    min-width: min(100%, 340px);
}

.resolution-submit-zone .button.is-ready {
    box-shadow:
        0 0 0 5px rgba(38, 164, 95, .16),
        0 18px 44px rgba(18, 126, 78, .32),
        inset 0 1px 0 rgba(255,255,255,.36);
    animation: readyButtonGlow 1.65s ease-in-out infinite;
}

.final-submit-dialog {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(5, 13, 17, .58);
    backdrop-filter: blur(10px);
}

.final-submit-dialog[hidden] {
    display: none;
}

.final-submit-card {
    width: min(100%, 460px);
    display: grid;
    gap: 16px;
    padding: 24px;
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(237, 247, 244, .92));
    box-shadow: 0 28px 90px rgba(0,0,0,.28);
    text-align: center;
}

.final-submit-card h2 {
    margin: 0;
    color: var(--primary-strong);
}

.final-submit-card p {
    margin: 0;
    color: var(--ink);
    font-weight: 800;
    line-height: 1.45;
}

.final-submit-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.database-choice-actions {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
}

.database-choice-actions [hidden] {
    display: none !important;
}

.database-dialog-note {
    padding: 10px 12px;
    border: 1px solid rgba(7, 48, 64, .16);
    border-radius: 10px;
    background: rgba(255,255,255,.56);
    color: var(--ink);
    font-weight: 800;
}

.database-dialog-note strong {
    color: var(--primary-strong);
}

.roster-load-card {
    width: min(100%, 560px);
    text-align: left;
}

.roster-load-card h2,
.roster-load-card p {
    text-align: center;
}

.roster-description-field {
    display: grid;
    gap: 8px;
    color: var(--ink);
    font-weight: 900;
}

.roster-description-field textarea {
    min-height: 92px;
    padding: 12px 14px;
    border: 1px solid rgba(7, 48, 64, .34);
    border-radius: 10px;
    background: rgba(255,255,255,.78);
    color: var(--ink);
    font: inherit;
    resize: vertical;
}

.roster-description-field textarea::placeholder {
    color: rgba(25, 37, 42, .42);
}

.database-busy-dialog {
    position: fixed;
    inset: 0;
    z-index: 4200;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(5, 13, 17, .62);
    backdrop-filter: blur(12px);
}

.database-busy-dialog[hidden] {
    display: none;
}

.database-busy-card {
    width: min(100%, 520px);
    display: grid;
    gap: 14px;
    padding: 26px;
    border: 1px solid rgba(255,255,255,.68);
    border-radius: 16px;
    background:
        linear-gradient(135deg, rgba(255,255,255,.96), rgba(232, 246, 243, .92)),
        radial-gradient(circle at top left, rgba(38, 164, 95, .18), transparent 42%);
    box-shadow: 0 30px 95px rgba(0,0,0,.32);
    text-align: center;
}

.database-busy-card h2,
.database-busy-card p {
    margin: 0;
}

.database-busy-card h2 {
    color: var(--primary-strong);
}

.database-busy-card > p:not(.eyebrow) {
    color: var(--ink);
    font-weight: 900;
    line-height: 1.45;
}

.database-progress {
    position: relative;
    overflow: hidden;
    height: 34px;
    border: 1px solid rgba(7, 48, 64, .26);
    border-radius: 999px;
    background: rgba(226, 236, 233, .92);
    box-shadow: inset 0 1px 3px rgba(0,0,0,.08);
}

.database-progress span {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, #1b7c72, #2fc177);
    transition: width .28s ease;
}

.database-progress strong {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    color: #062f33;
    font-weight: 1000;
    text-shadow: 0 1px 0 rgba(255,255,255,.45);
}

.database-busy-detail {
    min-height: 20px;
    color: var(--muted) !important;
    font-size: .92rem;
    font-weight: 800 !important;
}

.student-shutdown-dialog {
    position: fixed;
    inset: 0;
    z-index: 4300;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(5, 13, 17, .64);
    backdrop-filter: blur(12px);
}

.student-shutdown-card {
    width: min(100%, 520px);
    display: grid;
    gap: 16px;
    padding: 26px;
    border: 1px solid rgba(255,255,255,.68);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(232, 246, 243, .92));
    box-shadow: 0 30px 95px rgba(0,0,0,.32);
    text-align: center;
}

.student-shutdown-card h2,
.student-shutdown-card p {
    margin: 0;
}

.student-shutdown-card h2 {
    color: var(--primary-strong);
}

.student-shutdown-card p {
    color: var(--ink);
    font-weight: 900;
    line-height: 1.45;
}

.student-shutdown-card .button {
    justify-self: center;
    min-width: 170px;
}

.inactive-system-dialog {
    position: fixed;
    inset: 0;
    z-index: 4400;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(5, 13, 17, .62);
    backdrop-filter: blur(12px);
}

.inactive-system-card {
    width: min(100%, 460px);
    display: grid;
    justify-items: center;
    gap: 16px;
    padding: 26px;
    border: 1px solid rgba(255,255,255,.68);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(247, 238, 232, .92));
    box-shadow: 0 30px 95px rgba(0,0,0,.32);
    text-align: center;
}

.inactive-system-card h2,
.inactive-system-card p {
    margin: 0;
}

.inactive-system-card h2 {
    color: #9f1f2f;
}

.inactive-system-card p {
    color: var(--ink);
    font-weight: 900;
    line-height: 1.45;
}

.inactive-system-card .button {
    min-width: 160px;
}

.analysis-card-direct .analysis-item {
    border-left: 6px solid rgba(12, 96, 112, .72);
}

.analysis-subgroup .analysis-item {
    border-left: 6px solid rgba(201, 154, 93, .78);
}

.analysis-copy,
.analysis-result {
    min-width: 0;
}

.analysis-copy {
    overflow: hidden;
}

.analysis-copy {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.analysis-result {
    justify-self: end;
    max-width: 100%;
    padding: 6px 9px;
    border-radius: 999px;
    background: #e8f4ef;
    color: var(--success);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    display: block;
}

.analysis-item-multi {
    height: auto;
    min-height: 112px;
}

.analysis-card-direct .analysis-item-multi,
.analysis-card-solutions .analysis-item-multi {
    min-height: 112px;
}

.analysis-result-lines {
    display: grid;
    gap: 3px;
    width: 100%;
    border-radius: 10px;
    text-align: left;
}

.analysis-result-lines span {
    white-space: normal;
    overflow-wrap: anywhere;
}

.analysis-item:hover {
    border-color: rgba(12, 96, 112, .72);
    background: #f3faf8;
    box-shadow: 0 10px 24px rgba(12, 96, 112, .11);
}

.test-title-panel {
    padding: 24px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    text-align: center;
}

.test-title-panel h1 {
    margin: 0 0 8px;
    font-size: 32px;
    line-height: 1.1;
}

.test-form {
    margin-top: 18px;
}

.procedure-box {
    width: min(760px, 100%);
    margin: 0 auto;
    padding: 24px;
    background: #fff;
    border: 1px solid #b9d4ce;
    border-radius: 8px;
    text-align: center;
}

.procedure-box p:last-child {
    margin: 0;
    color: #2d3a37;
    line-height: 1.55;
}

.result-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.result-options.options-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.result-option {
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    justify-items: center;
    min-height: 64px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfc;
    text-align: center;
}

.result-option:has(input:checked) {
    border-color: rgba(35, 143, 83, .95);
    background:
        linear-gradient(135deg, #26a45f, #087a4d),
        #118653;
    color: #fff;
    box-shadow:
        0 16px 34px rgba(18, 126, 78, .30),
        inset 0 1px 0 rgba(255,255,255,.28);
}

.result-option:has(input:checked) span {
    color: #fff;
    font-weight: 850;
}

.result-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 18px;
    height: 18px;
}

.multipart-results {
    display: grid;
    gap: 22px;
}

.multipart-result-block {
    display: grid;
    gap: 14px;
    padding: 18px;
    border: 1px solid rgba(255,255,255,.54);
    border-radius: 16px;
    background: rgba(255,255,255,.32);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}

.multipart-result-block h2 {
    margin: 0;
    color: var(--ink);
    font-size: 1.12rem;
    text-align: center;
}

.multipart-result-block .test-image-upload {
    margin-top: 2px;
}

.multipart-evidence-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: stretch;
}

.multipart-observation {
    display: grid;
    grid-template-rows: auto 1fr;
}

.multipart-observation textarea {
    min-height: 260px;
    height: 100%;
}

.evidence-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.description-only-grid {
    grid-template-columns: minmax(0, 1fr);
}

.evidence-panel,
.description-panel {
    margin-top: 0;
}

.description-panel {
    display: grid;
}

.description-panel label {
    grid-template-rows: auto 1fr;
}

.image-drop {
    display: grid;
    gap: 10px;
    place-items: center;
    min-height: 88px;
    padding: 16px;
    border: 1px dashed #9eb8b1;
    border-radius: 8px;
    background: #f8fbfa;
    text-align: center;
    color: var(--primary-strong);
}

.image-drop input {
    max-width: 360px;
}

.test-image-upload {
    margin: 10px 0 0;
    min-height: 260px;
}

.test-image-upload .sample-upload-drop,
.test-image-upload.has-preview .sample-upload-drop {
    min-height: 260px;
}

.preview-frame {
    display: grid;
    place-items: center;
    min-height: 280px;
    margin-top: 14px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7f9f8;
}

.preview-frame img {
    width: 100%;
    max-height: 420px;
    object-fit: contain;
}

.preview-frame p {
    color: var(--muted);
    font-weight: 700;
}

.photo-meta {
    display: grid;
    gap: 4px;
    margin-top: 12px;
    padding: 12px;
    border-radius: 8px;
    background: #edf2f0;
}

.photo-meta span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.photo-meta strong {
    color: var(--ink);
}

.description-panel textarea {
    min-height: 260px;
    height: 100%;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    min-height: 42px;
    margin-bottom: 14px;
    color: #152024;
    font-size: .96rem;
    font-weight: 650;
}

.topbar span,
.topbar a {
    text-shadow: 0 1px 0 rgba(255,255,255,.55);
}

.topbar a {
    color: var(--primary);
    font-weight: 800;
    padding: 10px 0;
    border-bottom: 2px solid transparent;
    transition: border-color .18s ease, color .18s ease;
}

.topbar a:hover {
    color: var(--primary-strong);
    border-color: var(--accent);
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.student-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px;
}

.student-card,
.report-item {
    display: grid;
    gap: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255,255,255,.92), rgba(246,249,250,.88));
    box-shadow: 0 6px 18px rgba(24, 33, 38, .06);
}

.compact-report {
    overflow: hidden;
}

.compact-report.student-online {
    border-color: rgba(37, 116, 84, .32);
    background:
        linear-gradient(180deg, rgba(235, 248, 241, .96), rgba(224, 242, 234, .9));
    box-shadow: 0 8px 22px rgba(37, 116, 84, .11);
}

.compact-report.student-online .student-toggle:hover {
    background: rgba(37, 116, 84, .09);
}

.compact-report.student-submitted {
    border-color: rgba(21, 128, 61, .66);
    background:
        linear-gradient(180deg, rgba(216, 248, 226, .98), rgba(187, 235, 207, .94));
    box-shadow:
        0 10px 28px rgba(21, 128, 61, .18),
        inset 0 1px 0 rgba(255,255,255,.72);
}

.compact-report.student-submitted .student-toggle:hover {
    background: rgba(21, 128, 61, .12);
}

.admin-edit-report-form {
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 12px 10px;
}

.admin-edit-report-button {
    width: auto;
    min-height: 26px;
    border: 1px solid rgba(12, 96, 112, .22);
    border-radius: 999px;
    background: rgba(255,255,255,.72);
    color: var(--primary-strong);
    font: inherit;
    font-size: .72rem;
    font-weight: 900;
    cursor: pointer;
    padding: 3px 9px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.74);
    white-space: nowrap;
}

.admin-edit-report-button:hover {
    background: #fff;
    box-shadow: 0 8px 18px rgba(12, 96, 112, .12);
}

.student-toggle {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    align-items: center;
    width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    min-height: 52px;
    padding: 10px 12px;
}

.compact-report.student-submitted .student-toggle {
    min-height: 38px;
    padding-bottom: 4px;
}

.student-toggle:hover {
    background: rgba(37, 88, 106, .07);
}

.student-main {
    display: grid;
    min-width: 0;
}

.student-name-line {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.student-presence {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,.18);
    box-shadow: inset 0 1px 1px rgba(255,255,255,.36);
}

.student-presence.is-away {
    background: #c43b46;
}

.student-presence.is-master-online {
    border-color: rgba(18, 126, 78, .55);
    background: #16c46f;
    box-shadow:
        0 0 0 4px rgba(22, 196, 111, .14),
        0 0 16px rgba(22, 196, 111, .72),
        inset 0 1px 2px rgba(255,255,255,.55);
}

.student-presence.is-finished {
    background: #111719;
    border-color: rgba(0,0,0,.42);
}

.student-main strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .94rem;
}

.student-main small {
    color: var(--muted);
}

.row-progress {
    grid-column: 1 / -1;
    position: relative;
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    background: linear-gradient(90deg, rgba(167,53,61,.18), rgba(184,107,18,.18), rgba(37,116,84,.18));
    border: 1px solid rgba(50,68,78,.12);
}

.row-progress-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.24);
}

.row-percent {
    justify-self: end;
    min-width: 46px;
    color: var(--ink);
    font-weight: 800;
    font-size: .88rem;
    text-align: right;
}

.student-detail {
    display: grid;
    gap: 10px;
    padding: 12px;
    border-top: 1px solid var(--line);
    background: rgba(255,255,255,.7);
}

.student-detail[hidden] {
    display: none;
}

.test-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
}

.admin-resolution-detail {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(37, 88, 106, .18);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(237, 247, 244, .96), rgba(255, 255, 255, .88));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.72);
}

.admin-resolution-detail.is-empty {
    background: rgba(255,255,255,.7);
}

.admin-resolution-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.admin-resolution-head h3 {
    margin: 0;
    color: var(--primary-strong);
    font-size: .95rem;
}

.admin-resolution-head span {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 800;
    text-align: right;
}

.admin-resolution-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.admin-resolution-grid article {
    display: grid;
    gap: 6px;
    min-width: 0;
    padding: 10px;
    border: 1px solid rgba(37, 88, 106, .12);
    border-radius: 8px;
    background: rgba(255,255,255,.7);
}

.admin-resolution-grid strong {
    color: var(--ink);
}

.admin-resolution-grid p,
.admin-resolution-grid small {
    margin: 0;
    color: var(--muted);
    overflow-wrap: anywhere;
}

@media (max-width: 760px) {
    .admin-resolution-grid {
        grid-template-columns: 1fr;
    }
}

.test-group {
    display: grid;
    gap: 8px;
}

.test-group h3,
.analysis-stat-group h3 {
    margin: 4px 0 0;
    padding: 7px 10px;
    border-left: 4px solid var(--primary);
    border-radius: 6px;
    background: rgba(37, 88, 106, .08);
    color: var(--primary-strong);
    font-size: .9rem;
}

.test-detail {
    display: grid;
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255,255,255,.86);
}

.test-detail.answered {
    border-color: rgba(37, 116, 84, .32);
    background: linear-gradient(180deg, rgba(238, 249, 243, .96), rgba(228, 244, 236, .9));
}

.test-detail.pending {
    border-color: rgba(167, 53, 61, .26);
    background: linear-gradient(180deg, rgba(253, 242, 242, .96), rgba(249, 231, 232, .86));
}

.test-detail-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 10px;
}

.test-detail-head span {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 800;
}

.test-detail p {
    margin: 0;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.test-detail img {
    width: 100%;
    max-height: 180px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7f8f8;
    cursor: zoom-in;
}

.admin-test-parts {
    display: grid;
    gap: 10px;
}

.admin-test-part {
    display: grid;
    gap: 7px;
    padding: 9px;
    border: 1px solid rgba(37, 88, 106, .12);
    border-radius: 8px;
    background: rgba(255,255,255,.72);
}

.admin-test-part-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.admin-test-part-head strong {
    color: var(--ink);
}

.admin-test-part-head span {
    padding: 4px 8px;
    border-radius: 999px;
    background: #e8f4ef;
    color: var(--success);
    font-size: .8rem;
    font-weight: 850;
    white-space: nowrap;
}

.admin-test-part img {
    max-height: 220px;
}

.analysis-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 14px;
}

.admin-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(150px, 1fr)) auto;
    gap: 10px;
    align-items: end;
    margin: 0 0 12px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255,255,255,.62);
}

.admin-filters label {
    gap: 5px;
    color: var(--muted);
    font-size: .82rem;
}

.admin-filters select {
    width: 100%;
    min-height: 36px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(255,255,255,.9);
    color: var(--ink);
    font: inherit;
    font-weight: 700;
    padding: 0 10px;
}

.filter-count {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border-radius: 6px;
    background: rgba(37, 88, 106, .10);
    color: var(--primary-strong);
    font-weight: 800;
    white-space: nowrap;
}

.analysis-stat-group {
    display: grid;
    gap: 8px;
}

.analysis-stat-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}

.analysis-stat {
    display: grid;
    grid-template-rows: auto auto auto;
    gap: 7px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255,255,255,.88), rgba(245,248,249,.82));
    box-shadow: 0 5px 16px rgba(24, 33, 38, .05);
}

.analysis-stat strong {
    min-width: 0;
    overflow-wrap: anywhere;
}

.analysis-stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: .84rem;
}

.analysis-stat-row b {
    color: var(--primary-strong);
    white-space: nowrap;
}

.analysis-stat strong {
    font-size: .9rem;
}

.analysis-stat > span:not(.analysis-stat-row) {
    color: var(--muted);
    font-size: .84rem;
}

.student-card:hover {
    border-color: var(--primary);
}

.student-card span,
.student-card small,
.muted {
    color: var(--muted);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
    font-weight: 800;
    cursor: pointer;
    transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}

.button.primary {
    border-color: rgba(255,255,255,.38);
    background:
        linear-gradient(135deg, rgba(21, 118, 132, .86), rgba(9, 47, 56, .92)),
        linear-gradient(90deg, rgba(255,255,255,.26), transparent);
    color: #fff;
    box-shadow:
        0 18px 38px rgba(14, 70, 82, .27),
        inset 0 1px 0 rgba(255,255,255,.36),
        inset 0 -1px 0 rgba(0,0,0,.10);
}

.button.primary:hover {
    transform: translateY(-1px);
    background:
        linear-gradient(135deg, rgba(24, 116, 130, .96), rgba(11, 51, 59, .96)),
        linear-gradient(90deg, rgba(255,255,255,.22), transparent);
}

.login-form .button.primary {
    position: relative;
    overflow: hidden;
    border-color: rgba(255, 255, 255, .46);
    background:
        radial-gradient(circle at 18% 18%, rgba(255,255,255,.34), transparent 24%),
        linear-gradient(115deg, rgba(201, 154, 93, .20), transparent 36%),
        repeating-linear-gradient(135deg, rgba(255,255,255,.08) 0 1px, transparent 1px 7px),
        linear-gradient(135deg, rgba(19, 126, 139, .96), rgba(8, 44, 53, .98));
    color: #fff;
    letter-spacing: .01em;
    text-shadow: 0 1px 1px rgba(5, 24, 30, .42);
    box-shadow:
        0 18px 42px rgba(8, 47, 58, .32),
        inset 0 1px 0 rgba(255,255,255,.42),
        inset 0 -12px 22px rgba(3, 28, 35, .22);
}

.login-form .button.primary::after {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: 11px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.24), transparent);
    transform: translateX(-115%);
    transition: transform .45s ease;
}

.login-form .button.primary:hover::after {
    transform: translateX(115%);
}

.login-form .button.primary:focus-visible {
    outline: 3px solid rgba(201, 154, 93, .48);
    outline-offset: 3px;
}

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

.danger-button:hover {
    filter: brightness(.94);
}

.button:disabled,
input:disabled,
textarea:disabled {
    cursor: not-allowed;
    opacity: .62;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    background: #edf2f0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.badge.success,
.notice.success {
    background: #e8f4ef;
    color: var(--success);
}

.badge.danger,
.notice.danger {
    background: #faebeb;
    color: var(--danger);
}

.online-text {
    color: var(--success);
    font-weight: 800;
}

.offline-text {
    color: var(--muted);
    font-weight: 700;
}

form {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 8px;
    color: #142024;
    font-size: .96rem;
    font-weight: 760;
}

input,
textarea {
    width: 100%;
    border: 1px solid rgba(255,255,255,.68);
    border-radius: 12px;
    padding: 12px 14px;
    font: inherit;
    color: var(--ink);
    background: rgba(255,255,255,.32);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.62),
        0 10px 24px rgba(8, 25, 32, .05);
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input {
    min-height: 48px;
}

input:focus,
textarea:focus {
    border-color: rgba(23, 79, 90, .75);
    background: rgba(255,255,255,.82);
    box-shadow: 0 0 0 4px rgba(23, 79, 90, .13);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.notice {
    padding: 12px;
    border-radius: 6px;
    font-weight: 700;
}

.preview {
    max-width: 360px;
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.login-panel {
    max-width: 460px;
    margin: 60px auto;
}

.wide-panel {
    max-width: 760px;
}

.dashboard {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.admin-dashboard {
    width: 100%;
}

.admin-top-panel {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    align-items: stretch;
}

.admin-top-heading h1 {
    margin-bottom: 0;
}

.admin-top-row {
    display: grid;
    gap: 12px;
}

.admin-settings-inline {
    display: grid;
    grid-template-columns: minmax(210px, .8fr) minmax(340px, 1.2fr) minmax(170px, auto) minmax(170px, auto);
    gap: 12px;
    align-items: end;
}

.admin-settings-inline textarea {
    min-height: 96px;
    height: 96px;
    resize: vertical;
}

.roster-loader-panel {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(300px, .95fr) minmax(260px, auto) minmax(300px, .95fr);
    gap: 18px;
    align-items: center;
    padding: 16px 22px;
    border: 2px solid #073040;
    border-radius: 18px;
    background: rgba(235, 244, 242, .86);
    transition: border-color .28s ease, box-shadow .28s ease;
}

.roster-loader-panel > * {
    position: relative;
    z-index: 1;
}

.roster-loader-panel::before {
    display: none;
}

.roster-loader-panel.is-loading .roster-picker-card {
    border-color: rgba(21, 128, 61, .48);
    box-shadow: 0 10px 26px rgba(21, 128, 61, .12);
}

.roster-loader-panel.is-loading .roster-picker-card::before {
    width: var(--roster-progress, 72%);
}

.roster-loader-panel.is-loading .roster-picker-card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(110deg, transparent 0%, rgba(255,255,255,.34) 45%, transparent 70%);
    animation: rosterProcessingSheen 1.15s linear infinite;
    pointer-events: none;
}

.roster-loader-panel.is-loaded .roster-picker-card {
    border-color: rgba(21, 128, 61, .62);
    box-shadow: 0 10px 26px rgba(21, 128, 61, .14);
}

.roster-loader-panel.is-loaded .roster-picker-card::before {
    width: 100%;
}

.roster-loader-panel.is-clearing .roster-picker-card {
    border-color: rgba(21, 128, 61, .42);
}

.roster-loader-panel.is-clearing .roster-picker-card::before {
    width: var(--roster-progress, 0%);
}

.admin-roster-inline {
    display: contents;
}

.roster-picker-card {
    position: relative;
    overflow: hidden;
    display: grid;
    gap: 8px;
    padding: 10px 18px 14px;
    border: 2px solid #073040;
    border-radius: 14px;
    background: rgba(255,255,255,.18);
    text-align: center;
}

.roster-picker-card > * {
    position: relative;
    z-index: 1;
}

.roster-picker-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 0%;
    background: linear-gradient(90deg, rgba(38, 164, 95, .32), rgba(92, 211, 143, .48));
    pointer-events: none;
    transition: width .28s ease;
}

.roster-picker-card span {
    color: #111719;
    font-weight: 500;
}

.roster-file-button {
    display: grid;
    place-items: center;
    min-height: 32px;
    padding: 4px 12px;
    border: 2px solid #073040;
    border-radius: 5px;
    background: #e9eeee;
    color: #111719;
    cursor: pointer;
}

.roster-file-input {
    position: absolute;
    opacity: 0;
    pointer-events: auto;
    width: 1px;
    height: 1px;
}

.roster-file-button strong {
    max-width: 100%;
    overflow: hidden;
    color: #111719;
    font-size: 1.05rem;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.roster-action-stack {
    display: grid;
    gap: 18px;
}

.roster-load-button,
.roster-delete-button {
    min-height: 38px;
    border: 2px solid #073040;
    border-radius: 6px;
    font: inherit;
    font-size: .96rem;
    font-weight: 900;
    cursor: pointer;
}

.roster-load-button {
    background: #05b963;
    color: #fff;
}

.roster-delete-button {
    background: #f31313;
    color: #ffe35c;
}

.roster-load-button:disabled,
.roster-delete-button:disabled {
    border-color: rgba(40, 52, 56, .42);
    background: #d7dddd;
    color: #60696c;
    cursor: not-allowed;
    box-shadow: none;
}

.roster-instructions {
    display: grid;
    gap: 2px;
    padding: 8px 18px;
    border: 2px solid #073040;
    border-radius: 14px;
    background: rgba(255,255,255,.18);
    color: #111719;
    text-align: center;
}

.roster-instructions strong {
    font-weight: 500;
    text-decoration: underline;
}

.roster-instructions ol {
    margin: 0;
    padding-left: 0;
    list-style-position: inside;
    text-align: center;
}

.roster-instructions span {
    font-size: .9rem;
}

.backup-table-panel {
    display: grid;
    gap: 10px;
    width: 100%;
    margin-top: 14px;
    padding: 14px;
    border: 1px solid rgba(7, 48, 64, .22);
    border-radius: 14px;
    background: rgba(255,255,255,.48);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}

.backup-table-panel h2 {
    margin: 0;
    color: var(--primary-strong);
    font-size: 1rem;
}

.backup-table-wrap {
    overflow-x: auto;
}

.backup-table {
    width: 100%;
    min-width: 820px;
    border-collapse: collapse;
    color: var(--ink);
    font-size: .86rem;
}

.current-roster-table {
    min-width: 960px;
}

.backup-table th,
.backup-table td {
    padding: 9px 10px;
    border-bottom: 1px solid rgba(7, 48, 64, .12);
    text-align: left;
    vertical-align: middle;
}

.backup-table th {
    color: var(--muted);
    font-size: .76rem;
    text-transform: uppercase;
}

.backup-table td:first-child,
.backup-table td:nth-child(5),
.backup-table th:first-child,
.backup-table th:nth-child(5) {
    text-align: center;
}

.backup-action,
.backup-delete {
    display: inline-grid;
    place-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border: 1px solid rgba(7, 48, 64, .22);
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
}

.backup-action {
    background: rgba(12, 96, 112, .12);
    color: var(--primary-strong);
}

.backup-delete {
    background: rgba(179, 37, 54, .12);
    color: #9f1f2f;
}

.backup-table form {
    margin: 0;
}

.current-roster-edit {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.current-roster-edit input {
    min-height: 30px;
    width: 100%;
    padding: 4px 8px;
    border: 1px solid rgba(7, 48, 64, .22);
    border-radius: 7px;
    background: rgba(255,255,255,.76);
    color: var(--ink);
    font: inherit;
    font-size: .84rem;
}

@keyframes rosterLoadFill {
    from { width: 0%; }
    to { width: 100%; }
}

@keyframes rosterClearFill {
    from { width: 100%; opacity: 1; }
    to { width: 0%; opacity: 0; }
}

@keyframes rosterProcessingSheen {
    from { transform: translateX(-120%); }
    to { transform: translateX(120%); }
}

.admin-clear-inline {
    align-self: end;
    justify-self: start;
}

.admin-progress-panel {
    width: 100%;
}

.admin-master-menu {
    position: relative;
    overflow: hidden;
    display: grid;
    gap: clamp(28px, 5vw, 70px);
    width: min(1280px, 100%);
    margin: 0 auto;
    padding: clamp(34px, 5vw, 58px);
    border-radius: 22px;
    background: transparent;
    box-shadow: none;
}

.admin-master-heading {
    display: grid;
    gap: 4px;
    text-align: left;
}

.admin-master-heading .eyebrow {
    color: rgba(39, 55, 65, .62);
    font-size: clamp(1rem, 1.7vw, 1.45rem);
    font-weight: 500;
    letter-spacing: .08em;
}

.admin-master-heading h1 {
    margin: 0;
    color: #071a2b;
    font-size: clamp(3.2rem, 6.5vw, 5.6rem);
    font-weight: 1000;
    line-height: .95;
}

.admin-master-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(18px, 3vw, 42px);
}

.admin-master-card {
    min-height: 400px;
    display: grid;
    grid-template-rows: minmax(190px, 1fr) auto auto;
    align-items: center;
    justify-items: center;
    gap: 0;
    padding: 14px 14px 18px;
    border: 2px solid rgba(92, 118, 133, .42);
    border-radius: 18px;
    background: rgba(255,255,255,.26);
    box-shadow: 0 24px 58px rgba(20, 36, 42, .12), inset 0 1px 0 rgba(255,255,255,.8);
    color: #07131d;
    text-align: center;
    text-decoration: none;
    backdrop-filter: blur(8px);
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.admin-master-card:hover {
    transform: translateY(-5px);
    border-color: rgba(30, 72, 88, .56);
    background: rgba(255,255,255,.36);
    box-shadow: 0 30px 76px rgba(20, 36, 42, .2), inset 0 1px 0 rgba(255,255,255,.86);
}

.admin-master-icon {
    width: 100%;
    height: 100%;
    min-height: 184px;
    border: 2px solid rgba(255,255,255,.7);
    border-radius: 18px;
    background-image: url("/adminmaestro.png");
    background-size: 520% auto;
    background-repeat: no-repeat;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.74), 0 14px 30px rgba(20, 36, 42, .08);
}

.admin-master-card strong {
    width: 100%;
    min-height: 82px;
    display: grid;
    place-items: center;
    margin-top: 18px;
    padding: 18px 10px 6px;
    border-radius: 15px 15px 0 0;
    background: rgba(255,255,255,.52);
    color: #020914;
    font-size: clamp(1.12rem, 1.7vw, 1.55rem);
    font-weight: 1000;
}

.admin-master-card span:last-child {
    width: 100%;
    min-height: 112px;
    display: grid;
    place-items: start center;
    padding: 6px 12px 16px;
    border-radius: 0 0 15px 15px;
    background: rgba(255,255,255,.52);
    color: #111719;
    font-size: clamp(.9rem, 1.25vw, 1.08rem);
    font-weight: 500;
    line-height: 1.24;
}

.admin-image-config .admin-master-icon {
    background-position: 6.8% 46%;
}

.admin-image-course .admin-master-icon {
    background-position: 35.2% 46%;
}

.admin-image-students .admin-master-icon {
    background-position: 64.8% 46%;
}

.admin-image-evaluations .admin-master-icon {
    background-position: 93.2% 46%;
}

.admin-back-master {
    align-self: start;
    justify-self: start;
    display: inline-grid;
    place-items: center;
    min-height: 36px;
    margin-bottom: 12px;
    padding: 7px 14px;
    border: 1px solid rgba(7, 48, 64, .18);
    border-radius: 999px;
    background: rgba(255,255,255,.68);
    color: var(--primary-strong);
    font-weight: 900;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(20, 36, 42, .08);
}

.admin-single-view {
    grid-template-columns: 1fr;
}

.admin-placeholder-panel {
    min-height: 360px;
    display: grid;
    align-content: center;
    justify-items: center;
    text-align: center;
}

.admin-placeholder-panel h1 {
    margin: 0;
    color: var(--primary-strong);
    font-size: clamp(2rem, 5vw, 4rem);
}

.admin-db-setup-layout {
    grid-template-columns: minmax(0, 720px);
    justify-content: center;
}

.admin-db-setup-panel {
    margin-top: 18px;
}

.admin-db-setup-panel form {
    margin: 18px 0 10px;
}

.admin-inline-setup {
    display: grid;
    gap: 12px;
    padding: 18px;
    border: 1px solid rgba(167, 53, 61, .18);
    border-radius: 14px;
    background: rgba(255, 255, 255, .46);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}

.admin-inline-setup form {
    display: flex;
}

.admin-inline-setup .button {
    width: min(100%, 360px);
}

.toggle {
    grid-template-columns: auto 1fr;
    align-items: center;
}

.toggle input {
    width: 18px;
    height: 18px;
}

.danger-toggle {
    color: var(--danger);
}

.clear-roster-form {
    margin-top: 10px;
}

.diagnostic-list {
    display: grid;
    gap: 10px;
    margin: 18px 0;
}

.diagnostic-row {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 6px 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfc;
}

.diagnostic-row strong {
    grid-row: span 2;
    text-align: center;
    font-size: .78rem;
    padding: 6px 8px;
    border-radius: 999px;
}

.diagnostic-row.ok strong {
    color: #11653f;
    background: #e8f6ef;
}

.diagnostic-row.fail strong {
    color: var(--danger);
    background: #fdeeee;
}

.diagnostic-row.warn strong {
    color: #8a5a00;
    background: #fff4d8;
}

.diagnostic-row span {
    font-weight: 700;
}

.diagnostic-row small {
    color: var(--muted);
    overflow-wrap: anywhere;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.stat {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfc;
}

@media (max-width: 720px) {
    .admin-filters {
        grid-template-columns: 1fr;
    }

    .student-toggle {
        grid-template-columns: minmax(0, 1fr) 42px;
        gap: 8px;
    }

    .student-main strong {
        font-size: .88rem;
    }

    .row-progress {
        height: 10px;
    }
}

@media (max-width: 1180px) {
    .admin-settings-inline,
    .admin-roster-inline {
        grid-template-columns: 1fr 1fr;
    }

    .roster-loader-panel {
        grid-template-columns: 1fr;
    }

    .admin-clear-inline {
        grid-column: 1 / -1;
    }

    .report-list {
        grid-template-columns: repeat(2, minmax(260px, 1fr));
    }
}

@media (max-width: 760px) {
    .admin-top-panel,
    .admin-settings-inline,
    .admin-roster-inline,
    .report-list {
        grid-template-columns: 1fr;
    }
}

.stat strong {
    display: block;
    font-size: 26px;
}

.report-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(260px, 1fr));
    gap: 14px;
    padding-bottom: 92px;
}

.report-item:has(.student-detail:not([hidden])) {
    grid-column: 1 / -1;
}

.admin-float-nav {
    position: fixed;
    right: clamp(12px, 3vw, 34px);
    bottom: clamp(12px, 3vw, 28px);
    z-index: 30;
    display: grid;
    grid-template-columns: 48px minmax(170px, 260px) 48px;
    align-items: center;
    gap: 10px;
    width: min(calc(100vw - 24px), 390px);
    padding: 9px;
    border: 1px solid rgba(255, 255, 255, .46);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(20, 116, 132, .9), rgba(9, 47, 56, .94)),
        linear-gradient(90deg, rgba(255,255,255,.25), transparent);
    box-shadow: 0 18px 48px rgba(8, 33, 42, .24), inset 0 1px 0 rgba(255,255,255,.32);
    backdrop-filter: blur(18px) saturate(1.25);
}

.float-arrow-button,
.float-go-button {
    min-width: 44px;
    min-height: 44px;
    border: 1px solid rgba(255, 255, 255, .48);
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    color: var(--primary-strong);
    background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(219, 234, 232, .92));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.72), 0 8px 18px rgba(5, 24, 30, .18);
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.float-arrow-button:hover,
.float-go-button:hover {
    transform: translateY(-1px);
    background: linear-gradient(180deg, #fff, rgba(232, 244, 241, .96));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.82), 0 12px 24px rgba(5, 24, 30, .22);
}

.float-arrow-button span {
    position: relative;
    display: block;
    width: 0;
    height: 0;
    margin: 1px auto 0;
    border-left: 13px solid transparent;
    border-right: 13px solid transparent;
    border-bottom: 16px solid #49c56e;
    filter: drop-shadow(0 1px 0 rgba(255,255,255,.55));
}

.float-arrow-button span::after {
    content: "";
    position: absolute;
    left: -6px;
    top: 15px;
    width: 12px;
    height: 16px;
    border-radius: 2px;
    background: #49c56e;
}

.float-search-wrap {
    position: relative;
    min-width: 0;
}

.float-search-wrap input {
    width: 100%;
    min-height: 44px;
    border: 1px solid rgba(9, 47, 56, .28);
    border-radius: 7px;
    background: rgba(255,255,255,.94);
    color: var(--ink);
    font: inherit;
    font-weight: 800;
    padding: 0 12px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.72);
}

.float-search-wrap input:focus {
    outline: 3px solid rgba(201, 154, 93, .42);
    border-color: var(--accent);
}

.float-search-results {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    left: 0;
    display: grid;
    gap: 5px;
    max-height: 260px;
    overflow: auto;
    padding: 8px;
    border: 1px solid rgba(255,255,255,.48);
    border-radius: 8px;
    background: rgba(246, 251, 249, .92);
    box-shadow: 0 18px 46px rgba(8, 33, 42, .22);
    backdrop-filter: blur(16px);
}

.float-search-results[hidden] {
    display: none;
}

.float-search-option {
    display: grid;
    gap: 2px;
    width: 100%;
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid rgba(37, 88, 106, .12);
    border-radius: 7px;
    background: rgba(255,255,255,.72);
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}

.float-search-option:hover {
    border-color: rgba(12, 96, 112, .38);
    background: rgba(236, 247, 245, .94);
}

.float-search-option span {
    color: var(--muted);
    font-size: .78rem;
}

.student-row-pulse {
    animation: studentPulse .9s ease;
}

@keyframes studentPulse {
    0% { box-shadow: 0 0 0 0 rgba(201, 154, 93, .48), 0 6px 18px rgba(24, 33, 38, .06); }
    100% { box-shadow: 0 0 0 16px rgba(201, 154, 93, 0), 0 6px 18px rgba(24, 33, 38, .06); }
}

.progress {
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: #e6ecea;
}

.progress span {
    display: block;
    height: 100%;
    background: var(--primary);
}

.report-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 820px) {
    .hero,
    .dashboard,
    .master-header,
    .analysis-menu,
    .evidence-grid {
        grid-template-columns: 1fr;
    }

    .result-options {
        grid-template-columns: 1fr;
    }

    .result-options.options-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .multipart-evidence-row {
        grid-template-columns: 1fr;
    }

    .resolution-cations,
    .resolution-anion-row {
        grid-template-columns: 1fr;
    }

    .resolution-anion-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .resolution-anion-control {
        justify-content: space-between;
        border-radius: 12px;
    }

    .hero h1 {
        font-size: 32px;
    }

    .sample-side {
        grid-template-columns: minmax(0, 1fr) minmax(150px, 190px);
    }

    .section-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .admin-master-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-master-card {
        min-height: 360px;
    }

    .analysis-item {
        grid-template-columns: 28px minmax(0, 1fr);
        height: auto;
    }

    .analysis-result {
        grid-column: 2;
        justify-self: start;
        width: 100%;
    }
}

@media (max-width: 560px) {
    .start-card {
        padding: 24px 18px;
    }

    .start-form {
        --start-field-font: 18px;
        width: min(100%, 310px);
    }

    .start-field {
        font-size: 18px;
    }

    .sample-upload-drop,
    .sample-upload-card.has-preview .sample-upload-drop {
        min-height: 168px;
    }

    .sample-upload-preview {
        height: 168px;
    }

    .sample-upload-card.is-expanded .sample-upload-preview,
    .sample-image-thumb.is-expanded img {
        width: auto !important;
        height: auto !important;
        max-width: 100vw;
        max-height: 100vh;
        object-fit: contain !important;
    }

    .test-image-upload,
    .test-image-upload .sample-upload-drop,
    .test-image-upload.has-preview .sample-upload-drop {
        min-height: 220px;
    }

    .sample-side {
        grid-template-columns: 1fr;
    }

    .admin-float-nav {
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        gap: 7px;
        padding: 7px;
    }

    .admin-master-grid {
        grid-template-columns: 1fr;
    }

    .admin-master-card {
        min-height: 320px;
    }

    .admin-master-menu {
        padding: 24px 16px;
    }

    .admin-master-heading h1 {
        font-size: 3rem;
    }

    .float-search-wrap input {
        min-height: 42px;
        font-size: .9rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .student-row-pulse {
        animation: none;
    }
}
