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

:root {
  --bg: hsl(210, 5%, 98%);
  --bg-card: hsl(210, 5%, 96%);
  --bg-card-border: hsl(210, 5%, 92%);
  --bg-secondary: hsl(210, 5%, 94%);
  --text: hsl(210, 6%, 12%);
  --text-primary: hsl(210, 6%, 12%);
  --text-secondary: hsl(210, 8%, 38%);
  --text-tertiary: hsl(210, 8%, 55%);
  --text-muted: hsl(210, 8%, 55%);
  --primary: hsl(210, 85%, 42%);
  --primary-hover: hsl(210, 85%, 36%);
  --primary-fg: hsl(210, 85%, 98%);
  --primary-light: hsl(210, 85%, 95%);
  --primary-subtle: hsl(210, 85%, 95%);
  --border: hsl(210, 5%, 90%);
  --border-color: hsl(210, 5%, 90%);
  --input-border: hsl(210, 8%, 78%);
  --surface: hsl(210, 5%, 98%);
  --sidebar-bg: hsl(210, 5%, 94%);
  --sidebar-fg: hsl(210, 6%, 12%);
  --sidebar-muted: hsl(210, 8%, 38%);
  --sidebar-border: hsl(210, 5%, 88%);
  --sidebar-accent: hsl(210, 8%, 88%);
  --muted: hsl(210, 8%, 90%);
  --muted-fg: hsl(210, 8%, 38%);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: hsl(210, 85%, 50%);
  --ring: hsl(210, 85%, 42%);
  --chart-1: hsl(210, 85%, 42%);
  --chart-2: hsl(195, 75%, 38%);
  --chart-3: hsl(145, 65%, 40%);
  --chart-4: hsl(45, 85%, 50%);
  --chart-5: hsl(0, 72%, 50%);
  --chart-6: hsl(210, 8%, 60%);
  --radius: 0.5rem;
  --shadow-sm: 0px 1px 2px 0px rgba(0,0,0,0.04);
  --shadow: 0px 1px 3px 0px rgba(0,0,0,0.06);
  --shadow-md: 0px 2px 6px -1px rgba(0,0,0,0.08);
}

body.dark {
  --bg: hsl(210, 6%, 8%);
  --bg-card: hsl(210, 6%, 10%);
  --bg-card-border: hsl(210, 6%, 14%);
  --bg-secondary: hsl(210, 6%, 13%);
  --text: hsl(210, 6%, 96%);
  --text-primary: hsl(210, 6%, 96%);
  --text-secondary: hsl(210, 10%, 72%);
  --text-tertiary: hsl(210, 10%, 52%);
  --text-muted: hsl(210, 10%, 52%);
  --primary: hsl(210, 85%, 55%);
  --primary-hover: hsl(210, 85%, 62%);
  --primary-fg: hsl(210, 85%, 98%);
  --primary-light: hsl(210, 85%, 15%);
  --primary-subtle: hsl(210, 85%, 15%);
  --border: hsl(210, 6%, 18%);
  --border-color: hsl(210, 6%, 18%);
  --input-border: hsl(210, 10%, 28%);
  --surface: hsl(210, 6%, 10%);
  --sidebar-bg: hsl(210, 6%, 12%);
  --sidebar-fg: hsl(210, 6%, 96%);
  --sidebar-muted: hsl(210, 10%, 62%);
  --sidebar-border: hsl(210, 6%, 16%);
  --sidebar-accent: hsl(210, 10%, 18%);
  --muted: hsl(210, 10%, 20%);
  --muted-fg: hsl(210, 10%, 72%);
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: hsl(210, 85%, 65%);
  --ring: hsl(210, 85%, 55%);
  --chart-1: hsl(210, 85%, 70%);
  --chart-2: hsl(195, 75%, 68%);
  --chart-3: hsl(145, 65%, 55%);
  --chart-4: hsl(45, 85%, 60%);
  --chart-5: hsl(0, 72%, 60%);
  --chart-6: hsl(210, 8%, 55%);
  --shadow-sm: 0px 1px 2px 0px rgba(0,0,0,0.2);
  --shadow: 0px 1px 3px 0px rgba(0,0,0,0.3);
  --shadow-md: 0px 2px 6px -1px rgba(0,0,0,0.35);
}

