:root {
  --brand: #0d3b66;
  --brand-2: #1d6fb8;
  --accent: #f4a261;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --border: #e3e8ef;
  --text: #1b2733;
  --muted: #6b7785;
  --sidebar-w: 248px;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
}
[data-bs-theme="dark"] {
  --brand: #1d6fb8;
  --bg: #0e1620;
  --surface: #161f2b;
  --border: #263241;
  --text: #e7edf4;
  --muted: #93a1b1;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 14px;
}
a { text-decoration: none; }

.app-shell { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--brand) 0%, #0a2e50 100%);
  color: #dce6f2;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
  transition: transform .25s ease;
}
.sidebar-brand {
  display: flex; align-items: center; justify-content: center;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .brand-logo {
  height: 76px; width: auto; max-width: 100%; display: block;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,.4));
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: .75rem .5rem; }
.sidebar .nav-link {
  display: flex; align-items: center; gap: .75rem;
  color: #cbd6e4; padding: .6rem .85rem; border-radius: 8px;
  font-weight: 500; margin-bottom: 2px;
}
.sidebar .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar .nav-link.active { background: var(--brand-2); color: #fff; }
.sidebar-footer { padding: .5rem; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1035;
}
body.sidebar-open .sidebar-backdrop { display: block; }

/* ── Main ── */
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .75rem; padding: 0 1rem;
  position: sticky; top: 0; z-index: 1020;
}
.topbar-search {
  flex: 1; max-width: 460px; position: relative; display: flex; align-items: center;
}
.topbar-search i { position: absolute; left: 12px; color: var(--muted); }
.topbar-search input {
  width: 100%; padding: .5rem .75rem .5rem 2.2rem; border: 1px solid var(--border);
  border-radius: 999px; background: var(--bg); color: var(--text); outline: none;
}
.topbar-actions { display: flex; align-items: center; gap: .35rem; margin-left: auto; }
.btn-icon {
  width: 40px; height: 40px; border-radius: 50%; border: none; background: transparent;
  color: var(--text); display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.btn-icon:hover { background: var(--bg); }
.notif-dot {
  position: absolute; top: 4px; right: 4px; background: #e63946; color: #fff;
  font-size: .6rem; min-width: 16px; height: 16px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.user-chip { display: flex; align-items: center; gap: .5rem; border: none; background: transparent; color: var(--text); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--brand-2); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 600;
}

.content { padding: 1.25rem; flex: 1; }
@media (max-width: 991px) { .content { padding-bottom: 80px; } }

/* ── Page header ── */
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.1rem; }
.page-head h1 { font-size: 1.4rem; font-weight: 700; margin: 0; }
.page-head .subtitle { color: var(--muted); font-size: .85rem; }

/* ── Cards ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 1.1rem; }
.stat-card { display: flex; align-items: center; gap: 1rem; }
.stat-card .icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; color: #fff; }
.stat-card .value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-card .label { color: var(--muted); font-size: .8rem; }

.bg-grad-blue { background: linear-gradient(135deg,#1d6fb8,#0d3b66); }
.bg-grad-green { background: linear-gradient(135deg,#2a9d8f,#1f7a6f); }
.bg-grad-orange { background: linear-gradient(135deg,#f4a261,#e76f51); }
.bg-grad-red { background: linear-gradient(135deg,#e63946,#9d0208); }
.bg-grad-purple { background: linear-gradient(135deg,#7b6cf6,#4a3fc0); }
.bg-grad-teal { background: linear-gradient(135deg,#0fa3b1,#0b7a85); }

/* ── Tables ── */
.table { color: var(--text); margin: 0; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 2px solid var(--border); }
.table td, .table th { vertical-align: middle; border-color: var(--border); }
.table-wrap { overflow-x: auto; }

/* ── Forms ── */
.form-label { font-weight: 600; font-size: .82rem; }
.form-control, .form-select { background: var(--surface); border-color: var(--border); color: var(--text); }
.form-control:focus, .form-select:focus { border-color: var(--brand-2); box-shadow: 0 0 0 .2rem rgba(29,111,184,.15); }

/* ── Auth ── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem;
  background: linear-gradient(135deg, var(--brand) 0%, #0a2e50 100%); }
.auth-card { width: 100%; max-width: 410px; background: var(--surface); border-radius: 16px; padding: 2rem; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.auth-brand {
  text-align: center; margin: -2rem -2rem 1.5rem; padding: 1.75rem 1rem 1.5rem;
  background: linear-gradient(135deg, var(--brand) 0%, #0a2e50 100%);
  border-radius: 16px 16px 0 0;
}
.auth-brand i { font-size: 2.5rem; color: var(--brand-2); }
.auth-brand .brand-logo { height: 110px; width: auto; max-width: 100%; margin: 0 auto .5rem; display: block; filter: drop-shadow(0 2px 6px rgba(0,0,0,.3)); }
.auth-brand h1 { font-size: 1.25rem; margin: .4rem 0 0; color: #fff; }
.auth-brand p { color: rgba(255,255,255,.7); font-size: .82rem; margin: .15rem 0 0; }

/* ── Bottom nav (mobile) ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: 62px; background: var(--surface);
  border-top: 1px solid var(--border); display: flex; z-index: 1030;
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--muted); font-size: .68rem;
}
.bottom-nav a i { font-size: 1.2rem; }
.bottom-nav a.active { color: var(--brand-2); }

/* ── Responsive sidebar ── */
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .main { margin-left: 0; }
}

/* ── Print ── */
@media print {
  .sidebar, .topbar, .bottom-nav, .no-print, .btn { display: none !important; }
  .main { margin: 0 !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  .content { padding: 0; }
}
.print-only { display: none; }
@media print { .print-only { display: block; } }
