/* Rezidential - stiluri
   Paleta: cerneala (albastru-ardezie) pe hartie rece; fiecare utilitate isi are culoarea ei,
   aceeasi ca in logo: gaz = flacara albastra, curent = galben, apa/intretinere = turcoaz,
   chirie = prun. Elementul distinctiv: indexul afisat ca pe cadranul unui contor. */

:root {
  --ink: #17323F;
  --ink-2: #24485A;
  --paper: #F2F4F3;
  --card: #FFFFFF;
  --line: #D9E0DE;
  --line-2: #E8EDEB;
  --muted: #5B6E75;
  --text: #1A2B31;

  --gaz: #2F6FDB;      --gaz-bg: #E9F0FD;
  --curent: #8F6800;   --curent-fill: #F2B705; --curent-bg: #FDF4D6;
  --intretinere: #12807D; --intretinere-bg: #E0F3F2;
  --chirie: #6B4F8E;   --chirie-bg: #F1EBF7;

  --ok: #1E7A4F;   --ok-bg: #E3F3EA;
  --warn: #8A5300; --warn-bg: #FCEFD9;
  --danger: #B3261E; --danger-bg: #FBE7E5;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(23, 50, 63, .06), 0 4px 14px rgba(23, 50, 63, .05);
  --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-num: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --nav-h: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--text);
  font: 16px/1.5 var(--font);
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--ink-2); }
a:hover { color: var(--ink); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; color: var(--ink); margin: 0 0 .5em; }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .8em; }
small, .muted { color: var(--muted); }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
:focus-visible { outline: 3px solid #5B9BF8; outline-offset: 2px; border-radius: 4px; }

/* ------------------------------------------------------------ bara de sus */
.topbar {
  background: var(--ink); color: #fff;
  position: sticky; top: 0; z-index: 30;
}
.topbar-in {
  max-width: 1180px; margin: 0 auto; padding: 0 16px; height: 60px;
  display: flex; align-items: center; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.12rem; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.brand:hover { color: #fff; }
.topnav { display: flex; gap: 4px; margin-left: 8px; }
.topnav a {
  color: #C9D7DC; text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 700; font-size: .95rem;
}
.topnav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.topnav a.on { color: #fff; background: rgba(255,255,255,.14); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.iconbtn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px; color: #E3ECEF; text-decoration: none;
}
.iconbtn:hover { background: rgba(255,255,255,.1); color: #fff; }
.iconbtn svg { width: 22px; height: 22px; }
.dot {
  position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--curent-fill); color: var(--ink); border-radius: 9px; font: 700 .72rem/18px var(--font); text-align: center;
}
.who { color: #C9D7DC; font-size: .9rem; margin-right: 4px; }

/* ------------------------------------------------------------ bara de jos (mobil) */
.tabbar { display: none; }
@media (max-width: 820px) {
  .topnav, .who { display: none; }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: #fff; border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom); height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--muted); text-decoration: none; font-size: .74rem; font-weight: 700; position: relative;
  }
  .tabbar a svg { width: 24px; height: 24px; }
  .tabbar a.on { color: var(--ink); }
  .tabbar a.on::before { content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 3px; background: var(--ink); border-radius: 0 0 3px 3px; }
  .tabbar .dot { top: 6px; right: calc(50% - 22px); }
  main { padding-bottom: calc(var(--nav-h) + 28px) !important; }
}

/* ------------------------------------------------------------ continut */
main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 22px 16px 40px; }
.narrow { max-width: 680px; margin-left: auto; margin-right: auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.crumbs { font-size: .9rem; margin-bottom: 6px; }
.crumbs a { text-decoration: none; }

.footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 18px 16px 26px; }
.footer a { color: var(--muted); }
@media (max-width: 820px) { .footer { padding-bottom: calc(var(--nav-h) + 24px); } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
}
.card + .card, .stack > * + * { margin-top: 14px; }
.card h2 { margin-bottom: .7em; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ------------------------------------------------------------ butoane */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--ink); background: var(--ink); color: #fff;
  font: 700 .96rem var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--ink-2); color: #fff; }
.btn svg { width: 18px; height: 18px; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--line-2); color: var(--ink); }
.btn-ok { background: var(--ok); border-color: var(--ok); }
.btn-ok:hover { background: #17633F; }
.btn-danger { background: #fff; color: var(--danger); border-color: #EBC1BD; }
.btn-danger:hover { background: var(--danger-bg); color: var(--danger); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: .86rem; }
.btn-block { width: 100%; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--ink-2); font: inherit; text-decoration: underline; cursor: pointer; }
.linkbtn.danger { color: var(--danger); }
form.inline { display: inline; }

/* ------------------------------------------------------------ formulare */
label { display: block; font-weight: 700; font-size: .92rem; color: var(--ink); margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .84rem; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date],
input[type=month], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid #C3CECB; background: #fff; color: var(--text); font: 16px var(--font);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--ink-2); box-shadow: 0 0 0 3px rgba(36, 72, 90, .15); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--ink); flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 4px; margin: 0 0 16px; }
legend { font-weight: 700; color: var(--ink); padding: 0 6px; }
.code-input { text-transform: uppercase; letter-spacing: .35em; font-family: var(--font-num) !important; font-size: 1.5rem !important; text-align: center; font-weight: 600; }

/* ------------------------------------------------------------ mesaje */
.flash { border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 14px; border: 1px solid; font-weight: 700; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: #B9E0CA; }
.flash.error { background: var(--danger-bg); color: var(--danger); border-color: #F0C4BF; }
.flash.info { background: #EAF1F4; color: var(--ink-2); border-color: #CFDDE3; }
.notice {
  border-radius: var(--radius); padding: 14px 16px; border: 1px solid; margin-bottom: 14px;
  display: flex; gap: 14px; align-items: flex-start;
}
.notice svg { width: 24px; height: 24px; flex: none; margin-top: 1px; }
.notice.warn { background: var(--warn-bg); border-color: #EFD3A6; color: #5E3A00; }
.notice.info { background: #EAF1F4; border-color: #CFDDE3; color: var(--ink); }
.notice.ok { background: var(--ok-bg); border-color: #B9E0CA; color: #11452C; }
.notice .actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.notice p:last-child { margin-bottom: 0; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px;
  font-size: .78rem; font-weight: 700; background: var(--line-2); color: var(--muted); white-space: nowrap;
}
.badge.trimis { background: var(--warn-bg); color: var(--warn); }
.badge.confirmat { background: var(--ok-bg); color: var(--ok); }
.badge.corectat { background: var(--danger-bg); color: var(--danger); }
.badge.activ { background: var(--ok-bg); color: var(--ok); }
.badge.inchis { background: var(--line-2); color: var(--muted); }

/* ------------------------------------------------------------ total de plata */
.due {
  background: var(--ink); color: #fff; border-radius: var(--radius); padding: 20px 22px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin-bottom: 14px; position: relative; overflow: hidden;
}
.due .lbl { color: #B7C8CE; font-weight: 700; }
.due .amount { font-family: var(--font-num); font-weight: 600; font-size: 3.1rem; line-height: 1; margin-top: 6px; letter-spacing: .01em; }
.due .amount small { font-size: 1.3rem; color: #B7C8CE; margin-left: 4px; }
.due .meta { color: #B7C8CE; font-size: .9rem; }
.due.zero .amount { color: #9FE0BF; }

/* ------------------------------------------------------------ carduri pe utilitati */
.ucard { border-top: 5px solid var(--c, var(--ink)); display: flex; flex-direction: column; gap: 10px; }
.ucard[data-u=gaz] { --c: var(--gaz); --cb: var(--gaz-bg); }
.ucard[data-u=curent] { --c: var(--curent-fill); --cb: var(--curent-bg); }
.ucard[data-u=intretinere], .ucard[data-u=apa] { --c: var(--intretinere); --cb: var(--intretinere-bg); }
.ucard[data-u=chirie] { --c: var(--chirie); --cb: var(--chirie-bg); }
.ucard .uhead { display: flex; align-items: center; gap: 10px; }
.uicon { width: 36px; height: 36px; border-radius: 10px; background: var(--cb, var(--line-2)); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.uicon svg { width: 22px; height: 22px; }
.ucard h3 { margin: 0; font-size: 1.05rem; }
.ucard .bal { font-family: var(--font-num); font-size: 2rem; font-weight: 600; line-height: 1; color: var(--ink); }
.ucard .bal.credit { color: var(--ok); }
.ucard .bal-lbl { font-size: .84rem; color: var(--muted); }
.ucard .facts { font-size: .9rem; color: var(--muted); }
.ucard .facts b { color: var(--text); font-weight: 700; }
.ucard .actions { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------ contorul (index) */
.meter {
  display: inline-flex; align-items: stretch; gap: 3px; padding: 6px; border-radius: 10px;
  background: #0F1E25; box-shadow: inset 0 2px 6px rgba(0,0,0,.5), 0 1px 0 rgba(255,255,255,.4);
}
.meter span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.05em; padding: .08em .06em; border-radius: 4px;
  background: linear-gradient(#22343C, #0B171C 48%, #16262D 52%, #22343C);
  color: #F4F6F3; font: 600 1.7rem/1 var(--font-num); font-variant-numeric: tabular-nums;
}
.meter span.dec { background: linear-gradient(#8E1E18, #5F0F0B 48%, #741611 52%, #8E1E18); }
.meter.sm span { font-size: 1.15rem; }
.meter.lg span { font-size: 2.4rem; }
.meter-wrap { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.meter-cap { font-size: .8rem; color: var(--muted); font-weight: 700; }

/* ------------------------------------------------------------ tabele */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 700; padding: 8px 8px; border-bottom: 2px solid var(--line); white-space: nowrap; }
td { padding: 9px 8px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
td.r, th.r { text-align: right; }
td.num, .num-cell { font-family: var(--font-num); font-size: 1.05rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.sub td { background: #FAFBFB; font-size: .88rem; color: var(--muted); }
tr:target td { background: #FFF8E1; }
.neg { color: var(--ok); }
.pos { color: var(--text); }

/* ------------------------------------------------------------ taburi */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 700; white-space: nowrap;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tabs a.on { color: var(--ink); border-bottom-color: var(--ink); }
.tabs a .dot { position: static; display: inline-block; margin-left: 4px; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.pills a { padding: 6px 14px; border-radius: 99px; border: 1px solid var(--line); text-decoration: none; color: var(--muted); font-weight: 700; background: #fff; }
.pills a.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ------------------------------------------------------------ cod acces */
.codebox { display: inline-flex; gap: 6px; }
.codebox span {
  width: 42px; height: 52px; display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--ink); border-radius: 8px; background: #fff;
  font: 600 1.9rem var(--font-num); color: var(--ink);
}
.codebox.off span { border-color: var(--line); color: var(--muted); text-decoration: line-through; }

/* ------------------------------------------------------------ pop-up verificare */
dialog.modal {
  border: 0; padding: 0; border-radius: 16px; width: min(980px, calc(100vw - 24px)); max-height: calc(100vh - 24px);
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
dialog.modal::backdrop { background: rgba(10, 24, 30, .6); }
.modal-in { display: grid; grid-template-columns: 1.4fr 1fr; min-height: 420px; }
.modal-photo { background: #0F1E25; display: flex; align-items: center; justify-content: center; position: relative; min-height: 300px; }
.modal-photo img { max-height: calc(100vh - 60px); width: 100%; object-fit: contain; cursor: zoom-in; }
.modal-photo img.zoom { cursor: zoom-out; transform: scale(2); transform-origin: var(--zx, 50%) var(--zy, 50%); }
.modal-photo .nophoto { color: #B7C8CE; padding: 30px; text-align: center; }
.modal-side { padding: 20px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.modal-side .close { position: absolute; top: 10px; right: 10px; }
.compare { border: 2px dashed var(--line); border-radius: 12px; padding: 14px; }
.compare .k { font-size: .82rem; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.modal-close { position: absolute; top: 10px; right: 12px; z-index: 2; background: rgba(255,255,255,.92); border: 0; border-radius: 99px; width: 38px; height: 38px; cursor: pointer; font-size: 1.3rem; }
@media (max-width: 760px) {
  .modal-in { grid-template-columns: 1fr; }
  .modal-photo { min-height: 240px; max-height: 50vh; }
  .modal-photo img { max-height: 50vh; }
}

/* ------------------------------------------------------------ login */
.auth { flex: 1; display: grid; place-items: center; padding: 28px 16px; background:
  radial-gradient(circle at 15% 10%, rgba(76,141,246,.14), transparent 40%),
  radial-gradient(circle at 85% 90%, rgba(43,179,177,.14), transparent 40%), var(--paper); }
.auth-card { width: min(420px, 100%); }
.auth-brand { text-align: center; margin-bottom: 18px; }
.auth-brand img { width: 84px; height: 84px; border-radius: 22px; box-shadow: 0 8px 24px rgba(23,50,63,.25); }
.auth-brand h1 { margin: 12px 0 0; font-size: 1.9rem; }
.auth-brand .tag { color: var(--muted); }
.version { display: inline-block; margin-top: 14px; color: var(--muted); font-size: .82rem; }

/* ------------------------------------------------------------ diverse */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 700; }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; }
.empty .btn { margin-top: 12px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.list li:last-child { border-bottom: 0; }
.list li.unread { font-weight: 700; }
.loc-card { text-decoration: none; color: inherit; display: block; }
.loc-card:hover { border-color: #B8C6C3; }
.loc-card .bal { font-family: var(--font-num); font-size: 1.9rem; font-weight: 600; color: var(--ink); }
.loc-card .meta { color: var(--muted); font-size: .9rem; }
.mini-bals { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.mini-bals span { font-size: .8rem; padding: 3px 8px; border-radius: 6px; background: var(--line-2); }
.mini-bals .gaz { background: var(--gaz-bg); color: var(--gaz); }
.mini-bals .curent { background: var(--curent-bg); color: var(--curent); }
.mini-bals .intretinere { background: var(--intretinere-bg); color: var(--intretinere); }
.mini-bals .chirie { background: var(--chirie-bg); color: var(--chirie); }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding: 0 0 14px 40px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--line-2); color: var(--ink); font-weight: 700; display: grid; place-items: center; font-size: .9rem; }
.steps li.done::before { content: "✓"; background: var(--ok); color: #fff; }
.steps li.now::before { background: var(--ink); color: #fff; }
.calc-line { font-family: var(--font-num); font-size: 1.15rem; }
.livecalc { background: var(--line-2); border-radius: 12px; padding: 14px; }
.livecalc .big { font-family: var(--font-num); font-size: 2.2rem; font-weight: 600; color: var(--ink); line-height: 1.1; }
.photo-pick { border: 2px dashed #B9C7C4; border-radius: 12px; padding: 16px; text-align: center; background: #FAFBFB; cursor: pointer; display: block; }
.photo-pick input { display: none; }
.photo-pick img { max-height: 220px; border-radius: 8px; margin-top: 8px; }
.photo-pick .pp-title { font-weight: 700; color: var(--ink); }
.chart { width: 100%; height: auto; display: block; }
.legend-sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
@media print { .topbar, .tabbar, .footer, .btn, .tabs { display: none !important; } body { background: #fff; } .card { box-shadow: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.photo-pick svg { width: 36px; height: 36px; color: var(--ink-2); }
.grid > .card + .card, .grid > .card { margin-top: 0; }
.grid + .card, .card + .grid, .grid + .grid, .stack + .card { margin-top: 14px; }
