
/* Ardezie Financiară — tokeni */
:root { --bg: #F8FAFC;--surface: #FFFFFF;--border: #E2E8F0;--text: #0F172A;--text-2: #64748B;--text-3: #94A3B8;--primary: #2563EB;--primary-hover: #1D4ED8;--primary-subtle: #DBEAFE;--on-primary: #FFFFFF;--success: #16A34A;--success-bg: #DCFCE7;--success-text: #166534;--warning: #D97706;--warning-bg: #FEF3C7;--warning-text: #92400E;--warning-border: #FDE68A;--error: #DC2626;--error-bg: #FEE2E2;--error-text: #991B1B;--info: #2563EB;--info-bg: #DBEAFE;--info-text: #1E40AF;--nav-text: #334155;--nav-active-bg: #DBEAFE;--nav-active-text: #1D4ED8;--avatar-bg: #E2E8F0;--avatar-text: #334155;--shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);--shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08); --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --r-sm: 4px; --r-md: 6px; --r-lg: 8px; --r-xl: 12px; --r-pill: 999px;
  --t-fast: 150ms; --t-base: 200ms; --ease: cubic-bezier(0.2, 0, 0, 1); color-scheme: light; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #0F172A;--surface: #1E293B;--border: #334155;--text: #F1F5F9;--text-2: #94A3B8;--text-3: #64748B;--primary: #60A5FA;--primary-hover: #93C5FD;--primary-subtle: #1E3A8A;--on-primary: #0F172A;--success: #4ADE80;--success-bg: #14532D;--success-text: #4ADE80;--warning: #FBBF24;--warning-bg: #451A03;--warning-text: #FBBF24;--warning-border: #78350F;--error: #F87171;--error-bg: #450A0A;--error-text: #F87171;--info: #60A5FA;--info-bg: #1E3A8A;--info-text: #93C5FD;--nav-text: #CBD5E1;--nav-active-bg: #1E3A8A;--nav-active-text: #93C5FD;--avatar-bg: #334155;--avatar-text: #F1F5F9;--shadow-sm: none;--shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35); color-scheme: dark; } }
:root[data-theme="dark"] { --bg: #0F172A;--surface: #1E293B;--border: #334155;--text: #F1F5F9;--text-2: #94A3B8;--text-3: #64748B;--primary: #60A5FA;--primary-hover: #93C5FD;--primary-subtle: #1E3A8A;--on-primary: #0F172A;--success: #4ADE80;--success-bg: #14532D;--success-text: #4ADE80;--warning: #FBBF24;--warning-bg: #451A03;--warning-text: #FBBF24;--warning-border: #78350F;--error: #F87171;--error-bg: #450A0A;--error-text: #F87171;--info: #60A5FA;--info-bg: #1E3A8A;--info-text: #93C5FD;--nav-text: #CBD5E1;--nav-active-bg: #1E3A8A;--nav-active-text: #93C5FD;--avatar-bg: #334155;--avatar-text: #F1F5F9;--shadow-sm: none;--shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35); color-scheme: dark; }

/* bază */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; } a:hover { color: var(--primary-hover); }
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.25; }
h1 { font-size: 18px; } h2 { font-size: 16px; }
code, .mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--text-2); } .faint { color: var(--text-3); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
svg { flex-shrink: 0; }
*, *::before, *::after { transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* shell */
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { display: flex; flex-direction: column; padding: 16px 12px; background: var(--surface); border-right: 1px solid var(--border); position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 8px; margin-bottom: 16px; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav span.disabled { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: var(--r-md); font-size: 14px; font-weight: 500; color: var(--nav-text); }
.nav a:hover { background: var(--bg); color: var(--text); }
.nav a.active { background: var(--nav-active-bg); color: var(--nav-active-text); }
.nav span.disabled { color: var(--text-3); cursor: default; }
.nav .soon { margin-left: auto; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding: 12px 8px 0; border-top: 1px solid var(--border); }
.label { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--r-pill); background: var(--avatar-bg); color: var(--avatar-text); font-size: 12px; font-weight: 600; flex-shrink: 0; }
.identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.identity .who { display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.identity .who .email { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar { display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.content { display: flex; flex-direction: column; gap: 24px; padding: 24px; max-width: 1200px; width: 100%; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-head p { margin: 4px 0 0; font-size: 14px; color: var(--text-2); }
.actions { display: inline-flex; align-items: center; gap: 12px; }
.actions-tight { display: inline-flex; align-items: center; gap: 16px; }

/* pagini fără organizație (login, home) */
.bare { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.bare .card { width: 100%; max-width: 420px; }

/* componente */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.kpi { display: flex; flex-direction: column; gap: 8px; padding: 20px 24px; }
.kpi .k { font-size: 13px; font-weight: 500; color: var(--text-2); }
.kpi .n { font-size: 30px; font-weight: 700; line-height: 1.25; letter-spacing: -0.02em; }
.kpi .row { display: flex; align-items: center; gap: 12px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { padding: 0 16px; height: 40px; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 0 16px; height: 44px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td.right, .table th.right { text-align: right; }
.table tr.selected td { background: var(--bg); }
.table td.detail { padding: 0 16px 16px; background: var(--bg); height: auto; }
.detail-box { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-warning { background: var(--warning-bg); color: var(--warning-text); }
.badge-error { background: var(--error-bg); color: var(--error-text); }
.badge-info { background: var(--info-bg); color: var(--info-text); }
.badge-neutral { background: var(--bg); color: var(--text-2); border: 1px solid var(--border); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }
.btn-icon { width: 36px; padding: 0; color: var(--nav-text); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 500; }
.input, .select, .textarea { width: 100%; height: 40px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; }
.textarea { height: auto; min-height: 240px; padding: 12px 14px; font-family: var(--mono); font-size: 13px; line-height: 1.5; resize: vertical; }
.input::placeholder { color: var(--text-3); }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-radius: var(--r-lg); font-size: 14px; font-weight: 500; }
.banner-warning { background: var(--warning-bg); border: 1px solid var(--warning-border); color: var(--warning-text); }
.banner .lead { display: flex; align-items: center; gap: 10px; }
.notice { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 6px 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); font-size: 13px; color: var(--text-2); }
.msg { font-size: 14px; } .msg.ok { color: var(--success-text); } .msg.err { color: var(--error-text); }
.filters { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.filters form { display: flex; align-items: center; gap: 12px; }
.filters .select { width: 200px; }
.hint { font-size: 13px; color: var(--text-2); }
.empty { padding: 32px; text-align: center; color: var(--text-2); font-size: 14px; }
.chart { display: block; }
.chart-empty { padding: 24px; text-align: center; font-size: 13px; }
.pre { white-space: pre-wrap; font-family: var(--mono); font-size: 12px; background: var(--bg); padding: 12px; border-radius: var(--r-md); border: 1px solid var(--border); max-height: 320px; overflow: auto; }
.stats { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:12px; margin:12px 0 }
.stat { background:var(--surface); border:1px solid var(--border); border-radius:8px; padding:12px 16px }
.stat .value { font-size:18px; font-weight:600 }
.num { text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums }
.ok { color:var(--success-text) }
.err { color:var(--error-text) }

/* chat */
.chat { display: flex; flex-direction: column; flex-grow: 1; min-height: 0; gap: 16px; }
.thread { display: flex; flex-direction: column; gap: 20px; flex-grow: 1; min-height: 240px; max-height: calc(100vh - 260px); overflow: auto; padding: 8px 0; }
.msg-user { display: flex; justify-content: flex-end; }
.msg-bot { display: flex; align-items: flex-start; gap: 12px; }
.bubble { max-width: 720px; padding: 10px 14px; border-radius: var(--r-lg); font-size: 14px; line-height: 1.5; }
.msg-user .bubble { background: var(--bg); border: 1px solid var(--border); }
.msg-bot .bubble { background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.composer { display: flex; align-items: center; gap: 12px; }
.composer .input { flex-grow: 1; }

/* formularul din schemă (schema_form.py emite elemente fără clase) */
#adl-form label { display: block; margin: 12px 0 4px; font-size: 14px; font-weight: 500; }
#adl-form input[type="text"], #adl-form select { width: 100%; height: 40px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; }
#adl-form input[type="checkbox"] { width: auto; height: auto; }
#adl-form fieldset { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px 16px; margin: 12px 0; }
#adl-form legend { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; padding: 0 4px; }

/* responsive */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .kpis { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}

/* facturare: pagina de tipărire (fără shell — vezi ui/html.py:html_page) */
.invoice { max-width: 800px; width: 100%; margin: 0 auto; padding: 32px; box-sizing: border-box; }
.invoice table { width: 100%; border-collapse: collapse; }
.invoice th, .invoice td { border-bottom: 1px solid var(--border); padding: 8px; text-align: left; }
.invoice .right { text-align: right; }
.invoice .totals td { font-weight: 600; }
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .content { padding: 0; }
  /* fundal alb + text negru INDIFERENT de tema (în dark ar ieși alb pe alb) */
  body, .invoice, .invoice * { background: #fff !important; color: #111 !important; }
}
