/* ============================================================
   PVPORTAL SCA — Premium Design System
   Clean slate: Inter font, indigo/violet accent, glassmorphic
   sidebar, excellent table/form components.
   ============================================================ */

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

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

/* ── Design Tokens ──────────────────────────────────────────── */
:root {
  /* Brand */
  --primary:        #4f46e5;
  --primary-light:  #6366f1;
  --primary-dark:   #3730a3;
  --primary-glow:   rgba(79, 70, 229, 0.18);
  --primary-muted:  rgba(79, 70, 229, 0.08);

  /* Semantic */
  --success:        #059669;
  --success-bg:     rgba(5, 150, 105, 0.10);
  --success-text:   #047857;
  --warning:        #d97706;
  --warning-bg:     rgba(217, 119, 6, 0.10);
  --warning-text:   #b45309;
  --danger:         #dc2626;
  --danger-bg:      rgba(220, 38, 38, 0.10);
  --danger-text:    #b91c1c;
  --info:           #0284c7;
  --info-bg:        rgba(2, 132, 199, 0.10);
  --info-text:      #0369a1;

  /* Neutrals — Light base */
  --bg-app:         #f1f5f9;
  --bg-page:        #f8fafc;
  --surface:        #ffffff;
  --surface-raised: #ffffff;
  --surface-overlay: rgba(255, 255, 255, 0.92);
  --border:         #e2e8f0;
  --border-strong:  #cbd5e1;
  --border-focus:   #4f46e5;

  /* Text */
  --text:           #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --text-inverse:   #ffffff;

  /* Sidebar — Deep dark with subtle glass */
  --sidebar-bg:         #1e1b4b;
  --sidebar-bg-end:     #0f0c29;
  --sidebar-text:       rgba(255,255,255,0.75);
  --sidebar-text-active:#ffffff;
  --sidebar-item-hover: rgba(255,255,255,0.07);
  --sidebar-item-active:rgba(255,255,255,0.12);
  --sidebar-border:     rgba(255,255,255,0.06);
  --sidebar-accent:     #818cf8;

  /* Layout */
  --sidebar-width:      260px;
  --topbar-height:      56px;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Shape */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Elevation */
  --shadow-xs:  0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
  --shadow-xl:  0 20px 25px -5px rgba(0,0,0,0.10), 0 10px 10px -5px rgba(0,0,0,0.04);

  /* Motion */
  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast:   120ms;
  --dur-base:   200ms;
  --dur-slow:   300ms;
}

/* ── Base ───────────────────────────────────────────────────── */
html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-app);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ── App Shell ──────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-end) 100%);
  border-right: 1px solid var(--sidebar-border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-5);
  border-bottom: 1px solid var(--sidebar-border);
  min-height: 72px;
}

.sidebar-header .brand-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25);
}

.sidebar-header .brand-icon .material-symbols-outlined {
  color: #fff; font-size: 1.25rem;
}

.nav-logo {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  object-fit: contain;
}

.brand-text {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.brand-text small {
  display: block;
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--sidebar-text);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-3);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.nav-group {
  margin-bottom: var(--space-5);
}

.nav-group-label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  padding: 0 var(--space-3);
  margin-bottom: var(--space-2);
}

.nav-links { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background var(--dur-fast) var(--ease-in-out),
              color var(--dur-fast) var(--ease-in-out);
  cursor: pointer;
  position: relative;
}

.nav-item .material-symbols-outlined {
  font-size: 1.125rem;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity var(--dur-fast);
}

.nav-item:hover {
  background: var(--sidebar-item-hover);
  color: var(--sidebar-text-active);
}
.nav-item:hover .material-symbols-outlined { opacity: 1; }

.nav-item.active {
  background: var(--sidebar-item-active);
  color: var(--sidebar-text-active);
}
.nav-item.active .material-symbols-outlined { opacity: 1; }

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--sidebar-accent);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.nav-badge-system {
  margin-left: auto;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: rgba(129, 140, 248, 0.25);
  color: #a5b4fc;
  padding: 2px 5px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(129, 140, 248, 0.3);
}

/* Sidebar Footer */
.sidebar-footer {
  border-top: 1px solid var(--sidebar-border);
  padding: var(--space-4);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}

