/* =====================================================================
   FamilyMed - stiluri
   Telefon: aspect de aplicatie iOS (titluri mari, liste grupate, tab bar).
   Desktop (>= 900px): bara laterala, antet de pagina, tabele aliniate.
   ===================================================================== */

:root {
  color-scheme: light;
  --bg: #f2f2f7;
  --bg-elevated: #ffffff;
  --bg-overlay: rgba(249,249,251,0.82);
  --topbar-overlay: rgba(242,242,247,0.82);
  --sidebar-bg: #f9f9fb;
  --text: #1c1c1e;
  --text-secondary: #6c6c70;
  --text-tertiary: #8e8e93;
  --text-muted: #aeaeb2;
  --separator: rgba(60,60,67,0.16);
  --border: rgba(60,60,67,0.12);
  --border-light: rgba(60,60,67,0.10);
  --input-bg: #f4f4f7;
  --input-border: rgba(60,60,67,0.14);
  --fill: rgba(120,120,128,0.12);
  --fill-strong: rgba(120,120,128,0.2);
  --accent: #5a8ae6;
  --accent-active: #4673cc;
  --accent-soft: rgba(90,138,230,0.12);
  --danger: #d9655c;
  --danger-soft: rgba(217,101,92,0.11);
  --success: #3d9461;
  --success-soft: rgba(61,148,97,0.12);
  --warning: #c27a35;
  --warning-soft: rgba(194,122,53,0.12);
  --switch-on: #6cc28c;
  --hero-bg: linear-gradient(135deg, #e9f0fc 0%, #e2e9fa 55%, #e9e6f8 100%);
  --hero-fg: #24324d;
  --hero-sub: #5b6a86;
  --hero-pill: rgba(255,255,255,0.65);
  --hero-shadow: 0 6px 20px rgba(60,90,150,0.10);
  --brand-grad: linear-gradient(135deg, #8fb2ef, #5a8ae6);
  --stepper-bg: var(--fill);
  --stepper-bg-active: var(--fill-strong);
  --secondary-btn-bg: #3a3a3c;
  --secondary-btn-active: #1c1c1e;
  --table-header: #8e8e93;
  --status-ok: #3d9461;
  --status-ok-bg: rgba(61,148,97,0.12);
  --status-soon: #c27a35;
  --status-soon-bg: rgba(194,122,53,0.12);
  --status-gone: #8e8e93;
  --status-gone-bg: rgba(142,142,147,0.12);
  --chip-bg: var(--fill);
  --switch-off: #e9e9ea;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.04), 0 0 0 1px rgba(0,0,0,0.035);
  --shadow-pop: 0 12px 40px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.05);

  --radius: 14px;
  --radius-sm: 10px;
  --banner-h: 0px;
  --topbar-h: 44px;
  --tabbar-h: 54px;
  --glass-bg: rgba(255,255,255,0.4);
  --glass-edge: rgba(255,255,255,0.75);
  --glass-highlight: rgba(255,255,255,0.95);
  --glass-lowlight: rgba(255,255,255,0.35);
  --glass-sheen: rgba(255,255,255,0.38);
  --glass-pill: rgba(120,120,128,0.14);
  --sidebar-w: 248px;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000;
    --bg-elevated: #1c1c1e;
    --bg-overlay: rgba(22,22,24,0.82);
    --glass-bg: rgba(38,38,42,0.55);
    --glass-edge: rgba(255,255,255,0.14);
    --glass-highlight: rgba(255,255,255,0.18);
    --glass-lowlight: rgba(255,255,255,0.06);
    --glass-sheen: rgba(255,255,255,0.07);
    --glass-pill: rgba(255,255,255,0.12);
    --topbar-overlay: rgba(0,0,0,0.78);
    --sidebar-bg: #111113;
    --text: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-tertiary: #8e8e93;
    --text-muted: #636366;
    --separator: rgba(84,84,88,0.55);
    --border: rgba(255,255,255,0.09);
    --border-light: rgba(255,255,255,0.07);
    --input-bg: #2c2c2e;
    --input-border: rgba(255,255,255,0.08);
    --fill: rgba(118,118,128,0.24);
    --fill-strong: rgba(118,118,128,0.36);
    --accent: #7aa3ea;
    --accent-active: #93b6f0;
    --accent-soft: rgba(122,163,234,0.16);
    --danger: #e08078;
    --danger-soft: rgba(224,128,120,0.14);
    --success: #6abf8a;
    --success-soft: rgba(106,191,138,0.14);
    --warning: #ddb070;
    --warning-soft: rgba(221,176,112,0.14);
    --switch-on: #4f9e6e;
    --hero-bg: linear-gradient(135deg, #1f2a40 0%, #1c2438 55%, #241f3a 100%);
    --hero-fg: #e6ecf8;
    --hero-sub: #a3b0c9;
    --hero-pill: rgba(255,255,255,0.08);
    --hero-shadow: none;
    --brand-grad: linear-gradient(135deg, #7d9fd8, #5a7fc8);
    --secondary-btn-bg: #3a3a3c;
    --switch-off: #39393d;
    --secondary-btn-active: #48484a;
    --table-header: #8e8e93;
    --status-ok: #6abf8a;
    --status-ok-bg: rgba(106,191,138,0.14);
    --status-soon: #ddb070;
    --status-soon-bg: rgba(221,176,112,0.14);
    --status-gone: #8e8e93;
    --status-gone-bg: rgba(142,142,147,0.16);
    --shadow-card: 0 0 0 1px rgba(255,255,255,0.06);
    --shadow-pop: 0 16px 48px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.08);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --bg-elevated: #1c1c1e;
  --bg-overlay: rgba(22,22,24,0.82);
  --glass-bg: rgba(38,38,42,0.55);
  --glass-edge: rgba(255,255,255,0.14);
  --glass-highlight: rgba(255,255,255,0.18);
  --glass-lowlight: rgba(255,255,255,0.06);
  --glass-sheen: rgba(255,255,255,0.07);
  --glass-pill: rgba(255,255,255,0.12);
  --topbar-overlay: rgba(0,0,0,0.78);
  --sidebar-bg: #111113;
  --text: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-tertiary: #8e8e93;
  --text-muted: #636366;
  --separator: rgba(84,84,88,0.55);
  --border: rgba(255,255,255,0.09);
  --border-light: rgba(255,255,255,0.07);
  --input-bg: #2c2c2e;
  --input-border: rgba(255,255,255,0.08);
  --fill: rgba(118,118,128,0.24);
  --fill-strong: rgba(118,118,128,0.36);
  --accent: #7aa3ea;
  --accent-active: #93b6f0;
  --accent-soft: rgba(122,163,234,0.16);
  --danger: #e08078;
  --danger-soft: rgba(224,128,120,0.14);
  --success: #6abf8a;
  --success-soft: rgba(106,191,138,0.14);
  --warning: #ddb070;
  --warning-soft: rgba(221,176,112,0.14);
  --switch-on: #4f9e6e;
  --hero-bg: linear-gradient(135deg, #1f2a40 0%, #1c2438 55%, #241f3a 100%);
  --hero-fg: #e6ecf8;
  --hero-sub: #a3b0c9;
  --hero-pill: rgba(255,255,255,0.08);
  --hero-shadow: none;
  --brand-grad: linear-gradient(135deg, #7d9fd8, #5a7fc8);
  --secondary-btn-bg: #3a3a3c;
  --switch-off: #39393d;
  --secondary-btn-active: #48484a;
  --table-header: #8e8e93;
  --status-ok: #6abf8a;
  --status-ok-bg: rgba(106,191,138,0.14);
  --status-soon: #ddb070;
  --status-soon-bg: rgba(221,176,112,0.14);
  --status-gone: #8e8e93;
  --status-gone-bg: rgba(142,142,147,0.16);
  --shadow-card: 0 0 0 1px rgba(255,255,255,0.06);
  --shadow-pop: 0 16px 48px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.08);
}

/* ---------- Baza ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  font-size: 17px; line-height: 1.35;
  margin: 0;
  background: var(--bg); color: var(--text);
  padding-top: calc(var(--safe-top) + var(--banner-h) + var(--topbar-h));
  padding-bottom: calc(max(var(--safe-bottom), 18px) + var(--tabbar-h) + 2rem);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
body:has(.test-banner) { --banner-h: 22px; }
.ic { width: 1em; height: 1em; flex: none; display: block; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* Banner de test - doar pe copia de test (vezi test_banner.php) */
.test-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  padding-top: var(--safe-top);
  height: calc(var(--safe-top) + var(--banner-h));
  background: #eda65a; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
}
.login-body:has(.test-banner) { padding-top: calc(var(--safe-top) + var(--banner-h)); }

/* ---------- Bara de sus (telefon) ---------- */
.topbar {
  position: fixed; left: 0; right: 0; top: var(--banner-h); z-index: 20;
  padding-top: var(--safe-top);
  background: transparent;
  border-bottom: 0.5px solid transparent;
  transition: background-color .2s, border-color .2s;
}
.topbar-inner {
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: center;
  padding: 0 calc(16px + env(safe-area-inset-right)) 0 calc(16px + env(safe-area-inset-left));
  position: relative;
}
.topbar-title {
  font-size: 17px; font-weight: 600;
  opacity: 0; transform: translateY(4px);
  transition: opacity .2s, transform .2s;
  max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-actions {
  position: absolute; right: calc(12px + env(safe-area-inset-right)); top: 0; bottom: 0;
  display: flex; align-items: center; gap: 4px;
}
body.scrolled .topbar {
  background: var(--topbar-overlay);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom-color: var(--separator);
}
body.scrolled .topbar-title { opacity: 1; transform: none; }

/* buton rotund din bara de sus (ex. "+") */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 36px; height: 36px; padding: 0 8px; min-height: 0;
  border-radius: 18px; border: none; cursor: pointer;
  background: var(--fill); color: var(--accent);
  font-size: 15px; font-weight: 600; text-decoration: none;
}
.icon-btn .ic { width: 20px; height: 20px; }
.icon-btn .btn-text { display: none; }
.icon-btn:active { background: var(--fill-strong); }

/* Buton de actiune din bara de sus (ex. "+ Lucrare nouă", "Filtre"):
   pastila albastra cu text, ca sa fie clar ce face */
.action-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; min-height: 0; width: auto; padding: 0 16px 0 12px;
  border-radius: 19px; border: none; cursor: pointer;
  background: var(--accent-soft); color: var(--accent);
  font-size: 15px; font-weight: 600; white-space: nowrap;
}
.action-btn .ic { width: 19px; height: 19px; stroke-width: 2.4; }
.action-btn:active { background: var(--fill-strong); transform: scale(0.97); }
.topbar:has(.topbar-actions > *) .topbar-title { max-width: 42%; }

/* Titlul mare al paginii */
.page-head {
  max-width: 680px; margin: 0 auto;
  padding: 2px calc(16px + env(safe-area-inset-right)) 10px calc(16px + env(safe-area-inset-left));
}
.large-title { font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.page-subtitle { font-size: 15px; color: var(--text-secondary); margin-top: 2px; }

main { padding: 0 16px; max-width: 680px; margin: 0 auto; }

/* ---------- Tab bar (telefon) ---------- */
/* Bara de jos in stil Liquid Glass (iOS 26): capsula plutitoare, translucida,
   cu blur + saturatie pe continutul de dedesubt, margine luminoasa si o
   "bula" sub tab-ul activ. Continutul se vede trecand pe sub ea. */
nav.tabbar {
  position: fixed; z-index: 20;
  left: calc(16px + env(safe-area-inset-left)); right: calc(16px + env(safe-area-inset-right));
  bottom: calc(max(var(--safe-bottom), 18px) - 8px);
  display: flex; justify-content: space-around; gap: 2px;
  padding: 5px;
  border-radius: 34px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(12px) saturate(200%) brightness(1.06);
  backdrop-filter: blur(12px) saturate(200%) brightness(1.06);
  border: 0.5px solid var(--glass-edge);
  box-shadow:
    0 10px 30px rgba(0,0,0,0.12),
    0 1px 3px rgba(0,0,0,0.08),
    inset 0 1px 0.5px var(--glass-highlight),
    inset 0 -0.5px 0.5px var(--glass-lowlight);
  overflow: hidden;
}
/* reflexia de sus a "sticlei" */
nav.tabbar::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, var(--glass-sheen) 0%, transparent 46%);
}
nav.tabbar a {
  position: relative; flex: 1; height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: 29px;
  text-decoration: none; color: var(--text);
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.01em;
  transition: background-color .25s, color .25s;
}
nav.tabbar a .ic { width: 24px; height: 24px; stroke-width: 1.8; }
nav.tabbar a.active { color: var(--accent); background: var(--glass-pill); }
/* pana se incarca pagina noua (2-3 s pe date multe), continuul curent se estompeaza */
body.navigating main, body.navigating .page-head { opacity: .45; transition: opacity .15s .1s; }
nav.tabbar a.active .ic { stroke-width: 2.1; }
.sidebar { display: none; }

