:root {
    --ink: #18211d;
    --muted: #68736d;
    --line: #d9dedb;
    --surface: #ffffff;
    --soft: #f3f5f3;
    --canvas: #e9ece9;
    --accent: #176b4b;
    --accent-dark: #0f5439;
    --accent-soft: #e5f2eb;
    --danger: #a13b35;
    --shadow: 0 18px 55px rgba(25, 40, 32, 0.12);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    min-height: 100%;
    color-scheme: light;
    background: var(--canvas);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 8% 0%, rgba(255, 255, 255, 0.92), transparent 28rem),
        var(--canvas);
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    min-height: 68px;
    padding: 0 32px;
    border-bottom: 1px solid rgba(24, 33, 29, 0.1);
    background: rgba(248, 250, 248, 0.9);
    backdrop-filter: blur(18px);
}

.brand,
.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 9px;
    background: var(--ink);
    color: #fff;
    font-size: 15px;
    letter-spacing: 0;
}

.topnav {
    display: flex;
    align-self: stretch;
    gap: 8px;
    margin-left: 44px;
}

.topnav a {
    display: flex;
    align-items: center;
    padding: 0 14px;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-size: 14px;
    font-weight: 650;
    text-decoration: none;
}

.topnav a:hover,
.topnav a[aria-current="page"] {
    border-bottom-color: var(--accent);
    color: var(--ink);
}

.account {
    display: flex;
    align-items: center;
    gap: 15px;
}

.account-email {
    max-width: 260px;
    overflow: hidden;
    color: var(--muted);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quiet-button,
.text-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 13px;
    font-weight: 650;
}

.quiet-button:hover,
.text-button:hover {
    color: var(--ink);
}

.text-button.danger {
    color: var(--danger);
}

.app-main {
    width: min(1240px, calc(100% - 48px));
    margin: 0 auto;
    padding: 54px 0 90px;
}

.auth-main {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 32px 20px;
}

.auth-card {
    width: min(100%, 470px);
    padding: 42px;
    border: 1px solid rgba(24, 33, 29, 0.11);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow);
}

.compact-card {
    text-align: center;
}

.compact-card .auth-brand {
    justify-content: center;
}

.auth-copy {
    margin: 40px 0 28px;
}

.eyebrow {
    display: block;
    margin-bottom: 8px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.16em;
}

h1,
h2,
p {
    margin-top: 0;
}

.auth-copy h1,
.page-heading h1 {
    margin-bottom: 10px;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.07;
    letter-spacing: -0.035em;
}

.auth-copy p,
.page-heading p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.6;
}

.stack-form {
    display: grid;
    gap: 10px;
}

.stack-form label,
.inline-form label span {
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 46px;
    padding: 10px 13px;
    border: 1px solid #cbd2ce;
    border-radius: 10px;
    outline: none;
    background: #fff;
    color: var(--ink);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(23, 107, 75, 0.12);
}

.code-input {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.24em;
    text-align: center;
}

.primary-button,
.primary-link,
.download-link,
.small-button {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border: 0;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 750;
    text-decoration: none;
    transition: background 150ms ease, transform 150ms ease;
}

.primary-button:hover,
.primary-link:hover,
.download-link:hover,
.small-button:hover {
    background: var(--accent-dark);
}

.primary-button:active,
.primary-link:active,
.download-link:active {
    transform: translateY(1px);
}

.primary-button.compact {
    min-height: 44px;
}

.secondary-form {
    margin-top: 15px;
    text-align: center;
}

.auth-footnote {
    margin: 26px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
}

.auth-footnote a {
    color: var(--accent);
    font-weight: 700;
}

.notice {
    margin: 0 0 20px;
    padding: 12px 14px;
    border: 1px solid #c6d8cc;
    border-radius: 10px;
    background: var(--accent-soft);
    color: #234d38;
    font-size: 13px;
    line-height: 1.5;
}

.notice.success {
    margin-bottom: 24px;
}

.notice.error {
    border-color: #e3c4c0;
    background: #f9eae8;
    color: #7c302b;
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 36px;
}

.page-heading > div:first-child {
    max-width: 680px;
}

.heading-stat {
    display: grid;
    min-width: 118px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.66);
    text-align: right;
}

