:root {
    color-scheme: dark;
    --bg: #090e1b;
    --panel: #121a2b;
    --panel-soft: #182238;
    --border: #2a3855;
    --text: #f6f8fc;
    --muted: #9ba9c0;
    --accent: #6678ff;
    --accent-hover: #8290ff;
    --danger: #f16d7f;
    --success: #46c894;
    --warning: #f2bd5b;
    --shadow: 0 22px 70px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 10% 0%, rgba(102, 120, 255, .18), transparent 34rem),
        radial-gradient(circle at 100% 25%, rgba(70, 200, 148, .07), transparent 30rem),
        var(--bg);
    color: var(--text);
}

a { color: var(--accent-hover); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.shell {
    width: min(1240px, calc(100% - 32px));
    margin: 0 auto;
    padding: 42px 0 32px;
}
.shell.narrow { width: min(560px, calc(100% - 28px)); }

.topbar,
.section-heading,
.account-area,
.actions,
.admin-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.topbar { margin-bottom: 20px; }
.account-area { justify-content: flex-end; }
.account-area form { margin: 0; }

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.8rem, 4vw, 2.65rem); letter-spacing: -.03em; }
h2 { margin-bottom: 8px; font-size: 1.23rem; }
code { padding: 2px 6px; border-radius: 6px; background: var(--panel-soft); }
hr { margin: 26px 0; border: 0; border-top: 1px solid var(--border); }

.eyebrow {
    margin-bottom: 6px;
    color: var(--accent-hover);
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}
.muted { color: var(--muted); }

.card {
    margin-bottom: 22px;
    padding: clamp(20px, 4vw, 30px);
    background: rgba(18, 26, 43, .95);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
}
.login-card, .install-card { margin-inline: auto; }
.form-card { max-width: 900px; }

