/* ==========================================================================================================
   INVOICES-1669 (lane/1669-rd-invoices, owner 2026-11-04 / 2026-11-09): the new-look Invoices pages
   (js/modules/invoices-redesign.js). Namespaced .ix-*; uses the ChiroApp "cx" tokens from css/index.css. Nothing here
   applies unless the module draws #ixRoot (new look on) or marks body.ix-form-on (a classic invoice form / payment / send
   page under the new look: restyled only, same markup and handlers). --ix-ready tells the module this stylesheet is
   loaded (a missing / stale one keeps classic). No pills / chips: status and flags are plain coloured words. No emoji.
   Same app on phone, tablet and desktop: the detail panel is a right column at 1200px and wider, the SAME content in a
   bottom sheet below.
   ========================================================================================================== */
:root {
    --ix-ready: 1;
    --ix-head: 'Poppins', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --ix-hero: #2f5a37;
    --ix-hero-2: #3a6b43;
    --ix-line: var(--cx-border, #dfe5e1);
    --ix-soft: #eef4ef;
    --ix-bad: #b91c1c;
    --ix-warn: #b45309;
    --ix-done: #15803d;
    --ix-part: #1d4ed8;
    --ix-wait: #6d28d9;
    --ix-ink: var(--cx-text, #0f172a);
}
[data-theme="dark"] { --ix-soft: #1b2a1e; --ix-hero: #23402a; --ix-hero-2: #2b4f33; --ix-bad: #fca5a5; --ix-warn: #fcd34d; --ix-done: #86efac; --ix-part: #93c5fd; --ix-wait: #c4b5fd; }

#page-invoices > .ix-classic-hidden { display: none !important; }

.ix { color: var(--cx-text); display: flex; flex-direction: column; gap: 14px; padding-bottom: 28px; min-width: 0; }
.ix *, .ix-sheet * { box-sizing: border-box; }
.ix-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ix-muted { color: var(--cx-text-2); }
.ix-strong { font-weight: 700; }
.ix-money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ix-tone-bad { color: var(--ix-bad); }
.ix-tone-warn { color: var(--ix-warn); }
.ix-tone-done { color: var(--ix-done); }
.ix-tone-part { color: var(--ix-part); }
.ix-tone-wait { color: var(--ix-wait); }
.ix-tone-ink { color: var(--ix-ink); }
.ix-tone-neutral { color: var(--cx-text-2); }
.ix-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--cx-text-2); margin: 0 0 6px; }

.ix-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 6px 4px; margin: 0 0 -6px -4px;
    color: var(--cx-brand-ink); font: inherit; font-weight: 600; font-size: 0.95rem; cursor: pointer; min-height: 40px; }
.ix-back:hover { text-decoration: underline; }
.ix-link { background: none; border: 0; padding: 0 2px; font: inherit; font-weight: 600; color: var(--cx-brand-ink); cursor: pointer; text-decoration: underline; }
.ix-strong-link { color: inherit; font-weight: 700; text-decoration: none; border-bottom: 1px solid color-mix(in srgb, currentColor 35%, transparent); }
.ix-strong-link:hover { border-bottom-color: currentColor; }

/* header */
.ix-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ix-titles { min-width: 0; }
.ix-head h1 { margin: 0; font-family: var(--ix-head); font-size: 2.1rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.12; color: var(--cx-text); }
.ix-subtitle { margin: 4px 0 0; color: var(--cx-text-2); font-size: 0.95rem; overflow-wrap: anywhere; }
.ix-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.ix-title-status { font-family: 'Inter', system-ui, sans-serif; font-size: 0.95rem; font-weight: 700; letter-spacing: 0; vertical-align: middle; margin-left: 6px; white-space: nowrap; }

/* buttons */
.ix-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 12px;
    border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 0.95rem; cursor: pointer; text-decoration: none; color: inherit;
    background: var(--cx-surface); transition: background 120ms ease, box-shadow 120ms ease, transform 120ms ease; white-space: nowrap; }
