/* ═══════════════════════════════════════
   ROOT VARIABLES
═══════════════════════════════════════ */
:root {
  --g900:#052e16; --g800:#14532d; --g700:#15803d; --g600:#16a34a;
  --g500:#22c55e; --g400:#4ade80; --g300:#86efac; --g200:#bbf7d0;
  --g100:#dcfce7; --g50:#f0fdf4;
  --lime:#a3e635; --amber:#fbbf24; --red:#ef4444; --blue:#3b82f6;
  --bg:#f0fdf4; --card:#ffffff; --text:#052e16; --muted:#4b7c59; --border:#bbf7d0;
  --radius:16px; --radius-sm:10px; --radius-xs:6px;
  --shadow: 0 1px 3px rgba(5,46,22,.06), 0 4px 16px rgba(5,46,22,.04);
  --shadow-md: 0 4px 20px rgba(5,46,22,.1), 0 1px 4px rgba(5,46,22,.06);
  --shadow-lg: 0 12px 40px rgba(5,46,22,.14), 0 4px 12px rgba(5,46,22,.08);
  --shadow-xl: 0 24px 64px rgba(5,46,22,.18);
  --sidebar-w: 248px;
  --topbar-h: 62px;
  --transition: .2s cubic-bezier(.4,0,.2,1);
}

/* ═══════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--g200); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--g400); }

/* ═══════════════════════════════════════
   PROGRESS BAR (top loading indicator)
═══════════════════════════════════════ */
#nprogress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--g600), var(--lime), var(--g400));
  z-index: 9999; transform: scaleX(0); transform-origin: left;
  transition: transform .4s ease, opacity .3s ease;
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 12px rgba(22,163,74,.5);
}
#nprogress.active { transform: scaleX(0.7); opacity: 1; }
#nprogress.done   { transform: scaleX(1); opacity: 0; transition: transform .15s ease, opacity .4s ease .15s; }

/* ═══════════════════════════════════════
   LOGIN SCREEN
═══════════════════════════════════════ */
#login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #022c1a 0%, var(--g900) 40%, var(--g800) 100%);
  position: relative; overflow: hidden;
}
/* Animated mesh background */
#login-screen::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 30%, rgba(34,197,94,.12) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 80% 70%, rgba(163,230,53,.08) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 60% 20%, rgba(22,163,74,.06) 0%, transparent 50%);
  animation: meshShift 8s ease-in-out infinite alternate;
}
@keyframes meshShift {
  from { opacity: .7; transform: scale(1); }
  to   { opacity: 1;  transform: scale(1.04); }
}
/* Floating dots pattern */
#login-screen::after {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 32px 32px;
  animation: patternDrift 20s linear infinite;
}
@keyframes patternDrift {
  from { background-position: 0 0; }
  to   { background-position: 32px 32px; }
}

