/* ==========================================================================
   Onix SplitView — the surface of Components/Shared/SplitView.razor and of
   the document pane it holds beside a form (the invoice editor: the original
   of a digitized bill, or the invoice as it will be printed).

     .onix-split            the two panes and the divider between them
     .onix-split-first      the document: stays in view while the form scrolls
     .onix-split-divider    dragged to size the panes (js/onix-splitview.js)
     .onix-split-second     the form
     .doc-pane              the document pane's own parts

   --split is the first pane's share of the width. The page scrolls as a whole
   (the form with it); the document pane parks under the chrome that stays in
   view — the floating top bar (--topbar-h) and the page's breadcrumb bar with
   the record's commands (--trail-h, published by js/onix-trail.js) — and fills
   the window down to its foot, so what the person reads scrolls inside the
   pane alone (overscroll-behavior: the wheel never spills onto the page).
   At 1100px and below the panes stack: the divider goes, the document pane
   stops parking, and each pane takes the whole width — what is wider than
   the form (the lines' table) scrolls in its own box (.edg-scroll), never
   the page.
   Every colour is a token.
   ========================================================================== */

.onix-split {
    --split-gap: 12px;
    /* Where the sticky panes park: a one-row breadcrumb bar (36px) until the script has measured it. */
    --split-top: calc(var(--topbar-h, 64px) + var(--trail-h, 36px) + 6px);
    --split-bottom: 12px;
    display: grid;
    grid-template-columns: minmax(300px, calc(var(--split, 44%) - var(--split-gap) / 2)) var(--split-gap) minmax(0, 1fr);
    align-items: start;
    min-width: 0;
}
.onix-split.is-single { display: block; }
.onix-split-pane { min-width: 0; }
.onix-split-second > .form-card { max-width: none; }

.onix-split-first,
.onix-split-divider {
    position: sticky;
    top: var(--split-top);
    height: calc(100dvh - var(--split-top) - var(--split-bottom));
    min-height: 360px;
}
.onix-split-first { display: flex; flex-direction: column; }
.onix-split-first > * { flex: 1 1 auto; min-height: 0; }

.onix-split-divider {
    display: grid;
    place-items: center;
    cursor: col-resize;
    touch-action: none;
    outline: none;
}
.onix-split-divider::after {
    content: "";
    width: 4px;
    height: 56px;
    border-radius: 2px;
    background: var(--line-strong);
    transition: background var(--dur) var(--ease), height var(--dur) var(--ease);
}
.onix-split-divider:hover::after,
.onix-split-divider:focus-visible::after,
.onix-split.is-resizing > .onix-split-divider::after { background: var(--brand); height: 88px; }
.onix-split.is-resizing { cursor: col-resize; user-select: none; }
/* A frame under the pointer would swallow the drag. */
.onix-split.is-resizing iframe { pointer-events: none; }

/* ─── The document pane ────────────────────────────────────────────────── */

/* In a split the pane fills the first pane; on its own it keeps the height of onix-glass.css. */
.onix-split-first > .invoice-source { position: static; height: auto; min-height: 0; padding: 10px; }
/* The pages scroll inside the pane: at their end the wheel stops, it does not take the page along.
   (A print preview in a frame says the same inside its document — InvoicePrintPreview.Framed.) */
.onix-split-first .invoice-source__view { overscroll-behavior: contain; }

