:root {
  --bg: #f8fafd; --surface: #ffffff; --surface-2: #f1f4f9; --ink: #1f1f1f; --muted: #5f6368; --line: #e3e7ee; --line-strong: #d3d9e2;
  --primary: #1a73e8; --primary-ink: #ffffff; --primary-soft: #d3e3fd; --primary-soft-ink: #041e49;
  --hover: rgba(60, 64, 67, .07); --sel: #c2e7ff; --sel-ink: #001d35;
  --warn: #b06000; --warn-bg: #fef0d4; --ok: #137333; --ok-bg: #e6f4ea; --err: #c5221f; --err-bg: #fce8e6;
  --t-szallitoi: #1a73e8; --t-szallitoi-bg: #e8f0fe;
  --t-vevoi: #188038; --t-vevoi-bg: #e6f4ea;
  --t-ber: #8430ce; --t-ber-bg: #f3e8fd;
  --t-bank: #00796b; --t-bank-bg: #e0f2f1;
  --t-egyeb: #5f6368; --t-egyeb-bg: #f1f3f4;
  --shadow: 0 1px 2px rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418; --surface: #1b1f24; --surface-2: #23282f; --ink: #e3e3e3; --muted: #a8adb4; --line: #2d333b; --line-strong: #3a414b;
    --primary: #8ab4f8; --primary-ink: #062e6f; --primary-soft: #0b3d91; --primary-soft-ink: #d3e3fd;
    --hover: rgba(232, 234, 237, .08); --sel: #004a77; --sel-ink: #c2e7ff;
    --warn: #fdd663; --warn-bg: #3d3214; --ok: #81c995; --ok-bg: #1b3a26; --err: #f28b82; --err-bg: #3c1f1d;
    --t-szallitoi: #8ab4f8; --t-szallitoi-bg: #1c2b45;
    --t-vevoi: #81c995; --t-vevoi-bg: #1b3326;
    --t-ber: #d7aefb; --t-ber-bg: #33244a;
    --t-bank: #80cbc4; --t-bank-bg: #15322f;
    --t-egyeb: #bdc1c6; --t-egyeb-bg: #2a2f36;
    --shadow: 0 1px 3px rgba(0,0,0,.5);
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 Roboto, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .tiny { font-size: 12px; }
.error { color: var(--err); min-height: 1.2em; margin: 0; }
svg.i { width: 20px; height: 20px; fill: currentColor; flex: none; display: block; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 20px; border-radius: 20px; border: 0;
  font: 500 14px/1 inherit; font-family: inherit; cursor: pointer; text-decoration: none; white-space: nowrap; letter-spacing: .1px; }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { box-shadow: var(--shadow); }
.btn.tonal { background: var(--primary-soft); color: var(--primary-soft-ink); }
.btn.outline { background: transparent; color: var(--primary); border: 1px solid var(--line-strong); }
.btn.outline:hover, .btn.tonal:hover { filter: brightness(.97); }
.btn.wide { width: 100%; justify-content: center; }
.btn.sm { height: 32px; padding: 0 14px; font-size: 13px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--muted);
  display: inline-grid; place-items: center; cursor: pointer; text-decoration: none; flex: none; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.sm { width: 34px; height: 34px; }
.icon-btn.primary-ico { color: var(--primary); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 28px; padding: 40px 36px; width: min(420px, 100%);
  display: flex; flex-direction: column; gap: 16px; }
.login-card h1 { margin: 8px 0 0; font-size: 26px; font-weight: 400; }
.login-card p { margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input, select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px 12px; }
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }

/* logo */
.logo { width: 40px; height: 40px; border-radius: 12px; background: var(--primary); color: #fff; display: grid; place-items: center; flex: none; }
.logo svg.i { width: 24px; height: 24px; }
.logo.big { width: 56px; height: 56px; border-radius: 16px; } .logo.big svg.i { width: 32px; height: 32px; }
@media (prefers-color-scheme: dark) { .logo { color: #062e6f; } }

/* app bar */
.appbar { height: 64px; display: flex; align-items: center; gap: 16px; padding: 0 16px; background: var(--bg); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 230px; }
.brand b { display: block; font-size: 20px; font-weight: 400; line-height: 1.1; }
.brand span { display: block; font-size: 12px; color: var(--muted); }
.searchbar { flex: 1; max-width: 720px; height: 48px; border-radius: 24px; background: var(--surface-2); display: flex; align-items: center; gap: 12px; padding: 0 18px; color: var(--muted); }
.searchbar:focus-within { background: var(--surface); box-shadow: var(--shadow); }
.searchbar input { flex: 1; border: 0; background: transparent; padding: 0; height: 100%; font-size: 16px; }
.searchbar input:focus { outline: none; }
.user { margin-left: auto; position: relative; }
.avatar { width: 36px; height: 36px; border-radius: 50%; border: 0; background: #7b5ea7; color: #fff; font: 500 15px/1 inherit; font-family: inherit; cursor: pointer; display: grid; place-items: center; }
.avatar.big { width: 52px; height: 52px; font-size: 22px; cursor: default; }
.menu { position: absolute; right: 0; top: 46px; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); padding: 8px; min-width: 260px; z-index: 20; }
.menu-head { display: flex; gap: 12px; align-items: center; padding: 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head b, .menu-head span { display: block; }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: transparent; color: var(--ink); padding: 10px 12px; border-radius: 10px; font: inherit; cursor: pointer; }
.menu-item:hover { background: var(--hover); }

/* layout */
.layout { display: grid; grid-template-columns: 264px 1fr; gap: 0; min-height: calc(100vh - 64px); }
nav { padding: 4px 12px 24px 12px; overflow: auto; max-height: calc(100vh - 64px); position: sticky; top: 64px; }
.fab { display: inline-flex; align-items: center; gap: 12px; height: 56px; padding: 0 22px 0 18px; border-radius: 16px; border: 0; background: var(--surface);
  box-shadow: var(--shadow); color: var(--ink); font: 500 14px/1 inherit; font-family: inherit; cursor: pointer; margin: 4px 0 16px 4px; }
.fab:hover { background: var(--surface-2); }
.fab svg.i { width: 24px; height: 24px; color: var(--primary); }
.nav-item { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 40px; padding: 6px 14px; border: 0; border-radius: 20px; background: transparent;
  color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--sel); color: var(--sel-ink); font-weight: 500; }
.nav-item.small { min-height: 34px; font-size: 13px; }
.nav-section { margin: 18px 14px 6px; font-size: 12px; font-weight: 500; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.year-head { display: flex; align-items: center; gap: 10px; margin: 12px 14px 4px; font-size: 13px; font-weight: 500; color: var(--muted); }
.year-head::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }

.batch { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 4px 12px; width: 100%; padding: 9px 12px 9px 14px;
  border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; border-radius: 0; }
.batch:last-child { border-bottom: 0; }
.batch:hover { background: var(--hover); }
.batch.active { background: var(--sel); color: var(--sel-ink); border-radius: 12px; border-bottom-color: transparent; }
.batch .ico { color: var(--muted); } .batch.active .ico { color: var(--sel-ink); }
.batch .ico.ok { color: var(--ok); }
.batch .t { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch .m { grid-column: 2 / 4; font-size: 12px; color: var(--muted); }
.batch.active .m { color: inherit; opacity: .8; }
.batch.sub { padding-left: 34px; }
.count { font-size: 12px; font-weight: 500; color: var(--muted); }
.batch-list { background: var(--surface); border-radius: 14px; border: 1px solid var(--line); overflow: hidden; }

.maint { margin-top: 18px; }
.maint summary { display: flex; align-items: center; gap: 14px; padding: 8px 14px; border-radius: 20px; cursor: pointer; color: var(--muted); list-style: none; }
.maint summary::-webkit-details-marker { display: none; }
.maint summary:hover { background: var(--hover); }
.maint p { padding: 4px 14px; margin: 4px 0 0; }

/* main */
main { padding: 4px 24px 32px 8px; min-width: 0; }
.batch-head { background: var(--surface); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; }
.batch-head .bh-title { display: flex; align-items: center; gap: 14px; flex: 1 1 320px; min-width: 0; }
.batch-head .bh-title .type-ico { width: 48px; height: 48px; border-radius: 14px; background: var(--primary-soft); color: var(--primary-soft-ink); }
.batch-head h2 { margin: 0; font-size: 22px; font-weight: 400; }
.batch-head .meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.batch-head .counts { display: flex; flex-wrap: wrap; gap: 8px; flex-basis: 100%; }
.batch-head .bh-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line-strong); margin: 4px 0 12px; scrollbar-width: none; }
.tab { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 16px; border: 0; background: transparent; color: var(--muted); font: 500 14px/1 inherit;
  font-family: inherit; cursor: pointer; border-bottom: 3px solid transparent; border-radius: 0; white-space: nowrap; }
.tab:hover { background: var(--hover); color: var(--ink); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab .n { font-size: 12px; background: var(--surface-2); color: var(--muted); border-radius: 10px; padding: 2px 7px; }
.tab.active .n { background: var(--primary-soft); color: var(--primary-soft-ink); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.selects, .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.select { position: relative; display: flex; align-items: center; color: var(--muted); }
.select > span { position: absolute; left: 12px; pointer-events: none; }
.select select { appearance: none; height: 36px; padding: 0 30px 0 40px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface)
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%235f6368' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 6px center / 20px;
  color: var(--ink); cursor: pointer; }
.chip-toggle { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px 0 10px; border: 1px solid var(--line-strong); border-radius: 8px;
  cursor: pointer; color: var(--ink); background: var(--surface); user-select: none; }
.chip-toggle input { display: none; }
.chip-toggle svg.i { width: 18px; height: 18px; color: var(--muted); }
.chip-toggle:has(input:checked) { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.chip-toggle:has(input:checked) svg.i { color: var(--warn); }

.summary { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 10px; font-size: 13px; color: var(--muted); }
.stat { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; color: var(--ink); }
.stat b { font-weight: 500; }

/* table */
.sheet { background: var(--surface); border-radius: var(--radius); overflow: auto; }
.sheet.flat { border-radius: 0; flex: 1; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; background: var(--surface); position: sticky; top: 0; z-index: 1; height: 44px; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--hover); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.num b { font-weight: 500; font-size: 15px; }
td.nowrap { white-space: nowrap; }
td .sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
td .partner { font-weight: 500; font-size: 14px; }
td.act, th.act { text-align: right; white-space: nowrap; width: 1%; }
.td-type { min-width: 190px; }
.td-partner { width: 100%; max-width: 0; min-width: 200px; }
.td-partner .partner { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-partner .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv { font-variant-numeric: tabular-nums; color: var(--ink); background: var(--surface-2); border-radius: 6px; padding: 1px 6px; margin-right: 6px; font-size: 12px; }
.badge.icon-only { padding: 3px 5px; }

.type-pill { display: inline-flex; align-items: center; gap: 10px; padding: 4px 6px 4px 0; border-radius: 12px; font-size: 15px; font-weight: 500; white-space: nowrap; }
.type-pill .type-ico { width: 32px; height: 32px; border-radius: 10px; }
.type-ico { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; flex: none; }
.type-ico svg.i { width: 20px; height: 20px; }
.t-szallitoi { color: var(--t-szallitoi); } .t-szallitoi .type-ico, .type-ico.t-szallitoi { background: var(--t-szallitoi-bg); color: var(--t-szallitoi); }
.t-vevoi { color: var(--t-vevoi); } .t-vevoi .type-ico, .type-ico.t-vevoi { background: var(--t-vevoi-bg); color: var(--t-vevoi); }
.t-ber { color: var(--t-ber); } .t-ber .type-ico, .type-ico.t-ber { background: var(--t-ber-bg); color: var(--t-ber); }
.t-bank { color: var(--t-bank); } .t-bank .type-ico, .type-ico.t-bank { background: var(--t-bank-bg); color: var(--t-bank); }
.t-egyeb { color: var(--t-egyeb); } .t-egyeb .type-ico, .type-ico.t-egyeb { background: var(--t-egyeb-bg); color: var(--t-egyeb); }
.type-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px 0 8px; border-radius: 8px; font-size: 13px; font-weight: 500; }
.type-chip svg.i { width: 18px; height: 18px; }
.type-chip.t-szallitoi { background: var(--t-szallitoi-bg); } .type-chip.t-vevoi { background: var(--t-vevoi-bg); }
.type-chip.t-ber { background: var(--t-ber-bg); } .type-chip.t-bank { background: var(--t-bank-bg); } .type-chip.t-egyeb { background: var(--t-egyeb-bg); }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; padding: 3px 9px 3px 6px; border-radius: 8px; background: var(--surface-2); color: var(--muted); white-space: nowrap; margin: 1px 0; }
.badge svg.i { width: 15px; height: 15px; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.err { background: var(--err-bg); color: var(--err); }
.period { font-variant-numeric: tabular-nums; font-weight: 500; }

.empty { display: grid; place-items: center; gap: 8px; padding: 56px 16px; color: var(--muted); }
.empty svg.i { width: 56px; height: 56px; opacity: .5; }

/* drawer */
.drawer { position: fixed; inset: 0; background: rgba(32,33,36,.45); display: flex; justify-content: flex-end; z-index: 30; }
.drawer-inner { background: var(--surface); width: min(1240px, 100%); height: 100%; display: flex; flex-direction: column; }
.drawer-inner.narrow { width: min(480px, 100%); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px 10px 20px; border-bottom: 1px solid var(--line); gap: 10px; min-height: 64px; }
.dtitle { display: flex; align-items: center; gap: 14px; min-width: 0; }
.dtitle h2 { margin: 0; font-size: 18px; font-weight: 400; overflow-wrap: anywhere; }
.dtitle .muted { font-size: 13px; }
.dactions { display: flex; gap: 4px; }
.drawer-body { display: grid; grid-template-columns: 1fr 420px; flex: 1; min-height: 0; }
iframe { width: 100%; height: 100%; border: 0; background: #e8eaed; }
.fields { padding: 16px 20px 24px; overflow: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; align-content: start; border-left: 1px solid var(--line); }
.fields.single { grid-template-columns: 1fr; border-left: 0; }
.fields .wide { grid-column: 1 / -1; }
.fields h3 { grid-column: 1 / -1; margin: 10px 0 0; font-size: 12px; font-weight: 500; letter-spacing: .4px; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.fields h3:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.fields .actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.fields .check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
.fields .check input { width: 18px; height: 18px; }
.infobox { grid-column: 1 / -1; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; font-size: 12px; color: var(--muted); display: grid; gap: 4px; }
.notebox { grid-column: 1 / -1; background: var(--warn-bg); color: var(--warn); border-radius: 12px; padding: 10px 12px; font-size: 13px; display: flex; gap: 8px; }

.only-mobile { display: none; }
@media (max-width: 1100px) {
  .drawer-body { grid-template-columns: 1fr; grid-template-rows: 55vh auto; overflow: auto; }
  .fields { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 900px) {
  .only-mobile { display: inline-grid; }
  .brand { display: none; }
  .appbar { gap: 8px; padding: 0 8px; }
  .searchbar { min-width: 0; padding: 0 12px; }
  .user { margin-left: 0; }
  .layout { grid-template-columns: 1fr; }
  nav { position: fixed; top: 64px; left: 0; bottom: 0; width: 290px; background: var(--bg); z-index: 15; transform: translateX(-105%); transition: transform .2s; max-height: none; box-shadow: var(--shadow); }
  nav.open { transform: none; }
  main { padding: 4px 12px 24px; }
  .searchbar { height: 42px; }
  .searchbar input { font-size: 15px; }
  /* table → cards */
  #docs thead { display: none; }
  #docs, #docs tbody, #docs tr, #docs td { display: block; width: 100%; }
  #docs tr { padding: 12px 14px; border-bottom: 1px solid var(--line); position: relative; }
  #docs td { border: 0; padding: 2px 0; }
  #docs td.act { position: absolute; top: 10px; right: 8px; width: auto; }
  #docs td.num { text-align: left; }
  #docs td.td-partner { max-width: none; padding-right: 90px; }
  #docs td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: 12px; }
}