.ix-btn:active { transform: translateY(1px); }
.ix-btn i { font-size: 1.15em; }
.ix-btn--brand { background: var(--ix-hero); color: #fff; box-shadow: 0 4px 12px rgba(47, 90, 55, 0.28); }
.ix-btn--brand:hover { background: var(--ix-hero-2); }
.ix-btn--soft { background: var(--ix-soft); color: var(--cx-brand-ink); border-color: color-mix(in srgb, var(--cx-brand) 18%, transparent); }
.ix-btn--soft:hover { border-color: var(--cx-brand); }
.ix-btn--outline { border-color: var(--ix-line); background: var(--cx-surface); color: var(--cx-text); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05); }
.ix-btn--outline:hover { border-color: var(--cx-brand); }
.ix-btn--icon { padding: 0 12px; }
.ix-btn:focus-visible, .ix-row:focus-visible, .ix-tab:focus-visible, .ix-menu-item:focus-visible, .ix-back:focus-visible, .ix-link:focus-visible {
    outline: 3px solid var(--cx-focus); outline-offset: 2px; }

/* toolbar: tabs (plain words, underline) + search */
.ix-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.ix-tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--ix-line); overflow-x: auto; scrollbar-width: none; align-items: center; flex: 1 1 520px; min-width: 0; }
.ix-tabs::-webkit-scrollbar { display: none; }
.ix-tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 0 9px; margin-bottom: -1px; font: inherit; font-weight: 600; font-size: 0.95rem;
    color: var(--cx-text-2); cursor: pointer; white-space: nowrap; }
.ix-tab:hover { color: var(--cx-text); }
.ix-tab.is-active { color: var(--cx-brand-ink); border-bottom-color: var(--cx-brand); }
.ix-tab--bad { color: var(--ix-bad); }
.ix-tab--warn { color: var(--ix-warn); }
.ix-tab--bad.is-active { color: var(--ix-bad); border-bottom-color: var(--ix-bad); }
.ix-tab--warn.is-active { color: var(--ix-warn); border-bottom-color: var(--ix-warn); }
.ix-search { position: relative; display: flex; align-items: center; flex: 0 1 320px; min-width: 200px; }
.ix-search > i { position: absolute; left: 14px; color: var(--cx-text-2); pointer-events: none; }
.ix-search input { width: 100%; min-height: 44px; border-radius: 12px; border: 1px solid var(--ix-line); background: var(--cx-surface); color: var(--cx-text);
    padding: 0 40px 0 40px; font: inherit; font-size: 0.95rem; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); }
.ix-search input:focus { outline: none; border-color: var(--cx-brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cx-brand) 22%, transparent); }
.ix-search-clear { position: absolute; right: 6px; background: none; border: 0; width: 34px; height: 34px; color: var(--cx-text-2); cursor: pointer; font-size: 1.1rem; }
.ix-narrowed { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--cx-text-2); font-size: 0.92rem; }
.ix-count { color: var(--cx-text-2); font-size: 0.85rem; font-weight: 600; margin: -4px 0 -6px; }

/* layout */
.ix-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
@media (min-width: 1200px) {
    .ix-body.has-panel { grid-template-columns: minmax(0, 1fr) minmax(360px, 400px); }
    .ix-panel { position: sticky; top: 12px; }
}
.ix-list { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.ix-group { display: flex; flex-direction: column; gap: 8px; }
.ix-group-head { font-family: var(--ix-head); font-size: 1.02rem; font-weight: 600; color: var(--cx-text); padding: 0 2px; }

/* row */
.ix-row { --ix-acc: var(--ix-part); position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto minmax(92px, auto); align-items: center; gap: 14px;
    width: 100%; text-align: left; padding: 12px 16px 12px 18px; border-radius: 14px; border: 1px solid var(--ix-line); background: var(--cx-surface);
    color: var(--cx-text); font: inherit; cursor: pointer; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); line-height: 1.35; overflow: hidden;
    transition: box-shadow 120ms ease, border-color 120ms ease; }
