/* ===================================================
   1. CORE RESET & BASE
=================================================== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    color: #333;
    background: #f3f4f6;
}

/* ===================================================
   2. SHARED COMPONENTS
=================================================== */
button {
    padding: 10px 18px;
    border-radius: 6px;
    border: none;
    background: #0a2766;
    color: white;
    cursor: pointer;
    transition: 0.2s ease;
    font-weight: 600;
}

button:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

/* Explicit primary button — same as default button but nameable */
.btn-primary {
    background: #0a2766;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.2s;
    white-space: nowrap;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: #93c5fd;
    cursor: not-allowed;
    transform: none;
}

input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
    outline: none;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
}

th {
    background: #f9fafb;
    font-weight: 600;
}

th, td {
    padding: 14px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.form-inline {
    display: inline;
}

/* ===================================================
   3. AUTH LAYOUT
=================================================== */
.auth-body {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

/* Extra wrapper so card stays centred on all screens */
.auth-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 40px 36px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.13);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    color: white;
}

.auth-title {
    margin: 0 0 6px;
    font-size: 1.55rem;
    font-weight: 800;
    color: white;
    letter-spacing: -0.02em;
}

.auth-subtitle {
    margin: 0 0 28px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

/* Form structure */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.auth-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    letter-spacing: 0.02em;
}

/* Override global input inside auth card */
.auth-card input[type="text"],
.auth-card input[type="email"],
.auth-card input[type="password"] {
    background: rgba(255, 255, 255, 0.92);
    border: none;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 0.95rem;
    color: #111827;
    width: 100%;
    margin-bottom: 0;
    transition: box-shadow 0.2s;
    font-family: 'Inter', sans-serif;
}

.auth-card input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
}

.auth-card input::placeholder {
    color: #9ca3af;
}

/* Submit button */
.auth-btn {
    width: 100%;
    padding: 13px;
    background: white;
    color: #0a2766;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: 0.2s;
    margin-top: 6px;
    font-family: 'Inter', sans-serif;
}

.auth-btn:hover {
    background: #e0e7ff;
    transform: translateY(-1px);
}

/* Feedback messages */
.auth-error {
    background: rgba(239, 68, 68, 0.22);
    border: 1px solid rgba(239, 68, 68, 0.45);
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: #fecaca;
}

.auth-message {
    background: rgba(34, 197, 94, 0.18);
    border: 1px solid rgba(34, 197, 94, 0.35);
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: #bbf7d0;
}

/* Backward compat for templates still using .error */
.error {
    background: rgba(239, 68, 68, 0.22);
    border: 1px solid rgba(239, 68, 68, 0.45);
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: #fecaca;
}

