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

:root {
  /* Brand */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: rgba(37, 99, 235, 0.12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.12);
  --success: #16a34a;
  --success-soft: rgba(22, 163, 74, 0.12);
  --warning: #d97706;
  --warning-soft: rgba(217, 119, 6, 0.14);
  --indigo: #6366f1;

  /* Neutrals */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Semantic surfaces (themeable) */
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e5e7eb;
  --text: #1f2937;
  --text-muted: #6b7280;
  --sidebar-bg: #0f172a;
  --sidebar-text: #cbd5e1;
  --sidebar-active-bg: rgba(37, 99, 235, 0.18);
  --sidebar-active-text: #ffffff;

  /* Scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.16);

  --transition: 0.18s ease;
  --sidebar-w: 240px;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #0f172a;
  --border: #1f2937;
  --text: #e5e7eb;
  --text-muted: #94a3b8;
  --gray-50: #0f172a;
  --gray-100: #1e293b;
  --gray-200: #1f2937;
  --gray-700: #cbd5e1;
  --sidebar-bg: #060b16;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
}

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

.hidden {
  display: none !important;
}

.page {
  min-height: 100vh;
}

/* Buttons */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition),
    box-shadow var(--transition), transform var(--transition);
}

button:active {
  transform: translateY(1px);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.6rem 1.1rem;
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

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

.btn-block {
  width: 100%;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.5rem 0.9rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn-cancel {
  padding: 0.6rem 1.1rem;
  background: var(--gray-100);
  color: var(--gray-700);
}

.btn-cancel:hover {
  background: var(--gray-200);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

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

.form-group label {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: 500;
  color: var(--text);
  font-size: 0.9rem;
}

input,
select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

input::placeholder {
  color: var(--gray-400);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

input:user-invalid {
  border-color: var(--danger);
}

input:user-invalid:focus {
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.field-hint {
  display: block;
  margin-top: var(--space-1);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.error {
  color: var(--danger);
  margin-top: var(--space-3);
  font-size: 0.875rem;
  min-height: 1.2em;
}

.read-only-input {
  background: var(--surface-2) !important;
  cursor: not-allowed;
  opacity: 0.8;
}

.info-box {
  padding: var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* ===== Landing Page & Common Layout ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.landing-page {
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

.landing-header {
  padding: var(--space-4) 0;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}

.landing-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.brand .logo {
  background: var(--primary);
  color: #fff;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  display: flex;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.landing-nav {
  display: flex;
  gap: var(--space-3);
}

.btn-ghost-pill {
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.btn-primary-pill {
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Hero Section */
.hero {
  padding: var(--space-6) 0 var(--space-6);
  background: radial-gradient(circle at top right, rgba(37, 99, 235, 0.05), transparent);
}

.hero .container {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: center;
  gap: var(--space-6);
}

.hero-content h1 {
  font-size: 3.5rem;
  line-height: 1.1;
  margin-bottom: var(--space-4);
  color: var(--gray-900);
}

.hero-content p {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-bottom: var(--space-6);
  max-width: 540px;
}

.hero-actions {
  display: flex;
  gap: var(--space-3);
}

.btn-primary-lg {
  padding: 1rem 2rem;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}

.btn-outline-lg {
  padding: 1rem 2rem;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
}

.hero-card-mockup {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-5);
  border: 1px solid var(--border);
  transform: rotate(-3deg);
}

.mockup-header {
  display: flex;
  gap: 6px;
  margin-bottom: var(--space-4);
}

.mockup-dot {
  width: 10px;
  height: 10px;
  background: var(--gray-200);
  border-radius: 50%;
}

.mockup-line { height: 14px; background: var(--gray-100); border-radius: 4px; margin-bottom: 12px; }
.mockup-line-short { width: 60%; height: 14px; background: var(--gray-100); border-radius: 4px; margin-bottom: 24px; }
.mockup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mockup-item { height: 60px; background: var(--gray-50); border-radius: 8px; }

/* Features Section */
.features {
  padding: var(--space-6) 0;
  background: #fff;
}

.section-title {
  text-align: center;
  font-size: 2.25rem;
  margin-bottom: var(--space-6);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
}

.feature-card {
  padding: var(--space-5);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow);
  border-color: var(--primary-soft);
}

.feature-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.feature-icon.icon-blue { background: var(--primary-soft); color: var(--primary); }
.feature-icon.icon-green { background: var(--success-soft); color: var(--success); }
.feature-icon.icon-indigo { background: rgba(99, 102, 241, 0.14); color: var(--indigo); }

.feature-card h3 { margin-bottom: var(--space-2); }
.feature-card p { color: var(--text-muted); font-size: 0.95rem; }

.landing-footer {
  padding: var(--space-5) 0;
  text-align: center;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ===== Login & Public Pages ===== */
.login-page, .public-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(37, 99, 235, 0.18), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(99, 102, 241, 0.16), transparent 55%),
    var(--bg);
}

.public-page {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(22, 163, 74, 0.12), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(37, 99, 235, 0.14), transparent 55%),
    var(--bg);
}

.login-container {
  width: 100%;
  max-width: 410px;
  background: var(--surface);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.login-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  flex-shrink: 0;
}

.login-brand h1 {
  font-size: 1.5rem;
  color: var(--text);
  line-height: 1.1;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ===== Dashboard Shell ===== */
.dashboard-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: var(--space-4) var(--space-3);
  z-index: 50;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3) var(--space-5);
  color: #fff;
}

.sidebar-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
}

.sidebar-title {
  font-weight: 700;
  font-size: 1.1rem;
}

.tabs {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.7rem 0.9rem;
  background: transparent;
  color: var(--sidebar-text);
  border-radius: var(--radius-sm);
  text-align: left;
  font-weight: 500;
  width: 100%;
}

.tab-btn .nav-icon {
  flex-shrink: 0;
  opacity: 0.85;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.tab-btn.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

.tab-btn.active .nav-icon {
  opacity: 1;
  color: #60a5fa;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 40;
}

.main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--space-3) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

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

.topbar-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
}

#sidebar-toggle {
  display: none;
}

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

.user-chip {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.3rem 0.6rem 0.3rem 0.3rem;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
}

.icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: inline; }

/* Content */
.content {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}

/* Stats & Dashboard */
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-primary { color: var(--primary) !important; }

/* Dashboard Comprehensive Tab */
.dash-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  background: linear-gradient(135deg, #1e3a8a, var(--primary), #3b82f6);
  color: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.dash-hero::after {
  content: "";
  position: absolute;
  right: -50px;
  top: -50px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.dash-badge-date {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-pill);
  margin-bottom: var(--space-2);
  backdrop-filter: blur(4px);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dash-hero-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: var(--space-1);
  color: #ffffff;
}

.dash-hero-desc {
  font-size: 0.95rem;
  opacity: 0.9;
  max-width: 580px;
  color: #e0e7ff;
}

.dash-hero-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  z-index: 1;
}

.dash-hero-actions .btn-primary {
  background: #ffffff;
  color: var(--primary-dark);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dash-hero-actions .btn-primary:hover {
  background: #f1f5f9;
}

.dash-hero-actions .btn-ghost {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(4px);
}

.dash-hero-actions .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: #ffffff;
}

/* Dashboard KPI Grid */
.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.stat-card-featured {
  background: linear-gradient(135deg, var(--surface) 0%, rgba(37, 99, 235, 0.05) 100%);
  border-left: 4px solid var(--primary);
}

.dash-kpi-subtext {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Charts Grid */
.dash-charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.dash-chart-card {
  display: flex;
  flex-direction: column;
}

.dash-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}

.dash-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.dash-card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dash-chart-wrapper {
  position: relative;
  width: 100%;
  height: 280px;
}

.dash-donut-wrapper {
  height: 200px;
}

.dash-donut-legend {
  display: flex;
  justify-content: space-around;
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.dash-donut-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.donut-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-bottom: 4px;
}

.donut-color-dot.dot-setor { background: #16a34a; }
.donut-color-dot.dot-tarik { background: #dc2626; }

.donut-item-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.donut-item-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

/* Today's Activity Banner */
.dash-today-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  margin-top: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.dash-today-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  text-align: center;
}

.dash-today-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dash-today-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.dash-today-divider {
  width: 1px;
  height: 36px;
  background: var(--border);
}

/* Bottom Grid: Recent Activities */
.dash-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.dash-activity-card {
  display: flex;
  flex-direction: column;
}

.btn-ghost-sm {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

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

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

.stat-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}

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

.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.stat-icon-blue { background: var(--primary-soft); color: var(--primary); }
.stat-icon-indigo { background: rgba(99, 102, 241, 0.14); color: var(--indigo); }
.stat-icon-green { background: var(--success-soft); color: var(--success); }
.stat-icon-red { background: var(--danger-soft); color: var(--danger); }

.stat-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Toolbar */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.toolbar h2 {
  font-size: 1.15rem;
  font-weight: 600;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.search-box input {
  border: none;
  padding: 0.55rem 0;
  background: transparent;
  width: 220px;
  max-width: 100%;
}

.search-box input:focus {
  outline: none;
  box-shadow: none;
}

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

.filter-group label {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.filter-group select {
  width: auto;
  min-width: 170px;
}

.filter-group input[type="date"] {
  width: auto;
  min-width: 150px;
  padding: 0.7rem 0.85rem;
}

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  min-width: 560px;
}

thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  z-index: 1;
}

th, td {
  padding: 0.8rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

td {
  font-size: 0.9rem;
  color: var(--text);
}

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

tbody tr:nth-child(even) {
  background: var(--surface-2);
}

tbody tr:hover {
  background: var(--primary-soft);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.6;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-aktif {
  background: var(--success-soft);
  color: var(--success);
}

.status-nonaktif {
  background: var(--danger-soft);
  color: var(--danger);
}

.jenis-setor {
  background: var(--success-soft);
  color: var(--success);
}

.jenis-tarik {
  background: var(--danger-soft);
  color: var(--danger);
}

.action-btn {
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  margin-right: var(--space-1);
  color: #fff;
}

.action-btn.edit {
  background: var(--warning);
}

.action-btn.edit:hover {
  background: #b45309;
}

.action-btn.delete {
  background: var(--danger);
}

.action-btn.delete:hover {
  background: #b91c1c;
}

/* Empty & loading states */
.state-cell {
  text-align: center;
  padding: var(--space-6) var(--space-4) !important;
  color: var(--text-muted);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
}

.empty-state svg {
  opacity: 0.5;
}

.empty-state strong {
  color: var(--text);
  font-weight: 600;
}

.skeleton-bar {
  height: 12px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 37%, var(--gray-100) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}

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

/* Saldo */
.saldo-form {
  display: flex;
  gap: var(--space-3);
  align-items: flex-end;
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.saldo-form-field {
  flex: 1;
  min-width: 220px;
}

.saldo-form-field label {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: 500;
  font-size: 0.9rem;
}

.saldo-form button {
  white-space: nowrap;
}

.saldo-card {
  background: linear-gradient(135deg, var(--primary), var(--indigo));
  color: #fff;
  padding: var(--space-5);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.saldo-card h3 {
  font-size: 1.3rem;
  margin-bottom: var(--space-1);
}

.saldo-id {
  opacity: 0.85;
  margin-bottom: var(--space-5);
  font-size: 0.9rem;
}

.saldo-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}

.saldo-item {
  padding: var(--space-4);
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
  text-align: center;
  backdrop-filter: blur(2px);
}

.saldo-item span {
  display: block;
  font-size: 0.82rem;
  opacity: 0.9;
  margin-bottom: var(--space-2);
}

.saldo-item strong {
  font-size: 1.25rem;
}

.saldo-utama {
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary-dark);
  border-color: transparent;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: var(--space-4);
  animation: overlay-in var(--transition);
}

@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 480px;
  width: 100%;
  max-height: calc(100vh - (var(--space-4) * 2));
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: var(--space-5);
  animation: modal-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.modal-header h2 {
  font-size: 1.2rem;
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}

.modal-close:hover {
  background: var(--surface-2);
  color: var(--text);
}

.modal-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
  margin-top: var(--space-5);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dash-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dash-charts-grid {
    grid-template-columns: 1fr;
  }
  .dash-bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .dash-hero {
    flex-direction: column;
    align-items: flex-start;
    padding: var(--space-5);
  }

  .dash-hero-actions {
    width: 100%;
    margin-top: var(--space-3);
  }

  .dash-hero-actions button {
    flex: 1;
    justify-content: center;
  }

  .dash-kpi-grid {
    grid-template-columns: 1fr;
  }

  .dash-today-banner {
    flex-direction: column;
    gap: var(--space-3);
    align-items: stretch;
  }

  .dash-today-divider {
    width: 100%;
    height: 1px;
  }
  .hero .container {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-content h1 { font-size: 2.5rem; }
  .hero-content p { margin: 0 auto var(--space-6); }
  .hero-actions { justify-content: center; }
  .hero-image { display: none; }

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

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform var(--transition);
    box-shadow: var(--shadow-lg);
  }

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

  .dashboard-shell.sidebar-open .sidebar-overlay {
    display: block;
  }

  #sidebar-toggle {
    display: inline-flex;
  }

  .content {
    padding: var(--space-4);
  }

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

  .toolbar {
    align-items: stretch;
  }

  .toolbar-actions {
    width: 100%;
  }

  .search-box {
    flex: 1;
  }

  .search-box input {
    width: 100%;
  }

  .saldo-details {
    grid-template-columns: 1fr;
  }

  .saldo-form {
    flex-direction: column;
    align-items: stretch;
  }

  .saldo-form button {
    width: 100%;
  }

  .user-chip span:not(.user-avatar) {
    display: none;
  }

  .btn-ghost span {
    display: none;
  }
}

/* Pagination */
.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-5);
  flex-wrap: wrap;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  text-decoration: none;
  cursor: pointer;
}

