/* SmartSpend – app.css */
:root {
  --primary:    #003366;
  --primary-lt: #1a5276;
  --accent:     #e8a020;
  --danger:     #c0392b;
  --success:    #1e8449;
  --warning:    #d4ac0d;
  --bg:         #f4f6fa;
  --card:       #ffffff;
  --border:     #d5d8dc;
  --text:       #1a1a2e;
  --muted:      #7f8c8d;
  --sidebar-w:  230px;
  --text-secondary: #6b7280;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── TOP NAV ─────────────────────────────────────────────────────────── */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 56px; background: var(--primary);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.topnav-brand a { color: #fff; font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.topnav-right { display: flex; align-items: center; gap: 12px; color: #fff; }
.nav-icon { color: #fff; font-size: 18px; position: relative; }
.nav-icon .badge {
  position: absolute; top: -6px; right: -8px; background: var(--accent);
  color: #fff; border-radius: 9px; font-size: 10px; padding: 1px 5px;
}
.nav-user { font-size: 13px; }

/* ── LAYOUT ──────────────────────────────────────────────────────────── */
.layout { display: flex; margin-top: 56px; min-height: calc(100vh - 56px); }
.sidebar {
  width: var(--sidebar-w); background: var(--primary-lt); flex-shrink: 0;
  position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto;
}
.sidebar ul { list-style: none; padding: 12px 0; }
.sidebar li a {
  display: flex; align-items: center; gap: 10px;
  color: rgba(255,255,255,.8); padding: 10px 18px; border-radius: 0;
  font-size: 13.5px; transition: background .15s;
}
.sidebar li a i { width: 18px; text-align: center; }
.sidebar li:hover a, .sidebar li.active a {
  background: rgba(255,255,255,.12); color: #fff;
}
.content { flex: 1; padding: 24px; max-width: 1200px; }

/* ── CARDS ───────────────────────────────────────────────────────────── */
.card { background: var(--card); border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.08); margin-bottom: 20px; }
.card-header {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 15px; display: flex; justify-content: space-between; align-items: center;
}
.card-body { padding: 20px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(160px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card); border-radius: 8px; padding: 18px 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08); border-left: 4px solid var(--primary);
}
.stat-card.accent { border-left-color: var(--accent); }
.stat-card.success { border-left-color: var(--success); }
.stat-card.danger  { border-left-color: var(--danger); }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 4px; }

/* ── BUTTONS ─────────────────────────────────────────────────────────── */
.btn { display:inline-flex; align-items:center; gap:6px; padding:8px 16px; border:none; border-radius:5px; cursor:pointer; font-size:13px; font-weight:500; transition:opacity .15s; }
.btn:hover { opacity: .88; text-decoration:none; }
.btn-primary   { background:var(--primary);  color:#fff; }
.btn-accent    { background:var(--accent);   color:#fff; }
.btn-success   { background:var(--success);  color:#fff; }
.btn-danger    { background:var(--danger);   color:#fff; }
.btn-warning   { background:var(--warning);  color:#fff; }
.btn-outline   { background:transparent; border:1px solid currentColor; }
.btn-sm        { padding:5px 11px; font-size:12px; }

/* ── FORMS ───────────────────────────────────────────────────────────── */
.form-group   { margin-bottom: 16px; }
label         { display:block; font-size:13px; font-weight:500; margin-bottom:5px; }
input,select,textarea {
  width:100%; padding:8px 12px; border:1px solid var(--border); border-radius:5px;
  font-size:14px; background:#fff; color:var(--text);
}
input:focus,select:focus,textarea:focus { outline:2px solid var(--primary); border-color:var(--primary); }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.form-row-3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:16px; }

/* ── TABLES ──────────────────────────────────────────────────────────── */
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; font-size:13px; }
th,td { padding:10px 12px; border-bottom:1px solid var(--border); text-align:left; }
th { background:var(--primary); color:#fff; font-weight:600; white-space:nowrap; }
tr:hover td { background:#f0f4ff; }

/* ── ALERTS ──────────────────────────────────────────────────────────── */
.alert { padding:12px 16px; border-radius:6px; margin-bottom:16px; font-size:13.5px; }
.alert-success { background:#d5f5e3; color:#145a32; }
.alert-danger   { background:#fadbd8; color:#78281f; }
.alert-warning  { background:#fef9e7; color:#7d6608; }
.alert-info     { background:#d6eaf8; color:#1b4f72; }

/* ── BADGES ──────────────────────────────────────────────────────────── */
.badge-status { display:inline-block; padding:2px 8px; border-radius:9px; font-size:11px; font-weight:600; }
.badge-active   { background:#d5f5e3; color:#145a32; }
.badge-pending  { background:#fef9e7; color:#7d6608; }
.badge-inactive, .badge-suspended { background:#fadbd8; color:#78281f; }
.badge-completed { background:#d5f5e3; color:#145a32; }
.badge-failed    { background:#fadbd8; color:#78281f; }

/* ── QR ──────────────────────────────────────────────────────────────── */
.qr-wrap { text-align:center; padding:20px; }
.qr-wrap img { max-width:200px; border:4px solid var(--primary); border-radius:8px; }
.uid-code { font-size:28px; font-weight:700; letter-spacing:4px; color:var(--primary); margin:10px 0; }

/* ── MISC ────────────────────────────────────────────────────────────── */
.page-title { font-size:20px; font-weight:700; margin-bottom:20px; }
.text-muted  { color:var(--muted); }
.text-right  { text-align:right; }
.mt-1 { margin-top:8px; } .mt-2 { margin-top:16px; } .mt-3 { margin-top:24px; }
.flex-between { display:flex; justify-content:space-between; align-items:center; }
.export-bar { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-bottom:12px; }
.site-footer { text-align:center; padding:16px; font-size:12px; color:var(--muted); border-top:1px solid var(--border); }

/* ── LOGIN PAGE ──────────────────────────────────────────────────────── */
body.login-page { background:var(--primary); display:flex; align-items:center; justify-content:center; min-height:100vh; }
.login-box { background:#fff; border-radius:12px; padding:40px; width:380px; box-shadow:0 8px 32px rgba(0,0,0,.25); }
.login-box h1 { font-size:22px; margin-bottom:4px; color:var(--primary); }
.login-box .subtitle { color:var(--muted); font-size:13px; margin-bottom:24px; }

@media(max-width:768px) {
  .sidebar { display:none; }
  .form-row, .form-row-3 { grid-template-columns:1fr; }
}

/* ─── Modal System ─────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open {
  display: flex;
}
.modal-box {
  background: #ffffff;
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0 .25rem;
}
.modal-close:hover { color: var(--danger); }
.modal-body  { padding: 1.25rem 1.5rem; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

/* ─── Sidebar Sign Out ─────────────────────────────────────────────────────── */
.sidebar-signout {
  padding: 1rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.sidebar-signout a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem .75rem;
  border-radius: 8px;
  color: var(--danger);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  transition: background .15s;
}
.sidebar-signout a:hover { background: rgba(239,68,68,.1); }
