:root {
  --bg: #f0f2f6;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #d1d9e6;
  --brand: #0f766e;
  --brand-light: #d1fae5;
  --brand-2: #1d4ed8;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --ok: #15803d;
  --ok-light: #dcfce7;
  --warn: #d97706;
  --warn-light: #fef3c7;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.1), 0 4px 10px rgba(0,0,0,.06);
  --sheet-radius: 20px;
  --nav-height: 64px;
  --radius: 10px;
  --radius-sm: 8px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { transition: none; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background .35s ease, color .35s ease;
  padding-top: var(--safe-top);
}
body, .sidebar, .shell, .topbar, .bottom-nav, .btn, .icon-btn,
table, input, select, textarea, .sheet, .badge, .tab-list, .filters,
.filter-group, .form-grid, .member-card, .feed-item, .profile-menu,
.metrics, .tile, .tile-grid, .alert, .modal-card, .lock-card, .card-list {
  transition: background .35s ease, color .35s ease, border-color .35s ease, box-shadow .35s ease;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ============ SIDEBAR (Desktop) ============ */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 100;
  background: linear-gradient(180deg, #0b1220 0%, #141d2f 100%);
  color: #c8d2e0; padding: 16px 12px 40px; overflow-y: auto; scrollbar-width: none;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  -webkit-overflow-scrolling: touch;
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar.open { transform: translateX(0); }
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 17px; margin-bottom: 20px; color: #fff; padding: 0 6px;
}
.brand img { width: 38px; height: 38px; object-fit: contain; border-radius: 6px; }
.sidebar nav { display: flex; flex-direction: column; gap: 1px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 10px;
  border-radius: var(--radius-sm); color: #c8d2e0; font-size: 13px;
  transition: all .15s;
}
.sidebar nav a:hover, .sidebar nav a.active { background: rgba(255,255,255,.08); color: #fff; }
.sidebar nav a svg, .sidebar nav a i { width: 18px; flex-shrink: 0; }
.nav-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  color: #6b7a94; margin: 14px 8px 4px; letter-spacing: .6px;
}

/* ============ MAIN SHELL ============ */
.shell { margin-left: 260px; min-height: 100vh; padding: 20px 24px 100px; }

/* ============ TOPBAR ============ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; gap: 12px;
}
.topbar .eyebrow { margin: 0; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.topbar h1 { margin: 2px 0 0; font-size: 22px; font-weight: 700; letter-spacing: -.3px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.top-actions span { font-size: 13px; color: var(--muted); }
.hamburger, .back-btn { display: none; border: none; background: none; padding: 6px; cursor: pointer; border-radius: 10px; color: var(--muted); }
.hamburger svg, .back-btn svg { width: 22px; height: 22px; color: var(--text); }
.back-btn:active { background: var(--brand-light); }

/* ============ BUTTONS ============ */
.btn, .icon-btn, button, input[type=submit] {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: var(--radius-sm); padding: 10px 16px; font-size: 13px;
  font-weight: 600; cursor: pointer; transition: all .15s;
  line-height: 1.4; font-family: inherit; touch-action: manipulation;
}
.btn:hover { background: #f3f4f6; border-color: #b0bcca; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #0d6b63; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.icon-btn { width: 38px; height: 38px; padding: 0; border-radius: 10px; }
.icon-btn svg { width: 18px; }
.btn-xs { padding: 4px 8px; font-size: 11px; height: 28px; gap: 4px; }
.btn-xs svg { width: 12px; height: 12px; }
.btn-sm { padding: 6px 12px; font-size: 12px; height: 32px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-success:hover { background: #166534; border-color: #166534; }
.btn-primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn-primary:hover { background: #1e3a8a; border-color: #1e3a8a; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.danger { color: var(--danger); }
.danger:hover { color: #b91c1c; }
.muted-link { color: var(--muted); font-size: 12px; text-align: center; display: block; margin-top: 10px; }
.form-control.input-sm { height: 28px; font-size: 11px; padding: 0 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }

/* ============ BOTTOM NAV (Mobile) ============ */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 99;
  background: #fff; border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + var(--safe-bottom));
  box-shadow: 0 -2px 10px rgba(0,0,0,.06);
}
.bottom-nav-inner { display: flex; overflow-x: auto; gap: 2px; }
.back-nav-btn { color: var(--muted) !important; }
.back-nav-btn svg { stroke-width: 2.5 !important; }
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 10px; border-radius: var(--radius-sm); font-size: 9px;
  font-weight: 600; color: var(--muted); white-space: nowrap; min-width: 56px;
  transition: all .15s; flex-shrink: 0;
}
.bottom-nav a svg { width: 20px; height: 20px; }
.bottom-nav a.active { color: var(--brand); }
.bottom-nav a:active { background: var(--brand-light); }

/* ============ OVERLAY ============ */
.overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.45);
  opacity: 0; pointer-events: none; transition: opacity .3s ease;
}
.overlay.show { opacity: 1; pointer-events: auto; }

/* ============ BOTTOM SHEET ============ */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 300;
  background: #fff; border-radius: var(--sheet-radius) var(--sheet-radius) 0 0;
  box-shadow: 0 -8px 30px rgba(0,0,0,.15);
  transform: translateY(100%); transition: transform .35s cubic-bezier(.32,.72,0,1);
  max-height: 98vh; display: flex; flex-direction: column;
  will-change: transform;
}
.sheet.open { transform: translateY(0); }
.sheet-handle {
  display: flex; justify-content: center; padding: 10px 0 4px;
  cursor: grab; touch-action: none; flex-shrink: 0;
}
.sheet-handle:active { cursor: grabbing; }
.sheet-handle span {
  display: block; width: 36px; height: 4px; border-radius: 2px;
  background: #d1d5db; transition: background .2s;
}
.sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 20px 12px; flex-shrink: 0;
}
.sheet-header h2 { margin: 0; font-size: 17px; font-weight: 700; }
.sheet-close {
  border: none; background: none; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; cursor: pointer; color: var(--muted);
}
.sheet-close:hover { background: #f3f4f6; }
.sheet-body {
  padding: 0 20px 28px; overflow-y: auto; -webkit-overflow-scrolling: touch;
  flex: 1 1 auto; min-height: 0;
}
.sheet-body .form-grid { grid-template-columns: 1fr; gap: 12px; }
.sheet-body .form-grid .span-2 { grid-column: auto; }
.sheet-body label { font-size: 12px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.sheet-body input, .sheet-body select, .sheet-body textarea {
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 15px; font-family: inherit; background: #f9fafb; color: var(--text);
  transition: all .15s; -webkit-appearance: none;
}
.sheet-body input:focus, .sheet-body select:focus, .sheet-body textarea:focus {
  outline: none; border-color: var(--brand); background: #fff;
  box-shadow: 0 0 0 3px rgba(15,118,110,.12);
}
.sheet-body textarea { min-height: 70px; resize: vertical; }
.sheet-body .btn { padding: 14px; font-size: 15px; border-radius: var(--radius-sm); }
.sheet-body .span-2 { grid-column: 1 / -1; }

/* ============ ALERTS ============ */
.alert {
  padding: 12px 16px; border-radius: var(--radius); margin-bottom: 14px;
  font-size: 13px; line-height: 1.5; display: flex; align-items: center; gap: 8px;
}
.alert.success { background: var(--ok-light); color: #14532d; border: 1px solid #bbf7d0; }
.alert.error { background: var(--danger-light); color: #7f1d1d; border: 1px solid #fecaca; }

/* ============ METRICS CARDS ============ */
.metrics {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 18px;
}
.metrics div {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.metrics div b { display: block; font-size: 20px; font-weight: 800; }
.metrics div span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

/* ============ PANEL ============ */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 18px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-group select { padding: 6px 10px; border-radius: var(--radius); border: 1px solid var(--line); font-size: 12px; }
.panel h2 { margin: 0; font-size: 16px; font-weight: 700; }
.panel.compact { padding: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel.compact form { margin: 0; }

/* ============ TILE GRID ============ */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); transition: box-shadow .15s;
}
.tile h3 { margin: 0 0 4px; font-size: 13px; font-weight: 700; }
.tile p { margin: 0 0 6px; font-size: 12px; color: #374151; line-height: 1.5; }
.tile small { color: var(--muted); font-size: 11px; }
.tile form { margin-top: 6px; }

/* ============ TABLE / CARD LIST ============ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
table th {
  background: #f8fafc; text-align: left; padding: 10px 12px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  color: var(--muted); letter-spacing: .4px; border-bottom: 2px solid var(--line);
}
table td { padding: 10px 12px; border-bottom: 1px solid #eef2f6; vertical-align: middle; }
table tr:hover td { background: #f9fafb; }
.actions { display: flex; gap: 6px; align-items: center; white-space: nowrap; flex-wrap: wrap; }
.actions form { display: inline; }

/* Mobile card list */
.card-list { display: none; gap: 10px; flex-direction: column; }
.card-item {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); position: relative;
}
.card-item .row { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; font-size: 13px; }
.card-item .row .lbl { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }
.card-item .row .val { font-weight: 600; text-align: right; }
.card-item .actions { margin-top: 8px; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 8px; }

/* ============ BADGES ============ */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 10px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  background: #e5e7eb; color: #374151;
}
.status-active { background: var(--ok-light); color: var(--ok); }
.status-pending { background: var(--warn-light); color: var(--warn); }
.status-rejected { background: var(--danger-light); color: var(--danger); }

/* ============ FORM GRID ============ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 600; color: var(--muted); }
.form-grid input, .form-grid select, .form-grid textarea {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
  transition: border-color .15s;
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15,118,110,.12);
}
.form-grid select[multiple] { min-height: 100px; }

/* ============ FILTERS ============ */
.filters { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; margin-bottom: 14px; }
.filters select, .filters input {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 13px; background: #fff; -webkit-appearance: none;
}

/* ============ TABS ============ */
.tabs { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.tab-list {
  display: flex; border-bottom: 1px solid var(--line); overflow-x: auto;
  background: #f8fafc; -webkit-overflow-scrolling: touch;
}
.tab-list button {
  padding: 12px 18px; border: none; background: transparent; font-size: 12px;
  font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .15s;
  flex-shrink: 0; touch-action: manipulation;
}
.tab-list button.active { color: var(--brand); border-bottom-color: var(--brand); background: #fff; }
.tab-panel { display: none; padding: 14px; }
.tab-panel.active { display: block; }


/* Swipeable tabs container */
.swipe-container { overflow: hidden; position: relative; }
.swipe-track { display: flex; transition: transform .3s cubic-bezier(.4,0,.2,1); }
.swipe-track .tab-panel { min-width: 100%; display: block; padding: 14px; box-sizing: border-box; }

/* Collapsible forms */
.panel.form-grid:not([style*="display: none"]) { animation: slideDown .25s ease; }
@keyframes slideDown { from { opacity: 0; max-height: 0; } to { opacity: 1; max-height: 600px; } }

/* ============ AUTH PAGES ============ */
.auth-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0b1220 0%, #1a2744 100%);
  padding: calc(20px + var(--safe-top)) 20px 20px;
}
.auth-card {
  background: #fff; border-radius: 16px; padding: 32px 28px 24px;
  width: 100%; max-width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.auth-card img { display: block; width: 48px; margin: 0 auto 10px; }
.auth-card h1 { text-align: center; font-size: 20px; margin: 0 0 18px; }
.auth-card label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
.auth-card input {
  padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 15px; font-family: inherit; background: #f9fafb;
}
.auth-card input:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(15,118,110,.12); }
.auth-card .btn { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }
.auth-card .alert { margin-bottom: 12px; }

/* ============ INLINE EDIT ============ */
.editable-cell { cursor: pointer; position: relative; }
.editable-cell:hover { background: #fff7ed; }
.editable-cell i[data-lucide="pencil"] { opacity: .6 !important; }
.inline-edit { padding: 4px 6px; border: 1px solid var(--brand); border-radius: 4px; font-size: 13px; width: auto; min-width: 60px; background: #fff; }

/* ============ EMPTY ============ */
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 24px 16px; }

/* ============ NOTIFICATION TOAST ============ */
.notif-toast {
  position: fixed; top: 16px; right: 16px; z-index: 500;
  display: flex; align-items: flex-start; gap: 10px;
  background: #1e293b; color: #fff; border-radius: 12px;
  padding: 14px 16px; max-width: 360px; width: 100%;
  box-shadow: 0 8px 30px rgba(0,0,0,.3);
  animation: toastIn .35s cubic-bezier(.32,.72,0,1);
}
.notif-toast-icon { flex-shrink: 0; }
.notif-toast-icon svg { width: 20px; height: 20px; color: #60a5fa; }
.notif-toast-body { flex: 1; min-width: 0; }
.notif-toast-body strong { display: block; font-size: 13px; margin-bottom: 2px; }
.notif-toast-body p { margin: 0; font-size: 12px; color: #cbd5e1; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif-toast-close { border: none; background: none; color: #94a3b8; font-size: 18px; cursor: pointer; padding: 0; line-height: 1; flex-shrink: 0; }
.notif-toast-close:hover { color: #fff; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-20px) scale(.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 480px) {
  .notif-toast { left: 12px; right: 12px; top: 12px; max-width: none; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  .shell { padding: 16px; }
  .metrics { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); padding-top: calc(16px + var(--safe-top)); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.2); }
   .hamburger { display: flex; align-items: center; }
   .back-btn { display: inline-flex; align-items: center; }
  .shell { margin-left: 0; padding-top: calc(12px + var(--safe-top)); padding-right: 12px; padding-left: 12px; padding-bottom: calc(var(--nav-height) + 16px); }
  .topbar { margin-bottom: 14px; }
  .topbar h1 { font-size: 18px; }
  .top-actions span { display: none; }

  .bottom-nav { display: block; }
  .table-wrap { display: none; }
  .card-list { display: flex; }
  .card-list + .table-wrap { display: none; }

  .metrics { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metrics div { padding: 12px; }
  .metrics div b { font-size: 17px; }

  .tile-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .tab-list button { padding: 10px 12px; font-size: 11px; }

  .auth-card { padding: 24px 20px 20px; }
}

@media (max-width: 480px) {
  .shell { padding: 10px 8px; }
  .metrics div b { font-size: 15px; }
  .panel { padding: 14px; }
}

/* iOS-safe scroll: html clips, body scrolls */
html { height: 100%; overflow: hidden; }
body { width: 100%; height: 100%; overflow-y: auto; overflow-x: clip; -webkit-overflow-scrolling: touch; }
.shell, .sidebar, .bottom-nav, .card-list, .card-item, .panel, .form-grid { max-width: 100%; }
.bottom-nav-inner { overflow-x: hidden; flex-wrap: wrap; justify-content: center; }
.bottom-nav-inner a { min-width: auto; flex-shrink: 1; padding: 6px 8px; }

/* Searchable select enhancement */
.searchable-select + input[type="text"] { margin-bottom: 6px !important; }
.searchable-select { min-height: 100px; }
.searchable-select option { padding: 6px 8px; }

/* Card actions on mobile - ensure buttons don't overflow */
.card-item .actions { flex-wrap: wrap; gap: 4px; }
.card-item .actions .btn-xs { font-size: 10px; padding: 3px 6px; height: auto; min-height: 26px; }

/* ============ LOCK SCREEN ============ */
.lock-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(11, 18, 32, 0.95);
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.lock-card {
    background: #fff; border-radius: 20px; padding: 36px 28px 28px;
    width: 90%; max-width: 340px; text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
    animation: lockIn .35s cubic-bezier(.32,.72,0,1);
}
.lock-card img { width: 72px; margin-bottom: 12px; }
.lock-card h2 { margin: 0 0 4px; font-size: 20px; font-weight: 700; }
.lock-card p { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.lock-card input {
    width: 100%; padding: 12px 16px; border: 2px solid var(--line);
    border-radius: 12px; font-size: 18px; text-align: center;
    letter-spacing: 8px; font-family: inherit; margin-bottom: 14px;
    outline: none; transition: border-color .15s; box-sizing: border-box;
}
.lock-card input:focus { border-color: var(--brand); }
.lock-card .btn { width: 100%; padding: 14px; font-size: 15px; border-radius: 12px; margin-bottom: 8px; }
.lock-card .lock-logout-btn { background: none; border: 1px solid var(--line); color: var(--muted); }
.lock-card .lock-logout-btn:hover { background: #f3f4f6; }
.lock-error { color: var(--danger); font-size: 13px; margin-bottom: 10px; font-weight: 600; }
@keyframes lockIn {
    from { opacity: 0; transform: scale(.9) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ============ CUSTOM CONFIRM MODAL ============ */
.modal-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,.55);
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    animation: fadeIn .2s ease;
}
.modal-card {
    background: #fff; border-radius: 20px; padding: 28px 24px 20px;
    width: 90%; max-width: 320px; text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    animation: lockIn .3s cubic-bezier(.32,.72,0,1);
}
.modal-card h3 { margin: 0 0 8px; font-size: 18px; font-weight: 700; }
.modal-card p { margin: 0 0 24px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; padding: 12px; font-size: 14px; border-radius: 12px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ============ NAV DROPDOWN ============ */
.nav-dropdown { display: none; }
.nav-dropdown.show { display: block !important; }
.nav-dropdown-toggle { cursor: pointer; }
.nav-dropdown-toggle:hover { background: rgba(255,255,255,.05); }

/* ============ SHEET SCROLL FIX ============ */
.sheet-body { max-height: calc(100vh - 120px); padding-bottom: 32px; }

/* ============ EXTRA BOTTOM SPACING FOR FORMS ============ */
.panel { scroll-margin-bottom: 80px; }
.sheet-body form { padding-bottom: 40px; }

/* ============ PROFILE DROPDOWN ============ */
.profile-dropdown { position: relative; }
.profile-menu {
    display: none; position: absolute; right: 0; top: 100%; margin-top: 8px;
    background: #fff; border-radius: var(--radius); box-shadow: 0 10px 40px rgba(0,0,0,.15);
    min-width: 160px; overflow: hidden; z-index: 500; border: 1px solid var(--line);
}
.profile-menu.show { display: block; }
.profile-menu a {
    display: flex; align-items: center; gap: 8px; padding: 10px 14px;
    font-size: 13px; color: var(--text); transition: background .15s;
}
.profile-menu a:hover { background: #f3f4f6; }
.profile-menu a i { width: 16px; height: 16px; }
@media (max-width: 768px) {
    .profile-menu { right: 0; left: auto; }
}

/* ============ THEME TOGGLE ============ */
#theme-toggle { overflow: hidden; }
#theme-toggle .icon-moon, #theme-toggle .icon-sun {
    display: inline-flex; align-items: center; justify-content: center;
}

/* ============ DARK MODE ============ */
[data-theme="dark"] {
  --bg: #0b1220;
  --panel: #111d2f;
  --text: #e2e8f0;
  --muted: #8899aa;
  --line: #1e2d45;
  --shadow: 0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.4), 0 4px 10px rgba(0,0,0,.2);
}
[data-theme="dark"] .btn, [data-theme="dark"] button, [data-theme="dark"] input[type=submit] {
  background: #1a2744; color: #e2e8f0; border-color: #1e2d45;
}
[data-theme="dark"] .btn:hover { background: #243456; border-color: #2a3a55; }
[data-theme="dark"] .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
[data-theme="dark"] .btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
[data-theme="dark"] .icon-btn { background: transparent; }
[data-theme="dark"] .bottom-nav { background: #111d2f; border-top-color: #1e2d45; }
[data-theme="dark"] .bottom-nav a:active { background: #1a2744; }
[data-theme="dark"] table th { background: #0f1a2e; color: #8899aa; border-bottom-color: #1e2d45; }
[data-theme="dark"] table td { border-bottom-color: #1a2744; }
[data-theme="dark"] table tr:hover td { background: #0f1a2e; }
[data-theme="dark"] .badge { background: #1e2d45; color: #c8d2e0; }
[data-theme="dark"] .status-active { background: #1b2d1b; color: #4ade80; }
[data-theme="dark"] .status-pending { background: #2d2b1b; color: #fbbf24; }
[data-theme="dark"] .status-rejected { background: #2d1b1b; color: #f87171; }
[data-theme="dark"] .tab-list { background: #0f1a2e; }
[data-theme="dark"] .tab-list button.active { background: #111d2f; color: var(--brand); }
[data-theme="dark"] .filters select, [data-theme="dark"] .filters input { background: #1a2744; color: #e2e8f0; border-color: #1e2d45; }
[data-theme="dark"] .filter-group select { background: #1a2744; color: #e2e8f0; border-color: #1e2d45; }
[data-theme="dark"] .form-grid input, [data-theme="dark"] .form-grid select, [data-theme="dark"] .form-grid textarea { background: #1a2744; color: #e2e8f0; border-color: #1e2d45; }
[data-theme="dark"] .form-grid input:focus, [data-theme="dark"] .form-grid select:focus, [data-theme="dark"] .form-grid textarea:focus { border-color: var(--brand); }
[data-theme="dark"] .sheet { background: #111d2f; }
[data-theme="dark"] .sheet-header h2 { color: #e2e8f0; }
[data-theme="dark"] .sheet-close:hover { background: #1a2744; }
[data-theme="dark"] .sheet-body input, [data-theme="dark"] .sheet-body select, [data-theme="dark"] .sheet-body textarea { background: #1a2744; color: #e2e8f0; border-color: #1e2d45; }
[data-theme="dark"] .sheet-body input:focus, [data-theme="dark"] .sheet-body select:focus, [data-theme="dark"] .sheet-body textarea:focus { background: #1a2744; border-color: var(--brand); }
[data-theme="dark"] .sheet-handle span { background: #1e2d45; }
[data-theme="dark"] .profile-menu { background: #111d2f; border-color: #1e2d45; }
[data-theme="dark"] .profile-menu a:hover { background: #1a2744; }
[data-theme="dark"] .alert.success { background: #1b2d1b; color: #4ade80; border-color: #1f3f1f; }
[data-theme="dark"] .alert.error { background: #2d1b1b; color: #f87171; border-color: #3f1f1f; }
[data-theme="dark"] .modal-card { background: #111d2f; }
[data-theme="dark"] button.lock-logout-btn { border-color: #1e2d45; }
[data-theme="dark"] .lock-card { background: #111d2f; }
[data-theme="dark"] .lock-card .lock-logout-btn { border-color: #1e2d45; }
[data-theme="dark"] .tile p { color: #8899aa; }
[data-theme="dark"] .editable-cell:hover { background: #1a2744; }
[data-theme="dark"] .inline-edit { background: #1a2744; }