/* ---------- Titluri de sectiune, texte ajutatoare ---------- */
h3 {
  font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--text-secondary); margin: 1.6rem 0 0.45rem; padding: 0 16px;
}
.hint { font-size: 13px; color: var(--text-secondary); margin: 0 0 0.6rem; padding: 0 4px; line-height: 1.4; }
.hint a { color: var(--accent); text-decoration: none; font-weight: 500; }

/* ---------- Carduri de statistici ---------- */
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 1.2rem; }
.report-card {
  background: var(--bg-elevated); border-radius: var(--radius); padding: 14px 16px; min-width: 0;
}
.report-card .value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: break-word; line-height: 1.15; }
.report-card .label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ---------- Carduri, formulare ---------- */
form.card, .card {
  background: var(--bg-elevated); border-radius: var(--radius); padding: 16px;
  margin-bottom: 1.2rem;
}
.card { display: flex; flex-direction: column; gap: 0.8rem; }
.card-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }

/* Campurile unui formular se aseaza intr-un grid cat mai "patrat" posibil,
   cu randul incomplet centrat - --form-cols e calculat in JS
   (FMBalanceForms, din offline-queue.js). */
form.card {
  display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: end;
  gap: 14px 12px;
}
form.card label, form.card .field-group {
  display: flex; flex-direction: column; font-size: 13px; font-weight: 500; color: var(--text-secondary); gap: 6px;
  flex: 0 0 calc((100% - (var(--form-cols, 1) - 1) * 12px) / var(--form-cols, 1));
  max-width: calc((100% - (var(--form-cols, 1) - 1) * 12px) / var(--form-cols, 1));
  min-width: 0;
}
form.card fieldset {
  display: flex; flex-direction: column; font-size: 13px; color: var(--text-secondary); gap: 8px;
  flex: 0 0 100%; max-width: 100%;
  border: none; margin: 0; padding: 0;
}
form.card fieldset legend { padding: 0; font-size: inherit; font-weight: 500; color: inherit; margin-bottom: 6px; }
form.card fieldset .chk-row { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 8px; }
/* bifele de grupare devin "pastile" apasabile - mai usor de atins decat un checkbox mic */
form.card fieldset .chk-row > label {
  flex: none; max-width: none; flex-direction: row; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 500; color: var(--text);
  background: var(--fill); border-radius: 999px; padding: 7px 12px 7px 10px; cursor: pointer;
}
form.card fieldset .chk-row > label:has(input:checked) { background: var(--accent-soft); color: var(--accent); }
form.card fieldset label {
  flex: none; max-width: none; flex-direction: row; align-items: flex-start; gap: 0.35rem;
  font-size: 14px; color: var(--text);
}
form.card fieldset label input[type="checkbox"] { margin: 0; }