.user-info { flex: 1; min-width: 0; }
.username {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sidebar-text-active);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  margin-top: 2px;
}

.btn-logout-sidebar {
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  color: rgba(255,255,255,0.4);
  border-radius: var(--radius-sm);
  display: flex; align-items: center;
  transition: color var(--dur-fast), background var(--dur-fast);
}
.btn-logout-sidebar:hover {
  color: var(--danger-text);
  background: var(--danger-bg);
}
.btn-logout-sidebar .material-symbols-outlined { font-size: 1.1rem; }

/* ── Main Area ──────────────────────────────────────────────── */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  padding: var(--space-8);
  max-width: 1400px;
  width: 100%;
}

/* ── Page Header ────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  background: var(--bg-page);
}

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.card-body { padding: var(--space-6); }

/* ── Stat / KPI Cards ───────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--dur-base) var(--ease-out),
              transform var(--dur-base) var(--ease-out);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--space-3);
}
.stat-icon .material-symbols-outlined { font-size: 1.25rem; }

.stat-icon.blue   { background: var(--primary-muted);  color: var(--primary); }
.stat-icon.green  { background: var(--success-bg);      color: var(--success); }
.stat-icon.amber  { background: var(--warning-bg);      color: var(--warning); }
.stat-icon.red    { background: var(--danger-bg);       color: var(--danger); }
.stat-icon.cyan   { background: var(--info-bg);         color: var(--info); }

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.04em;
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: var(--space-1);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

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

thead {
  background: var(--bg-page);
  border-bottom: 1px solid var(--border);
}

thead th {
  padding: var(--space-3) var(--space-4);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

thead th:hover { color: var(--text); }

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--dur-fast);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:nth-child(even) { background: var(--bg-page); }
tbody tr:hover { background: color-mix(in srgb, var(--primary) 6%, var(--surface)); }

tbody td {
  padding: var(--space-3) var(--space-4);
  color: var(--text-secondary);
  vertical-align: middle;
}

thead th a {
  color: var(--text-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  transition: color var(--dur-fast);
}
thead th a:hover { color: var(--primary); }

.col-primary {
  font-weight: 600;
  color: var(--text);
}

.col-mono {
  font-family: 'Fira Code', 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.8125rem;
}

/* ── Status Badges ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-warning { background: var(--warning-bg); color: var(--warning-text); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger-text); }
.badge-info    { background: var(--info-bg);     color: var(--info-text); }
.badge-neutral { background: #f1f5f9; color: #64748b; }
.badge-primary { background: var(--primary-muted); color: var(--primary); }

/* Processing animation */
.badge-processing {
  background: rgba(217, 119, 6, 0.10);
  color: var(--warning-text);
}
.badge-processing::before {
  animation: pulse-dot 1.2s ease-in-out infinite;
}

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

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-in-out);
  white-space: nowrap;
  text-decoration: none;
}

.btn .material-symbols-outlined { font-size: 1rem; }

.btn-primary {
  background: var(--primary);
  color: var(--text-inverse);
  border-color: var(--primary);
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.3);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
  transform: translateY(-1px);
  color: #fff;
}
.btn-primary:active { transform: translateY(0); box-shadow: none; }

.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--bg-page);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: rgba(220, 38, 38, 0.25);
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-page); color: var(--text); }

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

.btn-icon {
  padding: 0.5rem;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--dur-fast);
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon:hover { border-color: var(--border-strong); color: var(--text); }
.btn-icon .material-symbols-outlined { font-size: 1rem; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: var(--space-5); }

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
  letter-spacing: -0.01em;
}

