/* src/public/css/admin.css
   Look of the Admin Panel (on top of Bootstrap 5.3).
   - Colours are CSS variables ("tokens") on :root; dark mode changes only the tokens.
   - Dark navy sidebar, light page, white rounded cards, indigo accent.
   - No inline styles anywhere (the Content Security Policy blocks them): widths of bars and
     heights of chart columns are set by admin.js from data-w / data-h attributes. */

/* ---------- 1. Tokens ---------- */
:root {
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bg: #f4f5fa;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --border: #e6e8f0;
  --text: #121528;
  --muted: #6b7088;
  --primary: #4f46e5;
  --primary-2: #6366f1;
  --primary-soft: #eef0ff;
  --primary-border: #c7cbff;
  --green: #059669;   --green-soft: #e6f7ef;
  --amber: #c2410c;   --amber-soft: #fff1e3;
  --red: #dc2626;     --red-soft: #fdecec;
  --teal: #0d9488;    --teal-soft: #e3f5f2;
  --yellow: #ca8a04;  --yellow-soft: #fdf6dc;
  --shadow: 0 1px 2px rgba(18, 21, 40, .04), 0 4px 16px rgba(18, 21, 40, .04);
  --radius: 16px;
  --sidebar-w: 268px;
  --side-bg: linear-gradient(180deg, #1c1a4a 0%, #121033 55%, #0d0b26 100%);
  --side-text: #c9cbe6;
  --side-muted: #7f82a8;

  /* Bootstrap variables we want to follow our tokens */
  --bs-body-font-family: var(--font);
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-primary: var(--primary);
  --bs-primary-rgb: 79, 70, 229;
  --bs-link-color: var(--primary);
  --bs-link-color-rgb: 79, 70, 229;
  --bs-link-hover-color: #3730a3;
  --bs-secondary-color: var(--muted);
  --bs-tertiary-bg: var(--surface-2);
}

[data-bs-theme="dark"] {
  --bg: #0e1020;
  --surface: #171a2e;
  --surface-2: #1d2038;
  --border: #2a2e4a;
  --text: #e8e9f5;
  --muted: #9a9dbb;
  --primary: #7c74ff;
  --primary-2: #8b85ff;
  --primary-soft: #25264d;
  --primary-border: #3d3f7a;
  --green: #34d399;   --green-soft: #12302a;
  --amber: #fb923c;   --amber-soft: #36230f;
  --red: #f87171;     --red-soft: #3a1717;
  --teal: #2dd4bf;    --teal-soft: #0f302c;
  --yellow: #facc15;  --yellow-soft: #332b0b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-primary-rgb: 124, 116, 255;
  --bs-link-color: var(--primary);
  --bs-link-color-rgb: 124, 116, 255;
  --bs-link-hover-color: #a5a0ff;
  --bs-secondary-color: var(--muted);
  --bs-tertiary-bg: var(--surface-2);
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: .9375rem;
}
.text-muted, .text-secondary { color: var(--muted) !important; }
a { text-decoration: none; }

/* ---------- 2. Layout: sidebar + main ---------- */
.app-shell { min-height: 100vh; }

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--side-bg);
  color: var(--side-text);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform .2s ease;
}
.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 18px;
  color: #fff;
}
.app-brand:hover { color: #fff; }
.app-brand-logo {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6d65ff, #4f46e5);
  display: grid; place-items: center;
  font-size: 1.25rem;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .45);
}
.app-brand-name { font-weight: 800; font-size: 1.05rem; line-height: 1.1; letter-spacing: -.01em; }
.app-brand-sub { font-size: .75rem; color: var(--side-muted); }