body.navy {
  --bg: hsl(215, 45%, 12%);
  --bg-card: hsl(215, 45%, 16%);
  --bg-card-border: hsl(215, 45%, 22%);
  --bg-secondary: hsl(215, 45%, 14%);
  --text: hsl(210, 40%, 96%);
  --text-primary: hsl(210, 40%, 96%);
  --text-secondary: hsl(210, 30%, 75%);
  --text-tertiary: hsl(210, 20%, 55%);
  --text-muted: hsl(210, 20%, 55%);
  --primary: hsl(210, 85%, 60%);
  --primary-hover: hsl(210, 85%, 68%);
  --primary-fg: hsl(215, 45%, 10%);
  --primary-light: hsl(210, 85%, 20%);
  --primary-subtle: hsl(210, 85%, 20%);
  --border: hsl(215, 45%, 24%);
  --border-color: hsl(215, 45%, 24%);
  --input-border: hsl(215, 40%, 32%);
  --surface: hsl(215, 45%, 14%);
  --sidebar-bg: hsl(215, 50%, 10%);
  --sidebar-fg: hsl(210, 40%, 96%);
  --sidebar-muted: hsl(210, 25%, 65%);
  --sidebar-border: hsl(215, 45%, 18%);
  --sidebar-accent: hsl(215, 45%, 20%);
  --muted: hsl(215, 30%, 22%);
  --muted-fg: hsl(210, 30%, 75%);
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: hsl(210, 85%, 65%);
  --ring: hsl(210, 85%, 60%);
  --shadow-sm: 0px 1px 2px 0px rgba(0,0,0,0.3);
  --shadow: 0px 1px 3px 0px rgba(0,0,0,0.4);
  --shadow-md: 0px 2px 6px -1px rgba(0,0,0,0.5);
}

body.blood_red {
  --bg: hsl(0, 0%, 100%);
  --bg-card: hsl(0, 0%, 98%);
  --bg-card-border: hsl(0, 10%, 90%);
  --bg-secondary: hsl(0, 0%, 96%);
  --text: hsl(0, 10%, 10%);
  --text-primary: hsl(0, 10%, 10%);
  --text-secondary: hsl(0, 5%, 35%);
  --text-tertiary: hsl(0, 5%, 55%);
  --text-muted: hsl(0, 5%, 55%);
  --primary: hsl(0, 85%, 42%);
  --primary-hover: hsl(0, 85%, 35%);
  --primary-fg: hsl(0, 0%, 100%);
  --primary-light: hsl(0, 85%, 95%);
  --primary-subtle: hsl(0, 85%, 95%);
  --border: hsl(0, 10%, 88%);
  --border-color: hsl(0, 10%, 88%);
  --input-border: hsl(0, 10%, 75%);
  --surface: hsl(0, 0%, 100%);
  --sidebar-bg: hsl(0, 85%, 18%);
  --sidebar-fg: hsl(0, 0%, 98%);
  --sidebar-muted: hsl(0, 20%, 75%);
  --sidebar-border: hsl(0, 70%, 25%);
  --sidebar-accent: hsl(0, 70%, 28%);
  --muted: hsl(0, 10%, 92%);
  --muted-fg: hsl(0, 5%, 35%);
  --success: #16a34a;
  --warning: #d97706;
  --danger: hsl(0, 85%, 42%);
  --info: hsl(0, 85%, 42%);
  --ring: hsl(0, 85%, 42%);
  --shadow-sm: 0px 1px 2px 0px rgba(0,0,0,0.04);
  --shadow: 0px 1px 3px 0px rgba(0,0,0,0.06);
  --shadow-md: 0px 2px 6px -1px rgba(0,0,0,0.08);
}