.form-control {
  width: 100%;
  padding: 0.5625rem 0.875rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  outline: none;
  appearance: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control:disabled {
  background: var(--bg-app);
  color: var(--text-muted);
  cursor: not-allowed;
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%2394a3b8' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}

.form-hint {
  margin-top: var(--space-1);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.form-error {
  margin-top: var(--space-1);
  font-size: 0.75rem;
  color: var(--danger-text);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Validation Summary ──────────────────────────────────────── */
.validation-summary-errors {
  background: var(--danger-bg);
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  color: var(--danger-text);
  font-size: 0.875rem;
}

.field-validation-error {
  color: var(--danger-text);
  font-size: 0.75rem;
  display: block;
  margin-top: var(--space-1);
}

/* ── Alerts / Banners ───────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.875rem;
}

.alert .material-symbols-outlined { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }

.alert-success { background: var(--success-bg); border-color: rgba(5, 150, 105, 0.2); color: var(--success-text); }
.alert-warning { background: var(--warning-bg); border-color: rgba(217, 119, 6, 0.2); color: var(--warning-text); }
.alert-danger  { background: var(--danger-bg);  border-color: rgba(220, 38, 38, 0.2); color: var(--danger-text); }
.alert-info    { background: var(--info-bg);    border-color: rgba(2, 132, 199, 0.2);  color: var(--info-text); }

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-6);
}

.tab-btn {
  padding: var(--space-3) var(--space-5);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--dur-fast);
  margin-bottom: -1px;
  font-family: inherit;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* ── Search & Filter Bar ────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 400px;
}

.search-input-wrapper .material-symbols-outlined {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input-wrapper .form-control {
  padding-left: 2.25rem;
}

/* ── Drag & Drop Upload Zone ────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-xl);
  padding: var(--space-12) var(--space-8);
  text-align: center;
  transition: all var(--dur-base) var(--ease-out);
  cursor: pointer;
  background: var(--bg-page);
  position: relative;
  overflow: hidden;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-muted);
}

.upload-zone.drag-over {
  box-shadow: 0 0 0 4px var(--primary-glow);
  transform: scale(1.005);
}

.upload-zone-icon {
  width: 64px; height: 64px;
  background: var(--primary-muted);
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto var(--space-5);
  transition: transform var(--dur-base) var(--ease-out);
}

.upload-zone:hover .upload-zone-icon,
.upload-zone.drag-over .upload-zone-icon {
  transform: scale(1.1);
}

.upload-zone-icon .material-symbols-outlined {
  font-size: 2rem;
  color: var(--primary);
}

.upload-zone-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-2);
}

.upload-zone-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.upload-zone-sub strong {
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
}
.upload-zone-sub strong:hover { text-decoration: underline; }

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: var(--bg-page);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.pagination-btn {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--dur-fast);
}
.pagination-btn:hover { border-color: var(--border-strong); color: var(--text); }
.pagination-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Login Page ─────────────────────────────────────────────── */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface);
}

@media (max-width: 768px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { display: none; }
}

.login-brand {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  position: relative;
  overflow: hidden;
}

.login-brand::before {
  content: '';
  position: absolute;
  top: -30%; right: -20%;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, transparent 60%);
  pointer-events: none;
}

.login-brand-logo {
  width: 72px; height: 72px;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--space-6);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.login-brand-logo .material-symbols-outlined {
  font-size: 2.5rem;
  color: #fff;
}

.login-brand h1 {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.04em;
  text-align: center;
  margin-bottom: var(--space-3);
}

.login-brand p {
  font-size: 1rem;
  color: rgba(255,255,255,0.65);
  text-align: center;
  max-width: 300px;
  line-height: 1.6;
}

.login-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-10);
  background: var(--surface);
}

.login-form-card {
  width: 100%;
  max-width: 400px;
}

.login-form-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  margin-bottom: var(--space-2);
}

.login-form-card p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: var(--space-8);
}

.password-wrapper { position: relative; }
.password-wrapper .form-control { padding-right: 2.75rem; }
.password-toggle {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex; align-items: center;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  transition: color var(--dur-fast);
}
.password-toggle:hover { color: var(--text); }
.password-toggle .material-symbols-outlined { font-size: 1rem; }

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-8);
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--surface);
}

.footer-logo { height: 20px; width: auto; }
.footer-sep { color: var(--border-strong); }
.footer-page-id { font-family: ui-monospace, monospace; }

/* ── Loading / Skeleton ─────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg-app) 50%, var(--border) 75%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ── Spinner ────────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Progress indicator ─────────────────────────────────────── */
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width 0.4s var(--ease-out);
}

