/* EZNDZ — Custom styles on top of Tailwind CDN */

@font-face {
  font-family: 'Barlow Semi Condensed';
  src: url('/fonts/BarlowSemiCondensed-Regular.woff2') format('woff2'),
       url('/fonts/BarlowSemiCondensed-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow Semi Condensed';
  src: url('/fonts/BarlowSemiCondensed-Medium.woff2') format('woff2'),
       url('/fonts/BarlowSemiCondensed-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow Semi Condensed';
  src: url('/fonts/BarlowSemiCondensed-SemiBold.woff2') format('woff2'),
       url('/fonts/BarlowSemiCondensed-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow Semi Condensed';
  src: url('/fonts/BarlowSemiCondensed-Bold.woff2') format('woff2'),
       url('/fonts/BarlowSemiCondensed-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow Semi Condensed';
  src: url('/fonts/BarlowSemiCondensed-ExtraBold.woff2') format('woff2'),
       url('/fonts/BarlowSemiCondensed-ExtraBold.ttf') format('truetype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0f172a;
  --surface: rgba(30, 41, 59, 0.8);
  --surface2: rgba(218, 216, 203, 0.1);
  --border: rgba(218, 216, 203, 0.15);
  --primary: #F3B343;
  --primary-light: #D95D41;
  --primary-dim: #F3B34320;
  --text: #f8fafc;
  --muted: #DAD8CB;
  --success: #65a30d;
  --warning: #f59e0b;
  --danger: #D95D41;
  --info: #3b82f6;
  --sidebar-w: 260px;
}

* { box-sizing: border-box; font-family: 'Barlow Semi Condensed', system-ui, sans-serif; }

html { font-family: 'Barlow Semi Condensed', system-ui, sans-serif; }
body { background: var(--bg); color: var(--text); margin: 0; min-height: 100vh; }

/* ── Scrollbar ─────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ── Auth page ──────────────────────────────────── */
.auth-bg {
  min-height: 100vh;
  background: radial-gradient(ellipse at 20% 50%, #0d948820 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, #14b8a615 0%, transparent 50%),
              var(--bg);
  display: flex; align-items: center; justify-content: center;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%; max-width: 420px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}

/* ── Sidebar ────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  height: 100vh;
  position: fixed; left: 0; top: 0;
  display: flex; flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

#sidebar.hidden-mobile { transform: translateX(-100%); }

.sidebar-logo {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}

.sidebar-logo .logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}

.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 0.65rem 1.25rem;
  color: var(--muted);
  text-decoration: none;
  border-radius: 8px;
  margin: 2px 8px;
  transition: all 0.2s;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
}

.nav-link:hover { background: var(--primary-dim); color: var(--primary-light); }
.nav-link.active,
.nav-link[aria-current="page"] { background: var(--primary-dim); color: var(--primary-light); border-left: 3px solid var(--primary); font-weight: 600; }
.nav-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.nav-link .nav-icon { width: 20px; text-align: center; flex-shrink: 0; }

.nav-section-label {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.1em;
  color: var(--muted); text-transform: uppercase;
  padding: 0.75rem 1.5rem 0.25rem;
}

/* ── Main content ───────────────────────────────── */
#main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 0;
  transition: margin-left 0.3s ease;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.875rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}

.page-content { padding: 1.5rem; }

/* ── Cards ──────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  transition: border-color 0.2s;
}

.card:hover { border-color: var(--primary); }
.card-header { font-size: 0.8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.card-value { font-size: 2rem; font-weight: 700; color: var(--text); line-height: 1; }
.card-sub { font-size: 0.82rem; color: var(--muted); margin-top: 0.25rem; }

.glass-card {
  background: rgba(30, 41, 59, 0.8);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(51, 65, 85, 0.6);
  border-radius: 12px;
}

/* ── Buttons ────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0.5rem 1rem;
  border-radius: 8px; border: none;
  font-size: 0.875rem; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
  text-decoration: none; white-space: nowrap;
}

.btn-primary {
  background: var(--primary); color: white;
}
.btn-primary:hover { background: var(--primary-light); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(13,148,136,0.4); }

.btn-secondary {
  background: var(--surface2); color: var(--text); border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary-light); }

.btn-danger { background: #7f1d1d; color: #fca5a5; }
.btn-danger:hover { background: var(--danger); color: white; }

.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--primary-dim); color: var(--primary-light); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }

/* ── Form controls ──────────────────────────────── */
.form-label { display: block; font-size: 0.82rem; font-weight: 500; color: var(--muted); margin-bottom: 0.35rem; }

.form-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.875rem;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-dim); }
.form-input::placeholder { color: var(--border); }

select.form-input option { background: var(--surface); }

textarea.form-input { resize: vertical; min-height: 80px; }

/* Calendar picker icon — recolour to match system palette */
/* Filter converts the browser's default dark icon → amber (#F3B343) */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="week"]::-webkit-calendar-picker-indicator {
  filter: invert(1) sepia(1) saturate(2) hue-rotate(5deg) brightness(1.05);
  opacity: 0.65;
  cursor: pointer;
  transition: opacity 0.2s, filter 0.2s;
  border-radius: 3px;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover,
input[type="week"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  filter: invert(1) sepia(1) saturate(3) hue-rotate(5deg) brightness(1.15);
}

/* ── Badges ─────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-green  { background: #14532d; color: #86efac; }
.badge-yellow { background: #78350f; color: #fcd34d; }
.badge-red    { background: #7f1d1d; color: #fca5a5; }
.badge-blue   { background: #1e3a5f; color: #93c5fd; }
.badge-gray   { background: #1e293b; color: #94a3b8; border: 1px solid var(--border); }
.badge-teal   { background: #0d948820; color: var(--primary-light); border: 1px solid #0d948840; }

/* ── Progress bars ──────────────────────────────── */
.progress-track {
  height: 6px; background: var(--border); border-radius: 999px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width 0.8s ease;
}
.progress-fill.at-risk { background: linear-gradient(90deg, #d97706, #f59e0b); }
.progress-fill.behind  { background: linear-gradient(90deg, #b91c1c, #ef4444); }

/* ── Tables ─────────────────────────────────────── */
.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}
.table-wrap, .table-wrapper { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); width: 100%; -webkit-overflow-scrolling: touch; }
.table-wrap:focus-visible, .table-wrapper:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--surface2);
  padding: 0.75rem 1rem;
  font-size: 0.75rem; font-weight: 600; text-align: left;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
thead th:has(> .th-sort-btn) { padding: 0; }
.th-sort-btn {
  display: inline-flex; align-items: center; gap: 4px;
  width: 100%; min-block-size: 38px; padding: 0.75rem 1rem;
  background: none; border: none; color: inherit; font: inherit;
  text-transform: inherit; letter-spacing: inherit; text-align: inherit;
  cursor: pointer; white-space: nowrap; user-select: none;
}
.th-sort-btn:hover { color: var(--text); }
.th-sort-btn:focus-visible, .mkt-db-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.th-sort-btn--right { justify-content: flex-end; }
tbody td { padding: 0.75rem 1rem; font-size: 0.875rem; border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }

/* ── Modal ──────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}
.modal {
  background: #1e293b; /* solid background instead of var(--surface) for readability */
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  animation: slideUp 0.2s ease;
}
dialog.modal::backdrop {
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 900px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
}
.modal-title { font-size: 1.1rem; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.25rem; padding: 4px; border-radius: 6px; }
.modal-close:hover { background: var(--surface2); color: var(--text); }

/* ── Toast ──────────────────────────────────────── */
#toast-container {
  position: fixed; top: 1rem; right: 1rem;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: slideInRight 0.3s ease;
  min-width: 280px; max-width: 380px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info    { border-left: 3px solid var(--info); }

/* ── Gantt chart ────────────────────────────────── */
.gantt-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.gantt-bar-wrap { position: relative; height: 24px; background: var(--border); border-radius: 4px; }
.gantt-bar {
  position: absolute; height: 100%; border-radius: 4px;
  transition: width 0.8s ease;
}

/* ── Donut chart ────────────────────────────────── */
.donut-svg { transform: rotate(-90deg); }

/* ── Activity card ──────────────────────────────── */
.activity-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  transition: all 0.2s;
}
.activity-card:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,0.3); }

