:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --card-soft: #f8fafc;
    --text: #172033;
    --muted: #667085;
    --line: #d8e0eb;
    --primary: #2563eb;
    --primary-soft: #e8f0ff;
    --success: #16a34a;
    --success-soft: #eaf8ef;
    --warning: #d97706;
    --warning-soft: #fff4e5;
    --danger: #dc2626;
    --danger-soft: #ffe9e9;
    --shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

body {
    min-height: 100vh;
}

h1, h2, h3 {
    margin: 0;
}

p {
    margin: 0;
    color: var(--muted);
}

.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 18px;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.16), transparent 28%),
        radial-gradient(circle at bottom right, rgba(22, 163, 74, 0.10), transparent 30%),
        var(--bg);
}

.auth-brand {
    width: 100%;
    max-width: 460px;
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 20px;
}

.brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    box-shadow: var(--shadow);
}

.brand-logo.large {
    width: 58px;
    height: 58px;
    font-size: 20px;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: var(--card);
    border: 1px solid rgba(216, 224, 235, 0.6);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 28px;
}

.auth-title {
    margin-bottom: 8px;
}

.auth-subtitle {
    margin-bottom: 24px;
}

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

.form-row {
    display: grid;
    gap: 14px;
}

.form-row.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
    display: grid;
    gap: 8px;
}

label {
    font-size: 14px;
    font-weight: 600;
}

input[type="text"],
input[type="password"],
input[type="search"],
input[type="file"],
textarea,
select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}

input:focus,
textarea:focus,
select:focus {
    border-color: rgba(37, 99, 235, 0.55);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

input[type="file"] {
    padding: 12px;
    background: var(--card-soft);
}

small, .help {
    color: var(--muted);
    font-size: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    border: none;
    border-radius: 14px;
    padding: 0 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.25);
}

.btn-secondary {
    background: #0f172a;
    color: #fff;
}

.btn-light {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--line);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

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

.btn-sm {
    min-height: 34px;
    border-radius: 12px;
    padding: 0 12px;
    font-size: 13px;
}

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

.muted {
    color: var(--muted);
}

.mono {
    font-family: Consolas, Monaco, monospace;
}

.flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.flash {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
}

.flash-success {
    background: var(--success-soft);
    color: #136b34;
    border-color: rgba(22, 163, 74, 0.15);
}

.flash-error {
    background: var(--danger-soft);
    color: #9f1d1d;
    border-color: rgba(220, 38, 38, 0.15);
}

.flash-info {
    background: var(--primary-soft);
    color: #1d4ed8;
    border-color: rgba(37, 99, 235, 0.15);
}

.flash-warning {
    background: var(--warning-soft);
    color: #a35d09;
    border-color: rgba(217, 119, 6, 0.15);
}

.app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #0f172a;
    color: #fff;
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-name {
    font-size: 18px;
    font-weight: 800;
}

.brand-meta {
    color: rgba(255,255,255,0.64);
    font-size: 13px;
}

.side-nav {
    display: grid;
    gap: 8px;
}

.nav-link {
    color: rgba(255,255,255,0.8);
    padding: 12px 14px;
    border-radius: 14px;
    transition: background .2s ease, color .2s ease;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
    text-decoration: none;
}

.storage-widget,
.user-card {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 18px;
    padding: 16px;
}

.storage-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
}

.storage-bar {
    height: 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 10px;
}

.storage-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #60a5fa, #22c55e);
    border-radius: inherit;
}

.storage-meta {
    color: rgba(255,255,255,0.7);
    font-size: 13px;
}

.user-card {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    display: grid;
    place-items: center;
    font-weight: 700;
}

.user-name {
    font-weight: 700;
}

.user-role {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
}

.main-content {
    padding: 24px;
}

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

.topbar h1 {
    font-size: 30px;
    margin-bottom: 6px;
}

.topbar p {
    font-size: 15px;
}

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