.page-link:hover:not(.disabled):not(.active) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.page-link.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.page-link.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-dots {
  color: var(--text-muted);
  padding: 0 var(--space-1);
}

/* Public Saldo Result */
.pub-saldo-result {
  margin-top: 2rem;
}

.pub-saldo-card {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.pub-nama {
  color: var(--primary);
}

.pub-id-display {
  color: var(--text-muted);
}

.pub-saldo-details {
  grid-template-columns: 1fr;
  gap: 1rem;
}

.pub-saldo-item {
  background: var(--gray-50);
  border-color: var(--border);
  color: var(--text);
}

.pub-saldo-item span {
  color: var(--text-muted);
}

.pub-saldo-amount {
  font-size: 1.8rem;
  color: var(--success);
}

.pub-back-btn {
  margin-top: 1.5rem;
}

/* Public Riwayat Transaksi */
.pub-riwayat-section {
  margin-top: 1.5rem;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.pub-riwayat-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
}

.pub-riwayat-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  transition: background var(--transition, 0.2s);
}

.pub-riwayat-item:hover {
  background: var(--gray-100);
}

.pub-riwayat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.pub-riwayat-row + .pub-riwayat-row {
  margin-top: 0.25rem;
}

.pub-riwayat-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pub-riwayat-amount {
  font-weight: 600;
  font-size: 0.95rem;
}

.pub-riwayat-amount.amount-setor {
  color: var(--success);
}

.pub-riwayat-amount.amount-tarik {
  color: var(--danger);
}

.pub-riwayat-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  font-style: italic;
}

.pub-riwayat-empty,
.pub-riwayat-loading {
  text-align: center;
  color: var(--text-muted);
  padding: 1.5rem 0;
  font-size: 0.9rem;
}

/* Dark mode overrides for public riwayat */
[data-theme="dark"] .pub-riwayat-item {
  background: var(--surface-2);
  border-color: var(--border);
}

[data-theme="dark"] .pub-riwayat-item:hover {
  background: var(--gray-100);
}

[data-theme="dark"] .pub-saldo-item {
  background: var(--gray-50);
  border-color: var(--border);
}

@media (max-width: 600px) {
  .pub-riwayat-item {
    padding: 0.625rem 0.75rem;
  }

  .pub-riwayat-amount {
    font-size: 0.875rem;
  }

  .pub-saldo-amount {
    font-size: 1.5rem;
  }
}
