/* Invoicer "Életút" UI on Bootstrap 5.3. Tokens switch with data-bs-theme on <html> (light / dark "Courier Dark"). */
:root, :root[data-bs-theme=light] {
    --iv-app: #fbfaf7;
    --iv-surface: #f5f3ee;
    --iv-raised: #ffffff;
    --iv-line: #ddd8ce;
    --iv-line-soft: #ece8e0;
    --iv-line2: #857e73;
    --iv-timeline: #bdb6aa;
    --iv-track: #e3ded4;
    --iv-ink: #1f1d1a;
    --iv-ink-rgb: 31, 29, 26;
    --iv-ink2: #2e2b26;
    --iv-ink3: #4d483f;
    --iv-ink4: #5f5a52;
    --iv-accent: #2d6150;
    --iv-accent-ink: #ffffff;
    --iv-link: #2d6150;
    --iv-link-rgb: 45, 97, 80;
    --iv-ring: #b9d3c7;
    --iv-inverse-bg: #1f1d1a;
    --iv-inverse-ink: #ffffff;
    --iv-watermark: rgba(31, 29, 26, .05);

    --iv-ok-bg: #e8f1ec; --iv-ok-fg: #285a44; --iv-ok-bd: #a9c9b8;
    --iv-warn-bg: #f8efd9; --iv-warn-fg: #6b4a00; --iv-warn-bd: #d9bd7a;
    --iv-info-bg: #e7eef3; --iv-info-fg: #23506b; --iv-info-bd: #a3bccd;
    --iv-bad-bg: #fbeee9; --iv-bad-fg: #8a2417; --iv-bad-bd: #d59a8f;
    --iv-mute-bg: #f5f3ee; --iv-mute-fg: #4d483f; --iv-mute-bd: #d4cec3;
    --iv-ok-solid: #285a44; --iv-ok-solid-ink: #ffffff;
    --iv-bad-solid: #9b2a1c; --iv-bad-solid-ink: #ffffff;
    --iv-bad-dash: #b8574a;
    --iv-bad-sub: #5a2218;

    --iv-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --iv-mono: ui-monospace, Menlo, Consolas, monospace;
}
:root[data-bs-theme=dark] {
    color-scheme: dark;
    --iv-app: #131313;
    --iv-surface: #181818;
    --iv-raised: #252525;
    --iv-line: #2c2c2c;
    --iv-line-soft: #2c2c2c;
    --iv-line2: #474747;
    --iv-timeline: #474747;
    --iv-track: #2c2c2c;
    --iv-ink: #dedede;
    --iv-ink-rgb: 222, 222, 222;
    --iv-ink2: #dedede;
    --iv-ink3: #b9b9b9;
    --iv-ink4: #8f8f8f;
    --iv-accent: #714eb9;
    --iv-accent-ink: #fdecea;
    --iv-link: #b89fff;
    --iv-link-rgb: 184, 159, 255;
    --iv-ring: #4a3a70;
    --iv-inverse-bg: #dedede;
    --iv-inverse-ink: #181818;
    --iv-watermark: rgba(222, 222, 222, .05);

    --iv-ok-bg: #1e2a17; --iv-ok-fg: #8fd14f; --iv-ok-bd: #34502a;
    --iv-warn-bg: #3a3015; --iv-warn-fg: #eec84f; --iv-warn-bd: #6b5a24;
    --iv-info-bg: #172538; --iv-info-fg: #5aa5f5; --iv-info-bd: #2b4668;
    --iv-bad-bg: #3a2021; --iv-bad-fg: #ff8b80; --iv-bad-bd: #6a3533;
    --iv-mute-bg: #181818; --iv-mute-fg: #b9b9b9; --iv-mute-bd: #363636;
    --iv-ok-solid: #70b433; --iv-ok-solid-ink: #131313;
    --iv-bad-solid: #c94a44; --iv-bad-solid-ink: #fdecea;
    --iv-bad-dash: #d9605a;
    --iv-bad-sub: #f2c4bf;
}
:root, :root[data-bs-theme] {
    --bs-font-sans-serif: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bs-font-monospace: var(--iv-mono);
    --bs-body-font-size: .9375rem;
    --bs-body-color: var(--iv-ink);
    --bs-body-color-rgb: var(--iv-ink-rgb);
    --bs-body-bg: var(--iv-surface);
    --bs-emphasis-color: var(--iv-ink);
    --bs-secondary-color: var(--iv-ink3);
    --bs-tertiary-color: var(--iv-ink4);
    --bs-secondary-bg: var(--iv-surface);
    --bs-tertiary-bg: var(--iv-app);
    --bs-border-color: var(--iv-line);
    --bs-border-radius: 6px;
    --bs-link-color: var(--iv-link);
    --bs-link-color-rgb: var(--iv-link-rgb);
    --bs-link-hover-color: var(--iv-ink);
    --bs-link-hover-color-rgb: var(--iv-ink-rgb);
    --bs-heading-color: var(--iv-ink);
    --bs-focus-ring-color: var(--iv-ring);
    --bs-success-text-emphasis: var(--iv-ok-fg); --bs-success-bg-subtle: var(--iv-ok-bg); --bs-success-border-subtle: var(--iv-ok-bd);
    --bs-warning-text-emphasis: var(--iv-warn-fg); --bs-warning-bg-subtle: var(--iv-warn-bg); --bs-warning-border-subtle: var(--iv-warn-bd);
    --bs-info-text-emphasis: var(--iv-info-fg); --bs-info-bg-subtle: var(--iv-info-bg); --bs-info-border-subtle: var(--iv-info-bd);
    --bs-danger-text-emphasis: var(--iv-bad-fg); --bs-danger-bg-subtle: var(--iv-bad-bg); --bs-danger-border-subtle: var(--iv-bad-bd);
    --bs-danger: var(--iv-bad-fg);
}

