/* Hey Platform — stiluri. Tokenuri preluate din identitatea heymonitor.ro */
:root {
  --paper: #f3f2ee;
  --cream: #eeeee7;
  --card: #fbfbf9;
  --ink: #20211f;
  --ink-2: #3b3c38;
  --muted: #656660;
  --faint: #8d8e86;
  --line: #d4d4cd;
  --line-2: #e4e3dd;
  --red: #f34332;
  --red-ink: #c92d1e;
  --red-soft: #fde6e2;
  --dark: #202320;
  --green: #2f7d4f;
  --green-soft: #dfeee3;
  --amber: #a8650a;
  --amber-soft: #f6ead2;
  --blue: #2c5d8f;
  --blue-soft: #dfe8f1;
  --mono: 'Courier New', ui-monospace, monospace;
  --sans: Inter, Arial, Helvetica, sans-serif;
  --r: 10px;
  --r-sm: 7px;
  --shadow: 0 1px 2px rgba(32,33,31,.05), 0 6px 24px -12px rgba(32,33,31,.18);
  --sidebar: 248px;
  /* culoarea de brand (butoane principale, accente) — separată de roșul de alertă (--red), care rămâne roșu în orice ediție */
  --accent: #f34332;
  --accent-ink: #c92d1e;
  --accent-soft: #fde6e2;
  --accent-rgb: 243, 67, 50;
  --topbar-bg: rgba(243,242,238,.92);
  --topbar-ink: var(--ink);
  color-scheme: light;
}
/* ---------- Ediția ERP: meniu lateral deschis, bară de sus închisă (inversul CRM), accent cobalt, colțuri drepte ---------- */
html[data-edition="erp"] {
  --accent: #2b57a3;
  --accent-ink: #1f4480;
  --accent-soft: #dde6f5;
  --accent-rgb: 43, 87, 163;
  --dark: #16213a;
  --paper: #f4f5f7;
  --cream: #eceef2;
  --card: #ffffff;
  --line: #d6d9e0;
  --line-2: #e6e8ee;
  --r: 6px;
  --r-sm: 4px;
  --topbar-bg: #16213a;
  --topbar-ink: #ffffff;
}
html[data-edition="erp"] .sidebar { background: #fff; color: var(--ink); border-right: 1px solid var(--line); }
html[data-edition="erp"] .logo-hey { color: var(--ink); letter-spacing: -1.2px; }
html[data-edition="erp"] .logo-sub { color: var(--accent); font-weight: 700; }
html[data-edition="erp"] .nav-group-label { color: var(--faint); }
html[data-edition="erp"] .nav a { color: var(--ink-2); }
html[data-edition="erp"] .nav a:hover { background: var(--cream); color: var(--ink); }
html[data-edition="erp"] .nav a.active { background: var(--accent-soft); color: var(--accent-ink); }
html[data-edition="erp"] .nav a.active svg { color: var(--accent-ink); }
html[data-edition="erp"] .sidebar-foot { color: var(--faint); border-top-color: var(--line-2); }
html[data-edition="erp"] .sidebar-foot .lic { color: var(--faint); }
html[data-edition="erp"] .nav { scrollbar-color: var(--line) transparent; }
html[data-edition="erp"] .topbar { border-bottom: 0; backdrop-filter: none; }
html[data-edition="erp"] .search { background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.16); }
html[data-edition="erp"] .search:focus-within { border-color: rgba(255,255,255,.5); }
html[data-edition="erp"] .search input { color: #fff; }
html[data-edition="erp"] .search input::placeholder { color: rgba(255,255,255,.55); }
html[data-edition="erp"] .search svg { color: rgba(255,255,255,.65); }
html[data-edition="erp"] .search kbd { color: rgba(255,255,255,.6); border-color: rgba(255,255,255,.25); }
html[data-edition="erp"] .search-results { color: var(--ink); }
html[data-edition="erp"] .user-chip { color: #fff; }
html[data-edition="erp"] .user-chip:hover { background: rgba(255,255,255,.09); border-color: transparent; }
html[data-edition="erp"] .user-chip .who small { color: rgba(255,255,255,.6); }
html[data-edition="erp"] .user-chip .avatar { background: var(--accent); }
html[data-edition="erp"] .menu-btn { color: #fff; }
html[data-edition="erp"] .menu-btn:hover { background: rgba(255,255,255,.1); }
html[data-edition="erp"] .kpi:not(.dark) { border-top: 3px solid var(--accent); }
html[data-edition="erp"] .kpi .val { font-weight: 700; }
html[data-edition="erp"] h1.title { font-weight: 700; letter-spacing: -1.5px; }
html[data-edition="erp"] .kicker { color: var(--accent-ink); }
html[data-edition="erp"] .t th { background: var(--cream); color: var(--ink-2); }
html[data-edition="erp"] .card { box-shadow: 0 1px 2px rgba(22,33,58,.05); }
html[data-edition="erp"] .login-card { border-top: 4px solid var(--accent); border-radius: 8px; }
html[data-edition="erp"] .modal { border-radius: 10px; }
html[data-edition="erp"] .modal-foot { border-radius: 0 0 10px 10px; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.red { color: var(--red); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar);
  background: var(--dark); color: #e9e9e2;
  display: flex; flex-direction: column; z-index: 40;
}
.brand { display: flex; align-items: center; padding: 22px 22px 18px; text-decoration: none; }
.logo { display: inline-flex; align-items: flex-end; gap: 2px; color: var(--accent); position: relative; padding-top: 10px; }
.logo-bubble { position: absolute; left: 24px; top: -6px; width: 26px; height: 20px; stroke: none; }
.logo-hey { font-weight: 800; font-size: 30px; letter-spacing: -1.6px; line-height: 1; }
.logo-sub { font-size: 12px; font-weight: 600; color: #e9e9e2; margin-left: 4px; padding-bottom: 3px; letter-spacing: .02em; }
.nav { flex: 1; overflow-y: auto; padding: 6px 12px 16px; scrollbar-width: thin; scrollbar-color: #444 transparent; }
.nav-group { margin-top: 14px; }
.nav-group-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #8b8c84; padding: 0 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px;
  text-decoration: none; color: #cfcfc7; font-size: 13.5px; font-weight: 500;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(var(--accent-rgb), .16); color: #fff; }
.nav a.active svg { color: var(--accent); }
.nav a .count { margin-left: auto; font-size: 11px; background: var(--accent); color: #fff; border-radius: 99px; padding: 0 7px; line-height: 18px; font-weight: 600; }
.sidebar-foot { padding: 14px 22px; color: #77786f; border-top: 1px solid rgba(255,255,255,.07); display: flex; flex-direction: column; gap: 6px; }
.sidebar-foot .lic { font-size: 10.5px; line-height: 1.4; color: #6b6c64; }
.sidebar-scrim { display: none; }

.main { flex: 1; margin-left: var(--sidebar); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  padding: 12px clamp(16px, 3vw, 36px); background: var(--topbar-bg); color: var(--topbar-ink);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.menu-btn { display: none; }
.search { position: relative; flex: 1; min-width: 0; max-width: 560px; display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; height: 38px; }
.search:focus-within { border-color: var(--ink); }
.search svg { color: var(--muted); }
.search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; height: 100%; }
.search kbd { font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.search-results { position: absolute; top: 44px; left: 0; right: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); max-height: 420px; overflow: auto; padding: 6px; }
.search-results a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 7px; text-decoration: none; }
.search-results a:hover, .search-results a.focus { background: var(--cream); }
.search-results .sr-type { font-family: var(--mono); font-size: 10px; text-transform: uppercase; color: var(--muted); width: 74px; flex: none; }
.search-results .sr-sub { margin-left: auto; color: var(--muted); font-size: 12px; }
.search-results .empty { padding: 14px; color: var(--muted); }
.topbar-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.user-chip { display: flex; align-items: center; gap: 8px; background: transparent; border: 1px solid transparent; border-radius: 99px; padding: 3px 10px 3px 3px; cursor: pointer; }
.user-chip:hover { border-color: var(--line); background: var(--card); }
.user-chip .who { text-align: left; line-height: 1.15; }
.user-chip .who small { display: block; color: var(--muted); font-size: 11px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff; display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 700; flex: none; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.red { background: var(--red); }

.view { padding: 26px clamp(16px, 3vw, 36px) 60px; outline: none; max-width: 1480px; width: 100%; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.kicker { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 8px; }
.kicker::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
h1.title { margin: 0; font-size: clamp(26px, 3vw, 36px); font-weight: 600; letter-spacing: -1.2px; line-height: 1.05; }
h1.title em { font-style: normal; color: var(--accent); }
.page-sub { color: var(--muted); margin: 8px 0 0; max-width: 640px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
h2.section { font-size: 18px; letter-spacing: -.4px; font-weight: 600; margin: 0; }
h3 { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: -.2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--card); cursor: pointer;
  font-weight: 600; font-size: 13px; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { border-color: var(--ink); }
.btn svg { width: 16px; height: 16px; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #000; }
.btn-red { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-red:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--cream); border-color: transparent; }
.btn-danger { color: var(--red-ink); }
.btn-danger:hover { border-color: var(--red); background: var(--red-soft); }
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger-solid:hover { background: var(--red-ink); border-color: var(--red-ink); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid transparent; background: transparent; cursor: pointer; }
.icon-btn:hover { background: var(--cream); }

/* ---------- Cards / grid ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px 0; }
.card-head .mono { color: var(--muted); }
.card-body { padding: 14px 20px 18px; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g-5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.mt { margin-top: 16px; } .mt-lg { margin-top: 26px; } .mb { margin-bottom: 16px; }

.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi .mono { color: var(--muted); }
.kpi .val { font-size: clamp(19px, 1.55vw, 25px); font-weight: 600; letter-spacing: -.8px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .val small { font-size: 14px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.kpi .sub { font-size: 12.5px; color: var(--muted); }
.kpi.dark { background: var(--dark); color: #f0f0ea; border-color: var(--dark); }
.kpi.dark .mono, .kpi.dark .sub, .kpi.dark .val small { color: #a9aaa2; }
.delta { font-weight: 600; }
.delta.up { color: var(--green); } .delta.down { color: var(--red-ink); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--cream); color: var(--ink-2); white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.b-green { background: var(--green-soft); color: var(--green); }
.b-red { background: var(--red-soft); color: var(--red-ink); }
.b-amber { background: var(--amber-soft); color: var(--amber); }
.b-blue { background: var(--blue-soft); color: var(--blue); }
.b-gray { background: var(--cream); color: var(--muted); border-color: var(--line-2); }
.b-dark { background: var(--ink); color: #fff; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 5px; background: var(--cream); color: var(--ink-2); border: 1px solid var(--line-2); }

/* ---------- Tables ---------- */
.table-card { overflow: hidden; }
.table-tools { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.table-tools .tsearch { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 0 9px; height: 32px; background: #fff; min-width: 200px; flex: 0 1 280px; }
.table-tools .tsearch input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 13px; }
.table-tools .tsearch svg { width: 15px; height: 15px; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--cream); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 0 10px; height: 26px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg button .c { font-weight: 500; color: var(--faint); margin-left: 3px; }
.table-scroll { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.2px; }
.t th { text-align: left; font-family: var(--mono); font-weight: 400; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--card); user-select: none; }
.t th.sortable { cursor: pointer; }
.t th.sortable:hover { color: var(--ink); }
.t th .arr { color: var(--red); margin-left: 3px; }
.t td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.t tbody tr:last-child td { border-bottom: 0; }
.t tbody tr.click { cursor: pointer; }
.t tbody tr.click:hover td { background: #f6f5f0; }
.t td.right, .t th.right { text-align: right; }
.t td .sub { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.t tfoot td { padding: 10px 14px; border-top: 1px solid var(--line); font-weight: 600; background: var(--cream); }
.t .row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.table-foot { padding: 10px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.empty-state { padding: 38px 20px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; grid-column: span 3; min-width: 0; }
.field.c2 { grid-column: span 2; } .field.c4 { grid-column: span 4; } .field.c6 { grid-column: span 6; } .field.c1 { grid-column: span 1; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field label .req { color: var(--red); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.input, .field input, .field select, .field textarea {
  width: 100%; height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: #fff; outline: none;
}
.field textarea { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(32,33,31,.07); }
.field.invalid input, .field.invalid select { border-color: var(--red); }
.field.check { flex-direction: row; align-items: center; gap: 8px; padding-top: 22px; }
.field.check input { width: 16px; height: 16px; accent-color: var(--accent); }
select.input, .field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23656660' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 15px; padding-right: 28px; }
.input.sm { height: 30px; font-size: 13px; }

/* Lines editor */
.lines { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: #fff; }
.lines table { width: 100%; border-collapse: collapse; }
.lines th { font-family: var(--mono); font-weight: 400; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 8px; background: var(--cream); border-bottom: 1px solid var(--line); }
.lines td { padding: 6px 4px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.lines td:first-child { padding-left: 8px; } .lines td:last-child { padding-right: 8px; }
.lines .input { height: 32px; font-size: 13px; padding: 0 8px; }
.lines .w-qty { width: 78px; } .lines .w-um { width: 64px; } .lines .w-price { width: 110px; } .lines .w-vat { width: 78px; } .lines .w-tot { width: 120px; text-align: right; font-weight: 600; }
.lines-foot { display: flex; justify-content: space-between; align-items: flex-start; padding: 10px 12px; gap: 14px; flex-wrap: wrap; }
.totals { min-width: 240px; display: grid; grid-template-columns: 1fr auto; gap: 4px 18px; font-size: 13px; }
.totals .grand { font-size: 16px; font-weight: 700; border-top: 1px solid var(--line); padding-top: 6px; margin-top: 2px; }

/* ---------- Modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(24,25,23,.42); animation: fade .14s ease; }
.modal { background: var(--paper); border-radius: 14px; width: min(640px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); animation: pop .16s ease; }
.modal.lg { width: min(980px, 100%); }
.modal.xl { width: min(1120px, 100%); }
.modal.sm { width: min(440px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 12px; gap: 12px; }
.modal-head h2 { margin: 0; font-size: 20px; letter-spacing: -.5px; font-weight: 600; }
.modal-body { padding: 4px 22px 18px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--cream); border-radius: 0 0 14px 14px; flex-wrap: wrap; }
.modal-foot .spacer { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.985); opacity: 0; } }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { background: var(--ink); color: #fff; padding: 11px 14px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 10px; max-width: 420px; animation: pop .18s ease; }
.toast.err { background: var(--red-ink); }
.toast.ok::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #6fd39a; flex: none; }
.toast button { background: rgba(255,255,255,.14); border: 0; color: #fff; border-radius: 6px; padding: 4px 9px; cursor: pointer; font-weight: 600; font-size: 12px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 10px 14px; font-weight: 600; font-size: 13.5px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.tabs button .c { color: var(--faint); font-weight: 500; margin-left: 4px; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-2); min-width: 0; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .t1 { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .t2 { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item a { text-decoration: none; }
.list.wrap .t1, .list.wrap .t2 { white-space: normal; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.dot.red { background: var(--red); } .dot.green { background: var(--green); } .dot.amber { background: #d9921c; }
.chk { width: 18px; height: 18px; border: 1.5px solid var(--faint); border-radius: 5px; display: inline-grid; place-items: center; cursor: pointer; background: #fff; flex: none; padding: 0; }
.chk.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chk svg { width: 12px; height: 12px; stroke-width: 3; }

/* Timeline */
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ''; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 14px; }
.tl-item::before { content: ''; position: absolute; left: -18px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--card); border: 2px solid var(--accent); }
.tl-item .when { font-family: var(--mono); font-size: 10.5px; color: var(--muted); text-transform: uppercase; }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 10px; }
.k-col { background: var(--cream); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; min-height: 420px; }
.k-col.over { border-color: var(--accent); background: var(--accent-soft); }
.k-head { padding: 12px 12px 8px; border-bottom: 1px solid var(--line); }
.k-head .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.k-head .mono { color: var(--ink-2); }
.k-head .sum { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.k-bar { height: 3px; border-radius: 3px; background: var(--line); margin-top: 8px; overflow: hidden; }
.k-bar i { display: block; height: 100%; background: var(--accent); }
.k-cards { padding: 8px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.k-card { background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px; cursor: grab; box-shadow: 0 1px 1px rgba(0,0,0,.03); }
.k-card:hover { border-color: var(--ink-2); }
.k-card.dragging { opacity: .45; }
.k-card .t1 { font-weight: 600; font-size: 13px; line-height: 1.3; }
.k-card .t2 { color: var(--muted); font-size: 12px; margin-top: 2px; }
.k-card .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 9px; gap: 6px; }
.k-card .val { font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
.k-col.won .k-head .mono { color: var(--green); }
.k-col.lost { opacity: .8; }

/* ---------- Charts ---------- */
.chart { width: 100%; position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; stroke: none; }
.chart .grid-line { stroke: var(--line-2); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.chart .bar { fill: var(--accent); }
.chart .bar.alt { fill: var(--ink); }
.chart .bar.muted { fill: #c9c8c0; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart g.col:hover .bar { filter: brightness(.9); }
.chart-tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; padding: 6px 9px; border-radius: 7px; white-space: nowrap; transform: translate(-50%, -110%); box-shadow: var(--shadow); z-index: 5; }
.chart-tip b { display: block; font-weight: 600; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar .row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 4px; }
.hbar .row span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hbar .track { height: 8px; background: var(--cream); border-radius: 4px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.hbar .fill.ink { background: var(--ink); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Document preview (factură) ---------- */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.doc { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 40px 44px; box-shadow: var(--shadow); font-size: 12.5px; color: #1b1b1a; }
.doc-top { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.doc h2 { font-size: 28px; letter-spacing: -1px; margin: 0; font-weight: 700; }
.doc .doc-no { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 4px; }
.doc .parties { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin: 28px 0 22px; }
.doc .party .mono { color: var(--accent); margin-bottom: 6px; display: block; }
.doc .party strong { font-size: 14px; display: block; margin-bottom: 3px; }
.doc .party div { color: #444; line-height: 1.55; }
.doc table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.doc th { text-align: left; font-family: var(--mono); font-weight: 400; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: #666; border-bottom: 1.5px solid #1b1b1a; padding: 7px 6px; }
.doc td { padding: 8px 6px; border-bottom: 1px solid #e6e5df; }
.doc .doc-totals { margin-left: auto; width: 290px; margin-top: 16px; display: grid; grid-template-columns: 1fr auto; gap: 5px 16px; }
.doc .doc-totals .grand { font-size: 17px; font-weight: 700; border-top: 1.5px solid #1b1b1a; padding-top: 8px; }
.doc .doc-foot { margin-top: 34px; padding-top: 14px; border-top: 1px solid #e6e5df; display: flex; justify-content: space-between; gap: 20px; color: #555; font-size: 11.5px; }
.doc .stamp { display: inline-block; border: 2px solid var(--red); color: var(--red); font-weight: 800; letter-spacing: .1em; padding: 4px 10px; border-radius: 6px; transform: rotate(-6deg); font-size: 13px; text-transform: uppercase; }
.side-panel { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 80px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-weight: 500; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack .btn { justify-content: flex-start; }

/* Client header */
.entity-head { display: flex; gap: 16px; align-items: center; }
.entity-mark { width: 54px; height: 54px; border-radius: 12px; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 18px; flex: none; }
.meta-row { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 6px; }
.meta-row span { display: inline-flex; align-items: center; gap: 5px; }
.meta-row svg { width: 14px; height: 14px; }

.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r); background: var(--amber-soft); color: #6d4306; font-size: 13px; border: 1px solid #ecd6ad; }
.notice.info { background: var(--blue-soft); color: #1f4268; border-color: #c6d6e7; }
.notice svg { margin-top: 1px; }

.decl-table { min-width: 520px; }
.decl-table td:first-child { color: var(--muted); font-family: var(--mono); font-size: 11px; width: 54px; }
.progress { height: 6px; background: var(--cream); border-radius: 4px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--ink); border-radius: 4px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(1200px 500px at 85% -10%, rgba(var(--accent-rgb), .10), transparent 60%), var(--paper); }
.login-card { width: min(420px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 36px 34px 30px; box-shadow: var(--shadow); }
.login-card h1.title { font-size: 34px; }
.login-card .field { grid-column: auto; }
.login-card input { height: 42px; }
.login-err { font-size: 13px; margin-top: 12px; font-weight: 600; }

/* ---------- Pop menu ---------- */
.pop-menu { position: fixed; z-index: 90; background: var(--card); border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow); padding: 6px; min-width: 230px; animation: pop .12s ease; }
.pop-menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; padding: 8px 10px; border-radius: 7px; cursor: pointer; text-align: left; font-size: 13.5px; font-weight: 500; }
.pop-menu button:hover { background: var(--cream); }
.pop-menu button svg { color: var(--muted); width: 17px; height: 17px; }
.pop-menu button small { margin-left: auto; color: var(--muted); font-size: 11.5px; }
.pop-menu hr { border: 0; border-top: 1px solid var(--line-2); margin: 5px 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .g-5 { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .g-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g-main, .doc-layout { grid-template-columns: minmax(0,1fr); }
  .side-panel { position: static; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .user-chip .who { display: none; }
  .g-3, .g-2 { grid-template-columns: minmax(0,1fr); }
  .search kbd { display: none; }
}
@media (max-width: 640px) {
  .g-5, .g-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .form-grid { grid-template-columns: minmax(0,1fr); }
  .field, .field.c1, .field.c2, .field.c4, .field.c6 { grid-column: span 1; }
  .field.check { padding-top: 0; }
  .quick-btn span { display: none; }
  .topbar { gap: 8px; padding: 10px 12px; }
  .search { min-width: 0; }
  .topbar-right { gap: 6px; }
  .user-chip { padding: 0; }
  .doc { padding: 22px 18px; }
  .doc .parties { grid-template-columns: 1fr; }
  .kpi .val { font-size: 21px; }
  .modal-wrap { padding: 0; place-items: end stretch; }
  .modal { max-height: 94vh; border-radius: 14px 14px 0 0; width: 100% !important; }
  .view { padding-top: 18px; }
  .lines { overflow-x: auto; }
  .lines table { min-width: 640px; }
}

/* ---------- Print (factură / document) ---------- */
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .side-panel, .page-head, .toasts, .no-print, .tabs { display: none !important; }
  .main { margin: 0; }
  .view { padding: 0; max-width: none; }
  .doc-layout { display: block; }
  .doc { border: 0; box-shadow: none; padding: 0; }
  .modal-wrap { position: static; background: none; padding: 0; display: block; }
  .modal { box-shadow: none; max-height: none; width: 100% !important; background: #fff; }
  .modal-head, .modal-foot { display: none; }
  body.printing-modal .app { display: none; }
}
