/* =====================================================================
   ITAPP Gestiune v4 — design system (tema luminoasa / intunecata)
   ===================================================================== */
:root {
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --radius-sm: 8px; --radius: 12px; --radius-lg: 18px; --radius-xl: 24px;
  --sb-w: 268px; --sb-w-c: 76px; --top-h: 64px;
  --ease: cubic-bezier(.2,.8,.2,1);
  --spring: cubic-bezier(.34,1.56,.64,1);

  --accent: #6366f1; --accent-2: #06b6d4; --accent-ink: #fff;
  --success: #16a34a; --warning: #d97706; --danger: #dc2626; --info: #0284c7;
}
[data-theme="light"] {
  --bg: #f4f6fb; --bg-2: #eef1f8; --surface: #ffffff; --surface-2: #f8fafc; --surface-3: #f1f5f9;
  --border: #e2e8f0; --border-2: #cbd5e1;
  --text: #0f172a; --text-2: #334155; --muted: #64748b; --faint: #94a3b8;
  --sb-bg: #0f172a; --sb-text: #cbd5e1; --sb-muted: #64748b; --sb-hover: rgba(255,255,255,.06); --sb-active: rgba(99,102,241,.18);
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow: 0 1px 3px rgba(15,23,42,.06), 0 8px 24px -8px rgba(15,23,42,.10);
  --shadow-lg: 0 24px 60px -12px rgba(15,23,42,.25);
  --ring: 0 0 0 4px rgba(99,102,241,.18);
  --tint-success: #dcfce7; --tint-warning: #fef3c7; --tint-danger: #fee2e2; --tint-info: #e0f2fe; --tint-accent: #e0e7ff;
  --row-hover: #f8fafc;
}
[data-theme="dark"] {
  --bg: #070b16; --bg-2: #0b1222; --surface: #0f172a; --surface-2: #131c33; --surface-3: #1a2440;
  --border: #1e293b; --border-2: #334155;
  --text: #e2e8f0; --text-2: #cbd5e1; --muted: #94a3b8; --faint: #64748b;
  --sb-bg: #0a1020; --sb-text: #cbd5e1; --sb-muted: #64748b; --sb-hover: rgba(255,255,255,.05); --sb-active: rgba(99,102,241,.22);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px -12px rgba(0,0,0,.6);
  --shadow-lg: 0 30px 80px -20px rgba(0,0,0,.8);
  --ring: 0 0 0 4px rgba(129,140,248,.25);
  --accent: #818cf8; --accent-2: #22d3ee;
  --success: #22c55e; --warning: #f59e0b; --danger: #f87171; --info: #38bdf8;
  --tint-success: rgba(34,197,94,.14); --tint-warning: rgba(245,158,11,.14); --tint-danger: rgba(248,113,113,.14); --tint-info: rgba(56,189,248,.14); --tint-accent: rgba(129,140,248,.16);
  --row-hover: #131c33;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; transition: background .3s var(--ease), color .3s var(--ease); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3,h4 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.02em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
code, .mono { font-family: var(--mono); font-size: .92em; }
.ico { width: 18px; height: 18px; flex: none; }
.hidden, [hidden] { display: none !important; }
::selection { background: var(--tint-accent); }
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }

/* ---------------- Layout ---------------- */
.app { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sb-w); background: var(--sb-bg); color: var(--sb-text); display: flex; flex-direction: column; z-index: 40; transition: width .3s var(--ease), transform .3s var(--ease); border-right: 1px solid rgba(255,255,255,.04); }
.sidebar::before { content: ""; position: absolute; inset: 0; background: radial-gradient(600px 300px at -10% -10%, rgba(99,102,241,.25), transparent 60%), radial-gradient(400px 300px at 120% 110%, rgba(6,182,212,.15), transparent 60%); pointer-events: none; }
.main { flex: 1; min-width: 0; margin-left: var(--sb-w); display: flex; flex-direction: column; transition: margin .3s var(--ease); }
.sb-collapsed .sidebar { width: var(--sb-w-c); }
.sb-collapsed .main { margin-left: var(--sb-w-c); }
.sb-collapsed .sb-link span, .sb-collapsed .sb-section, .sb-collapsed .brand-text, .sb-collapsed .sb-tenant div, .sb-collapsed .lic-chip span { display: none; }
.sb-collapsed .sb-collapse .ico { transform: rotate(180deg); }
.sb-collapsed .sb-link { justify-content: center; }
.sb-collapsed .sb-brand { flex-direction: column; gap: 8px; }