/* ---------- Base */
body { background: var(--iv-surface); color: var(--iv-ink); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
a { text-underline-offset: .15em; }
a:hover { color: var(--iv-ink); }
h1, h2, h3, h4, h5, h6 { font-weight: 600; }
b, strong { font-weight: 700; }
code, pre { color: var(--iv-ink2); }
.serif { font-family: var(--iv-serif); }
.ink3, .text-body-secondary { color: var(--iv-ink3) !important; }
.ink4 { color: var(--iv-ink4) !important; }
.text-bad, .text-danger { color: var(--iv-bad-fg) !important; }
.text-ok { color: var(--iv-ok-fg) !important; }
.link { color: var(--iv-link); text-decoration: underline; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.link:hover { color: var(--iv-ink); }
.label {
    font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--iv-ink3);
}
.label-sm { font-size: 12px; }
.mono { font-family: var(--iv-mono); }
[hidden] { display: none !important; }

/* ---------- Top bar */
.topbar {
    height: 54px; border-bottom: 1px solid var(--iv-line); background: var(--iv-app);
    display: flex; align-items: center; gap: 30px; padding: 0 40px; position: relative; z-index: 20;
}
.wordmark { font-family: var(--iv-serif); font-weight: 600; font-size: 21px; color: var(--iv-ink); text-decoration: none; }
.wordmark:hover { color: var(--iv-ink); }
.topnav { display: flex; gap: 24px; font-size: 15px; height: 100%; align-items: stretch; margin: 0; padding: 0; list-style: none; }
.topnav a {
    display: flex; align-items: center; height: 100%; color: var(--iv-ink3); text-decoration: none;
    border-bottom: 2px solid transparent; padding-top: 2px; white-space: nowrap;
}
.topnav a:hover { color: var(--iv-ink); }
.topnav a.active { color: var(--iv-ink); font-weight: 600; border-bottom-color: var(--iv-ink); }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--iv-ink3); white-space: nowrap; }
.topbar-user a { color: var(--iv-ink3); text-decoration: none; }
.topbar-user a:hover { color: var(--iv-ink); text-decoration: underline; }
.theme-toggle {
    height: 30px; min-width: 30px; padding: 0 8px; border: 1px solid var(--iv-line2); border-radius: 6px;
    background: var(--iv-raised); color: var(--iv-ink3); font-size: 13px; display: inline-flex; align-items: center; gap: 6px;
}
.theme-toggle:hover { color: var(--iv-ink); }
.company-btn {
    height: 32px; max-width: 260px; padding: 0 10px; border: 1px solid var(--iv-line2); border-radius: 6px;
    background: var(--iv-raised); color: var(--iv-ink); font-size: 14px; font-weight: 600; display: inline-flex;
    align-items: center; gap: 6px; white-space: nowrap;
}
.company-btn .name { overflow: hidden; text-overflow: ellipsis; }
.company-switch .dropdown-menu { max-height: 70vh; overflow-y: auto; }
.company-switch form { margin: 0; }
.company-switch .dropdown-menu button.btn.dropdown-item {
    width: 100%; display: flex; justify-content: space-between; align-items: baseline; gap: 14px; text-align: left;
    border: 0; border-radius: 0; box-shadow: none; background: transparent; font-weight: 400; min-height: 0;
    padding: 7px 16px; margin: 0; color: var(--iv-ink); transform: none;
}
.company-switch .dropdown-menu button.btn.dropdown-item:hover { background: var(--iv-surface); }
.company-switch .dropdown-menu button.btn.dropdown-item.active { background: var(--iv-inverse-bg); color: var(--iv-inverse-ink); font-weight: 600; }
.company-switch .dropdown-menu button.btn.dropdown-item.active .ink4 { color: inherit; opacity: .7; }
.menu-btn { display: none; margin-left: auto; width: 44px; height: 44px; border: 0; background: none; color: var(--iv-ink); font-size: 20px; }
.page-title-mobile { display: none; }
@media (max-width: 1199.98px) {
    .topbar { padding: 0 16px; gap: 16px; height: 56px; }
    .menu-btn { display: inline-flex; align-items: center; justify-content: center; }
    .topbar .wordmark { font-size: 20px; }
    .topbar-collapse {
        display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--iv-app);
        border-bottom: 1px solid var(--iv-line); padding: 8px 16px 14px; flex-direction: column; gap: 10px;
        box-shadow: 0 12px 24px rgba(0, 0, 0, .08);
    }
    .topbar-collapse.open { display: flex; }
    .topnav { flex-direction: column; gap: 0; height: auto; }
    .topnav a { height: 44px; border-bottom: 0; border-left: 2px solid transparent; padding: 0 10px; }
    .topnav a.active { border-left-color: var(--iv-ink); }
    .topbar-user { margin-left: 10px; }
    .company-btn { max-width: 46vw; }
}
@media (min-width: 1200px) {
    .topbar-collapse { display: contents; }
}