/* ── Modal / Dialog ─────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-6);
  animation: fade-in var(--dur-base) var(--ease-out);
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 520px;
  animation: modal-in var(--dur-slow) var(--ease-out);
}

@keyframes modal-in {
  from { transform: translateY(20px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.modal-close {
  padding: var(--space-2);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all var(--dur-fast);
}
.modal-close:hover { background: var(--bg-page); color: var(--text); }

.modal-body { padding: var(--space-6); }
.modal-footer {
  display: flex; justify-content: flex-end; gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  background: var(--bg-page);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ── Utilities ──────────────────────────────────────────────── */
.flex           { display: flex; }
.flex-col       { flex-direction: column; }
.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.justify-between{ justify-content: space-between; }
.justify-end    { justify-content: flex-end; }
.gap-2          { gap: var(--space-2); }
.gap-3          { gap: var(--space-3); }
.gap-4          { gap: var(--space-4); }
.gap-6          { gap: var(--space-6); }
.mt-1           { margin-top: var(--space-1); }
.mt-2           { margin-top: var(--space-2); }
.mt-4           { margin-top: var(--space-4); }
.mt-6           { margin-top: var(--space-6); }
.mb-4           { margin-bottom: var(--space-4); }
.mb-6           { margin-bottom: var(--space-6); }
.w-full         { width: 100%; }
.text-sm        { font-size: 0.875rem; }
.text-xs        { font-size: 0.75rem; }
.text-muted     { color: var(--text-muted); }
.font-semibold  { font-weight: 600; }
.font-bold      { font-weight: 700; }
.truncate       { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── OcrProcessingLog specific ──────────────────────────────── */
.ocr-status-cell { display: flex; align-items: center; gap: var(--space-2); }
.log-row-processing { background: rgba(217, 119, 6, 0.03); }

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
}
.empty-state-icon {
  width: 56px; height: 56px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto var(--space-4);
}
.empty-state-icon .material-symbols-outlined { font-size: 1.5rem; color: var(--text-muted); }
.empty-state h3 { font-size: 0.9rem; font-weight: 600; color: var(--text); margin-bottom: var(--space-2); }
.empty-state p  { font-size: 0.8125rem; color: var(--text-muted); }

/* ── Print / PDF Invoice Viewer ─────────────────────────────── */
.invoice-viewer-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-6);
}

