/* ==========================================================================
   PUMS Pro-Bill – design system
   ========================================================================== */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../vendor/inter/inter-latin-wght-normal.woff2") format("woff2"); }

:root {
  --brand: #1b3a8f; --brand-600: #162f75; --brand-700: #10245c; --brand-50: #eef2fb; --brand-100: #dbe4f7;
  --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --line: #e6e9f2; --bg: #f4f6fb; --card: #fff;
  --elec: #f59f00; --elec-50: #fff6e0; --water: #1c7ed6; --water-50: #e7f2fd; --sewer: #7048e8; --sewer-50: #f0ebff;
  --ok: #12b76a; --ok-50: #e8f8f0; --warn: #f79009; --warn-50: #fff4e5; --bad: #f04438; --bad-50: #feeceb;
  --radius: 14px; --sidebar-w: 268px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px -12px rgba(16, 24, 40, .18);
  --bs-primary: #1b3a8f; --bs-primary-rgb: 27, 58, 143; --bs-link-color: #1b3a8f; --bs-link-color-rgb: 27, 58, 143;
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-border-color: #e6e9f2; --bs-body-color: #0f172a;
}
html, body { font-family: var(--bs-body-font-family); }
body { background: var(--bg); font-size: .9rem; color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; } a:hover { color: var(--brand-600); text-decoration: underline; }
.text-muted { color: var(--muted) !important; }
.fw-600 { font-weight: 600; }

/* ---------- Shell ---------- */
.app-shell { min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: #fff; border-right: 1px solid var(--line); position: sticky; top: 0;
  height: 100vh; overflow-y: auto; flex-shrink: 0; display: flex; flex-direction: column; }
.sidebar::-webkit-scrollbar { width: 6px; } .sidebar::-webkit-scrollbar-thumb { background: #dde2ee; border-radius: 6px; }
.sidebar .brand { padding: 1.15rem 1.35rem .9rem; display: flex; align-items: center; gap: .6rem; }
.sidebar .brand img { height: 40px; }
.sidebar .brand .app { font-size: .66rem; font-weight: 700; color: var(--muted); letter-spacing: .12em;
  text-transform: uppercase; border-left: 1px solid var(--line); padding-left: .6rem; line-height: 1.15; }
.cta-cycle { margin: .2rem 1rem .6rem; display: flex; align-items: center; gap: .55rem; padding: .62rem .85rem;
  border-radius: 12px; background: linear-gradient(135deg, var(--brand), #2f59c9); color: #fff !important;
  font-weight: 600; box-shadow: 0 6px 16px -6px rgba(27, 58, 143, .55); text-decoration: none !important; }
.cta-cycle:hover { filter: brightness(1.06); }
.cta-cycle small { display: block; font-weight: 400; opacity: .8; font-size: .72rem; }
.nav-section { text-transform: uppercase; font-size: .66rem; letter-spacing: .1em; color: #94a3b8;
  padding: 1rem 1.35rem .3rem; font-weight: 700; }
.sidebar .nav-link { color: var(--ink-2); padding: .42rem .85rem; margin: 1px .75rem; border-radius: 9px;
  font-size: .86rem; font-weight: 500; display: flex; align-items: center; gap: .65rem; }
.sidebar .nav-link i { font-size: 1.02rem; color: #8a97ad; width: 1.1rem; text-align: center; }
.sidebar .nav-link:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.sidebar .nav-link.active { background: var(--brand-50); color: var(--brand); font-weight: 600; }
.sidebar .nav-link.active i { color: var(--brand); }
.sidebar .user-card { margin-top: auto; border-top: 1px solid var(--line); padding: .85rem 1rem; display: flex;
  gap: .65rem; align-items: center; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-100); color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; flex-shrink: 0; }
.sidebar-offcanvas { width: var(--sidebar-w) !important; }
.sidebar-offcanvas .sidebar { display: flex !important; position: static; height: 100%; border: 0; width: 100%; }
.main-col { min-width: 0; }
.topbar { background: rgba(255, 255, 255, .86); backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid var(--line);
  padding: .6rem 1.5rem; position: sticky; top: 0; z-index: 1020; }
.search-pill { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: .2rem .4rem .2rem .9rem;
  display: flex; align-items: center; gap: .5rem; max-width: 440px; flex: 1; }
.search-pill input { border: 0; background: transparent; outline: none; flex: 1; font-size: .86rem; padding: .3rem 0; }
.search-pill kbd { background: #fff; color: var(--muted); border: 1px solid var(--line); font-size: .7rem; }
.role-badge { background: var(--brand-50); color: var(--brand); border-radius: 999px; padding: .25rem .7rem; font-size: .74rem; font-weight: 600; }
main.content { padding: 1.6rem 1.75rem 3rem; max-width: 1680px; }

/* ---------- Page header ---------- */
.page-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-bottom: 1.35rem; }
.page-head h1 { font-size: 1.5rem; margin: 0; font-weight: 700; letter-spacing: -.02em; }
.page-head .eyebrow { font-size: .76rem; color: var(--muted); font-weight: 500; margin-bottom: .2rem; }
.page-head .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ---------- Cards ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--card); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); font-weight: 600; padding: .9rem 1.15rem;
  display: flex; align-items: center; gap: .5rem; }