body.apple_green {
  --bg: hsl(120, 10%, 98%);
  --bg-card: hsl(120, 10%, 96%);
  --bg-card-border: hsl(120, 10%, 90%);
  --bg-secondary: hsl(120, 10%, 94%);
  --text: hsl(120, 10%, 10%);
  --text-primary: hsl(120, 10%, 10%);
  --text-secondary: hsl(120, 8%, 35%);
  --text-tertiary: hsl(120, 8%, 52%);
  --text-muted: hsl(120, 8%, 52%);
  --primary: hsl(120, 60%, 35%);
  --primary-hover: hsl(120, 60%, 28%);
  --primary-fg: hsl(0, 0%, 100%);
  --primary-light: hsl(120, 60%, 92%);
  --primary-subtle: hsl(120, 60%, 92%);
  --border: hsl(120, 10%, 88%);
  --border-color: hsl(120, 10%, 88%);
  --input-border: hsl(120, 12%, 74%);
  --surface: hsl(120, 10%, 98%);
  --sidebar-bg: hsl(120, 50%, 14%);
  --sidebar-fg: hsl(120, 10%, 97%);
  --sidebar-muted: hsl(120, 20%, 70%);
  --sidebar-border: hsl(120, 40%, 20%);
  --sidebar-accent: hsl(120, 40%, 22%);
  --muted: hsl(120, 10%, 90%);
  --muted-fg: hsl(120, 8%, 35%);
  --success: hsl(120, 60%, 35%);
  --warning: #d97706;
  --danger: #ef4444;
  --info: hsl(120, 60%, 35%);
  --ring: hsl(120, 60%, 35%);
  --shadow-sm: 0px 1px 2px 0px rgba(0,0,0,0.04);
  --shadow: 0px 1px 3px 0px rgba(0,0,0,0.06);
  --shadow-md: 0px 2px 6px -1px rgba(0,0,0,0.08);
}

body.purple {
  --bg: hsl(270, 10%, 98%);
  --bg-card: hsl(270, 10%, 96%);
  --bg-card-border: hsl(270, 10%, 90%);
  --bg-secondary: hsl(270, 10%, 94%);
  --text: hsl(270, 10%, 10%);
  --text-primary: hsl(270, 10%, 10%);
  --text-secondary: hsl(270, 8%, 35%);
  --text-tertiary: hsl(270, 8%, 52%);
  --text-muted: hsl(270, 8%, 52%);
  --primary: hsl(270, 65%, 48%);
  --primary-hover: hsl(270, 65%, 40%);
  --primary-fg: hsl(0, 0%, 100%);
  --primary-light: hsl(270, 65%, 93%);
  --primary-subtle: hsl(270, 65%, 93%);
  --border: hsl(270, 10%, 88%);
  --border-color: hsl(270, 10%, 88%);
  --input-border: hsl(270, 12%, 74%);
  --surface: hsl(270, 10%, 98%);
  --sidebar-bg: hsl(270, 50%, 16%);
  --sidebar-fg: hsl(270, 10%, 97%);
  --sidebar-muted: hsl(270, 20%, 70%);
  --sidebar-border: hsl(270, 40%, 22%);
  --sidebar-accent: hsl(270, 40%, 25%);
  --muted: hsl(270, 10%, 90%);
  --muted-fg: hsl(270, 8%, 35%);
  --success: #16a34a;
  --warning: #d97706;
  --danger: #ef4444;
  --info: hsl(270, 65%, 55%);
  --ring: hsl(270, 65%, 48%);
  --shadow-sm: 0px 1px 2px 0px rgba(0,0,0,0.04);
  --shadow: 0px 1px 3px 0px rgba(0,0,0,0.06);
  --shadow-md: 0px 2px 6px -1px rgba(0,0,0,0.08);
}