/* Pastile de grupare (Raport): fara bifa vizibila; aleasa = albastru plin cu ✓ */
.toggle-chips { display: flex; flex-wrap: wrap; gap: 8px; }
form.card fieldset .toggle-chip {
  position: relative; flex: none; max-width: none;
  display: inline-flex; flex-direction: row; align-items: center; gap: 0;
  padding: 8px 15px; border-radius: 999px; cursor: pointer;
  background: var(--fill); color: var(--text);
  font-size: 15px; font-weight: 500;
  transition: background-color .2s, color .2s, padding .2s;
  -webkit-user-select: none; user-select: none;
}
form.card fieldset .toggle-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.toggle-chip .chip-check { width: 0; height: 15px; stroke-width: 3; opacity: 0; transition: width .2s, opacity .2s, margin .2s; }
form.card fieldset .toggle-chip:has(input:checked) { background: var(--accent-soft); color: var(--accent); padding-left: 12px; box-shadow: inset 0 0 0 1px rgba(90,138,230,0.35); }
.toggle-chip:has(input:checked) .chip-check { width: 15px; opacity: 1; margin-right: 6px; }
.toggle-chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Comutatoare stil iOS (optiunile de afisare din Raport) */
.switch-list { display: flex; flex-direction: column; background: var(--input-bg); border-radius: 12px; padding: 0 14px; }
form.card fieldset .switch-row {
  display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 12px;
  flex: none; max-width: none; width: 100%;
  padding: 10px 0; font-size: 16px; color: var(--text); cursor: pointer;
}
form.card fieldset .switch-row + .switch-row { border-top: 1px solid var(--border-light); }
input[type="checkbox"].switch {
  -webkit-appearance: none; appearance: none; flex: none; cursor: pointer;
  width: 51px; height: 31px; border-radius: 16px; margin: 0; padding: 0; border: none;
  background-color: var(--switch-off);
  background-image:
    radial-gradient(circle, #fff 12.5px, transparent 13.5px),
    radial-gradient(circle, rgba(0,0,0,0.18) 13px, transparent 14.5px);
  background-size: 31px 31px, 31px 31px;
  background-repeat: no-repeat;
  background-position: 0 0, 0 1px;
  transition: background-color .2s, background-position .2s;
}
input[type="checkbox"].switch:checked { background-color: var(--switch-on); background-position: 20px 0, 20px 1px; }
input.switch:focus { box-shadow: none; }
input.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
form.card fieldset label.lp-card {
  align-items: center; gap: 0.6rem;
  flex: 1 1 260px; max-width: 360px;
  background: var(--input-bg); border-radius: var(--radius-sm); padding: 0.55rem 0.75rem;
}
form.card fieldset label.lp-card input[type="checkbox"] { margin-top: 0; flex: none; }
form.card fieldset label.lp-card .lp-info { flex: 1; min-width: 0; }
form.card fieldset label.lp-card .lp-row1,
form.card fieldset label.lp-card .lp-row2 { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
form.card fieldset label.lp-card .lp-row1 { font-weight: 600; font-size: 14px; }
form.card fieldset label.lp-card .lp-row2 { font-size: 12px; color: var(--text-secondary); margin-top: 0.15rem; }
form.card fieldset label.lp-card .lp-row1 span:last-child,
form.card fieldset label.lp-card .lp-row2 span:last-child { flex: none; }
/* De la/Până la pe acelasi rand (vezi memoria despre input[type=date] pe iOS 27 beta) */
form.card > .date-range-row {
  flex: 0 0 100%; max-width: 100%;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 12px;
}
form.card > .date-range-row label { flex: 1 1 150px; max-width: none; min-width: 150px; }
form.card > button,
form.card > .cancel-link,
form.card > .preview-suma,
form.card > .hint,
form.card > .segmented { flex: 0 0 100%; text-align: center; }
form.card > button { align-self: center; width: 100%; }

input, select, textarea {
  padding: 11px 12px; border: 1px solid var(--input-border); border-radius: var(--radius-sm);
  font: inherit; font-size: 17px; /* min 16px previne zoom automat pe iOS */
  width: 100%; min-width: 0; background: var(--input-bg); color: var(--text);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--bg-elevated);
}
select {
  appearance: none; -webkit-appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238e8e93' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
/* Bife stil iOS: cerc subtire gol; bifat = cerc albastru cu ✓ alb.
   Fara asta, stilul general al campurilor (chenar, colturi, fundal) se
   aplica si pe ele, iar iOS desena un patrat cu cercul lui nativ inauntru. */
input[type="checkbox"]:not(.switch), input[type="radio"] {
  -webkit-appearance: none; appearance: none; flex: none;
  width: 22px; height: 22px; min-width: 22px; min-height: 0; margin: 0; padding: 0;
  border: 1.5px solid var(--text-muted); border-radius: 50%;
  background: transparent no-repeat center / 14px 14px;
  cursor: pointer; vertical-align: middle;
  transition: background-color .15s, border-color .15s;
}
input[type="checkbox"]:not(.switch):checked {
  background-color: var(--accent); border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
}
input[type="radio"]:checked { border-color: var(--accent); background-image: radial-gradient(circle, var(--accent) 5px, transparent 5.5px); background-size: 100% 100%; }
input[type="checkbox"]:not(.switch):focus, input[type="radio"]:focus { box-shadow: none; background-color: transparent; }
input[type="checkbox"]:not(.switch):checked:focus { background-color: var(--accent); }
input[type="checkbox"]:not(.switch):focus-visible, input[type="radio"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type="date"] {
  min-width: 150px;
  /* iOS deseneaza controlul nativ mai lat decat cutia lui si centrat - fara
     aspectul nativ, campul respecta latimea si textul sta la stanga ca la restul */
  -webkit-appearance: none; appearance: none; display: block; min-height: 47px; text-align: left;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
/* Chrome/desktop isi deseneaza propria iconita de calendar - o ascundem, ramane a noastra */
input[type="date"]::-webkit-calendar-picker-indicator { opacity: 0; cursor: pointer; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; margin: 0; }

button {
  background: var(--accent); color: #fff; border: none; padding: 13px 18px;
  border-radius: 12px; font: inherit; font-weight: 600; font-size: 17px; cursor: pointer;
  min-height: 50px;
  transition: background-color .15s, transform .1s;
}
button:active { background: var(--accent-active); transform: scale(0.985); }

/* ---------- Stepper cantitate ---------- */
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper input { text-align: center; flex: 1; min-width: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.stepper-btn {
  flex: 0 0 46px; width: 46px; height: 46px; min-height: 46px; padding: 0;
  border-radius: var(--radius-sm); border: none; background: var(--stepper-bg); color: var(--accent);
  font-size: 24px; font-weight: 500; line-height: 1;
}
.stepper-btn:active { background: var(--stepper-bg-active); }

/* ---------- Dropdown cu selectie multipla (Raport universal) ---------- */
.ms-dropdown { position: relative; }
.ms-toggle {
  background: var(--input-bg); color: var(--text); border: 1px solid var(--input-border);
  padding: 11px 12px; border-radius: var(--radius-sm); font-size: 17px; font-weight: 400;
  width: 100%; min-height: 0; text-align: left;
  display: flex; align-items: center; gap: 0.4rem;
}
.ms-toggle:active { background-color: var(--input-bg); transform: none; }
.ms-toggle-btn {
  background: none; color: inherit; border: none; padding: 0; margin: 0;
  font-size: inherit; font-weight: inherit; text-align: left;
  flex: 1; min-width: 0; min-height: 0; width: auto;
}
.ms-toggle-btn:active { background: none; transform: none; }
.ms-toggle-text { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-clear {
  background: none; color: var(--text-secondary); border: none; padding: 0; margin: 0;
  width: 20px; height: 20px; min-height: 0; flex: none; line-height: 1;
  font-size: 1.1rem; font-weight: 600;
}
.ms-clear:active { color: var(--text); background: none; }
.ms-caret { display: none; }
.ms-toggle {
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238e8e93' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.ms-panel {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 25;
  background: var(--bg-elevated); border-radius: 12px;
  padding: 6px; max-height: 260px; overflow-y: auto;
  box-shadow: var(--shadow-pop);
}
.ms-panel[hidden] { display: none; }
form.card label[hidden] { display: none; }
.ms-panel .ms-option {
  display: flex; flex-direction: row; align-items: center; gap: 0.6rem; padding: 9px 8px;
  font-size: 15px; font-weight: 400; color: var(--text); border-radius: 8px; text-align: left;
}
.ms-panel .ms-option:active { background: var(--fill); }
.ms-panel .ms-option input[type="checkbox"] { margin: 0; flex: none; }

/* ---------- Liste grupate (stil iOS) ---------- */
.list {
  display: flex; flex-direction: column;
  background: var(--bg-elevated); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 1.2rem;
}
.list:not(:has(> *)) { display: none; }
.list-item {
  position: relative; display: block;
  padding: 12px 16px; text-decoration: none; color: inherit;
  background: var(--bg-elevated);
}
.list-item + .list-item::before {
  content: ""; position: absolute; top: 0; right: 0; left: 16px;
  border-top: 1px solid var(--border-light);
}
a.list-item:active { background: var(--fill); }
.list-item.inactive { opacity: 0.45; }
.list-item .row1 {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  font-weight: 600; font-size: 16px;
}
.list-item .row1 > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.list-item .row2 {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  font-size: 14px; color: var(--text-secondary); margin-top: 2px;
}
.list-item .amount { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; flex: none; }
.list-item .row3 { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.list-item .row2 .hint { margin: 0; padding: 0; font-size: 12px; }
.list .empty { background: transparent; }
.list-head { display: none; }

/* actiuni pe un rand (editeaza / sterge) - pastile mici, usor de atins */
.mini-link, .mini-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--fill); color: var(--accent);
  border: none; border-radius: 999px; padding: 5px 11px; min-height: 0; width: auto;
  font: inherit; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.mini-link .ic, .mini-btn .ic { width: 14px; height: 14px; }
.mini-btn:active, .mini-link:active { background: var(--fill-strong); transform: none; }
.mini-btn.danger { color: var(--danger); background: var(--danger-soft); }
.inline-form { margin: 0; display: inline; }

.pending-tag { font-size: 12px; color: var(--warning); font-weight: 600; }
#offlineStatus:not(:empty) {
  background: var(--warning-soft); color: var(--warning); padding: 10px 14px;
  border-radius: 12px; font-size: 14px; font-weight: 600;
  margin-bottom: 0.8rem; text-align: center;
}
.list-item[data-pending] { opacity: 0.75; }
.sold-datorie { color: var(--danger) !important; }
.sold-achitat { color: var(--success) !important; }
.list-item .amount.sold-achitat { font-weight: 600; font-size: 13px; }
.stare-achitat { color: var(--success); font-weight: 600; }
.stare-partial { color: var(--warning); font-weight: 600; }
.stare-neachitat { color: var(--danger); font-weight: 600; }
form.card > .situatie-client,
form.card > details.prioritate { flex: 0 0 100%; max-width: 100%; }
.situatie-client { display: flex; flex-wrap: wrap; gap: 8px; }
.situatie-client > div { flex: 1 1 110px; background: var(--input-bg); border-radius: var(--radius-sm); padding: 8px 12px; }
.situatie-client .val { font-size: 17px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.situatie-client .lbl { font-size: 12px; color: var(--text-secondary); }
form.card > details.prioritate summary { text-align: center; }
.list-item .preturi-row span { flex: 1; }
.empty { text-align: center; color: var(--text-tertiary); padding: 2.2rem 1rem; font-size: 15px; }
.preview-suma { text-align: center; font-size: 20px; font-weight: 700; color: var(--accent); min-height: 1.4rem; font-variant-numeric: tabular-nums; }
.preview-suma:empty { display: none; }

.status { padding: 0.2rem 0.6rem; border-radius: 20px; font-size: 12px; font-weight: 600; }
.status-in-lucru { background: var(--warning-soft); color: var(--warning); }
.status-finalizat { background: var(--success-soft); color: var(--success); }
.status-anulat { background: var(--danger-soft); color: var(--danger); }

.back-link { display: inline-flex; align-items: center; gap: 2px; margin-bottom: 0.8rem; color: var(--accent); text-decoration: none; font-size: 16px; }

/* ---------- Tabele ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 1.2rem; border-radius: var(--radius); background: var(--bg-elevated); }
.table-scroll .simple-table { margin-bottom: 0; }
.simple-table { width: 100%; border-collapse: collapse; background: var(--bg-elevated); border-radius: var(--radius); overflow: hidden; margin-bottom: 1.2rem; font-variant-numeric: tabular-nums; }
.simple-table th, .simple-table td { text-align: left; padding: 10px 14px; font-size: 14px; border-bottom: 0.5px solid var(--separator); white-space: nowrap; }
.simple-table th { color: var(--table-header); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
.simple-table tr:last-child td { border-bottom: none; }

.report-client-title { font-size: 20px; margin: 0.4rem 0 0.6rem; }
.print-btn {
  display: flex; align-items: center; justify-content: center; text-decoration: none;
  background: var(--secondary-btn-bg); color: #fff; border: none; padding: 13px 18px;
  border-radius: 12px; font-weight: 600; font-size: 17px;
  min-height: 50px; margin-bottom: 1.2rem;
}
.print-btn:active { background: var(--secondary-btn-active); }

/* Preturi custom per client */
.override-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: flex-end; margin-top: 0.6rem; }
.override-form label { flex: 1; min-width: 70px; font-size: 12px; color: var(--text-secondary); display: flex; flex-direction: column; gap: 0.2rem; }
.override-form input { padding: 8px 10px; font-size: 16px; }
.override-form button { flex-basis: 100%; padding: 10px 14px; font-size: 15px; min-height: 40px; }

/* ---------- Rutiere ---------- */
.route-search { margin-bottom: 0.8rem; }
.route-search-box { position: relative; }
.route-search-box svg { position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-tertiary); pointer-events: none; }
.route-search-box input { padding-left: 2.2rem; }
.chips { display: flex; gap: 0.4rem; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 0.6rem 0 0.1rem; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 13px; border-radius: 999px; background: var(--chip-bg);
  color: var(--text); font-size: 14px; font-weight: 500; border: none; width: auto;
  white-space: nowrap; cursor: pointer; min-height: 0;
}
.chip:active { background: var(--fill-strong); transform: none; }
.chip.active { background: var(--accent-soft); color: var(--accent); }
.route-toggle { display: flex; align-items: center; gap: 0.45rem; margin: 0.6rem 0.2rem 0; font-size: 14px; color: var(--text-secondary); }
.route-toggle input { margin: 0; }
.route-count { font-size: 13px; color: var(--text-tertiary); margin: 0 0 0.5rem; padding: 0 0.2rem; }
.route-list { display: flex; flex-direction: column; margin-bottom: 1.2rem; background: var(--bg-elevated); border-radius: var(--radius); overflow: hidden; }
.route-item { position: relative; display: flex; align-items: center; gap: 0.8rem; background: var(--bg-elevated); padding: 11px 14px; }
.route-item + .route-item::before { content: ""; position: absolute; top: 0; right: 0; left: 72px; border-top: 1px solid var(--border-light); }
.route-time { flex: none; width: 3.4rem; text-align: center; font-variant-numeric: tabular-nums; font-size: 17px; font-weight: 700; }
.route-time small { display: block; font-size: 10px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.04em; }
.route-info { flex: 1; min-width: 0; }
.route-dir { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.route-meta { margin-top: 0.15rem; font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.route-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-tertiary); }
.route-meta .probabil { font-style: italic; color: var(--text-tertiary); }
.route-stop-match { margin-top: 0.2rem; font-size: 12px; color: var(--accent); overflow-wrap: break-word; }
.route-status { flex: none; font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 6px; white-space: nowrap; }
.route-status.ok { color: var(--status-ok); background: var(--status-ok-bg); }
.route-status.soon { color: var(--status-soon); background: var(--status-soon-bg); }
.route-status.gone { color: var(--status-gone); background: var(--status-gone-bg); }

/* ---------- Control segmentat ---------- */
.segmented { display: flex; background: var(--fill); border-radius: 9px; padding: 2px; gap: 2px; }
.seg-btn {
  flex: 1; background: none; border: none; color: var(--text);
  padding: 7px 6px; font-size: 14px; font-weight: 500; width: auto;
  border-radius: 7px; min-height: 0; cursor: pointer;
}
.seg-btn:active { background: none; transform: none; opacity: .7; }
.seg-btn.active { background: var(--bg-elevated); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 0 0 0.5px rgba(0,0,0,0.04); }
:root[data-theme="dark"] .seg-btn.active { background: #636366; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg-btn.active { background: #636366; } }

/* ---------- Mesaje ---------- */
.form-error, .login-error { background: var(--danger-soft); color: var(--danger); padding: 11px 14px; border-radius: 12px; font-size: 14px; font-weight: 500; margin-bottom: 1rem; }
.form-success { background: var(--success-soft); color: var(--success); padding: 11px 14px; border-radius: 12px; font-size: 14px; font-weight: 500; margin-bottom: 1rem; }
details summary.mini-link { cursor: pointer; margin-bottom: 0.6rem; list-style: none; }
details summary.mini-link::-webkit-details-marker { display: none; }
.cancel-link { display: inline-block; margin-top: 0.2rem; font-size: 15px; color: var(--text-secondary); text-decoration: none; text-align: center; }
.tip-contract { color: var(--accent); font-weight: 600; }

/* randurile care se deschid la apasare (Lucrari): pe telefon fara butoane pe rand */
.list-item[data-href] { cursor: pointer; }
.list-item[data-href]:active { background: var(--fill); }
@media (max-width: 899px) {
  /* cardul ramas singur pe ultimul rand (ex. Datorie la Raport) ocupa tot randul */
  .report-grid > .report-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .report-grid { grid-template-columns: 1fr 1fr; }
  /* Raport: Client / Tip de lucrare pe cate un rand, ca lista cu bife sa
     aiba toata latimea (altfel numele se rupeau pe doua randuri) */
  .filtre-sheet form.card > .field-group { flex-basis: 100%; max-width: 100%; }
  /* campul ramas singur pe ultimul rand (ex. Cantitate la Azi) ocupa tot randul */
  form.card > label:last-of-type:nth-of-type(odd) { flex-basis: 100%; max-width: 100%; }
  .list.rows .list-item[data-href] .row3 { display: none; }
  /* pe telefon: observatia (dreapta) se taie, nu impinge randul; "Acoperă" pe max 2 randuri */
  .plati-wrap .list-item .row2:not(.row-meta) > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
  .plati-wrap .list-item .row-meta .hint { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
  .fara-date { display: none; }
}
.btn-danger {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  background: var(--danger-soft); color: var(--danger); margin-top: 12px;
}
.btn-danger .ic { width: 18px; height: 18px; }
.btn-danger:active { background: var(--danger-soft); opacity: .8; }
.sheet-delete { margin: 0; }

/* pagini dezactivate temporar (ex. Rutiere) - vizibile, dar nu se deschid */
.settings-list .list-item.disabled { opacity: 0.45; cursor: not-allowed; }
.nav-disabled { display: none; }

/* Plati pe desktop: Client | Data · tip | Observatii | Suma | Actiuni */
.rows-wrap.plati-wrap { --cols: minmax(0, 1.5fr) minmax(0, 1.5fr) minmax(0, 1.4fr) 120px 190px; }

/* Clienti: avatar langa nume, telefonul apasabil (suna) */
.rows-wrap.clienti-wrap { --cols: minmax(0, 1.6fr) 140px minmax(0, 1.2fr) 130px 300px; }
.client-name { display: flex; align-items: center; gap: 10px; }
.client-name .avatar { width: 30px; height: 30px; font-size: 12px; }
.tel-link { color: inherit; text-decoration: none; }
.clienti-wrap .list.rows .list-item .row2 { padding-left: 40px; }
.client-links { margin-bottom: 0.4rem; }
.sheet-body h3 { padding: 0 4px; margin-top: 1.2rem; }
.sheet-body > .list { background: var(--bg-elevated); }

/* ---------- Raport universal ---------- */
.filtre-rezumat {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 0;
  background: var(--bg-elevated); color: var(--text); text-align: left;
  padding: 12px 14px; border-radius: var(--radius); margin-bottom: 14px;
  font-size: 15px; font-weight: 500;
}
.filtre-rezumat:active { background: var(--fill); transform: none; }
.filtre-rezumat > .ic:first-child { width: 18px; height: 18px; color: var(--accent); }
.filtre-rezumat > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filtre-rezumat .chev { width: 16px; height: 16px; color: var(--text-muted); stroke-width: 2.4; }
.raport-rezultate { min-width: 0; }

@media (max-width: 899px) {
  /* tabelul devine lista de randuri: grupa ca titlu, cifrele dedesubt cu eticheta lor */
  .report-table, .report-table tbody { display: block; }
  .report-table tr.head-row { display: none; }
  .report-table tr {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 2px 12px;
    padding: 11px 16px; position: relative;
  }
  .report-table tr + tr::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--border-light); }
  .report-table tr.head-row + tr::before { display: none; }
  .report-table td { padding: 0; border: none; white-space: normal; }
  .report-table td.dim { grid-column: 1 / -1; font-size: 16px; font-weight: 600; }
  .report-table td.dim + td.dim { font-size: 14px; font-weight: 400; color: var(--text-secondary); margin-top: -1px; }
  .report-table td.num { text-align: left !important; font-size: 15px; font-weight: 600; margin-top: 6px; }
  .report-table td.num::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.03em; }
  .report-table td.empty { grid-column: 1 / -1; }
  /* grupuri: prima dimensiune ca titlu de sectiune, cu subtotal */
  .report-table tr.grup-cap { display: block; padding: 14px 16px 6px; background: var(--fill); }
  .report-table tr.grup-cap::before { display: none; }
  .report-table tr.grup-cap td { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 16px; font-weight: 700; }
  .report-table tr.grup-cap .grup-total { font-size: 13px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
  .report-table tr.grup-cap .grup-total.sold-datorie { color: var(--danger); }
  .report-table tr.in-grup td.dim:first-child { display: none; }
  .report-table tr.in-grup td.dim:first-child + td.dim { font-size: 15px; font-weight: 600; color: var(--text); margin-top: 0; }
  .report-table tr.grup-cap + tr::before { display: none; }
  /* totalurile: un singur card compact cu coloane */
  .report-grid.raport-sumar { display: flex; gap: 0; background: var(--bg-elevated); border-radius: var(--radius); padding: 4px 0; }
  .report-grid.raport-sumar .report-card { flex: 1 1 0; background: none; border-radius: 0; padding: 10px 12px; }
  .report-grid.raport-sumar .report-card + .report-card { border-left: 1px solid var(--border-light); }
  .report-grid.raport-sumar .report-card .value { font-size: 17px; letter-spacing: -0.01em; }
  .report-grid.raport-sumar .report-card .label { font-size: 11px; line-height: 1.25; }
  .report-grid.raport-sumar > .report-card:last-child:nth-child(odd) { grid-column: auto; }
  .table-scroll:has(.report-table) { overflow: visible; }
}

/* ---------- Etichete, butoane secundare ---------- */
.badge {
  display: inline-block; vertical-align: middle;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  padding: 2px 7px; border-radius: 6px;
  background: var(--fill); color: var(--text-secondary);
  white-space: nowrap;
}
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.list-item .row1 .badge { font-size: 11px; }
.btn-icon, .print-btn { gap: 8px; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; }
.btn-icon .ic, .print-btn .ic { width: 18px; height: 18px; }
.btn-secondary {
  width: 100%; background: var(--fill); color: var(--text);
}
.btn-secondary:active { background: var(--fill-strong); }
.sheet-actions { display: flex; gap: 10px; margin-top: 12px; }
.sheet-actions > form { flex: 1; margin: 0; }
.sheet-actions .btn-danger { margin-top: 0; }
.text-link {
  display: inline-block; margin: 0 4px 0.8rem; cursor: pointer; list-style: none;
  color: var(--accent); font-size: 15px; font-weight: 500;
}
.text-link::-webkit-details-marker { display: none; }

/* Preturi: valorile pe valute (pe telefon doar cele completate) */
.pret-val { font-variant-numeric: tabular-nums; }
.pret-val small { font-size: 0.85em; color: var(--text-tertiary); font-weight: 500; }
.list-item .preturi-row { justify-content: flex-start; gap: 14px; }
.list-item .preturi-row span { flex: none; }
.pret-client-item .row1 { align-items: center; }
.pret-client-item .override-form { margin-top: 10px; }

/* Login: aceeasi marca ca in bara laterala */
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: var(--brand-grad); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
}
.brand-mark .ic { width: 19px; height: 19px; stroke-width: 2; }
.login-logo { margin-bottom: 12px; line-height: 0; }
.login-logo .brand-mark { width: 64px; height: 64px; border-radius: 16px; box-shadow: 0 6px 20px rgba(90,138,230,0.2); }
.login-logo .brand-mark .ic { width: 36px; height: 36px; stroke-width: 1.8; }

/* explicatie restransa (Raport universal) */
.info-mic { margin: 0 4px 12px; font-size: 13px; color: var(--text-secondary); }
.info-mic summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--accent); font-weight: 500; list-style: none; }
.info-mic summary::-webkit-details-marker { display: none; }
.info-mic summary .ic { width: 14px; height: 14px; }
.info-mic p { margin: 6px 0 0; line-height: 1.4; }
@media (min-width: 900px) { .report-table tr.grup-cap { display: none; } }