.login-box {
  background: rgba(255,255,255,.97);
  border-radius: 28px;
  padding: 44px 42px;
  width: min(440px, calc(100vw - 32px));
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,.1) inset;
  position: relative; z-index: 1;
  animation: boxReveal .6s cubic-bezier(.34,1.56,.64,1);
}
@keyframes boxReveal {
  from { opacity: 0; transform: translateY(28px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.login-brand { text-align: center; margin-bottom: 32px; }
.login-logo {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--g600), var(--g400));
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; margin: 0 auto 14px;
  box-shadow: 0 8px 24px rgba(22,163,74,.35);
  animation: logoFloat 3s ease-in-out infinite;
}
@keyframes logoFloat {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
.login-title { font-family: 'Bricolage Grotesque', sans-serif; font-size: 28px; font-weight: 800; color: var(--g900); letter-spacing: -.5px; }
.login-sub   { font-size: 13px; color: var(--muted); margin-top: 5px; }

.login-tabs {
  display: flex; gap: 4px; background: var(--g50);
  border-radius: 12px; padding: 4px; margin-bottom: 24px;
  border: 1px solid var(--g200);
}
.login-tab {
  flex: 1; padding: 10px; border-radius: 9px; border: none; background: none;
  font-family: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
  color: var(--muted); transition: all var(--transition);
}
.login-tab.active {
  background: #fff; color: var(--g800); font-weight: 600;
  box-shadow: 0 2px 8px rgba(5,46,22,.1);
}
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-field { display: flex; flex-direction: column; gap: 7px; }
.login-field label { font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: .2px; }
.login-field input {
  padding: 12px 16px; border: 1.5px solid var(--border); border-radius: 12px;
  font-size: 15px; font-family: inherit; outline: none;
  transition: border var(--transition), box-shadow var(--transition), background var(--transition);
  background: #fff; color: var(--text);
}
.login-field input:hover { border-color: var(--g300); }
.login-field input:focus { border-color: var(--g500); box-shadow: 0 0 0 4px rgba(34,197,94,.14); background: #fff; }
.login-btn {
  padding: 14px; background: linear-gradient(135deg, var(--g600), var(--g700));
  color: #fff; border: none; border-radius: 12px;
  font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: all var(--transition); margin-top: 4px; letter-spacing: .1px;
  box-shadow: 0 4px 16px rgba(22,163,74,.3);
  position: relative; overflow: hidden;
}
.login-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(22,163,74,.4); }
.login-btn:active { transform: translateY(0); }
.login-btn:disabled { opacity: .7; cursor: not-allowed; transform: none; }
.login-err {
  background: #fef2f2; color: #991b1b; border: 1px solid #fecaca;
  padding: 11px 14px; border-radius: 10px; font-size: 13px;
  display: none; border-left: 3px solid var(--red);
}
.login-err.show { display: block; animation: shake .4s ease; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-5px); }
  40%,80% { transform: translateX(5px); }
}
/* ── Hide browser-native password reveal buttons (Edge / Chrome / IE / Safari) ── */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear { display: none !important; }
input[type="password"]::-webkit-credentials-auto-fill-button,
input[type="password"]::-webkit-textfield-decoration-container { display: none !important; }

.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 46px !important; }
.eye-btn {
  position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--muted);
  font-size: 17px; line-height: 1; padding: 3px; transition: color .15s;
}
.eye-btn:hover { color: var(--g700); }
.pass-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
#forgot-panel { display: none; flex-direction: column; gap: 16px; }
#forgot-panel.show { display: flex; }
.back-link {
  background: none; border: none; color: var(--muted); font-size: 13px;
  cursor: pointer; font-family: inherit; text-align: left; padding: 0;
  display: inline-flex; align-items: center; gap: 5px;
  transition: color .15s; font-weight: 500;
}
.back-link:hover { color: var(--g700); }
.forgot-link {
  background: none; border: none; color: var(--g700); font-size: 12px;
  cursor: pointer; font-family: inherit; padding: 0; text-align: right;
  font-weight: 500; transition: color .15s;
}
.forgot-link:hover { color: var(--g800); text-decoration: underline; }

/* ═══════════════════════════════════════
   APP SHELL
═══════════════════════════════════════ */
#app { display: none; min-height: 100vh; }
#app.visible { display: block; }