body.sky_blue {
  --bg: hsl(195, 30%, 98%);
  --bg-card: hsl(195, 30%, 96%);
  --bg-card-border: hsl(195, 20%, 90%);
  --bg-secondary: hsl(195, 20%, 94%);
  --text: hsl(200, 20%, 10%);
  --text-primary: hsl(200, 20%, 10%);
  --text-secondary: hsl(200, 15%, 35%);
  --text-tertiary: hsl(200, 12%, 52%);
  --text-muted: hsl(200, 12%, 52%);
  --primary: hsl(195, 80%, 40%);
  --primary-hover: hsl(195, 80%, 33%);
  --primary-fg: hsl(0, 0%, 100%);
  --primary-light: hsl(195, 80%, 92%);
  --primary-subtle: hsl(195, 80%, 92%);
  --border: hsl(195, 20%, 88%);
  --border-color: hsl(195, 20%, 88%);
  --input-border: hsl(195, 20%, 74%);
  --surface: hsl(195, 30%, 98%);
  --sidebar-bg: hsl(195, 60%, 18%);
  --sidebar-fg: hsl(195, 20%, 97%);
  --sidebar-muted: hsl(195, 25%, 68%);
  --sidebar-border: hsl(195, 50%, 24%);
  --sidebar-accent: hsl(195, 50%, 26%);
  --muted: hsl(195, 20%, 90%);
  --muted-fg: hsl(200, 15%, 35%);
  --success: #16a34a;
  --warning: #d97706;
  --danger: #ef4444;
  --info: hsl(195, 80%, 45%);
  --ring: hsl(195, 80%, 40%);
  --shadow-sm: 0px 1px 2px 0px rgba(0,0,0,0.04);
  --shadow: 0px 1px 3px 0px rgba(0,0,0,0.06);
  --shadow-md: 0px 2px 6px -1px rgba(0,0,0,0.08);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a:hover {
  text-decoration: underline;
}

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

.sidebar {
  width: 256px;
  background: var(--sidebar-bg);
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  border-right: 1px solid var(--sidebar-border);
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

.main-content {
  flex: 1;
  margin-left: 256px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  min-height: 49px;
}

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.sidebar-header {
  padding: 16px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.sidebar-logo:hover {
  text-decoration: none;
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-icon svg {
  width: 20px;
  height: 20px;
  color: var(--primary-fg);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
}

.sidebar-logo-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--sidebar-fg);
}

.sidebar-logo-subtitle {
  font-size: 11px;
  color: var(--sidebar-muted);
}

.sidebar-nav {
  flex: 1;
  padding: 0 8px;
}

.nav-section-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sidebar-muted);
  padding: 16px 12px 6px;
}

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-item {
  margin-bottom: 1px;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--sidebar-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item a:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--sidebar-fg);
  text-decoration: none;
}

body.dark .nav-item a:hover {
  background: rgba(255, 255, 255, 0.04);
}

.nav-item a.active {
  background: var(--sidebar-accent);
  color: var(--sidebar-fg);
  font-weight: 500;
}

.nav-item a .nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-item a .nav-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--sidebar-border);
  margin-top: auto;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-fg);
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.sidebar-user-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--sidebar-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.sidebar-user-role {
  font-size: 12px;
  color: var(--sidebar-muted);
  text-transform: capitalize;
  display: block;
}

.btn-icon-ghost {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.btn-icon-ghost:hover {
  background: rgba(0, 0, 0, 0.06);
}

body.dark .btn-icon-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
}

.btn-icon-ghost svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-toggle {
  display: none;
}

.sidebar-overlay {
  display: none;
}

.card {
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--bg-card-border);
  box-shadow: var(--shadow-sm);
}

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

.card-header-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.card-header-subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.card-header-icon {
  color: var(--text-tertiary);
}

.card-header-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card-content {
  padding: 20px;
  padding-top: 12px;
}

.card-padded {
  padding: 20px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--bg-card-border);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.stat-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stat-card-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.stat-card-icon {
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
}

.stat-card-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stat-card-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

.stat-card-subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-pending {
  background: hsl(45, 90%, 92%);
  color: hsl(35, 80%, 35%);
}

.badge-approved {
  background: hsl(210, 80%, 92%);
  color: hsl(210, 80%, 35%);
}

.badge-active, .badge-success {
  background: hsl(145, 60%, 90%);
  color: hsl(155, 70%, 28%);
}

.badge-rejected, .badge-danger {
  background: hsl(0, 75%, 93%);
  color: hsl(0, 70%, 35%);
}

