/* d2 — ajustările de design (2.10), active doar cu comutatorul `design-nou` (body.d2).
   Singurul loc pentru culori, forme și componente comune. Paginile NU scriu culori direct: folosesc variabilele de aici.
   Reguli: aer, tipografie Inter, suprafețe albe pe fond gri deschis, fără chenare, colțuri rotunjite, umbră fină;
   negru pentru acțiuni și linkuri; VERDE DOAR PENTRU „DA” (--yes): nota peste prag, Analizăm/Merită, în interval. */

body.d2 {
  /* paleta nouă */
  --d2-bg: #f5f5f7; --d2-surface: #ffffff; --d2-fg: #1d1d1f; --d2-muted: #545458; --d2-soft: #636366;
  --d2-hair: #e8e8ed; --d2-seg: #ececf0; --d2-plate: #f5f5f7;
  /* contur pentru câmpuri și butoane ghost: ≥ 3:1 pe card și pe fond (WCAG 1.4.11, ui-ajustari-s1) */
  --d2-edge: #8c8c91;
  --d2-yes: #17783f; --d2-yes-bg: #e8f5ec; --d2-no: #b42318; --d2-no-bg: #fdecea; --d2-warn: #9a5300;
  --d2-shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 24px rgba(0,0,0,.06);
  --d2-r-sm: 8px; --d2-r: 14px; --d2-r-lg: 18px;
  --d2-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  /* variabilele vechi, remapate: tot ce nu are pagină d2/ capătă aspectul nou */
  --ground: var(--d2-bg); --card: var(--d2-surface); --panel: var(--d2-plate); --line: var(--d2-hair);
  --ink: var(--d2-fg); --ink-2: var(--d2-muted); --ink-3: var(--d2-soft);
  --acc: var(--d2-fg); --acc-ink: #ffffff; --acc-soft: var(--d2-seg);
  --radius: var(--d2-r);
  background: var(--d2-bg); color: var(--d2-fg);
  font: 15px/1.5 var(--d2-font); -webkit-font-smoothing: antialiased; letter-spacing: -.003em;
}
@media (prefers-color-scheme: dark) {
  body.d2 {
    --d2-bg: #000000; --d2-surface: #1c1c1e; --d2-fg: #f5f5f7; --d2-muted: #a1a1a6; --d2-soft: #949499;
    --d2-hair: #2c2c2e; --d2-edge: #8c8c91; --d2-seg: #2c2c2e; --d2-plate: #161618;
    --d2-yes: #4cd07d; --d2-yes-bg: #12301d; --d2-no: #ff6b5e; --d2-no-bg: #3a1714; --d2-warn: #e5a55c;
    --d2-shadow: 0 1px 2px rgba(0,0,0,.5);
    --acc-ink: #000000;
  }
}

/* linkuri și butoane: negru, nu verde */
body.d2 a { color: var(--d2-fg); text-decoration-color: var(--d2-hair); text-underline-offset: 3px; }
body.d2 a:hover { text-decoration-color: currentColor; }
body.d2 :focus-visible { outline: 2px solid var(--d2-fg); outline-offset: 2px; }
/* pe butoanele negre, conturul de focus stă la 3 px, ca să nu se confunde cu butonul */
body.d2 .btn.primary:focus-visible, .d2 .d2-pill.on:focus-visible, body.d2 .tb-btn.on:focus-visible { outline-offset: 3px; }
body.d2 .btn { border-radius: 999px; border: 0; background: var(--d2-seg); color: var(--d2-fg); font-weight: 500; box-shadow: none; }
body.d2 .btn.primary { background: var(--d2-fg); color: var(--d2-surface); }
body.d2 .btn.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--d2-edge); }

/* suprafețe: fără chenare, colțuri și umbră fină */
body.d2 .card { border: 0; border-radius: var(--d2-r-lg); box-shadow: var(--d2-shadow); background: var(--d2-surface); }
body.d2 input, body.d2 select, body.d2 textarea {
  font: inherit; border: 0; border-radius: 10px; background: var(--d2-seg); color: var(--d2-fg); padding: 8px 12px;
}
/* câmpurile vizibile au contur fin (nu bifele, butoanele radio, glisoarele, fișierele, butoanele); :where() nu
   ridică specificitatea, deci un câmp transparent dintr-un container cu contur îl poate scoate */
