:root {
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-2: #eef4f0;
  --text: #102418;
  --muted: #5a7062;
  --primary: #0a4a1c;
  --primary-hover: #083815;
  --gold: #d4a017;
  --danger: #c62828;
  --border: #d8e4dc;
  --shadow: 0 6px 20px rgba(10, 74, 28, 0.08);
}

body.dark {
  --bg: #0b1410;
  --surface: #13221b;
  --surface-2: #1b2f25;
  --text: #f1f5f2;
  --muted: #9eb5a6;
  --primary: #1f7a38;
  --primary-hover: #279144;
  --gold: #f0c446;
  --border: #253d30;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', 'Hind Siliguri', sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.88rem; }
.full-width { width: 100%; }

.error-box {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px;
  background: #fdecea; color: #b71c1c; border: 1px solid #f5c6cb;
  font-size: 0.86rem; word-break: break-word;
}

.login-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: radial-gradient(circle at top, #134e24, #071d0d);
}
.login-card {
  width: 100%; max-width: 430px; background: var(--surface); padding: 32px;
  border-radius: 18px; border: 2px solid var(--gold); box-shadow: var(--shadow);
}
.brand-badge {
  display: inline-block; background: var(--primary); color: var(--gold);
  padding: 4px 12px; border-radius: 99px; font-weight: 700; font-size: 0.78rem; margin-bottom: 12px;
}
.login-card h1 { font-size: 1.5rem; margin-bottom: 6px; }
.login-card label { display: block; margin-top: 14px; font-weight: 600; font-size: 0.9rem; }
.login-footer { margin-top: 16px; text-align: center; }

input, select, textarea {
  width: 100%; padding: 10px 12px; margin-top: 6px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-family: inherit;
}
.btn {
  padding: 10px 16px; border: none; border-radius: 10px; cursor: pointer;
  font-weight: 600; font-family: inherit; transition: 0.2s;
}
.btn:disabled { opacity: 0.65; cursor: not-allowed; }
.btn.small { padding: 6px 10px; font-size: 0.82rem; }
.btn-primary { background: var(--primary); color: #fff; margin-top: 14px; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-gold { background: var(--gold); color: #111; margin-top: 14px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 265px; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px; gap: 18px;
}
.sidebar-header { display: flex; align-items: center; gap: 12px; }
.logo-circle {
  width: 44px; height: 44px; border-radius: 50%; background: var(--primary);
  color: var(--gold); border: 2px solid var(--gold); display: grid; place-items: center; font-weight: 700;
}
.gold-tag { font-size: 0.72rem; color: var(--gold); font-weight: 700; }
.nav-links { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.nav-btn {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: none;
  border-radius: 10px; background: transparent; color: var(--text); font-weight: 600; cursor: pointer; text-align: left;
}
.nav-btn.active, .nav-btn:hover { background: var(--primary); color: #fff; }
.badge { margin-left: auto; background: var(--gold); color: #111; padding: 2px 7px; border-radius: 99px; font-size: 0.75rem; }
.admin-mini { margin-bottom: 10px; display: flex; align-items: center; gap: 10px; }

.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 14px 22px; display: flex; align-items: center; justify-content: space-between;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.icon-btn { display: none; background: none; border: none; font-size: 1.4rem; color: var(--text); cursor: pointer; }
.content { padding: 22px; max-width: 1350px; width: 100%; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi-card { background: var(--surface); padding: 18px; border-radius: 14px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.kpi-card span { color: var(--muted); font-size: 0.88rem; display: block; }
.kpi-card strong { font-size: 1.7rem; margin-top: 6px; display: block; }
.kpi-card.gold { border-left: 4px solid var(--gold); }
.kpi-card.green { border-left: 4px solid var(--primary); }

.card { background: var(--surface); padding: 20px; border-radius: 14px; border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 16px; }
.toolbar { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.stack-form { display: flex; flex-direction: column; gap: 8px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; cursor: pointer; }
.checkbox-row input { width: auto; margin: 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold); }
.pill { padding: 3px 9px; border-radius: 99px; font-size: 0.76rem; font-weight: 700; display: inline-block; }
.pill.pending { background: #fff3cd; color: #856404; }
.pill.approved, .pill.paid { background: #d4edda; color: #155724; }
.pill.rejected { background: #f8d7da; color: #721c24; }
.pill.anon { background: #3b235a; color: #f6d56f; }
.actions-row { display: flex; gap: 6px; flex-wrap: wrap; }

.list-stack { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.item-row { padding: 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.chat-inspector { max-height: 500px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.chat-msg { padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.admin-reveal { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: rgba(212, 160, 23, 0.14); border: 1px dashed var(--gold); font-size: 0.84rem; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.75); display: grid; place-items: center; z-index: 999; padding: 20px; }
.modal-box { background: var(--surface); padding: 16px; border-radius: 14px; max-width: 90vw; max-height: 90vh; overflow: auto; }
.modal-box img { max-width: 100%; max-height: 75vh; display: block; margin-top: 10px; border-radius: 8px; }
.toast { position: fixed; bottom: 22px; right: 22px; background: var(--primary); color: #fff; padding: 12px 18px; border-radius: 10px; border: 1px solid var(--gold); z-index: 1000; }

@media (max-width: 860px) {
  .sidebar { position: fixed; left: -280px; top: 0; bottom: 0; z-index: 900; transition: 0.25s; }
  .sidebar.open { left: 0; }
  .icon-btn { display: inline-block; }
}

