:root {
    color-scheme: light;
    font-family: Arial, "Microsoft YaHei", sans-serif;
    color: #182235;
    background: #f3f6fa;
    --bg: #f3f6fa;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --line: #d8e0eb;
    --line-soft: #e8edf4;
    --text: #182235;
    --muted: #66758a;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --teal: #0f766e;
    --slate: #334155;
    --danger: #c2410c;
    --shadow: 0 14px 34px rgba(15, 23, 42, 0.07);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(180deg, #ffffff 0, #f7f9fc 190px, var(--bg) 460px),
        var(--bg);
}

a {
    color: var(--primary-dark);
}

.shell {
    width: min(1200px, calc(100% - 36px));
    margin: 0 auto;
    padding: 18px 0 44px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 17px;
    font-weight: 800;
    text-decoration: none;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #12343b;
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0;
}

.brand-mark.large {
    width: 48px;
    height: 48px;
    font-size: 13px;
}

.nav {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    background: #f5f7fb;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
}

.nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 7px 12px;
    color: #475569;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.nav a.active {
    color: #fff;
    background: var(--slate);
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin: 4px 0 16px;
}

.compact-head {
    align-items: center;
}

.head-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.eyebrow {
    margin: 0 0 5px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

h1 {
    margin: 0;
    color: var(--text);
    font-size: 26px;
    line-height: 1.2;
}

.panel,
.auth-card {
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel {
    padding: 20px;
}

.auth-layout {
    display: grid;
    min-height: calc(100vh - 80px);
    place-items: center;
}

.auth-card {
    width: min(420px, 100%);
    padding: 28px;
}

.auth-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.form {
    display: grid;
    gap: 16px;
}

label {
    display: grid;
    gap: 8px;
    color: #334155;
    font-weight: 800;
}

input[type="password"],
input[type="file"],
input[type="search"] {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    color: var(--text);
    font: inherit;
    background: #fff;
    outline: none;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: var(--teal);
    color: #fff;
    font: inherit;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}

button:hover,
.button:hover {
    filter: brightness(0.97);
}

.primary {
    background: var(--primary);
}

.secondary {
    background: var(--slate);
}

.muted {
    background: #64748b;
}

.ghost {
    color: #475569;
    background: #fff;
    border-color: var(--line);
}

.danger {
    background: var(--danger);
}

.small {
    min-height: 30px;
    padding: 7px 10px;
    font-size: 13px;
    white-space: nowrap;
}

.full {
    width: 100%;
}

.stat-badge {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 6px 10px;
    color: #475569;
    background: #fff;
    border: 1px solid var(--line-soft);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 800;
}

.form-actions,
.row-actions,
.filter-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.flash,
.error {
    border-radius: 8px;
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    background: #fff;
}

.flash.ok {
    border-color: #99d8ca;
    background: #effaf7;
    color: #0f5132;
}

.flash.warn,
.error {
    border-color: #f3c7c1;
    background: #fff4f2;
    color: #9f1d14;
}

.upload-panel {
    max-width: 740px;
}

.upload-zone {
    position: relative;
    min-height: 174px;
    place-items: center;
    padding: 24px;
    border: 1px dashed #a5b4c7;
    border-radius: 8px;
    background: #f8fafc;
    text-align: center;
}

.upload-zone input[type="file"] {
    max-width: 520px;
    margin-top: 8px;
    background: #fff;
}

.upload-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--slate);
    font-size: 13px;
    font-weight: 900;
}

.upload-title {
    color: var(--text);
    font-size: 18px;
    font-weight: 900;
}

.upload-meta,
td span,
.table-meta {
    color: var(--muted);
    font-size: 13px;
}

.files-panel {
    padding: 0;
    overflow: hidden;
}

.filter-bar {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) auto;
    align-items: end;
    gap: 12px;
    padding: 16px;
    background: #fff;
    border-bottom: 1px solid var(--line-soft);
}

.search-box {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.search-label {
    display: inline-flex;
    align-items: center;
    height: 42px;
    padding: 0 12px;
    color: #475569;
    background: #f8fafc;
    border-right: 1px solid var(--line-soft);
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.search-box input[type="search"] {
    height: 42px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    font-weight: 700;
}

.search-box input[type="search"]:focus {
    box-shadow: none;
}

.table-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px;
    background: #fbfcfe;
    border-bottom: 1px solid var(--line-soft);
}

.table-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 8px;
    background: #fff;
    border: 1px solid var(--line-soft);
    border-radius: 6px;
}

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

table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    vertical-align: middle;
}

th {
    background: #fff;
    color: #5f6f84;
    font-size: 12px;
    font-weight: 900;
}

tbody tr:hover {
    background: #f9fbfd;
}

td strong,
td span {
    display: block;
}

td strong {
    max-width: 340px;
    overflow: hidden;
    color: #182235;
    text-overflow: ellipsis;
    white-space: nowrap;
}

td span {
    margin-top: 4px;
}

.date-cell {
    color: #475569;
    white-space: nowrap;
}

.name-cell {
    min-width: 220px;
}

.link-pill {
    display: inline-flex;
    max-width: 430px;
    padding: 6px 8px;
    overflow: hidden;
    color: #0f5f8f;
    background: #f6f9fc;
    border: 1px solid var(--line-soft);
    border-radius: 6px;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
}

.actions-col {
    width: 220px;
}

.empty {
    padding: 42px 16px;
    color: var(--muted);
    text-align: center;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
}

.pagination span {
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 720px) {
    .shell {
        width: min(100% - 20px, 1200px);
        padding-top: 12px;
    }

    .topbar,
    .page-head,
    .form-actions,
    .row-actions,
    .filter-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .brand {
        align-self: flex-start;
    }

    .nav {
        width: 100%;
        justify-content: stretch;
    }

    .nav a {
        flex: 1;
    }

    .filter-bar {
        grid-template-columns: 1fr;
    }

    .search-box {
        grid-template-columns: 1fr;
    }

    .search-label {
        height: 34px;
        border-right: 0;
        border-bottom: 1px solid var(--line-soft);
    }

    .panel,
    .auth-card {
        padding: 18px;
    }

    .files-panel {
        padding: 0;
    }

    h1 {
        font-size: 24px;
    }

    .pagination {
        align-items: stretch;
        flex-direction: column;
    }
}
