:root {
    --ink: #14213d;
    --muted: #5d6b82;
    --line: #d9e2ef;
    --bg: #eef4fb;
    --panel: #ffffff;
    --brand: #006d77;
    --brand-2: #c2410c;
    --ok: #0f766e;
    --danger: #b42318;
    --violet: #6d5dfc;
    --sky: #0284c7;
    --gold: #d97706;
    --shadow: 0 14px 40px rgba(20, 33, 61, .08);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 12% 10%, rgba(109,93,252,.12), transparent 30%),
        radial-gradient(circle at 88% 18%, rgba(0,109,119,.13), transparent 28%),
        var(--bg);
}
a { color: inherit; text-decoration: none; }
.topbar {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px clamp(16px, 4vw, 44px);
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}
.sidebar-toggle {
    display: none;
    background: #edf2f7;
    color: var(--ink);
}
.sidebar {
    position: fixed;
    left: 0;
    top: 73px;
    bottom: 0;
    z-index: 9;
    width: 248px;
    padding: 18px 14px;
    overflow-y: auto;
    color: #e8f3ff;
    background: linear-gradient(180deg, #102a43, #0f3f4a 58%, #09333b);
    border-right: 1px solid rgba(255,255,255,.12);
}
.sidebar-title {
    display: grid;
    gap: 4px;
    padding: 10px 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,.14);
    margin-bottom: 12px;
}
.sidebar-title span {
    color: rgba(255,255,255,.68);
    font-size: 13px;
}
.side-nav {
    display: grid;
    gap: 6px;
}
.side-nav a {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 7px;
    color: rgba(255,255,255,.88);
    font-weight: 800;
}
.side-nav a:hover {
    background: rgba(255,255,255,.12);
    color: #fff;
}
.side-nav a.active {
    background: rgba(255,255,255,.18);
    color: #fff;
    box-shadow: inset 3px 0 0 #fbbf24;
}
.side-subnav {
    display: grid;
    gap: 4px;
    margin: -2px 0 4px 18px;
}
.side-subnav a {
    min-height: 34px;
    font-size: 13px;
    color: rgba(255,255,255,.72);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: white;
    background: var(--brand);
    font-weight: 800;
    overflow: hidden;
}
.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
}
.brand small, .muted { color: var(--muted); }
.brand span:last-child { display: grid; gap: 2px; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.user-pill {
    border: 1px solid var(--line);
    background: #f8fafc;
    border-radius: 999px;
    padding: 9px 12px;
    font-size: 14px;
}
.shell {
    width: min(1180px, calc(100% - 32px));
    margin: 28px auto 56px;
}
.shell.with-sidebar {
    width: min(1180px, calc(100% - 288px));
    margin-left: calc(248px + clamp(20px, 4vw, 44px));
}
.dashboard-hero {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: end;
    padding: clamp(24px, 5vw, 46px);
    color: #fff;
    background:
        linear-gradient(135deg, rgba(0,109,119,.96), rgba(109,93,252,.86)),
        radial-gradient(circle at top right, rgba(255,255,255,.35), transparent 36%);
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 22px;
}
.dashboard-hero h1 {
    margin: 0 0 8px;
    font-size: clamp(30px, 5vw, 56px);
    line-height: 1.05;
}
.dashboard-hero p {
    max-width: 760px;
    color: rgba(255,255,255,.82);
}
.hero-chip {
    display: inline-flex;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.16);
    border: 1px solid rgba(255,255,255,.28);
    font-weight: 800;
}
.hero {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: 28px;
    align-items: center;
    min-height: calc(100vh - 128px);
}
.login-hero {
    position: relative;
    overflow: hidden;
    padding: clamp(22px, 4vw, 42px);
    border-radius: 18px;
    background:
        linear-gradient(115deg, rgba(255,255,255,.98), rgba(236,249,255,.9) 42%, rgba(236,245,255,.68)),
        url("images/top-view.png");
    background-size: cover;
    background-position: center right;
    box-shadow: 0 28px 80px rgba(20,33,61,.14);
    border: 1px solid rgba(255,255,255,.74);
}
.login-hero::after {
    content: "";
    position: absolute;
    right: clamp(18px, 4vw, 56px);
    bottom: clamp(18px, 4vw, 44px);
    width: min(360px, 36vw);
    aspect-ratio: 1.3;
    background: url("images/top-view.png") center / cover no-repeat;
    border: 10px solid rgba(255,255,255,.78);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(20,33,61,.16);
    pointer-events: none;
}
.login-hero::before {
    content: "";
    position: absolute;
    inset: auto -80px -130px auto;
    width: 390px;
    height: 390px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(0,109,119,.22), rgba(194,65,12,.18));
    filter: blur(6px);
}
.login-hero > * {
    position: relative;
    z-index: 1;
}
.hero-logo {
    width: 92px;
    height: 92px;
    object-fit: contain;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 18px;
}
.login-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 999px;
    color: #075985;
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}
.hero-copy h1 { font-size: clamp(36px, 6vw, 68px); line-height: 1; margin: 0 0 18px; }
.hero-copy p { font-size: 18px; color: var(--muted); max-width: 680px; line-height: 1.6; }
.login-highlights {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 24px 0 16px;
}
.login-highlights span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 9px 13px;
    border-radius: 10px;
    background: rgba(255,255,255,.78);
    border: 1px solid rgba(217,226,239,.95);
    box-shadow: 0 12px 30px rgba(20,33,61,.07);
    font-weight: 800;
}
.login-highlights strong {
    color: var(--brand);
}
.login-demo {
    margin-top: 8px;
}
.login-panel, .panel, .card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}
.login-panel {
    overflow: hidden;
    padding: 0 30px 30px;
    backdrop-filter: blur(10px);
    background: rgba(255,255,255,.94);
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,.86);
    box-shadow: 0 24px 70px rgba(20,33,61,.16);
}
.login-image-strip {
    position: relative;
    height: 80px;
    margin: 0 -30px 26px;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: linear-gradient(135deg, #006d77, #6d5dfc 52%, #c2410c);
}
.login-image-strip::before {
    content: "";
    position: absolute;
    inset: -60%;
    background:
        radial-gradient(circle, rgba(255,255,255,.32) 0 8%, transparent 9% 100%),
        radial-gradient(circle at 70% 30%, rgba(255,255,255,.18), transparent 28%);
    background-size: 46px 46px, 100% 100%;
    animation: welcomePattern 10s linear infinite;
}
.login-image-strip span {
    position: relative;
    color: #fff;
    font-size: clamp(24px, 4vw, 34px);
    font-weight: 900;
    letter-spacing: 0;
    text-shadow: 0 8px 24px rgba(0,0,0,.22);
    animation: welcomeText 2.8s ease-in-out infinite;
}
.login-form-head {
    margin-bottom: 18px;
}
.login-form-head h2 {
    margin: 12px 0 4px;
    font-size: 32px;
}
.pretty-login-form {
    gap: 16px;
}
.login-input {
    display: grid;
    grid-template-columns: 42px 1fr;
    align-items: center;
    min-height: 50px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8fafc;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.login-input:focus-within {
    border-color: rgba(0,109,119,.55);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(0,109,119,.12);
}
.login-input > span {
    display: grid;
    place-items: center;
    width: 42px;
    height: 100%;
    color: var(--brand);
    font-weight: 900;
}
.login-input input {
    border: 0;
    background: transparent;
    padding-left: 0;
    border-radius: 0;
}
.login-input input:focus {
    outline: 0;
}
.login-submit {
    min-height: 52px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--brand), var(--violet));
    box-shadow: 0 14px 34px rgba(0,109,119,.24);
    font-size: 16px;
}
.login-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 42px rgba(0,109,119,.28);
}
@keyframes welcomePattern {
    from { transform: translate3d(0, 0, 0) rotate(0deg); }
    to { transform: translate3d(28px, 28px, 0) rotate(6deg); }
}
@keyframes welcomeText {
    0%, 100% { transform: translateY(0) scale(1); opacity: .96; }
    50% { transform: translateY(-3px) scale(1.03); opacity: 1; }
}
.panel { padding: 22px; margin-bottom: 22px; }
details.panel { display: block; }
.collapsible {
    padding: 0;
    overflow: hidden;
}
.collapsible summary {
    list-style: none;
    cursor: pointer;
    padding: 18px 20px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.collapsible summary::-webkit-details-marker { display: none; }
.collapsible summary::after {
    content: "+";
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    background: #edf2f7;
    color: var(--ink);
    font-size: 18px;
    line-height: 1;
}
.collapsible[open] summary {
    border-bottom: 1px solid var(--line);
}
.collapsible[open] summary::after {
    content: "-";
}
.collapsible > form {
    padding: 18px 20px 20px;
}
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }
.card { padding: 18px; box-shadow: none; }
.stat-card {
    color: #fff;
    border: 0;
    min-height: 132px;
    display: grid;
    align-content: space-between;
    background: linear-gradient(135deg, var(--brand), var(--sky));
}
.stat-card:nth-child(2) { background: linear-gradient(135deg, var(--violet), #9b5cf6); }
.stat-card:nth-child(3) { background: linear-gradient(135deg, var(--brand-2), var(--gold)); }
.stat-card:nth-child(4) { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.stat-card .muted { color: rgba(255,255,255,.78); }
.card h3, .panel h2, .panel h3 { margin-top: 0; }
.stat { font-size: 34px; font-weight: 800; }
form { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
label { display: grid; gap: 6px; font-weight: 700; font-size: 14px; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 11px 12px;
    font: inherit;
    background: #fff;
    color: var(--ink);
}
textarea { min-height: 110px; resize: vertical; }
.btn, button {
    border: 0;
    border-radius: 6px;
    background: var(--brand);
    color: white;
    padding: 11px 14px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn.secondary { background: var(--brand-2); }
.btn.ghost { background: #edf2f7; color: var(--ink); }
.btn.danger { background: var(--danger); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.compact-form { display: inline-flex; margin: 0; }
.password-view {
    position: relative;
    min-width: 210px;
}
.password-view input {
    padding-right: 78px;
    min-width: 0;
}
.password-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
}
.password-icon:hover,
.password-icon.copied,
.password-icon.is-visible {
    background: #edf2f7;
    color: var(--brand);
}
.password-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    pointer-events: none;
}
.view-icon { right: 40px; }
.copy-icon { right: 6px; }
.copy-icon.copied::after {
    content: "";
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--ok);
}
.icon-btn {
    width: 42px;
    padding-inline: 0;
}
.copy-btn::before {
    content: "Copy";
}
.check-line { min-width: 92px; }
.switch-line {
    display: inline-flex;
    grid-template-columns: none;
    align-items: center;
    gap: 8px;
    min-width: 86px;
    font-weight: 800;
}
.switch-line input {
    width: 18px;
    height: 18px;
}
.notice {
    padding: 14px 16px;
    border: 1px solid #9ae6b4;
    background: #ecfdf3;
    color: #065f46;
    border-radius: 8px;
    margin-bottom: 18px;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 13px; text-transform: uppercase; }
.account-table {
    min-width: 0;
    table-layout: auto;
}
.account-table th,
.account-table td {
    padding: 10px;
}
.account-table input,
.account-table select {
    min-width: 0;
    padding: 9px 10px;
}
.account-table .actions {
    flex-wrap: nowrap;
    gap: 8px;
    min-width: max-content;
}
.account-table .btn,
.account-table button {
    min-height: 38px;
    padding: 9px 11px;
    white-space: nowrap;
}
.account-table th:last-child,
.account-table td:last-child {
    width: 210px;
}
.account-table th:nth-child(4),
.account-table td:nth-child(4) {
    width: 250px;
}
.badge { display: inline-flex; border-radius: 999px; padding: 5px 9px; font-size: 12px; background: #edf2f7; color: var(--ink); }
.badge.ok { background: #ccfbf1; color: #115e59; }
.badge.warn { background: #ffedd5; color: #9a3412; }
.question { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 18px; }
.media-preview img, .exam-media img { max-width: 280px; border-radius: 8px; border: 1px solid var(--line); }
.exam-media video { max-width: 420px; width: 100%; }
.exam-bar {
    position: sticky;
    top: 73px;
    z-index: 8;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 16px;
}
.timer { font-size: 24px; font-weight: 900; color: var(--danger); }
.rules-box {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    line-height: 1.7;
    margin-bottom: 16px;
}
.rules-confirm {
    border-top: 1px solid var(--line);
    padding-top: 16px;
}
.exam-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 18px;
    align-items: start;
}
.exam-question-area {
    min-width: 0;
}
.exam-question[hidden] {
    display: none;
}
.exam-question {
    position: relative;
}
.choice-row {
    display: flex;
    grid-template-columns: none;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    font-weight: 600;
}
.choice-row input[type="radio"] {
    width: auto;
    flex: 0 0 auto;
    margin: 2px 0 0;
}
.choice-row span {
    line-height: 1.45;
}
.exam-attachment {
    float: right;
    width: 150px;
    margin: 0 0 14px 18px;
    text-align: center;
}
.exam-attachment a {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-weight: 700;
}
.exam-attachment img,
.attachment-thumb {
    width: 150px;
    height: 96px;
    border: 1px solid var(--line);
    border-radius: 8px;
    object-fit: cover;
    background: #f8fafc;
}
.attachment-thumb {
    display: grid;
    place-items: center;
    color: var(--ink);
}
.exam-nav-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 22px;
    border-top: 1px solid var(--line);
    padding-top: 16px;
}
.question-sidebar {
    position: sticky;
    top: 154px;
    display: grid;
    gap: 12px;
}
.question-palette {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    box-shadow: var(--shadow);
}
.submit-exam-btn {
    width: 100%;
    min-height: 56px;
    font-size: 17px;
}
.question-box {
    aspect-ratio: 1;
    min-width: 0;
    padding: 0;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 6px;
}
.question-box.answered {
    background: var(--ok);
    border-color: var(--ok);
    color: #fff;
}
.question-box.current {
    outline: 3px solid rgba(194, 65, 12, .3);
}
.result-box {
    text-align: center;
    padding: 36px;
}
.result-score { font-size: clamp(48px, 10vw, 96px); font-weight: 900; color: var(--ok); }
.filter-bar {
    display: grid;
    grid-template-columns: repeat(5, minmax(140px, 1fr)) auto;
    gap: 12px;
    align-items: end;
}
.report-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.section-title-row h2 {
    margin: 0;
}
.danger-notice {
    border-color: #fecaca;
    background: #fff1f2;
    color: #991b1b;
}
.report-export h1 {
    margin: 0 0 6px;
}
.print-only { display: none; }
@media (max-width: 820px) {
    .hero, .form-row { grid-template-columns: 1fr; }
    .span-3, .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: span 12; }
    .topbar { align-items: flex-start; flex-direction: column; }
    .sidebar-toggle { display: inline-flex; }
    .sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .shell, .shell.with-sidebar { width: min(100% - 20px, 1180px); margin: 16px auto 56px; }
    .dashboard-hero { grid-template-columns: 1fr; }
    .filter-bar { grid-template-columns: 1fr; }
    .exam-layout { grid-template-columns: 1fr; }
    .question-sidebar {
        position: sticky;
        top: 132px;
        order: -1;
    }
    .exam-attachment {
        float: none;
        width: 100%;
        margin: 0 0 14px;
        text-align: left;
    }
    .exam-attachment a {
        width: 150px;
    }
}
@media print {
    .topbar, .sidebar, .btn, button, form, .notice { display: none !important; }
    .shell, .shell.with-sidebar { width: 100%; margin: 0; }
    body { background: #fff; }
    .panel, .card { box-shadow: none; }
    .print-only { display: block; }
}
