:root {
  --brand: #0b3d91;
  --brand-2: #1257c7;
  --brand-ink: #ffffff;
  --accent: #f5a623;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --ink: #1b2333;
  --muted: #667085;
  --line: #e4e7ec;
  --ok: #12804a;
  --ok-bg: #e7f6ee;
  --bad: #c62828;
  --bad-bg: #fdecec;
  --warn: #b25e00;
  --warn-bg: #fff4e0;
  --series-1: #2a78d6;
  --series-rest: #c9ced8;
  --radius: 14px;
  --sidebar-w: 248px;
}

html, body { height: 100%; }
body.app { background: var(--bg); color: var(--ink); font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--brand) 0%, #082a66 100%);
  color: var(--brand-ink); padding: 18px 14px; z-index: 1030;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; padding: 4px 8px 18px; }
.brand strong { display: block; font-size: 15px; line-height: 1.1; }
.brand small { display: block; font-size: 12px; opacity: .75; }
.brand-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--accent); color: #1b1b1b;
  display: grid; place-items: center; font-size: 18px; flex: 0 0 auto; }
.sidebar .nav-link, .sidebar-mobile .nav-link {
  color: rgba(255,255,255,.82); border-radius: 10px; padding: 10px 12px; display: flex; align-items: center; gap: 12px; font-size: 14.5px; margin-bottom: 2px;
}
.sidebar .nav-link:hover, .sidebar-mobile .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar .nav-link.active, .sidebar-mobile .nav-link.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.sidebar-foot { opacity: .6; padding: 8px 12px; }
.sidebar-mobile { background: var(--brand); color: #fff; width: 270px !important; }

/* ---------- Main ---------- */
.main { min-height: 100%; display: flex; flex-direction: column; }
@media (min-width: 992px) { .main { margin-left: var(--sidebar-w); } }
.topbar { position: sticky; top: 0; z-index: 1020; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 10px 20px; }
.page-title { font-size: 19px; font-weight: 650; margin: 0; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 600; }
.content { padding: 22px 20px; flex: 1; }
@media (min-width: 1200px) { .content { padding: 26px 30px; } }
.app-footer { padding: 14px 30px; border-top: 1px solid var(--line); }

/* ---------- Cards ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); font-weight: 600; padding: 14px 18px; }
.stat-card { padding: 18px; display: flex; gap: 14px; align-items: center; height: 100%; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; flex: 0 0 auto; }
.stat-label { color: var(--muted); font-size: 13px; margin-bottom: 2px; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12.5px; color: var(--muted); }
.bg-soft-blue { background: #e8f0fd; color: var(--brand-2); }
.bg-soft-green { background: var(--ok-bg); color: var(--ok); }
.bg-soft-amber { background: var(--warn-bg); color: var(--warn); }
.bg-soft-purple { background: #f0ecfd; color: #5b3fc4; }
.bg-soft-red { background: var(--bad-bg); color: var(--bad); }

.progress-thin { height: 8px; border-radius: 6px; background: #eef1f5; }
.progress-thin .progress-bar { background: var(--series-1); border-radius: 6px; }

/* ---------- Tables ---------- */
.table > :not(caption) > * > * { padding: .7rem .8rem; }
.table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #f9fafb; white-space: nowrap; }
.table td { vertical-align: middle; }
.receipt { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-weight: 600; letter-spacing: .02em; }
.badge-status { font-weight: 600; padding: .4em .7em; border-radius: 999px; font-size: 12px; }
.badge-entered { background: var(--ok-bg); color: var(--ok); }
.badge-pending { background: #eef1f5; color: #475467; }
.badge-approved { background: var(--ok-bg); color: var(--ok); }
.badge-duplicate { background: var(--bad-bg); color: var(--bad); }
.badge-invalid { background: var(--warn-bg); color: var(--warn); }
.badge-reset { background: #eef1f5; color: #475467; }

.filter-bar .form-control, .filter-bar .form-select { min-width: 140px; }

/* ---------- Verify screen ---------- */
.verify-wrap { max-width: 860px; margin: 0 auto; }
.scan-box { background: var(--surface); border-radius: 18px; border: 1px solid var(--line); padding: 18px; }
.scan-input { font-size: 28px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; height: 68px; border-radius: 12px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.scan-input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 .3rem rgba(18,87,199,.18); }
.scan-btn { height: 68px; font-size: 18px; font-weight: 700; border-radius: 12px; padding: 0 26px; }
.scan-hint { font-size: 13px; color: var(--muted); }
.scan-hint .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #98a2b3; margin-right: 6px; }
.scan-hint.ready .dot { background: var(--ok); box-shadow: 0 0 0 4px rgba(18,128,74,.15); }

.result { border-radius: 18px; padding: 22px; margin-top: 18px; border: 3px solid transparent; display: none; }
.result.show { display: block; animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.98); opacity: .4; } to { transform: none; opacity: 1; } }
.result .r-head { display: flex; align-items: center; gap: 14px; font-size: clamp(22px, 4.6vw, 38px); font-weight: 800; line-height: 1.1; letter-spacing: .01em; }
.result .r-head i { font-size: 1.15em; }
.result .r-msg { font-size: 15px; margin-top: 6px; font-weight: 500; }
.result.approved  { background: var(--ok);  color: #fff; border-color: #0b5e35; }
.result.duplicate { background: var(--bad); color: #fff; border-color: #8e1515; }
.result.invalid   { background: #1f2937;   color: #fff; border-color: #f5a623; }
.result.error     { background: var(--warn-bg); color: var(--warn); border-color: #f1c27d; }
.r-details { background: rgba(255,255,255,.96); color: var(--ink); border-radius: 12px; margin-top: 16px; padding: 14px 18px; }
.r-details dt { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.r-details dd { font-size: 20px; font-weight: 700; margin-bottom: 10px; word-break: break-word; }
.r-details .big-name { font-size: clamp(22px, 4vw, 30px); }
.result.duplicate .r-details .prev { color: var(--bad); }

.mini-stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; text-align: center; }
.mini-stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.mini-stat span { font-size: 12px; color: var(--muted); }

.recent-list .item { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 14px; }
.recent-list .item:last-child { border-bottom: 0; }
.recent-list .ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 auto; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 10% -10%, #1d5fd1 0%, transparent 60%), linear-gradient(160deg, #0b3d91, #061f4f); }
.login-card { width: 100%; max-width: 410px; border-radius: 20px; border: 0; box-shadow: 0 20px 50px rgba(0,0,0,.25); }

/* ---------- Charts ---------- */
.chart-box { position: relative; height: 260px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: middle; }

@media (max-width: 575.98px) {
  .content { padding: 14px 12px; }
  .scan-input { font-size: 22px; height: 60px; }
  .scan-btn { height: 60px; width: 100%; }
  .stat-value { font-size: 22px; }
}