.nav-tabs {
    display: flex;
    gap: 8px;
    margin: 0 0 22px;
    padding: 6px;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(18, 26, 43, .78);
}
.nav-tabs a {
    padding: 9px 13px;
    border-radius: 9px;
    color: var(--muted);
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}
.nav-tabs a.active { color: #fff; background: var(--panel-soft); }

.user-chip,
.status,
.quota-label {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    background: var(--panel-soft);
    font-size: .82rem;
    white-space: nowrap;
}
.status-success { color: #b9f4da; border-color: rgba(70, 200, 148, .4); background: rgba(70, 200, 148, .1); }
.status-danger { color: #ffd1d8; border-color: rgba(241, 109, 127, .4); background: rgba(241, 109, 127, .1); }
.quota-label { color: var(--accent-hover); }

.metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.metric {
    padding: 17px 19px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: rgba(18, 26, 43, .87);
}
.metric span, .metric strong { display: block; }
.metric span { margin-bottom: 6px; color: var(--muted); font-size: .84rem; }
.metric strong { font-size: 1.25rem; }

.stack { display: grid; gap: 14px; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.form-action { display: flex; align-items: end; }
label { display: grid; gap: 7px; color: var(--muted); font-size: .9rem; font-weight: 650; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select {
    width: 100%;
    min-width: 0;
    padding: 12px 13px;
    color: var(--text);
    background: var(--panel-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
}
input:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(102, 120, 255, .12);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 0;
    border-radius: 10px;
    color: #fff;
    background: var(--accent);
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
    transition: transform .15s ease, background .15s ease, opacity .15s ease;
}
.button:hover { background: var(--accent-hover); transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button-secondary { background: var(--panel-soft); border: 1px solid var(--border); }
.button-secondary:hover { background: #22304d; }
.button-danger { background: transparent; color: var(--danger); border: 1px solid rgba(241, 109, 127, .45); }
.button-danger:hover { background: rgba(241, 109, 127, .12); }
.button-small { min-height: 35px; padding: 7px 11px; font-size: .86rem; }
.text-button { margin-top: 5px; padding: 0; border: 0; color: var(--accent-hover); background: none; cursor: pointer; font-size: .82rem; }
.auth-switch { margin: 18px 0 0; text-align: center; }

.quota-track {
    height: 10px;
    margin: 15px 0 20px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--panel-soft);
}
.quota-track span { display: block; height: 100%; background: var(--accent); }

.drop-zone {
    display: grid;
    place-items: center;
    gap: 8px;
    min-height: 220px;
    margin: 0 0 12px;
    padding: 28px;
    text-align: center;
    background: rgba(102, 120, 255, .045);
    border: 2px dashed var(--border);
    border-radius: 16px;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--accent); background: rgba(102, 120, 255, .1); transform: translateY(-1px); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-icon, .public-file-icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    color: var(--accent-hover);
    background: rgba(102, 120, 255, .15);
    font-size: 2rem;
}
.drop-zone span:last-of-type { color: var(--muted); }
.selection { margin-bottom: 14px; font-size: .9rem; }
.progress-wrap { display: flex; align-items: center; gap: 12px; margin: 14px 0; }
.progress { flex: 1; height: 10px; overflow: hidden; border-radius: 999px; background: var(--panel-soft); border: 1px solid var(--border); }
.progress span { display: block; width: 0; height: 100%; background: var(--accent); transition: width .12s linear; }
.inline-message { min-height: 24px; margin-bottom: 10px; color: var(--muted); }
.inline-message.success { color: var(--success); }
.inline-message.error { color: var(--danger); }

.alert { margin-bottom: 22px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border); }
.alert-success { color: #bcf5dc; background: rgba(70, 200, 148, .09); border-color: rgba(70, 200, 148, .32); }
.alert-error { color: #ffd2d8; background: rgba(241, 109, 127, .09); border-color: rgba(241, 109, 127, .32); }

.table-wrap { overflow-x: auto; margin-top: 14px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 11px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; }
td strong, td small { display: block; }
td small { margin-top: 4px; color: var(--muted); }
.actions-column { text-align: right; }
.actions { justify-content: flex-end; flex-wrap: wrap; }
.actions form, .admin-actions form { margin: 0; }
.admin-actions { align-items: stretch; justify-content: flex-start; flex-wrap: wrap; }
.reset-form { display: flex; gap: 6px; }
.reset-form input { width: 165px; padding: 7px 9px; font-size: .84rem; }
.empty-state { margin-top: 16px; padding: 32px; text-align: center; color: var(--muted); background: var(--panel-soft); border-radius: 14px; }

.profile-grid, .download-details {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}
.profile-grid div, .download-details div { padding: 13px; border-radius: 12px; background: var(--panel-soft); }
dt { color: var(--muted); font-size: .78rem; }
dd { margin: 5px 0 0; font-weight: 700; overflow-wrap: anywhere; }

.public-card { text-align: center; }
.public-file-icon { margin: 24px auto 16px; }
.public-card h1 { overflow-wrap: anywhere; font-size: clamp(1.6rem, 5vw, 2.35rem); }
.public-download { width: 100%; margin-top: 12px; }
.security-note { margin: 18px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.55; }

footer { padding: 12px 4px; color: var(--muted); text-align: center; font-size: .82rem; }

@media (max-width: 840px) {
    .metrics { grid-template-columns: 1fr; }
    .section-heading { align-items: flex-start; }
    table, thead, tbody, tr, th, td { display: block; }
    thead { display: none; }
    tr { padding: 12px 0; border-bottom: 1px solid var(--border); }
    td { padding: 7px 0; border: 0; }
    .actions-column { text-align: left; }
    .actions { justify-content: flex-start; }
}

@media (max-width: 620px) {
    .shell { width: min(100% - 20px, 1240px); padding-top: 24px; }
    .topbar { align-items: flex-start; }
    .account-area { align-items: flex-end; flex-direction: column; }
    .form-grid, .profile-grid, .download-details { grid-template-columns: 1fr; }
    .drop-zone { min-height: 185px; }
    .reset-form { width: 100%; flex-wrap: wrap; }
    .reset-form input { flex: 1 1 170px; width: auto; }
}
