/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    line-height: 1.5;
    min-height: 100vh;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }
.mb-0 { margin-bottom: 0 !important; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-4 { margin-top: 1.5rem; }
.ml-2 { margin-left: 0.5rem; }
.nowrap { white-space: nowrap; }
.mono { font-family: 'Cascadia Code', 'Fira Mono', Consolas, monospace; font-size: 0.85em; }

/* ── Navbar ── */
.navbar {
    display: flex;
    align-items: center;
    background: #1a1a2e;
    color: #e2e8f0;
    padding: 0 1.5rem;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    white-space: nowrap;
}
.nav-brand svg { opacity: 0.85; }
.nav-links {
    display: flex;
    gap: 0.25rem;
    flex: 1;
}
.nav-links a {
    color: #94a3b8;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all .15s;
}
.nav-links a:hover, .nav-links a.active {
    color: #fff;
    background: rgba(255,255,255,.1);
    text-decoration: none;
}
.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: #94a3b8;
}

/* ── Container ── */
.container { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }
.container-wide { max-width: 1400px; }

/* ── Page Header ── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    gap: 1rem;
    flex-wrap: wrap;
}
.page-header h2 { font-size: 1.5rem; font-weight: 700; color: #0f172a; }
.page-header .sub { color: #64748b; font-size: 0.9rem; margin-top: 0.2rem; }
.actions-group { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 1rem;
    border-radius: 7px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all .15s;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-outline { background: transparent; color: #374151; border-color: #d1d5db; }
.btn-outline:hover { background: #f3f4f6; }
.btn-outline-light { background: transparent; color: #e2e8f0; border-color: #4b5563; }
.btn-outline-light:hover { background: rgba(255,255,255,.1); }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 0.25rem 0.65rem; font-size: 0.8rem; }

/* ── Cards ── */
.card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    overflow: hidden;
}
.card-header {
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: #fafbfc;
}
.card-header h3 { font-size: 0.95rem; font-weight: 600; color: #0f172a; }
.card-body { padding: 1.25rem; }

/* ── Stat Grid ── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    padding: 1rem 1.25rem;
    text-align: center;
}
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; color: #0f172a; }
.stat-card .stat-label { font-size: 0.8rem; color: #64748b; margin-top: 0.2rem; }
.stat-pending  .stat-value { color: #d97706; }
.stat-imported .stat-value { color: #16a34a; }
.stat-failed   .stat-value { color: #dc2626; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
.scrollable { max-height: 480px; overflow-y: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.data-table th, .data-table td {
    padding: 0.55rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}
.data-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    position: sticky;
    top: 0;
}
.data-table tbody tr:hover { background: #f9fafb; }
.data-table-sm td, .data-table-sm th { padding: 0.35rem 0.6rem; font-size: 0.8rem; }
.filename { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.null { color: #94a3b8; font-style: italic; font-size: 0.8em; }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 0.2em 0.6em;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}
.badge-pending   { background: #fef3c7; color: #92400e; }
.badge-analysed  { background: #dbeafe; color: #1e40af; }
.badge-imported  { background: #dcfce7; color: #166534; }
.badge-failed    { background: #fee2e2; color: #991b1b; }
.badge-info      { background: #f0f9ff; color: #0369a1; }

/* ── Alerts ── */
.alert {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    border-left: 4px solid transparent;
}
.alert-error   { background: #fef2f2; border-color: #ef4444; color: #7f1d1d; }
.alert-success { background: #f0fdf4; border-color: #22c55e; color: #14532d; }
.alert-info    { background: #f0f9ff; border-color: #38bdf8; color: #0c4a6e; }
.alert-warning { background: #fffbeb; border-color: #f59e0b; color: #78350f; }

/* ── Forms ── */
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.4rem; color: #374151; }
.form-control {
    width: 100%;
    padding: 0.55rem 0.8rem;
    border: 1.5px solid #d1d5db;
    border-radius: 7px;
    font-size: 0.9rem;
    color: #1a1a2e;
    background: #fff;
    transition: border-color .15s;
    appearance: none;
}
.form-control:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-control-sm { padding: 0.3rem 0.6rem; font-size: 0.82rem; }
.form-section { margin: 1.5rem 0 0.75rem; }
.form-section h4 { font-size: 0.875rem; font-weight: 600; color: #374151; }
.form-actions { display: flex; gap: 0.75rem; align-items: center; margin-top: 1.5rem; flex-wrap: wrap; }
.hint { font-size: 0.8rem; color: #6b7280; margin-top: 0.3rem; }

/* ── Drop Zone ── */
.drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    position: relative;
    background: #f8fafc;
}
.drop-zone:hover, .drop-zone.drag-over {
    border-color: #2563eb;
    background: #eff6ff;
}
.drop-zone-content { pointer-events: none; }
.drop-zone-content svg { color: #94a3b8; margin-bottom: 0.75rem; }
.drop-zone-content p { color: #475569; margin: 0.25rem 0; }
.drop-zone-content .hint { font-size: 0.8rem; }
.link-label { color: #2563eb; cursor: pointer; text-decoration: underline; pointer-events: all; }
.file-selected {
    margin-top: 0.75rem;
    color: #16a34a;
    font-weight: 500;
    font-size: 0.9rem;
}

/* ── Progress Bar ── */
.progress-wrap {
    margin: 1rem 0;
    background: #f1f5f9;
    border-radius: 6px;
    height: 8px;
    position: relative;
}
.progress-bar {
    height: 100%;
    background: #2563eb;
    border-radius: 6px;
    transition: width .3s ease;
}
#progress-label {
    display: block;
    text-align: center;
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.35rem;
}

/* ── Info Table ── */
.info-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.info-table th, .info-table td { padding: 0.45rem 0.75rem; border-bottom: 1px solid #f1f5f9; }
.info-table th { width: 35%; color: #475569; font-weight: 500; background: #f8fafc; }

/* ── Meta Grid ── */
.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem 1.5rem;
}
.meta-grid > div { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.875rem; }
.meta-label { font-size: 0.75rem; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.04em; }

/* ── Fill Bar ── */
.fill-bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 120px;
}
.fill-bar span { font-size: 0.8rem; color: #475569; white-space: nowrap; }
.fill-inner {
    height: 8px;
    background: #2563eb;
    border-radius: 4px;
    opacity: 0.7;
    min-width: 2px;
    flex-shrink: 0;
}

/* ── Sample Chips ── */
.samples { font-size: 0.78rem; }
.sample-chip {
    display: inline-block;
    background: #f1f5f9;
    border-radius: 4px;
    padding: 0.1em 0.4em;
    margin: 0.1em;
    color: #475569;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

/* ── Empty State ── */
.empty-state { padding: 3rem; text-align: center; color: #94a3b8; }
.empty-state a { color: #2563eb; }

/* ── Login Page ── */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%);
    min-height: 100vh;
}
.login-wrap { width: 100%; max-width: 420px; padding: 1.5rem; }
.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem 2.25rem;
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.login-logo { text-align: center; color: #2563eb; margin-bottom: 0.75rem; }
.login-card h1 {
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
    color: #0f172a;
}
.login-sub { text-align: center; color: #64748b; font-size: 0.875rem; margin: 0.25rem 0 1.5rem; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