.doc-pane__switch.onix-segmented { flex: none; }
.doc-pane__status { color: var(--muted); font-size: 0.8rem; }
.doc-pane__frame { background: #FFFFFF; }
.doc-pane__empty {
    display: grid;
    place-items: center;
    padding: 24px;
    text-align: center;
    color: var(--muted);
}
.doc-pane__empty p { margin: 0; max-width: 34ch; }

/* ─── The document's tools: one floating bar over the preview (IDE-002) ── */

/* The accountant's Variant C: [Original | Print view] · − 100% + · ◀ 1 / 2 ▶ · ⋯ — a compact glass bar centred
   over the top of the document, which stays in view while the pages scroll beneath it (SourceDocumentPane; the
   print preview beside it draws the same bar). The stage holds the bar and the view; a view under a bar keeps
   its first page, or its frame, clear of it (--docpane-bar-room). A pane too narrow for one row puts the bar
   above the document instead, wrapped. Pages stay white in both themes, so the bar takes the chrome's fill —
   opaque enough to read over a white page in the dark theme. */
.docpane-stage {
    --docpane-bar-room: 56px;
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    container: docpane / inline-size;
}
.docpane-stage > .invoice-source__view { flex: 1 1 auto; }
.docpane-bar {
    position: absolute;
    top: 8px;
    left: 50%;
    z-index: 3;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 2px;
    max-width: calc(100% - 16px);
    box-sizing: border-box;
    padding: 4px;
    border: 1px solid var(--glass-border-chrome);
    border-radius: 14px;
    background: var(--glass-fill-chrome);
    -webkit-backdrop-filter: blur(var(--glass-blur, 28px)) saturate(160%);
    backdrop-filter: blur(var(--glass-blur, 28px)) saturate(160%);
    box-shadow: var(--glass-shadow), var(--glass-highlight);
    color: var(--ink);
    white-space: nowrap;
}
/* The parts, one after another, a hairline between them. */
.docpane-bar > .doc-tools__group + *,
.docpane-bar > .onix-segmented + *,
.docpane-bar > .doc-pane__status + * { margin-left: 4px; padding-left: 4px; border-left: 1px solid var(--line); }
.docpane-bar .onix-segmented { flex: none; padding: 2px; border-radius: 10px; }
.docpane-bar .onix-segmented button { padding: 4px 11px; border-radius: 8px; font-size: 12.5px; }
.docpane-bar .onix-segmented button.is-active { background: var(--brand-soft); color: var(--brand-strong); }
.docpane-bar .doc-pane__status { padding: 0 6px; }
/* The ⋯ menu's button is one of the bar's tools, not a framed button. */
.docpane-bar .row-menu-button.doc-tool { border: 0; border-radius: var(--radius-xs); background: none; box-shadow: none; padding: 0 6px; }
.docpane-bar .row-menu-button.doc-tool:hover:not(:disabled),
.docpane-bar .row-menu-button.doc-tool[aria-expanded="true"] { background: var(--panel-hover); color: var(--brand-strong); }
.row-menu-panel .docpane-menu__item svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.row-menu-panel .docpane-menu__item:hover svg { color: inherit; }
/* The first page starts under the bar, the rest scroll beneath it; a page sent to stops clear of it. */
.docpane-stage > .docpane-bar ~ .invoice-source__view.doc-pages {
    padding-top: var(--docpane-bar-room);
    scroll-padding-top: var(--docpane-bar-room);
}
.docpane-stage > .docpane-bar ~ .invoice-source__view.doc-pages:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--ring); }
/* A frame (the browser's PDF viewer, the print preview) or a note cannot run under it: it starts below. */
.docpane-stage > .docpane-bar ~ iframe.invoice-source__view,
.docpane-stage > .docpane-bar ~ .doc-pane__empty,
.docpane-stage > .docpane-bar ~ .docpane-stage__note { margin-top: calc(var(--docpane-bar-room) - 8px); }
.docpane-stage__note { margin: 0; }
@container docpane (max-width: 460px) {
    .docpane-bar {
        position: static;
        transform: none;
        align-self: center;
        flex-wrap: wrap;
        justify-content: center;
        row-gap: 4px;
        max-width: 100%;
        margin: 0 0 8px;
    }
    .docpane-stage > .docpane-bar ~ .invoice-source__view.doc-pages { padding-top: 8px; scroll-padding-top: 8px; }
    .docpane-stage > .docpane-bar ~ iframe.invoice-source__view,
    .docpane-stage > .docpane-bar ~ .doc-pane__empty,
    .docpane-stage > .docpane-bar ~ .docpane-stage__note { margin-top: 0; }
}

