/* ============================================================
   IT&E Electric Ghana — Employee Portal
   Design system — glass chrome, solid docket
   ============================================================ */

:root{
  --paper:#E7ECF3;  --paper-deep:#D5DDE8;
  --surface:#FFFFFF; --surface-sunk:#F4F6FA;
  --ink:#101E31;     --ink-2:#48576B;  --ink-3:#7A889B;
  --line:#D2DAE5;    --line-soft:#E3E9F1;

  --neutral:#2A5EA8;  --neutral-wash:#E4EDFA;
  --live:#8A5310;     --live-wash:#F6EBDC;
  --earth:#15694A;    --earth-wash:#DFF0E7;
  --fault:#A3221B;    --fault-wash:#FAE4E2;

  --glass:rgba(255,255,255,.60);
  --glass-solid:#F2F5FA;
  --glass-edge:rgba(255,255,255,.85);
  --glass-shade:0 1px 2px rgba(16,30,49,.07), 0 14px 34px -10px rgba(16,30,49,.22);
  --spec:rgba(255,255,255,.9);

  --blur:20px;
  --r-sm:8px; --r-md:10px; --r-lg:16px; --r-pill:999px;
  --tap:44px;
}

*{ box-sizing:border-box; }

html,body{ margin:0; padding:0; }

body{
  font-family:"Archivo","Segoe UI",system-ui,-apple-system,sans-serif;
  font-size:16px;
  line-height:1.55;
  color:var(--ink);
  background:var(--paper);
  background-image:
    radial-gradient(60rem 30rem at 12% -8%,
      color-mix(in srgb, var(--neutral) 14%, transparent), transparent 70%),
    radial-gradient(48rem 28rem at 96% 4%,
      color-mix(in srgb, var(--live) 10%, transparent), transparent 72%);
  background-attachment:fixed;
  min-height:100vh;
}

/* ---------- typography ---------- */

h1{ font-size:clamp(1.6rem,4.5vw,2.2rem); font-weight:700; letter-spacing:-.03em; margin:0 0 12px; }
h2{ font-size:1.4rem;  font-weight:600; letter-spacing:-.02em; margin:0 0 10px; }
h3{ font-size:1.05rem; font-weight:600; margin:0 0 8px; }
p{ margin:0 0 12px; }
a{ color:var(--neutral); text-decoration:none; }
a:hover{ text-decoration:underline; }

.small{ font-size:.86rem; color:var(--ink-2); }
.muted{ color:var(--ink-3); }
.figure{
  font-variant-numeric:tabular-nums;
  font-feature-settings:"tnum" 1;
  letter-spacing:-.015em;
}

/* ---------- glass + docket ---------- */

.glass{
  position:relative;
  background:var(--glass);
  -webkit-backdrop-filter:blur(var(--blur)) saturate(180%);
  backdrop-filter:blur(var(--blur)) saturate(180%);
  border:1px solid var(--glass-edge);
  box-shadow:var(--glass-shade);
}
.glass::before{
  content:"";
  position:absolute; inset:0;
  border-radius:inherit;
  pointer-events:none;
  background:linear-gradient(180deg, var(--spec), transparent 34%);
  opacity:.55;
}
@supports not ((backdrop-filter:blur(2px)) or (-webkit-backdrop-filter:blur(2px))){
  .glass{ background:var(--glass-solid); }
}

.docket{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--r-lg);
  box-shadow:0 1px 2px rgba(16,30,49,.05);
}
.docket.padded{ padding:22px; }

/* ---------- rail ---------- */