.sb-brand { position: relative; display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 12px; }
.brand-mark { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none !important; }
.brand-logo { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 8px 20px -6px rgba(99,102,241,.7); }
.brand-logo .ico { width: 22px; height: 22px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 16px; letter-spacing: .02em; }
.brand-text small { color: var(--sb-muted); font-size: 11px; }
.sb-tenant { position: relative; margin: 4px 12px 8px; padding: 10px 12px; border-radius: var(--radius); background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); display: flex; gap: 10px; align-items: center; }
.sb-tenant small { display: block; color: var(--sb-muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.sb-tenant strong { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.tenant-dot { width: 10px; height: 10px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.18); flex: none; animation: pulse-dot 2.4s infinite; }
.sb-nav { position: relative; flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.sb-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--sb-muted); padding: 14px 12px 6px; font-weight: 600; }
.sb-link { position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--sb-text); font-weight: 500; text-decoration: none !important; transition: background .2s, color .2s, transform .2s var(--ease); }
.sb-link:hover { background: var(--sb-hover); color: #fff; transform: translateX(2px); }
.sb-link.is-active { background: var(--sb-active); color: #fff; }
.sb-link.is-active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: linear-gradient(var(--accent), var(--accent-2)); }
.sb-link.is-active .ico { color: #a5b4fc; }
.sb-foot { position: relative; padding: 12px; border-top: 1px solid rgba(255,255,255,.06); }
.lic-chip { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 8px 10px; border-radius: 10px; background: rgba(34,197,94,.1); color: #86efac; }
.lic-chip.warn { background: rgba(245,158,11,.12); color: #fcd34d; }
.sb-backdrop { display: none; }

.topbar { position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 0 24px; background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--border); }
.search-trigger { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: inherit; cursor: pointer; transition: border-color .2s, box-shadow .2s; }
.search-trigger:hover { border-color: var(--border-2); box-shadow: var(--shadow-sm); }
.search-trigger span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
kbd { font-family: var(--mono); font-size: 11px; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.user-chip:hover { box-shadow: var(--shadow-sm); }
.user-meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.user-meta small { color: var(--muted); font-size: 11px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); flex: none; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
[data-theme="light"] .theme-ico-dark, [data-theme="dark"] .theme-ico-light { display: none; }

.content { flex: 1; padding: 24px 28px 40px; max-width: 1600px; width: 100%; margin: 0 auto; animation: page-in .45s var(--ease) both; }
.foot { display: flex; justify-content: space-between; gap: 12px; padding: 14px 28px; color: var(--faint); font-size: 12px; border-top: 1px solid var(--border); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 800; margin: 0; }
.page-sub { margin: 4px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12.5px; margin-bottom: 6px; }
.crumbs .ico { width: 14px; height: 14px; }

/* ---------------- Grid & cards ---------------- */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.span-2 { grid-column: span 2; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-head h3 .ico { color: var(--accent); }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.stack > * + * { margin-top: 18px; }
.reveal { opacity: 0; transform: translateY(10px); animation: rise .55s var(--ease) forwards; }
.reveal:nth-child(2) { animation-delay: .05s } .reveal:nth-child(3) { animation-delay: .1s } .reveal:nth-child(4) { animation-delay: .15s } .reveal:nth-child(5) { animation-delay: .2s } .reveal:nth-child(6) { animation-delay: .25s }

/* stat cards */
.stat { position: relative; display: flex; gap: 14px; align-items: center; padding: 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--text); text-decoration: none !important; overflow: hidden; transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s; }
a.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--tone) 40%, var(--border)); }
.stat::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--tone) 22%, transparent), transparent 70%); }
.stat-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--tone) 14%, transparent); color: var(--tone); flex: none; }
.stat-ico .ico { width: 22px; height: 22px; }
.stat-body { display: flex; flex-direction: column; min-width: 0; }
.stat-label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat-value { font-size: 24px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat small { color: var(--faint); font-size: 12px; }
.tone-indigo { --tone: #6366f1 } .tone-cyan { --tone: #06b6d4 } .tone-green { --tone: #16a34a } .tone-amber { --tone: #d97706 } .tone-red { --tone: #dc2626 } .tone-pink { --tone: #db2777 } .tone-violet { --tone: #7c3aed } .tone-blue { --tone: #2563eb }

/* hero */
.hero { position: relative; overflow: hidden; border-radius: var(--radius-xl); padding: 26px 28px; color: #fff; background: linear-gradient(120deg, #4338ca 0%, #6366f1 45%, #0891b2 100%); box-shadow: 0 20px 50px -20px rgba(79,70,229,.6); margin-bottom: 20px; }
.hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(500px 200px at 85% 0%, rgba(255,255,255,.25), transparent 60%), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M0 39.5h40M39.5 0v40' stroke='%23fff' stroke-opacity='.08'/%3E%3C/svg%3E"); }
.hero > * { position: relative; }
.hero h2 { font-size: 24px; margin: 0 0 6px; font-weight: 800; }
.hero p { margin: 0; opacity: .85; }
.hero-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.hero .btn { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.25); backdrop-filter: blur(6px); }
.hero .btn:hover { background: rgba(255,255,255,.26); }
.hero .btn-white { background: #fff; color: #3730a3; }

/* ---------------- Buttons ---------------- */
.btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: transform .15s var(--ease), box-shadow .2s, background .2s, border-color .2s; user-select: none; }
.btn:hover { border-color: var(--border-2); box-shadow: var(--shadow-sm); }
.btn:active { transform: scale(.97); }
.btn:focus-visible, .icon-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--accent-2))); color: #fff; border-color: transparent; box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn-primary:hover { box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--accent) 80%, transparent); filter: brightness(1.05); }
.btn-success { background: var(--success); color: #fff; border-color: transparent; }
.btn-danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-loading { opacity: .65; pointer-events: none; }
.btn.is-loading::after { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; transition: background .2s, color .2s, transform .15s; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.danger:hover { background: var(--tint-danger); color: var(--danger); }
.sidebar .icon-btn { color: var(--sb-muted); }
.sidebar .icon-btn:hover { background: var(--sb-hover); color: #fff; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
.ripple { position: absolute; border-radius: 50%; transform: scale(0); background: currentColor; opacity: .25; animation: ripple .6s ease-out; pointer-events: none; }
.inline-form { display: inline; margin: 0; }
.danger-text { color: var(--danger) !important; }

/* ---------------- Forms ---------------- */
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: 14px 16px; }
.col-12 { grid-column: span 12 } .col-8 { grid-column: span 8 } .col-6 { grid-column: span 6 } .col-4 { grid-column: span 4 } .col-3 { grid-column: span 3 } .col-2 { grid-column: span 2 }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field small, .help { color: var(--muted); font-size: 12px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], input[type=tel], input[type=url], input:not([type]), select, textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; transition: border-color .2s, box-shadow .2s, background .2s; }
textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input[readonly] { background: var(--surface-2); }
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='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 34px; }
.input-ico { position: relative; display: flex; align-items: center; }
.input-ico > .ico { position: absolute; left: 12px; color: var(--faint); pointer-events: none; }
.input-ico > input { padding-left: 40px; }
.input-btn { position: absolute; right: 6px; width: 30px; height: 30px; border: 0; background: transparent; color: var(--faint); border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.input-btn:hover { color: var(--text); background: var(--surface-3); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 42px; height: 24px; border-radius: 999px; background: var(--border-2); transition: background .25s; position: relative; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .3s var(--spring); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.toolbar .grow { flex: 1; min-width: 200px; }
.toolbar input, .toolbar select { height: 36px; }
.scan-box { display: flex; gap: 10px; align-items: center; padding: 14px; border: 2px dashed color-mix(in srgb, var(--accent) 40%, var(--border)); border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.scan-box .ico { color: var(--accent); width: 24px; height: 24px; }
.scan-box input { height: 46px; font-size: 15px; }
.scan-box [data-picker-input] { font-family: var(--mono); }
.scan-box.flash-ok { animation: flash-ok .6s; }
.scan-box.flash-err { animation: flash-err .6s, shake .4s; }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover { background: var(--row-hover); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num, .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .actions { text-align: right; white-space: nowrap; width: 1%; }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border); }
.tbl th[data-sort] { cursor: pointer; }
.tbl th[data-sort]:hover { color: var(--text); }
.tbl th.sorted-asc::after { content: " ▲"; font-size: 9px; } .tbl th.sorted-desc::after { content: " ▼"; font-size: 9px; }
.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { color: var(--muted); font-size: 12px; }
.prod-cell { display: flex; align-items: center; gap: 10px; }
.prod-thumb { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-3); display: grid; place-items: center; color: var(--faint); flex: none; overflow: hidden; }
.prod-thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-new { animation: row-in .8s var(--ease); }
.stock-bar { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; min-width: 70px; }
.stock-bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--success), #4ade80); transform-origin: left; animation: grow .9s var(--ease); }
.stock-bar.low i { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.stock-bar.out i { background: var(--danger); }

/* ---------------- Badges / alerts ---------------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.badge-success { background: var(--tint-success); color: var(--success); }
.badge-warning { background: var(--tint-warning); color: var(--warning); }
.badge-danger { background: var(--tint-danger); color: var(--danger); }
.badge-info { background: var(--tint-info); color: var(--info); }
.badge-accent { background: var(--tint-accent); color: var(--accent); }
.badge-neutral { background: var(--surface-3); color: var(--muted); }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); border: 1px solid; font-weight: 500; margin-bottom: 14px; }
.alert-danger { background: var(--tint-danger); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-warning { background: var(--tint-warning); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.alert-success { background: var(--tint-success); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert-info { background: var(--tint-info); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-ico { width: 64px; height: 64px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 20px; background: var(--tint-accent); color: var(--accent); animation: float 4s ease-in-out infinite; }
.empty-ico .ico { width: 28px; height: 28px; }
.empty h3 { color: var(--text); font-size: 16px; }

/* ---------------- Dropdown ---------------- */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.98); transform-origin: top right; transition: all .18s var(--ease); z-index: 50; }
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: none; }
.dropdown-menu a, .dropdown-menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; border: 0; background: none; color: var(--text); font: inherit; font-weight: 500; text-align: left; cursor: pointer; text-decoration: none !important; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-3); }
.dropdown-menu .ico { color: var(--muted); }
.dropdown-menu .badge { margin-left: auto; }
.dropdown-sm { min-width: 180px; }