.heading-stat strong,
.dashboard-stats strong {
    font-size: 24px;
    line-height: 1;
}

.heading-stat span,
.dashboard-stats span {
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
}

.file-grid {
    display: grid;
    gap: 14px;
}

.file-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 22px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 8px 28px rgba(26, 40, 32, 0.045);
}

.file-type {
    display: grid;
    width: 58px;
    height: 68px;
    place-items: end center;
    padding-bottom: 11px;
    border: 1px solid #cbd8d1;
    border-radius: 8px 15px 8px 8px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0.08em;
}

.file-content h2 {
    margin-bottom: 6px;
    font-size: 18px;
    letter-spacing: -0.015em;
}

.file-content > p {
    margin-bottom: 13px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.file-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
    margin: 0;
}

.file-meta div {
    display: flex;
    gap: 6px;
}

.file-meta dt,
.file-meta dd {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
}

.file-meta dt {
    font-weight: 750;
}

.file-meta .checksum {
    min-width: 0;
    max-width: 360px;
}

.file-meta .checksum dd {
    overflow: hidden;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty-state {
    display: grid;
    min-height: 330px;
    place-items: center;
    align-content: center;
    padding: 36px;
    border: 1px dashed #bec7c2;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.48);
    text-align: center;
}

.empty-state h1,
.empty-state h2 {
    margin: 14px 0 7px;
}

.empty-state p {
    max-width: 460px;
    margin-bottom: 20px;
    color: var(--muted);
}

.empty-icon {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 20px;
    font-weight: 800;
}

.dashboard-stats {
    display: flex;
    gap: 8px;
}

.dashboard-stats div {
    display: grid;
    min-width: 104px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.7);
    text-align: right;
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(310px, 0.7fr);
    gap: 18px;
    margin-bottom: 18px;
}

.admin-panel {
    min-width: 0;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
}

.full-panel {
    margin-top: 18px;
}

.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.panel-heading h2 {
    margin-bottom: 0;
    font-size: 20px;
}

.panel-note,
.panel-empty,
.subline {
    color: var(--muted);
    font-size: 12px;
}

.panel-empty {
    margin-bottom: 0;
    line-height: 1.6;
}

.inline-form {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) 150px auto;
    align-items: end;
    gap: 10px;
    margin-bottom: 22px;
}

.inline-form label {
    display: grid;
    gap: 7px;
}

.admin-form {
    gap: 8px;
}

.admin-form label:not(:first-of-type) {
    margin-top: 4px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th,
td {
    padding: 13px 10px;
    border-top: 1px solid #e8ece9;
    text-align: left;
    vertical-align: middle;
}

th {
    border-top: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
}

td strong,
td .subline {
    display: block;
}

.muted-row {
    opacity: 0.55;
}

.status-pill {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--soft);
    color: var(--muted);
    font-size: 10px;
    font-weight: 750;
}

code {
    color: #4c5952;
    font-size: 11px;
}

.assignment-form {
    display: flex;
    gap: 6px;
    min-width: 270px;
}

.assignment-form select {
    min-height: 36px;
    padding: 6px 9px;
}

.small-button {
    min-height: 36px;
    padding: 7px 11px;
    font-size: 12px;
}

@media (max-width: 900px) {
    .topbar {
        grid-template-columns: auto 1fr;
        padding: 0 20px;
    }

    .topnav {
        display: none;
    }

    .account {
        justify-self: end;
    }

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

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-stats {
        width: 100%;
    }

    .dashboard-stats div {
        flex: 1;
        text-align: left;
    }
}

@media (max-width: 660px) {
    .account-email {
        display: none;
    }

    .app-main {
        width: min(100% - 28px, 1240px);
        padding-top: 34px;
    }

    .auth-card {
        padding: 30px 24px;
        border-radius: 18px;
    }

    .file-card {
        grid-template-columns: auto 1fr;
        align-items: start;
        gap: 16px;
    }

    .download-link {
        grid-column: 1 / -1;
    }

    .file-meta {
        display: grid;
    }

    .inline-form {
        grid-template-columns: 1fr;
    }

    .dashboard-stats {
        overflow-x: auto;
    }

    .dashboard-stats div {
        min-width: 110px;
    }

    .admin-panel {
        padding: 18px;
    }
}

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