.card-header:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.card-header .sub { font-weight: 400; color: var(--muted); font-size: .8rem; }
.card-body { padding: 1.15rem; }
.stat { padding: 1.05rem 1.15rem; display: flex; gap: .9rem; align-items: flex-start; height: 100%; }
.stat .ico { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0; background: var(--brand-50); color: var(--brand); }
.stat .v { font-size: 1.45rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; color: var(--ink); }
.stat .l { color: var(--muted); font-size: .76rem; font-weight: 500; margin-top: .1rem; }
.stat .d { font-size: .74rem; margin-top: .25rem; }
.ico-elec { background: var(--elec-50) !important; color: var(--elec) !important; }
.ico-water { background: var(--water-50) !important; color: var(--water) !important; }
.ico-sewer { background: var(--sewer-50) !important; color: var(--sewer) !important; }
.ico-ok { background: var(--ok-50) !important; color: var(--ok) !important; }
.ico-bad { background: var(--bad-50) !important; color: var(--bad) !important; }
.ico-warn { background: var(--warn-50) !important; color: var(--warn) !important; }

/* ---------- Hero ---------- */
.hero { border-radius: 18px; padding: 1.5rem 1.6rem; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(1200px 300px at 90% -40%, rgba(255,255,255,.18), transparent 60%),
              linear-gradient(120deg, #10245c 0%, #1b3a8f 55%, #2f62d6 100%); box-shadow: var(--shadow-lg); }
.hero h2 { font-weight: 700; letter-spacing: -.02em; font-size: 1.45rem; margin: 0; }
.hero p { opacity: .82; margin: .3rem 0 0; }
.hero .btn-light { color: var(--brand); font-weight: 600; }
.hero-wave { position: absolute; right: -40px; bottom: -60px; font-size: 13rem; opacity: .06; }

/* ---------- Stepper ---------- */
.stepper { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
.step { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: .95rem 1rem; display: flex;
  gap: .75rem; align-items: flex-start; position: relative; color: var(--ink); text-decoration: none !important; }
.step .n { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; background: var(--bg); color: var(--muted); flex-shrink: 0; border: 1px solid var(--line); }
.step .t { font-weight: 600; font-size: .9rem; } .step .s { font-size: .76rem; color: var(--muted); }
.step.done .n { background: var(--ok); color: #fff; border-color: var(--ok); }
.step.active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.step.active .n { background: var(--brand); color: #fff; border-color: var(--brand); }
.hero .step { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); color: #fff; }
.hero .step .s { color: rgba(255,255,255,.72); }
.hero .step .n { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.25); }
.hero .step.done .n { background: #34d399; border-color: #34d399; color: #064e3b; }
.hero .step.active { background: #fff; color: var(--ink); box-shadow: none; }
.hero .step.active .s { color: var(--muted); }
@media (max-width: 991px) { .stepper { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Tables ---------- */
.table { font-size: .855rem; margin-bottom: 0; --bs-table-hover-bg: #f8faff; }
.table > :not(caption) > * > * { padding: .62rem .85rem; border-bottom-color: #eef0f6; }
.table thead th { background: #f8f9fc; color: var(--muted); font-weight: 600; font-size: .7rem; text-transform: uppercase;
  letter-spacing: .06em; white-space: nowrap; border-bottom: 1px solid var(--line); }
.table-sm > :not(caption) > * > * { padding: .45rem .7rem; }
.card > .table-responsive > .table tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- Buttons / forms ---------- */
.btn { border-radius: 10px; font-weight: 500; font-size: .86rem; padding: .45rem .9rem; }
.btn-sm { border-radius: 8px; font-size: .8rem; padding: .28rem .65rem; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-600);
  --bs-btn-hover-border-color: var(--brand-600); --bs-btn-active-bg: var(--brand-700); --bs-btn-disabled-bg: var(--brand); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand-100); --bs-btn-hover-bg: var(--brand);
  --bs-btn-hover-border-color: var(--brand); }
.btn-outline-secondary { --bs-btn-color: var(--ink-2); --bs-btn-border-color: var(--line); --bs-btn-hover-bg: var(--bg);
  --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: #d3d8e4; background: #fff; }
.btn-success { --bs-btn-bg: #12b76a; --bs-btn-border-color: #12b76a; --bs-btn-hover-bg: #0e9f5c; --bs-btn-hover-border-color: #0e9f5c; }
.form-control, .form-select { border-radius: 10px; border-color: #d9deea; font-size: .87rem; padding: .45rem .75rem; }
.form-control:focus, .form-select:focus { border-color: #8aa4e6; box-shadow: 0 0 0 3px var(--brand-100); }
.form-control-sm, .form-select-sm { border-radius: 8px; font-size: .8rem; }
.form-label { font-weight: 600; font-size: .8rem; margin-bottom: .3rem; color: var(--ink-2); }
.form-text { font-size: .74rem; color: var(--muted); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

/* ---------- Badges / pills ---------- */
.badge { font-weight: 600; border-radius: 999px; padding: .32em .7em; letter-spacing: .01em; }
.pill { display: inline-flex; align-items: center; gap: .3rem; border-radius: 999px; padding: .18rem .6rem; font-size: .74rem; font-weight: 600; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-ok { background: var(--ok-50); color: #067647; } .pill-bad { background: var(--bad-50); color: #b42318; }
.pill-warn { background: var(--warn-50); color: #b54708; } .pill-info { background: var(--brand-50); color: var(--brand); }
.pill-muted { background: #f1f3f8; color: var(--muted); }
.badge-util-E { background: var(--elec-50) !important; color: #b76e00 !important; }
.badge-util-W { background: var(--water-50) !important; color: #1864ab !important; }
.badge-util-S { background: var(--sewer-50) !important; color: #5f3dc4 !important; }
.badge-util-G { background: #fff0e6 !important; color: #d9480f !important; }
.status-SUCCESSFUL { color: #067647; font-weight: 500; } .status-fail { color: #b42318; font-weight: 500; }

/* ---------- Tabs ---------- */
.nav-tabs { border-bottom: 1px solid var(--line); gap: .25rem; }
.nav-tabs .nav-link { border: 0; color: var(--muted); font-weight: 500; padding: .65rem .9rem; border-bottom: 2px solid transparent; }
.nav-tabs .nav-link:hover { color: var(--ink); border-color: transparent; text-decoration: none; }
.nav-tabs .nav-link.active { color: var(--brand); background: transparent; border-bottom: 2px solid var(--brand); font-weight: 600; }
.nav-tabs + .card { border-top-left-radius: 0; border-top-right-radius: 0; border-top: 0; }

/* ---------- Misc ---------- */
.progress { background: #eef0f6; border-radius: 999px; }
.alert { border-radius: 12px; border: 0; font-size: .86rem; }
.alert-success { background: var(--ok-50); color: #05603a; } .alert-danger { background: var(--bad-50); color: #912018; }
.alert-warning { background: var(--warn-50); color: #93370d; } .alert-info { background: var(--brand-50); color: var(--brand-700); }
.tree ul { list-style: none; padding-left: 1.1rem; border-left: 1px dashed #cbd3e3; margin-left: .45rem; }
.tree li { margin: .25rem 0; }
.thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 8px; }
.sticky-actions { position: sticky; bottom: 0; background: rgba(244, 246, 251, .92); backdrop-filter: blur(6px); padding: .75rem 0; z-index: 5; }
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.empty i { font-size: 2rem; display: block; margin-bottom: .5rem; color: #b8c2d6; }
.kv dt { color: var(--muted); font-weight: 500; font-size: .8rem; } .kv dd { font-weight: 500; }
.warn-list li { font-size: .84rem; }
.chart-box { position: relative; height: 260px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
@media (max-width: 767px) { main.content { padding: 1rem; } .topbar { padding: .5rem 1rem; } }
@media print { .sidebar, .topbar, .no-print { display: none !important; } main.content { padding: 0; } }
