:root {
    color-scheme: light;
    --ink: #17202b;
    --muted: #657180;
    --page: #eef2f5;
    --surface: #ffffff;
    --surface-soft: #f7f8fa;
    --line: #d8dee5;
    --brand-black: #090909;
    --brand-charcoal: #181818;
    --brand-orange: #f4a126;
    --brand-orange-dark: #a94f00;
    --brand-orange-soft: #fff0d8;
    --primary: #b45b05;
    --primary-dark: #7f3d00;
    --primary-soft: #fff0d8;
    --success: #247a4a;
    --success-soft: #e3f5ea;
    --warning: #8b6514;
    --warning-soft: #fff4cf;
    --danger: #a43939;
    --danger-soft: #fde9e9;
    --shadow-sm: 0 2px 9px rgba(20, 28, 36, .07);
    --shadow-md: 0 14px 34px rgba(20, 28, 36, .12);
    --radius-sm: 9px;
    --radius: 16px;
    --radius-lg: 22px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--page);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at top right, rgba(244, 161, 38, .11), transparent 28rem),
        var(--page);
    line-height: 1.55;
}
button, input, select, textarea { font: inherit; }
a { color: var(--primary-dark); text-underline-offset: 3px; }
a:hover { color: var(--primary); }
img, svg { max-width: 100%; }
code {
    padding: .12em .38em;
    border-radius: 5px;
    background: #e9edf1;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.wrap { width: min(1180px, calc(100% - 36px)); margin-inline: auto; }
main.wrap { min-height: calc(100vh - 180px); padding-bottom: 20px; }

.skip-link {
    position: fixed;
    z-index: 1000;
    top: 10px;
    left: 10px;
    transform: translateY(-160%);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: white;
    color: var(--ink);
    box-shadow: var(--shadow-md);
}
.skip-link:focus { transform: translateY(0); }

.site-header {
    position: sticky;
    z-index: 50;
    top: 0;
    margin-bottom: clamp(20px, 4vw, 38px);
    color: white;
    background: linear-gradient(115deg, #050505, #151515 65%, #20170b);
    border-bottom: 3px solid var(--brand-orange);
    box-shadow: 0 7px 24px rgba(0, 0, 0, .26);
}
.header-inner {
    position: relative;
    display: flex;
    min-height: 78px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.brand {display:inline-flex;align-items:baseline;gap:12px;color:white;text-decoration:none;white-space:nowrap;}
.brand:hover{color:white;}
.brand-main{font-size:1.48rem;font-weight:900;letter-spacing:-.065em;line-height:1;color:#fff;}
.brand-accent{color:var(--brand-orange);}
.brand-service{padding-left:12px;border-left:1px solid rgba(255,255,255,.28);color:#e4e4e4;font-size:.72rem;font-weight:900;letter-spacing:.08em;text-transform:uppercase;}
.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}
.site-nav a,
.site-nav a:visited {
    padding: 10px 11px;
    border-radius: 8px;
    color: #ffffff;
    text-decoration: none;
    font-size: .91rem;
    font-weight: 750;
}
.site-nav a:hover,
.site-nav a:focus-visible {
    color: #ffffff;
    background: #303030;
}
.site-nav a[aria-current="page"] {
    color: #111111;
    background: var(--brand-orange);
}
.site-nav .nav-signout {
    margin-left: 4px;
    border: 1px solid #4a4a4a;
}
.nav-toggle {
    display: none;
    min-width: 46px;
    min-height: 46px;
    padding: 8px;
    border: 1px solid var(--brand-orange);
    border-radius: 10px;
    background: #171717;
    color: white;
    cursor: pointer;
}
.nav-toggle-lines,
.nav-toggle-lines::before,
.nav-toggle-lines::after {
    display: block;
    width: 22px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    content: "";
    transition: transform .18s ease, opacity .18s ease;
}
.nav-toggle-lines { position: relative; margin-inline: auto; }
.nav-toggle-lines::before { position: absolute; top: -7px; }
.nav-toggle-lines::after { position: absolute; top: 7px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-lines { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-lines::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-lines::after { top: 0; transform: rotate(-45deg); }

h1, h2, h3 { line-height: 1.18; color: #202832; }
h1 { margin: 0 0 22px; font-size: clamp(1.75rem, 4vw, 2.45rem); letter-spacing: -.035em; }
h2 { margin: 0 0 16px; font-size: clamp(1.25rem, 2.4vw, 1.55rem); letter-spacing: -.02em; }
h3 { margin: 0 0 10px; }
p:first-child { margin-top: 0; }
p:last-child { margin-bottom: 0; }

.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 20px;
}
.page-heading h1 { margin: 0; }
.page-heading > :first-child { min-width: 0; }
.push-right { margin-left: auto; }

.card {
    margin-bottom: 20px;
    padding: clamp(18px, 3vw, 25px);
    border: 1px solid rgba(205, 213, 222, .94);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .97);
    box-shadow: var(--shadow-sm);
}
.card:hover { border-color: #c6ced7; }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.login-card { max-width: 520px; margin-inline: auto; }
.hero-card {
    overflow: hidden;
    border-color: #e8d4b4;
    background: linear-gradient(135deg, white 53%, #fff2dd);
    box-shadow: var(--shadow-md);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
    gap: 17px;
}
.stats-grid .card { position: relative; overflow: hidden; min-height: 132px; }
.stats-grid .card::after {
    position: absolute;
    right: -24px;
    bottom: -34px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--primary-soft);
    content: "";
}
.stat { position: relative; z-index: 1; margin: 5px 0 0; font-size: clamp(2rem, 6vw, 2.65rem); font-weight: 850; color: var(--primary-dark); }
.muted { color: var(--muted); }

.project-section { margin-bottom: 34px; }
.project-banner {
    position: relative;
    overflow: hidden;
    margin-bottom: 17px;
    border-left: 7px solid var(--brand-orange);
    background: linear-gradient(125deg, #111 0, #202020 72%, #36240d 100%);
    color: #f2f2f2;
    box-shadow: var(--shadow-md);
}
.project-banner h2 { margin-bottom: 8px; color: #ffffff; }
.project-banner .muted { color: #c6c6c6; }
.project-kicker {
    margin-bottom: 6px;
    color: var(--brand-orange);
    font-size: .78rem;
    font-weight: 850;
    letter-spacing: .09em;
    text-transform: uppercase;
}
.project-description { max-width: 760px; }
.project-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.project-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    color: #f7f7f7;
    font-size: .8rem;
    font-weight: 700;
}

.lesson-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    gap: 17px;
}
.lesson-card {
    display: flex;
    min-height: 230px;
    flex-direction: column;
    margin: 0;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.lesson-card:hover { transform: translateY(-2px); border-color: #deb875; box-shadow: var(--shadow-md); }
.lesson-number {
    display: inline-flex;
    width: fit-content;
    margin-bottom: 14px;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.lesson-card h2 { margin-bottom: 8px; }
.lesson-meta { margin-bottom: 18px; color: var(--muted); }
.lesson-card .actions { margin-top: auto; }
.empty-state { padding: 28px; text-align: center; }

label { display: block; margin: 16px 0 7px; font-weight: 750; color: #2b3744; }
label > input,
label > select,
label > textarea { margin-top: 7px; }
input[type="text"],
input[type="password"],
input[type="number"],
input:not([type]),
select,
textarea {
    width: 100%;
    min-height: 46px;
    padding: 11px 13px;
    border: 1px solid #aeb8c3;
    border-radius: var(--radius-sm);
    outline: none;
    background: white;
    color: var(--ink);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
textarea { min-height: 126px; resize: vertical; }
input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand-orange-dark);
    box-shadow: 0 0 0 4px rgba(244, 161, 38, .18);
}
input::placeholder, textarea::placeholder { color: #84909d; }
.compact-input { max-width: 220px; }
.help-text { margin-top: 5px; color: var(--muted); font-size: .88rem; }

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
    gap: 10px;
    margin-top: 10px;
}
.check-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-soft);
    cursor: pointer;
}
.check-card:hover { border-color: #d4a75d; background: #fff7ea; }
.check-card input { width: 19px; height: 19px; flex: 0 0 auto; margin: 2px 0 0; accent-color: var(--brand-orange-dark); }

button,
.button {
    display: inline-flex;
    min-height: 43px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: white;
    text-align: center;
    text-decoration: none;
    font-weight: 750;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(120, 60, 0, .16);
    transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
button:hover,
.button:hover { transform: translateY(-1px); background: var(--primary-dark); color: white; box-shadow: 0 6px 14px rgba(100, 48, 0, .23); }
button:active,
.button:active { transform: translateY(0); }
.button.secondary,
button.secondary { border-color: #c7cdd4; background: white; color: #3f4c5a; box-shadow: none; }
.button.secondary:hover,
button.secondary:hover { background: #edf0f3; color: #202a34; }
.button.dark,
button.dark { background: #1a1a1a; }
.button.danger,
button.danger { background: var(--danger); }
.button.danger:hover,
button.danger:hover { background: #842b2b; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.inline-form { display: inline-flex; }

.filter-bar {
    display: grid;
    grid-template-columns: minmax(200px, 340px) auto;
    align-items: end;
    gap: 10px;
    margin-bottom: 18px;
}
.filter-bar label { margin: 0; }

.table-wrap {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table-wrap > h2 { position: sticky; left: 0; }
table { width: 100%; min-width: 700px; border-spacing: 0; border-collapse: separate; background: white; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: #eceff2; color: #394653; font-size: .79rem; letter-spacing: .035em; text-transform: uppercase; }
thead th:first-child { border-top-left-radius: 9px; }
thead th:last-child { border-top-right-radius: 9px; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: #fff8ed; }
tbody tr:last-child td { border-bottom: 0; }
td .actions { flex-wrap: nowrap; }

.flash {
    margin: 0 0 18px;
    padding: 13px 16px;
    border: 1px solid transparent;
    border-radius: 11px;
    font-weight: 650;
    box-shadow: var(--shadow-sm);
}
.flash.success { border-color: #b9dfc7; background: var(--success-soft); color: #155f38; }
.flash.error { border-color: #efc5c5; background: var(--danger-soft); color: #822d2d; }
.badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 4px 9px;
    border-radius: 999px;
    background: #e9edf1;
    color: #46525f;
    font-size: .79rem;
    font-weight: 750;
    white-space: nowrap;
}
.badge.good { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warning-soft); color: var(--warning); }
.badge.brand { background: var(--brand-orange-soft); color: #7d3b00; }

.question { border-left: 6px solid #d59a3e; }
.question h2 { font-size: clamp(1.12rem, 2.5vw, 1.4rem); }
.option {
    display: flex;
    min-height: 48px;
    align-items: flex-start;
    gap: 10px;
    margin: 10px 0;
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-soft);
    color: var(--ink);
    font-weight: 550;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.option:hover { transform: translateY(-1px); border-color: #d8aa61; background: #fff5e5; }
.option input { width: 19px; height: 19px; flex: 0 0 auto; margin: 2px 0 0; accent-color: var(--brand-orange-dark); }
.feedback { margin-top: 14px; padding: 13px 15px; border-left: 4px solid var(--brand-orange); border-radius: 0 9px 9px 0; background: #fff8df; }
.answer-correct { border-left-color: var(--success); }
.answer-incorrect { border-left-color: var(--danger); }

.footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 26px 0 38px;
    color: #68727d;
    font-size: .9rem;
    text-align: center;
}
.footer-logo { color: #2a2a2a; font-size: 1.02rem; }

:focus-visible { outline: 3px solid rgba(244, 161, 38, .82); outline-offset: 3px; }

@media (max-width: 980px) {
    .brand-service { font-size: .64rem; }
    .site-nav a { padding-inline: 9px; font-size: .87rem; }
}

@media (max-width: 860px) {
    .wrap { width: min(100% - 24px, 1180px); }
    .header-inner { min-height: 68px; flex-wrap: wrap; gap: 8px; padding-block: 9px; }
    .hm-logo { font-size: 1.48rem; }
    .nav-toggle { display: inline-grid; place-items: center; }
    .site-nav {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 7px;
        padding: 8px 0 12px;
        background: #090909;
    }
    .site-nav a,
    .site-nav a:visited {
        width: 100%;
        min-height: 46px;
        padding: 12px 14px;
        border: 1px solid #353535;
        background: #181818;
        color: #ffffff !important;
    }
    .site-nav a:hover,
    .site-nav a:focus-visible {
        background: #2b2b2b;
        color: #ffffff !important;
    }
    .site-nav a[aria-current="page"] {
        border-color: var(--brand-orange);
        background: var(--brand-orange);
        color: #111111 !important;
    }
    .site-nav .nav-signout { margin-left: 0; border-color: #7a3a00; }
    .js .site-nav { display: none; }
    .js .site-nav.is-open { display: flex; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .page-heading .button { width: 100%; }
    .actions.page-actions { align-items: stretch; flex-direction: column; }
    .actions.page-actions > * { width: 100%; }
    .lesson-card { min-height: 0; }
    .card { border-radius: 14px; }
    td .actions { flex-wrap: wrap; }
}

@media (max-width: 620px) {
    .filter-bar { grid-template-columns: 1fr; }
    .filter-bar .button { width: 100%; }
    .footer { flex-direction: column; gap: 5px; }
}

@media (max-width: 520px) {
    .wrap { width: min(100% - 18px, 1180px); }
    main.wrap { padding-bottom: 8px; }
    .site-header { margin-bottom: 18px; }
    .card { padding: 16px; margin-bottom: 14px; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stats-grid .card { min-height: 112px; padding: 14px; }
    .stat { font-size: 2rem; }
    .button, button { width: 100%; }
    .actions { align-items: stretch; flex-direction: column; }
    .actions .button,
    .actions button,
    .inline-form { width: 100%; }
    .compact-input { max-width: none; }
    table { min-width: 650px; }
    input[type="text"], input[type="password"], input[type="number"], input:not([type]), select, textarea { font-size: 16px; }
    .project-banner { border-left-width: 5px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
