:root { --bg:#f5f6f8; --card:#fff; --text:#1c2230; --muted:#687080; --line:#e3e6eb; --accent:#2f6fde; --accent-text:#fff; --in:#15803d; --out:#c0262d; --warn:#b45309; --soft:#eef3fd; }
@media (prefers-color-scheme: dark) { :root { --bg:#101318; --card:#191e26; --text:#e6e8eb; --muted:#9aa3ae; --line:#2a313b; --accent:#5b8ff0; --in:#4ade80; --out:#f87171; --warn:#fbbf24; --soft:#1d2738; } }
* { box-sizing:border-box; }
html { -webkit-text-size-adjust:100%; }
body { margin:0; font:15px/1.45 system-ui,-apple-system,Segoe UI,Roboto,sans-serif; background:var(--bg); color:var(--text); }
a { color:var(--accent); }
header.top { position:sticky; top:0; z-index:5; display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 16px; border-bottom:1px solid var(--line); background:var(--card); }
header.top h1 { font-size:17px; margin:0; }
main { max-width:1100px; margin:0 auto; padding:16px; display:grid; gap:14px; }
.card { background:var(--card); border:1px solid var(--line); border-radius:12px; padding:16px; }
.card h2 { font-size:16px; margin:0 0 12px; }
.row { display:flex; flex-wrap:wrap; gap:10px; align-items:end; }
label { display:grid; gap:4px; font-size:12px; color:var(--muted); }
input, select, button, textarea { font:inherit; padding:8px 11px; border-radius:8px; border:1px solid var(--line); background:var(--card); color:var(--text); }
textarea { width:100%; min-height:90px; }
button { cursor:pointer; }
button.primary { background:var(--accent); border-color:var(--accent); color:var(--accent-text); font-weight:600; }
button.danger { color:var(--out); }
button.small { padding:4px 9px; font-size:13px; }
button:disabled { opacity:.55; cursor:default; }
.muted { color:var(--muted); }
.err { color:var(--out); white-space:pre-wrap; }
.ok { color:var(--in); }
.in { color:var(--in); } .out { color:var(--out); }
.pill { display:inline-block; font-size:11px; padding:1px 7px; border-radius:99px; border:1px solid var(--line); color:var(--muted); white-space:nowrap; }
.pill.warn { color:var(--warn); border-color:currentColor; }
.hidden { display:none !important; }
.num { font-variant-numeric:tabular-nums; white-space:nowrap; }
.tabs { display:flex; gap:4px; overflow-x:auto; padding:0 16px; background:var(--card); border-bottom:1px solid var(--line); position:sticky; top:49px; z-index:4; scrollbar-width:none; }
.tabs button { border:0; border-bottom:2px solid transparent; border-radius:0; background:none; padding:11px 10px; color:var(--muted); white-space:nowrap; }
.tabs button.on { color:var(--text); border-bottom-color:var(--accent); font-weight:600; }
.badge { display:inline-block; min-width:18px; padding:0 5px; border-radius:99px; background:var(--out); color:#fff; font-size:11px; text-align:center; margin-left:4px; }
.stats { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px; }
.stat { background:var(--card); border:1px solid var(--line); border-radius:12px; padding:14px; }
.stat span { font-size:12px; color:var(--muted); }
.stat b { display:block; font-size:20px; margin-top:2px; font-variant-numeric:tabular-nums; }
.tbl { overflow-x:auto; }
table { width:100%; border-collapse:collapse; }
th, td { text-align:left; padding:9px 8px; border-bottom:1px solid var(--line); vertical-align:top; }
th { font-size:12px; color:var(--muted); font-weight:500; }
td.r, th.r { text-align:right; }
tr.mine td { background:var(--soft); }
.list { display:grid; gap:8px; }
.item { border:1px solid var(--line); border-radius:10px; padding:12px; display:grid; gap:6px; }
.item .head { display:flex; justify-content:space-between; gap:10px; align-items:start; }
.item .amt { font-weight:600; font-size:16px; }
.receipts { display:flex; flex-wrap:wrap; gap:8px; }
.receipt { display:flex; align-items:center; gap:6px; border:1px solid var(--line); border-radius:8px; padding:4px 8px; font-size:13px; max-width:100%; }
.receipt img { width:36px; height:36px; object-fit:cover; border-radius:4px; }
.receipt a { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:180px; }
.center { min-height:100vh; display:grid; place-items:center; padding:16px; }
.auth { width:100%; max-width:380px; display:grid; gap:12px; }
.auth h1 { margin:0; font-size:22px; }
.auth input, .auth button { width:100%; }
.code { font-size:24px; letter-spacing:6px; text-align:center; }
.checks { display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:4px 12px; max-height:260px; overflow:auto; border:1px solid var(--line); border-radius:8px; padding:8px; }
.checks label { display:flex; gap:6px; align-items:center; font-size:14px; color:var(--text); }
.checks input { width:auto; }
dialog { border:1px solid var(--line); border-radius:12px; background:var(--card); color:var(--text); width:min(560px, calc(100vw - 32px)); padding:18px; }
dialog::backdrop { background:rgba(0,0,0,.4); }
.toast { position:fixed; left:50%; bottom:20px; transform:translateX(-50%); background:var(--text); color:var(--bg); padding:10px 16px; border-radius:10px; z-index:50; max-width:calc(100vw - 32px); }
@media (max-width:640px) {
  main { padding:12px; }
  .hide-sm { display:none; }
  th, td { padding:8px 5px; }
}

/* Tabel tip Excel */
.sheet-wrap { overflow:auto; max-height:78vh; border:1px solid var(--line); border-radius:10px; background:var(--card); }
table.sheet { border-collapse:separate; border-spacing:0; font-size:12.5px; width:max-content; min-width:100%; }
.sheet th, .sheet td { border-right:1px solid var(--line); border-bottom:1px solid var(--line); padding:5px 7px; white-space:nowrap; }
.sheet thead th { position:sticky; background:var(--card); z-index:2; text-align:center; vertical-align:bottom; font-weight:600; color:var(--text); font-size:12px; }
.sheet thead tr:first-child th { top:0; }
.sheet thead tr:nth-child(2) th { top:var(--h1, 30px); }
.sheet th.exp { white-space:normal; width:88px; min-width:88px; max-width:110px; line-height:1.25; cursor:pointer; }
.sheet th.exp small { display:block; font-weight:400; color:var(--muted); margin-top:2px; }
.sheet th.exp:hover { background:var(--soft); }
.sheet td { text-align:right; font-variant-numeric:tabular-nums; }
.sheet td.name, .sheet th.name { text-align:left; position:sticky; left:32px; background:var(--card); z-index:1; min-width:190px; }
.sheet td.nr, .sheet th.nr { position:sticky; left:0; background:var(--card); z-index:1; width:32px; min-width:32px; text-align:center; color:var(--muted); }
.sheet thead th.name, .sheet thead th.nr { z-index:3; }
.sheet tr.mine td { background:var(--soft); }
.sheet tfoot td { font-weight:700; position:sticky; bottom:0; background:var(--card); border-top:2px solid var(--text); }
.sheet .grp { cursor:pointer; }
.sheet .grp:hover { background:var(--soft); }
.sheet td.zero { color:var(--muted); text-align:center; }
.sheet .bold { font-weight:700; }
.chips { display:flex; gap:6px; flex-wrap:wrap; }
.chips button { border-radius:99px; padding:4px 11px; font-size:13px; }
.chips button.on { background:var(--accent); color:var(--accent-text); border-color:var(--accent); }
@media (max-width:640px) {
  .sheet-wrap { max-height:72vh; border-radius:8px; }
  table.sheet { font-size:12px; }
  .sheet th, .sheet td { padding:5px 5px; }
  .sheet td.nr, .sheet th.nr { display:none; }
  .sheet td.name, .sheet th.name { left:0; min-width:112px; max-width:112px; white-space:normal; line-height:1.2; font-size:12px; }
  .sheet th.exp { width:74px; min-width:74px; font-size:11px; }
  dialog { width:100vw; max-width:100vw; max-height:92vh; margin:auto 0 0; border-radius:14px 14px 0 0; padding:16px; }
  dialog .checks { grid-template-columns:1fr 1fr !important; }
  .tabs { top:45px; }
  header.top h1 { font-size:16px; }
  .stat b { font-size:17px; }
}
main.wide { max-width:none; }
/* câmpurile nu au voie să lățească pagina */
.row > * { min-width:0; max-width:100%; }
label > select { width:100%; max-width:100%; text-overflow:ellipsis; }
.item, .card { min-width:0; overflow-wrap:anywhere; }
@media (max-width:640px) {
  .card .row > label { flex:1 1 100% !important; min-width:0 !important; }
  .card .row > label input:not([type=checkbox]):not([type=radio]) { width:100% !important; }
  #loose .item { min-width:0 !important; }
}

body.imp { padding-bottom:90px; }
.receipt { overflow-wrap:normal; min-width:0; }
.receipt > a, .receipt > span:not(.pill) { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; min-width:0; }
.item .head > div:first-child { flex:1 1 auto; min-width:0; }
.item .head > :last-child { flex:0 0 auto; }
.item { max-width:100%; }
.receipt { flex-wrap:wrap; }