.invoice-list-item {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--dur-fast);
}
.invoice-list-item:hover { background: var(--bg-page); border-color: var(--border); }
.invoice-list-item.selected {
  background: var(--primary-muted);
  border-color: rgba(79, 70, 229, 0.25);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .main-content { padding: var(--space-5); }
  .invoice-viewer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  .sidebar { transform: translateX(-100%); }
  .main-wrapper { margin-left: 0; }
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes slide-up {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.animate-slide-up {
  animation: slide-up var(--dur-slow) var(--ease-out) both;
}

/* Stagger children */
.stagger > * { animation: slide-up var(--dur-slow) var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 50ms; }
.stagger > *:nth-child(3) { animation-delay: 100ms; }
.stagger > *:nth-child(4) { animation-delay: 150ms; }
.stagger > *:nth-child(5) { animation-delay: 200ms; }
.stagger > *:nth-child(n+6) { animation-delay: 250ms; }

/* ── Bootstrap Utility Bridge ──────────────────────────────── */
.d-flex           { display: flex !important; }
.flex-column      { flex-direction: column !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-end     { justify-content: flex-end !important; }
.justify-content-center  { justify-content: center !important; }
.align-items-center      { align-items: center !important; }
.align-items-start       { align-items: flex-start !important; }
.align-items-end         { align-items: flex-end !important; }
.flex-wrap        { flex-wrap: wrap !important; }
.gap-1            { gap: 0.25rem !important; }
.gap-2            { gap: 0.5rem !important; }
.gap-3            { gap: 0.75rem !important; }
.gap-4            { gap: 1rem !important; }
.mb-1             { margin-bottom: 0.25rem !important; }
.mb-2             { margin-bottom: 0.5rem !important; }
.mb-3             { margin-bottom: 0.75rem !important; }
.mb-4             { margin-bottom: 1rem !important; }
.mb-5             { margin-bottom: 1.25rem !important; }
.mb-6             { margin-bottom: 1.5rem !important; }
.mt-1             { margin-top: 0.25rem !important; }
.mt-2             { margin-top: 0.5rem !important; }
.mt-3             { margin-top: 0.75rem !important; }
.mt-4             { margin-top: 1rem !important; }
.mr-1             { margin-right: 0.25rem !important; }
.mr-2             { margin-right: 0.5rem !important; }
.mr-3             { margin-right: 0.75rem !important; }
.mr-4             { margin-right: 1rem !important; }
.ml-1             { margin-left: 0.25rem !important; }
.ml-2             { margin-left: 0.5rem !important; }
.ml-3             { margin-left: 0.75rem !important; }
.ml-4             { margin-left: 1rem !important; }
.text-center      { text-align: center !important; }
.text-right       { text-align: right !important; }
.text-left        { text-align: left !important; }
.text-bold        { font-weight: 700 !important; }
.font-semibold    { font-weight: 600 !important; }
.font-mono        { font-family: monospace !important; }
.text-success     { color: var(--success) !important; }
.text-danger      { color: var(--danger) !important; }
.text-warning     { color: var(--warning) !important; }
.text-info        { color: var(--info) !important; }
.py-1             { padding-top: 0.25rem !important; padding-bottom: 0.25rem !important; }
.py-2             { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.py-3             { padding-top: 0.75rem !important; padding-bottom: 0.75rem !important; }
.py-4             { padding-top: 1rem !important; padding-bottom: 1rem !important; }
.py-5             { padding-top: 1.25rem !important; padding-bottom: 1.25rem !important; }
.px-1             { padding-left: 0.25rem !important; padding-right: 0.25rem !important; }
.px-2             { padding-left: 0.5rem !important; padding-right: 0.5rem !important; }
.px-3             { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
.px-4             { padding-left: 1rem !important; padding-right: 1rem !important; }
.shadow-sm        { box-shadow: var(--shadow-sm) !important; }
.shadow-md        { box-shadow: var(--shadow-md) !important; }
.shadow-lg        { box-shadow: var(--shadow-lg) !important; }
.shadow-xl        { box-shadow: var(--shadow-xl) !important; }
.py-4.text-center.text-muted {
  padding-top: 1.5rem !important;
  padding-bottom: 1.5rem !important;
  color: var(--text-muted) !important;
}

/* ── Outcome filter group (ofg) ───────────────────────────── */
.filter-form {
  display: flex !important;
  align-items: center !important;
  gap: var(--space-3) !important;
  flex-wrap: wrap !important;
  flex: 1 !important;
}
.ofg {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  padding: 4px 8px;
  border-radius: var(--radius-md);
  height: 38px;
}
.ofg__item {
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
  margin: 0;
}
.ofg__item input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}
.ofg__all {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  transition: all var(--dur-fast);
}
.ofg__item input[type="radio"]:checked + .ofg__all {
  background: var(--primary-muted);
  color: var(--primary);
}
.ofg__dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: all var(--dur-fast);
}
.ofg__dot--tbd { background-color: #94a3b8; }
.ofg__dot--loss { background-color: var(--danger); }
.ofg__dot--profit { background-color: var(--success); }
.ofg__dot--margin { background-color: var(--warning); }

.ofg__item input[type="radio"]:checked + .ofg__dot {
  transform: scale(1.2);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary-light);
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  margin: 0;
}

/* ── Section Header ────────────────────────────────────────── */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-8);
  margin-bottom: var(--space-4);
}
.section-header h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

/* ── Status Pills & Badges ─────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.status-pill::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.status-open       { background: var(--info-bg); color: var(--info-text); }
.status-closed     { background: #f1f5f9; color: #64748b; }
.status-denied     { background: var(--danger-bg); color: var(--danger-text); }
.status-paid       { background: var(--success-bg); color: var(--success-text); }
.status-csr        { background: var(--primary-muted); color: var(--primary); }
.status-contacted  { background: var(--warning-bg); color: var(--warning-text); }
.status-mgr        { background: #fae8ff; color: #a21caf; }
.status-matched    { background: var(--success-bg); color: var(--success-text); }
.status-pending    { background: var(--warning-bg); color: var(--warning-text); }

.role-badge, .status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.role-systemadmin { background: #fae8ff; color: #a21caf; }
.role-clientadmin, .role-admin { background: var(--primary-muted); color: var(--primary); }
.role-manager     { background: var(--info-bg); color: var(--info-text); }
.role-csr         { background: var(--warning-bg); color: var(--warning-text); }
.role-accounting  { background: #d1fae5; color: #065f46; }

.status-active    { background: var(--success-bg); color: var(--success-text); }
.status-inactive  { background: var(--danger-bg); color: var(--danger-text); }

/* ── Table Row states ──────────────────────────────────────── */
tr.row-loss { background-color: rgba(220, 38, 38, 0.03); }
tr.row-loss:hover { background-color: rgba(220, 38, 38, 0.06); }
tr.row-unmatched { background-color: rgba(217, 119, 6, 0.03); }
tr.row-unmatched:hover { background-color: rgba(217, 119, 6, 0.06); }
tr.row-stale { opacity: 0.65; background-color: #f8fafc; }
tr.row-inactive { opacity: 0.5; background-color: #f1f5f9; }

.badge-unmatched {
  background: var(--warning-bg);
  color: var(--warning-text);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

/* ── Outcome Dot indicators ────────────────────────────────── */
.outcome-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.outcome-dot--tbd    { background-color: #94a3b8; }
.outcome-dot--loss   { background-color: var(--danger); }
.outcome-dot--profit { background-color: var(--success); }
.outcome-dot--margin { background-color: var(--warning); }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}
.status-dot.success, .status-dot.matched { background: var(--success); }
.status-dot.partial { background: var(--warning); }
.status-dot.error, .status-dot.unmatched { background: var(--danger); }

/* ── KPI Grid & Card aliases ───────────────────────────────── */
.kpi-hero, .kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.kpi-item, .kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--dur-base) var(--ease-out),
              transform var(--dur-base) var(--ease-out);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.kpi-item:hover, .kpi-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.kpi-item--success, .kpi-card-success { border-left: 4px solid var(--success); }
.kpi-item--danger, .kpi-card-danger   { border-left: 4px solid var(--danger); }
.kpi-item--warning, .kpi-card-warning { border-left: 4px solid var(--warning); }

.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}
.kpi-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.04em;
  line-height: 1;
}
.kpi-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* ── Settings Form Components ──────────────────────────────── */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-6);
}
.form-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-2);
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-5);
  border-top: 1px solid var(--border);
  padding-top: var(--space-4);
}
.file-input-wrapper {
  border: 1px dashed var(--border-strong);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--bg-page);
  display: inline-block;
  width: 100%;
}
.file-input-wrapper input[type="file"] {
  width: 100%;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ── Three-Pane Invoice Viewer (from PVPortal main.css) ───── */
.invoice-viewer {
  display: flex;
  height: calc(100vh - var(--topbar-height) - 130px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  margin-top: var(--space-4);
}
.pane-list {
  width: 320px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.pane-list-header {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.filter-chips {
  display: flex;
  gap: var(--space-2);
}
.chip {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--dur-fast);
}
.chip.active, .chip:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.invoice-list {
  overflow-y: auto;
  flex: 1;
}
.invoice-row {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  border-left: 4px solid transparent;
  transition: all var(--dur-fast);
}
.invoice-row:hover {
  background: var(--bg-page);
}
.invoice-row.active {
  border-left-color: var(--primary);
  background: var(--primary-muted);
}
.invoice-row .row-top {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 4px;
}
.invoice-row .row-bottom {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.75rem;
}
.pane-pdf {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #f1f5f9;
}
.pdf-header {
  height: 48px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  font-size: 0.875rem;
  flex-shrink: 0;
}
.pdf-header .filename {
  font-family: ui-monospace, monospace;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.pdf-canvas-wrap {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-4);
}
.pdf-placeholder {
  margin: auto;
  color: var(--text-muted);
  text-align: center;
}
.pane-detail {
  width: 340px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  overflow: hidden;
  background: var(--surface);
  padding: 0;
  display: flex;
  flex-direction: column;
}
.pane-detail-scroll {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3) var(--space-4);
  min-height: 0;
}
.pane-detail-fixed {
  flex-shrink: 0;
  padding: 0 var(--space-4) var(--space-3);
  border-top: 2px solid var(--border);
  background: var(--surface);
}

.detail-section {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
}

.detail-section h3 {
  margin-top: 0;
  margin-bottom: var(--space-2);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-1);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-1);
  font-size: 0.78rem;
  line-height: 1.35;
}