/* ---------- Filtrele Raportului: totul pe un singur ecran ---------- */
.filtre-sheet form.card { gap: 12px; padding: 14px; }
.filtre-sheet form.card > fieldset, .filtre-sheet form.card > .filtre-rand { flex: 0 0 100%; max-width: 100%; }
.filtre-sheet form.card fieldset legend { margin-bottom: 4px; font-size: 12px; }
.filtre-rand { display: grid; gap: 10px; }
.filtre-rand.doua { grid-template-columns: 1fr 1fr; }
.filtre-rand.trei { grid-template-columns: 0.85fr 1.3fr 1fr; }
.filtre-rand > label, .filtre-rand > .field-group {
  display: flex; flex-direction: column; gap: 5px; min-width: 0; max-width: none;
  font-size: 12px; font-weight: 500; color: var(--text-secondary);
}
.filtre-sheet .filtre-rand input:not([type="checkbox"]), .filtre-sheet .filtre-rand select, .filtre-sheet .ms-toggle {
  min-height: 42px; padding-top: 8px; padding-bottom: 8px; font-size: 16px;
}
.filtre-sheet .filtre-rand select { padding-left: 10px; padding-right: 26px; background-position: right 9px center; }
.filtre-sheet .filtre-rand input[type="date"] { min-width: 0; padding-left: 10px; padding-right: 30px; background-position: right 8px center; background-size: 16px; }
.filtre-sheet .ms-toggle { padding-left: 10px; padding-right: 26px; background-position: right 9px center; }
/* listele cu bife se deschid pe toata latimea randului, nu doar a coloanei */
.ms-rand { position: relative; }
.ms-rand .ms-dropdown { position: static; }
.ms-rand .ms-panel { left: 0; right: 0; }
.filtre-sheet form.card fieldset .toggle-chip { padding: 6px 12px; font-size: 14px; }
.filtre-sheet form.card fieldset .toggle-chip:has(input:checked) { padding-left: 10px; }
.filtre-sheet .toggle-chips { gap: 6px; }
.filtre-sheet .switch-list { padding: 0 12px; }
.filtre-sheet form.card fieldset .switch-row { padding: 5px 0; font-size: 15px; }
.filtre-sheet form.card > button { min-height: 46px; margin-top: 2px; }
.filtre-sheet .sheet-head { padding-top: 12px; padding-bottom: 6px; }

