:root {
    --bg-start: #e3ecff;
    --bg-end: #cfe0ff;
    --panel: #ffffff;
    --ink: #0b1330;
    --muted: #4d5a86;
    --line: #c6d6fb;
    --primary: #1d4ed8;
    --primary-strong: #12309e;
    --accent: #00c2ff;
    --accent-2: #2563eb;
    --good: #0a8f5a;
    --warn: #b8860b;
    --bad: #d62839;
    --shadow: 0 18px 44px rgba(11, 19, 48, 0.16);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'DM Sans', Arial, sans-serif;
    color: var(--ink);
    background: var(--bg-start);
    position: relative;
    overflow-x: hidden;
}

#gradient-canvas {
    position: fixed;
    inset: 0;
    z-index: -1;
    width: 100%;
    height: 100%;
    pointer-events: none;
    --gradient-color-1: #0047bb;
    --gradient-color-2: #ff8200;
    --gradient-color-3: #0047bb;
    --gradient-color-4: #242424;
}

h1, h2, h3 {
    margin: 0;
    letter-spacing: -0.01em;
}

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

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

.app-shell {
    max-width: 900px;
    margin: 0 auto;
    padding: 28px 24px 64px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

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

.brand-mark {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.eyebrow {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
}

.topbar h1 {
    font-size: 24px;
    background: linear-gradient(120deg, var(--primary-strong), var(--accent) 70%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.identity {
    text-align: right;
    font-size: 13px;
    line-height: 1.3;
}

.identity small {
    display: block;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
}

.logout-link {
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    color: var(--muted);
    border: 1px solid var(--line);
    padding: 8px 12px;
    border-radius: 10px;
    background: #fff;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}

.panel h2 {
    font-size: 19px;
    margin-bottom: 6px;
}

.panel h3 {
    font-size: 14px;
    margin: 22px 0 10px;
    color: var(--primary-strong);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.panel > p {
    margin-bottom: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px 18px;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 14px;
}

.optional {
    font-weight: 400;
    color: var(--muted);
    text-transform: none;
}

input[type="text"], input[type="email"], input[type="password"], input[type="number"], textarea, select {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 11px 13px;
    border-radius: 10px;
    border: 1px solid var(--line);
    font-size: 14px;
    font-family: inherit;
    background: #fbfcff;
}

textarea {
    resize: vertical;
    font-family: 'Consolas', monospace;
    font-size: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-label input {
    width: auto;
    margin: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    background: linear-gradient(120deg, var(--primary), var(--primary-strong));
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
    min-height: 46px;
    box-shadow: 0 10px 22px rgba(29, 78, 216, 0.32);
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(29, 78, 216, 0.4);
}

.btn.secondary {
    background: #fff;
    color: var(--primary);
    border: 1px solid var(--line);
    box-shadow: none;
}

.btn.secondary:hover {
    background: #eef3ff;
    box-shadow: none;
}

.btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.auth-error, .flash-error {
    background: rgba(214, 40, 57, 0.1);
    color: var(--bad);
    border: 1px solid rgba(214, 40, 57, 0.3);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
}

.flash-ok {
    background: rgba(10, 143, 90, 0.1);
    color: var(--good);
    border: 1px solid rgba(10, 143, 90, 0.3);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
}

.auth-shell {
    min-height: 60vh;
    display: grid;
    place-items: center;
    padding: 24px 0;
}

.auth-card {
    width: min(440px, 100%);
    padding: 32px;
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
}

.auth-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary);
    background: rgba(29, 78, 216, 0.12);
    padding: 4px 10px;
    border-radius: 999px;
    margin-bottom: 12px;
}

.auth-card h1 {
    font-size: 22px;
    margin-bottom: 4px;
}

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

.upload-zone {
    position: relative;
    border: 2px dashed var(--line);
    border-radius: 18px;
    padding: 40px 28px;
    text-align: center;
    background: linear-gradient(180deg, #f5f8ff, #eaf1ff);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.upload-zone:hover, .upload-zone:focus-visible {
    border-color: var(--primary);
}

.upload-zone.dragover {
    border-color: var(--primary);
    background: linear-gradient(180deg, #e4ecff, #d9e6ff);
    transform: scale(1.01);
    box-shadow: 0 0 0 6px rgba(29, 78, 216, 0.1);
}

.upload-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(29, 78, 216, 0.16), rgba(0, 194, 255, 0.2));
    color: var(--primary);
}

.upload-zone strong {
    font-size: 16px;
}

.upload-hint {
    font-size: 12px;
    margin-top: 8px;
}

.upload-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.sr-only-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    opacity: 0;
    border: 0;
}

.sr-only-file-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    padding: 0;
    margin: -1px;
}

.file-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    font-size: 12px;
    color: var(--muted);
}

.link-btn {
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    font-weight: 600;
    font-size: 12px;
    color: var(--primary);
    cursor: pointer;
    text-decoration: underline;
}

.link-btn:hover {
    color: var(--primary-strong);
}

.file-list {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    font-size: 13px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 8px;
    background: #fbfcff;
}

.file-item .file-item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item .file-item-source {
    font-size: 11px;
    color: var(--primary);
    background: rgba(29, 78, 216, 0.1);
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 8px;
    flex-shrink: 0;
}

.file-item .file-item-remove {
    border: none;
    background: none;
    color: var(--bad);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}

.submit-row {
    margin-top: 22px;
    display: flex;
    justify-content: flex-end;
}

.upload-progress {
    margin-top: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.upload-progress-track {
    position: relative;
    flex: 1;
    height: 14px;
    border-radius: 999px;
    background: var(--gradient-color-4, #242424);
    border: 1px solid rgba(255, 130, 0, 0.35);
    overflow: visible;
    box-shadow: inset 0 0 8px rgba(0, 71, 187, 0.55);
}

.upload-progress-fill {
    position: absolute;
    inset: 0;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--gradient-color-1, #0047bb), var(--gradient-color-2, #ff8200), var(--gradient-color-3, #0047bb));
    background-size: 200% 100%;
    animation: pfilesProgressScan 1.6s linear infinite;
    box-shadow: 0 0 10px rgba(255, 130, 0, 0.75), 0 0 18px rgba(0, 71, 187, 0.6);
    transition: width 0.25s ease;
}

.upload-progress-cat {
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -55%);
    font-size: 20px;
    transition: left 0.25s ease;
    animation: pfilesCatRun 0.35s ease-in-out infinite;
    filter: drop-shadow(0 0 6px #ff8200) drop-shadow(0 0 10px #0047bb);
}

.upload-progress-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--gradient-color-2, #ff8200);
    min-width: 42px;
    text-align: right;
    text-shadow: 0 0 6px rgba(255, 130, 0, 0.55);
}

@keyframes pfilesProgressScan {
    0% { background-position: 0% 0; }
    100% { background-position: -200% 0; }
}

@keyframes pfilesCatRun {
    0%, 100% { transform: translate(-50%, -65%) rotate(-8deg); }
    50% { transform: translate(-50%, -45%) rotate(8deg); }
}

.success-panel {
    text-align: center;
    padding: 30px 10px 10px;
}

.success-icon {
    width: 60px;
    height: 60px;
    line-height: 60px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: rgba(10, 143, 90, 0.14);
    color: var(--good);
    font-size: 26px;
    font-weight: 700;
}

.success-panel h2 {
    margin-bottom: 8px;
}

.success-panel p {
    margin-bottom: 18px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 18px;
}

.data-table th, .data-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
}

.data-table th {
    color: var(--muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.03em;
}

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

.site-footer {
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    margin-top: 32px;
}

.footer-logo {
    height: 20px;
    width: auto;
    opacity: 0.8;
    margin-bottom: 6px;
}

.footer-admin-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 11px;
    color: var(--muted);
    text-decoration: none;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.footer-admin-link:hover {
    opacity: 1;
}

@media (max-width: 640px) {
    .topbar h1 {
        font-size: 20px;
    }
    .upload-zone {
        padding: 28px 16px;
    }
}