.doc-tools__group { display: inline-flex; align-items: center; gap: 2px; }
.doc-tool, .doc-tools__value {
    display: inline-grid;
    place-items: center;
    min-width: 30px;
    height: 30px;
    padding: 0 6px;
    border: 0;
    border-radius: var(--radius-xs);
    background: none;
    color: var(--ink-soft);
    font: inherit;
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.doc-tool svg { width: 18px; height: 18px; }
.doc-tool:hover:not(:disabled), .doc-tools__value:hover:not(:disabled) { background: var(--panel-hover); color: var(--brand-strong); text-decoration: none; }
.doc-tool:disabled, .doc-tools__value:disabled { opacity: 0.35; cursor: default; }
.doc-tool:focus-visible, .doc-tools__value:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.doc-tools__value { color: var(--ink); font-weight: 550; }
.doc-tools__value[disabled] { opacity: 1; cursor: default; }
.doc-tools__sep { width: 1px; height: 18px; background: var(--line); }

/* The pages: one box per page, sized by the zoom (a share of the scroll box), turned with the rotation. */
.doc-pages { --zoom: 100%; align-items: center; }
.doc-page {
    position: relative;
    flex: none;
    width: var(--zoom);
    max-width: none;
    background: #FFFFFF;
    box-shadow: var(--shadow-xs);
}
.doc-page img { display: block; width: 100%; height: auto; box-shadow: none; }
.invoice-source__image.doc-pages { flex-direction: column; justify-content: flex-start; gap: 8px; padding: 8px; }
.invoice-source__image.doc-pages img { max-width: none; }
.doc-pages.is-rotated-180 .doc-page img { transform: rotate(180deg); }
/* On its side the page's box takes the page's proportions (--page-w / --page-h, measured by
   js/onix-docpane.js; A4 until then) and the picture turns inside it. */
.doc-pages.is-rotated-90 .doc-page, .doc-pages.is-rotated-270 .doc-page {
    aspect-ratio: var(--page-h, 1414) / var(--page-w, 1000);
    container-type: inline-size;
    overflow: hidden;
}
.doc-pages.is-rotated-90 .doc-page img, .doc-pages.is-rotated-270 .doc-page img {
    position: absolute;
    left: 50%;
    top: 50%;
    width: auto;
    height: 100cqw;
    transform: translate(-50%, -50%) rotate(90deg);
}
.doc-pages.is-rotated-270 .doc-page img { transform: translate(-50%, -50%) rotate(270deg); }

/* ─── The editor's own head: the title and the documents chip ──────────── */

/* The page's bar says what is open (the crumb, the number, the state): the form's own title is not drawn again —
   the form starts with its notices and its fields. It stays in the markup for what reads the page. */
.editor-head { display: none; }
.editor-head h3 { margin: 0; margin-right: auto; font-size: 0.95rem; }
/* "Fill from previous bill / PO…" of a vendor draft: one slim line over the form, its explanation the button's tooltip. */
.form-card > .toolbar.editor-autocomplete { margin: 0 0 6px; padding: 0; border: 0; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
/* REV-013: a customer document is called by its ЗДДС number; its journal number (INV/…) beside it, as the internal one. */
.editor-head__internal { margin-left: 8px; color: var(--muted); font-size: 0.8rem; font-weight: 500; white-space: nowrap; }

/* ─── The editor's commands, in the page's breadcrumb bar (Breadcrumbs Tools, css/onix-trail.css) ── */

/* Through the list without leaving the form: the previous / next document with the position, at the bar's far
   right end (css/onix-trail.css, .page-trail-pager); "Confirm and open next" stays with the commands. */
.editor-nav { display: inline-flex; align-items: center; gap: 4px; }
.editor-nav .button.icon { padding: 3px 5px; }
/* The form's tools: the fields it shows, every fold at once, the document beside it. */
.editor-tools { display: inline-flex; align-items: center; gap: 4px; }
/* REV-006: Save, Pay…, Print ▾, Actions ▾ and the confirmation; then the Reconciliation and Documents chips. */
.editor-commands,
.editor-chips { display: inline-flex; align-items: center; gap: 4px; }
.editor-chips .onix-chip { white-space: nowrap; }
.editor-chips button.onix-chip { cursor: pointer; border: 0; font: inherit; }

/* IDE-001 (the accountant's Variant C): the bar reads, left to right, the state steps right after the title, the
   Onix AI and the notices badges, the chips, the form's tools (icons alone), then print · ⋯ · Save and, at the far
   right end, the pager. The steps sit at the start of the tools and push the rest to the right. */
.page-trail-actions:has(> .editor-steps) { flex: 1 1 auto; min-width: 0; }
.editor-steps { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; }
.page-trail-tools .editor-tools .button-label { display: none; }
.editor-badges { display: inline-flex; align-items: center; gap: 6px; }
.editor-badge { position: relative; display: inline-flex; }
.page-trail-tools .button.small.editor-badge__button,
.button.small.editor-badge__button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px 3px 7px;
    border-radius: 9px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}
.editor-badge__icon { display: inline-grid; place-items: center; width: 14px; height: 14px; font-size: 0.8rem; line-height: 1; }
.editor-badge__icon svg { width: 14px; height: 14px; }
.editor-badge__caret { display: inline-grid; place-items: center; width: 12px; height: 12px; opacity: 0.7; }
.editor-badge__caret svg { width: 12px; height: 12px; transform: rotate(90deg); transition: transform var(--dur) var(--ease); }
.editor-badge__button[aria-expanded="true"] .editor-badge__caret svg { transform: rotate(-90deg); }
/* Onix AI in the app's blue; the notices amber, red while an error is among them. */
.editor-badge__button.is-ai { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); color: var(--brand-strong); }
.editor-badge__button.is-ai:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-soft); }
.editor-badge__button.is-warning,
.editor-badge__button.is-note { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); color: var(--warn); }
.editor-badge__button.is-warning:hover:not(:disabled),
.editor-badge__button.is-note:hover:not(:disabled) { border-color: var(--warn); background: var(--warn-soft); }
.editor-badge__button.is-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); color: var(--danger-strong); }
.editor-badge__button.is-error:hover:not(:disabled) { border-color: var(--danger); background: var(--danger-soft); }
/* The badge's panel: a popover under its button (js/onix-formlayout.js places it), the AI extraction or the
   notices list whole, scrolling when long. */