/* ---------------- Modal ---------------- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(2,6,23,.55); backdrop-filter: blur(4px); animation: fade .2s; }
.modal-box { width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); animation: pop .3s var(--spring); }
.modal-box.wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); }

/* ---------------- Command palette ---------------- */
.palette { position: fixed; inset: 0; z-index: 90; background: rgba(2,6,23,.5); backdrop-filter: blur(6px); display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; animation: fade .15s; }
.palette-box { width: min(640px, 92vw); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .25s var(--spring); }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.palette-input input { border: 0 !important; box-shadow: none !important; height: 32px; padding: 0; font-size: 16px; background: transparent; }
.palette-list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text); cursor: pointer; text-decoration: none !important; }
.palette-item small { margin-left: auto; color: var(--faint); }
.palette-item.is-active { background: var(--tint-accent); }
.palette-item .ico { color: var(--muted); }
.palette-group { padding: 8px 12px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 600; }

/* ---------------- Toasts ---------------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, 90vw); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: toast-in .4s var(--spring); position: relative; overflow: hidden; }
.toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; background: var(--tc); animation: toast-timer 5s linear forwards; }
.toast .ico { color: var(--tc); margin-top: 1px; }
.toast.out { animation: toast-out .3s var(--ease) forwards; }
.toast-success { --tc: var(--success) } .toast-error { --tc: var(--danger) } .toast-warning { --tc: var(--warning) } .toast-info { --tc: var(--info) }

/* ---------------- Tabs / misc ---------------- */
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-3); width: fit-content; margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 7px 14px; border-radius: 9px; color: var(--muted); font-weight: 600; text-decoration: none !important; transition: all .2s; }
.tabs a.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; }
.pager { display: flex; gap: 4px; align-items: center; padding: 14px 16px; flex-wrap: wrap; border-top: 1px solid var(--border); }
.pager-btn { min-width: 34px; height: 34px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: 9px; border: 1px solid var(--border); color: var(--text); text-decoration: none !important; font-weight: 600; }
.pager-btn:hover { background: var(--surface-3); }
.pager-btn.is-active { background: var(--accent); color: #fff; border-color: transparent; }
.pager-gap { padding: 0 4px; color: var(--faint); }
.pager-info { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 26px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: -4px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 1px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); }
.timeline .t-time { color: var(--faint); font-size: 12px; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.list-plain li:last-child { border-bottom: 0; }
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }
.qr-box { display: grid; place-items: center; padding: 14px; background: #fff; border-radius: 16px; width: fit-content; margin: 0 auto; box-shadow: var(--shadow); }
.qr-box svg, .qr-box img { display: block; width: 200px; height: 200px; }
.secret { font-family: var(--mono); letter-spacing: .12em; padding: 8px 12px; border-radius: 10px; background: var(--surface-3); display: inline-block; word-break: break-all; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font-family: var(--mono); }
.codes span { padding: 8px; border-radius: 8px; background: var(--surface-3); text-align: center; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding: 0 0 14px 40px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--tint-accent); color: var(--accent); }
.muted { color: var(--muted); } .faint { color: var(--faint); } .center-text { text-align: center; } .right { text-align: right; }
.text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-warning { color: var(--warning); }
.flex { display: flex; gap: 10px; align-items: center; } .flex-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; } .wrap { flex-wrap: wrap; }
.mt-0 { margin-top: 0 } .mb-0 { margin-bottom: 0 } .mt { margin-top: 18px } .mb { margin-bottom: 18px }
.doc-total { font-size: 20px; font-weight: 800; }
.big-number { font-size: 34px; font-weight: 800; letter-spacing: -.03em; }