/* ---------- Page */
.page { padding: 20px 40px 32px; max-width: 1600px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.page-narrow { max-width: 1040px; }
.page > * { margin-bottom: 0; }
.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.page-head .crumb { font-size: 14px; color: var(--iv-ink4); }
.page-head .crumb a { color: var(--iv-ink4); }
.page-head .crumb a:hover { color: var(--iv-ink); }
.page-head h1 { font-family: var(--iv-serif); font-size: 30px; font-weight: 600; margin: 0; line-height: 1.15; }
.page-head h1.lg { font-size: 32px; }
.page-head .sub { font-size: 15px; color: var(--iv-ink3); }
.page-head .actions { margin-left: auto; }
.section-title { font-family: var(--iv-serif); font-size: 21px; font-weight: 600; margin: 10px 0 0; }
@media (max-width: 767.98px) {
    .page { padding: 12px 14px 24px; }
    .page-head h1, .page-head h1.lg { font-size: 24px; }
    .page-head .actions { margin-left: 0; }
}

/* ---------- Buttons */
.btn {
    --bs-btn-padding-x: 14px; --bs-btn-padding-y: 0; --bs-btn-font-size: 15px; --bs-btn-font-weight: 400;
    --bs-btn-border-radius: 6px; --bs-btn-line-height: 1.2;
    min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
}
.btn:focus-visible { box-shadow: 0 0 0 2px var(--iv-ink), 0 0 0 5px var(--iv-ring); outline: 0; }
.btn-sm { --bs-btn-padding-x: 12px; --bs-btn-font-size: 14px; min-height: 34px; }
.btn-lg { --bs-btn-font-size: 16px; min-height: 44px; font-weight: 700; }
.btn-primary {
    --bs-btn-color: var(--iv-accent-ink); --bs-btn-bg: var(--iv-accent); --bs-btn-border-color: var(--iv-accent);
    --bs-btn-hover-color: var(--iv-accent-ink); --bs-btn-hover-bg: color-mix(in srgb, var(--iv-accent) 92%, #000);
    --bs-btn-hover-border-color: color-mix(in srgb, var(--iv-accent) 92%, #000);
    --bs-btn-active-color: var(--iv-accent-ink); --bs-btn-active-bg: color-mix(in srgb, var(--iv-accent) 85%, #000);
    --bs-btn-active-border-color: color-mix(in srgb, var(--iv-accent) 85%, #000);
    --bs-btn-disabled-color: var(--iv-accent-ink); --bs-btn-disabled-bg: var(--iv-accent); --bs-btn-disabled-border-color: var(--iv-accent);
    --bs-btn-disabled-opacity: .55;
    --bs-btn-font-weight: 600;
}
/* Secondary: neutral control border on the raised surface. */
.btn-secondary, .btn-outline-secondary, .btn-light, .btn-outline-dark {
    --bs-btn-color: var(--iv-ink); --bs-btn-bg: var(--iv-raised); --bs-btn-border-color: var(--iv-line2);
    --bs-btn-hover-color: var(--iv-ink); --bs-btn-hover-bg: color-mix(in srgb, var(--iv-raised) 92%, var(--iv-ink));
    --bs-btn-hover-border-color: var(--iv-line2);
    --bs-btn-active-color: var(--iv-ink); --bs-btn-active-bg: color-mix(in srgb, var(--iv-raised) 86%, var(--iv-ink));
    --bs-btn-active-border-color: var(--iv-ink);
    --bs-btn-disabled-color: var(--iv-ink4); --bs-btn-disabled-bg: var(--iv-raised); --bs-btn-disabled-border-color: var(--iv-line);
}
/* Outline accent: text actions that deserve a box (NAV lekérdezés). */
.btn-outline-primary {
    --bs-btn-color: var(--iv-link); --bs-btn-bg: transparent; --bs-btn-border-color: var(--iv-link);
    --bs-btn-hover-color: var(--iv-accent-ink); --bs-btn-hover-bg: var(--iv-accent); --bs-btn-hover-border-color: var(--iv-accent);
    --bs-btn-active-color: var(--iv-accent-ink); --bs-btn-active-bg: var(--iv-accent); --bs-btn-active-border-color: var(--iv-accent);
    --bs-btn-font-weight: 600;
}
.btn-danger, .btn-outline-danger {
    --bs-btn-color: var(--iv-bad-fg); --bs-btn-bg: var(--iv-raised); --bs-btn-border-color: var(--iv-bad-solid);
    --bs-btn-hover-color: var(--iv-bad-solid-ink); --bs-btn-hover-bg: var(--iv-bad-solid); --bs-btn-hover-border-color: var(--iv-bad-solid);
    --bs-btn-active-color: var(--iv-bad-solid-ink); --bs-btn-active-bg: var(--iv-bad-solid); --bs-btn-active-border-color: var(--iv-bad-solid);
    --bs-btn-font-weight: 600;
}
.btn-link { --bs-btn-color: var(--iv-link); --bs-btn-hover-color: var(--iv-ink); --bs-btn-padding-x: 0; text-decoration: underline; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions form { display: inline-flex; gap: 8px; margin: 0; }

/* ---------- Forms */
.form-control, .form-select {
    background-color: var(--iv-raised); border-color: var(--iv-line2); border-radius: 6px; color: var(--iv-ink);
    font-size: 15px; min-height: 36px; padding-top: 5px; padding-bottom: 5px;
}
.form-control::placeholder { color: var(--iv-ink4); opacity: 1; }
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: var(--iv-ink); box-shadow: 0 0 0 1px var(--iv-ink), 0 0 0 4px var(--iv-ring); background-color: var(--iv-raised); color: var(--iv-ink);
}
.form-control:disabled, .form-select:disabled { background-color: var(--iv-surface); color: var(--iv-ink4); }
.form-control-sm, .form-select-sm { min-height: 34px; font-size: 14px; }
.form-check-input { background-color: var(--iv-raised); border: 1.5px solid var(--iv-ink4); width: 18px; height: 18px; margin-top: .1em; }
.form-check-input[type=checkbox] { border-radius: 3px; }
.form-check-input:checked { background-color: var(--iv-accent); border-color: var(--iv-accent); }
[data-bs-theme=dark] .form-check-input:checked[type=checkbox] {
    --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fdecea' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}
.form-check { display: flex; gap: 8px; align-items: flex-start; padding-left: 0; }
.form-check .form-check-input { float: none; margin-left: 0; flex: none; }
.input > label, .form-label { margin-bottom: 4px; font-weight: 600; font-size: 14px; color: var(--iv-ink2); }
.input.mb-3 { margin-bottom: 12px !important; }
.form-text { color: var(--iv-ink4); }
.is-invalid { border-color: var(--iv-bad-solid) !important; }
.invalid-feedback { color: var(--iv-bad-fg); }
input[type=color].form-control { width: 3.5rem; padding: 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
@media (max-width: 767.98px) { .grid-2 { grid-template-columns: 1fr; } }

/* Underline inputs (the invoice paper form) */
.uline, .uline.form-control, .uline.form-select {
    border: 0; border-bottom: 1px solid var(--iv-line2); border-radius: 0; background-color: transparent;
    min-height: 34px; padding: 4px 2px; font-size: 14px;
}
.uline.form-select { padding-right: 18px; background-position: right 2px center; background-size: 12px 10px; }
.uline:focus, .uline.form-control:focus, .uline.form-select:focus {
    box-shadow: 0 2px 0 0 var(--iv-ink); border-bottom-color: var(--iv-ink); background-color: transparent;
}

/* Segmented control (radio pair) */
.seg { display: inline-flex; border: 1px solid var(--iv-line2); border-radius: 6px; overflow: hidden; font-size: 15px; width: fit-content; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label, .seg a, .seg button { padding: 7px 16px; cursor: pointer; margin: 0; color: var(--iv-ink); text-decoration: none; background: none; border: 0; }
.seg label + label, .seg a + a, .seg button + button { border-left: 1px solid var(--iv-line2); }
.seg input:checked + label, .seg .on, .seg .active { background: var(--iv-inverse-bg); color: var(--iv-inverse-ink); font-weight: 600; }
.seg input:focus-visible + label { box-shadow: inset 0 0 0 3px var(--iv-ring); }
.seg-sm label, .seg-sm a, .seg-sm button { padding: 6px 12px; font-size: 14px; }

/* ---------- Cards, tables */
.card { --bs-card-border-radius: 8px; --bs-card-border-color: var(--iv-line); --bs-card-bg: var(--iv-raised); --bs-card-cap-bg: var(--iv-surface); }
.box { background: var(--iv-raised); border: 1px solid var(--iv-line); border-radius: 8px; }
.box-pad { padding: 18px; }
.table {
    --bs-table-bg: var(--iv-raised); --bs-table-color: var(--iv-ink); --bs-table-border-color: var(--iv-line-soft);
    --bs-table-hover-bg: var(--iv-surface); --bs-table-hover-color: var(--iv-ink); --bs-table-striped-bg: var(--iv-surface);
    font-size: 15px; margin: 0;
}
.table > thead th {
    background: var(--iv-surface); color: var(--iv-ink3); font-size: 13px; font-weight: 700; border-bottom: 1px solid var(--iv-line);
    white-space: nowrap; padding-top: 8px; padding-bottom: 8px;
}
.table > :not(caption) > * > * { padding: 7px 12px; vertical-align: middle; }
.table form { margin: 0; }
.table > tbody > tr:last-child > * { border-bottom: 0; }
.table-wrap { background: var(--iv-raised); border: 1px solid var(--iv-line); border-radius: 8px; overflow: hidden; }
.table-wrap .table-responsive { margin: 0; }
.table-wrap > .table-foot { padding: 10px 18px; background: var(--iv-surface); border-top: 1px solid var(--iv-line); font-size: 14px; display: flex; gap: 28px; flex-wrap: wrap; align-items: center; }
.num { text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.empty { padding: 28px 18px; text-align: center; color: var(--iv-ink4); }

.pagination {
    --bs-pagination-color: var(--iv-ink); --bs-pagination-bg: var(--iv-raised); --bs-pagination-border-color: var(--iv-line2);
    --bs-pagination-hover-color: var(--iv-ink); --bs-pagination-hover-bg: var(--iv-surface); --bs-pagination-hover-border-color: var(--iv-line2);
    --bs-pagination-active-bg: var(--iv-inverse-bg); --bs-pagination-active-border-color: var(--iv-inverse-bg); --bs-pagination-active-color: var(--iv-inverse-ink);
    --bs-pagination-disabled-bg: var(--iv-surface); --bs-pagination-disabled-color: var(--iv-ink4); --bs-pagination-disabled-border-color: var(--iv-line);
    --bs-pagination-focus-box-shadow: 0 0 0 3px var(--iv-ring); --bs-pagination-border-radius: 6px;
    margin: 0;
}

/* ---------- Status chips and stepper */
.chip {
    display: inline-flex; align-items: center; gap: 2px; padding: 1px 8px; border-radius: 11px; border: 1px solid;
    font-size: 13px; font-weight: 600; line-height: 1.45; white-space: nowrap; vertical-align: middle;
}
.chip-ok, .tone-ok { background: var(--iv-ok-bg); color: var(--iv-ok-fg); border-color: var(--iv-ok-bd); }
.chip-warn, .tone-warn { background: var(--iv-warn-bg); color: var(--iv-warn-fg); border-color: var(--iv-warn-bd); }
.chip-info, .tone-info { background: var(--iv-info-bg); color: var(--iv-info-fg); border-color: var(--iv-info-bd); }
.chip-bad, .tone-bad { background: var(--iv-bad-bg); color: var(--iv-bad-fg); border-color: var(--iv-bad-bd); }
.chip-mute, .tone-mute { background: var(--iv-mute-bg); color: var(--iv-mute-fg); border-color: var(--iv-mute-bd); }
.chip-missing { background: var(--iv-bad-bg); color: var(--iv-bad-fg); border: 1px dashed var(--iv-bad-dash); border-radius: 0; padding: 0 6px; font-weight: 700; }
.stepper { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); height: 26px; font-size: 13px; font-weight: 600; }
.stepper > span { display: flex; align-items: center; padding: 0 8px; border: 1px solid; border-left: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper > span:first-child { border-left: 1px solid; border-radius: 13px 0 0 13px; }
.stepper > span:last-child { border-radius: 0 13px 13px 0; }
.chip-pair { display: flex; gap: 4px; font-size: 12px; font-weight: 600; }
.chip-pair > span { padding: 2px 8px; border: 1px solid; white-space: nowrap; }
.chip-pair > span:first-child { border-radius: 11px 0 0 11px; }
.chip-pair > span:last-child { border-radius: 0 11px 11px 0; }

/* ---------- Invoice list (C1) */
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--iv-line); border-radius: 8px; background: var(--iv-raised); overflow: hidden; }
.summary > a { padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; color: var(--iv-ink3); text-decoration: none; font-size: 14px; }
.summary > a + a { border-left: 1px solid var(--iv-line); }
.summary > a:hover { background: var(--iv-surface); }
.summary > a.on { box-shadow: inset 0 -3px 0 var(--iv-ink); }
.summary .t { font-weight: 700; }
.summary b { font-size: 20px; color: var(--iv-ink); }
.summary .t-bad { color: var(--iv-bad-fg); }
.summary .t-warn { color: var(--iv-warn-fg); }
.summary .t-ok { color: var(--iv-ok-fg); }
.summary > a.alert-cell { background: var(--iv-bad-bg); box-shadow: inset 0 -3px 0 var(--iv-bad-solid); color: var(--iv-bad-sub); }
.summary > a.alert-cell b { color: var(--iv-bad-sub); }
.summary > a.alert-cell.on { box-shadow: inset 0 -3px 0 var(--iv-bad-solid), inset 0 3px 0 var(--iv-bad-solid); }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.filters .form-control, .filters .form-select { min-height: 34px; font-size: 14px; width: auto; }
.filters input[type=search] { width: 320px; }
.filters .legend { margin-left: auto; color: var(--iv-ink3); font-size: 13px; }
.filters select.form-select { max-width: 210px; }
.drawer { background: var(--iv-raised); border: 1px solid var(--iv-line); border-radius: 8px; padding: 14px 16px; }
.drawer form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin: 0; }
.drawer .input { margin: 0 !important; }

.ledger { background: var(--iv-raised); border: 1px solid var(--iv-line); border-radius: 8px; overflow: hidden; }
.ledger .lrow, .ledger .lhead {
    display: grid; grid-template-columns: 148px minmax(0, 1fr) 150px 410px 210px; gap: 14px; align-items: center; padding: 0 18px;
}
.ledger .lhead { height: 34px; font-size: 13px; font-weight: 700; color: var(--iv-ink3); background: var(--iv-surface); border-bottom: 1px solid var(--iv-line); }
.ledger .lhead .steps3 { display: grid; grid-template-columns: repeat(3, 1fr); }
.ledger .lgroup { height: 30px; padding: 0 18px; display: flex; align-items: center; font-size: 13px; font-weight: 700; border-bottom: 1px solid var(--iv-line); }
.ledger .lgroup.bad { color: var(--iv-bad-fg); background: var(--iv-bad-bg); }
.ledger .lgroup.rest { color: var(--iv-ink3); background: var(--iv-surface); }
.ledger .lrow { min-height: 36px; border-bottom: 1px solid var(--iv-line-soft); font-size: 15px; color: var(--iv-ink); text-decoration: none; position: relative; }
.ledger .lrow:hover { background: var(--iv-surface); color: var(--iv-ink); }
.ledger .lrow:focus-visible { outline: 0; box-shadow: inset 0 0 0 3px var(--iv-ring); }
.ledger .no { display: flex; flex-direction: column; line-height: 1.1; padding: 3px 0; }
.ledger .no b { font-weight: 600; }
.ledger .no span, .ledger .who span { font-size: 12px; color: var(--iv-ink4); }
.ledger .who { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ledger .who span { font-size: 13px; }
.ledger .amt { text-align: right; font-weight: 600; white-space: nowrap; }
.ledger .next { font-size: 14px; color: var(--iv-ink4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ledger .next.urgent { color: var(--iv-ink); font-weight: 700; }
.ledger .lfoot { display: flex; gap: 28px; align-items: center; min-height: 42px; padding: 6px 18px; background: var(--iv-surface); font-size: 14px; flex-wrap: wrap; }
@media (max-width: 1399.98px) {
    .ledger .lrow, .ledger .lhead { grid-template-columns: 136px minmax(0, 1fr) 124px 360px 170px; gap: 12px; }
}
.mlist { display: none; }
.mchips { display: none; }
@media (max-width: 1099.98px) {
    .summary, .filters .legend, .ledger .lhead, .ledger .lrow, .ledger .lgroup { display: none; }
    .ledger { border-radius: 0; border-left: 0; border-right: 0; margin: 0 -14px; }
    .mlist { display: block; }
    .mchips { display: flex; gap: 6px; flex-wrap: wrap; }
    .mchips a {
        height: 40px; padding: 0 12px; border-radius: 20px; border: 1px solid var(--iv-line2); background: var(--iv-raised);
        display: inline-flex; align-items: center; font-size: 14px; color: var(--iv-ink); text-decoration: none;
    }
    .mchips a.on { background: var(--iv-bad-bg); border: 1.5px solid var(--iv-bad-solid); color: var(--iv-bad-fg); font-weight: 700; }
    .mchips a.on.plain { background: var(--iv-inverse-bg); border-color: var(--iv-inverse-bg); color: var(--iv-inverse-ink); }
    .filters input[type=search] { width: 100%; min-height: 44px; font-size: 15px; }
    .filters > select[data-autosubmit] { display: none; }
    .page-head h1 { flex: 1; }
}
.mcard { display: flex; flex-direction: column; gap: 5px; padding: 10px 14px; border-bottom: 1px solid var(--iv-line-soft); color: var(--iv-ink); text-decoration: none; }
.mcard:hover { background: var(--iv-surface); color: var(--iv-ink); }
.mcard .top { display: flex; justify-content: space-between; gap: 10px; font-size: 16px; font-weight: 700; }
.mcard .meta { font-size: 14px; color: var(--iv-ink3); }
.mcard .next { font-size: 14px; color: var(--iv-ink4); }
.mcard .next.urgent { color: var(--iv-ink); font-weight: 700; }

/* ---------- Paper (C2, C3) */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 28px; align-items: start; }
.split-360 { grid-template-columns: minmax(0, 1fr) 360px; }
.split-520 { grid-template-columns: minmax(0, 1fr) 520px; }
@media (max-width: 1199.98px) { .split, .split-360, .split-520 { grid-template-columns: minmax(0, 1fr); } }
.paper {
    background: var(--iv-raised); border: 1px solid var(--iv-line); box-shadow: 0 2px 0 var(--iv-line-soft);
    padding: 40px 44px; display: flex; flex-direction: column; gap: 26px; font-size: 15px; position: relative; min-width: 0;
}
.paper-form { padding: 36px 40px; gap: 22px; overflow: hidden; box-shadow: none; }
@media (max-width: 767.98px) { .paper, .paper-form { padding: 20px 16px; } }
.paper .title { font-family: var(--iv-serif); font-size: 24px; font-weight: 600; line-height: 1.2; }
.paper .parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; border-top: 1px solid var(--iv-line); padding-top: 18px; }
.paper .parties > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
@media (max-width: 767.98px) { .paper .parties { grid-template-columns: 1fr; } }
.paper .note { font-size: 14px; color: var(--iv-ink3); }
.watermark {
    position: absolute; top: 220px; left: 0; right: 0; text-align: center; font-family: var(--iv-serif); font-size: 72px; font-weight: 600;
    color: var(--iv-watermark); transform: rotate(-12deg); pointer-events: none; white-space: nowrap; user-select: none;
}
.stamp-paid {
    align-self: center; transform: rotate(-8deg); pointer-events: none; user-select: none;
    border: 3px double var(--iv-ok-fg); color: var(--iv-ok-fg); padding: 4px 14px; text-align: center; text-transform: uppercase;
    font-family: var(--iv-serif); font-size: 22px; font-weight: 700; letter-spacing: .12em; line-height: 1.1; opacity: .85;
}
.stamp-paid span { display: block; font-family: var(--iv-mono); font-size: 12px; font-weight: 400; letter-spacing: .05em; }
.lines { width: 100%; border-collapse: collapse; font-size: 15px; }
.lines th { padding: 8px 5px; font-size: 13px; font-weight: 700; color: var(--iv-ink3); border-bottom: 1.5px solid var(--iv-ink); white-space: nowrap; }
.lines td { padding: 10px 5px; border-bottom: 1px solid var(--iv-line); vertical-align: top; }
.lines th:first-child, .lines td:first-child { padding-left: 0; }
.lines th:last-child, .lines td:last-child { padding-right: 0; }
.lines tr.total td { font-weight: 700; border-bottom: 0; }
.lines tr.huf td { padding: 8px 5px; border-top: 1px solid var(--iv-line); border-bottom: 0; color: var(--iv-ink3); font-size: 14px; }
.lines .sub { font-size: 13px; color: var(--iv-ink3); }
.lines-scroll { overflow-x: auto; }

/* ---------- Timeline (Életút) */
.timeline { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 0 12px; }
.timeline .rail { display: flex; flex-direction: column; align-items: center; }
.timeline .rail::after { content: ''; flex: 1; width: 2px; background: var(--iv-timeline); }
.timeline .rail.dashed::after { background: repeating-linear-gradient(var(--iv-timeline) 0 4px, transparent 4px 8px); }
.timeline .rail.end::after { display: none; }
.timeline .body { padding: 2px 0 18px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; min-width: 0; }
.timeline .body > b:first-child, .timeline .body .h { font-size: 16px; font-weight: 700; }
.timeline .body .meta { color: var(--iv-ink3); }
.dot {
    width: 26px; height: 26px; border-radius: 13px; display: flex; align-items: center; justify-content: center;
    font-size: 14px; flex: none; line-height: 1;
}
.dot-ok { background: var(--iv-ok-solid); color: var(--iv-ok-solid-ink); }
.dot-bad { background: var(--iv-bad-solid); color: var(--iv-bad-solid-ink); }
.dot-overdue { border: 2px solid var(--iv-bad-solid); background: var(--iv-bad-bg); color: var(--iv-bad-fg); font-weight: 700; }
.dot-warn { border: 2px solid var(--iv-warn-bd); background: var(--iv-warn-bg); color: var(--iv-warn-fg); font-weight: 700; }
.dot-info { border: 2px solid var(--iv-info-bd); background: var(--iv-info-bg); color: var(--iv-info-fg); font-weight: 700; }
.dot-future { border: 2px dashed var(--iv-line2); color: var(--iv-ink4); font-size: 13px; }
.dot-current { border: 2px solid var(--iv-ink); color: var(--iv-ink); font-weight: 700; }
.dot-inverse { background: var(--iv-inverse-bg); color: var(--iv-inverse-ink); font-size: 13px; }
.dot-sm { width: 24px; height: 24px; border-radius: 12px; font-size: 13px; }
.errcard {
    background: var(--iv-raised); border: 1.5px solid var(--iv-bad-solid); border-radius: 8px; padding: 14px;
    display: flex; flex-direction: column; gap: 8px; font-size: 14px;
}
.errcard > b:first-child { font-size: 16px; color: var(--iv-bad-fg); }
.errcard .why { line-height: 1.45; }
.errcard .tech { font-family: var(--iv-mono); font-size: 12px; color: var(--iv-ink3); overflow-wrap: anywhere; }
.errcard .todo { line-height: 1.45; color: var(--iv-ink2); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin: 4px 0 0; }
.inline-form .input { margin: 0 !important; }
.inline-form .form-control { min-height: 34px; font-size: 14px; }

/* Plain step list (C3 right panel, draft view) */
.plainsteps { display: flex; flex-direction: column; gap: 10px; font-size: 15px; }
.plainsteps > div { display: flex; gap: 10px; align-items: center; }
.plainsteps .todo { color: var(--iv-ink3); }
.plainsteps .hint { color: var(--iv-ink3); font-size: 14px; }
.optbox { background: var(--iv-raised); border: 1px solid var(--iv-line); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 10px; font-size: 15px; }
.optbox .form-check { margin: 0 !important; }
.confirm { border: 1.5px solid var(--iv-ink); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--iv-raised); }
.confirm p { margin: 0; line-height: 1.45; font-size: 15px; }
.confirm .form-check { font-size: 14px; margin: 0 !important; }
.confirm .form-check-input { border-color: var(--iv-ink); }
.sticky { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 14px; }

/* ---------- Invoice form (C3) */
.lined-grid { display: grid; grid-template-columns: minmax(220px, 1fr) 48px 56px 84px 74px 108px 104px 84px 18px; gap: 8px; align-items: center; }
.lined-head { font-size: 13px; font-weight: 700; color: var(--iv-ink3); padding-bottom: 4px; border-bottom: 1.5px solid var(--iv-ink); }
.line-item { padding: 4px 0; }
.line-item .lnet { text-align: right; font-weight: 600; font-size: 14px; white-space: nowrap; }
.line-item .rm { background: none; border: 0; color: var(--iv-ink4); padding: 0; width: 18px; font-size: 14px; }
.line-item .rm:hover { color: var(--iv-bad-fg); }
.line-item .more { font-size: 16px; line-height: 1; color: var(--iv-ink3); background: none; border: 0; padding: 2px 4px; border-radius: 4px; }
.line-item .more:hover, .line-item .more[aria-expanded=true] { color: var(--iv-ink); background: var(--iv-surface); }
.line-extra { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 6px 0 8px 14px; font-size: 14px; border-left: 2px solid var(--iv-line); margin: 2px 0 6px; }
.line-extra .form-check { margin: 0 !important; }
.line-extra .uline { width: auto; }
@media (max-width: 991.98px) {
    .lined-head { display: none; }
    .lined-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .lined-grid > :first-child { grid-column: 1 / -1; }
}
.totals { width: 300px; display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-size: 15px; }
.totals .grand { border-top: 1.5px solid var(--iv-ink); padding-top: 8px; font-size: 17px; font-weight: 700; }
.totals .grand.amt { font-family: var(--iv-serif); font-size: 24px; font-weight: 600; text-align: right; }
.fieldgrid { display: grid; grid-template-columns: auto 170px; gap: 6px 10px; align-items: center; font-size: 14px; }
.fieldgrid .form-control, .fieldgrid .form-select { min-height: 32px; font-size: 14px; padding-top: 3px; padding-bottom: 3px; background-color: transparent; }
.valid-line { font-size: 13px; color: var(--iv-ok-fg); }
.invalid-line { font-size: 13px; color: var(--iv-bad-fg); }
details.more > summary { list-style: none; cursor: pointer; font-size: 14px; color: var(--iv-ink3); }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: '▸ '; }
details.more[open] > summary::before { content: '▾ '; }
details.more[open] > summary { margin-bottom: 10px; }

/* ---------- Seller setup (C4) */
.progress-bar-iv { width: 320px; max-width: 100%; height: 8px; border-radius: 4px; background: var(--iv-track); overflow: hidden; }
.progress-bar-iv > span { display: block; height: 100%; background: var(--iv-accent); }
.steps { background: var(--iv-raised); border: 1px solid var(--iv-line); border-radius: 8px; overflow: hidden; }
.step { border-bottom: 1px solid var(--iv-line-soft); }
.step:last-child { border-bottom: 0; }
.step-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 18px; }
.step-row .t { display: flex; flex-direction: column; min-width: 0; }
.step-row .t b { font-size: 16px; }
.step-row .t span { font-size: 14px; color: var(--iv-ink3); }
.step-row .act { font-size: 14px; }
.step-row .warn { color: var(--iv-bad-fg); font-weight: 600; font-size: 14px; }
.step .dot { font-size: 16px; }
.step-body { padding: 0 18px 18px 68px; display: flex; flex-direction: column; gap: 14px; }
.step.open { background: var(--iv-app); box-shadow: inset 3px 0 0 var(--iv-ink); }
.step.open .step-row { padding-bottom: 12px; }
@media (max-width: 767.98px) { .step-body { padding-left: 18px; } .step-row { grid-template-columns: 30px minmax(0, 1fr); } .step-row .act { grid-column: 2; } }
.pdf-frame { background: #fff; border: 1px solid #ddd8ce; aspect-ratio: 210 / 297; width: 100%; display: block; color-scheme: light; }

/* ---------- Dropdown */
.dropdown-menu {
    --bs-dropdown-bg: var(--iv-raised); --bs-dropdown-border-color: var(--iv-line); --bs-dropdown-color: var(--iv-ink);
    --bs-dropdown-link-color: var(--iv-ink); --bs-dropdown-link-hover-bg: var(--iv-surface); --bs-dropdown-link-hover-color: var(--iv-ink);
    --bs-dropdown-link-active-bg: var(--iv-inverse-bg); --bs-dropdown-link-active-color: var(--iv-inverse-ink);
    --bs-dropdown-border-radius: 8px; --bs-dropdown-font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}

/* ---------- Flash */
.alert { --bs-alert-border-radius: 8px; border: 1px solid; font-size: 15px; padding: 10px 44px 10px 14px; }
.alert-success { background: var(--iv-ok-bg); color: var(--iv-ok-fg); border-color: var(--iv-ok-bd); }
.alert-info { background: var(--iv-info-bg); color: var(--iv-info-fg); border-color: var(--iv-info-bd); }
.alert-warning { background: var(--iv-warn-bg); color: var(--iv-warn-fg); border-color: var(--iv-warn-bd); }
.alert-danger { background: var(--iv-bad-bg); color: var(--iv-bad-fg); border-color: var(--iv-bad-bd); }
.alert .btn-close { padding: 13px 14px; }
.flash-stack { display: flex; flex-direction: column; gap: 8px; }
.flash-stack:empty { display: none; }
.alert-dismissible { margin: 0; }

/* ---------- Misc */
details > summary { cursor: pointer; }
pre.xml { max-height: 30rem; overflow: auto; font-size: 12px; background: var(--iv-surface); border: 1px solid var(--iv-line); border-radius: 6px; padding: 12px; color: var(--iv-ink2); }
.nav-tabs { --bs-nav-tabs-border-color: var(--iv-line); --bs-nav-tabs-link-active-bg: var(--iv-raised); --bs-nav-tabs-link-active-color: var(--iv-ink); --bs-nav-tabs-link-active-border-color: var(--iv-line) var(--iv-line) var(--iv-raised); --bs-nav-link-color: var(--iv-ink3); --bs-nav-link-hover-color: var(--iv-ink); }
.nav-tabs .nav-link.active { font-weight: 600; }
.tab-box { background: var(--iv-raised); border: 1px solid var(--iv-line); border-top: 0; border-radius: 0 0 8px 8px; padding: 14px; }
.modal { --bs-modal-bg: var(--iv-raised); --bs-modal-border-color: var(--iv-line); --bs-modal-border-radius: 8px; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; background: var(--iv-raised); border: 1px solid var(--iv-line); border-radius: 8px; padding: 32px; display: flex; flex-direction: column; gap: 18px; }
.login-card .wordmark { font-size: 30px; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; font-size: 14px; margin: 0; }
.kv dt { font-weight: 400; color: var(--iv-ink3); }
.kv dd { margin: 0; }
/* Demo instance (App\Demo): banner on every page, one-click entry on the login page. */
.demo-banner { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 8px 24px; font-size: 13px; line-height: 1.4; background: var(--iv-warn-bg); color: var(--iv-warn-fg); border-bottom: 1px solid var(--iv-warn-bd); }
.demo-banner strong { text-transform: uppercase; letter-spacing: .06em; }
.demo-banner span { flex: 1 1 320px; }
.demo-banner a { color: inherit; font-weight: 600; white-space: nowrap; }
@media (max-width: 575.98px) { .demo-banner { padding: 8px 16px; } }
.demo-login { display: flex; flex-direction: column; gap: 10px; padding-bottom: 18px; border-bottom: 1px solid var(--iv-line); font-size: 14px; }