.editor-badge-panel {
    display: none;
    box-sizing: border-box;
    width: min(620px, calc(100vw - 16px));
    max-height: min(72vh, calc(100dvh - 16px));
    overflow-y: auto;
    margin: 0;
    inset: auto;
    padding: 10px 12px;
    background: var(--glass-pop, var(--panel));
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    color: var(--ink);
    font-size: 0.88rem;
    text-align: left;
    scrollbar-width: thin;
}
.editor-badge-panel:popover-open { display: flex; flex-direction: column; gap: 8px; animation: pop-in 0.12s var(--ease); }
.editor-badge-panel.extraction-panel { margin-bottom: 0; }
.editor-badge-panel .editor-notices__list { padding: 0; }
.editor-badge-panel__title { margin: 0; font-family: var(--font-display); font-size: 0.9rem; font-weight: 650; }

/* ─── The form's top row: Return to draft · Validate (IDE-001) ─────────── */

/* Above the fields, right-aligned: back to draft (outline, the red arrow) and the confirmation — Post for a
   draft, Reviewed for a posted digitized document — as "Confirm and open next" does it, without opening the next. */
.editor-decision { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
/* IDE-001 (Variant C): from Return to draft / Validate straight into the header's rows — the Document fold draws its
   head (▾ Document over a hairline) only while folded, where its summary says what it holds and a click unfolds it.
   The folds of Other information keep their heads. */
.invoice-form .form-section[data-section="document"]:not(.is-collapsed) > .form-section__head { display: none; }
.editor-decision .button svg { width: 15px; height: 15px; vertical-align: -3px; }
.editor-decision .button svg + .button-label { margin-left: 5px; }
.editor-decision__draft { color: var(--danger-strong); }
.editor-decision__draft:disabled { color: var(--muted-2); }
.editor-decision__stop { color: var(--danger-strong); }
.editor-decision__stop:disabled { color: var(--muted-2); }

/* ─── ATP-014: the Recurring block of a recurring template, above the header ─────────── */

/* The plan the template issues by — every n months, first issue date, until, post automatically — on one card at the top
   of the form; its head names the template and where it stands (issued n · next …); the issued invoices as chips under
   the fields. Theme tokens only: the card reads the same in light and dark mode. */
.recurring-block { margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius, 8px); background: var(--surface-2, var(--surface)); }
.recurring-block__head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; margin-bottom: 8px; }
.recurring-block__state { font-size: 0.85rem; }
.recurring-block__fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 14px; margin: 0; padding: 0; border: 0; min-width: 0; }
.recurring-block__fields > label { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.recurring-block__fields > label > span:first-child { font-size: 0.8rem; color: var(--muted); }
.recurring-block__every { display: flex; align-items: center; gap: 6px; }
.recurring-block__every input { width: 6ch; }
.recurring-block__auto { flex-direction: row !important; align-items: center; flex-wrap: wrap; gap: 6px !important; align-self: end; }
.recurring-block__auto > span:first-child { font-size: inherit; color: inherit; }
.recurring-block__issued { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* The header column's companions (css/onix-form.css .form-column): the VAT number beside the ЕИК, the numerator, the
   period (red with its date while the two differ), the currency. */
.invoice-header .form-column__side.invoice-vat-field input { max-width: none; }
.invoice-header .form-column__side--contents.is-period-mismatch > label select { color: var(--danger-strong); border-color: var(--danger); }

/* ─── Notices: what the editor says about the document, under its head ─── */

/* One panel for every notice (InvoiceNotices.razor): the digitization's notes, a duplicate, an
   abnormal amount, a locked period. Folded, the head keeps the counts and the first line. */
.editor-notices {
    margin: 0 0 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
}
.editor-notices.has-warning { border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.editor-notices.has-error { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.editor-notices__head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; padding: 1px 10px 1px 2px; }
.editor-notices__toggle {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 3px 6px;
    border: 0;
    border-radius: var(--radius-xs);
    background: none;
    color: var(--ink);
    font: inherit;
    font-size: 0.84rem;
    cursor: pointer;
}
.editor-notices__toggle:hover { color: var(--brand-strong); }
.editor-notices__toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.editor-notices__chevron { display: inline-grid; place-items: center; width: 18px; height: 18px; color: var(--muted); }
.editor-notices__chevron svg { width: 16px; height: 16px; transform: rotate(90deg); transition: transform var(--dur) var(--ease); }
.editor-notices.is-collapsed .editor-notices__chevron svg { transform: rotate(0deg); }
.editor-notices__peek {
    flex: 1 1 200px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    font-size: 0.84rem;
}
.editor-notices__list { display: flex; flex-direction: column; gap: 4px; padding: 0 6px 6px; }
.editor-notices__list .alert { margin: 0; }
.editor-notice__actions { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-left: 8px; vertical-align: middle; }

/* ─── The header and what is under it (REV-007, Invoices.Header.cs) ─────── */

/* The main fields in two aligned columns (.form-pairs, css/onix-form.css). The document type: the НАП code
   and, beside it, the document's kind — a select on a new document of the bare list, else what it is. */
.invoice-document-type__controls { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.invoice-document-type__controls > select { flex: 1 1 150px; min-width: 0; }
.invoice-document-type__kind { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
/* The rate of a foreign currency: a row of its own, the figure as wide as a rate needs. */
.invoice-rate input { max-width: 18ch; }
/* REV-013 — a customer document's Document number, its 10-digit ЗДДС number: the proposal reads grey until a number is
   typed, and the line under it says what the number is (proposed, kept from posting, printed) or what is wrong with it
   (ten digits, carried by another document, another draft asking for it, a gap). */
.invoice-document-number input { max-width: 16ch; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.invoice-document-number input.is-proposed { color: var(--muted); }
.invoice-document-number small.is-muted { color: var(--muted); }
.invoice-document-number small.is-warn { color: var(--warn); }
.invoice-document-number small.is-bad { color: var(--danger); }
/* The number a draft posted before keeps, before its state bar. */
.editor-kept-number { white-space: nowrap; }
/* Other information: every other field in its groups, hidden while another tab shows. */
.invoice-other[hidden] { display: none; }
.invoice-other > .form-section:first-child { margin-top: 2px; }
.invoice-partner-hints:empty { display: none; }
/* The terms under the lines, on every tab; the fiscal position's legal note beside them. */
.invoice-notes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px 12px; margin: 8px 0 2px; }
.invoice-notes.has-legal-note { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
.invoice-notes textarea { min-height: 48px; resize: vertical; }
.invoice-notes__legal {
    margin-top: 18px;
    padding: 6px 10px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    white-space: pre-line;
}
@media (max-width: 700px) {
    .invoice-notes.has-legal-note { grid-template-columns: minmax(0, 1fr); }
    .invoice-notes__legal { margin-top: 0; }
}

/* The partner's data under the partner field: country, VAT, ЕИК, its own fiscal position. */
.partner-panel { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 6px 10px; border-radius: 10px; }
.partner-panel > label { display: flex; align-items: center; gap: 6px; }
.partner-panel > label > span { margin: 0; }
.partner-panel__name input { min-width: 16em; }
/* REV-008: a number field with its register button beside it (EIK / VAT No.) — a span the form card's caption rule
   (.form-card label span, app.css) would stack as a block: named with its card and label, so it stays a row. */
.field-with-action, .form-card label span.field-with-action { display: flex; align-items: center; gap: 4px; margin: 0; font-size: inherit; font-weight: inherit; }
.field-with-action > input { flex: 1 1 auto; min-width: 0; }
/* The button alone, or the main half of a split button (IDE-016, RegisterFillButton) — the glyph has no size of its own. */
.field-with-action > .button.icon,
.field-with-action > .register-fill > .button.icon { flex: none; padding: 5px 6px; }
.field-with-action > .button.icon svg,
.field-with-action > .register-fill > .button.icon svg { width: 15px; height: 15px; }
/* What the register would change on the partner, waiting for the person's confirmation. */
.registry-changes { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border-radius: 10px; }
.registry-changes ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.registry-changes__field { display: inline-block; min-width: 9em; font-weight: 600; }
.registry-changes__actions { display: flex; gap: 8px; }

/* The form of a document that is not a draft (Invoices.razor, IsLocked): the fieldset disables
   its fields; they stay as readable as the values they show. */
.form-lock { border: 0; margin: 0; padding: 0; min-width: 0; }
.form-lock:disabled input, .form-lock:disabled select, .form-lock:disabled textarea {
    opacity: 1;
    color: var(--ink);
    -webkit-text-fill-color: var(--ink);
    cursor: default;
}
/* A hint of what to type has no place in a field that only shows. */
.form-lock:disabled ::placeholder { color: transparent; -webkit-text-fill-color: transparent; }
/* REV-015 — a posted document keeps its texts editable (Invoices.PostedTexts.cs): the fields locked around them read as
   values on the card, without a field's fill and behind a lighter border, so what can still be changed stands out. */
.has-posted-texts .form-lock:disabled :is(input, select, textarea) { background: transparent; border-color: var(--line); }
.editor-locked { margin: -4px 0 8px; font-size: 0.82rem; }

/* Totals under the lines (InvoiceTotals.razor): the figures of the document as a printed invoice prints them — every
   line one grid of label · the cents a VAT moved · the figure · the currency · ▲▼, each part placed by its class, so a
   line without a chip or a stepper keeps its figure in the figures' column, right-aligned, digits under digits. */
.editor-totals { margin: 0 0 0 auto; width: min(100%, 420px); padding: 6px 12px 8px; border-radius: 12px; }
.editor-totals.is-stale { opacity: 0.6; }
.editor-totals__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content minmax(7em, max-content) 2.8em 24px;
    align-items: center;
    column-gap: 8px;
    min-height: 24px;
    padding: 1px 0;
    font-size: 0.88rem;
    font-variant-numeric: tabular-nums;
}
.editor-totals__row + .editor-totals__row { border-top: 1px solid var(--hairline); }
.editor-totals__label { grid-column: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); }
.editor-totals__adjusted { grid-column: 2; justify-self: end; }
.editor-totals__amount { grid-column: 3; text-align: right; white-space: nowrap; color: var(--ink); }
.editor-totals__ccy { grid-column: 4; color: var(--muted); font-size: 0.78rem; white-space: nowrap; }
.editor-totals__nudge { grid-column: 5; }
.editor-totals__total { font-weight: 600; }
.editor-totals__total .editor-totals__label { color: var(--ink); }
.editor-totals__total .editor-totals__amount { font-size: 0.98rem; }
.editor-totals__row + .editor-totals__total { border-top: 1px solid var(--line-strong); margin-top: 2px; padding-top: 3px; }
.editor-totals__note .editor-totals__label { grid-column: 1 / -1; white-space: normal; font-size: 0.78rem; line-height: 1.3; padding: 3px 0; }
.editor-totals__rate { margin-left: 6px; color: var(--muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.editor-totals__row.is-bad .editor-totals__label,
.editor-totals__row.is-bad .editor-totals__amount { color: var(--danger-strong); }
.editor-totals__match .editor-totals__label { color: var(--good); font-size: 0.8rem; }
.editor-totals__match .editor-totals__amount { display: inline-flex; justify-content: flex-end; }
/* The issuer's rounding: ▲▼ beside a VAT and the total, the cents a VAT moved in a chip before the figure. */
.editor-totals__nudge {
    display: inline-flex;
    flex-direction: column;
    flex: none;
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
}
.editor-totals__step {
    display: grid;
    place-items: center;
    width: 22px;
    height: 13px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
}
.editor-totals__step + .editor-totals__step { border-top: 1px solid var(--line); }
.editor-totals__step:hover:not(:disabled) { background: var(--panel-hover); color: var(--ink); }
.editor-totals__step:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.editor-totals__step:disabled { opacity: 0.35; cursor: default; }
.editor-totals__step svg {
    width: 9px;
    height: 6px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.editor-totals__adjusted { font-variant-numeric: tabular-nums; background: var(--info-soft); color: var(--info); }
@media (pointer: coarse) {
    .editor-totals__step { width: 30px; height: 20px; }
}
/* REV-032: the partner's outstanding credits / debits under the totals, each with Add (InvoiceOutstanding). */
.editor-outstanding { margin: 8px 0 0 auto; max-width: 640px; padding: 8px 12px; border-radius: 12px; }
.editor-outstanding__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-bottom: 8px;
}
.editor-outstanding__due { font-size: 0.84rem; color: var(--muted); }
.editor-outstanding__due strong { color: var(--ink); font-variant-numeric: tabular-nums; }
/* Installments under the terms: the heading, the preview button and its note on one line. */
.editor-installments { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin: 6px 0 4px; }
.editor-installments h3 { margin: 0; font-size: 0.86rem; }
.editor-installments .muted { font-size: 0.8rem; }
.editor-tabs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin: 6px 0 6px; }
.editor-tabs .muted { font-size: 0.78rem; }
/* The tabs as a slim segmented control: a line of text, not a row of pills. */
.editor-tabs .onix-segmented { padding: 2px; }
.editor-tabs .onix-segmented button { padding: 3px 11px; font-size: 12.5px; }

/* ─── Accounting entries tab: the operation as the accountant reads it (IDE-003, InvoiceOperationsGrid) ─── */

/* Дт / Кт before the account: the side the row books on, quiet beside the figures. */
.invoice-operations .op-side {
    display: inline-block;
    min-width: 1.9em;
    margin-right: 4px;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 600;
}
.invoice-operations .op-rate { margin-left: 6px; color: var(--muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.invoice-operations .op-tax { margin-left: 6px; }
.invoice-operations .op-note { margin-left: 4px; color: var(--muted-2); cursor: help; }
.invoice-operations .op-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A VAT rate no journal item books (0 %): shown for the ledgers' sake, read as a note. */
.invoice-operations .dxg-table tbody tr.op-zero-vat > td { color: var(--muted); }
/* Edit · Duplicate · Remove of a product row — the grid's own row tools (.edg-icon), side by side. */
.invoice-operations .dxg-table th.op-tools-cell,
.invoice-operations .dxg-table tbody tr.edg-row > td.op-tools-cell { padding: 0 4px; text-align: center; white-space: nowrap; text-overflow: clip; }
.invoice-operations .op-tools { display: inline-flex; gap: 2px; }
/* The invoice value the lines do not add up to, under the counterpart. */
.invoice-operations .dxg-table tfoot tr.op-mismatch > td {
    height: auto;
    padding: 6px 8px;
    background: var(--danger-soft);
    color: var(--danger-strong);
    font-weight: 600;
    white-space: normal;
}
.invoice-operations .op-mismatch .button { margin-left: 10px; font-weight: 500; }
@media print { .invoice-operations .op-tools, .invoice-operations .op-mismatch .button { display: none; } }

/* ─── Narrow windows: the panes stack ──────────────────────────────────── */

@media (max-width: 1100px) {
    /* Each pane as wide as the column: the grid's align-items: start would size them by their content,
       and the form would take the width of its lines' table (the page then scrolls sideways). */
    .onix-split { display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
    .onix-split.is-single { display: block; }
    .onix-split-divider { display: none; }
    .onix-split-first { position: static; height: 70dvh; min-height: 360px; }
    /* The original is what the form is filled from: it stays on top. A print preview is what
       the form comes to: on a narrow window it follows the form. */
    .onix-split-first:has(> .doc-pane) { order: 2; }
}

@media print {
    .onix-split { display: block; }
    .onix-split-first, .onix-split-divider, .editor-notices__chevron { display: none; }
}