/* ---------------- Auth ---------------- */
.auth-body { min-height: 100vh; overflow-x: hidden; background: var(--bg); }
.auth-bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; animation: blob 18s ease-in-out infinite; }
.b1 { width: 520px; height: 520px; background: #6366f1; top: -160px; left: -120px; }
.b2 { width: 420px; height: 420px; background: #06b6d4; bottom: -140px; right: 10%; animation-delay: -6s; }
.b3 { width: 300px; height: 300px; background: #a855f7; top: 40%; left: 40%; animation-delay: -12s; opacity: .35; }
.grid-lines { position: absolute; inset: 0; background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 48px 48px; mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%); opacity: .5; }
.auth-wrap { position: relative; z-index: 1; min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: 40px; max-width: 1180px; margin: 0 auto; padding: 40px 24px; }
.auth-hero { color: var(--text); }
.auth-hero h2 { font-size: 42px; font-weight: 800; letter-spacing: -.035em; margin: 28px 0 22px; }
.grad-text { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-mark.big { color: var(--text); }
.brand-mark.big .brand-logo { width: 48px; height: 48px; }
.brand-mark.big .brand-text strong { font-size: 20px; } .brand-mark.big small { color: var(--muted); }
.hero-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; color: var(--text-2); font-weight: 500; }
.hero-list li { display: flex; gap: 10px; align-items: center; }
.hero-list .ico { color: var(--accent); }
.hero-cards { position: relative; height: 130px; margin-top: 30px; }
.float-card { position: absolute; display: flex; gap: 12px; align-items: center; padding: 14px 18px; border-radius: 16px; background: color-mix(in srgb, var(--surface) 80%, transparent); backdrop-filter: blur(12px); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: float 6s ease-in-out infinite; }
.float-card small { display: block; color: var(--muted); font-size: 12px; } .float-card strong { font-size: 18px; }
.float-card .ico { width: 34px; height: 34px; padding: 7px; border-radius: 10px; background: var(--tint-success); color: var(--success); }
.fc1 { left: 0; top: 0; } .fc2 { left: 200px; top: 56px; animation-delay: -3s; } .fc2 .ico { background: var(--tint-accent); color: var(--accent); }
.auth-card-wrap { display: flex; flex-direction: column; align-items: center; }
.auth-card { width: 100%; max-width: 430px; padding: 34px; border-radius: 26px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(18px); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: pop .5s var(--spring); }
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-head h1 { font-size: 24px; font-weight: 800; }
.auth-head p { color: var(--muted); margin: 0; }
.auth-ico { width: 56px; height: 56px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 18px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 12px 30px -10px var(--accent); }
.auth-ico .ico { width: 26px; height: 26px; }
.auth-ico.pulse { animation: pulse-ring 2s infinite; }
.auth-note { display: flex; gap: 8px; align-items: center; justify-content: center; color: var(--muted); font-size: 12.5px; margin: 18px 0 0; }
.auth-foot { color: var(--faint); font-size: 12px; margin-top: 18px; }
.otp { display: flex; gap: 8px; justify-content: center; }
.otp input { width: 50px; height: 58px; text-align: center; font-size: 24px; font-weight: 700; font-family: var(--mono); border-radius: 14px; padding: 0; }
.otp input:focus { transform: translateY(-2px); }
.recovery summary { cursor: pointer; color: var(--muted); font-size: 13px; text-align: center; margin-bottom: 8px; }

/* ---------------- Animations ---------------- */
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(10px); } }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px) scale(.95); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(40px); } }
@keyframes toast-timer { from { width: 100%; } to { width: 0; } }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes blob { 0%,100% { transform: translate(0,0) scale(1); } 33% { transform: translate(60px,-40px) scale(1.1); } 66% { transform: translate(-40px,30px) scale(.95); } }
@keyframes pulse-dot { 0%,100% { box-shadow: 0 0 0 3px rgba(34,197,94,.25); } 50% { box-shadow: 0 0 0 7px rgba(34,197,94,0); } }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent); } 100% { box-shadow: 0 0 0 18px transparent; } }
@keyframes shake { 10%,90% { transform: translateX(-1px); } 20%,80% { transform: translateX(3px); } 30%,50%,70% { transform: translateX(-5px); } 40%,60% { transform: translateX(5px); } }
.shake { animation: shake .45s; }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes row-in { from { background: var(--tint-success); } }
@keyframes flash-ok { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.6); } 100% { box-shadow: 0 0 0 16px transparent; } }
@keyframes flash-err { 0% { border-color: var(--danger); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* ---------------- Responsive ---------------- */
.only-mobile { display: none; }
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .grid-main { grid-template-columns: 1fr; } }
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); width: var(--sb-w) !important; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .sidebar.open + .sb-backdrop { display: block; position: fixed; inset: 0; background: rgba(2,6,23,.5); z-index: 35; animation: fade .2s; }
  .main, .sb-collapsed .main { margin-left: 0; }
  .sb-collapsed .sb-link span, .sb-collapsed .sb-section, .sb-collapsed .brand-text, .sb-collapsed .sb-tenant div { display: initial; }
  .sb-collapse { display: none; }
  .only-mobile { display: inline-grid; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .auth-wrap { grid-template-columns: 1fr; } .auth-hero { display: none; }
  .content { padding: 18px 16px 32px; }
  .topbar { padding: 0 16px; }
  .col-8, .col-6, .col-4, .col-3, .col-2 { grid-column: span 12; }
}
@media (max-width: 640px) {
  .grid-4 { grid-template-columns: 1fr; }
  .hide-sm, .search-trigger span, .search-trigger kbd { display: none; }
  .search-trigger { flex: 0; }
  .page-head h1 { font-size: 21px; }
  .otp input { width: 42px; height: 52px; }
  .foot { flex-direction: column; }
}