.ix-row::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--ix-acc); }
.ix-row:hover { box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08); border-color: color-mix(in srgb, var(--ix-acc) 40%, var(--ix-line)); }
.ix-row.is-selected { border-color: var(--cx-brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--cx-brand) 30%, transparent), 0 6px 18px rgba(15, 23, 42, 0.08); background: color-mix(in srgb, var(--ix-soft) 55%, var(--cx-surface)); }
.ix-accent-bad { --ix-acc: var(--ix-bad); }
.ix-accent-warn { --ix-acc: #f59e0b; }
.ix-accent-done { --ix-acc: #16a34a; }
.ix-accent-part { --ix-acc: #f59e0b; }
.ix-accent-wait { --ix-acc: var(--ix-wait); }
.ix-row-icon { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.35rem;
    color: var(--cx-brand-ink); background: var(--ix-soft); border: 1px solid color-mix(in srgb, var(--cx-brand) 15%, transparent); }
.ix-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ix-row-name { font-size: 1rem; }
.ix-row-name b { font-weight: 700; }
.ix-row-sub { font-size: 0.86rem; color: var(--cx-text-2); }
.ix-flag { font-weight: 700; }
.ix-flag + .ix-flag::before { content: '· '; color: var(--cx-text-2); font-weight: 400; }
.ix-row-money { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.ix-row-balance { font-weight: 700; font-size: 1.08rem; }
.ix-row-total { font-size: 0.8rem; color: var(--cx-text-2); white-space: nowrap; }
.ix-row-status { font-weight: 700; font-size: 0.86rem; text-align: right; white-space: nowrap; }
.ix-row--broken { cursor: default; grid-template-columns: 1fr; color: var(--cx-text-2); }
.ix-more { align-self: center; }
.ix-empty { text-align: center; color: var(--cx-text-2); padding: 40px 16px; background: var(--cx-surface); border: 1px dashed var(--ix-line); border-radius: 18px; }
.ix-empty i { font-size: 2.2rem; color: var(--cx-brand); }
.ix-empty p { margin: 8px 0 0; }
@media (max-width: 640px) {
    .ix-row { grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: 'icon main money' 'icon status money'; row-gap: 0; column-gap: 12px; padding: 11px 12px 11px 14px; }
    .ix-row-icon { grid-area: icon; width: 40px; height: 40px; font-size: 1.2rem; align-self: start; }
    .ix-row-main { grid-area: main; }
    .ix-row-money { grid-area: money; align-self: start; }
    .ix-row-status { grid-area: status; text-align: left; font-size: 0.82rem; }
    .ix-row-sub { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
    .ix-head h1 { font-size: 1.7rem; }
    .ix-head-actions { width: 100%; }
    .ix-head-actions .ix-btn { flex: 1 1 auto; }
    .ix-search { flex-basis: 100%; }
}

/* panel / sheet detail */
.ix-panel { min-width: 0; }
.ix-panel-empty { padding: 28px; text-align: center; color: var(--cx-text-2); border: 1px dashed var(--ix-line); border-radius: 18px; background: var(--cx-surface); }
.ix-detail { background: var(--cx-surface); border: 1px solid var(--ix-line); border-radius: 20px; overflow: hidden; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 26px rgba(15, 23, 42, 0.07);
    display: flex; flex-direction: column; gap: 14px; padding-bottom: 16px; }
.ix-detail > *:not(.ix-hero) { margin-left: 16px; margin-right: 16px; }
.ix-hero { background: linear-gradient(160deg, var(--ix-hero), var(--ix-hero-2)); color: #fff; padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.ix-hero.is-overdue { background: linear-gradient(160deg, #7f1d1d, #991b1b); }
.ix-hero-top { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; font-weight: 600; }
.ix-hero-lead { display: inline-flex; align-items: center; gap: 6px; padding: 0; }
.ix-hero-num { margin-left: auto; opacity: 0.92; font-weight: 600; letter-spacing: 0.02em; }
.ix-hero-amount { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ix-hero-big { font-family: var(--ix-head); font-size: 2.3rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.ix-hero-of { font-size: 0.95rem; opacity: 0.95; }
.ix-panel-who { display: flex; flex-direction: column; gap: 3px; }
.ix-panel-name { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 1.1rem; }
.ix-panel-name b { font-family: var(--ix-head); font-weight: 600; }
.ix-panel-who .ix-muted i { color: var(--cx-brand-ink); }
.ix-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ix-detail .ix-actions .ix-btn { flex: 1 1 auto; min-height: 42px; padding: 0 12px; font-size: 0.9rem; }
.ix-detail .ix-actions .ix-btn--brand { flex-basis: 100%; }
.ix-detail .ix-actions .ix-btn--soft { flex: 1 1 calc(50% - 8px); }
.ix-narrow-only { display: none; }
.ix-more-wrap { position: relative; }
.ix-detail .ix-more-wrap { flex: 0 0 auto; }
.ix-menu { display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 240px; padding: 6px; background: var(--cx-surface);
    border: 1px solid var(--ix-line); border-radius: 14px; box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18); }
.ix-menu.is-open { display: flex; flex-direction: column; }
.ix-menu-item { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--cx-text);
    font: inherit; font-weight: 500; text-align: left; cursor: pointer; white-space: nowrap; }
.ix-menu-item:hover { background: var(--ix-soft); }
.ix-menu-item i { font-size: 1.15rem; color: var(--cx-text-2); }
.ix-menu-item.is-danger, .ix-menu-item.is-danger i { color: var(--ix-bad); }
.ix-detail .ix-menu { right: 0; }
.ix-paylinks:empty { display: none; }
.ix-paylinks .pay-link-status { margin: 0 !important; }
.ix-paylinks .action-popup-btn { margin-top: 6px; min-height: 40px; border-radius: 10px; border: 1px solid var(--ix-line); background: var(--cx-surface); color: var(--cx-brand-ink);
    font: inherit; font-weight: 600; padding: 0 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.ix-notices { display: flex; flex-direction: column; gap: 6px; }
.ix-notice { display: flex; gap: 8px; align-items: flex-start; font-size: 0.88rem; font-weight: 600; line-height: 1.35; }
.ix-notice i { margin-top: 2px; }
.ix-notice.ix-tone-neutral { font-weight: 500; }
.ix-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 0; margin-bottom: 0; }
.ix-facts > div { background: var(--cx-surface-2, #f8faf9); border: 1px solid var(--ix-line); border-radius: 12px; padding: 8px 10px; min-width: 0; }
.ix-facts dt { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--cx-text-2); }
.ix-facts dd { margin: 2px 0 0; font-weight: 700; font-size: 0.92rem; overflow-wrap: anywhere; }
.ix-mini-items { display: flex; flex-direction: column; }
.ix-mini-line { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--ix-line); font-size: 0.92rem; }
.ix-mini-line.is-fee { color: var(--ix-bad); font-style: italic; }
.ix-totals { display: flex; flex-direction: column; gap: 2px; }
.ix-tot-row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 0.92rem; }
.ix-tax { color: var(--cx-text-2); }
.ix-tot-total { font-weight: 700; font-size: 1.05rem; border-top: 1px solid var(--ix-line); padding-top: 8px; margin-top: 2px; }
.ix-tot-paid { color: var(--ix-done); font-weight: 600; }
.ix-tot-balance { font-weight: 700; font-size: 1.05rem; padding: 10px 12px; border-radius: 12px; background: var(--cx-surface-2, #f8faf9); margin-top: 6px; }
.ix-tot-balance.is-owed { background: color-mix(in srgb, var(--ix-bad) 9%, var(--cx-surface)); color: var(--ix-bad); }
.ix-open-full { width: auto; }

/* sheet (phone / tablet) */
.ix-sheet { position: fixed; inset: 0; z-index: 10050; display: none; align-items: flex-end; justify-content: center; }
.ix-sheet.is-open { display: flex; }
.ix-sheet-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.45); }
.ix-sheet-card { position: relative; width: 100%; max-width: 640px; max-height: 90vh; max-height: 90dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--cx-surface);
    border-radius: 22px 22px 0 0; animation: ix-up 200ms ease-out; padding-bottom: env(safe-area-inset-bottom, 0); }
.ix-sheet-bar { position: absolute; top: 0; left: 0; right: 0; height: 0; z-index: 2; }
.ix-sheet-grip { position: absolute; top: 6px; left: 50%; width: 44px; height: 5px; margin-left: -22px; border-radius: 3px; background: rgba(255, 255, 255, 0.6); }
.ix-sheet-close { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.12); color: #fff; cursor: pointer; font-size: 1.05rem; display: inline-flex; align-items: center; justify-content: center; }
.ix-sheet .ix-detail { border: 0; border-radius: 0; box-shadow: none; }
.ix-sheet .ix-hero { padding-top: 22px; padding-right: 60px; }
.ix-sheet .ix-hero-num { margin-left: 0; }
.ix-sheet .ix-hero-top { flex-wrap: wrap; }
@keyframes ix-up { from { transform: translateY(24px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ix-sheet-card { animation: none; } }
body.ix-sheet-open { overflow: hidden; }

/* full detail page */
.ix-detail-page .ix-actions { gap: 10px; }
.ix-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
@media (min-width: 1200px) { .ix-detail-grid { grid-template-columns: minmax(0, 1fr) minmax(340px, 400px); } .ix-side { position: sticky; top: 12px; } }
@media (max-width: 1199px) { .ix-detail-grid .ix-side { order: -1; } }
.ix-doc { background: var(--cx-surface); border: 1px solid var(--ix-line); border-radius: 20px; padding: 28px 30px; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 30px rgba(15, 23, 42, 0.07);
    display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.ix-doc-head { display: flex; justify-content: space-between; gap: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--ix-line); }
.ix-doc-practice { display: flex; gap: 14px; align-items: flex-start; min-width: 0; font-size: 0.9rem; overflow-wrap: anywhere; }
.ix-doc-logo { width: 56px; height: 56px; object-fit: contain; border-radius: 12px; }
.ix-doc-pname { font-family: var(--ix-head); font-weight: 700; font-size: 1.25rem; color: var(--cx-text); margin-bottom: 2px; }
.ix-doc-mark { text-align: right; flex-shrink: 0; }
.ix-doc-word { font-family: var(--ix-head); font-weight: 700; font-size: 1.6rem; letter-spacing: 0.14em; color: var(--cx-brand); }
.ix-doc-num { font-weight: 700; font-size: 1.02rem; }
.ix-doc-status { font-weight: 700; font-size: 0.9rem; margin-top: 2px; }
.ix-doc-dates { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; }
.ix-doc-dates dt { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--cx-text-2); }
.ix-doc-dates dd { margin: 3px 0 0; font-weight: 700; }
.ix-doc-parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; background: var(--cx-surface-2, #f8faf9); border: 1px solid var(--ix-line);
    border-radius: 16px; padding: 16px 18px; font-size: 0.92rem; overflow-wrap: anywhere; }
.ix-doc-parties b, .ix-doc-parties a { font-size: 1.02rem; }
.ix-doc-pat { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.ix-doc-pat i { color: var(--cx-brand-ink); font-size: 1.2rem; }
.ix-items { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.ix-items th { text-align: left; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cx-text-2); padding: 0 0 8px; border-bottom: 1px solid var(--ix-line); }
.ix-items td { padding: 12px 0; border-bottom: 1px solid var(--ix-line); vertical-align: top; }
.ix-items .ix-num { text-align: right; padding-left: 14px; white-space: nowrap; }
.ix-items tr.is-fee td { color: var(--ix-bad); font-style: italic; }
.ix-item-name { font-weight: 600; overflow-wrap: anywhere; }
.ix-item-sub { font-size: 0.82rem; color: var(--cx-text-2); margin-top: 2px; }
.ix-doc .ix-totals { align-self: flex-end; width: min(100%, 380px); }
.ix-doc-notes p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.ix-doc-footer { text-align: center; font-style: italic; color: var(--cx-text-2); font-size: 0.88rem; border-top: 1px solid var(--ix-line); padding-top: 14px; white-space: pre-wrap; }
.ix-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ix-side .ix-hero { border-radius: 20px; }
.ix-card { background: var(--cx-surface); border: 1px solid var(--ix-line); border-radius: 18px; padding: 16px 18px; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 18px rgba(15, 23, 42, 0.05); min-width: 0; }
.ix-card h2.ix-label { margin-bottom: 10px; }
.ix-pay-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--ix-line); font-size: 0.92rem; }
.ix-pay-row:last-of-type { border-bottom: 0; }
.ix-pay-date { color: var(--cx-text-2); white-space: nowrap; }
.ix-pay-what { display: flex; flex-direction: column; min-width: 0; }
.ix-pay-what .ix-muted { font-size: 0.82rem; }
.ix-pay-none { margin: 6px 0 0; font-size: 0.88rem; }
.ix-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.ix-h { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 10px; font-size: 0.92rem; position: relative; }
.ix-h .ix-muted { font-size: 0.82rem; }
.ix-h-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; background: var(--cx-text-2); }
.ix-h--good .ix-h-dot { background: #16a34a; }
.ix-h--pay .ix-h-dot { background: var(--ix-hero); }
.ix-h--warn .ix-h-dot { background: #f59e0b; }
.ix-h--bad .ix-h-dot { background: #dc2626; }
@media (max-width: 640px) {
    .ix-doc { padding: 18px 16px; border-radius: 18px; }
    .ix-doc-head { flex-direction: column; }
    .ix-doc-mark { text-align: left; }
    .ix-doc-dates { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ix-narrow-only { display: block; }
    .ix-items thead th:nth-child(2), .ix-items thead th:nth-child(3), .ix-items td:nth-child(2), .ix-items td:nth-child(3) { display: none; }
    .ix-detail-page > .ix-actions .ix-btn { flex: 1 1 calc(50% - 10px); }
    .ix-detail-page > .ix-actions .ix-btn--brand { flex-basis: 100%; }
    .ix-detail-page > .ix-actions .ix-more-wrap { flex: 1 1 calc(50% - 10px); }
    .ix-detail-page > .ix-actions .ix-more-wrap .ix-btn { width: 100%; }
    .ix-hero-big { font-size: 2rem; }
}
@media (max-width: 1199px) {
    .ix-detail-page .ix-menu, .ix-sheet .ix-menu { position: static; box-shadow: none; margin-top: 6px; width: 100%; }
    .ix-detail .ix-more-wrap { flex: 1 1 100%; }
    .ix-detail .ix-more-wrap > .ix-btn { width: 100%; }
}
.ix-detail .ix-more-wrap { flex: 1 1 100%; }
.ix-detail .ix-more-wrap > .ix-btn { width: 100%; }

/* ── the CLASSIC invoice form / Take payment / Send pages under the new look: restyled only (same markup + handlers) ── */
body.ix-form-on #page-invoices { max-width: 920px; margin-left: auto; margin-right: auto; }
body.ix-form-on #page-invoices > .page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px !important; }
body.ix-form-on #page-invoices > .page-header h1 { font-family: var(--ix-head); font-size: 1.9rem; font-weight: 700; letter-spacing: -0.03em; color: var(--primary-text, var(--cx-text)); }   /* BRAND-1677 */
body.ix-form-on #page-invoices > .page-header .btn-outline { min-height: 40px; border-radius: 12px; border-color: var(--ix-line); background: var(--cx-surface); color: var(--cx-brand-ink); font-weight: 600; }
body.ix-form-on #page-invoices > .card.glass { background: var(--cx-surface) !important; border: 1px solid var(--ix-line); border-radius: 20px; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 30px rgba(15, 23, 42, 0.07);
    backdrop-filter: none; -webkit-backdrop-filter: none; padding: 22px 24px !important; }
body.ix-form-on #page-invoices .form-section { border: 1px solid var(--ix-line); border-radius: 16px; padding: 16px 18px; margin: 14px 0; background: var(--cx-surface-2, #f8faf9); }
body.ix-form-on #page-invoices .form-section h3, body.ix-form-on #page-invoices .form-section h4 { font-family: var(--ix-head); font-weight: 600; color: var(--cx-text); }
body.ix-form-on #page-invoices .form-group label { font-weight: 600; font-size: 0.85rem; color: var(--cx-text); }
body.ix-form-on #page-invoices input:not([type="checkbox"]):not([type="radio"]), body.ix-form-on #page-invoices select, body.ix-form-on #page-invoices textarea {
    border-radius: 12px; border: 1px solid var(--ix-line); min-height: 44px; background: var(--cx-surface); color: var(--cx-text); font-size: 0.95rem; }
body.ix-form-on #page-invoices input:focus, body.ix-form-on #page-invoices select:focus, body.ix-form-on #page-invoices textarea:focus {
    outline: none; border-color: var(--cx-brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cx-brand) 22%, transparent); }
body.ix-form-on #page-invoices .invoice-item-row { background: var(--cx-surface); border: 1px solid var(--ix-line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
body.ix-form-on #page-invoices .btn { border-radius: 12px; min-height: 42px; font-weight: 600; }
body.ix-form-on #page-invoices .btn-primary { background: var(--ix-hero); border-color: var(--ix-hero); box-shadow: 0 4px 12px rgba(47, 90, 55, 0.28); }
body.ix-form-on #page-invoices .btn-primary:hover { background: var(--ix-hero-2); }
body.ix-form-on #page-invoices .btn-secondary { background: var(--ix-soft); color: var(--cx-brand-ink); border: 1px solid color-mix(in srgb, var(--cx-brand) 18%, transparent); }
body.ix-form-on #page-invoices #invoiceTotalDisplay { font-variant-numeric: tabular-nums; }
body.ix-form-on #page-invoices .form-actions { z-index: 5; background: var(--cx-surface); border-top: 1px solid var(--ix-line);
    margin: 16px -24px -22px; padding: 12px 24px calc(12px + env(safe-area-inset-bottom, 0)); border-radius: 0 0 20px 20px; display: flex; gap: 10px; justify-content: flex-end; }
/* sticky Save bar only where the classic bottom navigation is not drawn over it */
@media (min-width: 1024px) { body.ix-form-on #page-invoices .form-actions { position: sticky; bottom: 0; } }
@media (max-width: 640px) {
    body.ix-form-on #page-invoices > .card.glass { padding: 16px 14px !important; border-radius: 18px; }
    body.ix-form-on #page-invoices .form-actions { margin: 16px -14px -16px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0)); }
    body.ix-form-on #page-invoices .form-actions .btn { flex: 1 1 0; }
    body.ix-form-on #page-invoices > .page-header h1 { font-size: 1.5rem; }
}

/* one clear button (the browser's own search "x" is hidden); tabs that scroll on a phone fade at the edge */
.ix-search input::-webkit-search-cancel-button, .ix-search input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
@media (max-width: 900px) { .ix-tabs { -webkit-mask-image: linear-gradient(to right, #000 82%, transparent); mask-image: linear-gradient(to right, #000 82%, transparent); padding-right: 28px; } }

/* summary tiles (owner 2026-11-09): a calm number per card; Unpaid / Overdue open their classic filter */
.ix-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ix-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--ix-line);
    background: var(--cx-surface); color: var(--cx-text); font: inherit; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 18px rgba(15, 23, 42, 0.05); min-width: 0; }
button.ix-tile { cursor: pointer; transition: border-color 120ms ease, box-shadow 120ms ease; }
button.ix-tile:hover { border-color: var(--cx-brand); box-shadow: 0 8px 22px rgba(15, 23, 42, 0.09); }
.ix-tile:focus-visible { outline: 3px solid var(--cx-focus); outline-offset: 2px; }
.ix-tile-label { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; font-weight: 600; color: var(--cx-text-2); }
.ix-tile-num { font-family: var(--ix-head); font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.ix-tile-sub { font-size: 0.82rem; color: var(--cx-text-2); overflow-wrap: anywhere; }
.ix-tile--bad .ix-tile-label i { color: var(--ix-bad); }
.ix-tile--warn .ix-tile-num, .ix-tile--warn .ix-tile-label i { color: var(--ix-bad); }
.ix-tile--done .ix-tile-num, .ix-tile--done .ix-tile-label i { color: var(--ix-done); }
/* date range + filters */
.ix-filterbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ix-select { position: relative; display: inline-flex; align-items: center; }
.ix-select > i { position: absolute; left: 12px; color: var(--cx-text-2); pointer-events: none; }
.ix-select select, .ix-filters select, .ix-date input { min-height: 42px; border-radius: 12px; border: 1px solid var(--ix-line); background: var(--cx-surface); color: var(--cx-text);
    font: inherit; font-size: 0.92rem; padding: 0 12px; }
.ix-select select { padding-left: 36px; }
.ix-date { display: inline-flex; align-items: center; gap: 6px; font-size: 0.88rem; font-weight: 600; color: var(--cx-text-2); }
.ix-filters-btn { min-height: 42px; }
.ix-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; padding: 14px 16px; border: 1px solid var(--ix-line); border-radius: 16px; background: var(--cx-surface-2, #f8faf9); }
.ix-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; font-weight: 600; color: var(--cx-text); }
@media (max-width: 640px) {
    .ix-tiles { gap: 8px; }
    .ix-tile { padding: 10px 10px; border-radius: 14px; }
    .ix-tile-num { font-size: 1.25rem; }
    .ix-tile-label { font-size: 0.75rem; gap: 4px; }
    .ix-tile-sub { font-size: 0.72rem; }
    .ix-select, .ix-select select { flex: 1 1 auto; }
    .ix-filterbar > .ix-select { flex: 1 1 60%; }
}

/* IOS-16PX (lane/1674-rd-int; owner rule for the redesign: iOS inputs are at least 16px). iOS Safari zooms the whole page when
   a field under 16px gets focus; on phones / tablets / touch screens every field of this page and its sheet is 16px.
   Measured by tests/journeys/redesign1674_fit_browser.cjs F2 at 360 / 390. */
@media (max-width: 1024px), (pointer: coarse) {
    #ixRoot input, #ixRoot select, #ixRoot textarea, #ixSheet input, #ixSheet select, #ixSheet textarea { font-size: 16px; }
    /* the classic invoice / payment / send forms the new look restyles (body.ix-form-on; same specificity as that rule, later) */
    body.ix-form-on #page-invoices input:not([type="checkbox"]):not([type="radio"]), body.ix-form-on #page-invoices select, body.ix-form-on #page-invoices textarea { font-size: 16px; }
}