/* ── Tabs ───────────────────────────────────────── */
.tab-bar { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; }
.tab-btn {
  padding: 0.6rem 1rem; font-size: 0.875rem; font-weight: 500;
  color: var(--muted); background: none; border: none; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: all 0.2s;
}
.tab-btn.active { color: var(--primary-light); border-bottom-color: var(--primary); }
.tab-btn:hover { color: var(--text); }

/* ── Animations ─────────────────────────────────── */
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp  { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse    { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

.animate-pulse { animation: pulse 2s infinite; }
.fade-in       { animation: fadeIn 0.3s ease; }
.slide-up      { animation: slideUp 0.3s ease; }

/* ── Empty state ────────────────────────────────── */
.empty-state {
  text-align: center; padding: 3rem 1rem;
  color: var(--muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }

/* ── Avatar ─────────────────────────────────────── */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: white;
  flex-shrink: 0; text-transform: uppercase;
}
.avatar-lg { width: 42px; height: 42px; font-size: 1rem; }

/* ── Upload zone ────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-dim);
}

/* ── Notification dot ───────────────────────────── */
.notif-dot {
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  position: absolute; top: 2px; right: 2px;
  animation: pulse 2s infinite;
}

/* ── Dashboard toggle ──────────────────────────── */
.dash-toggle {
  display: inline-flex;
  background: var(--surface2);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.dash-toggle-btn {
  padding: 0.45rem 1rem;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}
.dash-toggle-btn.active {
  background: var(--primary);
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(243, 179, 67, 0.3);
}
.dash-toggle-btn:hover:not(.active) {
  color: var(--text);
  background: rgba(218, 216, 203, 0.08);
}

/* ── Dashboard grid helpers ────────────────────── */
.dash-grid-sidebar {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.dash-grid-sidebar.right-320 { grid-template-columns: 1fr 320px; }
.dash-grid-sidebar.right-340 { grid-template-columns: 1fr 340px; }

/* ── Company data filter bar ───────────────────── */
.company-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  padding: 0.875rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 1.25rem;
}
.company-filter-bar label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.company-filter-bar input[type="date"] {
  padding: 0.45rem 0.65rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.company-filter-bar input[type="date"]:focus {
  border-color: var(--primary);
}

/* ── Stacked bar chart ─────────────────────────── */
.stacked-bar-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(218, 216, 203, 0.06);
}
.stacked-bar-row:last-child { border-bottom: none; }
.stacked-bar-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stacked-bar-track {
  height: 26px;
  background: rgba(218, 216, 203, 0.06);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  position: relative;
}
.stacked-bar-seg {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: #0f172a;
  transition: width 0.5s ease;
  position: relative;
}
.stacked-bar-seg:hover { filter: brightness(1.15); }

/* ── Chart legend ──────────────────────────────── */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.chart-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
}

/* ── Company stats row ─────────────────────────── */
.company-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

/* ── Responsive ─────────────────────────────────── */
/* Layout Utilities */
.grid-responsive { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.grid-2-col { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
.flex-wrap { display: flex; flex-wrap: wrap; gap: 1rem; }
.flex-mobile-col { display: flex; flex-direction: row; }

@media (max-width: 768px) {
  #sidebar { width: 100%; max-width: 280px; }
  #sidebar.hidden-mobile { transform: translateX(-100%); }
  #main-content { margin-left: 0; }
  .gantt-row { grid-template-columns: 140px 1fr; }
  .grid-2-col { grid-template-columns: 1fr; }
  .flex-mobile-col { flex-direction: column; }
  .dash-grid-sidebar.right-320,
  .dash-grid-sidebar.right-340 { grid-template-columns: 1fr; }
  .stacked-bar-row { grid-template-columns: 80px 1fr; }
  .stacked-bar-label { font-size: 0.75rem; }
}

/* ── Divider ────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 1rem 0; }

/* ── Sidebar footer ─────────────────────────────── */
.sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}

/* ── Status dot ─────────────────────────────────── */
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0;
}
.status-dot.green  { background: var(--success); }
.status-dot.yellow { background: var(--warning); }
.status-dot.red    { background: var(--danger); }
.status-dot.gray   { background: var(--muted); }

/* ── Form builder ───────────────────────────────── */
.form-field-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.875rem;
  position: relative;
}

/* ── KPI tracker ────────────────────────────────── */
.kpi-row td:first-child { font-weight: 500; }
.traffic-light { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.tl-green  { background: var(--success); box-shadow: 0 0 6px var(--success); }
.tl-yellow { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.tl-red    { background: var(--danger);  box-shadow: 0 0 6px var(--danger); }
.tl-blue   { background: var(--info);    box-shadow: 0 0 6px var(--info); }

/* ── Print / PDF preview ────────────────────────── */
@media print {
  #sidebar, .topbar, .btn, .modal-overlay { display: none !important; }
  #main-content { margin-left: 0 !important; }
}

/* Upload report status indicators */
.status-inserted { background: rgba(34, 197, 94, 0.08); }
.status-updated { background: rgba(245, 158, 11, 0.08); }
.status-skipped { background: rgba(148, 163, 184, 0.08); }
.status-inserted td:first-child { color: #22c55e; font-weight: 600; }
.status-updated td:first-child { color: #f59e0b; font-weight: 600; }
.status-skipped td:first-child { color: #94a3b8; font-weight: 600; }

.upload-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  min-width: 100px;
}
.upload-stat-num {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
}
.upload-stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.upload-stat-inserted {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}
.upload-stat-updated {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}
.upload-stat-skipped {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
}

/* Loss-report upload statuses & file type badges */
.status-rejected { background: rgba(239, 68, 68, 0.08); }
.status-removed { background: rgba(100, 116, 139, 0.08); }
.status-rejected td:first-child { color: #ef4444; font-weight: 600; }
.status-removed td:first-child { color: #64748b; font-weight: 600; }
.upload-stat-rejected { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.upload-stat-removed { background: rgba(100, 116, 139, 0.1); color: #64748b; }
.report-type-badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
.report-type-production { background: rgba(34, 197, 94, 0.12); color: #16a34a; }
.report-type-loss { background: rgba(249, 115, 22, 0.14); color: #ea580c; }
.report-type-unknown { background: rgba(239, 68, 68, 0.12); color: #dc2626; }

/* ── UX Guard: Button Disabled & Loading States ─────────────────── */
.btn:disabled, .btn[disabled], button:disabled, button[disabled], input[type="submit"]:disabled, input[type="submit"][disabled], input[type="button"]:disabled, .btn.btn-loading {
  opacity: 0.6 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  transform: none !important;
  box-shadow: none !important;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.inline-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 0.75s ease-in-out infinite;
}

.btn-secondary .inline-spinner, .btn-ghost .inline-spinner {
  border: 2px solid var(--border);
  border-top-color: var(--primary);
}

.spinning-icon {
  animation: spin 1s linear infinite;
  display: inline-block;
}

/* ── UX Guard: Network Indicators ─────────────────────────────── */
.network-progress-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light), var(--primary));
  background-size: 200% 100%;
  animation: shimmerBar 1.5s linear infinite;
  z-index: 999998;
  box-shadow: 0 0 10px rgba(243, 179, 67, 0.5);
  transition: opacity 0.3s ease;
}

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

.network-floating-pill {
  position: fixed;
  bottom: 24px; right: 24px;
  padding: 0.65rem 1.25rem;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--primary-light);
  border-radius: 30px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5), 0 0 15px rgba(217, 93, 65, 0.3);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 600;
  z-index: 999998;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translateY(0);
}

.network-floating-pill .spinning-icon {
  color: var(--primary);
  font-size: 1.25rem;
}

/* ── UX Guard: Page Loading Curtain ───────────────────────────── */
.page-loading-curtain {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  pointer-events: all !important;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.page-loading-curtain.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none !important;
}

.curtain-box {
  text-align: center;
  padding: 2rem;
  max-width: 400px;
  animation: floatCurtain 3s ease-in-out infinite;
}

@keyframes floatCurtain {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

.curtain-spinner-ring {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.curtain-spinner-ring::before {
  content: '';
  position: absolute;
  inset: -6px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-right-color: var(--primary-light);
  border-radius: 50%;
  animation: spin 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
  box-shadow: 0 0 20px rgba(243, 179, 67, 0.3);
}

.curtain-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  animation: pulse 1.5s infinite;
}

.curtain-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.03em;
  margin-bottom: 0.35rem;
}

.curtain-sub {
  font-size: 0.875rem;
  color: var(--muted);
  opacity: 0.85;
}

.hidden {
  display: none !important;
}

/* ── Pagination Controls ────────────────────────── */
.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.pagination-controls .page-info {
  color: var(--muted);
}

.pagination-controls .page-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.pagination-controls .page-size-selector {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
}

.pagination-controls .page-size-selector select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.28rem 0.5rem;
  outline: none;
}

.pagination-controls .page-size-selector select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.pagination-controls .page-buttons {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.pagination-controls .pag-jump-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0.35rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.pagination-controls .pag-jump-input {
  width: 3.4rem;
  text-align: center;
  padding: 0.25rem 0.3rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pagination-controls .pag-jump-input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.pagination-controls .btn-page {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  min-width: 32px;
  min-height: 32px;
  padding: 0.25rem 0.45rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pagination-controls .btn-page:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary-light);
}

.pagination-controls .btn-page:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.pagination-controls .btn-page:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Shared Table Search Toolbar */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.table-search-box {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 1 1 220px;
  max-width: 340px;
}

.table-search-box .search-icon {
  position: absolute;
  left: 0.65rem;
  font-size: 1.05rem;
  color: var(--muted);
  pointer-events: none;
}

.table-search-box input.form-input {
  padding-left: 2.1rem;
  width: 100%;
}

/* Sortable Headers (CSS-driven from th[aria-sort]) */
th.sortable {
  user-select: none;
  transition: color 0.2s;
  white-space: nowrap;
}

th.sortable .sort-text {
  display: inline-block;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

th.sortable .sort-indicator {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  font-size: 0.72rem;
  line-height: 1;
  color: currentColor;
  flex-shrink: 0;
}

th.sortable .sort-indicator::after {
  content: '⇅';
  opacity: 0.35;
}

th.sortable[aria-sort] {
  color: var(--primary-light);
}

th.sortable[aria-sort="ascending"] .sort-indicator::after {
  content: '▲';
  opacity: 1;
}

th.sortable[aria-sort="descending"] .sort-indicator::after {
  content: '▼';
  opacity: 1;
}

th.sortable.active {
  color: var(--primary-light);
}

/* ── User Picker Active / Stub Demarcation ────────────────────── */
select.form-input optgroup {
  font-weight: 700;
  font-style: normal;
  color: var(--muted);
  background: var(--surface2);
}

select.form-input optgroup option {
  font-weight: 400;
  color: var(--text);
  background: var(--surface);
  padding: 0.25rem 0.5rem;
}

select.form-input hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0.25rem 0;
}

.team-blocked-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.team-blocked-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-inline-start: 4px solid var(--danger);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}

.team-blocked-summary:hover {
  border-color: var(--danger);
}

.team-card-blocked {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
}

.team-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.team-card-actions .btn-sm {
  min-block-size: 36px;
}

.team-stubs-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px dashed var(--border);
}

.team-stubs-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}

.team-stubs-summary:hover {
  border-color: var(--primary);
}

.team-stubs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