body.d2 input:where(:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="hidden"], [type="submit"], [type="button"], [type="color"])),
body.d2 select, body.d2 textarea { box-shadow: inset 0 0 0 1px var(--d2-edge); }
body.d2 ::placeholder { color: var(--d2-soft); opacity: 1; }
body.d2 h1, body.d2 h2, body.d2 h3 { letter-spacing: -.02em; }
body.d2 h1 { font-weight: 700; }

/* componente comune (folosite de paginile d2/) */
.d2 .d2-surface { background: var(--d2-surface); border-radius: var(--d2-r); box-shadow: var(--d2-shadow); }
.d2 .d2-seg { display: inline-flex; background: var(--d2-seg); border-radius: 10px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; }
.d2 .d2-seg > * { font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: 8px; white-space: nowrap; color: var(--d2-fg); text-decoration: none; }
.d2 .d2-seg > [aria-current="page"], .d2 .d2-seg > .on { background: var(--d2-surface); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }
.d2 .d2-seg em { font-style: normal; color: var(--d2-soft); margin-left: 4px; font-weight: 500; }
.d2 .d2-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: 999px; background: var(--d2-surface); box-shadow: var(--d2-shadow); white-space: nowrap; color: var(--d2-fg); text-decoration: none; }
.d2 .d2-pill.on { background: var(--d2-fg); color: var(--d2-surface); box-shadow: none; }
.d2 .d2-tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--d2-plate); color: var(--d2-fg); white-space: nowrap; }
.d2 .d2-tag.nou { background: var(--d2-fg); color: var(--d2-surface); }
.d2 .d2-tag.d2-client { white-space: normal; font-weight: 500; }
.d2 .d2-tag.d2-client-cunoscut { background: var(--d2-yes-bg); color: var(--d2-yes); }
.d2 .d2-tag.d2-client-necunoscut { color: var(--d2-no); }
.d2 .d2-yes { color: var(--d2-yes); }
.d2 .d2-muted { color: var(--d2-muted); }
.d2 .d2-soft { color: var(--d2-soft); }
.d2 .d2-num { font-variant-numeric: tabular-nums; }
.d2 .d2-flag { width: 18px; height: 12px; border-radius: 2px; box-shadow: 0 0 0 .5px rgba(0,0,0,.15); flex: none; vertical-align: -1px; }
.d2 .d2-ic { width: 18px; height: 18px; flex: none; }
/* stat (punct plin, îngroșat) / privat (cerc gol) */
.d2 .d2-cump { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--d2-fg); }
.d2 .d2-cump::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.d2 .d2-cump.priv { font-weight: 500; color: var(--d2-muted); }
.d2 .d2-cump.priv::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.d2 .d2-saved { font-size: 12px; color: var(--d2-yes); }
/* text doar pentru cititorul de ecran (ex. titlul listei pe Firme) */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* butonul de întoarcere de pe fișe („‹ Azi”, „‹ Finanțări”, „‹ În lucru”): buton secundar mic, cu contur */
.d2 .f3-inapoi { margin: 0 0 12px; }
.d2 .f3-inapoi a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--d2-edge); font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--d2-fg); text-decoration: none; }
.d2 .f3-inapoi a:hover { background: var(--d2-seg); }

/* „vezi ca firma” (03.11): banda adminului care se uită ca o firmă-client, doar citire */
.d2-vezi-ca { position: sticky; top: 0; z-index: 1000; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center;
  justify-content: center; padding: .45rem 16px; background: var(--d2-fg); color: var(--d2-bg); font-size: .9rem; }
.d2-vezi-ca form { display: inline; margin: 0; }
.d2-vezi-ca button { background: none; border: 0; padding: 0; color: inherit; font: inherit; font-weight: 600;
  text-decoration: underline; cursor: pointer; }
