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

:root {
  --teal: #1a9e9e;
  --teal-dark: #147a7a;
  --teal-light: #e6f7f7;
  --teal-mid: #b2e5e5;
  --navy: #1a2b3c;
  --navy-mid: #2d4156;
  --text: #1e293b;
  --text-mid: #475569;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --bg: #f1f5f9;
  --white: #ffffff;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --success: #059669;
  --success-light: #ecfdf5;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --info-light: #eff6ff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.12);
  --radius: 8px;
  --radius-sm: 5px;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
}

body { background: var(--bg); color: var(--text); min-height: 100vh; }

/* ─── TOP BAR ─── */
.topbar {
  background: var(--navy);
  color: white;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-logo {
  width: 32px; height: 32px;
  background: var(--teal);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.topbar-title { font-size: 14px; font-weight: 600; letter-spacing: .01em; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.icon-btn {
  position: relative; background: none; border: none; color: #94a3b8;
  cursor: pointer; padding: 6px; border-radius: 6px; display: flex;
  transition: color .2s, background .2s;
}
.icon-btn:hover { color: white; background: rgba(255,255,255,.1); }
.notif-dot {
  position: absolute; top: 5px; right: 5px;
  width: 7px; height: 7px; background: #ef4444; border-radius: 50%;
  border: 2px solid var(--navy);
}
.user-avatar {
  width: 30px; height: 30px; background: var(--teal);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white;
}
.user-name { font-size: 13px; color: #cbd5e1; }

/* ─── NAVBAR ─── */
.navbar {
  background: var(--teal);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 16px;
  position: sticky;
  top: 52px;
  z-index: 99;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.nav-btn {
  background: none; border: none; color: rgba(255,255,255,.85);
  padding: 0 18px; height: 46px;
  display: flex; align-items: center; gap: 8px;
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; border-bottom: 3px solid transparent;
  transition: all .18s; white-space: nowrap;
}
.nav-btn:hover { color: white; background: rgba(255,255,255,.1); }
.nav-btn.active { color: white; border-bottom-color: white; font-weight: 600; }

/* ─── MAIN CONTENT ─── */
.main-content { padding: 24px; max-width: 1600px; margin: 0 auto; }

.page { display: none; }
.page.active { display: block; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ─── PAGE HEADER ─── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.page-header h2 { font-size: 22px; font-weight: 700; color: var(--navy); }
.page-subtitle { font-size: 13px; color: var(--text-mid); margin-top: 2px; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

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

/* ─── HOME GRID ─── */
.home-grid { display: flex; flex-direction: column; gap: 20px; }
.home-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.home-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}
.home-panel-header h3 { font-size: 15px; font-weight: 600; color: var(--navy); }

/* ─── TABLES ─── */
.table-wrapper { overflow-x: auto; }
.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: #f8fafc;
  color: var(--text-mid);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fafbfc; }
.data-table tbody tr.selected { background: var(--teal-light) !important; }

.table-footer {
  padding: 10px 16px;
  font-size: 12px;
  color: var(--text-light);
  border-top: 1px solid var(--border);
  background: #fafbfc;
}

.empty-row td {
  text-align: center;
  padding: 32px;
  color: var(--text-light);
  font-style: italic;
}

/* ─── BULK TOOLBAR ─── */
.bulk-toolbar {
  padding: 10px 16px;
  background: var(--teal-light);
  border-bottom: 1px solid var(--teal-mid);
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 500; color: var(--teal-dark);
}

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border: none; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .18s; white-space: nowrap;
  text-decoration: none;
}
.btn-primary { background: var(--teal); color: white; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-secondary { background: white; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-ghost { background: none; color: var(--text-mid); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-outline-teal { background: none; color: var(--teal); border: 1px solid var(--teal); }
.btn-outline-teal:hover { background: var(--teal-light); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* Inline table action buttons */
.act-btn {
  padding: 4px 10px; border-radius: 4px; font-size: 12px; font-weight: 500;
  border: 1px solid; cursor: pointer; transition: all .15s; white-space: nowrap;
  font-family: inherit;
}
.act-btn.view { border-color: var(--teal); color: var(--teal); background: white; }
.act-btn.view:hover { background: var(--teal-light); }
.act-btn.approve { border-color: var(--success); color: var(--success); background: white; }
.act-btn.approve:hover { background: var(--success-light); }
.act-btn.reject { border-color: var(--danger); color: var(--danger); background: white; }
.act-btn.reject:hover { background: var(--danger-light); }
.act-btn.submit { border-color: var(--teal); color: white; background: var(--teal); }
.act-btn.submit:hover { background: var(--teal-dark); }
.act-btn:disabled { opacity: .3; cursor: not-allowed; }

/* ─── STATUS BADGES ─── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-draft { background: #f1f5f9; color: #64748b; }
.badge-submitted { background: var(--info-light); color: #2563eb; }
.badge-approved { background: var(--success-light); color: var(--success); }
.badge-rejected { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }

/* ─── SEARCH & FILTER ─── */
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0 12px;
  color: var(--text-light);
}
.search-box input {
  border: none; outline: none; background: none;
  font-family: inherit; font-size: 13px; padding: 7px 0;
  color: var(--text); width: 200px;
}
.filter-select {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 7px 12px; font-family: inherit; font-size: 13px;
  background: white; color: var(--text); outline: none; cursor: pointer;
}
.filter-select:focus { border-color: var(--teal); }

/* ─── FORMS ─── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--text-mid); }
.form-group input, .form-group select, .form-group textarea {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 11px; font-family: inherit; font-size: 13px; color: var(--text);
  outline: none; background: white; transition: border-color .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--teal); box-shadow: 0 0 0 3px rgba(26,158,158,.1);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--teal); padding: 12px 0 8px;
  border-top: 1px solid var(--border); margin-top: 4px;
}
.form-section-label:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.req { color: var(--danger); }

/* ─── MODALS ─── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,25,40,.45);
  display: none; align-items: center; justify-content: center;
  z-index: 200; backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 560px; max-width: calc(100vw - 32px);
  max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
  animation: slideUp .22s ease;
}
.modal-lg { width: 780px; }
.modal-sm { width: 420px; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--navy); }
.modal-close {
  background: none; border: none; font-size: 22px; color: var(--text-light);
  cursor: pointer; line-height: 1; padding: 2px 6px; border-radius: 4px;
  transition: color .15s, background .15s;
}
.modal-close:hover { color: var(--text); background: var(--bg); }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  background: #fafbfc;
}

/* ─── SIDE PANEL ─── */
.panel-overlay {
  position: fixed; inset: 0;
  background: rgba(15,25,40,.3);
  display: none; z-index: 199;
}
.panel-overlay.open { display: block; }
.side-panel {
  position: fixed; right: -480px; top: 0; bottom: 0;
  width: 460px; max-width: 100vw;
  background: white; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  z-index: 200; transition: right .28s cubic-bezier(.4,0,.2,1);
}
.side-panel.open { right: 0; }
.side-panel-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}
.side-panel-header h3 { font-size: 16px; font-weight: 700; color: var(--navy); }
.bulk-hint { font-size: 12px; color: var(--text-mid); margin-top: 3px; }
.side-panel-body { padding: 20px 22px; flex: 1; overflow-y: auto; }
.side-panel-footer {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px; background: #fafbfc;
}

/* ─── DROPDOWN SETTINGS ─── */
.dropdown-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.dropdown-card {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow-sm);
}
.dropdown-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.dropdown-card-title { font-size: 13px; font-weight: 700; color: var(--navy); text-transform: uppercase; letter-spacing: .04em; }
.dropdown-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; border-radius: 4px;
  font-size: 13px; color: var(--text);
  transition: background .15s;
}
.dropdown-item:hover { background: var(--bg); }
.dropdown-item-del {
  background: none; border: none; color: var(--text-light);
  cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px;
  border-radius: 3px; transition: color .15s, background .15s;
}
.dropdown-item-del:hover { color: var(--danger); background: var(--danger-light); }
.dropdown-add-form {
  display: flex; gap: 8px; margin-top: 10px; padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.dropdown-add-form input {
  flex: 1; border: 1px solid var(--border); border-radius: 4px;
  padding: 6px 10px; font-size: 12px; font-family: inherit; outline: none;
}
.dropdown-add-form input:focus { border-color: var(--teal); }
.dropdown-add-form button {
  background: var(--teal); color: white; border: none;
  border-radius: 4px; padding: 6px 12px; font-size: 12px;
  cursor: pointer; font-family: inherit; font-weight: 500;
  transition: background .15s;
}
.dropdown-add-form button:hover { background: var(--teal-dark); }

/* ─── REPORTS ─── */
.stats-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.stat-card {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-mid); margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--navy); font-family: 'IBM Plex Mono', monospace; }
.stat-sub { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.reports-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.report-card { padding: 20px; }
.report-card-title { font-size: 14px; font-weight: 700; color: var(--navy); margin-bottom: 16px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.bar-label { width: 150px; color: var(--text-mid); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.bar-track { flex: 1; background: var(--bg); border-radius: 20px; height: 8px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 20px; background: var(--teal); transition: width .5s ease; }
.bar-val { min-width: 40px; text-align: right; font-size: 12px; color: var(--text-mid); font-family: 'IBM Plex Mono', monospace; }

/* ─── ACTIVITY DETAIL ─── */
.detail-back { margin-bottom: 16px; }
.detail-card {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  margin-bottom: 16px; overflow: hidden;
}
.detail-section-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--teal);
  padding: 14px 22px 12px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}
.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0;
}
.detail-row {
  display: contents;
}
.detail-row .detail-key, .detail-row .detail-val {
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
}
.detail-key { font-size: 13px; color: var(--text-mid); font-weight: 500; }
.detail-val { font-size: 13px; color: var(--text); }
.detail-val a { color: var(--teal); text-decoration: none; }
.detail-val a:hover { text-decoration: underline; }
.detail-actions {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; background: #fafbfc; flex-wrap: wrap;
}

/* ─── TOAST ─── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--navy); color: white;
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 999; opacity: 0; transform: translateY(10px);
  transition: all .22s;
  max-width: 320px;
}
.toast.show { opacity: 1; transform: none; }
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--teal); }

/* ─── MISC ─── */
.mono { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--text-light); }
.id-cell { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--text-light); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 768px) {
  .main-content { padding: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: 1; }
  .reports-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-actions { width: 100%; flex-wrap: wrap; }
}

@media print {
  .topbar, .navbar, .page-actions, .bulk-toolbar, .detail-back,
  .btn, .act-btn, .modal-overlay, .side-panel, .panel-overlay, .toast { display: none !important; }
  .main-content { padding: 0; }
  .card, .detail-card { box-shadow: none; border: 1px solid #ccc; }
}