.badge-closed {
  background: hsl(210, 8%, 90%);
  color: hsl(210, 8%, 40%);
}

.badge-defaulted {
  background: hsl(0, 75%, 93%);
  color: hsl(0, 70%, 30%);
}

.badge-photo {
  background: hsl(210, 80%, 93%);
  color: hsl(210, 80%, 40%);
  font-size: 11px;
}

.badge-print {
  background: hsl(270, 60%, 93%);
  color: hsl(270, 60%, 40%);
  font-size: 11px;
}

body.dark .badge-pending {
  background: hsl(45, 90%, 50% / 0.12);
  color: hsl(45, 85%, 65%);
}

body.dark .badge-approved {
  background: hsl(210, 80%, 50% / 0.12);
  color: hsl(210, 80%, 70%);
}

body.dark .badge-active,
body.dark .badge-success {
  background: hsl(145, 60%, 40% / 0.12);
  color: hsl(145, 60%, 65%);
}

body.dark .badge-rejected,
body.dark .badge-danger {
  background: hsl(0, 72%, 50% / 0.12);
  color: hsl(0, 72%, 70%);
}

body.dark .badge-closed {
  background: hsl(210, 8%, 50% / 0.12);
  color: hsl(210, 8%, 65%);
}

body.dark .badge-defaulted {
  background: hsl(0, 72%, 40% / 0.12);
  color: hsl(0, 72%, 68%);
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
}

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

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 2px hsl(210, 85%, 42% / 0.15);
}

body.dark .form-input:focus,
body.dark .form-select:focus,
body.dark .form-textarea:focus {
  box-shadow: 0 0 0 2px hsl(210, 85%, 55% / 0.2);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
  transition: background 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover {
  background: rgba(0, 0, 0, 0.03);
}

body.dark .btn-outline:hover {
  background: rgba(255, 255, 255, 0.04);
}

.btn-danger {
  background: hsl(0, 72%, 95%);
  color: hsl(0, 72%, 38%);
  border-color: hsl(0, 72%, 90%);
}

.btn-danger:hover {
  background: hsl(0, 72%, 92%);
}

body.dark .btn-danger {
  background: hsl(0, 72%, 50% / 0.12);
  color: hsl(0, 72%, 70%);
  border-color: hsl(0, 72%, 50% / 0.2);
}

body.dark .btn-danger:hover {
  background: hsl(0, 72%, 50% / 0.2);
}

.btn-success {
  background: hsl(145, 60%, 93%);
  color: hsl(155, 70%, 28%);
  border-color: hsl(145, 60%, 85%);
}

.btn-success:hover {
  background: hsl(145, 60%, 88%);
}

body.dark .btn-success {
  background: hsl(145, 60%, 40% / 0.12);
  color: hsl(145, 60%, 65%);
  border-color: hsl(145, 60%, 40% / 0.2);
}

body.dark .btn-success:hover {
  background: hsl(145, 60%, 40% / 0.2);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 13px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
}

.table-container {
  overflow-x: auto;
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 10px 12px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: rgba(0, 0, 0, 0.015);
}

body.dark tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

thead tr:hover {
  background: transparent;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

body.dark .modal-overlay {
  background: rgba(0, 0, 0, 0.7);
}

.modal {
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--bg-card-border);
  padding: 24px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

body.dark .modal {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  cursor: pointer;
  border: none;
  background: none;
  font-size: 20px;
  color: var(--text-tertiary);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  transition: background 0.15s ease;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

body.dark .modal-close:hover {
  background: rgba(255, 255, 255, 0.06);
}

.flash-message {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  animation: flashIn 0.3s ease;
}

@keyframes flashIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.flash-success {
  background: hsl(145, 60%, 93%);
  color: hsl(155, 70%, 28%);
  border: 1px solid hsl(145, 60%, 85%);
}

.flash-error {
  background: hsl(0, 72%, 95%);
  color: hsl(0, 72%, 35%);
  border: 1px solid hsl(0, 72%, 88%);
}

body.dark .flash-success {
  background: hsl(145, 60%, 40% / 0.08);
  border-color: hsl(145, 60%, 40% / 0.15);
  color: hsl(145, 60%, 65%);
}

body.dark .flash-error {
  background: hsl(0, 72%, 50% / 0.08);
  border-color: hsl(0, 72%, 50% / 0.15);
  color: hsl(0, 72%, 70%);
}

.flash-close {
  cursor: pointer;
  border: none;
  background: none;
  font-size: 18px;
  color: inherit;
  opacity: 0.6;
  padding: 0 4px;
}

.flash-close:hover {
  opacity: 1;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  padding: 8px 16px;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-secondary);
  transition: color 0.15s ease, border-color 0.15s ease;
  margin-bottom: -1px;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  border-bottom-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.biometric-section {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 16px;
}

.capture-area {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.capture-preview img {
  max-height: 160px;
  border-radius: var(--radius);
  object-fit: contain;
  margin: 8px 0;
}

.capture-area video {
  max-height: 160px;
  width: 100%;
  background: #000;
  border-radius: var(--radius);
  margin: 8px 0;
}

.search-bar {
  position: relative;
  max-width: 320px;
}

.search-bar .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

.search-bar .search-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
}

.search-input:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 2px hsl(210, 85%, 42% / 0.15);
}

body.dark .search-input:focus {
  box-shadow: 0 0 0 2px hsl(210, 85%, 55% / 0.2);
}

.chart-container {
  height: 224px;
  position: relative;
}

.chart-container canvas {
  max-width: 100%;
}

.chart-card {
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--bg-card-border);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.chart-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.chart-subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--bg-card-border);
  padding: 32px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-md);
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-header .login-logo {
  width: 48px;
  height: 48px;
  background: var(--primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.login-header .login-logo svg {
  width: 28px;
  height: 28px;
  color: var(--primary-fg);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-header h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

.text-center { text-align: center; }
.text-right { text-align: right; }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.flex-center { display: flex; align-items: center; justify-content: center; }

.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }

.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }

.hidden { display: none; }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-tertiary);
}

