/* ============================================================
   DHA Enterprise Tracker — Core Stylesheet
   Clean, professional SaaS dashboard theme
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }

/* ── Design tokens ── */
:root {
  --navy:      #0a2766;
  --navy-dark: #071a4a;
  --blue:      #2563eb;
  --blue-lt:   #eff6ff;
  --green:     #10b981;
  --green-lt:  #f0fdf4;
  --amber:     #f59e0b;
  --amber-lt:  #fffbeb;
  --red:       #ef4444;
  --red-lt:    #fff1f2;

  --gray-50:   #f9fafb;
  --gray-100:  #f3f4f6;
  --gray-200:  #e5e7eb;
  --gray-300:  #d1d5db;
  --gray-400:  #9ca3af;
  --gray-500:  #6b7280;
  --gray-700:  #374151;
  --gray-900:  #111827;

  --sidebar-w:  240px;
  --sidebar-bg: #111827;
  --radius:     10px;
  --shadow:     0 1px 6px rgba(0,0,0,.07);
  --shadow-md:  0 4px 16px rgba(0,0,0,.09);
}

/* ── Base ── */
body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--gray-900);
  background: var(--gray-100);
}

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

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

.auth-title    { margin: 0 0 6px; font-size: 1.5rem; font-weight: 800; color: #fff; letter-spacing: -.02em; }
.auth-subtitle { margin: 0 0 28px; color: rgba(255,255,255,.6); font-size: .88rem; }

.auth-form { display: flex; flex-direction: column; gap: 0; }

.auth-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.auth-label { font-size: .75rem; font-weight: 600; color: rgba(255,255,255,.75); letter-spacing: .03em; }

.auth-card input[type=text],
.auth-card input[type=email],
.auth-card input[type=password] {
  background: rgba(255,255,255,.92);
  border: none;
  border-radius: 8px;
  padding: 11px 14px;
  font-size: .9rem;
  color: var(--gray-900);
  width: 100%;
  margin-bottom: 0;
  font-family: inherit;
  transition: box-shadow .2s;
}
.auth-card input:focus { outline: none; box-shadow: 0 0 0 3px rgba(255,255,255,.35); }
.auth-card input::placeholder { color: var(--gray-400); }

.auth-btn {
  width: 100%; padding: 13px;
  background: #fff; color: var(--navy);
  border: none; border-radius: 8px;
  font-weight: 700; font-size: .9rem; font-family: inherit;
  cursor: pointer; transition: .15s; margin-top: 6px;
}
.auth-btn:hover { background: #e0e7ff; transform: translateY(-1px); }

.auth-error {
  background: rgba(239,68,68,.2); border: 1px solid rgba(239,68,68,.4);
  padding: 10px 14px; border-radius: 8px;
  margin-bottom: 18px; font-size: .82rem; color: #fecaca;
}
.auth-message {
  background: rgba(34,197,94,.15); border: 1px solid rgba(34,197,94,.3);
  padding: 10px 14px; border-radius: 8px;
  margin-bottom: 18px; font-size: .82rem; color: #bbf7d0;
}
.error { /* backwards compat */
  background: rgba(239,68,68,.2); border: 1px solid rgba(239,68,68,.4);
  padding: 10px 14px; border-radius: 8px;
  margin-bottom: 18px; font-size: .82rem; color: #fecaca;
}

.auth-links {
  margin-top: 20px; text-align: center;
  font-size: .82rem; color: rgba(255,255,255,.6);
  display: flex; justify-content: center; gap: 8px; flex-wrap: wrap;
}
.auth-links a { color: #fff; font-weight: 600; text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }
.auth-divider { opacity: .4; }

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */
.app-body { margin: 0; }
.layout   { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: #fff;
  padding: 20px 14px;
  position: fixed; left: 0; top: 0; bottom: 0;
  display: flex; flex-direction: column;
  z-index: 200;
  transition: width .25s ease, transform .25s ease;
  overflow: hidden;
}

/* Brand */
.sidebar-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; }
.brand-icon {
  width: 32px; height: 32px;
  background: rgba(255,255,255,.1);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.brand-icon svg { width: 16px; height: 16px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.brand-text { font-size: .9rem; font-weight: 800; color: #fff; white-space: nowrap; letter-spacing: -.01em; }
.sidebar-close { display: none; background: transparent; border: none; color: var(--gray-400); font-size: 1rem; padding: 4px 8px; cursor: pointer; border-radius: 4px; line-height: 1; }
.sidebar-close:hover { background: #1f2937; color: #fff; }

/* Nav */
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: #374151 transparent; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #374151; border-radius: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: #4b5563; }
.nav-section-label {
  font-size: .6rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--gray-500); padding: 10px 8px 4px; white-space: nowrap; overflow: hidden;
}

.nav-item {
  display: flex; align-items: center; gap: 0;
  text-decoration: none;
  border-radius: 8px; overflow: hidden;
  transition: .15s; position: relative;
}
.nav-item:hover .nav-icon-box { background: #1f2937; }
.nav-item:hover .nav-label    { color: #fff; }
.nav-item.active .nav-icon-box { background: rgba(37,99,235,.25); }
.nav-item.active .nav-icon-box svg { stroke: #60a5fa; }
.nav-item.active .nav-label    { color: #fff; font-weight: 600; }

.nav-icon-box {
  width: 36px; height: 36px;
  background: rgba(255,255,255,.06);
  border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  margin: 2px; transition: .15s;
}
.nav-icon-box svg { width: 15px; height: 15px; stroke: var(--gray-400); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.nav-label {
  font-size: .82rem; font-weight: 500; color: var(--gray-400);
  padding: 9px 10px; flex: 1; white-space: nowrap; transition: .15s;
}
.nav-badge {
  font-size: .6rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 20px; margin-right: 6px; white-space: nowrap;
}

/* Footer */
.sidebar-footer {
  padding-top: 14px; border-top: 1px solid #1f2937;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.sidebar-user { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; }
.user-avatar-sm {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(37,99,235,.4);
  color: #fff; font-size: .78rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-details { min-width: 0; overflow: hidden; }
.user-name-sm {
  display: block; font-size: .78rem; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.role-pill {
  font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  background: #1f2937; color: var(--gray-400);
  padding: 2px 7px; border-radius: 20px; display: inline-block;
}

.sidebar-toggle {
  width: 26px; height: 26px; border-radius: 6px;
  background: #1f2937; border: none; color: var(--gray-500);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: .15s;
}
.sidebar-toggle:hover { background: #374151; color: #fff; }
.sidebar-toggle svg { transition: transform .25s; }

/* Collapsed */
.sidebar-collapsed { width: 60px; }
.sidebar-collapsed .brand-text,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .nav-badge,
.sidebar-collapsed .nav-section-label,
.sidebar-collapsed .user-details,
.sidebar-collapsed .role-pill { display: none; }
.sidebar-collapsed .sidebar-top { justify-content: center; }
.sidebar-collapsed .nav-item    { justify-content: center; }
.sidebar-collapsed .nav-icon-box { margin: 2px auto; }
.sidebar-collapsed .sidebar-footer { justify-content: center; }
.sidebar-collapsed .sidebar-user { gap: 0; }

body.sidebar-is-collapsed .main   { margin-left: 60px; }

/* ── Overlay ── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 199;
  opacity: 0; transition: opacity .25s;
}
.sidebar-overlay.overlay-visible { opacity: 1; }

/* ── Main content ── */
.main {
  margin-left: var(--sidebar-w);
  padding: 32px 28px;
  flex: 1; min-height: 100vh;
  transition: margin-left .25s ease;
}

/* ── Header ── */
.header {
  background: #fff;
  padding: 14px 20px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: var(--shadow); gap: 12px;
}
.header-left  { display: flex; align-items: center; gap: 10px; min-width: 0; }
.header-title { margin: 0; font-size: .95rem; font-weight: 700; color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }

.hamburger {
  display: none; flex-direction: column; justify-content: center; gap: 4px;
  background: transparent; border: none; padding: 6px;
  cursor: pointer; width: 36px; height: 36px; border-radius: 6px;
}
.hamburger:hover { background: var(--gray-100); }
.hamburger span  { display: block; width: 20px; height: 2px; background: var(--gray-700); border-radius: 2px; }

.user-info { text-align: right; }
.user-info strong { display: block; font-size: .82rem; color: var(--gray-900); }
.user-info small  { color: var(--gray-400); font-size: .72rem; }

.user-avatar { display: none; width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: #fff; font-size: .8rem; font-weight: 700; align-items: center; justify-content: center; flex-shrink: 0; }

.logout-btn {
  background: var(--red); padding: 7px 14px; border-radius: 6px;
  color: #fff; text-decoration: none; font-weight: 600; font-size: .8rem;
  white-space: nowrap; transition: background .15s;
}
.logout-btn:hover { background: #dc2626; }

/* ── Cards ── */
.card {
  background: #fff; padding: 22px 24px; border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 20px;
}
.card-header-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; gap: 12px;
}
.card-title-sm { margin: 0; font-size: .9rem; font-weight: 700; color: var(--gray-900); }

/* ── Buttons (shared) ── */
button { font-family: inherit; cursor: pointer; }

.btn-primary {
  background: var(--navy); color: #fff;
  padding: 9px 18px; border-radius: 7px; border: none;
  font-weight: 600; font-size: .85rem; transition: .15s; white-space: nowrap;
}
.btn-primary:hover { background: var(--blue); transform: translateY(-1px); }
.btn-primary:disabled { background: #93c5fd; cursor: not-allowed; transform: none; }

.btn-view-all {
  font-size: .78rem; font-weight: 600; color: var(--blue);
  text-decoration: none; background: var(--blue-lt);
  padding: 5px 12px; border-radius: 20px; transition: .15s; white-space: nowrap;
}
.btn-view-all:hover { background: #dbeafe; }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--gray-100); }
th { background: var(--gray-50); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500); border-bottom: 1.5px solid var(--gray-200); }
.table-scroll-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.row-num    { color: var(--gray-400); font-size: .75rem; font-weight: 600; width: 36px; }
.empty-row  { text-align: center; padding: 40px; color: var(--gray-400); font-style: italic; }

.action-links { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.action-link  {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 6px;
  font-size: .75rem; font-weight: 600; text-decoration: none;
  cursor: pointer; border: none; transition: .12s; white-space: nowrap;
}
.link-view     { background: var(--blue-lt); color: #1d4ed8; }
.link-view:hover { background: #dbeafe; }
.link-dl       { background: var(--green-lt); color: #15803d; }
.link-dl:hover { background: #dcfce7; }
.link-del      { background: var(--red-lt); color: #be123c; }
.link-del:hover{ background: #fee2e2; }

.form-inline { display: inline; }

/* ── Job progress card ── */
.job-card {
  background: #fff; border-radius: var(--radius); padding: 22px 24px;
  box-shadow: var(--shadow); border-left: 4px solid var(--blue);
  margin-bottom: 20px;
}
.job-card.job-done      { border-left-color: var(--green); }
.job-card.job-error     { border-left-color: var(--red); }
.job-card.job-idle      { border-left-color: var(--gray-300); }
.job-card.job-cancelled { border-left-color: var(--amber); }

.job-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.job-title  { font-size: .9rem; font-weight: 700; color: var(--gray-900); margin: 0; }

.job-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 20px;
  font-size: .72rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
}
.job-badge.running   { background: var(--blue-lt); color: #1d4ed8; }
.job-badge.running::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); animation: blink 1.2s infinite; }
.job-badge.done      { background: var(--green-lt); color: #15803d; }
.job-badge.error     { background: var(--red-lt); color: #be123c; }
.job-badge.idle      { background: var(--gray-100); color: var(--gray-500); }
.job-badge.queued    { background: #eff6ff; color: #1d4ed8; }
.job-badge.cancelled { background: #fef3c7; color: #92400e; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

.job-meta     { display: flex; align-items: baseline; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.job-filename { font-size: .88rem; color: var(--gray-700); font-weight: 600; }
.job-rows     { font-size: .82rem; color: var(--gray-500); }
.job-rows strong { color: var(--gray-900); }
.job-ref      { font-size: .78rem; color: var(--gray-400); margin-bottom: 12px; }
.job-idle-msg { color: var(--gray-400); font-size: .85rem; margin: 0; }
.job-pct      { font-size: .78rem; color: var(--gray-500); text-align: right; }

.job-bar-wrap { background: var(--gray-100); border-radius: 99px; height: 28px; overflow: hidden; margin: 10px 0 6px; }
.job-bar-bg   { height: 100%; }
.job-bar-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--blue), #60a5fa);
  transition: width .5s ease;
  display: flex; align-items: center; justify-content: center; min-width: 60px;
}
.job-bar-fill.done  { background: linear-gradient(90deg, var(--green), #4ade80); }
.job-bar-fill.error { background: linear-gradient(90deg, var(--red), #f87171); }
.job-bar-text { color: #fff; font-weight: 600; font-size: .8rem; text-shadow: 0 1px 2px rgba(0,0,0,.2); }

.btn-cancel-job {
  background: var(--red); color: #fff; padding: 6px 14px;
  border-radius: 6px; border: none; font-size: .78rem; font-weight: 700;
  cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn-cancel-job:hover { background: #dc2626; transform: translateY(-1px); }

/* ── Stats boxes ── */
.stat-box { flex: 1; min-width: 110px; padding: 14px 16px; border-radius: 10px; text-align: center; }
.stat-num { font-size: 1.6rem; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-lbl { font-size: .65rem; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .05em; }

/* ── Upload form ── */
.upload-form { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.file-pick-label { cursor: pointer; }
.file-pick-label input[type=file] { display: none; }
.file-pick-label span {
  display: inline-block; padding: 9px 16px;
  background: var(--gray-100); border: 1.5px dashed var(--gray-300);
  border-radius: 8px; font-size: .85rem; color: var(--gray-700); font-weight: 500;
  transition: .15s; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-pick-label:hover span { border-color: var(--navy); background: var(--blue-lt); }
.upload-hint { margin: 8px 0 0; font-size: .78rem; color: var(--gray-400); }
.link-uploads { color: var(--blue); font-weight: 600; text-decoration: none; }
.link-uploads:hover { text-decoration: underline; }

/* ── Uploads table ── */
.uploads-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.uploads-table thead th { background: var(--gray-50); color: var(--gray-500); font-weight: 700; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; padding: 11px 14px; border-bottom: 1.5px solid var(--gray-200); white-space: nowrap; }
.uploads-table tbody td { padding: 12px 14px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); }
.uploads-table tr:hover td { background: var(--gray-50); }
.file-name-cell { display: flex; align-items: center; gap: 8px; }
.file-icon { font-size: .9rem; }
.file-name-text { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.date-cell { color: var(--gray-500); white-space: nowrap; }
.size-cell { color: var(--gray-500); font-variant-numeric: tabular-nums; }
.link-result { color: var(--blue); text-decoration: none; font-weight: 600; font-size: .78rem; }
.link-result:hover { text-decoration: underline; }
.no-result { color: var(--amber); font-size: .78rem; font-weight: 500; }

.action-btn { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 6px; font-size: .75rem; font-weight: 600; text-decoration: none; transition: .12s; cursor: pointer; border: none; }
.btn-preview { background: var(--blue-lt); color: #1d4ed8; }
.btn-preview:hover { background: #dbeafe; }
.btn-dl      { background: var(--green-lt); color: #15803d; }
.btn-dl:hover{ background: #dcfce7; }
.btn-delete-upload { background: var(--red-lt); color: #be123c; }
.btn-delete-upload:hover { background: #fee2e2; }

/* ── Results page ── */
.results-header-card { padding: 24px 26px 18px; }
.results-meta { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 14px; margin-bottom: 18px; }
.results-badge { display: inline-block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; background: #e0e7ff; color: #3730a3; padding: 3px 10px; border-radius: 20px; margin-bottom: 6px; }
.results-filename { margin: 0 0 4px; font-size: 1.05rem; color: var(--gray-900); font-weight: 700; }
.results-subtitle { margin: 0; color: var(--gray-500); font-size: .82rem; }
.results-meta-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn-download { background: var(--navy); color: #fff; padding: 8px 16px; border-radius: 7px; text-decoration: none; font-weight: 600; font-size: .82rem; transition: background .15s; }
.btn-download:hover { background: var(--blue); }
.btn-back { background: var(--gray-100); color: var(--gray-700); padding: 8px 16px; border-radius: 7px; text-decoration: none; font-weight: 600; font-size: .82rem; }
.btn-back:hover { background: var(--gray-200); }

.results-summary { display: flex; gap: 8px; flex-wrap: wrap; }
.summary-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px; border-radius: 20px; font-size: .75rem; 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; font-size: .85rem; }
.results-table thead th { background: var(--gray-50); color: var(--gray-500); font-weight: 700; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; padding: 12px 14px; border-bottom: 1.5px solid var(--gray-200); white-space: nowrap; }
.results-table tbody td { padding: 11px 14px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-row:hover td { background: var(--gray-50); }

.status-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .72rem; font-weight: 600; }
.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: var(--gray-100); color: var(--gray-400); }
.empty-state { text-align: center; padding: 50px; color: var(--gray-400); font-style: italic; }

/* ── Admin users ── */
.users-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.users-table thead th { background: var(--gray-50); color: var(--gray-500); font-weight: 700; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; padding: 11px 14px; border-bottom: 1.5px solid var(--gray-200); white-space: nowrap; }
.users-table tbody td { padding: 12px 14px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); vertical-align: middle; }
.user-row:hover td { background: var(--gray-50); }
.col-id    { color: var(--gray-400); font-size: .75rem; width: 40px; }
.col-name  { font-weight: 600; }
.col-email { color: var(--gray-500); }
.col-date  { color: var(--gray-400); white-space: nowrap; }
.col-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.role-badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.role-admin    { background: #fef3c7; color: #92400e; }
.role-operator { background: #e0e7ff; color: #3730a3; }
.role-viewer   { background: var(--gray-100); color: var(--gray-500); }

.status-dot      { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.dot-active      { background: var(--green); }
.dot-disabled    { background: var(--gray-300); }
.status-text     { font-size: .8rem; font-weight: 600; vertical-align: middle; }
.text-active     { color: #15803d; }
.text-disabled   { color: var(--gray-400); }

.btn-disable     { background: var(--red-lt); color: #be123c; padding: 5px 10px; border: none; border-radius: 5px; font-size: .75rem; font-weight: 600; cursor: pointer; }
.btn-disable:hover { background: #fee2e2; }
.btn-enable      { background: var(--green-lt); color: #15803d; padding: 5px 10px; border: none; border-radius: 5px; font-size: .75rem; font-weight: 600; cursor: pointer; }
.btn-enable:hover  { background: #dcfce7; }
.btn-approve     { background: var(--green)!important; color: #fff!important; padding: 6px 12px; border: none; border-radius: 5px; cursor: pointer; font-weight: 600; font-size: .78rem; }
.btn-approve:hover { background: #059669!important; }
.btn-reject      { background: var(--red)!important; color: #fff!important; padding: 6px 12px; border: none; border-radius: 5px; cursor: pointer; font-weight: 600; font-size: .78rem; }
.btn-reject:hover  { background: #dc2626!important; }
.btn-delete-user { background: #1f2937; color: #f87171; border: 1px solid #374151; padding: 5px 10px; border-radius: 5px; font-size: .75rem; font-weight: 600; cursor: pointer; }
.btn-delete-user:hover { background: #111827; }

.role-select { padding: 5px 8px; border: 1px solid var(--gray-200); border-radius: 6px; font-size: .75rem; font-weight: 600; color: var(--gray-700); background: var(--gray-50); cursor: pointer; outline: none; font-family: inherit; margin-bottom: 0; }
.role-select:hover { border-color: var(--navy); }

/* ── Viewer banner ── */
.viewer-banner { display: flex; align-items: flex-start; gap: 12px; background: var(--blue-lt); border: 1px solid #bfdbfe; border-left: 4px solid var(--blue); border-radius: 10px; padding: 14px 18px; margin-bottom: 20px; }
.viewer-banner-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.viewer-banner-text { margin: 0; font-size: .85rem; color: #1e40af; line-height: 1.5; }
.viewer-banner-text strong { color: #1d4ed8; }

/* ── Footer ── */
.footer { position: fixed; bottom: 0; left: var(--sidebar-w); right: 0; background: rgba(17,24,39,.04); color: var(--gray-500); padding: 9px; text-align: center; font-size: .78rem; }
body.sidebar-is-collapsed .footer { left: 60px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); width: 280px; box-shadow: 4px 0 32px rgba(0,0,0,.3); }
  .sidebar.sidebar-open { transform: translateX(0); }
  .sidebar-toggle  { display: none; }
  .sidebar-close   { display: block; }
  .sidebar-overlay { display: block; }
  .hamburger       { display: flex; }
  body.sidebar-is-collapsed .main   { margin-left: 0; }
  body.sidebar-is-collapsed .footer { left: 0; }
  .main   { margin-left: 0; padding: 18px 16px 80px; }
  .footer { left: 0; }
  .user-info   { display: none; }
  .user-avatar { display: flex; }
  .card { padding: 18px 16px; }
  .card-header-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .upload-form { flex-direction: column; align-items: flex-start; }
  .users-table, .uploads-table, .results-table { min-width: 560px; }
}

@media (max-width: 600px) {
  .main    { padding: 14px 12px 80px; }
  .card    { padding: 16px 14px; }
  .header  { padding: 10px 14px; }
  .results-meta { flex-direction: column; }
  .auth-card    { padding: 28px 22px; }
  .stat-box     { min-width: 90px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms!important; transition-duration: .01ms!important; } }
@media (pointer: coarse) { .action-btn, .action-link, .logout-btn, .btn-primary { min-height: 40px; } .sidebar nav a { min-height: 44px; } }

/* ============================================================
   DASHBOARD ADDITIONS
   ============================================================ */

/* Worker banner */
.worker-banner {
  display: flex; align-items: center; justify-content: space-between;
  background: #fff; border-radius: var(--radius);
  padding: 12px 20px; margin-bottom: 16px;
  box-shadow: var(--shadow); gap: 12px; flex-wrap: wrap;
}
.worker-banner-left { display: flex; align-items: center; gap: 10px; }
.worker-status-dot  { width: 10px; height: 10px; border-radius: 50%; background: var(--gray-300); flex-shrink: 0; transition: background .3s; }
.dot-green  { background: #22c55e !important; }
.dot-red    { background: #ef4444 !important; }
.dot-blue   { background: #3b82f6 !important; }
.dot-amber  { background: #f59e0b !important; }
.worker-banner-label  { font-size: .875rem; font-weight: 600; color: var(--gray-900); }
.worker-banner-detail { font-size: .78rem; color: var(--gray-500); }
.mode-form   { display: flex; align-items: center; gap: 8px; }
.mode-label  { font-size: .75rem; color: var(--gray-500); font-weight: 600; white-space: nowrap; }
.mode-select { padding: 5px 10px; border: 1px solid var(--gray-200); border-radius: 6px; font-size: .78rem; font-weight: 600; color: var(--gray-700); background: var(--gray-50); cursor: pointer; outline: none; font-family: inherit; }

/* Alert banners */
.alert-banner {
  display: flex; align-items: center; justify-content: space-between;
  border-radius: var(--radius); padding: 14px 18px; margin-bottom: 16px;
  gap: 12px; flex-wrap: wrap;
}
.alert-warning { background: #fffbeb; border: 1.5px solid #fde047; }
.alert-error   { background: #fff1f2; border: 1.5px solid #fecdd3; }
.alert-banner-content { display: flex; align-items: center; gap: 12px; }
.alert-icon-box {
  width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.alert-warning .alert-icon-box { background: rgba(245,158,11,.12); }
.alert-error   .alert-icon-box { background: rgba(239,68,68,.12); }
.alert-warning .alert-icon-box svg { stroke: #d97706; }
.alert-error   .alert-icon-box svg { stroke: #dc2626; }
.alert-title { margin: 0 0 2px; font-weight: 700; font-size: .88rem; color: var(--gray-900); }
.alert-warning .alert-title { color: #92400e; }
.alert-error   .alert-title { color: #be123c; }
.alert-sub   { margin: 0; font-size: .78rem; }
.alert-warning .alert-sub { color: #a16207; }
.alert-error   .alert-sub { color: #e11d48; }
.alert-btn {
  background: var(--navy); color: #fff; padding: 8px 16px;
  border-radius: 7px; text-decoration: none; font-weight: 700;
  font-size: .82rem; white-space: nowrap;
}
.alert-btn-muted { background: var(--gray-500); }

/* Stat cards */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat-card {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: 16px 18px; display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow);
}
.stat-card-icon {
  width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.stat-card-body { min-width: 0; }
.stat-card-num { font-size: 1.6rem; font-weight: 800; line-height: 1; margin-bottom: 3px; font-variant-numeric: tabular-nums; }
.stat-card-lbl { font-size: .65rem; font-weight: 700; color: var(--gray-400); text-transform: uppercase; letter-spacing: .05em; }

/* Charts row */
.charts-row { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; margin-bottom: 16px; }
.chart-card-main { min-width: 0; }
.chart-card-side { min-width: 0; }

/* Live dot */
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gray-300); display: inline-block; transition: .3s; }
.live-dot-active { background: #ef4444; animation: pulse-red 1.5s infinite; }
@keyframes pulse-red { 0%,100%{opacity:1} 50%{opacity:.4} }

/* Empty panel */
.empty-panel {
  background: var(--gray-50); border-radius: 8px; padding: 36px 20px;
  text-align: center; border: 2px dashed var(--gray-200);
}

/* Button outline small */
.btn-outline-sm {
  font-size: .78rem; font-weight: 600; color: var(--blue);
  text-decoration: none; border: 1.5px solid #bfdbfe;
  padding: 5px 12px; border-radius: 6px; transition: .15s; white-space: nowrap;
}
.btn-outline-sm:hover { background: var(--blue-lt); }

/* Form inputs */
.form-label { display: block; font-size: .75rem; font-weight: 600; color: var(--gray-700); margin-bottom: 5px; letter-spacing: .02em; }
.form-input {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--gray-200);
  border-radius: 7px; font-family: inherit; font-size: .88rem; color: var(--gray-900);
  background: #fff; outline: none; transition: border-color .15s; margin-bottom: 0;
}
.form-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-hint { margin: 4px 0 0; font-size: .72rem; color: var(--gray-400); }

/* Sidebar workers panel */
.sidebar-workers { padding: 0 0 10px; border-top: 1px solid #1f2937; margin-top: 8px; padding-top: 10px; }
.worker-pill { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; margin-bottom: 2px; }
.worker-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.worker-dot.online  { background: #22c55e; animation: pulse 2s infinite; }
.worker-dot.offline { background: var(--gray-500); }
.worker-pill-text { font-size: .72rem; color: var(--txt, #e2e8f0); font-family: var(--mono, monospace); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Sidebar icon button */
.sidebar-icon-btn {
  width: 26px; height: 26px; border-radius: 6px;
  background: #1f2937; border: none; color: var(--gray-500);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: .15s;
}
.sidebar-icon-btn:hover { background: #374151; color: #fff; }

/* Sidebar collapsed: hide workers panel */
.sidebar-collapsed .sidebar-workers,
.sidebar-collapsed .sidebar-workers * { display: none; }

/* About modal */
.about-modal {
  display: none; position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.5); align-items: center; justify-content: center; padding: 20px;
}
.about-modal.open { display: flex; }
.about-card {
  background: #fff; border-radius: 14px; max-width: 560px; width: 100%;
  max-height: 85vh; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,.3);
}
.about-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--gray-200);
}
.about-title { margin: 0; font-size: .95rem; font-weight: 700; color: var(--gray-900); }
.about-close {
  background: var(--gray-100); border: none; width: 28px; height: 28px;
  border-radius: 6px; cursor: pointer; font-size: .85rem; color: var(--gray-500);
  display: flex; align-items: center; justify-content: center;
}
.about-close:hover { background: var(--gray-200); }
.about-body   { padding: 20px 24px; overflow-y: auto; flex: 1; }
.about-footer { padding: 14px 24px; border-top: 1px solid var(--gray-100); font-size: .72rem; color: var(--gray-400); }
.about-section { margin-bottom: 22px; }
.about-section h3 { margin: 0 0 10px; font-size: .88rem; font-weight: 700; color: var(--gray-900); }
.about-section p  { margin: 0 0 8px; font-size: .82rem; color: var(--gray-700); line-height: 1.6; }
.about-code {
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: 7px; padding: 12px 14px; font-size: .78rem;
  color: var(--gray-700); line-height: 1.8; font-family: monospace;
}
.about-table  { border: 1px solid var(--gray-200); border-radius: 7px; overflow: hidden; }
.about-row    { display: flex; align-items: flex-start; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--gray-100); font-size: .82rem; color: var(--gray-700); }
.about-row:last-child { border-bottom: none; }
.about-key    { font-weight: 700; min-width: 90px; flex-shrink: 0; font-size: .78rem; background: var(--gray-100); padding: 2px 8px; border-radius: 4px; color: var(--gray-700); }
.about-key.ready   { background: #dcfce7; color: #15803d; }
.about-key.pending { background: #fef9c3; color: #92400e; }
.about-key.error   { background: #fee2e2; color: #b91c1c; }

/* Responsive */
@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .worker-banner { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 500px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .stat-card-num { font-size: 1.3rem; }
}