/* ── Auth pages (login / signup) ───────────────────────────────────────────── */
.auth-main {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6rem 1rem 2rem;
    background: linear-gradient(135deg,
        hsla(214, 84%, 20%, 0.04) 0%,
        hsla(0, 0%, 100%, 1) 50%,
        hsla(142, 76%, 36%, 0.04) 100%);
}

.auth-container { width: 100%; max-width: 420px; }

.auth-card {
    background: var(--bg, #fff);
    border: 1px solid var(--border, hsl(214, 32%, 91%));
    border-radius: 16px;
    padding: 2.5rem 2rem;
    box-shadow: 0 8px 30px -12px rgba(0,0,0,.1);
}

.auth-header { text-align: center; margin-bottom: 2rem; }

.auth-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, hsl(214, 84%, 20%), hsl(214, 75%, 35%));
    color: white;
    margin-bottom: 1rem;
}
.auth-icon.green {
    background: linear-gradient(135deg, hsl(142, 76%, 36%), hsl(142, 60%, 45%));
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text, hsl(210, 15%, 15%));
    margin-bottom: .25rem;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--muted, hsl(215, 15%, 55%));
}

.auth-form .form-group {
    margin-bottom: 1.25rem;
}

.auth-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text, hsl(210, 15%, 15%));
    margin-bottom: .4rem;
}

.auth-form label .optional {
    font-weight: 400;
    color: var(--muted, hsl(215, 15%, 55%));
}

.auth-form input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border, hsl(214, 32%, 91%));
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    background: var(--bg, #fff);
    color: var(--text, hsl(210, 15%, 15%));
    transition: border-color .2s;
    box-sizing: border-box;
}
.auth-form input:focus {
    outline: none;
    border-color: hsl(214, 84%, 40%);
    box-shadow: 0 0 0 3px hsla(214, 84%, 40%, .1);
}

.auth-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
    background: linear-gradient(135deg, hsl(214, 84%, 20%), hsl(214, 84%, 30%));
    color: white;
    margin-top: .5rem;
}
.auth-btn.green {
    background: linear-gradient(135deg, hsl(142, 76%, 36%), hsl(142, 60%, 45%));
}
.auth-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px -4px rgba(0,0,0,.2);
}
.auth-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 13px;
    color: var(--muted, hsl(215, 15%, 55%));
}
.auth-footer a {
    color: hsl(214, 84%, 30%);
    font-weight: 600;
    text-decoration: none;
}
.auth-footer a:hover { text-decoration: underline; }

/* ── Flash messages ───────────────────────────────────────────────────────── */
.flash {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 1rem;
    border: 1px solid;
}
.flash-error   { background: hsl(0, 80%, 96%);   border-color: hsl(0, 60%, 85%);   color: hsl(0, 60%, 40%); }
.flash-success { background: hsl(142, 50%, 94%);  border-color: hsl(142, 40%, 80%); color: hsl(142, 50%, 30%); }
.flash-warning { background: hsl(38, 90%, 94%);   border-color: hsl(38, 60%, 80%);  color: hsl(38, 60%, 35%); }
.flash-info    { background: hsl(214, 60%, 95%);  border-color: hsl(214, 40%, 82%); color: hsl(214, 50%, 35%); }

/* ── Portal dashboard ─────────────────────────────────────────────────────── */
.portal-hero {
    padding: 2rem 0 1.5rem;
    border-bottom: 1px solid var(--border, hsl(214, 32%, 91%));
    margin-bottom: 1.5rem;
}
.portal-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: .25rem;
}
.portal-subtitle {
    font-size: 14px;
    color: var(--muted, hsl(215, 15%, 55%));
}

.portal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
@media (max-width: 800px) { .portal-grid { grid-template-columns: 1fr; } }

.portal-card {
    background: var(--bg, #fff);
    border: 1px solid var(--border, hsl(214, 32%, 91%));
    border-radius: 12px;
    padding: 1.5rem;
}

.portal-card-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1rem;
}