.empty-state .empty-icon {
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state .empty-icon svg {
  width: 40px;
  height: 40px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 4px;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

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

.section-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.recent-section {
  margin-top: 16px;
}

.recent-section .section-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.recent-section .section-subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

.loan-preview {
  background: var(--primary-light);
  border: 1px solid hsl(210, 85%, 42% / 0.15);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
}

body.dark .loan-preview {
  border-color: hsl(210, 85%, 55% / 0.2);
}

.loan-preview .preview-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 14px;
}

.loan-preview .preview-label {
  color: var(--text-secondary);
}

.loan-preview .preview-value {
  font-weight: 600;
}

.actions-cell {
  display: flex;
  gap: 4px;
  align-items: center;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.detail-item {
  padding: 8px 0;
}

.detail-label {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}

.detail-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.theme-toggle-btn {
  position: relative;
}

.mono-text {
  font-family: 'SF Mono', 'Consolas', 'Menlo', monospace;
  font-size: 12px;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

.max-w-7xl {
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: flex;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text);
    align-items: center;
    justify-content: center;
  }

  .sidebar-toggle svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .sidebar-overlay.active {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 90;
  }

  .main-content {
    margin-left: 0;
  }

  .stats-grid,
  .charts-grid,
  .grid-2,
  .grid-3,
  .grid-4,
  .cards-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .modal {
    width: 95%;
    padding: 16px;
  }

  table {
    font-size: 13px;
  }

  th, td {
    padding: 8px 6px;
  }

  .page-header h1 {
    font-size: 20px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

.report-stat-card {
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--bg-card-border);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}

.report-stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.report-stat-value {
  font-size: 20px;
  font-weight: 700;
}

.settings-section {
  margin-bottom: 32px;
}

.settings-section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--muted);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-lg {
  height: 12px;
  border-radius: 6px;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.4s ease;
  min-width: 0;
}

.progress-fill.progress-complete {
  background: var(--success);
}

.progress-fill.progress-low {
  background: var(--warning);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
  padding: 16px 0;
}

.pagination-info {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ==================== GLOBAL SEARCH ==================== */
.global-search-wrapper {
  position: relative;
}
.search-shortcut-hint {
  font-size: 0.68rem;
  color: var(--text-muted, var(--text-tertiary));
  background: var(--muted, var(--bg-card));
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  margin-right: 4px;
  white-space: nowrap;
}
.global-search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  min-width: 340px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 2000;
  max-height: 400px;
  overflow-y: auto;
}
.search-group-label {
  padding: 6px 12px 4px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary, var(--text-secondary));
  background: var(--bg-card, #fafafa);
  border-bottom: 1px solid var(--border);
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  font-size: 0.82rem;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.search-result-item:hover {
  background: var(--primary-light, #eff6ff);
}
.search-result-icon {
  font-size: 1rem;
  flex-shrink: 0;
}
.search-result-sub {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--text-tertiary, var(--text-secondary));
  white-space: nowrap;
}
.search-no-results {
  padding: 16px;
  text-align: center;
  color: var(--text-tertiary, var(--text-secondary));
  font-size: 0.85rem;
}

/* ==================== REPORT TABS ==================== */
.report-tab {
  padding: 8px 20px;
  border: none;
  background: none;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary, var(--muted-fg));
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.report-tab:hover {
  color: var(--primary);
}
.report-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.tab-alert {
  color: var(--danger, #ef4444);
}

/* ==================== OVERDUE CARD HIGHLIGHT ==================== */
.card-overdue {
  border-left: 3px solid var(--danger, #ef4444) !important;
}

/* ==================== MISSING UTILITY ==================== */
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--text-primary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }

/* btn-secondary — same look as btn-outline */
.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-secondary:hover {
  background: var(--bg-secondary);
}
body.dark .btn-secondary {
  background: hsl(210, 10%, 14%);
}
body.dark .btn-secondary:hover {
  background: hsl(210, 10%, 18%);
}

/* form-control alias for form-input/form-select */
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
  appearance: auto;
}
.form-control:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 2px hsl(210, 85%, 42% / 0.15);
}
body.dark .form-control:focus {
  box-shadow: 0 0 0 2px hsl(210, 85%, 55% / 0.2);
}
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* data-table — styled table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.data-table td {
  padding: 10px 12px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(0,0,0,0.015); }
body.dark .data-table tbody tr:hover { background: rgba(255,255,255,0.02); }

/* Stat card — React-style with icon in top-right */
.stat-card-react {
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--bg-card-border);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.stat-card-react .sc-body {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.stat-card-react .sc-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-card-react .sc-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.stat-card-react .sc-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}
.stat-card-react .sc-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}
.stat-card-react .sc-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: hsl(210, 85%, 42% / 0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
body.dark .stat-card-react .sc-icon {
  background: hsl(210, 85%, 55% / 0.12);
}
.stat-card-react .sc-icon svg {
  width: 20px;
  height: 20px;
  color: var(--primary);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Reports 4-column stats grid (responsive) */
.stats-grid-overview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 1024px) {
  .stats-grid-overview { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .stats-grid-overview { grid-template-columns: 1fr; }
}

/* Stats 5-column grid */
.stats-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}
@media (max-width: 1280px) {
  .stats-grid-5 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .stats-grid-5 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .stats-grid-5 { grid-template-columns: 1fr; }
}

/* Complete set of badge variants matching React */
.badge-secondary {
  background: hsl(210, 8%, 88%);
  color: hsl(210, 8%, 32%);
}
body.dark .badge-secondary {
  background: hsl(210, 10%, 22%);
  color: hsl(210, 10%, 72%);
}
.badge-info {
  background: hsl(210, 80%, 92%);
  color: hsl(210, 80%, 35%);
}
body.dark .badge-info {
  background: hsl(210, 80%, 30% / 0.18);
  color: hsl(210, 80%, 70%);
}
.badge-completed {
  background: hsl(210, 8%, 90%);
  color: hsl(210, 8%, 35%);
}
body.dark .badge-completed {
  background: hsl(210, 8%, 25% / 0.18);
  color: hsl(210, 8%, 65%);
}
.badge-warning {
  background: hsl(45, 90%, 92%);
  color: hsl(35, 80%, 35%);
}
body.dark .badge-warning {
  background: hsl(45, 90%, 50% / 0.12);
  color: hsl(45, 85%, 65%);
}
.badge-pending_approval, .badge-submitted, .badge-under_review {
  background: hsl(45, 90%, 92%);
  color: hsl(35, 80%, 35%);
}
body.dark .badge-pending_approval, body.dark .badge-submitted, body.dark .badge-under_review {
  background: hsl(45, 90%, 50% / 0.12);
  color: hsl(45, 85%, 65%);
}
.badge-disbursed {
  background: hsl(195, 75%, 90%);
  color: hsl(195, 75%, 28%);
}
body.dark .badge-disbursed {
  background: hsl(195, 75%, 38% / 0.12);
  color: hsl(195, 75%, 68%);
}
.badge-partially_repaid {
  background: hsl(172, 65%, 88%);
  color: hsl(172, 65%, 26%);
}
body.dark .badge-partially_repaid {
  background: hsl(172, 65%, 40% / 0.12);
  color: hsl(172, 65%, 60%);
}
.badge-draft {
  background: hsl(210, 8%, 90%);
  color: hsl(210, 8%, 42%);
}
body.dark .badge-draft {
  background: hsl(210, 8%, 30% / 0.15);
  color: hsl(210, 8%, 58%);
}
.badge-restructured {
  background: hsl(270, 60%, 92%);
  color: hsl(270, 60%, 35%);
}
body.dark .badge-restructured {
  background: hsl(270, 60%, 40% / 0.12);
  color: hsl(270, 60%, 68%);
}

/* Overdue card */
.card-alert-danger {
  background: hsl(0, 80%, 97%);
  border-color: hsl(0, 72%, 80%);
}
body.dark .card-alert-danger {
  background: hsl(0, 72%, 10%);
  border-color: hsl(0, 72%, 22%);
}
.card-alert-danger .alert-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 8px;
}
.card-alert-danger .alert-header svg {
  width: 16px; height: 16px;
  color: hsl(0, 72%, 50%);
  flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
body.dark .card-alert-danger .alert-header svg { color: hsl(0, 72%, 65%); }
.card-alert-danger .alert-title {
  font-size: 13px;
  font-weight: 600;
  color: hsl(0, 72%, 38%);
}
body.dark .card-alert-danger .alert-title { color: hsl(0, 72%, 72%); }
.card-alert-danger table th {
  color: hsl(0, 60%, 55%);
  border-bottom-color: hsl(0, 72%, 85%);
}
body.dark .card-alert-danger table th {
  color: hsl(0, 60%, 65%);
  border-bottom-color: hsl(0, 72%, 22%);
}
.card-alert-danger table tr { border-bottom: 1px solid hsl(0, 72%, 90%); }
body.dark .card-alert-danger table tr { border-bottom-color: hsl(0, 72%, 18%); }
.days-overdue-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.days-overdue-pill.critical { background: hsl(0, 72%, 50%); color: #fff; }
.days-overdue-pill.warning { background: hsl(0, 72%, 92%); color: hsl(0, 72%, 38%); }
body.dark .days-overdue-pill.warning { background: hsl(0, 72%, 25%); color: hsl(0, 72%, 72%); }

/* ==================== NEW MODAL OVERLAY PATTERN ==================== */
/* Used in rewritten templates where class="modal" is the full-screen wrapper */
div.modal.active {
  display: flex !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  padding: 20px !important;
  overflow: hidden !important;
  z-index: 1100 !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(0,0,0,0.5) !important;
}
body.dark div.modal.active {
  background: rgba(0,0,0,0.72) !important;
}
.modal-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  cursor: pointer;
}
.modal-content {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 12px;
  width: 90%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
}
body.dark .modal-content {
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-secondary);
  line-height: 1;
  padding: 0 4px;
}
.modal-close:hover { color: var(--danger, #ef4444); }
.modal-body {
  padding: 18px 22px;
  flex: 1;
  overflow-y: auto;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