.rail{
  position:sticky; top:0; z-index:50;
  border-radius:0 0 var(--r-lg) var(--r-lg);
}
.rail-inner{
  max-width:1200px;
  margin:0 auto;
  padding:14px 20px;
  display:flex;
  align-items:center;
  gap:16px;
}
.rail .mark{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:44px; height:44px;
  border-radius:12px;
  background:var(--ink);
  color:#fff;
  font-weight:700;
  letter-spacing:-.04em;
  text-decoration:none;
  font-size:1rem;
}
.rail .who{
  display:flex;
  flex-direction:column;
  flex:1;
  min-width:0;
}
.rail .who b{
  font-size:1.05rem;
  font-weight:600;
  letter-spacing:-.01em;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.rail .who span{
  font-size:.82rem;
  color:var(--ink-2);
}

/* ---------- layout ---------- */

.shell{
  max-width:1200px;
  margin:0 auto;
  padding:24px 20px 96px;
  display:grid;
  grid-template-columns:220px 1fr;
  gap:24px;
  align-items:start;
}
.main{ min-width:0; }

@media (max-width:900px){
  .shell{ grid-template-columns:1fr; padding-bottom:120px; }
}

/* ---------- sidebar ---------- */

.sidebar{
  border-radius:var(--r-lg);
  padding:10px;
  position:sticky;
  top:84px;
}
.sidebar ul{ list-style:none; margin:0; padding:0; }
.sidebar li{ margin:2px 0; }
.sidebar li.group{
  padding:14px 12px 6px;
  font-size:.72rem;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:var(--ink-3);
  font-weight:600;
}
.sidebar a{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius:10px;
  color:var(--ink);
  font-weight:500;
  font-size:.95rem;
  min-height:var(--tap);
}
.sidebar a:hover{ background:rgba(255,255,255,.55); text-decoration:none; }
.sidebar a.on{ background:#fff; box-shadow:0 1px 3px rgba(16,30,49,.06); }
.sidebar a i{ width:18px; color:var(--ink-2); font-size:.95rem; }

@media (max-width:900px){
  .sidebar{ display:none; }
}

/* ---------- tab bar (mobile) ---------- */

.tabbar{
  display:none;
  position:fixed;
  left:0; right:0; bottom:0;
  z-index:60;
  border-radius:var(--r-lg) var(--r-lg) 0 0;
  padding:8px 6px calc(8px + env(safe-area-inset-bottom));
}
.tabbar a{
  flex:1;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:2px;
  padding:6px 4px;
  color:var(--ink-2);
  font-size:.7rem;
  font-weight:500;
  min-height:var(--tap);
  justify-content:center;
}
.tabbar a i{ font-size:1.1rem; }
.tabbar a:hover{ text-decoration:none; color:var(--ink); }

@media (max-width:900px){
  .tabbar{ display:flex; }
}

/* ---------- buttons ---------- */

.btn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:10px 16px;
  min-height:var(--tap);
  border-radius:var(--r-sm);
  border:1px solid transparent;
  font-family:inherit;
  font-size:.95rem;
  font-weight:600;
  cursor:pointer;
  transition:background .15s, box-shadow .15s, transform .1s;
  text-decoration:none;
  color:var(--ink);
  background:var(--surface);
}
.btn:hover{ text-decoration:none; }
.btn-primary{
  background:var(--neutral);
  color:#fff;
}
.btn-primary:hover{ background:#23509a; }
.btn-quiet{
  background:rgba(255,255,255,.7);
  border-color:var(--line);
}
.btn-quiet:hover{ background:#fff; }
.btn-danger{ background:var(--fault); color:#fff; }
.btn-sm{ padding:8px 12px; min-height:36px; font-size:.86rem; }

/* ---------- forms ---------- */

label{
  display:block;
  margin:12px 0;
}
label > span{
  display:block;
  font-size:.86rem;
  color:var(--ink-2);
  margin-bottom:6px;
  font-weight:500;
}
input, select, textarea{
  width:100%;
  font-family:inherit;
  font-size:1rem;
  color:var(--ink);
  padding:11px 13px;
  min-height:var(--tap);
  border-radius:var(--r-md);
  border:1px solid var(--line);
  background:#fff;
  transition:border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus{
  outline:none;
  border-color:var(--neutral);
  box-shadow:0 0 0 3px var(--neutral-wash);
}

/* ---------- login page ---------- */

.login-page{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
}
.login-wrap{ width:100%; max-width:420px; }
.login-card{
  padding:32px 28px;
}
.login-mark{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:48px; height:48px;
  border-radius:14px;
  background:var(--ink);
  color:#fff;
  font-weight:700;
  margin-bottom:20px;
}
.login-card h1{ font-size:1.5rem; margin:0 0 6px; }
.login-card .btn{ width:100%; justify-content:center; margin-top:8px; }

/* ---------- pill ---------- */

.pill{
  display:inline-flex;
  align-items:center;
  gap:7px;
  padding:4px 10px;
  border-radius:var(--r-pill);
  font-size:.78rem;
  font-weight:600;
  letter-spacing:.01em;
  white-space:nowrap;
}
.pill i{
  display:inline-block;
  width:7px; height:7px;
  border-radius:50%;
  background:currentColor;
}
.pill.draft    { background:var(--neutral-wash); color:var(--neutral); }
.pill.pending  { background:var(--live-wash);    color:var(--live); }
.pill.approved { background:var(--earth-wash);   color:var(--earth); }
.pill.declined { background:var(--fault-wash);   color:var(--fault); }

/* ---------- toast ---------- */

.toast{
  padding:12px 16px;
  border-radius:var(--r-md);
  margin-bottom:16px;
  font-weight:500;
  border:1px solid transparent;
}
.toast.success{
  background:var(--earth-wash);
  border-color:color-mix(in srgb, var(--earth) 30%, transparent);
  color:var(--earth);
}
.toast.error{
  background:var(--fault-wash);
  border-color:color-mix(in srgb, var(--fault) 30%, transparent);
  color:var(--fault);
}

/* ---------- cards (dashboard) ---------- */

.cards{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(200px,1fr));
  gap:14px;
  margin-top:20px;
}
.card{
  background:var(--surface-sunk);
  border:1px solid var(--line-soft);
  border-radius:var(--r-md);
  padding:16px;
}
.card-label{
  font-size:.78rem;
  color:var(--ink-2);
  text-transform:uppercase;
  letter-spacing:.06em;
  margin-bottom:6px;
}
.card-value{
  font-size:1.6rem;
  font-weight:700;
  letter-spacing:-.02em;
  font-variant-numeric:tabular-nums;
}
.card-hint{
  font-size:.82rem;
  color:var(--ink-3);
  margin-top:4px;
}

/* ---------- tables ---------- */

.tbl-scroll{ overflow-x:auto; }
table.tbl{
  width:100%;
  border-collapse:collapse;
  font-size:.95rem;
}
table.tbl th, table.tbl td{
  text-align:left;
  padding:10px 12px;
  border-bottom:1px solid var(--line-soft);
}
table.tbl th{
  font-size:.78rem;
  text-transform:uppercase;
  letter-spacing:.05em;
  color:var(--ink-2);
  font-weight:600;
}
table.tbl td.r, table.tbl th.r{
  text-align:right;
  font-variant-numeric:tabular-nums;
}

/* ---------- Stage 2 — salesperson identity ---------- */

.rail .who.checkin b{ color:var(--live); }
.rail .who .checkin-msg{ color:var(--live); font-weight:600; }

.rail .who.just-identified b{ animation:spGreet 1.2s ease-out; }
@keyframes spGreet{
  0%   { color:var(--earth); }
  100% { color:inherit; }
}
@media (prefers-reduced-motion: reduce){
  .rail .who.just-identified b{ animation:none; }
}

/* ---------- Stage 3 — admin user forms ---------- */

.page-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
}
.page-head h1{ margin:0; }

.gen-row{
  display:flex;
  gap:8px;
  align-items:stretch;
}
.gen-row input{ flex:1; }
.gen-row .btn{ white-space:nowrap; }

.perm-group{
  margin-top:20px;
  padding:16px;
  background:var(--surface-sunk);
  border:1px solid var(--line-soft);
  border-radius:var(--r-md);
}
.perm-title{
  font-size:.85rem;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:.06em;
  color:var(--ink-2);
  margin-bottom:10px;
}

label.check{
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px 4px;
  margin:0;
  cursor:pointer;
  font-size:.95rem;
}
label.check input[type="checkbox"]{
  width:18px;
  height:18px;
  min-height:auto;
  accent-color:var(--neutral);
}
label.check span{
  display:inline;
  color:var(--ink);
  font-size:.95rem;
  font-weight:400;
  margin:0;
}

/* ---------- Stage 5 — sales entry ---------- */

.sale-layout{
  display:grid;
  grid-template-columns:1fr 340px;
  gap:22px;
  align-items:start;
}
@media (max-width:899px){
  .sale-layout{ grid-template-columns:1fr; padding-bottom:180px; }
  body{ padding-bottom:180px; }
}

.grid-2{
  display:grid;
  grid-template-columns:2fr 1fr;
  gap:14px;
}
@media (max-width:600px){
  .grid-2{ grid-template-columns:1fr; }
}

/* Item row — Option B: stacked layout */
.item-row{
  margin-bottom:14px;
  padding-bottom:14px;
  border-bottom:1px solid var(--line-soft);
}
.item-row:last-child{
  border-bottom:none;
  padding-bottom:0;
}
.item-grid{
  display:grid;
  grid-template-columns:1fr 1fr 1fr 1fr 40px;
  gap:10px;
  align-items:end;
}
.item-product{
  grid-column:1 / -1;
}
.item-grid .js-remove-item{
  grid-column:5 / 6;
  align-self:end;
}

@media (max-width:600px){
  .item-grid{
    grid-template-columns:1fr 1fr;
  }
  .item-grid .js-remove-item{
    grid-column:2 / 3;
    justify-self:end;
  }
}

/* Payment row */
.pay-row{ margin-bottom:14px; }
.pay-grid{
  display:grid;
  grid-template-columns:150px 130px 1fr 40px;
  gap:10px;
  align-items:end;
}
@media (max-width:768px){
  .pay-grid{ grid-template-columns:1fr 1fr; }
  .pay-note{ grid-column:1 / -1; }
  .pay-grid .js-remove-payment{ grid-column:2 / 3; justify-self:end; }
}

/* Slab */
.slab{
  border-radius:var(--r-lg);
  padding:18px;
  position:sticky;
  top:84px;
}
.slab-head{
  display:flex;
  flex-direction:column;
  gap:2px;
  padding-bottom:12px;
  border-bottom:1px solid var(--line-soft);
}
.slab-grand{
  font-size:1.9rem;
  font-weight:700;
  letter-spacing:-.03em;
  color:var(--ink);
  margin-bottom:8px;
}
.slab-balance .figure{
  font-size:1.15rem;
  font-weight:600;
  color:var(--live);
}
.slab.bal-clear .slab-balance .figure{ color:var(--earth); }

.slab-lines{
  padding:12px 0;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.slab-lines .line,
.totals .line{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  font-size:.92rem;
}
.totals{
  margin-top:18px;
  padding:16px;
  background:var(--surface-sunk);
  border-radius:var(--r-md);
  display:flex;
  flex-direction:column;
  gap:8px;
}
.totals .line.strong{
  font-size:1.05rem;
  font-weight:600;
  padding-top:8px;
  border-top:1px solid var(--line-soft);
  margin-top:6px;
}

.slab-publish{
  width:100%;
  justify-content:center;
  margin-top:6px;
}

@keyframes slabFlash{
  0%   { box-shadow:0 0 0 0 rgba(42,94,168,.35); }
  100% { box-shadow:0 0 0 14px rgba(42,94,168,0); }
}
.slab.flash{ animation:slabFlash .6s ease-out; }
@media (prefers-reduced-motion: reduce){
  .slab.flash{ animation:none; }
}

.desktop-only{ display:flex; gap:10px; justify-content:flex-end; }
@media (max-width:899px){
  .desktop-only{ display:none; }
}

@media (max-width:899px){
  .slab{
    position:fixed;
    left:0; right:0; bottom:0;
    top:auto;
    z-index:40;
    border-radius:var(--r-lg) var(--r-lg) 0 0;
    padding-bottom:calc(16px + env(safe-area-inset-bottom));
  }
  .slab .lines{ display:none; }
  .slab.is-open .lines{ display:flex; }
}

/* Autocomplete */
.suggest{
  position:absolute;
  top:100%; left:0; right:0;
  background:#fff;
  border:1px solid var(--line);
  border-radius:var(--r-md);
  box-shadow:0 8px 24px -8px rgba(16,30,49,.18);
  z-index:30;
  max-height:220px;
  overflow-y:auto;
}
.suggest-item{
  padding:10px 12px;
  cursor:pointer;
  font-size:.94rem;
  border-bottom:1px solid var(--line-soft);
}
.suggest-item:last-child{ border-bottom:none; }
.suggest-item:hover{ background:var(--surface-sunk); }

/* ---------- Stage 6 — drafts ---------- */

.resume-banner{
  display:flex;
  align-items:center;
  gap:10px;
  padding:12px 16px;
  background:var(--neutral-wash);
  border:1px solid color-mix(in srgb, var(--neutral) 30%, transparent);
  color:var(--ink);
  border-radius:var(--r-md);
  font-size:.95rem;
  font-weight:500;
  margin-bottom:16px;
  flex-wrap:wrap;
}
.resume-banner .btn{
  padding:6px 12px;
  min-height:32px;
  font-size:.85rem;
}

/* ---------- Stage 7 — reports ---------- */

.declined-note td{
  background:var(--fault-wash);
  color:var(--fault);
  padding:10px 12px;
}

.written-block{
  margin-top:16px;
  padding:20px;
  background:var(--surface-sunk);
  border-radius:var(--r-md);
}
.written-block h3{
  margin:18px 0 6px;
  font-size:.92rem;
  color:var(--ink-2);
  text-transform:uppercase;
  letter-spacing:.05em;
}
.written-block h3:first-child{ margin-top:0; }
.written-block p{
  white-space:pre-wrap;
  margin-bottom:8px;
}

/* ---------- Stage 9 — review ---------- */

/* Inbox tabs */
.inbox-tabs{
  display:flex;
  gap:4px;
  flex-wrap:wrap;
  background:var(--surface-sunk);
  padding:5px;
  border-radius:var(--r-md);
  border:1px solid var(--line-soft);
  margin-top:14px;
}

.inbox-tab{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:9px 16px;
  border-radius:8px;
  font-size:.92rem;
  font-weight:600;
  color:var(--ink-2);
  background:transparent;
  border:1px solid transparent;
  transition:background .15s, color .15s, box-shadow .15s;
  white-space:nowrap;
}
.inbox-tab:hover{
  text-decoration:none;
  color:var(--ink);
  background:rgba(255,255,255,.7);
}
.inbox-tab.on{
  color:var(--ink);
  background:#fff;
  border-color:var(--line);
  box-shadow:0 1px 2px rgba(16,30,49,.06);
}

.inbox-tab .count{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:22px;
  height:20px;
  padding:0 7px;
  background:var(--paper-deep);
  color:var(--ink-2);
  font-size:.72rem;
  border-radius:999px;
  font-weight:700;
  font-variant-numeric:tabular-nums;
}
.inbox-tab.on .count{
  background:var(--neutral);
  color:#fff;
}
.inbox-tab[href*="status=Approved"] .count{ background:var(--earth-wash); color:var(--earth); }
.inbox-tab[href*="status=Declined"] .count{ background:var(--fault-wash); color:var(--fault); }
.inbox-tab[href*="status=Pending"]  .count{ background:var(--live-wash);  color:var(--live);  }
.inbox-tab.on[href*="status=Approved"] .count{ background:var(--earth); color:#fff; }
.inbox-tab.on[href*="status=Declined"] .count{ background:var(--fault); color:#fff; }
.inbox-tab.on[href*="status=Pending"]  .count{ background:var(--live);  color:#fff; }

.review-timeline{
  margin-top:10px;
  border-left:2px solid var(--line-soft);
  padding-left:16px;
}
.review-row{
  padding:10px 0 12px;
}
.review-row:not(:last-child){
  border-bottom:1px solid var(--line-soft);
}
.review-when{
  font-variant-numeric:tabular-nums;
}
.review-what{
  margin:2px 0 6px;
}
.review-comment{
  background:var(--surface-sunk);
  border-radius:var(--r-sm);
  padding:10px 12px;
  font-size:.93rem;
  white-space:pre-wrap;
}

.review-actions{
  margin-top:26px;
  padding:18px;
  background:var(--surface-sunk);
  border:1px solid var(--line-soft);
  border-radius:var(--r-md);
  display:flex;
  flex-direction:column;
  gap:10px;
  align-items:flex-start;
}
.review-actions details{ width:100%; }
.review-actions summary{
  cursor:pointer;
  display:inline-block;
  user-select:none;
}
.review-actions summary::marker{ content:''; }
.review-actions .decline-block summary.btn{ padding:10px 16px; }

/* ---------- Stage 10 — unlock ---------- */

.unlock-actions{
  background:var(--neutral-wash);
  border-color:color-mix(in srgb, var(--neutral) 25%, transparent);
}
.unlock-actions summary.btn-quiet{
  background:#fff;
}

/* ---------- Stage 11 — consolidated ---------- */

.warning-card{
  margin-bottom:14px;
  border-left:4px solid var(--live);
}
.warning-card h2{
  color:var(--live);
}

.consol-grand{
  padding:18px;
  background:var(--surface-sunk);
  border:1px solid var(--line-soft);
  border-radius:var(--r-md);
  margin-bottom:14px;
}
.consol-grand-value{
  font-size:2rem;
  font-weight:700;
  letter-spacing:-.03em;
  color:var(--ink);
  margin:4px 0;
}

.consol-table td, .consol-table th{
  padding:12px 12px;
}

#sp-0{ scroll-margin-top:100px; }
section[id^="sp-"]{ scroll-margin-top:100px; }

/* ---------- Sales report: expandable product rows ---------- */

.row-expand{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:28px;
  height:28px;
  margin-right:6px;
  border:1px solid var(--line);
  border-radius:6px;
  background:#fff;
  color:var(--ink-2);
  cursor:pointer;
  font-size:.8rem;
  transition:background .15s, color .15s;
  vertical-align:middle;
}
.row-expand:hover{
  background:var(--surface-sunk);
  color:var(--ink);
}
.row-expand i{ transition:transform .15s; }
.row-expand[aria-expanded="true"] i{ transform:rotate(0deg); }

.items-row td{ padding:0; border-bottom:1px solid var(--line-soft); }

.items-nest{
  background:var(--surface-sunk);
  padding:12px 16px 16px;
  border-top:1px solid var(--line-soft);
}

.items-tbl{
  background:#fff;
  border:1px solid var(--line);
  border-radius:var(--r-md);
  overflow:hidden;
}
.items-tbl th,
.items-tbl td{
  padding:8px 12px;
  font-size:.9rem;
}
.items-tbl th{
  font-size:.72rem;
  background:var(--surface-sunk);
}
.items-tbl tr:last-child td{ border-bottom:none; }

@media (prefers-reduced-motion: reduce){
  .row-expand i{ transition:none; }
}

/* ---------- Accessibility ---------- */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--neutral);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

/* ---------- Global reduced motion ---------- */

@media (prefers-reduced-motion: reduce){
  *{ animation:none !important; transition:none !important; }
}

/* ---------- Step 2 — Pending payments ---------- */

.sidebar-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:20px;
  height:20px;
  padding:0 6px;
  margin-left:auto;
  background:var(--live);
  color:#fff;
  font-size:.7rem;
  font-weight:700;
  border-radius:999px;
  font-variant-numeric:tabular-nums;
}

/* Credit confirmation modal */
.credit-modal{
  position:fixed;
  inset:0;
  z-index:100;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  background:rgba(16,30,49,.45);
  -webkit-backdrop-filter:blur(3px);
  backdrop-filter:blur(3px);
}
.credit-modal[hidden]{ display:none; }

.credit-card{
  background:#fff;
  border-radius:var(--r-lg);
  max-width:480px;
  width:100%;
  padding:26px 24px;
  box-shadow:0 20px 60px -20px rgba(16,30,49,.4);
}
.credit-card h2{
  margin:0 0 6px;
  font-size:1.2rem;
}
.credit-card p{
  margin:0 0 16px;
  font-size:.92rem;
  color:var(--ink-2);
}

.credit-summary{
  background:var(--surface-sunk);
  border-radius:var(--r-md);
  padding:14px 16px;
  margin-bottom:20px;
  display:grid;
  gap:8px;
}
.credit-summary .row{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  font-size:.92rem;
}
.credit-summary .row.balance{
  padding-top:8px;
  border-top:1px solid var(--line-soft);
  font-size:1.05rem;
  font-weight:600;
}
.credit-summary .row.balance .figure{
  color:var(--live);
}

.credit-actions{
  display:flex;
  gap:10px;
  justify-content:flex-end;
  flex-wrap:wrap;
}

/* Pending payments table */
.pending-age{
  display:inline-block;
  padding:2px 8px;
  border-radius:999px;
  font-size:.72rem;
  font-weight:600;
  background:var(--surface-sunk);
  color:var(--ink-2);
}
.pending-age.warn{ background:var(--live-wash); color:var(--live); }
.pending-age.old { background:var(--fault-wash); color:var(--fault); }

/* ---------- Step 3 — Monthly report ---------- */

.chart-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:22px;
  align-items:start;
  margin-top:12px;
}
@media (max-width:900px){
  .chart-grid{ grid-template-columns:1fr; }
}

.chart-box{
  background:var(--surface-sunk);
  border:1px solid var(--line-soft);
  border-radius:var(--r-md);
  padding:16px;
  position:relative;
  height:260px;
}
.chart-box-wide{
  height:320px;
}
.chart-box canvas{
  width:100% !important;
  height:100% !important;
}

/* ---------- Mobile navigation (hamburger drawer) ---------- */

/* Hamburger — hidden on desktop */
.rail-burger{
  display:none;
  width:44px;
  height:44px;
  border:1px solid var(--line);
  border-radius:10px;
  background:rgba(255,255,255,.7);
  color:var(--ink);
  font-size:1rem;
  cursor:pointer;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
}
.rail-burger:hover{ background:#fff; }

/* Sidebar close button — hidden on desktop */
.sidebar-close{
  display:none;
  position:absolute;
  top:10px;
  right:10px;
  width:36px;
  height:36px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fff;
  color:var(--ink-2);
  font-size:1rem;
  cursor:pointer;
  align-items:center;
  justify-content:center;
}
.sidebar-close:hover{ color:var(--ink); }

/* Backdrop */
.sidebar-backdrop{
  position:fixed;
  inset:0;
  z-index:80;
  background:rgba(16,30,49,.4);
  -webkit-backdrop-filter:blur(2px);
  backdrop-filter:blur(2px);
}
.sidebar-backdrop[hidden]{ display:none; }

/* Mobile */
@media (max-width:900px){

  /* Show the hamburger */
  .rail-burger{ display:inline-flex; }

  /* Sidebar becomes a fixed drawer, off-screen by default */
  .sidebar{
    display:block;
    position:fixed;
    top:0;
    left:-300px;
    bottom:0;
    width:290px;
    max-width:85vw;
    z-index:90;
    border-radius:0 var(--r-lg) var(--r-lg) 0;
    padding:56px 10px 20px;
    overflow-y:auto;
    transition:left .22s ease;
    background:rgba(255,255,255,.92);
    -webkit-backdrop-filter:blur(20px) saturate(180%);
    backdrop-filter:blur(20px) saturate(180%);
  }
  .sidebar.open{ left:0; }
  .sidebar-close{ display:inline-flex; }

  /* Rail fixes for narrow screens */
  .rail-inner{
    padding:12px 14px;
    gap:10px;
  }
  .rail .who b{
    font-size:1rem;
  }
  .rail-role{
    display:none;   /* hide "Administrator" subtitle on mobile */
  }
  .rail-btn-password{
    display:none;   /* hide "Password" button on mobile — reachable via drawer */
  }
  .rail-btn-logout{
    padding:8px 12px;
    min-height:38px;
    font-size:.85rem;
  }
}

/* Very narrow — tighten further */
@media (max-width:420px){
  .rail-inner{ padding:10px 12px; }
  .rail .mark{ width:40px; height:40px; font-size:.9rem; }
  .rail .who b{ font-size:.92rem; }
}

/* Respect reduced-motion */
@media (prefers-reduced-motion: reduce){
  .sidebar{ transition:none; }
}