/* ---------- Rapoarte ---------- */
.rap-layout > * { min-width: 0; }
form.card.fisa-form { gap: 12px; }
form.card.fisa-form > label.full, form.card.fisa-form > .fisa-perioada { flex: 0 0 100%; max-width: 100%; }
.fisa-perioada { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; }
.fisa-perioada label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-secondary); min-width: 0; }
.fisa-gol { flex-direction: row; align-items: center; gap: 14px; color: var(--text-secondary); font-size: 15px; }
.fisa-gol .ic { width: 28px; height: 28px; color: var(--accent); flex: none; }

.fisa-head { display: flex; align-items: center; gap: 12px; margin: 6px 0 12px; }
.fisa-head .avatar { width: 44px; height: 44px; font-size: 16px; }
.fisa-head-text { flex: 1; min-width: 0; }
.fisa-nume { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fisa-perioada-label { font-size: 14px; color: var(--text-secondary); }
.fisa-pdf { flex: none; text-decoration: none; }

.fisa-sumar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 6px; }
.fisa-sumar > div { background: var(--bg-elevated); border-radius: var(--radius); padding: 14px 16px; }
.fisa-sumar .lbl { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.fisa-sumar .val { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.fisa-sumar .val span { font-size: 15px; color: var(--text-secondary); font-weight: 600; }
.fisa-sumar .sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.sumar-sold { grid-column: 1 / -1; }
.sumar-sold .val { font-size: 36px; }
.sumar-sold.e-datorie { background: var(--danger-soft) !important; }
.sumar-sold.e-datorie .val { color: var(--danger); }
.sumar-sold.e-achitat { background: var(--success-soft) !important; }
.sumar-sold.e-achitat .val { color: var(--success); }
.muted { color: var(--text-tertiary); font-weight: 500; }

.datorii-total { gap: 2px; background: var(--danger-soft); }
.datorii-total .lbl { font-size: 13px; font-weight: 600; color: var(--danger); text-transform: uppercase; letter-spacing: 0.04em; }
.datorii-total .val { font-size: 32px; font-weight: 800; color: var(--danger); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.datorii-total .val span { font-size: 17px; font-weight: 700; opacity: .8; }
.datorii-total .sub { font-size: 13px; color: var(--text-secondary); }
.bar-list .list-item { padding: 11px 16px 12px; }
.bar { height: 5px; border-radius: 3px; background: var(--fill); margin-top: 8px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 3px; background: var(--danger); opacity: .55; }
.bar.bar-accent > span { background: var(--accent); }
.rank { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 11px; background: var(--fill); color: var(--text-secondary); font-size: 12px; font-weight: 700; margin-right: 8px; vertical-align: 1px; }
.valute-grid .value small { font-size: 15px; color: var(--text-secondary); font-weight: 600; }
.report-table td.gol { display: none; }
/* fisa cu multe lucrari: doar primele 8 (randul 1 e antetul), restul la cerere */
.report-table.restrans tr:nth-child(n+10) { display: none; }
.arata-toate { margin: -8px 0 6px; font-size: 15px; }
@media print { .report-table.restrans tr:nth-child(n+10) { display: table-row !important; } .arata-toate { display: none; } }

/* ---------- Foaie (sheet) - formular deschis peste pagina ---------- */
dialog.sheet {
  border: none; padding: 0; margin: 0;
  position: fixed; inset: auto 0 0 0; width: 100%; max-width: 100%;
  max-height: calc(100dvh - var(--safe-top) - 12px);
  background: var(--bg); color: var(--text);
  border-radius: 14px 14px 0 0;
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
dialog.sheet[open] { display: flex; flex-direction: column; animation: sheet-up .32s cubic-bezier(.32,.72,0,1); }
dialog.sheet::backdrop { background: rgba(0,0,0,0.4); animation: fade-in .25s ease; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.sheet-head {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px 10px;
}
.sheet-head::before { content: ""; position: absolute; top: 6px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: var(--fill-strong); }
.sheet-title { font-size: 17px; font-weight: 600; margin: 0; }
.sheet-close { width: 30px; height: 30px; min-width: 30px; padding: 0; color: var(--text-secondary); }
.sheet-close .ic { width: 16px; height: 16px; stroke-width: 2.4; }
.sheet-close:focus, .sheet-close:focus-visible { outline: none; }
.sheet-body { overflow-y: auto; padding: 0 16px calc(16px + var(--safe-bottom)); -webkit-overflow-scrolling: touch; }
.sheet-body form.card { margin-bottom: 0; }
/* ultimul camp ramas singur pe rand ocupa toata latimea, nu sta centrat */
.sheet-body form.card > label:last-of-type:nth-of-type(odd) { flex-basis: 100%; max-width: 100%; }

/* ---------- Meniu (stil Setari iOS) ---------- */
.settings-list .list-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.settings-list .list-item + .list-item::before { left: 58px; }
.settings-list .tile, .quick-head .tile { filter: saturate(0.6) brightness(1.08); }
.settings-list .tile {
  flex: none; width: 30px; height: 30px; border-radius: 8px; color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.settings-list .tile .ic { width: 18px; height: 18px; stroke-width: 2; }
.settings-list .item-text { flex: 1; min-width: 0; }
.settings-list .item-title { font-size: 16px; font-weight: 500; }
.settings-list .item-sub { font-size: 13px; color: var(--text-secondary); margin-top: 1px; }
.settings-list .chev { color: var(--text-muted); width: 16px; height: 16px; stroke-width: 2.4; }
.settings-list .list-item.danger .item-title { color: var(--danger); }
.settings-list .avatar { width: 46px; height: 46px; font-size: 17px; }
.settings-list .list-item.account + .list-item::before { left: 74px; }
.pref-row { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.pref-row .item-title { font-size: 15px; font-weight: 500; }
.pref-row .segmented { width: 100%; }

.avatar {
  flex: none; width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-grad); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; letter-spacing: 0.02em;
}

/* ---------- Pagina Azi ---------- */
.azi-layout > * { min-width: 0; }
/* cardul mare cu totalul zilei */
.azi-hero {
  position: relative; overflow: hidden;
  border-radius: 22px; padding: 20px 20px 18px; margin-bottom: 16px;
  color: var(--hero-fg);
  background: var(--hero-bg);
  box-shadow: var(--hero-shadow);
}
.hero-label { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--hero-sub); }
.hero-value { font-size: 46px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; margin-top: 4px; font-variant-numeric: tabular-nums; }
.hero-value span { font-size: 22px; font-weight: 700; color: var(--hero-sub); letter-spacing: 0; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; position: relative; z-index: 1; }
.hero-pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--hero-pill); border-radius: 999px; padding: 5px 10px;
  font-size: 13px; font-weight: 600; color: var(--hero-sub);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.hero-pill .ic { width: 14px; height: 14px; stroke-width: 2.2; }
.hero-sun { position: absolute; right: -18px; top: -18px; width: 120px; height: 120px; opacity: 0.14; stroke-width: 1.4; color: var(--accent); }

/* adaugarea rapida */
.quick-card { gap: 14px; }
form.card.quick-card > .quick-head, form.card.quick-card > .quick-row, form.card.quick-card > label.full { flex: 0 0 100%; max-width: 100%; }
.quick-head { display: flex; align-items: center; gap: 12px; }
.quick-head .tile { flex: none; width: 36px; height: 36px; border-radius: 10px; color: #fff; display: flex; align-items: center; justify-content: center; }
.quick-head .tile .ic { width: 20px; height: 20px; stroke-width: 2.4; }
.quick-title { font-size: 17px; font-weight: 700; }
.quick-sub { font-size: 13px; color: var(--text-secondary); margin-top: 1px; }
.quick-sub a { text-decoration: none; font-weight: 500; }
.quick-row { display: flex; gap: 12px; align-items: flex-end; }
.quick-row > label { flex: 1 1 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-secondary); min-width: 0; }
.quick-sum { flex: 0 0 auto; min-width: 104px; text-align: right; padding-bottom: 6px; }
.quick-sum .lbl { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }
.quick-sum .preview-suma { display: block; text-align: right; font-size: 24px; font-weight: 800; min-height: 0; }
.quick-sum .preview-suma:empty::before { content: "—"; color: var(--text-muted); font-weight: 600; }

/* jurnalul zilei */
.azi-item { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; }
.azi-list .list-item + .list-item::before { left: 74px; }
.azi-time {
  flex: none; width: 50px; text-align: center;
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 5px 0;
}
.azi-main { flex: 1; min-width: 0; }
.azi-main .row2 { justify-content: flex-start; gap: 8px; }
.del-btn {
  flex: none; width: 34px; height: 34px; min-height: 0; padding: 0; border-radius: 17px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text-muted);
}
.del-btn .ic { width: 18px; height: 18px; }
.del-btn:active { background: var(--danger-soft); color: var(--danger); transform: none; }

/* ---------- Login ---------- */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; min-height: 100dvh;
  padding: var(--safe-top) env(safe-area-inset-right) var(--safe-bottom) env(safe-area-inset-left);
}
.login-main { width: 100%; padding: 1rem; }
.login-card {
  background: var(--bg-elevated); border-radius: 22px; padding: 2.2rem 1.6rem 1.8rem;
  max-width: 380px; margin: 0 auto; text-align: center; box-shadow: var(--shadow-card);
}
.login-logo { font-size: 3rem; margin-bottom: 0.4rem; }
.login-title { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 1.6rem; }
.login-card form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login-card label { font-size: 13px; font-weight: 500; color: var(--text-secondary); display: flex; flex-direction: column; gap: 6px; }

/* =====================================================================
   Desktop (Mac/PC)
   ===================================================================== */
@media (min-width: 900px) {
  :root { --topbar-h: 64px; }
  :root:not([data-theme="dark"]) { --bg: #f5f5f7; }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #0b0b0c; } }
  :root[data-theme="dark"] { --bg: #0b0b0c; }

  body {
    font-size: 15px;
    padding-left: var(--sidebar-w); padding-right: 0;
    padding-top: calc(var(--banner-h) + var(--topbar-h));
    padding-bottom: 3rem;
  }

  /* bara laterala */
  .sidebar {
    display: flex; flex-direction: column;
    position: fixed; top: var(--banner-h); bottom: 0; left: 0; width: var(--sidebar-w); z-index: 25;
    background: var(--sidebar-bg); border-right: 1px solid var(--border);
  }
  .sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    height: var(--topbar-h); padding: 0 20px; flex: none;
    text-decoration: none; color: var(--text);
  }
  .brand-mark {
    width: 32px; height: 32px; border-radius: 9px; flex: none;
    background: var(--brand-grad); color: #fff;
    display: flex; align-items: center; justify-content: center;
  }
  .brand-mark .ic { width: 19px; height: 19px; stroke-width: 2; }
  .brand-name { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
  .brand-test { font-size: 10px; font-weight: 700; color: #fff; background: #eda65a; border-radius: 5px; padding: 2px 6px; }
  .sidebar-scroll { flex: 1; overflow-y: auto; padding: 4px 12px 16px; }
  .sidebar-group { margin-bottom: 14px; }
  .sidebar-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-tertiary); padding: 8px 10px 5px; }
  .sidebar-group a {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 10px; border-radius: 8px; margin-bottom: 1px;
    color: var(--text); text-decoration: none; font-size: 14px; font-weight: 500;
  }
  .sidebar-group a .ic { width: 18px; height: 18px; color: var(--text-secondary); }
  .sidebar-group a:hover { background: var(--fill); }
  .sidebar-group a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
  .sidebar-group a.active .ic { color: var(--accent); }
  .sidebar-group .nav-disabled {
    display: flex; align-items: center; gap: 10px; padding: 7px 10px; margin-bottom: 1px;
    font-size: 14px; font-weight: 500; color: var(--text-muted); cursor: not-allowed;
  }
  .sidebar-group .nav-disabled .ic { width: 18px; height: 18px; }
  .sidebar-group .nav-disabled em { margin-left: auto; font-style: normal; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
  .sidebar-account {
    flex: none; display: flex; align-items: center; gap: 10px;
    padding: 12px 14px 12px 16px; border-top: 1px solid var(--border);
  }
  .account-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .account-logout {
    flex: none; width: 32px; height: 32px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center; color: var(--text-secondary);
  }
  .account-logout .ic { width: 18px; height: 18px; }
  .account-logout:hover { background: var(--danger-soft); color: var(--danger); }

  nav.tabbar { display: none; }

  /* antetul paginii */
  .topbar {
    left: var(--sidebar-w); padding-top: 0;
    background: var(--topbar-overlay);
    -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
  }
  .topbar-inner { justify-content: flex-start; max-width: 1240px; margin: 0 auto; padding: 0 36px; }
  .topbar-title { opacity: 1; transform: none; font-size: 22px; font-weight: 700; letter-spacing: -0.015em; max-width: none; }
  .topbar-actions { right: 36px; gap: 8px; }
  .page-head { display: none; }
  .icon-btn { height: 36px; padding: 0 14px 0 11px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 14px; }
  .icon-btn .ic { width: 17px; height: 17px; stroke-width: 2.2; }
  .icon-btn .btn-text { display: inline; }
  .icon-btn:hover { background: var(--accent-active); }
  .action-btn { height: 36px; border-radius: 9px; font-size: 14px; box-shadow: none; padding: 0 14px 0 11px; }
  .action-btn .ic { width: 17px; height: 17px; }
  .action-btn:hover { background: var(--fill-strong); }
  .action-btn:active { transform: none; }

  main { max-width: 1240px; padding: 28px 36px; }

  h3 { padding: 0 2px; margin-top: 1.8rem; font-size: 12px; }
  .hint { font-size: 13px; }

  /* carduri cu umbra fina in loc de diferenta de fundal */
  .card, form.card, .list, .report-card, .table-scroll, .simple-table, .route-list { box-shadow: var(--shadow-card); }
  .table-scroll .simple-table { box-shadow: none; }
  .report-card { padding: 16px 20px; }
  .report-card .value { font-size: 28px; }

  form.card { padding: 20px; gap: 16px 16px; justify-content: flex-start; }
  form.card label, form.card .field-group {
    flex: 0 0 calc((100% - (var(--form-cols, 1) - 1) * 16px) / var(--form-cols, 1));
    max-width: calc((100% - (var(--form-cols, 1) - 1) * 16px) / var(--form-cols, 1));
    font-size: 12px;
  }
  form.card > .date-range-row { justify-content: flex-start; }
  form.card > .date-range-row label { flex: 0 1 220px; }
  form.card > button { width: auto; min-width: 200px; }
  form.card > .preview-suma { text-align: left; }
  input, select, textarea, .ms-toggle { padding: 8px 11px; font-size: 14px; border-radius: 8px; }
  select { padding-right: 30px; background-position: right 10px center; }
  button { padding: 9px 18px; min-height: 38px; font-size: 14px; border-radius: 8px; }
  button:active { transform: none; }
  .stepper-btn { width: 36px; height: 36px; flex-basis: 36px; min-height: 36px; font-size: 20px; border-radius: 8px; }
  .print-btn { min-height: 38px; font-size: 14px; border-radius: 8px; padding: 9px 18px; display: inline-flex; }

  /* listele: randuri pe toata latimea, cu hover */
  .list-item { padding: 12px 18px; }
  .list-item .row1 { font-size: 15px; }
  .list-item .row2 { font-size: 13px; }
  .list-item + .list-item::before { left: 0; }
  a.list-item:hover { background: var(--fill); }

  /* .list.rows = lista afisata ca tabel pe desktop (Lucrari, Azi, Plati):
     row1/row2 dispar ca blocuri (display: contents) si celulele lor se
     aseaza pe coloane: Lucrare | Client | Data | Suma | Actiuni */
  .list-head {
    display: grid; grid-template-columns: var(--cols);
    gap: 16px; padding: 10px 18px;
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-tertiary);
    background: var(--bg-elevated); border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: 1px solid var(--border); box-shadow: var(--shadow-card);
  }
  .list-head > .r { text-align: right; }
  .list-head + .list { border-radius: 0 0 var(--radius) var(--radius); }
  .rows-wrap { --cols: minmax(0, 2.2fr) minmax(0, 1.6fr) 130px 120px 190px; }
  .rows-wrap.no-edit { --cols: minmax(0, 2.2fr) minmax(0, 1.6fr) 90px 120px 110px; }
  .list.rows .list-item {
    display: grid; grid-template-columns: var(--cols); gap: 4px 16px; align-items: center;
    padding: 10px 18px;
  }
  .list.rows .list-item:hover { background: color-mix(in srgb, var(--fill) 50%, transparent); }
  .list.rows .row1, .list.rows .row2 { display: contents; }
  .list.rows .row1 > span:first-child { order: 1; font-weight: 600; font-size: 14px; }
  .list.rows .row2 > span:first-child { order: 2; font-size: 14px; color: var(--text); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .list.rows .row2 > span:last-child { order: 3; font-size: 13px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
  .list.rows .row1 > .amount { order: 4; text-align: right; font-size: 14px; }
  .list.rows .row3 { order: 5; margin: 0; justify-content: flex-end; flex-wrap: nowrap; }
  .clienti-wrap .list.rows .list-item .row2 { padding-left: 0; }
  .rows-wrap.preturi-wrap { --cols: minmax(0, 2fr) 120px 120px 120px 170px; }
  .preturi-wrap .list.rows .row2.preturi-row > span { order: 2; text-align: right; font-size: 14px; color: var(--text); }
  .preturi-wrap .list.rows .row2.preturi-row > span.fara-date { color: var(--text-muted); }
  .sheet-actions { justify-content: flex-start; }
  .sheet-actions > form { flex: none; }
  .btn-secondary { width: auto; }
  .print-btn .ic { width: 16px; height: 16px; }
  .tel-link:hover { color: var(--accent); }
  .list.rows .row-meta { order: 6; grid-column: 1 / -1; display: block; margin-top: -2px; }
  .list.rows .empty { grid-column: 1 / -1; }
  .mini-link, .mini-btn { padding: 4px 10px; font-size: 12px; }

  /* lista de carduri obisnuita (ex. Clienti, Preturi) - grid de carduri */
  .list:not(.rows):not(.settings-list) {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px; background: transparent; box-shadow: none; overflow: visible;
  }
  .list:not(.rows):not(.settings-list) > .list-item { border-radius: var(--radius); box-shadow: var(--shadow-card); }
  .list:not(.rows):not(.settings-list) > .list-item + .list-item::before { display: none; }
  .list:not(.rows):not(.settings-list) > .empty { grid-column: 1 / -1; }
  .list-item .preturi-row span { flex: none; }
  .list-item .preturi-row { justify-content: flex-start; gap: 1.2rem; }

  /* Azi: adaugarea rapida in stanga, ziua in dreapta */
  .azi-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 28px; align-items: start; }
  .azi-add { position: sticky; top: calc(var(--banner-h) + var(--topbar-h) + 28px); }
  .azi-add form.card label { flex-basis: 100%; max-width: 100%; }
  .azi-add form.card > button { width: 100%; }
  .azi-layout h3:first-child, .azi-day h3 { margin-top: 0; }
  .azi-hero { padding: 26px 30px; margin-bottom: 28px; }
  .hero-value { font-size: 52px; }
  .del-btn:hover { background: var(--danger-soft); color: var(--danger); filter: none; }

  /* Raport: filtrele fixe in stanga (aceeasi foaie, afisata permanent), rezultatele in dreapta */
  .raport-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 28px; align-items: start; }
  .filtre-btn, .filtre-rezumat { display: none !important; }
  dialog.sheet.filtre-sheet {
    display: block; position: sticky; top: calc(var(--banner-h) + var(--topbar-h) + 28px);
    inset: auto; margin: 0; width: auto; max-height: calc(100vh - var(--banner-h) - var(--topbar-h) - 56px);
    overflow-y: auto; animation: none; background: var(--bg-elevated);
    border-radius: var(--radius); box-shadow: var(--shadow-card); z-index: 1;
  }
  .filtre-sheet .sheet-head { padding: 16px 18px 4px; }
  .filtre-sheet .sheet-title { font-size: 15px; }
  .filtre-sheet .sheet-close { display: none; }
  .filtre-sheet .sheet-body { padding: 0 18px 18px; overflow: visible; }
  .filtre-sheet .filtre-rand input:not([type="checkbox"]), .filtre-sheet .filtre-rand select, .filtre-sheet .ms-toggle { min-height: 34px; font-size: 13px; padding-top: 6px; padding-bottom: 6px; }
  .filtre-sheet .filtre-rand select, .filtre-sheet .ms-toggle { padding-left: 8px; padding-right: 22px; background-position: right 7px center; }
  .filtre-sheet .filtre-rand input[type="date"] { padding-left: 8px; padding-right: 24px; background-position: right 6px center; background-size: 14px; font-size: 12px; }
  .filtre-rand { gap: 8px; }
  .filtre-rand > label, .filtre-rand > .field-group { font-size: 11px; gap: 4px; }
  .filtre-sheet form.card { gap: 12px; padding: 4px 0 0; }
  .filtre-sheet form.card fieldset .toggle-chip { flex: none; max-width: none; padding: 6px 12px; font-size: 13px; }
  .filtre-sheet form.card fieldset .toggle-chip:has(input:checked) { padding-left: 10px; }
  .filtre-sheet .toggle-chip:has(input:checked) .chip-check { width: 13px; height: 13px; margin-right: 4px; }
  .filtre-sheet form.card fieldset .switch-row { font-size: 13px; padding: 7px 0; }
  .filtre-sheet .switch-list { padding: 0 10px; }
  .filtre-sheet form.card > .date-range-row label { flex: 1 1 100%; min-width: 0; }
  .filtre-sheet form.card > button { width: 100%; }
  .filtre-sheet .ms-panel { position: static; margin-top: 6px; box-shadow: none; border: 1px solid var(--border); }
  .raport-rezultate .report-grid { margin-top: 0; }

  /* Rapoarte: fisa clientului in stanga, panoul general in dreapta */
  .rap-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
  .rap-layout h3:first-child { margin-top: 0; }
  .rap-general { position: sticky; top: calc(var(--banner-h) + var(--topbar-h) + 28px); max-height: calc(100vh - var(--banner-h) - var(--topbar-h) - 56px); overflow-y: auto; padding-right: 4px; }
  .rap-general > h3:first-child { margin-top: 0; }
  .rap-general .list { display: flex; background: var(--bg-elevated); box-shadow: var(--shadow-card); gap: 0; }
  .rap-general .list > .list-item { border-radius: 0; box-shadow: none; }
  .rap-general .list > .list-item + .list-item::before { display: block; left: 16px; }
  .rap-general .valute-grid { grid-template-columns: 1fr 1fr; }
  .rap-fisa .tip-list { display: flex; background: var(--bg-elevated); box-shadow: var(--shadow-card); gap: 0; }
  .rap-fisa .tip-list > .list-item { border-radius: 0; box-shadow: none; }
  .rap-fisa .tip-list > .list-item + .list-item::before { display: block; left: 16px; }
  .fisa-sumar { grid-template-columns: 1.4fr 1fr 1fr; }
  .sumar-sold { grid-column: auto; }
  .report-table td.gol { display: table-cell; }
  .fisa-nume { font-size: 24px; }

  /* Meniu pe desktop: limitat ca latime, arata ca o pagina de setari */
  .settings-wrap { max-width: 720px; }
  .settings-list .list-item:hover { background: var(--fill); }
  .pref-row { flex-direction: row; align-items: center; justify-content: space-between; }
  .pref-row .segmented { width: 280px; }
  input[type="date"] { min-height: 36px; }

  /* foaia devine fereastra centrata */
  dialog.sheet {
    inset: 0; margin: auto; width: min(720px, calc(100vw - 64px)); height: fit-content;
    max-height: calc(100vh - 96px); border-radius: 16px; background: var(--bg-elevated);
  }
  dialog.sheet[open] { animation: pop-in .2s cubic-bezier(.2,.9,.3,1.2); }
  @keyframes pop-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
  .sheet-head { padding: 18px 22px 8px; }
  .sheet-head::before { display: none; }
  .sheet-title { font-size: 18px; }
  .sheet-close { background: var(--fill); color: var(--text-secondary); }
  .sheet-close:hover { background: var(--fill-strong); }
  .sheet-body { padding: 0 22px 22px; }
  .sheet-body form.card { box-shadow: none; padding: 4px 0 0; }
  .btn-danger { width: auto; display: inline-flex; margin-top: 14px; }
  .list.rows .list-item[data-href]:active { background: var(--fill); }

  .login-body { padding-left: 0; }
}

@media (min-width: 900px) and (max-width: 1100px) {
  :root { --sidebar-w: 216px; }
  main { padding: 24px 24px; }
  .topbar-inner { padding: 0 24px; }
  .topbar-actions { right: 24px; }
  .azi-layout { grid-template-columns: 330px minmax(0, 1fr); gap: 20px; }
  .rows-wrap { --cols: minmax(0, 2fr) minmax(0, 1.4fr) 120px 100px 170px; }
  .rows-wrap.clienti-wrap { --cols: minmax(0, 1.5fr) 120px minmax(0, 1fr) 110px 290px; }
}

/* Doar pentru dispozitive cu mouse real - evita hover-uri "lipite" pe atingere */
@media (hover: hover) and (pointer: fine) {
  button:hover { filter: brightness(1.06); }
  .mini-btn:hover, .mini-link:hover { filter: brightness(0.96); }
  .back-link:hover, .cancel-link:hover { text-decoration: underline; }
  nav.tabbar a:hover { color: var(--accent); }
}

@media print {
  nav.tabbar, .topbar, .sidebar, .page-head, .test-banner, .print-btn, #fisaForm, .rap-general, .fisa-pdf { display: none !important; }
  body { padding: 0 !important; background: #fff; }
  main { max-width: 100%; }
  main > *:not(.print-area):not(.rap-fisa) { display: none !important; }
  .rap-fisa > *:not(.print-area) { display: none !important; }
  .rap-layout { display: block !important; }
}

/* starea serverului (offline-queue.js): copie salvata / server jos / revenit */
#fmServerBanner {
  margin: 0 0 12px; padding: 10px 14px; border-radius: 12px;
  font-size: 14px; line-height: 1.35;
  background: var(--warning-soft); border: 1px solid rgba(255, 159, 10, 0.4);
}
#fmServerBanner[hidden] { display: none; }
#fmServerBanner.revenit { cursor: pointer; background: var(--success-soft); border-color: rgba(52, 199, 89, 0.45); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