.page-body {
    display: grid;
    gap: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.stat-card,
.section-card,
.public-card {
    background: var(--card);
    border: 1px solid rgba(216, 224, 235, 0.65);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.stat-card {
    padding: 18px;
}

.stat-label {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 10px;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
}

.stat-meta {
    margin-top: 6px;
    font-size: 13px;
    color: var(--muted);
}

.section-card {
    padding: 20px;
}

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

.section-title {
    font-size: 20px;
    font-weight: 800;
}

.section-subtitle {
    margin-top: 5px;
    font-size: 14px;
}

.upload-layout {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 18px;
}

.upload-box {
    background: linear-gradient(180deg, #f8fbff, #f1f6ff);
    border: 1px dashed rgba(37, 99, 235, 0.28);
    border-radius: 22px;
    padding: 20px;
}

.upload-box h3 {
    margin-bottom: 8px;
}

.search-toolbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.search-form {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
}

.search-form .field-search {
    flex: 1 1 280px;
}

.pill-group {
    display: inline-flex;
    gap: 10px;
    flex-wrap: wrap;
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.pill.active {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: rgba(37, 99, 235, 0.2);
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.file-card {
    border: 1px solid rgba(216, 224, 235, 0.7);
    border-radius: 20px;
    padding: 18px;
    background: var(--card-soft);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.file-card:hover {
    border-color: rgba(37, 99, 235, 0.28);
    transform: translateY(-2px);
    transition: transform .15s ease, border-color .15s ease;
}

.file-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: var(--primary-soft);
    color: var(--primary);
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 800;
}

.file-name {
    font-weight: 800;
    line-height: 1.35;
    word-break: break-word;
}

.file-meta {
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}

.badge-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge-success {
    background: var(--success-soft);
    color: #166534;
}

.badge-warning {
    background: var(--warning-soft);
    color: #b45309;
}

.badge-danger {
    background: var(--danger-soft);
    color: #b91c1c;
}

.badge-info {
    background: var(--primary-soft);
    color: #1d4ed8;
}

.action-stack {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.inline-form {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
}

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

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(216, 224, 235, 0.75);
    vertical-align: top;
    font-size: 14px;
}

.table th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.table tr:last-child td {
    border-bottom: none;
}

.empty-state {
    text-align: center;
    padding: 30px 18px;
    border: 1px dashed var(--line);
    border-radius: 18px;
    background: var(--card-soft);
}

.link-box {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px 12px;
}

.link-box input {
    border: none;
    padding: 0;
    background: transparent;
    flex: 1 1 200px;
    box-shadow: none;
}

.link-box input:focus {
    box-shadow: none;
}

.public-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

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

.public-head {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
}

.public-file-icon {
    width: 66px;
    height: 66px;
    border-radius: 20px;
    background: var(--primary-soft);
    color: var(--primary);
    display: grid;
    place-items: center;
    font-size: 18px;
    font-weight: 800;
}

.public-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.notice-box {
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--card-soft);
    border: 1px dashed var(--line);
}

.footer-note {
    margin-top: 18px;
    font-size: 13px;
    color: var(--muted);
}

hr.sep {
    border: none;
    border-top: 1px solid rgba(216, 224, 235, 0.75);
    margin: 18px 0;
}

@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .upload-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 920px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        gap: 16px;
    }

    .user-card {
        margin-top: 0;
    }
}

@media (max-width: 680px) {
    .main-content {
        padding: 18px;
    }

    .auth-card {
        padding: 22px;
    }

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

    .stats-grid,
    .form-row.two {
        grid-template-columns: 1fr;
    }

    .section-card,
    .stat-card,
    .public-card {
        border-radius: 18px;
    }
}

.notice-box.compact {
    font-size: 14px;
}

.choice-grid {
    display: grid;
    gap: 10px;
    min-width: 260px;
}

.choice-card {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
}

.choice-card input[type="radio"] {
    margin-top: 2px;
}

.choice-card strong {
    display: block;
    margin-bottom: 4px;
}


.upload-status {
    display: grid;
    gap: 12px;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid rgba(37, 99, 235, 0.18);
    background: #f8fbff;
}

.upload-status.is-error {
    border-color: rgba(220, 38, 38, 0.25);
    background: #fff7f7;
}

.upload-status-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    font-weight: 700;
}

.upload-status-meta {
    font-size: 13px;
    color: var(--muted);
}

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

.upload-progress-item {
    display: grid;
    gap: 6px;
}

.upload-progress-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.upload-progress-name {
    font-weight: 700;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-progress-bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: #e5edf9;
    overflow: hidden;
}

.upload-progress-bar > span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #2563eb, #4f46e5);
    transition: width .18s ease;
}