.detail-row:last-child {
  margin-bottom: 0;
}

.detail-row .label {
  color: var(--text-secondary);
  font-weight: 500;
  flex-shrink: 0;
}

.detail-row span:not(.label) {
  color: var(--text);
  text-align: right;
  word-break: break-word;
}

.totals-row.grand {
  border-top: 1px solid var(--border);
  padding-top: var(--space-2);
  margin-top: var(--space-2);
  font-weight: 700;
  font-size: 0.88rem;
}

.line-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--space-2);
}

.line-items-table thead td {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
  padding-bottom: var(--space-1);
}

.line-items-table tbody td {
  padding: var(--space-1) 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text);
}

.line-items-table tbody tr:last-child td {
  border-bottom: none;
}

/* ── Detail Page Layout (Invoice Details) ──────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}
.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-4);
}
.detail-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-2);
}
.detail-card--loss { border-top: 4px solid var(--danger); }
.detail-card--ok   { border-top: 4px solid var(--success); }
.detail-card--warning { border-top: 4px solid var(--warning); }

.detail-list {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: var(--space-3) var(--space-4);
  font-size: 0.875rem;
  margin-bottom: var(--space-4);
}
.detail-list dt {
  color: var(--text-muted);
  font-weight: 500;
}
.detail-list dd {
  color: var(--text);
  margin: 0;
}

.status-change-panel {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-top: var(--space-5);
}
.status-change-panel h4 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: var(--space-4);
}
.status-change-panel .form-row {
  margin-bottom: var(--space-4);
}
.status-change-panel .form-row label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.outcome-circles {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}
.outcome-circle {
  display: inline-flex;
  cursor: pointer;
  position: relative;
  margin: 0;
}
.outcome-circle input {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}
.circle-visual {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: all var(--dur-fast);
  display: inline-block;
}
.outcome-circle--tbd .circle-visual    { background-color: #94a3b8; }
.outcome-circle--loss .circle-visual   { background-color: var(--danger); }
.outcome-circle--profit .circle-visual { background-color: var(--success); }
.outcome-circle--margin .circle-visual { background-color: var(--warning); }

.outcome-circle input:checked + .circle-visual {
  transform: scale(1.2);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary-light);
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.note-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-xs);
}
.note-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}
.note-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.line-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.line-items-table td {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
}
.line-items-table thead td {
  font-weight: 700;
  color: var(--text-muted);
}
.totals-row.grand {
  font-weight: 700;
  font-size: 1rem;
}

/* Tab Bars */
.tab-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  gap: var(--space-3);
}
.tab-link {
  padding: var(--space-3) var(--space-5);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--dur-fast);
  margin-bottom: -1px;
  text-decoration: none;
}
.tab-link:hover {
  color: var(--text);
}
.tab-link.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.tab-actions {
  display: flex;
  gap: var(--space-2);
}
.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
}
.btn-outline:hover {
  background: var(--bg-page);
  color: var(--text);
  border-color: var(--border-strong);
}

/* ── Breadcrumb Navigation (PDF Spec) ────────────────────────────── */
.breadcrumb-nav {
  margin-bottom: 1rem;
  padding: 0.5rem 0;
}
.breadcrumb-list {
  display: flex;
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 0;
  font-size: 0.85rem;
}
.breadcrumb-item + .breadcrumb-item::before {
  content: "›";
  padding: 0 0.5rem;
  color: var(--text-muted, #64748b);
}
.breadcrumb-item a {
  color: var(--accent, #6366f1);
  text-decoration: none;
  transition: color 0.15s;
}
.breadcrumb-item a:hover {
  color: var(--accent-hover, #818cf8);
  text-decoration: underline;
}
.breadcrumb-item.active {
  color: var(--text-secondary, #94a3b8);
}