/* ═══════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════ */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: linear-gradient(180deg, #042617 0%, var(--g900) 100%);
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 100;
  transition: transform var(--transition);
  box-shadow: 4px 0 24px rgba(5,46,22,.3);
}
.sidebar-brand {
  padding: 22px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand-row { display: flex; align-items: center; gap: 11px; }
.brand-icon {
  width: 40px; height: 40px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--g600), var(--g400));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px;
  box-shadow: 0 4px 12px rgba(22,163,74,.35);
}
.brand-name  { font-family: 'Bricolage Grotesque', sans-serif; font-size: 17px; font-weight: 700; color: #fff; letter-spacing: -.3px; }
.brand-tag   { font-size: 10.5px; color: var(--g400); margin-top: 1px; opacity: .8; }

nav { flex: 1; padding: 10px 10px; display: flex; flex-direction: column; gap: 1px; overflow-y: auto; }
.nav-section-label {
  font-size: 10px; font-weight: 600; color: rgba(255,255,255,.28);
  letter-spacing: 1.4px; text-transform: uppercase;
  padding: 14px 10px 5px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px; cursor: pointer;
  color: rgba(255,255,255,.55); font-size: 13.5px; font-weight: 450;
  transition: all var(--transition); position: relative; user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active {
  background: linear-gradient(135deg, var(--g700), var(--g600));
  color: #fff; font-weight: 600;
  box-shadow: 0 4px 14px rgba(22,163,74,.3);
}
.nav-item.active::before {
  content: '';
  position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; background: var(--g400);
  border-radius: 0 3px 3px 0;
}
.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding: 12px 10px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.signout-btn {
  width: 100%; padding: 10px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px; color: rgba(255,255,255,.55); font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 7px;
  transition: all var(--transition);
}
.signout-btn:hover { background: rgba(239,68,68,.15); color: #fca5a5; border-color: rgba(239,68,68,.3); }

/* Mobile overlay */
#sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); backdrop-filter: blur(3px);
  z-index: 99;
}
#sidebar-overlay.show { display: block; }

/* ═══════════════════════════════════════
   MAIN CONTENT
═══════════════════════════════════════ */
#main { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; }

/* ═══════════════════════════════════════
   TOPBAR
═══════════════════════════════════════ */
.topbar {
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 26px 0 24px;
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 0 var(--border), 0 4px 20px rgba(5,46,22,.04);
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-title { font-family: 'Bricolage Grotesque', sans-serif; font-size: 19px; font-weight: 700; letter-spacing: -.3px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--g50); border: 1px solid var(--g200);
  border-radius: 100px; padding: 5px 14px; font-size: 13px; font-weight: 500;
}
.user-dot {
  width: 8px; height: 8px; background: var(--g500);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(34,197,94,.2);
  animation: pulse 2s ease infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 2px rgba(34,197,94,.2); }
  50%      { box-shadow: 0 0 0 5px rgba(34,197,94,.0); }
}

/* Hamburger (mobile) */
.hamburger {
  display: none; flex-direction: column; justify-content: center;
  gap: 5px; background: none; border: none; cursor: pointer;
  padding: 5px; border-radius: 8px; transition: background var(--transition);
}
.hamburger:hover { background: var(--g100); }
.hamburger span {
  display: block; width: 20px; height: 2px; background: var(--text);
  border-radius: 2px; transition: all var(--transition);
}

/* ═══════════════════════════════════════
   BUTTONS
═══════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-xs);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: none; transition: all var(--transition);
  font-family: inherit; position: relative; overflow: hidden;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--g600), var(--g700));
  color: #fff;
  box-shadow: 0 2px 8px rgba(22,163,74,.25);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--g700), var(--g800)); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(22,163,74,.35); }
.btn-secondary { background: var(--g100); color: var(--g800); border: 1px solid var(--g200); }
.btn-secondary:hover { background: var(--g200); }
.btn-danger { background: #fef2f2; color: var(--red); border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; border-color: #fca5a5; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }

/* Ripple */
.ripple { position: absolute; border-radius: 50%; transform: scale(0); animation: rippleAnim .5s linear; background: rgba(255,255,255,.35); pointer-events: none; }
@keyframes rippleAnim { to { transform: scale(4); opacity: 0; } }

/* ═══════════════════════════════════════
   PAGES
═══════════════════════════════════════ */
.page { display: none; padding: 26px 28px; animation: pageIn .25s ease; }
.page.active { display: block; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════
   STATS GRID
═══════════════════════════════════════ */
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 22px;
}
.stat-card {
  background: var(--card); border-radius: var(--radius);
  padding: 22px 20px; border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: default;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.stat-card::after {
  content: ''; position: absolute; bottom: -20px; right: -20px;
  width: 80px; height: 80px; border-radius: 50%;
  opacity: .06;
}
.stat-card.green::before { background: linear-gradient(90deg, var(--g600), var(--g400)); }
.stat-card.green::after  { background: var(--g600); }
.stat-card.lime::before  { background: linear-gradient(90deg, var(--lime), #bef264); }
.stat-card.lime::after   { background: var(--lime); }
.stat-card.amber::before { background: linear-gradient(90deg, var(--amber), #fde68a); }
.stat-card.amber::after  { background: var(--amber); }
.stat-card.red::before   { background: linear-gradient(90deg, var(--red), #fca5a5); }
.stat-card.red::after    { background: var(--red); }
.stat-icon  { font-size: 28px; margin-bottom: 10px; display: block; }
.stat-value { font-family: 'Bricolage Grotesque', sans-serif; font-size: 32px; font-weight: 800; line-height: 1; letter-spacing: -.5px; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 500; }

/* ═══════════════════════════════════════
   CARD
═══════════════════════════════════════ */
.card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden;
}
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-title { font-family: 'Bricolage Grotesque', sans-serif; font-size: 14.5px; font-weight: 700; }
.card-body  { padding: 20px; }

/* ═══════════════════════════════════════
   SEARCH BAR
═══════════════════════════════════════ */
.search-bar { padding: 14px 20px 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-input {
  flex: 1; max-width: 300px;
  padding: 9px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px; font-family: inherit;
  outline: none; background: var(--g50); color: var(--text);
  transition: border var(--transition), box-shadow var(--transition);
}
.search-input:focus { border-color: var(--g500); box-shadow: 0 0 0 3px rgba(34,197,94,.12); background: #fff; }
.filter-select {
  max-width: 160px; padding: 9px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px; font-family: inherit;
  outline: none; background: var(--g50); color: var(--text); cursor: pointer;
  transition: border var(--transition);
}
.filter-select:focus { border-color: var(--g500); }

/* ═══════════════════════════════════════
   TABLE
═══════════════════════════════════════ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { border-bottom: 2px solid var(--border); }
th {
  padding: 10px 14px; text-align: left; font-weight: 600;
  font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px;
  white-space: nowrap;
}
td { padding: 12px 14px; border-bottom: 1px solid rgba(240,253,244,.8); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: linear-gradient(90deg, var(--g50), rgba(240,253,244,.5)); }

/* ═══════════════════════════════════════
   BADGES
═══════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 100px;
  font-size: 11px; font-weight: 600; letter-spacing: .2px;
  white-space: nowrap;
}
.badge-green  { background: var(--g100); color: var(--g700); }
.badge-amber  { background: #fef3c7; color: #92400e; }
.badge-red    { background: #fef2f2; color: #991b1b; }
.badge-blue   { background: #eff6ff; color: #1d4ed8; }
.badge-gray   { background: #f3f4f6; color: #374151; }
.badge-lime   { background: #f7fee7; color: #3f6212; }

/* ═══════════════════════════════════════
   FORM
═══════════════════════════════════════ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .2px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: #fff;
  font-size: 13px; font-family: inherit; color: var(--text);
  transition: border var(--transition), box-shadow var(--transition);
  outline: none;
}
input:hover, select:hover { border-color: var(--g300); }
input:focus, select:focus, textarea:focus {
  border-color: var(--g500); box-shadow: 0 0 0 3px rgba(34,197,94,.12);
}
textarea { resize: vertical; min-height: 70px; }

/* ═══════════════════════════════════════
   MODAL
═══════════════════════════════════════ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(5,46,22,.45); backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200; display: none; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--card); border-radius: 20px;
  width: min(520px, 100%); max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-xl); animation: modalIn .24s cubic-bezier(.34,1.56,.64,1);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.94) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  padding: 20px 22px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--card); z-index: 1;
}
.modal-title { font-family: 'Bricolage Grotesque', sans-serif; font-size: 17px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px; border: none;
  background: var(--g100); cursor: pointer; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  color: var(--g700); transition: all var(--transition);
  line-height: 1; font-family: inherit;
}
.modal-close:hover { background: var(--g200); transform: rotate(90deg); }
.modal-body { padding: 20px 22px; }
.modal-footer {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
  position: sticky; bottom: 0; background: var(--card);
}

/* ═══════════════════════════════════════
   ALERT (inside modals/forms)
═══════════════════════════════════════ */
.alert {
  padding: 11px 14px; border-radius: 10px; font-size: 13px; font-weight: 500;
  margin-bottom: 16px; display: none;
  border-left: 3px solid transparent;
}
.alert.show { display: flex; align-items: flex-start; gap: 8px; animation: alertPop .25s ease; }
@keyframes alertPop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.alert-success { background: var(--g100); color: var(--g800); border-color: var(--g500); }
.alert-error   { background: #fef2f2; color: #991b1b; border-color: var(--red); }

/* ═══════════════════════════════════════
   CONFIRM DIALOG
═══════════════════════════════════════ */
#confirm-dialog {
  position: fixed; inset: 0;
  background: rgba(5,46,22,.5); backdrop-filter: blur(6px);
  z-index: 300; display: none; align-items: center; justify-content: center;
  padding: 16px;
}
#confirm-dialog.open { display: flex; }
.confirm-box {
  background: #fff; border-radius: 20px; padding: 32px;
  width: min(380px, 100%);
  box-shadow: var(--shadow-xl); text-align: center;
  animation: modalIn .22s cubic-bezier(.34,1.56,.64,1);
}
.confirm-icon { font-size: 40px; margin-bottom: 12px; }
.confirm-title { font-family: 'Bricolage Grotesque', sans-serif; font-size: 19px; font-weight: 700; margin-bottom: 7px; }
.confirm-msg { font-size: 14px; color: var(--muted); margin-bottom: 24px; line-height: 1.5; }
.confirm-btns { display: flex; gap: 10px; justify-content: center; }

/* ═══════════════════════════════════════
   TOAST — custom, rich notification
═══════════════════════════════════════ */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 9999; pointer-events: none;
}
.toast-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--g900); color: #fff;
  padding: 13px 18px; border-radius: 14px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
  min-width: 240px; max-width: 320px;
  pointer-events: all; position: relative; overflow: hidden;
  animation: toastIn .35s cubic-bezier(.34,1.56,.64,1);
}
.toast-item.removing { animation: toastOut .3s ease forwards; }
.toast-item.error { background: #991b1b; }
.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-text { flex: 1; }
.toast-progress {
  position: absolute; bottom: 0; left: 0; height: 3px;
  background: rgba(255,255,255,.35); border-radius: 0 2px 2px 0;
  animation: toastProgress 3.2s linear forwards;
}
@keyframes toastIn  { from { opacity: 0; transform: translateX(40px) scale(.9); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0) scale(1); } to { opacity: 0; transform: translateX(40px) scale(.9); } }
@keyframes toastProgress { from { width: 100%; } to { width: 0; } }

/* ═══════════════════════════════════════
   MISC UTILITIES
═══════════════════════════════════════ */
.empty {
  text-align: center; padding: 48px 20px; color: var(--muted);
}
.empty-icon  { font-size: 40px; margin-bottom: 12px; opacity: .7; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text); }
.empty-text  { font-size: 13px; margin-top: 4px; color: var(--muted); }
.two-col   { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.section-title  { font-family: 'Bricolage Grotesque', sans-serif; font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.section-sub    { font-size: 13px; color: var(--muted); margin-top: 2px; }
.expiry-urgent  { color: var(--red); font-weight: 600; }
.expiry-soon    { color: #d97706; font-weight: 500; }
.expiry-ok      { color: var(--g600); }
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 40px; gap: 10px; color: var(--muted); font-size: 13px;
}
.spinner {
  width: 18px; height: 18px; border: 2px solid var(--g200);
  border-top-color: var(--g600); border-radius: 50%;
  animation: spin .65s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.activity-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--g50);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--g500); flex-shrink: 0;
}
.activity-dot.pending     { background: var(--amber); }
.activity-dot.distributed { background: var(--blue); }
.activity-dot.approved    { background: var(--g500); }
.activity-text { flex: 1; font-size: 13px; line-height: 1.4; }
.activity-time { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* Location card */
.loc-card {
  transition: transform var(--transition), box-shadow var(--transition);
}
.loc-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

/* code tag */
code {
  background: var(--g100); color: var(--g800);
  padding: 2px 6px; border-radius: 5px; font-size: 11.5px;
  font-family: 'SF Mono', monospace; font-weight: 600;
}

/* ═══════════════════════════════════════
   RESPONSIVE / MOBILE
═══════════════════════════════════════ */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  #sidebar {
    width: 248px;
    transform: translateX(-100%);
  }
  #sidebar.open { transform: translateX(0); }
  #sidebar-overlay.show { display: block; }
  #main { margin-left: 0; }
  .hamburger { display: flex; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .page { padding: 18px 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .three-col { grid-template-columns: 1fr; }
  .stat-value { font-size: 26px; }
  .topbar { padding: 0 16px; }
  .login-box { padding: 32px 24px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: 1; }
  .user-chip span { display: none; }
  .section-header { flex-direction: column; align-items: flex-start; }
}
