:root {
  --primary: #0f172a;
  --primary-light: #1e293b;
  --accent: #0ea5e9;
  --accent-hover: #0284c7;
  --emerald: #10b981;
  --emerald-dark: #059669;
  --amber: #f59e0b;
  --rose: #ef4444;
  --rose-dark: #dc2626;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  font-family: var(--font);
  background-color: var(--slate-100);
  color: var(--slate-800);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* App Container */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: white;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  z-index: 20;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #0ea5e9 0%, #3b82f6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
}

.brand-text h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #fff;
}

.brand-text span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
  font-weight: 600;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--slate-400);
  padding: 8px 12px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: var(--slate-300);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.nav-item.active {
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.2) 0%, rgba(14, 165, 233, 0.05) 100%);
  color: #38bdf8;
  border-left: 3px solid #0ea5e9;
  font-weight: 600;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-item-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.counter-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  background: var(--slate-700);
  color: #fff;
}

.counter-badge.amber {
  background: #f59e0b;
  color: #000;
}

.counter-badge.rose {
  background: #ef4444;
  color: #fff;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.admin-info {
  line-height: 1.2;
}

.admin-name {
  font-size: 13px;
  font-weight: 600;
  color: white;
}

.admin-role {
  font-size: 11px;
  color: var(--emerald);
}

.btn-logout {
  background: none;
  border: none;
  color: var(--slate-400);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: 68px;
  background: white;
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 10;
}

.topbar-title h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--slate-900);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.api-status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 9999px;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.4);
}

/* Content Views */
.content-body {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

/* KPI Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  transition: transform 0.2s, box-shadow 0.2s;
}

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

.kpi-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-500);
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--slate-900);
  line-height: 1;
}

.kpi-sub {
  font-size: 12px;
  color: var(--slate-400);
  margin-top: 6px;
}

.kpi-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.kpi-icon-wrap.blue { background: #e0f2fe; color: #0284c7; }
.kpi-icon-wrap.pink { background: #fce7f3; color: #db2777; }
.kpi-icon-wrap.emerald { background: #d1fae5; color: #059669; }
.kpi-icon-wrap.amber { background: #fef3c7; color: #d97706; }
.kpi-icon-wrap.purple { background: #f3e8ff; color: #7e22ce; }
.kpi-icon-wrap.rose { background: #ffe4e6; color: #e11d48; }

/* Action Banner */
.safety-banner {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  color: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
}

.safety-banner-content h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.safety-banner-content p {
  font-size: 13px;
  color: #c7d2fe;
}

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.filter-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.filter-btn {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--slate-300);
  background: white;
  font-size: 13px;
  font-weight: 500;
  color: var(--slate-700);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn:hover {
  background: var(--slate-100);
}

.filter-btn.active {
  background: var(--slate-900);
  color: white;
  border-color: var(--slate-900);
}

.search-input {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--slate-300);
  font-size: 13px;
  width: 240px;
  outline: none;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

/* Card Tables */
.card-table-wrap {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  background: var(--slate-50);
  color: var(--slate-600);
  font-weight: 600;
  padding: 14px 18px;
  border-bottom: 1px solid var(--slate-200);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--slate-200);
  color: var(--slate-700);
  vertical-align: middle;
}

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

.data-table tr:hover td {
  background: #f8fafc;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-pending {
  background: #fef3c7;
  color: #b45309;
}

.badge-approved {
  background: #d1fae5;
  color: #047857;
}

.badge-rejected {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-active {
  background: #e0f2fe;
  color: #0369a1;
}

.badge-blocked {
  background: #fee2e2;
  color: #991b1b;
}

/* Action Buttons */
.btn-action-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-sm {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn-approve {
  background: var(--emerald);
  color: white;
}

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

.btn-reject {
  background: var(--rose);
  color: white;
}

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

.btn-secondary {
  background: var(--slate-100);
  color: var(--slate-700);
  border: 1px solid var(--slate-300);
}

.btn-secondary:hover {
  background: var(--slate-200);
}

.btn-block {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.btn-block:hover {
  background: #fee2e2;
}

.btn-unblock {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.btn-unblock:hover {
  background: #d1fae5;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

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

.modal-box {
  background: white;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 520px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--slate-900);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--slate-400);
  cursor: pointer;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  background: var(--slate-50);
  border-top: 1px solid var(--slate-200);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Login Modal */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

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

.login-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
}

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

.login-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--slate-900);
}

.login-header p {
  font-size: 13px;
  color: var(--slate-500);
  margin-top: 4px;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--slate-300);
  font-size: 14px;
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

.btn-primary {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: white;
  border: none;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

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

/* Toast System */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--slate-900);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast.success { border-left: 4px solid var(--emerald); }
.toast.error { border-left: 4px solid var(--rose); }
.toast.info { border-left: 4px solid var(--accent); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--slate-400);
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.empty-state h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--slate-700);
}

.empty-state p {
  font-size: 13px;
  margin-top: 4px;
}

/* Table Pagination Footer */
.table-pagination-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: #f8fafc;
  border-top: 1px solid var(--slate-200);
  font-size: 13px;
  color: var(--slate-600);
}

.pagination-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-page {
  padding: 6px 12px;
  border: 1px solid var(--slate-200);
  background: white;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--slate-700);
  transition: all 0.2s;
}

.btn-page:hover:not(:disabled) {
  background: var(--slate-100);
  border-color: var(--slate-300);
}

.btn-page:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Document Previews */
.doc-preview-item {
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 12px;
  background: white;
  text-align: center;
  flex: 1;
  min-width: 140px;
}

.doc-preview-thumb {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 6px;
  border: 1px solid var(--slate-100);
}

.doc-link-btn {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

