/* CarGeo – stil fără resurse externe (rulează offline în intranet) */
:root {
  --paper: #fbfaf7;
  --bg: #f1efe9;
  --ink: #1d2733;
  --muted: #6a7480;
  --line: #d9d5cb;
  --line-strong: #b9b3a5;
  --accent: #1f4e79;
  --accent-ink: #fff;
  --grey-cell: #d6d3cc;
  --head: #ebe8e1;
  --err: #a32626;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
}
/* Tema întunecată: automat după sistem, sau forțată din comutator (data-theme pe <html>) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1b2129; --bg: #12161c; --ink: #e3e6ea; --muted: #97a1ad;
    --line: #2f3843; --line-strong: #46515e; --accent: #6aa6dd; --accent-ink: #0d1520;
    --grey-cell: #3a434e; --head: #232b35; --err: #ff8a80;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #1b2129; --bg: #12161c; --ink: #e3e6ea; --muted: #97a1ad;
  --line: #2f3843; --line-strong: #46515e; --accent: #6aa6dd; --accent-ink: #0d1520;
  --grey-cell: #3a434e; --head: #232b35; --err: #ff8a80;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.4; }
sub, sup { font-size: 72%; line-height: 0; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 10px 24px; background: var(--paper); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand b { display: block; font-size: 1.1rem; letter-spacing: .02em; }
.brand small { display: block; color: var(--muted); font-size: .8rem; }
.mark { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 6px; background: var(--accent); color: var(--accent-ink); }
.mark svg { width: 20px; height: 20px; }
nav { display: flex; gap: 4px; align-items: center; }
.theme-toggle { width: 34px; height: 34px; margin-left: 8px; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--line-strong); border-radius: 6px; background: var(--paper); color: var(--ink); cursor: pointer; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .i-sun { display: none; }
.theme-toggle.is-dark .i-sun { display: block; }
.theme-toggle.is-dark .i-moon { display: none; }
nav a { padding: 7px 12px; border-radius: 6px; color: var(--muted); text-decoration: none; font-weight: 500; }
nav a:hover { color: var(--ink); background: var(--bg); }
nav a.on { color: var(--ink); background: var(--bg); box-shadow: inset 0 -2px 0 var(--accent); }

main { max-width: 1480px; margin: 0 auto; padding: 18px 24px 8px; }
.foot { max-width: 1480px; margin: 0 auto; padding: 10px 24px 24px; color: var(--muted); font-size: .8rem; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-bottom: 14px; }

/* bara de selecție */
.bar { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: flex-end; background: var(--paper);
  border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.lbl { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.lbl small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.seg { display: flex; flex-wrap: wrap; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.seg label { position: relative; min-width: 34px; padding: 6px 0; text-align: center; cursor: pointer; font-weight: 600;
  border-right: 1px solid var(--line); user-select: none; }
.seg label:last-child { border-right: 0; }
.seg label:hover { background: var(--bg); }
.seg label.on { background: var(--accent); color: var(--accent-ink); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -3px; }
input[type=number], input[type=text], select, textarea {
  font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line-strong);
  border-radius: 6px; padding: 6px 8px; }
textarea { width: 100%; font-family: var(--mono); font-size: .9rem; margin: 6px 0 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.unit { display: flex; align-items: center; }
.unit input { width: 90px; border-radius: 6px 0 0 6px; font-weight: 600; font-size: 1.05rem; }
.unit span { padding: 6px 10px; border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 6px 6px 0; background: var(--head); color: var(--muted); }
.chk label { display: flex; gap: 6px; align-items: center; padding-bottom: 7px; cursor: pointer; }
.antet summary { cursor: pointer; color: var(--muted); padding-bottom: 7px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 6px; margin-top: 4px; min-width: min(520px, 80vw); }

.btn { display: inline-block; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--paper);
  color: var(--ink); text-decoration: none; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.1); }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: .8rem; padding: 0 0 0 6px; text-transform: none; letter-spacing: 0; }

.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.head-row h1 { margin: 0; font-size: 1.35rem; }
.head-row h1 span { color: var(--muted); font-weight: 400; font-size: 1rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.top-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; }
.top-grid .card { margin-bottom: 14px; }
.fig { margin: 0; display: flex; align-items: center; justify-content: center; }
svg.sectiune { width: 100%; max-height: 380px; color: var(--ink); font-family: var(--font); }
.kpis dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.kpis dl > div { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.kpis dl > div:nth-child(odd) { border-right: 1px solid var(--line); }
.kpis dt { font-size: .8rem; color: var(--muted); font-weight: 600; }
.kpis dd { margin: 2px 0 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.kpis .big dd { font-size: 1.25rem; color: var(--accent); }
.kpis small { color: var(--muted); font-weight: 400; font-size: .8rem; }

/* tabel centralizator */
.tbl-wrap { overflow-x: auto; }
table.cg { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: .88rem; }
table.cg th, table.cg td { border: 1px solid var(--line-strong); padding: 4px 7px; white-space: nowrap; }
table.cg thead th { background: var(--head); font-weight: 700; text-align: center; }
table.cg thead tr.grp th { background: transparent; font-weight: 500; font-style: italic; color: var(--muted); border-top: 0; border-left: 0; border-right: 0; }
table.cg thead tr.u th { font-weight: 400; font-size: .75rem; color: var(--muted); }
table.cg td { text-align: right; }
table.cg td.c-nr { text-align: left; }
table.cg td.c-semn { text-align: center; }
table.cg tbody tr:hover td { background: color-mix(in srgb, var(--accent) 7%, transparent); }
table.cg tfoot td { font-weight: 700; border-top: 2px solid var(--ink); }
table.cg td.gri { background: var(--grey-cell); text-align: center; }
table.cg td.sig { text-align: center; font-size: 1.1rem; }
table.cg .c-YG { border-right: 2px solid var(--ink); }
table.cg.sum td { text-align: right; }
table.cg.sum td:nth-child(2) { text-align: left; }
.note { color: var(--muted); font-size: .8rem; margin: 10px 0 0; }
.err { color: var(--err); font-weight: 600; margin: 0 0 10px; }

/* generator */
.gen-grid { display: grid; grid-template-columns: 1.4fr 1fr 1.3fr 1fr; gap: 16px; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
legend { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin-bottom: 6px; padding: 0; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.row3 label { display: flex; flex-direction: column; font-size: .8rem; color: var(--muted); gap: 2px; }
.row3 input { width: 100%; }
.radio { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.w4 { width: 64px; } .w8 { width: 100px; }
.seed { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .9rem; }
.seed small { color: var(--muted); }
code { font-family: var(--mono); font-size: .85em; background: var(--head); padding: 1px 4px; border-radius: 4px; }

@media (max-width: 1100px) {
  .top-grid { grid-template-columns: 1fr; }
  .gen-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  main, .top, .foot { padding-left: 16px; padding-right: 16px; }
  .gen-grid, .grid3 { grid-template-columns: 1fr; }
  .kpis dl { grid-template-columns: 1fr; }
  .kpis dl > div:nth-child(odd) { border-right: 0; }
}
@media print {
  .top, .bar, .actions, .foot, form { display: none !important; }
  body { background: #fff; }
  .card { border: 0; }
}
