/* Rapoarte vânzări Rezon — aplicație de lucru: tabele și grafice dense, cifre mari doar unde contează. */
:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --fg: #1c2230;
  --muted: #5c6577;
  --line: #e1e5ec;
  --soft: #eef1f5;
  --accent: #2d5bd7;
  --accent-soft: #e5ecfc;
  --ok: #1f8a5b;
  --bad: #c2412d;
  --warn: #b7791f;
  --neutral: #9aa3b2;
  --g-nelucrat: #d69e2e;
  --g-neraspuns: #8fa3c7;
  --g-reapel: #5b84d6;
  --g-prezentare: #2d5bd7;
  --g-oferta: #6b46c1;
  --g-castigat: #1f8a5b;
  --g-pierdut: #c2412d;
  --g-refuz: #a0616a;
  --g-date_gresite: #7c8494;
  --g-inchis: #b3bac6;
  --font-display: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-body: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
  --radius: 8px;
  --shadow: 0 6px 24px rgba(20, 30, 50, .12);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151c;
    --panel: #1a1f29;
    --fg: #e6e9ef;
    --muted: #9aa3b4;
    --line: #2b3240;
    --soft: #222937;
    --accent: #7c9cf0;
    --accent-soft: #24304d;
    --ok: #4cc38a;
    --bad: #f07a65;
    --warn: #e3b04b;
    --neutral: #6c7587;
    --g-nelucrat: #e3b04b;
    --g-neraspuns: #7083a8;
    --g-reapel: #6f93e0;
    --g-prezentare: #8aa6f2;
    --g-oferta: #a88be8;
    --g-castigat: #4cc38a;
    --g-pierdut: #f07a65;
    --g-refuz: #c98a93;
    --g-date_gresite: #8a93a3;
    --g-inchis: #4a5263;
    --shadow: 0 6px 24px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); }
h1, h2, h3 { text-wrap: balance; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-left, 0px)); }
.login-card { width: min(100%, 380px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; display: flex; flex-direction: column; gap: 8px; }
.login-card h1 { font-family: var(--font-display); font-weight: 600; font-size: 26px; }
.login-card label { font-size: 13px; color: var(--muted); margin-top: 6px; }
.alert { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); padding: 8px 10px; border-radius: 6px; margin: 4px 0; }

/* layout */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
}
.brand { font-family: var(--font-display); font-weight: 600; font-size: 19px; color: var(--fg); text-decoration: none; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 6px; }
.nav a:hover { background: var(--soft); color: var(--fg); }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.who { margin-left: auto; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; font-size: 14px; }
.page { max-width: 1280px; margin: 0 auto; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 64px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 24px; }

.page-head { display: flex; flex-direction: column; gap: 6px; }
.page-head h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(22px, 3vw, 30px); }
.crumbs { font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.lead { max-width: 75ch; margin: 0; }

.section { display: flex; flex-direction: column; gap: 12px; }
.section > h2 { font-size: 18px; font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; position: relative; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; }
.card-head h3 { font-size: 16px; font-weight: 600; }
.card-note { margin: 0; font-size: 13px; color: var(--muted); }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile .label { font-size: 13px; color: var(--muted); }
.tile .value { font-family: var(--font-display); font-size: 30px; line-height: 1.15; }
.tile .sub { font-size: 13px; color: var(--muted); }
.tile.warn .value { color: var(--warn); }

/* tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--line); }
.tab { font: inherit; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 8px 12px; color: var(--muted); cursor: pointer; }
.tab:hover { color: var(--fg); }
.tab[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); font-weight: 600; }

/* controls */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; min-width: 0; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--fg); border-radius: 6px; padding: 7px 12px; cursor: pointer; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.small { padding: 3px 8px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: default; }

/* chips */
.chip { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.chip.activa { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.chip.inchisa { background: var(--soft); color: var(--muted); }
.chip.ascunsa { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.chip.low { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }

/* tables */
.table-wrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 14px; }
table.data th, table.data td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; white-space: normal; min-width: 10rem; }
table.data th { color: var(--muted); font-weight: 600; font-size: 13px; position: sticky; top: 0; background: var(--panel); }
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--fg); }
table.data th[aria-sort="ascending"]::after { content: " ▲"; font-size: 10px; }
table.data th[aria-sort="descending"]::after { content: " ▼"; font-size: 10px; }
table.data tr.total td { font-weight: 600; border-top: 2px solid var(--line); }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td { background: var(--soft); }
table.data td.cur, table.data th.cur { background: var(--accent-soft); }
.scroll-y { max-height: 32rem; overflow: auto; }

/* bars */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; font-size: 13px; }
.bar-row .val { color: var(--muted); white-space: nowrap; }
.bar-track { grid-column: 1 / -1; height: 10px; background: var(--soft); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; }

.stacks { display: flex; flex-direction: column; gap: 12px; }
.stack-row { display: flex; flex-direction: column; gap: 4px; border-radius: 4px; }
.stack-row.click { cursor: pointer; }
.stack-row.cur .stack-label { font-weight: 600; }
.stack-label { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.stack { display: flex; gap: 2px; height: 20px; border-radius: 4px; overflow: hidden; }
.seg { height: 100%; min-width: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* funnel */
.funnel { display: flex; flex-direction: column; gap: 6px; }
.f-step { display: grid; grid-template-columns: 9rem minmax(0, 1fr) 7rem; gap: 10px; align-items: center; font-size: 13px; }
.f-bar { height: 22px; background: var(--accent); border-radius: 4px; min-width: 2px; }
.f-drop { grid-column: 2 / 4; font-size: 12px; color: var(--muted); padding-left: 2px; }
.f-drop.worst { color: var(--bad); font-weight: 600; }
@media (max-width: 560px) { .f-step { grid-template-columns: 6.5rem minmax(0, 1fr) 5.5rem; } }

/* charts */
.chart { width: 100%; min-height: 260px; }
.chart svg { display: block; width: 100%; height: auto; }
.chart text { fill: var(--muted); font-size: 12px; font-family: var(--font-body); }
.chart .grid line { stroke: var(--line); }
.chart .axis path, .chart .axis line { stroke: var(--line); }
.tip { position: fixed; pointer-events: none; z-index: 20; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); padding: 6px 9px; font-size: 13px; max-width: 280px; }
.tip .t-head { color: var(--muted); margin-bottom: 2px; }

.notes { font-size: 13px; color: var(--muted); margin: 0; padding-left: 1.1em; display: flex; flex-direction: column; gap: 4px; max-width: 80ch; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 10px 14px; align-items: end; }
.toast { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); background: var(--fg); color: var(--bg); padding: 10px 14px; border-radius: 6px; z-index: 30; }
.skeleton { background: linear-gradient(90deg, var(--soft), var(--line), var(--soft)); background-size: 200% 100%; border-radius: 6px; min-height: 120px; }
@media (prefers-reduced-motion: no-preference) { .skeleton { animation: sk 1.2s linear infinite; } }
@keyframes sk { to { background-position: -200% 0; } }