/* ---------------- Print ---------------- */
@media print {
  .sidebar, .topbar, .foot, .page-actions, .toolbar, .no-print, .toasts, .pager, .sb-backdrop { display: none !important; }
  .main { margin: 0 !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .content { padding: 0; animation: none; max-width: none; }
  .tbl th { background: #eee !important; color: #000; }
  a { color: #000; text-decoration: none; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
.doc-print-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.signatures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 40px; text-align: center; }
.signatures div { border-top: 1px solid var(--border-2); padding-top: 6px; color: var(--muted); }
.label-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.lbl-item { border: 1px dashed var(--border-2); border-radius: 10px; padding: 10px; text-align: center; background: #fff; color: #000; break-inside: avoid; }
.lbl-item .l-name { font-weight: 700; font-size: 12px; line-height: 1.2; max-height: 2.4em; overflow: hidden; }
.lbl-item .l-meta { font-size: 11px; color: #444; }
.lbl-item svg { max-width: 100%; height: 60px; }
@media print { .label-sheet { gap: 4mm; grid-template-columns: repeat(3, 1fr); } .lbl-item { border: 1px solid #ddd; } }

/* product picker */
.picker-list { left: 0; right: 0; min-width: 0; max-height: 320px; overflow-y: auto; transform-origin: top left; }
.picker-list button { align-items: center; }
.picker-list button.is-active { background: var(--tint-accent); }
[data-picker] { flex: 1; min-width: 220px; }
[data-picker].open .picker-list { opacity: 1; visibility: visible; transform: none; }
.picker-info { min-height: 22px; margin-top: 6px; display: flex; gap: 6px; align-items: center; }
.line-form { display: grid; grid-template-columns: minmax(240px, 3fr) minmax(90px, 1fr) minmax(120px, 1fr) auto; gap: 10px; align-items: start; }
@media (max-width: 760px) { .line-form { grid-template-columns: 1fr 1fr; } .line-form > :first-child { grid-column: span 2; } }
.doc-head { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.doc-head .kv-item small { display: block; color: var(--muted); font-size: 12px; }
.doc-head .kv-item strong { font-size: 15px; }
@media (max-width: 760px) { .doc-head { grid-template-columns: 1fr 1fr; } }

.sb-tenant.is-platform { background: linear-gradient(135deg, rgba(99,102,241,.22), rgba(6,182,212,.12)); border-color: rgba(129,140,248,.35); }
.sb-tenant.is-platform .tenant-dot { background: #a5b4fc; box-shadow: 0 0 0 4px rgba(165,180,252,.2); animation: none; }
.step-no { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 13px; font-weight: 700; }
input.flash-ok { animation: flash-ok .6s; }

.sb-link.is-locked { opacity: .55; }
.sb-link .sb-lock { width: 14px; height: 14px; margin-left: auto; color: var(--sb-muted); }
.sb-collapsed .sb-link .sb-lock, .sb-collapsed .plan-chip span { display: none; }
.plan-chip { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; padding: 8px 10px; border-radius: 10px; margin-bottom: 8px; color: #fff !important; text-decoration: none !important;
  background: linear-gradient(135deg, color-mix(in srgb, var(--tone) 55%, transparent), color-mix(in srgb, var(--tone) 22%, transparent)); border: 1px solid color-mix(in srgb, var(--tone) 50%, transparent); }
.plan-chip:hover { filter: brightness(1.15); }
.meter { height: 8px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transform-origin: left; animation: grow .9s var(--ease); }
.meter.warn i { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.meter.full i { background: var(--danger); }
.plans { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
.plan-card { position: relative; padding: 22px; border-radius: var(--radius-xl); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; transition: transform .25s var(--ease), box-shadow .25s; }
.plan-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.plan-card.is-current { border-color: var(--tone); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 25%, transparent), var(--shadow-lg); }
.plan-card h3 { font-size: 20px; margin: 0; color: var(--tone); }
.plan-card .pc-tag { position: absolute; top: 14px; right: 14px; }
.plan-card ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; font-size: 13px; }
.plan-card li { display: flex; gap: 8px; align-items: flex-start; }
.plan-card li .ico { width: 16px; height: 16px; margin-top: 2px; }
.plan-card li.no { color: var(--faint); }
.plan-card li.yes .ico { color: var(--success); }
@media (max-width: 1100px) { .plans { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 640px) { .plans { grid-template-columns: 1fr; } }

/* Licente: suprascrieri de limite */
.lic-over details{border:1px dashed var(--border);border-radius:12px;padding:10px 14px;background:var(--surface-2,transparent)}
.lic-over summary{cursor:pointer;display:flex;align-items:center;gap:8px;list-style:none}
.lic-over summary::-webkit-details-marker{display:none}
.lic-over summary svg{width:16px;height:16px}
.chk{display:inline-flex;align-items:center;gap:6px;padding:5px 10px;border:1px solid var(--border);border-radius:999px;font-size:12.5px;cursor:pointer}
.chk input{accent-color:var(--accent)}