.app-nav { flex: 1; overflow-y: auto; padding: 4px 14px 12px; }
.app-nav::-webkit-scrollbar { width: 6px; }
.app-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 3px; }
.app-nav-heading {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--side-muted);
  padding: 18px 12px 8px;
  margin: 0;
}
.app-nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 2px;
  border-radius: 12px;
  color: var(--side-text);
  font-weight: 500;
  border: 1px solid transparent;
}
.app-nav-link i { font-size: 1.1rem; width: 22px; text-align: center; opacity: .9; }
.app-nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.app-nav-link.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, .32), rgba(99, 102, 241, .12));
  border-color: rgba(129, 140, 248, .35);
  color: #fff;
  font-weight: 600;
}
.app-nav-link.active::before {
  content: '';
  position: absolute;
  left: -14px; top: 10px; bottom: 10px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: #a5b4fc;
}
.app-side-card {
  margin: 8px 16px 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .08);
  display: flex; gap: 12px; align-items: center;
}
.app-side-card i { font-size: 1.3rem; color: #a5b4fc; }
.app-side-card .t1 { color: #fff; font-weight: 600; font-size: .85rem; line-height: 1.2; }
.app-side-card .t2 { color: var(--side-muted); font-size: .75rem; }

.app-main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 32px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.app-crumbs { display: flex; align-items: center; gap: 10px; font-size: .9rem; color: var(--muted); min-width: 0; }
.app-crumbs i.bi-chevron-right { font-size: .7rem; }
.app-crumbs .current { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-crumbs a { color: var(--muted); }
.app-crumbs a:hover { color: var(--text); }
.app-top-actions { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 40px; height: 40px;
  display: inline-grid; place-items: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.icon-btn:hover { border-color: var(--primary-border); color: var(--primary); }

.user-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.user-pill:hover { border-color: var(--primary-border); }
.user-pill .who { text-align: left; line-height: 1.15; }
.user-pill .who .n { font-weight: 700; font-size: .875rem; }
.user-pill .who .r { font-size: .72rem; color: var(--muted); }

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-grid; place-items: center;
  font-weight: 700; font-size: .78rem;
  color: #fff;
  background: linear-gradient(135deg, #7c74ff, #4f46e5);
  flex-shrink: 0;
}
.avatar-sq {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: inline-grid; place-items: center;
  font-weight: 700; font-size: .82rem;
  color: var(--primary);
  background: var(--primary-soft);
  flex-shrink: 0;
}
.avatar-xl {
  width: 64px; height: 64px;
  border-radius: 18px;
  display: inline-grid; place-items: center;
  font-weight: 800; font-size: 1.35rem;
  color: #fff;
  background: linear-gradient(135deg, #7c74ff, #4f46e5);
  box-shadow: 0 10px 24px rgba(79, 70, 229, .35);
  flex-shrink: 0;
}

.act-as-select { min-width: 220px; border-radius: 12px; }

.app-content { flex: 1; padding: 28px 32px 24px; max-width: 1440px; width: 100%; }
.app-footer {
  display: flex; justify-content: space-between;
  padding: 18px 32px 26px;
  color: var(--muted);
  font-size: .82rem;
}

.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); }
  body.sidebar-open .app-sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 1035; background: rgba(10, 10, 30, .45);
  }
  .app-main { margin-left: 0; }
  .app-topbar { padding: 0 16px; }
  .app-content { padding: 20px 16px; }
  .app-footer { padding: 16px; }
  .user-pill .who, .act-as-select { display: none; }
}

/* ---------- 3. Page header ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-eyebrow { color: var(--primary); font-weight: 600; font-size: .85rem; margin-bottom: 4px; }
.page-title, .app-content h1.h4 {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 0;
  color: var(--text);
}
.page-sub { color: var(--muted); margin: 6px 0 0; font-size: .98rem; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .9rem; margin-bottom: 12px; }
.back-link:hover { color: var(--text); }

/* ---------- 4. Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  padding: 16px 20px;
}
.card-header:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.card-body { padding: 20px 22px; }
.panel-title { font-weight: 700; font-size: 1.1rem; margin: 0; }
.panel-sub { color: var(--muted); font-size: .85rem; margin: 2px 0 0; }

/* Stat cards (dashboard numbers) */
.stat {
  position: relative;
  height: 100%;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.stat-label { font-weight: 500; color: var(--text); font-size: .92rem; }
.stat-value { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; margin: 14px 0 4px; line-height: 1.1; }
.stat-value small { font-size: 1rem; font-weight: 600; color: var(--muted); }
.stat-note { color: var(--muted); font-size: .84rem; }
.stat-icon {
  position: absolute; top: 18px; right: 18px;
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 1.1rem;
}
.tone-primary { background: var(--primary-soft); color: var(--primary); }
.tone-amber   { background: var(--amber-soft);   color: var(--amber); }
.tone-green   { background: var(--green-soft);   color: var(--green); }
.tone-teal    { background: var(--teal-soft);    color: var(--teal); }
.tone-red     { background: var(--red-soft);     color: var(--red); }
.tone-yellow  { background: var(--yellow-soft);  color: var(--yellow); }

.stat-hero {
  background: linear-gradient(140deg, #5b52f0 0%, #4338ca 100%);
  border: 0;
  color: #fff;
  box-shadow: 0 12px 30px rgba(79, 70, 229, .35);
}
.stat-hero::after {
  content: '';
  position: absolute; right: -60px; bottom: -80px;
  width: 220px; height: 220px;
  border-radius: 50%;
  border: 28px solid rgba(255, 255, 255, .06);
}
.stat-hero .stat-label, .stat-hero .stat-value { color: #fff; }
.stat-hero .stat-note { color: rgba(255, 255, 255, .8); }
.stat-hero .stat-icon { background: rgba(255, 255, 255, .18); color: #fff; }
.stat-hero .stat-split {
  display: flex; gap: 18px;
  border-top: 1px solid rgba(255, 255, 255, .18);
  margin-top: 16px; padding-top: 12px;
  font-size: .84rem; color: rgba(255, 255, 255, .9);
}

/* ---------- 5. Chips, badges, pills ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: .78rem; font-weight: 600;
  white-space: nowrap;
}
.chip-green  { background: var(--green-soft);   color: var(--green); }
.chip-amber  { background: var(--amber-soft);   color: var(--amber); }
.chip-red    { background: var(--red-soft);     color: var(--red); }
.chip-primary{ background: var(--primary-soft); color: var(--primary); }
.chip-muted  { background: var(--surface-2);    color: var(--muted); border: 1px solid var(--border); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: currentColor; }
.status-dot { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .88rem; }
.status-dot .dot { width: 8px; height: 8px; }
.status-dot.on .dot { background: var(--green); }
.status-dot.off .dot { background: var(--muted); }

.badge { font-weight: 600; border-radius: 999px; padding: .38em .75em; }
.badge.bg-success { background: var(--green-soft) !important; color: var(--green) !important; }
.badge.bg-danger  { background: var(--red-soft) !important;   color: var(--red) !important; }
.badge.bg-warning { background: var(--amber-soft) !important; color: var(--amber) !important; }
.badge.bg-secondary { background: var(--surface-2) !important; color: var(--muted) !important; border: 1px solid var(--border); }
.badge.bg-primary, .badge.bg-info { background: var(--primary-soft) !important; color: var(--primary) !important; }

/* Quick range buttons (Today / Yesterday / ...) */
.quick-ranges { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-range {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: .84rem; font-weight: 500;
}
.quick-range:hover { border-color: var(--primary-border); }
.quick-range.active { background: var(--primary-soft); border-color: var(--primary-border); color: var(--primary); }

/* Attention strip */
.attention {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  padding: 12px 16px;
  border: 1.5px dashed var(--border);
  border-radius: 14px;
  background: var(--surface);
  margin-bottom: 22px;
  font-weight: 600; font-size: .9rem;
}
.attention a.chip:hover { filter: brightness(.97); }

/* ---------- 6. Progress bars + bar chart ---------- */
.meter { height: 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.meter > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--primary); transition: width .4s ease; }
.meter.warn > span { background: #f59e0b; }
.meter.over > span { background: var(--red); }

.bar-chart {
  position: relative;
  display: flex; align-items: flex-end; gap: 10px;
  height: 220px;
  padding: 24px 0 0 48px;
  border-bottom: 1px solid var(--border);
}
.bar-grid { position: absolute; top: 24px; bottom: 0; left: 0; right: 0; }
.bar-chart .grid-line {
  position: absolute; left: 48px; right: 0;
  border-top: 1px solid var(--border);
}
.bar-chart .grid-label {
  position: absolute; left: 0; width: 42px;
  font-size: .68rem; color: var(--muted);
  transform: translateY(-50%);
  text-align: right;
}
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; z-index: 1; }
.bar-col .bar {
  width: 100%; max-width: 24px;
  height: 0;
  min-height: 0;
  border-radius: 4px 4px 0 0;
  background: #c7c9f7;
  transition: height .4s ease;
}
[data-bs-theme="dark"] .bar-col .bar { background: #4b4a9a; }
.bar-col .bar.has { min-height: 3px; }
.bar-col.peak .bar { background: var(--primary-2); }
.bar-col .bar-tip { font-size: .66rem; font-weight: 700; margin-bottom: 4px; white-space: nowrap; }
.bar-axis { display: flex; gap: 10px; padding-left: 48px; margin-top: 8px; }
.bar-axis span { flex: 1; min-width: 0; text-align: center; font-size: .64rem; color: var(--muted); white-space: nowrap; overflow: visible; letter-spacing: -.01em; }
@media (max-width: 1199.98px) { .bar-axis span:nth-child(even):not(.today) { visibility: hidden; } }
.bar-axis span.today { color: var(--text); font-weight: 700; }
.legend { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .8rem; }
.legend::before { content: ''; width: 9px; height: 9px; border-radius: 3px; background: var(--primary-2); }
.panel-foot { border-top: 1px solid var(--border); padding: 12px 22px; font-weight: 500; }

/* Ranked lists (top customers, renewals, exceptions) */
.rank-row { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; }
.rank-row + .rank-row { border-top: 1px solid var(--border); }
.rank-no {
  width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 700; font-size: .85rem;
  background: var(--surface-2); color: var(--muted); flex-shrink: 0;
}
.rank-no.first { background: var(--yellow-soft); color: var(--yellow); }
.rank-main { flex: 1; min-width: 0; }
.rank-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-sub { color: var(--muted); font-size: .82rem; margin-top: 2px; }
.empty-note { color: var(--muted); padding: 28px 0; text-align: center; font-size: .9rem; }

/* ---------- 7. Tables ---------- */
.table { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-hover-bg: var(--surface-2); --bs-table-hover-color: var(--text); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .75rem .9rem; border-bottom-color: var(--border); }
.table-sm > :not(caption) > * > * { padding: .6rem .85rem; }
.table thead th, .table-light th {
  background: transparent !important;
  color: var(--muted) !important;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table tfoot td, .table-secondary td, tr.table-light td { background: var(--surface-2) !important; color: var(--text) !important; }
.app-content .table-responsive {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.app-content .table-responsive > .table > tbody > tr:last-child > * { border-bottom: 0; }
.card .table-responsive { border: 0; box-shadow: none; border-radius: 0; }
.table-foot { padding: 14px 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: .88rem; }
.table-foot strong { color: var(--text); }
.row-link { color: inherit; }
.chev-btn {
  width: 34px; height: 34px; border-radius: 10px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--border); color: var(--muted); background: var(--surface);
}
.chev-btn:hover { color: var(--primary); border-color: var(--primary-border); }
.num { text-align: right; white-space: nowrap; }
/* Report tables: one line per cell (dates, ticket numbers, money); only the ticket lines column wraps */
.report-table td, .report-table th { white-space: nowrap; }
.report-table { font-size: .86rem; }
.report-table > :not(caption) > * > * { padding: .6rem .65rem; }
.report-table .line-item { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .88rem; }

/* ---------- 8. Forms + buttons ---------- */
.form-label { font-weight: 600; font-size: .88rem; color: var(--text); margin-bottom: 6px; }
.form-control, .form-select {
  border-radius: 12px;
  border-color: var(--border);
  background-color: var(--surface);
  color: var(--text);
  padding: .6rem .9rem;
}
.form-control-sm, .form-select-sm { border-radius: 10px; padding: .4rem .75rem; }
.form-control:focus, .form-select:focus { border-color: var(--primary-2); box-shadow: 0 0 0 4px rgba(99, 102, 241, .15); }
.form-text { color: var(--muted); }
.search-box { position: relative; }
.search-box i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box .form-control { padding-left: 40px; }

.btn { border-radius: 12px; font-weight: 600; padding: .55rem 1rem; }
.btn-sm { border-radius: 10px; padding: .35rem .75rem; }
.btn-primary {
  --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: #4338ca; --bs-btn-hover-border-color: #4338ca;
  --bs-btn-active-bg: #3730a3; --bs-btn-active-border-color: #3730a3;
  --bs-btn-disabled-bg: var(--primary); --bs-btn-disabled-border-color: var(--primary);
}
.btn-primary.btn-glow { box-shadow: 0 8px 20px rgba(79, 70, 229, .35); }
.btn-outline-primary {
  --bs-btn-color: var(--primary); --bs-btn-border-color: var(--primary-border);
  --bs-btn-hover-bg: var(--primary-soft); --bs-btn-hover-color: var(--primary); --bs-btn-hover-border-color: var(--primary-border);
  --bs-btn-active-bg: var(--primary-soft); --bs-btn-active-color: var(--primary);
}
.btn-outline-secondary, .btn-light {
  --bs-btn-color: var(--text); --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--border);
  --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-color: var(--text); --bs-btn-hover-border-color: var(--primary-border);
  --bs-btn-active-bg: var(--surface-2); --bs-btn-active-color: var(--text);
  box-shadow: var(--shadow);
}
.btn-outline-danger { --bs-btn-border-color: #f3c0c0; }
.btn-success { --bs-btn-bg: #059669; --bs-btn-border-color: #059669; --bs-btn-hover-bg: #047857; --bs-btn-hover-border-color: #047857; }

/* ---------- 9. Tabs (pill style) ---------- */
.pill-tabs, .app-content .nav-tabs {
  display: flex; flex-wrap: nowrap; gap: 4px;
  overflow-x: auto;
  padding: 6px;
  margin-bottom: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.pill-tabs .nav-link, .app-content .nav-tabs .nav-link {
  display: inline-flex; align-items: center; gap: 8px;
  white-space: nowrap;
  border: 0;
  border-radius: 10px;
  padding: 8px 14px;
  color: var(--text);
  font-weight: 500;
  margin: 0;
}
.pill-tabs .nav-link:hover, .app-content .nav-tabs .nav-link:hover { background: var(--surface-2); }
.pill-tabs .nav-link.active, .app-content .nav-tabs .nav-link.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 14px rgba(79, 70, 229, .3);
}

/* ---------- 10. Reports: report picker ---------- */
.report-picker { padding: 8px; }
.report-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: var(--text);
}
.report-item + .report-item { margin-top: 2px; }
.report-item:hover { background: var(--surface-2); color: var(--text); }
.report-item .ri-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
  flex-shrink: 0;
}
.report-item .ri-title { font-weight: 600; display: block; }
.report-item .ri-sub { display: block; color: var(--muted); font-size: .8rem; line-height: 1.35; margin-top: 2px; }
.report-item.active { background: var(--primary-soft); border-color: var(--primary-border); }
.report-item.active .ri-icon { background: var(--primary); color: #fff; }
.report-sum { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.report-sum .sum {
  flex: 1 1 140px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.report-sum .sum .l { color: var(--muted); font-size: .8rem; }
.report-sum .sum .v { font-weight: 800; font-size: 1.2rem; }

/* ---------- 11. Detail lists + quick links ---------- */
.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; }
.kv .k { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.kv .v { font-weight: 500; word-break: break-word; }
@media (max-width: 575.98px) { .kv-grid { grid-template-columns: 1fr; } }

.quick-link {
  display: flex; align-items: center; gap: 14px;
  padding: 16px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--text);
  font-weight: 600;
  height: 100%;
  width: 100%;
  text-align: left;
}
.quick-link:hover { border-color: var(--primary-border); color: var(--text); }
.quick-link .ql-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.quick-link .bi-chevron-right { margin-left: auto; color: var(--muted); font-size: .8rem; }

.sub-box { border: 1px solid var(--border); background: var(--surface-2); border-radius: 14px; padding: 18px; }
.cust-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.cust-meta { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; color: var(--muted); font-size: .88rem; margin-top: 6px; }

/* ---------- 12. Misc ---------- */
.alert { border-radius: 14px; border: 1px solid var(--border); }
.dropdown-menu { border-radius: 14px; border-color: var(--border); box-shadow: 0 12px 32px rgba(18, 21, 40, .12); padding: 6px; background: var(--surface); }
.dropdown-item { border-radius: 8px; padding: 8px 12px; color: var(--text); }
.dropdown-item:hover { background: var(--surface-2); color: var(--text); }
.pagination { --bs-pagination-border-radius: 10px; --bs-pagination-active-bg: var(--primary); --bs-pagination-active-border-color: var(--primary); --bs-pagination-color: var(--primary); --bs-pagination-bg: var(--surface); --bs-pagination-border-color: var(--border); margin-top: 14px; }
.modal-content { border-radius: var(--radius); background: var(--surface); }
.payload { max-height: 300px; overflow: auto; font-size: .75rem; background: var(--surface-2); padding: .5rem; border-radius: 10px; }
.inline-form { display: inline-block; }
.min-w-0 { min-width: 0; }

/* Login page */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login-art { background: var(--side-bg); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art h2 { font-weight: 800; font-size: 2.2rem; letter-spacing: -.02em; max-width: 420px; }
.login-art p { color: var(--side-text); max-width: 420px; }
.login-panel { display: grid; place-items: center; padding: 32px 16px; }
.login-card { width: 100%; max-width: 400px; }
@media (max-width: 991.98px) { .login-wrap { grid-template-columns: 1fr; } .login-art { display: none; } }

/* Print-friendly view: hide menus and buttons */
@media print {
  .no-print, .btn, form.no-print, .app-sidebar, .app-topbar, .app-footer, .report-picker-col { display: none !important; }
  .app-main { margin: 0 !important; }
  .app-content { padding: 0 !important; }
  .report-main-col { width: 100% !important; flex: 0 0 100% !important; max-width: 100% !important; }
  body { background: #fff; }
}