.portal-card-icon {
    width: 36px; height: 36px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, hsl(214, 84%, 20%), hsl(214, 75%, 35%));
    color: white;
    flex-shrink: 0;
}
.portal-card-icon.green {
    background: linear-gradient(135deg, hsl(142, 76%, 36%), hsl(142, 60%, 45%));
}

.portal-card-title {
    font-size: 16px;
    font-weight: 600;
}

.portal-card-desc {
    font-size: 13px;
    color: var(--muted, hsl(215, 15%, 55%));
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

/* ── Upload zone ──────────────────────────────────────────────────────────── */
.upload-form { display: flex; flex-direction: column; gap: 1rem; }

.upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: 2rem 1rem;
    border: 2px dashed var(--border, hsl(214, 32%, 91%));
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    text-align: center;
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: hsl(214, 84%, 40%);
    background: hsla(214, 84%, 40%, .03);
}
.upload-zone input[type="file"] { display: none; }
.upload-icon { color: var(--muted, hsl(215, 15%, 55%)); }
.upload-label { font-size: 14px; font-weight: 500; color: var(--text); }
.upload-hint  { font-size: 11px; color: var(--muted, hsl(215, 15%, 55%)); }

/* ── Stats ────────────────────────────────────────────────────────────────── */
.portal-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .75rem;
}
.portal-stat {
    text-align: center;
    padding: .75rem .5rem;
    background: var(--bg-subtle, hsl(210, 20%, 98%));
    border-radius: 8px;
}
.portal-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}
.portal-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted, hsl(215, 15%, 55%));
    margin-top: 2px;
}

/* ── Quick links ──────────────────────────────────────────────────────────── */
.quick-links {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.quick-link {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem .75rem;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    transition: background .15s;
}
.quick-link:hover {
    background: hsla(214, 84%, 20%, .05);
}
.quick-link svg {
    color: hsl(214, 84%, 30%);
    flex-shrink: 0;
}

/* ── Uploads table ────────────────────────────────────────────────────────── */
.uploads-table-wrap { overflow-x: auto; }
.uploads-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.uploads-table th {
    text-align: left;
    padding: .6rem .75rem;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted, hsl(215, 15%, 55%));
    border-bottom: 1px solid var(--border, hsl(214, 32%, 91%));
}
.uploads-table td {
    padding: .6rem .75rem;
    border-bottom: 1px solid var(--border, hsl(214, 32%, 91%));
    vertical-align: middle;
}
.upload-name { font-weight: 500; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-date { color: var(--muted, hsl(215, 15%, 55%)); white-space: nowrap; }

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.status-pending    { background: hsl(38, 90%, 92%);  color: hsl(38, 60%, 35%); }
.status-processing { background: hsl(214, 60%, 92%); color: hsl(214, 50%, 35%); }
.status-ready      { background: hsl(142, 50%, 92%); color: hsl(142, 50%, 30%); }
.status-error      { background: hsl(0, 70%, 94%);   color: hsl(0, 50%, 40%); }

.btn-explore {
    font-size: .8rem;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
    white-space: nowrap;
}
.btn-explore:hover { text-decoration: underline; }

.btn-delete {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: .8rem;
    cursor: pointer;
    padding: 0;
    transition: color .15s;
}
.btn-delete:hover { color: #ef4444; }

.btn-retry {
    background: none;
    border: 1px solid #f97316;
    color: #f97316;
    font-size: .78rem;
    font-family: inherit;
    border-radius: .375rem;
    padding: .2rem .55rem;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}
.btn-retry:hover { background: #f97316; color: white; }

.upload-error-row td { padding: 0 !important; border-bottom: 1px solid var(--border,#e2e8f0); }
.upload-error-panel {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    background: hsl(0,100%,97%);
    border-left: 3px solid #ef4444;
    padding: .65rem 1rem;
    font-size: .82rem;
    color: #374151;
    line-height: 1.5;
}
.upload-error-pre {
    margin-top: .35rem;
    font-size: .72rem;
    font-family: 'DM Mono', monospace;
    background: hsl(0,0%,97%);
    border: 1px solid #e5e7eb;
    border-radius: .25rem;
    padding: .4rem .6rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 120px;
    overflow-y: auto;
    color: #6b7280;
}