/* Bottom links row */
.auth-links {
    margin-top: 22px;
    text-align: center;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.auth-links a {
    color: white;
    font-weight: 600;
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

.auth-divider {
    opacity: 0.4;
}

/* ===================================================
   4. SAAS DASHBOARD LAYOUT
=================================================== */
.app-body {
    margin: 0;
}

.layout {
    display: flex;
    min-height: 100vh;
}

/* ===================================================
   5. SIDEBAR
=================================================== */
.sidebar {
    width: 240px;
    background: #111827;
    color: white;
    padding: 24px 16px;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 36px;
}

.sidebar .logo {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: white;
}

.sidebar-close {
    display: none;
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 1.1rem;
    padding: 4px 8px;
    cursor: pointer;
    line-height: 1;
    border-radius: 4px;
    transition: 0.15s;
}

.sidebar-close:hover {
    background: #1f2937;
    color: white;
    transform: none;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.sidebar nav a {
    color: #9ca3af;
    text-decoration: none;
    margin-bottom: 4px;
    padding: 10px 12px;
    border-radius: 8px;
    transition: 0.2s;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: #1f2937;
    color: white;
    font-weight: 600;
}

.nav-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid #1f2937;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.sidebar-role-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: #1f2937;
    color: #6b7280;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s, width 0.2s;
}

/* Collapse toggle button — desktop only */
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1f2937;
    border: none;
    color: #6b7280;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.7rem;
    flex-shrink: 0;
    padding: 0;
    transition: background 0.15s, color 0.15s;
}

.sidebar-toggle:hover {
    background: #374151;
    color: white;
    transform: none;
}

/* ── Collapsed sidebar (desktop) ── */
.sidebar-collapsed {
    width: 64px;
}

.sidebar-collapsed .logo,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .sidebar-role-badge {
    display: none;
}

.sidebar-collapsed .sidebar-top {
    justify-content: center;
}

.sidebar-collapsed nav a {
    justify-content: center;
    padding: 10px 0;
    gap: 0;
}

.sidebar-collapsed .nav-icon {
    width: auto;
    font-size: 1.2rem;
}

.sidebar-collapsed .sidebar-footer {
    justify-content: center;
}

/* Shift main content when sidebar is collapsed on desktop */
body.sidebar-is-collapsed .main {
    margin-left: 64px;
}

body.sidebar-is-collapsed .footer {
    left: 64px;
}

/* ===================================================
   6. OVERLAY (mobile only)
=================================================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.sidebar-overlay.overlay-visible {
    opacity: 1;
}

/* ===================================================
   7. MAIN CONTENT
=================================================== */
.main {
    margin-left: 240px;
    padding: 40px;
    flex: 1;
    min-height: 100vh;
    transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===================================================
   8. HEADER
=================================================== */
.header {
    background: white;
    padding: 16px 24px;
    border-radius: 12px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    gap: 12px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.header-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: transparent;
    border: none;
    padding: 6px;
    cursor: pointer;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    transition: background 0.15s;
}

.hamburger:hover {
    background: #f3f4f6;
    transform: none;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #374151;
    border-radius: 2px;
    transition: 0.2s;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.user-info {
    text-align: right;
}

.user-info strong {
    display: block;
    font-size: 0.875rem;
    color: #111827;
}

.user-info small {
    color: #9ca3af;
    font-size: 0.75rem;
}

.logout-btn {
    background: #ef4444;
    padding: 8px 15px;
    border-radius: 6px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: #dc2626;
}

/* Avatar initial circle — shown on mobile when user-info is hidden */
.user-avatar {
    display: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #0a2766;
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: default;
}

@media (max-width: 900px) {
    .user-info   { display: none; }
    .user-avatar { display: flex; }
}

/* ===================================================
   9. CARDS
=================================================== */
.card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
}

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-title-sm {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
}

/* ===================================================
   10. STICKY FOOTER
=================================================== */
.footer {
    position: fixed;
    bottom: 0;
    left: 240px;
    right: 0;
    background: #11182705;
    color: #021a36;
    padding: 10px;
    text-align: center;
    font-size: 0.85rem;
}

/* ===================================================
   11. SHARED TABLE UTILITIES
=================================================== */
.table-scroll-wrapper {
    overflow-x: auto;
}

.row-num {
    color: #9ca3af;
    font-size: 0.78rem;
    font-weight: 600;
    width: 40px;
}

.empty-row {
    text-align: center;
    padding: 40px;
    color: #9ca3af;
    font-style: italic;
}

/* ===================================================
   12. SHARED BUTTONS & LINKS
=================================================== */
.btn-view-all {
    font-size: 0.82rem;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
    background: #eff6ff;
    padding: 5px 14px;
    border-radius: 20px;
    transition: 0.15s;
}

.btn-view-all:hover {
    background: #dbeafe;
}

.action-links {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.action-link {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: 0.15s;
}

.link-view            { background: #eff6ff; color: #1d4ed8; }
.link-view:hover      { background: #dbeafe; }
.link-dl              { background: #f0fdf4; color: #15803d; }
.link-dl:hover        { background: #dcfce7; }
.link-del             { background: #fff1f2; color: #be123c; padding: 4px 10px; }
.link-del:hover       { background: #fee2e2; }

/* ===================================================
   VIEWER BANNER
=================================================== */
.viewer-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-left: 4px solid #2563eb;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 24px;
}

.viewer-banner-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.viewer-banner-text {
    margin: 0;
    font-size: 0.875rem;
    color: #1e40af;
    line-height: 1.5;
}

.viewer-banner-text strong {
    color: #1d4ed8;
}

/* ===================================================
   13. DASHBOARD PAGE
=================================================== */
.upload-form {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.file-pick-label {
    cursor: pointer;
}

.file-pick-label input[type="file"] {
    display: none;
}

.file-pick-label span {
    display: inline-block;
    padding: 10px 16px;
    background: #f3f4f6;
    border: 1.5px dashed #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #374151;
    font-weight: 500;
    transition: 0.2s;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-pick-label:hover span {
    border-color: #0a2766;
    background: #eff6ff;
}

.upload-hint {
    margin: 8px 0 0;
    font-size: 0.82rem;
    color: #9ca3af;
}

.link-uploads {
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
}

.link-uploads:hover {
    text-decoration: underline;
}

/* ===================================================
   CURRENT JOB PROGRESS CARD
=================================================== */
.job-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px 28px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    border-left: 4px solid #2563eb;
    margin-bottom: 24px;
}

.job-card.job-done   { border-left-color: #16a34a; }
.job-card.job-error  { border-left-color: #dc2626; }
.job-card.job-idle   { border-left-color: #d1d5db; }

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

.job-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.job-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.job-badge.running {
    background: #eff6ff;
    color: #1d4ed8;
}

.job-badge.running::before {
    content: "";
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #2563eb;
    animation: pulse-dot 1.2s ease-in-out infinite;
}

.job-badge.done {
    background: #f0fdf4;
    color: #15803d;
}

.job-badge.error {
    background: #fff1f2;
    color: #be123c;
}

.job-badge.idle {
    background: #f3f4f6;
    color: #6b7280;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(0.85); }
}

/* File name + row counter */
.job-meta {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.job-filename {
    font-size: 0.9rem;
    color: #374151;
    font-weight: 600;
}

.job-rows {
    font-size: 0.85rem;
    color: #6b7280;
}

.job-rows strong {
    color: #111827;
}

.job-ref {
    font-size: 0.8rem;
    color: #9ca3af;
    margin-bottom: 12px;
}

/* Progress bar */
.job-bar-wrap {
    background: #f3f4f6;
    border-radius: 99px;
    height: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.job-bar-fill {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, #2563eb, #60a5fa);
    transition: width 0.5s ease;
}

.job-bar-fill.done  { background: linear-gradient(90deg, #16a34a, #4ade80); }
.job-bar-fill.error { background: linear-gradient(90deg, #dc2626, #f87171); }

.job-pct {
    font-size: 0.82rem;
    color: #6b7280;
    text-align: right;
}

.job-idle-msg {
    color: #9ca3af;
    font-size: 0.88rem;
    margin: 0;
}

/* ===================================================
   14. UPLOADS PAGE
=================================================== */
.upload-new-card {
    padding: 24px 28px;
}

.upload-new-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.upload-card-title {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
}

.upload-card-sub {
    margin: 0;
    font-size: 0.8rem;
    color: #9ca3af;
}

.upload-form-inline {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.file-input-hidden {
    display: none;
}

.file-label {
    cursor: pointer;
}

.file-label-text {
    display: inline-block;
    padding: 9px 16px;
    background: #f3f4f6;
    border: 1.5px dashed #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #374151;
    font-weight: 500;
    transition: 0.2s;
    white-space: nowrap;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-label:hover .file-label-text {
    border-color: #0a2766;
    background: #eff6ff;
}

.btn-upload {
    background: #0a2766;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: 0.2s;
    white-space: nowrap;
}

.btn-upload:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.upload-count {
    font-size: 0.78rem;
    font-weight: 600;
    background: #e0e7ff;
    color: #3730a3;
    padding: 3px 12px;
    border-radius: 20px;
}

.uploads-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.uploads-table thead th {
    background: #f8fafc;
    color: #374151;
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 14px;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

.uploads-table tbody td {
    padding: 13px 14px;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
}

.upload-row:hover td {
    background: #f9fafb;
}

.file-name-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-icon { font-size: 1rem; }

.file-name-text {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    display: block;
}

.date-cell  { color: #6b7280; white-space: nowrap; }
.size-cell  { color: #6b7280; font-variant-numeric: tabular-nums; }

.link-result {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.82rem;
}

.link-result:hover { text-decoration: underline; }

.no-result {
    color: #f59e0b;
    font-size: 0.82rem;
    font-weight: 500;
}

.actions-cell { white-space: nowrap; }

.action-btn {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    transition: 0.15s;
    cursor: pointer;
    border: none;
}

.btn-preview {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.btn-preview:hover { background: #dbeafe; transform: none; }

.btn-dl {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.btn-dl:hover { background: #dcfce7; transform: none; }

.btn-delete-upload {
    background: #fff1f2;
    color: #be123c;
    border: 1px solid #fecdd3;
}

.btn-delete-upload:hover { background: #fee2e2; transform: none; }

.empty-uploads {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon  { font-size: 3rem; margin-bottom: 12px; }
.empty-title { margin: 0 0 6px; font-weight: 700; color: #374151; font-size: 1.05rem; }
.empty-sub   { margin: 0; color: #9ca3af; font-size: 0.875rem; }

/* ===================================================
   15. RESULTS PAGE
=================================================== */
.results-header-card {
    padding: 28px 30px 20px;
}

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

.results-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: #e0e7ff;
    color: #3730a3;
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 8px;
}

.results-filename {
    margin: 0 0 4px;
    font-size: 1.1rem;
    color: #111827;
    font-weight: 700;
}

.results-subtitle {
    margin: 0;
    color: #6b7280;
    font-size: 0.85rem;
}

.results-meta-right {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-download {
    background: #0a2766;
    color: white;
    padding: 9px 18px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    transition: background 0.2s;
}

.btn-download:hover { background: #2563eb; }

.btn-back {
    background: #f3f4f6;
    color: #374151;
    padding: 9px 18px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    transition: background 0.2s;
}

.btn-back:hover { background: #e5e7eb; }

.results-summary {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.summary-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.pill-ready   { background: #dcfce7; color: #15803d; }
.pill-pending { background: #fef9c3; color: #a16207; }
.pill-error   { background: #fee2e2; color: #b91c1c; }

.results-table-card {
    padding: 0;
    overflow: hidden;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.875rem;
}

.results-table thead th {
    background: #f8fafc;
    color: #374151;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 14px 16px;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

.results-table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-row:hover td { background: #f9fafb; }

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: normal;
    max-width: 280px;
}

.status-ready        { background: #dcfce7; color: #15803d; }
.status-error        { background: #fee2e2; color: #b91c1c; }
.status-pending      { background: #fef9c3; color: #92400e; }
.status-adjudication { background: #e0e7ff; color: #3730a3; }
.status-unknown      { background: #f3f4f6; color: #9ca3af; }

.prev-status-text {
    display: block;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #6b7280;
    font-size: 0.82rem;
    cursor: default;
}

.text-muted  { color: #d1d5db; }

.empty-state {
    text-align: center;
    padding: 50px;
    color: #9ca3af;
    font-style: italic;
}

/* ===================================================
   16. ADMIN USERS PAGE
=================================================== */
.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.users-table thead th {
    background: #f8fafc;
    color: #374151;
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 14px;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

.users-table tbody td {
    padding: 13px 14px;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
    vertical-align: middle;
}

.user-row:hover td { background: #f9fafb; }
.row-disabled td   { opacity: 0.55; }

.col-id    { color: #9ca3af; font-size: 0.78rem; width: 40px; }
.col-name  { font-weight: 600; }
.col-email { color: #4b5563; }
.col-date  { color: #9ca3af; white-space: nowrap; }

.col-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.role-admin    { background: #fef3c7; color: #92400e; }
.role-operator { background: #e0e7ff; color: #3730a3; }
.role-viewer   { background: #f3f4f6; color: #6b7280; }

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}

.dot-active   { background: #22c55e; }
.dot-disabled { background: #d1d5db; }

.status-text   { font-size: 0.82rem; font-weight: 600; vertical-align: middle; }
.text-active   { color: #15803d; }
.text-disabled { color: #9ca3af; }

.verified-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

.verified-yes { background: #dcfce7; color: #15803d; }
.verified-no  { background: #fee2e2; color: #b91c1c; }

.btn-disable { background: #fff1f2; color: #be123c; }
.btn-disable:hover { background: #fee2e2; transform: none; }

.btn-enable  { background: #f0fdf4; color: #15803d; }
.btn-enable:hover  { background: #dcfce7; transform: none; }

.btn-delete-user {
    background: #1f2937;
    color: #f87171;
    border: 1px solid #374151;
}
.btn-delete-user:hover { background: #111827; transform: none; }

.role-select {
    padding: 5px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #374151;
    background: #f9fafb;
    cursor: pointer;
    outline: none;
    transition: 0.15s;
    width: auto;
    margin-bottom: 0;
}

.role-select:hover { border-color: #0a2766; }

/* ===================================================
   17. RESPONSIVE — TABLET (≤ 900px)
=================================================== */
@media (max-width: 900px) {

    /* ── Sidebar ── */
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        box-shadow: 4px 0 32px rgba(0, 0, 0, 0.3);
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    /* Hide the desktop collapse toggle on mobile */
    .sidebar-toggle   { display: none; }

    .sidebar-close    { display: block; }
    .sidebar-overlay  { display: block; }
    .hamburger        { display: flex; }

    /* Sidebar collapsed state has no effect on mobile */
    body.sidebar-is-collapsed .main  { margin-left: 0; }
    body.sidebar-is-collapsed .footer { left: 0; }

    /* ── Layout ── */
    .main {
        margin-left: 0;
        padding: 20px 16px 80px; /* bottom padding for footer clearance */
    }

    /* ── Header ── */
    .header {
        border-radius: 10px;
        padding: 12px 16px;
        position: sticky;
        top: 0;
        z-index: 100;
    }

    /* ── Footer ── */
    .footer { left: 0; }

    /* ── Cards ── */
    .card { padding: 20px 18px; }

    /* ── Card header rows ── */
    .card-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    /* ── Upload forms ── */
    .upload-new-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .upload-form-inline {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }

    .file-label-text {
        max-width: 100%;
        width: 100%;
    }

    .btn-upload {
        width: 100%;
        text-align: center;
    }

    .upload-form {
        flex-direction: column;
        align-items: flex-start;
    }

    .upload-form .file-pick-label span {
        max-width: 100%;
        width: 100%;
        display: block;
    }

    /* ── Results page ── */
    .results-meta {
        flex-direction: column;
        gap: 12px;
    }

    .results-meta-right {
        width: 100%;
    }

    .btn-download,
    .btn-back {
        flex: 1;
        text-align: center;
    }

    /* ── Tables — make them scroll horizontally ── */
    .table-scroll-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 0 0 10px 10px;
    }

    /* Ensure tables don't shrink below their natural width */
    .results-table,
    .uploads-table,
    .users-table {
        min-width: 600px;
    }

    /* ── Action links — wrap on tablet ── */
    .action-links {
        gap: 4px;
    }

    .col-actions {
        flex-wrap: wrap;
        gap: 4px;
    }

    /* ── Admin users table ── */
    .users-table { min-width: 700px; }
}

/* ===================================================
   18. RESPONSIVE — MOBILE (≤ 600px)
=================================================== */
@media (max-width: 600px) {

    /* ── Main ── */
    .main { padding: 16px 12px 80px; }

    /* ── Header ── */
    .header { padding: 10px 12px; gap: 8px; }
    .header-title { font-size: 0.9rem; }

    /* ── Cards ── */
    .card { padding: 16px 14px; border-radius: 10px; }

    /* ── Auth card ── */
    .auth-body    { padding: 16px; }
    .auth-card    { padding: 28px 24px; }
    .auth-title   { font-size: 1.35rem; }

    /* ── Tables min-width tighter ── */
    .results-table  { min-width: 520px; }
    .uploads-table  { min-width: 520px; }
    .users-table    { min-width: 620px; }

    /* ── Reduce table padding ── */
    .results-table thead th,
    .results-table tbody td,
    .uploads-table thead th,
    .uploads-table tbody td,
    .users-table thead th,
    .users-table tbody td {
        padding: 10px 10px;
    }

    th, td { padding: 10px 10px; }

    /* ── Action buttons — smaller on mobile ── */
    .action-btn,
    .action-link {
        padding: 5px 8px;
        font-size: 0.72rem;
    }

    /* ── Summary pills wrap ── */
    .results-summary { gap: 6px; }
    .summary-pill    { padding: 4px 10px; font-size: 0.75rem; }

    /* ── Upload hint ── */
    .upload-hint { font-size: 0.78rem; }

    /* ── Sidebar nav links — bigger tap targets ── */
    .sidebar nav a { padding: 12px 12px; font-size: 0.95rem; }

    /* ── Role select in admin table ── */
    .role-select { font-size: 0.72rem; padding: 4px 6px; }

    /* ── Results filename ── */
    .results-filename { font-size: 0.95rem; }
    .results-subtitle { font-size: 0.78rem; }

    /* ── Card header row stacks fully ── */
    .card-header-row { gap: 8px; }
    .card-title-sm   { font-size: 0.95rem; }

    /* ── btn-view-all full width ── */
    .btn-view-all {
        width: 100%;
        text-align: center;
        display: block;
    }

    /* ── Logout button ── */
    .logout-btn { padding: 7px 10px; font-size: 0.78rem; }

    /* ── Empty states ── */
    .empty-uploads { padding: 40px 16px; }
    .empty-state   { padding: 30px 16px; }
}

/* ===================================================
   19. RESPONSIVE — SMALL PHONES (≤ 380px)
=================================================== */
@media (max-width: 380px) {

    .main { padding: 12px 10px 80px; }
    .card { padding: 14px 12px; }

    .header-title { font-size: 0.82rem; }

    .auth-card  { padding: 24px 18px; }
    .auth-title { font-size: 1.2rem; }

    /* Stack the download + back buttons vertically on results */
    .results-meta-right {
        flex-direction: column;
    }

    .btn-download,
    .btn-back {
        width: 100%;
        text-align: center;
        display: block;
    }

    /* Tighter summary pills */
    .summary-pill { padding: 3px 8px; font-size: 0.7rem; }

    /* Hamburger tap target */
    .hamburger { width: 40px; height: 40px; }
}

/* ===================================================
   20. TOUCH & ACCESSIBILITY
=================================================== */

/* Minimum tap target size (WCAG 2.5.5) */
@media (pointer: coarse) {
    .action-btn,
    .action-link,
    .logout-btn,
    .btn-view-all,
    .btn-download,
    .btn-back,
    .btn-upload {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar nav a {
        min-height: 44px;
    }

    button {
        min-height: 40px;
    }

    .role-select {
        min-height: 36px;
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   ✅ NEW: Progress Bar Styles
   Add this to your existing static/css/style.css
   ======================================== */

.job-bar-bg {
    width: 100%;
    height: 32px;
    background: #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    margin: 12px 0;
}

.job-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 60px; /* So text is always visible */
}

.job-bar-fill.done {
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.job-bar-fill.error {
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

.job-bar-text {
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.job-pct {
    text-align: center;
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 8px;
}