:root {
    color-scheme: light;
    --font-primary: "Inter", "Helvetica Neue", sans-serif;
    --bg: #f3f4f6;
    --surface: #ffffff;
    --surface-subtle: #f8fafc;
    --line: #e5e7eb;
    --line-strong: #d1d5db;
    --text: #111827;
    --text-soft: #6b7280;
    --primary: #4532d7;
    --primary-strong: #3726bf;
    --primary-soft: #efedff;
    --primary-soft-strong: #d8d2ff;
    --secondary: #705fe8;
    --shadow: 0 18px 42px rgba(15, 23, 42, 0.06);
    --radius-xl: 24px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --text-dark: var(--text);
    --text-body: #4b5563;
    --text-muted: #9ca3af;
    --color-primary: var(--primary);
    --color-primary-light: var(--secondary);
    --color-gradient: linear-gradient(135deg, var(--primary), var(--secondary));
    --bg-light: var(--bg);
    --bg-secondary: var(--surface-subtle);
    --bg-white: var(--surface);
    --border-color: var(--line);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 25px rgba(17, 24, 39, 0.08);
    --border-radius: 0.75rem;
    --border-radius-sm: 0.5rem;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-primary);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -8rem;
    z-index: 20;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    text-decoration: none;
}

.skip-link:focus-visible {
    top: 1rem;
}

.app-shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    min-height: 100vh;
}

.app-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem 1rem;
    background: var(--surface);
    border-right: 1px solid var(--line);
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.4rem 0.35rem 0.75rem;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--primary);
    color: #fff;
    font-family: "Sora", "Manrope", sans-serif;
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.brand-name,
.page-title,
.panel h2,
.panel h3 {
    font-family: "Sora", "Manrope", sans-serif;
}

.brand-name {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.sidebar-nav {
    display: grid;
    gap: 0.35rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    min-height: 46px;
    padding: 0.8rem 0.95rem;
    border-radius: 12px;
    color: var(--text-soft);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease;
    border: 1px solid transparent;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(69, 50, 215, 0.12);
}

.sidebar-link:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.sidebar-link.is-active {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: var(--primary-soft-strong);
    font-weight: 700;
}

.app-main {
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 90;
    background: rgba(246, 247, 252, 0.98);
    border-bottom: 1px solid var(--line);
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.4rem;
    margin: 0;
}

.app-content {
    flex: 1;
    padding: 1.4rem;
}

.page-title {
    margin: 0;
    font-size: clamp(1.5rem, 2vw, 2rem);
    letter-spacing: -0.03em;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.inline-action-form {
    display: inline-flex;
    margin: 0;
}

.inline-action-form .button {
    white-space: nowrap;
}

.page-header-right,
.user-profile,
.user-profile-card,
.action-stack {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-header-right,
.user-profile {
    justify-content: flex-end;
    flex-wrap: wrap;
}

.user-profile-card {
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary);
    font-family: "Sora", "Manrope", sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
}

.user-meta {
    display: grid;
    gap: 0.1rem;
}

.user-name,
.user-email {
    display: block;
    line-height: 1.2;
}

.user-name {
    font-weight: 700;
}

.user-email {
    color: var(--text-soft);
    font-size: 0.8rem;
}

.flash-message,
.panel,
.metric-card {
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.flash-message {
    margin-bottom: 1rem;
    padding: 0.95rem 1rem;
    border-radius: var(--radius-md);
    color: var(--primary-strong);
    background: #f4f2ff;
}

.flash-message-error {
    color: #a42d55;
    background: #fff3f7;
    border-color: #f3cada;
}

.page-content,
.panel-stack,
.record-list {
    display: grid;
    gap: 1rem;
}

.metric-grid,
.dashboard-grid,
.workspace-grid,
.review-grid {
    display: grid;
    gap: 1rem;
}

.metric-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.metric-card {
    display: grid;
    gap: 0.4rem;
    padding: 1.15rem 1.2rem;
    border-radius: var(--radius-lg);
}

.metric-number {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
}

.metric-label {
    color: var(--text-soft);
    font-size: 0.88rem;
    font-weight: 600;
}

.dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workspace-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.85fr);
}

.workspace-grid-wide {
    grid-template-columns: minmax(0, 1.65fr) minmax(320px, 0.7fr);
}

.review-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.75fr);
    align-items: start;
}

.invoice-show-grid {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
    gap: 1.35rem;
}

.invoice-show-grid > .panel-stack,
.invoice-show-grid > aside,
.invoice-show-grid .panel {
    min-width: 0;
}

.panel {
    padding: 1.1rem;
    border-radius: var(--radius-lg);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel-header h2,
.panel-header h3 {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.panel-header-actions {
    align-items: flex-start;
}

.title-stack {
    min-width: 0;
}

.title-stack h2 {
    overflow-wrap: anywhere;
}

.invoice-title-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
    min-width: 0;
}

.invoice-title-row h2 {
    margin: 0;
}

.invoice-export-button {
    gap: 0.5rem;
}

.invoice-export-button svg {
    width: 1rem;
    height: 1rem;
}

.panel-count,
.status-chip,
.meta-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.panel-count {
    background: var(--surface-subtle);
    border: 1px solid var(--line);
    color: var(--text-soft);
    font-variant-numeric: tabular-nums;
}

.status-chip {
    background: var(--primary-soft);
    color: var(--primary);
}

.meta-chip {
    background: #f5f6fb;
    border: 1px solid var(--line);
    color: var(--text-soft);
}

.meta-inline,
.button-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.invoice-editor-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.record-list {
    gap: 0.75rem;
}

.record-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.95rem 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-subtle);
    text-decoration: none;
    cursor: pointer;
    transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.record-row:hover {
    border-color: var(--primary-soft-strong);
    background: #ffffff;
    transform: translateY(-1px);
}

.record-copy {
    display: grid;
    gap: 0.18rem;
    min-width: 0;
}

.record-primary,
.record-secondary {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.record-primary {
    font-weight: 700;
}

.record-secondary {
    color: var(--text-soft);
    font-size: 0.84rem;
}

.text-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
}

.text-link:hover {
    color: var(--primary-strong);
}

.button,
button,
input,
select,
textarea {
    font: inherit;
}

.button,
button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(69, 50, 215, 0.12);
}

.button:hover,
button[type="submit"]:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-1px);
}

.button:disabled,
button:disabled,
button[type="submit"]:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.button-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.button-primary:hover {
    background: var(--primary-strong);
    border-color: var(--primary-strong);
}

.button-danger {
    border-color: #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}

.button-danger:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

.button-small {
    min-height: 32px;
    padding: 0.42rem 0.68rem;
}

.button-block {
    width: 100%;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
}

.data-table th,
.data-table td {
    padding: 0.9rem 0.95rem;
    text-align: left;
    vertical-align: top;
}

.data-table thead th {
    color: var(--text-soft);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: #f9fafb;
}

.data-table tbody tr {
    transition: background-color 180ms ease;
}

.data-table-row-clickable {
    cursor: pointer;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

.data-table-row-clickable:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.data-table tbody tr + tr td {
    border-top: 1px solid var(--line);
}

.invoice-editor-grid {
    grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.78fr);
}

.invoice-editor-stack {
    display: grid;
    gap: 1rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding-bottom: 9.5rem;
}

.invoice-editor-stack > .panel {
    min-width: 0;
}

.invoice-header-grid {
    display: grid;
    grid-template-columns: minmax(260px, 2fr) minmax(120px, 0.65fr) minmax(180px, 0.95fr) minmax(180px, 0.95fr);
    gap: 0.85rem 1rem;
    align-items: start;
}

.invoice-header-field-customer {
    grid-column: 1;
}

.invoice-header-field-currency {
    grid-column: 2;
}

.invoice-header-field-invoice-number {
    grid-column: 3;
}

.invoice-header-field-reference,
.invoice-header-field-service-note {
    grid-column: 4;
}

.invoice-header-field-address {
    grid-column: 1 / span 2;
}

.invoice-header-field-invoice-date {
    grid-column: 3;
}

.invoice-header-field-payment-terms {
    grid-column: 4;
}

:root {
    --invoice-col-product: 150px;
    --invoice-col-po: 130px;
    --invoice-col-qty: 56px;
    --invoice-col-uom: 62px;
    --invoice-col-unit-price: 96px;
    --invoice-col-total: 108px;
}

.invoice-source-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem;
}

.invoice-source-card {
    display: grid;
    gap: 0.3rem;
    padding: 0.9rem 0.95rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-subtle);
}

.invoice-source-meta {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    color: var(--text-soft);
    font-size: 0.78rem;
}

.invoice-builder-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.invoice-builder-hint {
    color: var(--text-soft);
    font-size: 0.82rem;
}

.invoice-builder-add {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.invoice-builder-add select {
    min-width: 180px;
}

.invoice-editor-sidebar-button {
    min-height: 36px;
}

.invoice-editor-totals-bar {
    position: fixed;
    left: 260px;
    right: 0;
    bottom: 0;
    z-index: 80;
    margin-top: 0;
    padding: 0.45rem 1.5rem max(0.45rem, env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.06);
    backdrop-filter: blur(10px);
}

.invoice-editor-totals-bar-inner {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.85rem;
    flex-wrap: wrap;
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
}

body.sidebar-collapsed .invoice-editor-totals-bar {
    left: 0;
}

.invoice-editor-totals-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 180px));
    gap: 0.7rem;
    flex: 1 1 720px;
    align-items: end;
    justify-content: end;
    margin-left: auto;
}

.invoice-editor-total-field {
    margin: 0;
}

.invoice-editor-total-field label {
    margin-bottom: 0.25rem;
}

.invoice-editor-total-field-grand input {
    font-weight: 800;
}

.invoice-editor-totals-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.65rem;
    flex: 0 0 auto;
}

.invoice-builder-table {
    --invoice-table-min-width: 1088px;
    width: 100%;
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: 20px;
    overflow-x: auto;
    overflow-y: visible;
    background: var(--surface);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
    overscroll-behavior-x: contain;
    position: relative;
    isolation: isolate;
}

.invoice-builder-table-head,
.invoice-builder-row-main {
    display: grid;
    grid-template-columns: 136px 44px 104px minmax(116px, 0.28fr) minmax(176px, 1.42fr) 230px 52px 64px 82px 82px 108px;
    gap: 0.34rem;
    align-items: start;
    min-width: var(--invoice-table-min-width);
}

.invoice-builder-table-head {
    position: sticky;
    top: 0;
    z-index: 4;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, #fafbff 0%, #f4f6fb 100%);
}

.invoice-builder-head-cell {
    color: var(--text-soft);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.invoice-builder-head-cell-qty,
.invoice-builder-head-cell-uom,
.invoice-builder-head-cell-money {
    text-align: center;
}

.invoice-builder-head-cell-sn,
.invoice-builder-head-cell-po {
    text-align: center;
}

.invoice-builder-head-cell-actions {
    text-align: right;
}

.invoice-builder-rows {
    display: grid;
    min-width: var(--invoice-table-min-width);
    overflow: visible;
}

.invoice-builder-row {
    display: grid;
    gap: 0;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
    overflow: visible;
}

.invoice-builder-row:last-child {
    border-bottom: 0;
}

.invoice-builder-row:hover {
    background: #fcfcff;
}

.invoice-builder-row.is-dragging {
    opacity: 0.74;
}

.invoice-builder-row.is-drop-target {
    box-shadow: 0 0 0 3px rgba(69, 50, 215, 0.12);
    background: #f8f7ff;
}

.invoice-row-print-only {
    background: linear-gradient(90deg, rgba(248, 250, 252, 0.88) 0%, rgba(255, 255, 255, 0.96) 100%);
}

.invoice-builder-row-block-odd {
    background: linear-gradient(90deg, rgba(69, 50, 215, 0.025) 0%, rgba(255, 255, 255, 0) 34%);
}

.invoice-builder-row-block-even {
    background: linear-gradient(90deg, rgba(14, 165, 233, 0.03) 0%, rgba(255, 255, 255, 0) 34%);
}

.invoice-builder-row-main {
    padding: 0.62rem 0.75rem;
}

.invoice-builder-row-separator {
    background: #f1f4f8;
}

.invoice-builder-row-separator:hover {
    background: #eef2f7;
}

.invoice-builder-row-separator .invoice-builder-row-main {
    padding-top: 0.38rem;
    padding-bottom: 0.38rem;
    align-items: center;
}

.invoice-builder-row-body {
    display: grid;
    padding: 0 0.9rem 0.95rem;
    border-top: 1px dashed var(--line);
    background: #fafbff;
}

.invoice-builder-row-body[hidden] {
    display: none !important;
}

.invoice-builder-row-drawer-grid {
    display: grid;
    grid-template-columns: 1.25fr 0.9fr 1fr 1.5fr 1.3fr;
    gap: 0.75rem;
    align-items: start;
    min-width: var(--invoice-table-min-width);
    padding-top: 0.75rem;
}

.invoice-row-subfield {
    display: grid;
    gap: 0.22rem;
    min-width: 0;
    align-content: start;
    align-self: start;
}

.invoice-row-subfield-span-2 {
    grid-column: span 2;
}

.invoice-row-subfield-print-no input {
    text-align: center;
}

.invoice-row-subfield-print-no,
.invoice-row-subfield-qty,
.invoice-row-subfield-uom,
.invoice-row-subfield-money {
    min-width: 0;
}

.invoice-row-type-chip-button {
    border: 0;
    outline: none;
    box-shadow: none;
    appearance: none;
    cursor: pointer;
    user-select: none;
}

.invoice-row-type-chip-button:hover,
.action-menu[open] .invoice-row-type-chip-button {
    box-shadow: 0 0 0 2px rgba(69, 50, 215, 0.12);
}

.invoice-builder-row-cell {
    min-width: 0;
    display: flex;
    align-items: stretch;
    overflow: visible;
}

.invoice-builder-row-cell-separator-fill {
    grid-column: 2 / 11;
    align-items: center;
}

.invoice-builder-row-cell-controls,
.invoice-builder-row-cell-actions {
    display: flex;
    align-items: center;
    gap: 0.22rem;
    z-index: 12;
    overflow: visible;
}

.invoice-builder-row-cell-controls {
    justify-content: flex-start;
    position: sticky;
    left: 0;
    padding-right: 0.2rem;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.95) 78%, rgba(255, 255, 255, 0.86) 100%);
    backdrop-filter: blur(6px);
    box-shadow: 1px 0 0 rgba(229, 231, 235, 0.88);
}

.invoice-builder-row-cell-actions {
    justify-content: flex-end;
    position: sticky;
    right: 0;
    padding-left: 0.15rem;
    background: linear-gradient(270deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.95) 78%, rgba(255, 255, 255, 0.86) 100%);
    backdrop-filter: blur(6px);
    box-shadow: -1px 0 0 rgba(229, 231, 235, 0.88);
}

.invoice-builder-row-cell-actions .action-menu,
.invoice-builder-row-cell-actions .action-menu-dropdown,
.invoice-builder-row-cell-actions .invoice-row-add-menu-shell,
.invoice-builder-row-cell-actions .invoice-row-add-dropdown,
.invoice-builder-row-cell-actions .invoice-row-actions-menu,
.invoice-builder-row-cell-actions .invoice-row-actions-dropdown {
    overflow: visible;
}

.invoice-builder-head-cell-controls,
.invoice-builder-head-cell-actions {
    position: sticky;
    z-index: 7;
    background: linear-gradient(180deg, #fafbff 0%, #f4f6fb 100%);
}

.invoice-builder-head-cell-controls {
    left: 0;
    box-shadow: 1px 0 0 rgba(229, 231, 235, 0.9);
}

.invoice-builder-head-cell-actions {
    right: 0;
    box-shadow: -1px 0 0 rgba(229, 231, 235, 0.9);
}

.invoice-row-print-only .invoice-builder-row-cell-controls,
.invoice-row-print-only .invoice-builder-row-cell-actions {
    background: linear-gradient(90deg, rgba(248, 250, 252, 0.98) 0%, rgba(248, 250, 252, 0.92) 78%, rgba(248, 250, 252, 0.82) 100%);
}

.invoice-builder-row-separator .invoice-builder-row-cell-controls {
    background: linear-gradient(90deg, rgba(241, 244, 248, 0.98) 0%, rgba(241, 244, 248, 0.93) 78%, rgba(241, 244, 248, 0.84) 100%);
}

.invoice-builder-row-separator .invoice-builder-row-cell-actions {
    background: linear-gradient(270deg, rgba(241, 244, 248, 0.98) 0%, rgba(241, 244, 248, 0.93) 78%, rgba(241, 244, 248, 0.84) 100%);
}

.invoice-builder-row-block-odd .invoice-builder-row-cell-controls {
    background: linear-gradient(90deg, rgba(250, 249, 255, 0.98) 0%, rgba(250, 249, 255, 0.93) 78%, rgba(250, 249, 255, 0.84) 100%);
}

.invoice-builder-row-block-odd .invoice-builder-row-cell-actions {
    background: linear-gradient(270deg, rgba(250, 249, 255, 0.98) 0%, rgba(250, 249, 255, 0.93) 78%, rgba(250, 249, 255, 0.84) 100%);
}

.invoice-builder-row-block-even .invoice-builder-row-cell-controls {
    background: linear-gradient(90deg, rgba(247, 252, 255, 0.98) 0%, rgba(247, 252, 255, 0.93) 78%, rgba(247, 252, 255, 0.84) 100%);
}

.invoice-builder-row-block-even .invoice-builder-row-cell-actions {
    background: linear-gradient(270deg, rgba(247, 252, 255, 0.98) 0%, rgba(247, 252, 255, 0.93) 78%, rgba(247, 252, 255, 0.84) 100%);
}

.invoice-row-service-note-button {
    padding: 0;
}

.invoice-builder-row-cell-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
    min-width: 108px;
    padding-right: 0.1rem;
}

.invoice-row-service-note-icon {
    width: 1rem;
    height: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
}

.invoice-row-service-note-icon svg {
    width: 1rem;
    height: 1rem;
}

.invoice-row-service-note-button:hover .invoice-row-service-note-icon,
.invoice-row-service-note-button:focus-visible .invoice-row-service-note-icon {
    color: #64748b;
}

.invoice-row-subfield label {
    color: var(--text-soft);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.invoice-builder-row input,
.invoice-builder-row textarea,
.invoice-builder-row select {
    width: 100%;
    font-size: 0.8rem;
}

.invoice-drag-handle {
    cursor: grab;
}

.invoice-row-toggle {
    min-width: 28px;
    width: 28px;
    min-height: 28px;
    height: 28px;
    padding: 0;
    font-size: 0.78rem;
    line-height: 1;
}

.invoice-drag-handle:active {
    cursor: grabbing;
}

.invoice-row-type-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 0.16rem 0.42rem;
    border-radius: 999px;
    background: #eef2ff;
    color: var(--primary);
    font-size: 0.64rem;
    font-weight: 700;
    white-space: nowrap;
}

.invoice-row-type-menu {
    min-width: 64px;
}

.invoice-row-type-menu.is-open {
    z-index: 2147483000;
}

.invoice-row-actions-menu {
    position: relative;
    min-width: 28px;
    display: flex;
    justify-content: flex-end;
    overflow: visible;
}

.invoice-row-actions-menu.is-open {
    z-index: 2147483000;
}

.invoice-row-actions-dropdown {
    min-width: 13rem;
}

.invoice-row-actions-dropdown[hidden] {
    display: none !important;
}

.invoice-row-add-menu-shell {
    position: relative;
    min-width: 28px;
    display: flex;
    justify-content: flex-end;
    overflow: visible;
}

.invoice-row-add-menu-shell.is-open {
    z-index: 2147483000;
}

.invoice-row-add-dropdown {
    min-width: 10.5rem;
}

.invoice-row-actions-portal {
    position: fixed;
    inset: 0;
    z-index: 2147483640;
    pointer-events: none;
    overflow: visible;
}

.invoice-row-actions-portal[hidden] {
    display: none !important;
}

.invoice-row-actions-dropdown-portal {
    position: absolute;
    top: 0;
    left: 0;
    right: auto;
    pointer-events: auto;
    z-index: 1;
}

.invoice-row-actions-portal .invoice-row-actions-dropdown {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.invoice-row-actions-portal.is-positioning .invoice-row-actions-dropdown {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.invoice-row-add-portal {
    position: fixed;
    inset: 0;
    z-index: 2147483640;
    pointer-events: none;
    overflow: visible;
}

.invoice-row-add-portal[hidden] {
    display: none !important;
}

.invoice-row-add-dropdown-portal {
    position: absolute;
    top: 0;
    left: 0;
    right: auto;
    pointer-events: auto;
    z-index: 1;
}

.invoice-row-add-portal .invoice-row-add-dropdown {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.invoice-row-add-portal.is-positioning .invoice-row-add-dropdown {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.invoice-row-type-portal {
    position: fixed;
    inset: 0;
    z-index: 2147483639;
    pointer-events: none;
    overflow: visible;
}

.invoice-row-type-portal[hidden] {
    display: none !important;
}

.invoice-row-type-dropdown-portal {
    position: absolute;
    top: 0;
    left: 0;
    right: auto;
    min-width: 10rem;
    pointer-events: auto;
    z-index: 1;
}

.invoice-row-type-portal .invoice-row-type-dropdown {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.invoice-row-type-portal.is-positioning .invoice-row-type-dropdown {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.invoice-row-actions-section-label {
    padding: 0.35rem 0.75rem 0.2rem;
    color: var(--text-soft);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.invoice-row-actions-divider {
    height: 1px;
    margin: 0.15rem 0.35rem;
    background: var(--line);
}

.invoice-builder-row .button-small,
.invoice-builder-row .action-menu-trigger {
    min-width: 28px;
    width: 28px;
    min-height: 28px;
    height: 28px;
    padding: 0;
    border-radius: 9px;
}

.invoice-row-type-service_note_header,
.invoice-row-type-separator {
    background: #f3f4f6;
    color: #4b5563;
}

.invoice-row-type-action_heading {
    background: #ede9fe;
    color: #6d28d9;
}

.invoice-row-type-service_action_billed {
    background: #dcfce7;
    color: #166534;
}

.invoice-row-type-material_line {
    background: #fef3c7;
    color: #92400e;
}

.invoice-muted-cell,
.invoice-detected-copy,
.invoice-inline-note {
    color: var(--text-soft);
    font-size: 0.8rem;
}

.invoice-detected-copy {
    margin-top: 0.35rem;
}

.invoice-inline-note {
    padding: 0.48rem 0.58rem;
    border: 1px dashed var(--line-strong);
    border-radius: 9px;
    background: var(--surface);
}

.invoice-table-input,
.invoice-table-textarea,
.invoice-table-static,
.invoice-builder-row .item-master-field [data-item-master-input] {
    width: 100%;
    min-height: 36px;
    padding: 0.3rem 0.46rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    font-size: 0.8rem;
    line-height: 1.35;
}

.invoice-table-input:hover,
.invoice-table-textarea:hover,
.invoice-builder-row .item-master-field [data-item-master-input]:hover {
    border-color: var(--line-strong);
}

.invoice-table-input:focus-visible,
.invoice-table-textarea:focus-visible,
.invoice-builder-row .item-master-field [data-item-master-input]:focus-visible {
    outline: 0;
    border-color: rgba(69, 50, 215, 0.38);
    box-shadow: 0 0 0 4px rgba(69, 50, 215, 0.12);
}

.invoice-table-static {
    display: flex;
    align-items: center;
    color: var(--text-soft);
    background: #f9fafb;
}

.invoice-table-static-type {
    justify-content: center;
    font-weight: 800;
    color: var(--text);
    letter-spacing: 0.04em;
}

.invoice-table-po {
    justify-content: flex-start;
    text-align: left;
    font-variant-numeric: tabular-nums;
    padding-inline: 0.42rem;
}

.invoice-table-secondary {
    white-space: normal;
    overflow-wrap: anywhere;
    padding-inline: 0.55rem;
}

.invoice-table-input[readonly],
.invoice-table-textarea[readonly] {
    background: #f9fafb;
}

.invoice-table-textarea {
    min-height: 36px;
    resize: vertical;
}

.invoice-table-print-no {
    text-align: center;
    padding-inline: 0.18rem;
}

.invoice-table-separator-fill {
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.82rem;
    border-radius: 12px;
    background: #f8fafc;
    color: transparent;
    font-size: 0;
    line-height: 1;
    position: relative;
}

.invoice-table-separator-fill::before {
    content: "";
    width: 100%;
    height: 2px;
    border-radius: 999px;
    background: #64748b;
}

.invoice-table-number,
.invoice-table-money {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.invoice-table-total {
    background: #f8fafc;
    font-weight: 700;
}

.invoice-builder-row-cell-item .item-master-field,
.invoice-builder-row-cell-item .invoice-table-static,
.invoice-builder-row-cell-item .invoice-table-input {
    width: 100%;
    min-width: 0;
}

.invoice-builder-row-cell-no .invoice-table-input {
    padding-inline: 0.18rem;
    max-width: 48px;
}

.invoice-table-sn {
    justify-content: flex-start;
    text-align: left;
    font-variant-numeric: tabular-nums;
    padding-inline: 0.42rem;
}

.invoice-row-action-icon {
    width: 0.95rem;
    height: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
    flex-shrink: 0;
}

.invoice-row-action-icon svg {
    width: 0.95rem;
    height: 0.95rem;
}

.invoice-preview-shell {
    overflow-x: auto;
    padding: 0.2rem;
    max-width: 100%;
}

.invoice-print-page {
    margin: 0;
    background: #eef1f7;
}

.invoice-print-page-shell {
    max-width: 1160px;
    margin: 0 auto;
    padding: 1.5rem;
}

.invoice-print-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.invoice-print-sheet {
    min-width: 860px;
    padding: 2rem 2.2rem;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
    color: #111827;
}

.invoice-print-sheet-standalone {
    min-width: 0;
}

.invoice-print-header {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
    gap: 1.5rem;
    padding-bottom: 1.35rem;
    border-bottom: 2px solid #111827;
}

.invoice-print-eyebrow,
.invoice-print-title {
    font-family: "Sora", "Manrope", sans-serif;
}

.invoice-print-eyebrow {
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.invoice-print-title {
    margin: 0.45rem 0 0;
    font-size: 2rem;
    letter-spacing: -0.05em;
}

.invoice-print-subtitle {
    margin: 0.5rem 0 0;
    color: #6b7280;
    font-size: 0.9rem;
    max-width: 36rem;
}

.invoice-print-meta-list {
    display: grid;
    gap: 0.45rem;
    margin: 0;
}

.invoice-print-meta-row {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 0.85rem;
    align-items: start;
}

.invoice-print-meta-row dt {
    color: #6b7280;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.invoice-print-meta-row dd {
    margin: 0;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.invoice-print-party-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 0.6fr);
    gap: 1.2rem;
    padding: 1.1rem 0 1.25rem;
}

.invoice-print-party {
    display: grid;
    gap: 0.3rem;
    padding: 0.95rem 1rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fbfcff;
}

.invoice-print-party-label {
    color: #6b7280;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.invoice-print-party-copy {
    color: #4b5563;
    font-size: 0.88rem;
    line-height: 1.6;
}

.invoice-print-table-wrap {
    overflow-x: auto;
}

.invoice-print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.94rem;
}

.invoice-print-table th,
.invoice-print-table td {
    padding: 0.42rem 0.45rem;
    vertical-align: top;
}

.invoice-print-table thead th {
    border-top: 1px solid #111827;
    border-bottom: 1px solid #111827;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.invoice-print-col-no {
    width: 4rem;
}

.invoice-print-col-sn {
    width: 8rem;
}

.invoice-print-cell-sn {
    white-space: nowrap;
}

.invoice-print-col-qty {
    width: 5rem;
    text-align: right;
}

.invoice-print-col-uom {
    width: 5.5rem;
    text-align: center;
}

.invoice-print-col-money {
    width: 8rem;
    text-align: right;
}

.invoice-print-row-block-start td {
    padding-top: 0.75rem;
}

.invoice-print-cell-no,
.invoice-print-cell-qty,
.invoice-print-cell-money {
    text-align: right;
}

.invoice-print-cell-uom {
    text-align: center;
}

.invoice-print-primary {
    overflow-wrap: anywhere;
}

.invoice-print-primary-service_note_header {
    font-weight: 800;
    letter-spacing: 0.01em;
}

.invoice-print-primary-action_heading {
    font-weight: 800;
    text-transform: uppercase;
}

.invoice-print-primary-service_action_billed {
    font-weight: 700;
}

.invoice-print-primary-separator {
    color: #6b7280;
    letter-spacing: 0.24em;
}

.invoice-print-secondary {
    margin-top: 0.18rem;
    color: #4b5563;
    line-height: 1.5;
    white-space: pre-line;
}

.invoice-print-totals {
    width: min(360px, 100%);
    margin-top: 1.35rem;
    margin-left: auto;
    padding-top: 0.7rem;
    border-top: 1px solid #111827;
}

.invoice-print-total-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    padding: 0.28rem 0;
}

.invoice-print-total-row-grand {
    margin-top: 0.35rem;
    padding-top: 0.6rem;
    border-top: 1px solid #111827;
    font-size: 1.02rem;
}

.empty-table,
.empty-state {
    color: var(--text-soft);
}

.empty-table {
    text-align: center;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.form-stack {
    grid-template-columns: minmax(0, 1fr);
}

.single-form-wrap {
    display: grid;
    grid-template-columns: minmax(0, 760px);
}

.field,
.field-span-2 {
    min-width: 0;
}

.field-span-2 {
    grid-column: 1 / -1;
}

.field label {
    display: inline-block;
    margin-bottom: 0.45rem;
    color: var(--text-soft);
    font-size: 0.83rem;
    font-weight: 700;
}

.form-footer {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.48rem 0.62rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-subtle);
    color: var(--text);
    transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

textarea {
    resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--line-strong);
    background: #fff;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.button:focus-visible,
button:focus-visible,
.sidebar-link:focus-visible,
.text-link:focus-visible,
.record-row:focus-visible {
    outline: 0;
    border-color: rgba(69, 50, 215, 0.38);
    box-shadow: 0 0 0 4px rgba(69, 50, 215, 0.12);
}

.mono,
.metric-number {
    font-variant-numeric: tabular-nums;
}

.action-stack {
    flex-wrap: wrap;
}

.action-cell {
    width: 1%;
    white-space: nowrap;
}

.action-cell .action-stack {
    justify-content: flex-end;
}

.module-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.filters-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
    align-items: end;
}

.filter-actions {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    padding-bottom: 0.02rem;
}

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
}

.pager-meta {
    color: var(--text-soft);
    font-size: 0.86rem;
    font-weight: 600;
}

.is-disabled {
    opacity: 0.55;
    pointer-events: none;
}

.action-menu {
    position: relative;
    overflow: visible;
}

.action-menu summary {
    list-style: none;
}

.action-menu summary::-webkit-details-marker {
    display: none;
}

.action-menu-trigger {
    position: relative;
    z-index: 1;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color 180ms ease, background-color 180ms ease;
}

.action-menu-trigger-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1rem;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1;
}

.action-menu-trigger:hover,
.action-menu[open] .action-menu-trigger {
    background: var(--surface-subtle);
    border-color: var(--line-strong);
}

.action-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    z-index: 12001;
    min-width: 10rem;
    max-width: min(18rem, calc(100vw - 1rem));
    display: grid;
    gap: 0.15rem;
    padding: 0.4rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.action-menu[open] {
    z-index: 12000;
}

.action-menu[open] .action-menu-dropdown {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.action-menu[open][data-positioned="true"] .action-menu-dropdown {
    position: fixed;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.action-menu-dropdown form {
    margin: 0;
}

.action-menu-link {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.6rem;
    min-height: 38px;
    padding: 0.65rem 0.75rem;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
}

.action-menu-link:hover {
    background: var(--surface-subtle);
}

.invoice-builder-row .action-menu[open] {
    z-index: 12100;
}

.action-menu-link-danger {
    color: #b91c1c;
}

.status-chip-pending {
    background: #f3f4f6;
    color: #111827;
}

.status-chip-synced,
.status-chip-success {
    background: #ecfdf3;
    color: #047857;
}

.status-chip-failed {
    background: #fef2f2;
    color: #b91c1c;
}

.mono {
    font-family: "SFMono-Regular", "Menlo", "Monaco", monospace;
}

.detail-list {
    display: grid;
    gap: 0.75rem;
}

.detail-row {
    display: grid;
    gap: 0.15rem;
    padding: 0.75rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-subtle);
}

.detail-row dt {
    color: var(--text-soft);
    font-size: 0.8rem;
    font-weight: 700;
}

.detail-row dd {
    margin: 0;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.code-block {
    margin: 0;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #f8f8ff;
    color: #262844;
    font-family: "SFMono-Regular", "Menlo", "Monaco", monospace;
    font-size: 0.84rem;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    min-width: 0;
    max-height: 520px;
    overflow: auto;
}

.json-panel {
    margin-top: 1rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-subtle);
}

.json-panel summary {
    padding: 0.9rem 1rem;
    cursor: pointer;
    font-weight: 700;
    list-style: none;
}

.json-panel summary::-webkit-details-marker {
    display: none;
}

.json-panel[open] summary {
    border-bottom: 1px solid var(--line);
}

.json-panel .code-block {
    border: 0;
    border-radius: 0 0 16px 16px;
    background: transparent;
    max-height: 360px;
}

.invoice-readiness-group {
    margin-top: 1rem;
}

.invoice-readiness-title {
    margin: 0 0 0.55rem;
    font-size: 0.84rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.invoice-readiness-list {
    margin: 0;
    padding-left: 1.15rem;
    display: grid;
    gap: 0.45rem;
    font-size: 0.9rem;
}

.invoice-readiness-list-error {
    color: #b91c1c;
}

.invoice-readiness-list-warning {
    color: #92400e;
}

.service-note-tab-shell,
.session-footer-bar {
    display: grid;
    gap: 1rem;
}

.service-note-tab-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}

.service-note-tab-button {
    min-height: 40px;
    padding: 0.7rem 1rem;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
}

.service-note-tab-button.is-active {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: var(--primary-soft-strong);
    font-weight: 700;
}

.service-note-tab-panel {
    display: none;
}

.service-note-tab-panel.is-active {
    display: block;
}

.workflow-modal {
    position: fixed;
    inset: 0;
    z-index: 5200;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: rgba(23, 23, 43, 0.38);
}

.workflow-modal[hidden] {
    display: none;
}

.workflow-modal-card {
    width: min(100%, 980px);
    max-height: 92vh;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--surface);
    box-shadow: 0 26px 64px rgba(23, 23, 43, 0.18);
}

.workflow-modal-wide {
    width: min(100%, 1320px);
}

.workflow-modal-header,
.workflow-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.2rem 1.4rem;
    border-bottom: 1px solid var(--line);
}

.workflow-modal-header h2 {
    margin: 0;
    font-family: "Sora", "Manrope", sans-serif;
    font-size: 1.1rem;
}

.workflow-modal-footer {
    border-bottom: 0;
    border-top: 1px solid var(--line);
}

.workflow-modal-body {
    min-height: 0;
    padding: 1.4rem;
    overflow: auto;
}

.invoice-source-preview-modal-card {
    width: min(100%, 1040px);
}

.invoice-source-preview-modal-body {
    padding: 1rem;
}

.invoice-source-preview-stage {
    min-height: 420px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface-subtle);
    overflow: hidden;
}

.invoice-source-preview-stage iframe,
.invoice-source-preview-stage img {
    width: 100%;
    height: min(78vh, 820px);
    border: 0;
    object-fit: contain;
    background: white;
}

body.modal-open {
    overflow: hidden;
}

.button-shortcut-hint {
    display: inline-flex;
    align-items: center;
    margin-left: 0.45rem;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.3;
}

.button:not(.button-primary) .button-shortcut-hint {
    background: var(--primary-soft);
    color: var(--primary);
}

.invoice-preview-modal-shell {
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    padding: 0 0 0 1.5rem;
    background: rgba(23, 23, 43, 0.28);
    opacity: 0;
    transition: opacity 180ms ease;
}

.invoice-preview-modal-shell.is-open {
    opacity: 1;
}

.invoice-preview-modal-card {
    width: min(50vw, 960px);
}

.invoice-preview-modal-drawer {
    width: min(50vw, 960px);
    height: 100vh;
    max-height: 100vh;
    border-radius: 24px 0 0 24px;
    border-right: 0;
    transform: translateX(40px);
    opacity: 0;
    transition: transform 220ms ease, opacity 180ms ease;
}

.invoice-preview-modal-shell.is-open .invoice-preview-modal-drawer {
    transform: translateX(0);
    opacity: 1;
}

.invoice-preview-modal-copy {
    margin: 0.3rem 0 0;
    color: var(--text-soft);
    font-size: 0.84rem;
}

.invoice-preview-modal-status {
    margin-bottom: 1rem;
    padding: 0.8rem 0.9rem;
    border-radius: 12px;
    font-size: 0.9rem;
}

.invoice-preview-modal-status-error {
    background: #fff1f2;
    color: #b91c1c;
    border: 1px solid #fecdd3;
}

.invoice-preview-modal-body {
    min-height: 280px;
}

.invoice-preview-loading {
    display: grid;
    place-items: center;
    min-height: 220px;
    border: 1px dashed var(--line-strong);
    border-radius: 18px;
    color: var(--text-soft);
    background: var(--surface-subtle);
    font-weight: 600;
}

.invoice-editor-preview-shell {
    display: grid;
    gap: 1rem;
}

.invoice-editor-preview-note {
    padding: 0.8rem 0.95rem;
    border: 1px solid var(--primary-soft-strong);
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 600;
}

.invoice-preview-modal-drawer .invoice-preview-shell {
    overflow-x: visible;
    padding: 0;
}

.invoice-preview-modal-drawer .invoice-print-sheet {
    width: 100%;
    min-width: 0;
    padding: 1.35rem 1.5rem;
}

.invoice-preview-modal-drawer .invoice-print-header {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.72fr);
    gap: 1.1rem;
    padding-bottom: 1.1rem;
}

.invoice-preview-modal-drawer .invoice-print-eyebrow {
    font-size: 1.45rem;
}

.invoice-preview-modal-drawer .invoice-print-title {
    font-size: 1.65rem;
}

.invoice-preview-modal-drawer .invoice-print-subtitle {
    max-width: 30rem;
    font-size: 0.84rem;
}

.invoice-preview-modal-drawer .invoice-print-party-grid {
    grid-template-columns: minmax(0, 1fr) minmax(210px, 0.55fr);
    gap: 1rem;
}

.invoice-preview-modal-drawer .invoice-print-table-wrap {
    overflow-x: visible;
}

.invoice-preview-modal-drawer .invoice-print-table {
    table-layout: fixed;
    font-size: 0.88rem;
}

.invoice-preview-modal-drawer .invoice-print-col-no {
    width: 3.2rem;
}

.invoice-preview-modal-drawer .invoice-print-col-sn {
    width: 6.6rem;
}

.invoice-preview-modal-drawer .invoice-print-col-qty {
    width: 4.4rem;
}

.invoice-preview-modal-drawer .invoice-print-col-uom {
    width: 4.8rem;
}

.invoice-preview-modal-drawer .invoice-print-col-money {
    width: 6.7rem;
}

.invoice-preview-modal-drawer .invoice-print-table th,
.invoice-preview-modal-drawer .invoice-print-table td {
    padding: 0.38rem 0.3rem;
}

.invoice-preview-modal-drawer .invoice-print-table thead th {
    font-size: 0.72rem;
}

.invoice-preview-modal-drawer .invoice-print-primary,
.invoice-preview-modal-drawer .invoice-print-secondary {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.workflow-modal-step {
    display: grid;
    gap: 1rem;
}

.workflow-modal-step[hidden] {
    display: none !important;
}

.batch-flow-modal {
    z-index: 9999;
}

.batch-flow-modal[data-stage="config"] #batch-upload-run-ocr-btn,
.batch-flow-modal[data-stage="config"] #batch-upload-save-draft-btn,
.batch-flow-modal[data-stage="config"] #batch-upload-save-module-btn {
    display: none !important;
}

.batch-flow-modal[data-stage="workspace"] #batch-upload-create-btn {
    display: none !important;
}

.batch-flow-modal[data-stage="config"] #batch-upload-workspace-step {
    display: none !important;
}

.batch-flow-modal[data-stage="workspace"] #batch-upload-config-step {
    display: none !important;
}

.batch-flow-modal-card {
    width: min(100%, 1580px);
    max-height: 94vh;
}

.batch-review-image-modal {
    z-index: 10050;
    padding: 1rem;
}

.batch-review-image-modal-card {
    width: min(94vw, 1280px);
    height: min(92vh, 980px);
    max-height: 92vh;
}

.batch-review-image-modal-header,
.batch-review-image-modal-footer {
    padding: 0.9rem 1rem;
}

.batch-review-image-modal-filename {
    margin: 0.2rem 0 0;
    color: var(--text-soft);
    font-size: 0.86rem;
    word-break: break-word;
}

.batch-review-image-modal-body {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    min-height: 0;
    overflow: auto;
    padding: 1rem;
    background:
        linear-gradient(45deg, rgba(148, 163, 184, 0.14) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(148, 163, 184, 0.14) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.14) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.14) 75%);
    background-color: #f8fafc;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    background-size: 20px 20px;
    overscroll-behavior: contain;
}

.batch-review-image-modal-stage {
    width: max-content;
    min-width: 100%;
    height: max-content;
    min-height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.batch-review-image-modal-stage img {
    width: auto;
    max-width: none;
    max-height: none;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 20px 44px rgba(23, 23, 43, 0.2);
}

.batch-review-image-modal-footer,
.batch-review-image-modal-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.batch-flow-header {
    align-items: flex-start;
    padding: 1rem 1.2rem;
}

.batch-flow-heading {
    display: grid;
    gap: 0.2rem;
}

.batch-flow-subtitle {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.86rem;
}

.batch-flow-window-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.batch-flow-window-button {
    min-width: auto;
    width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    border-radius: 12px;
    font-size: 1.1rem;
    line-height: 1;
}

.batch-flow-body {
    display: grid;
    gap: 0.85rem;
}

.batch-flow-setup {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
}

.batch-flow-card {
    min-width: 0;
}

.batch-flow-card-body {
    display: grid;
    gap: 0.75rem;
}

.batch-flow-form-grid {
    display: grid;
    gap: 0.75rem;
}

.batch-flow-config-card .batch-flow-card-body {
    gap: 1rem;
}

.batch-flow-field {
    display: grid;
    gap: 0.35rem;
}

.batch-flow-label {
    color: var(--text-body);
    font-size: 0.88rem;
    font-weight: 700;
}

.batch-flow-input {
    width: 100%;
    padding: 0.78rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: white;
    color: var(--text-dark);
}

.batch-flow-help {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.79rem;
}

.batch-flow-files-table-wrap {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: white;
}

.batch-flow-files-table {
    width: 100%;
    border-collapse: collapse;
}

.batch-flow-files-table th,
.batch-flow-files-table td {
    padding: 0.72rem 0.85rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 0.83rem;
}

.batch-flow-files-table th {
    color: var(--text-soft);
    font-size: 0.77rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.batch-flow-files-table tbody tr:last-child td {
    border-bottom: 0;
}

.batch-flow-files-empty {
    color: var(--text-soft);
}

.batch-flow-inline-notice {
    display: grid;
    gap: 0.18rem;
    padding: 0.8rem 0.95rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    font-size: 0.82rem;
}

.batch-flow-inline-notice strong {
    font-size: 0.85rem;
}

.batch-flow-inline-notice-success {
    border-color: rgba(16, 185, 129, 0.2);
    background: rgba(16, 185, 129, 0.08);
}

.batch-flow-inline-notice-success strong {
    color: #047857;
}

.batch-flow-inline-notice-success span {
    color: #065f46;
}

.batch-flow-empty-state {
    display: grid;
    gap: 0.4rem;
    padding: 0.95rem 1rem;
    border: 1px dashed var(--line-strong);
    border-radius: 16px;
    background: var(--surface-subtle);
    color: var(--text-soft);
}

.batch-flow-empty-state strong {
    color: var(--text-dark);
}

.batch-flow-file-list {
    display: grid;
    gap: 0.55rem;
    max-height: 360px;
    overflow: auto;
}

.batch-flow-file-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-subtle);
}

.batch-flow-file-main {
    display: grid;
    gap: 0.2rem;
    min-width: 0;
}

.batch-flow-file-main strong,
.batch-flow-file-main span {
    overflow-wrap: anywhere;
}

.batch-flow-file-main span,
.batch-flow-file-meta {
    color: var(--text-soft);
    font-size: 0.82rem;
}

.batch-flow-workspace-step {
    display: grid;
    gap: 0.75rem;
}

.batch-flow-results-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.85rem;
}

.batch-flow-results-shell.is-reviewing {
    grid-template-columns: minmax(420px, 0.9fr) minmax(640px, 1.1fr);
    align-items: start;
}

.batch-flow-results-shell.is-reviewing.is-collapsed {
    grid-template-columns: minmax(150px, 172px) minmax(0, 1fr);
}

.batch-flow-results-card,
.batch-flow-review-card {
    min-width: 0;
}

.batch-flow-results-header,
.batch-flow-review-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem;
}

.batch-flow-results-summary,
.batch-flow-review-caption {
    margin: 0.2rem 0 0;
    color: var(--text-soft);
    font-size: 0.8rem;
}

.batch-flow-sidebar-toggle {
    min-width: auto;
    padding: 0.35rem 0.62rem;
}

.batch-flow-results-body {
    padding-top: 0.2rem;
}

.batch-flow-results-table-wrap {
    overflow: auto;
}

.batch-flow-results-table {
    width: 100%;
    border-collapse: collapse;
}

.batch-flow-results-table th,
.batch-flow-results-table td {
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
    font-size: 0.84rem;
}

.batch-flow-results-table thead th {
    color: var(--text-soft);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.batch-flow-results-table tbody tr:last-child td {
    border-bottom: 0;
}

.batch-flow-results-check-col {
    width: 2.2rem;
    white-space: nowrap;
}

.batch-flow-results-empty {
    color: var(--text-soft);
}

.batch-flow-results-row {
    transition: background-color 160ms ease, box-shadow 160ms ease;
}

.batch-flow-results-row.is-active {
    background: var(--primary-soft);
}

.batch-flow-results-row.is-disabled {
    opacity: 0.78;
}

.batch-flow-results-link {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--primary);
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.batch-flow-results-link:hover {
    text-decoration: underline;
}

.batch-flow-results-type {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: capitalize;
}

.batch-flow-results-dash {
    color: var(--text-soft);
}

.batch-flow-results-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    white-space: nowrap;
}

.batch-flow-results-action-btn {
    min-width: auto;
    padding: 0.38rem 0.72rem;
}

.batch-flow-results-open-link {
    color: var(--text-soft);
    text-decoration: none;
    font-size: 0.98rem;
    line-height: 1;
}

.batch-flow-results-open-link:hover {
    color: var(--primary);
}

.batch-flow-review-card {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 66vh;
    overflow: hidden;
}

.batch-flow-review-body {
    padding: 0;
    background: var(--surface-subtle);
}

.batch-flow-results-shell.is-collapsed #service-notes-list-panel .batch-flow-results-table th,
.batch-flow-results-shell.is-collapsed #service-notes-list-panel .batch-flow-results-table td {
    padding: 0.26rem 0.28rem;
    font-size: 0.64rem;
}

.batch-flow-results-shell.is-collapsed #service-notes-list-panel .batch-flow-results-header {
    gap: 0.45rem;
}

.batch-flow-results-shell.is-collapsed #service-notes-list-panel .batch-flow-results-summary {
    font-size: 0.63rem;
}

.batch-flow-results-shell.is-collapsed #service-notes-list-panel .batch-flow-results-check-col,
.batch-flow-results-shell.is-collapsed #service-notes-list-panel .batch-flow-results-table th:nth-child(3),
.batch-flow-results-shell.is-collapsed #service-notes-list-panel .batch-flow-results-table td:nth-child(3),
.batch-flow-results-shell.is-collapsed #service-notes-list-panel .batch-flow-results-table th:nth-child(4),
.batch-flow-results-shell.is-collapsed #service-notes-list-panel .batch-flow-results-table td:nth-child(4) {
    display: none;
}

.batch-flow-results-shell.is-collapsed #service-notes-list-panel .batch-flow-results-table th:nth-child(5),
.batch-flow-results-shell.is-collapsed #service-notes-list-panel .batch-flow-results-table td:nth-child(5) {
    display: none;
}

.batch-flow-results-shell.is-collapsed #service-notes-list-panel .batch-flow-results-action-btn {
    padding: 0.18rem 0.34rem;
    font-size: 0.62rem;
    border-radius: 8px;
}

.batch-flow-results-shell.is-collapsed #service-notes-list-panel .batch-flow-results-open-link {
    font-size: 0.66rem;
}

.batch-flow-results-shell.is-collapsed #service-notes-list-panel .batch-flow-results-link {
    font-size: 0.64rem;
    line-height: 1.25;
}

.batch-flow-results-shell.is-collapsed #service-notes-list-panel .card-header {
    padding: 0.46rem 0.55rem;
}

.batch-flow-results-shell.is-collapsed #service-notes-list-panel .card-title {
    font-size: 0.82rem;
}

.batch-flow-results-shell.is-collapsed #service-notes-list-panel .card-body {
    padding: 0.1rem 0.28rem 0.25rem;
}

.batch-flow-results-shell.is-collapsed #service-notes-list-panel .batch-flow-sidebar-toggle {
    padding: 0.18rem 0.34rem;
    font-size: 0.62rem;
}

.batch-flow-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0.9rem;
    border-radius: 14px;
    border: 1px solid var(--line);
}

.batch-flow-banner-copy {
    display: grid;
    gap: 0.18rem;
}

.batch-flow-banner-copy strong {
    font-size: 0.88rem;
}

.batch-flow-banner-copy span {
    color: var(--text-soft);
    font-size: 0.8rem;
}

.batch-flow-banner-tip {
    border-color: rgba(245, 158, 11, 0.24);
    background: #fff7db;
}

.batch-flow-banner-tip .batch-flow-banner-copy strong {
    color: #a16207;
}

.batch-flow-banner-progress {
    border-color: rgba(69, 50, 215, 0.12);
    background: linear-gradient(135deg, rgba(69, 50, 215, 0.96), rgba(112, 95, 232, 0.96));
}

.batch-flow-banner-progress .batch-flow-banner-copy strong,
.batch-flow-banner-progress .batch-flow-banner-copy span {
    color: white;
}

.batch-flow-banner-success {
    border-color: rgba(16, 185, 129, 0.22);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(5, 150, 105, 0.18));
}

.batch-flow-banner-success .batch-flow-banner-copy strong {
    color: #047857;
}

.batch-flow-banner-success .batch-flow-banner-copy span {
    color: #065f46;
}

.batch-flow-summary-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: white;
}

.batch-flow-summary-copy {
    display: grid;
    gap: 0.15rem;
}

.batch-flow-summary-copy strong {
    font-size: 0.88rem;
}

.batch-flow-summary-copy span {
    color: var(--text-soft);
    font-size: 0.8rem;
}

.batch-flow-summary-chips {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.batch-flow-summary-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.95rem;
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-subtle);
    color: var(--text-soft);
    font-size: 0.78rem;
    font-weight: 700;
}

.batch-flow-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
    align-items: stretch;
}

.batch-flow-workspace.has-review {
    grid-template-columns: minmax(270px, 320px) minmax(0, 1fr);
}

.batch-flow-workspace.is-collapsed.has-review {
    grid-template-columns: 142px minmax(0, 1fr);
}

.batch-flow-sidebar,
.batch-flow-review-card {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 62vh;
}

.batch-flow-sidebar {
    overflow: hidden;
}

.batch-flow-workspace:not(.has-review) .batch-flow-sidebar {
    min-height: auto;
}

.batch-flow-sidebar-header {
    align-items: flex-start;
}

.batch-flow-sidebar-summary,
.batch-flow-review-caption {
    margin: 0.2rem 0 0;
    color: var(--text-soft);
    font-size: 0.78rem;
}

.batch-flow-sidebar-toggle {
    padding: 0.32rem 0.58rem;
    min-width: auto;
}

.batch-flow-sidebar-body {
    min-height: 0;
    overflow: auto;
}

.batch-flow-service-note-list {
    display: grid;
    gap: 0.45rem;
}

.batch-flow-service-note {
    width: 100%;
    display: grid;
    gap: 0.4rem;
    padding: 0.72rem 0.78rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: white;
    text-align: left;
    cursor: pointer;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.batch-flow-service-note:hover {
    border-color: var(--primary-soft-strong);
    box-shadow: 0 10px 24px rgba(69, 50, 215, 0.08);
    transform: translateY(-1px);
}

.batch-flow-service-note.is-active {
    border-color: var(--primary-soft-strong);
    background: var(--primary-soft);
    box-shadow: 0 14px 26px rgba(69, 50, 215, 0.12);
}

.batch-flow-service-note-top,
.batch-flow-service-note-meta,
.batch-flow-service-note-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
}

.batch-flow-service-note-name {
    min-width: 0;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.batch-flow-service-note-meta,
.batch-flow-service-note-foot {
    color: var(--text-soft);
    font-size: 0.76rem;
}

.batch-flow-service-note-foot-copy {
    min-width: 0;
}

.batch-flow-service-note-action {
    color: var(--primary);
    font-weight: 700;
    white-space: nowrap;
}

.batch-flow-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem 0.48rem;
    border-radius: 999px;
    font-size: 0.71rem;
    font-weight: 700;
    white-space: nowrap;
}

.batch-flow-badge-neutral {
    background: var(--surface-subtle);
    color: var(--text-soft);
}

.batch-flow-badge-warning {
    background: #fff3d6;
    color: #a16207;
}

.batch-flow-badge-success {
    background: #dcfce7;
    color: #15803d;
}

.batch-flow-badge-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.batch-flow-workspace.is-collapsed .batch-flow-sidebar-summary,
.batch-flow-workspace.is-collapsed .batch-flow-service-note-meta,
.batch-flow-workspace.is-collapsed .batch-flow-service-note-foot-copy {
    display: none;
}

.batch-flow-workspace.is-collapsed .batch-flow-sidebar-toggle {
    padding-inline: 0.55rem;
}

.batch-flow-workspace.is-collapsed .batch-flow-service-note {
    padding: 0.8rem 0.75rem;
}

.batch-flow-workspace.is-collapsed .batch-flow-service-note-top,
.batch-flow-workspace.is-collapsed .batch-flow-service-note-foot {
    flex-direction: column;
    align-items: flex-start;
}

.batch-flow-review-card {
    min-width: 0;
    overflow: hidden;
}

.batch-flow-review-body {
    min-height: 0;
    padding: 0;
    background: var(--surface-subtle);
}

.batch-flow-review-empty {
    min-height: 62vh;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.batch-flow-empty-card {
    width: min(100%, 560px);
    display: grid;
    gap: 0.6rem;
    padding: 1rem;
    border: 1px dashed var(--line-strong);
    border-radius: 18px;
    background: white;
    color: var(--text-soft);
}

.batch-flow-empty-card strong {
    color: var(--text-dark);
}

.batch-flow-footer {
    justify-content: space-between;
}

.batch-flow-footer-status {
    color: var(--text-soft);
    font-size: 0.84rem;
}

.batch-flow-footer-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.batch-workspace,
.service-note-review-layout,
.session-shell {
    display: grid;
    gap: 1rem;
}

.batch-workspace {
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    align-items: start;
}

.batch-list-panel,
.batch-review-panel,
.session-sidebar,
.session-review-panel,
.service-note-preview-pane,
.service-note-form-pane {
    min-width: 0;
}

.batch-review-panel,
.session-review-panel {
    padding: 0;
    overflow: hidden;
}

.batch-review-frame,
.session-review-frame {
    width: 100%;
    min-height: 72vh;
    border: 0;
}

.batch-service-note-item,
.session-service-note-item {
    width: 100%;
    display: grid;
    gap: 0.2rem;
    padding: 0.85rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-subtle);
    text-align: left;
    cursor: pointer;
}

.batch-service-note-item + .batch-service-note-item,
.session-service-note-item + .session-service-note-item {
    margin-top: 0.65rem;
}

.batch-service-note-item.is-active,
.session-service-note-item.is-active {
    border-color: var(--primary-soft-strong);
    background: var(--primary-soft);
}

.batch-service-note-item.is-disabled {
    opacity: 0.65;
}

.batch-service-note-name,
.session-service-note-name {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.batch-service-note-meta,
.session-service-note-state {
    color: var(--text-soft);
    font-size: 0.83rem;
}

.session-shell {
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
}

.session-meta,
.session-service-note-list {
    display: grid;
    gap: 0.75rem;
}

.service-note-review-shell {
    --service-note-preview-sticky-top: 72px;
    display: grid;
    gap: 1rem;
}

.service-note-review-banner {
    padding: 0.9rem 1rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
}

.service-note-review-layout {
    grid-template-columns: minmax(220px, 0.52fr) minmax(720px, 1.48fr);
    align-items: start;
}

.service-note-preview-pane,
.service-note-form-pane {
    position: relative;
    display: grid;
    gap: 0.8rem;
    padding: 0.95rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.service-note-review-shell.is-standalone-review .service-note-preview-pane {
    position: sticky;
    top: var(--service-note-preview-sticky-top);
    max-height: calc(100vh - var(--service-note-preview-sticky-top) - 1rem);
    overflow: auto;
    align-self: start;
    z-index: 5;
}

.service-note-pane-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.service-note-pane-header h2 {
    margin: 0;
    font-family: "Sora", "Manrope", sans-serif;
    font-size: 1rem;
}

.service-note-pane-subtitle {
    margin: 0.25rem 0 0;
    color: var(--text-soft);
    font-size: 0.84rem;
}

.service-note-review-shell .button-row {
    gap: 0.55rem;
}

.service-note-review-shell .form-grid {
    gap: 0.58rem;
}

.service-note-review-shell .field label {
    margin-bottom: 0.24rem;
    font-size: 0.78rem;
}

.service-note-review-shell input,
.service-note-review-shell select,
.service-note-review-shell textarea {
    padding: 0.56rem 0.62rem;
    border-radius: 10px;
    font-size: 0.89rem;
}

.service-note-review-shell textarea {
    min-height: 108px;
}

.service-note-review-shell .table-wrap {
    border-radius: 14px;
}

.service-note-review-shell .data-table {
    font-size: 0.9rem;
}

.service-note-review-shell .data-table th,
.service-note-review-shell .data-table td {
    padding: 0.38rem 0.32rem;
}

.service-note-review-shell .data-table thead th {
    font-size: 0.69rem;
    letter-spacing: 0.05em;
}

.service-note-review-shell #review-line-items-table input {
    padding: 0.42rem 0.46rem;
    font-size: 0.85rem;
}

.service-note-review-shell #review-line-items-table textarea {
    width: 100%;
    min-height: 42px;
    padding: 0.42rem 0.46rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    font-size: 0.85rem;
    line-height: 1.45;
    resize: vertical;
    overflow: hidden;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.service-note-review-shell #review-structured-table input,
.service-note-review-shell #review-structured-table select,
.service-note-review-shell #review-structured-table textarea {
    font-size: 0.85rem;
}

.service-note-review-shell #review-line-items-table .line-col-action {
    width: 10.25rem;
}

.service-note-review-shell #review-line-items-table .line-col-item-code {
    width: 10.5rem;
}

.service-note-review-shell #review-line-items-table .line-col-qty {
    width: 4.35rem;
}

.service-note-review-shell #review-line-items-table .line-col-uom {
    width: 4.6rem;
}

.service-note-review-shell #review-line-items-table .line-col-remarks {
    width: 8.75rem;
}

.service-note-review-shell #review-line-items-table .line-col-unit-price,
.service-note-review-shell #review-line-items-table .line-col-total {
    width: 6rem;
}

.service-note-review-shell #review-line-items-table .line-col-remove {
    width: 2.75rem;
}

.service-note-review-shell #review-structured-table .structured-col-type {
    width: 3.8rem;
}

.service-note-review-shell #review-structured-table .structured-col-sn {
    width: 8.25rem;
}

.service-note-review-shell #review-structured-table .structured-col-product-code {
    width: 10.5rem;
}

.service-note-review-shell #review-structured-table .structured-col-po {
    width: 9rem;
}

.service-note-review-shell #review-structured-table .structured-col-qty,
.service-note-review-shell #review-structured-table .structured-col-unit {
    width: 4.75rem;
}

.service-note-review-shell #review-structured-table .structured-col-unit-price,
.service-note-review-shell #review-structured-table .structured-col-total {
    width: 6.4rem;
}

.service-note-review-shell #review-structured-table .structured-col-actions {
    width: 4.8rem;
}

.service-note-review-shell .review-remove-line-btn {
    min-width: 32px;
    width: 32px;
    min-height: 32px;
    height: 32px;
    padding: 0;
    border-radius: 999px;
    font-size: 1.1rem;
    line-height: 1;
    display: inline-grid;
    place-items: center;
}

.item-master-field {
    position: relative;
    display: grid;
    gap: 0;
    min-width: 0;
}

.item-master-dropdown {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 5002;
    display: grid;
    gap: 0.2rem;
    max-height: 240px;
    overflow-y: auto;
    padding: 0.28rem;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

.item-master-dropdown[hidden] {
    display: none !important;
}

.item-master-option,
.item-master-dropdown-empty {
    display: grid;
    gap: 0.12rem;
    width: 100%;
    padding: 0.48rem 0.55rem;
    border-radius: 10px;
    text-align: left;
    font-size: 0.82rem;
}

.item-master-option {
    border: 0;
    background: transparent;
    cursor: pointer;
}

.item-master-option:hover,
.item-master-option:focus-visible {
    background: #f5f7ff;
    outline: none;
}

.item-master-dropdown-empty {
    color: var(--text-soft);
}

.item-master-option-meta {
    color: var(--text-soft);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.item-master-option-description {
    color: var(--text);
    font-weight: 600;
}

.customer-mapping-status {
    display: inline-flex;
    align-items: center;
    gap: 0.36rem;
    margin-top: 0.38rem;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.customer-mapping-status[hidden] {
    display: none !important;
}

.customer-mapping-status-icon {
    width: 0.82rem;
    height: 0.82rem;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
}

.customer-mapping-status-icon::before {
    content: "";
    width: 0.28rem;
    height: 0.46rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(40deg) translateY(-1px);
}

.customer-mapping-status.is-mapped {
    color: #15803d;
}

.customer-mapping-status.is-mapped .customer-mapping-status-icon {
    color: #fff;
    background: #16a34a;
}

.customer-mapping-status.is-unmapped {
    color: #6b7280;
}

.customer-mapping-status.is-unmapped .customer-mapping-status-icon {
    color: #9ca3af;
    background: #e5e7eb;
}

.customer-mapping-status.is-unmapped .customer-mapping-status-icon::before {
    width: 0.32rem;
    height: 0.32rem;
    border: 0;
    border-radius: 999px;
    background: currentColor;
    transform: none;
}

.review-structured-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.7rem;
}

.review-structured-hint,
.review-inline-note {
    color: var(--text-soft);
    font-size: 0.8rem;
}

.review-inline-note {
    padding: 0.56rem 0.62rem;
    border: 1px dashed var(--line-strong);
    border-radius: 10px;
    background: var(--surface-subtle);
}

.review-structured-table td {
    vertical-align: top;
}

.review-structured-table input,
.review-structured-table select,
.review-structured-table textarea {
    width: 100%;
    min-height: 38px;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
}

.review-structured-table input[readonly] {
    background: #fbfbff;
    color: var(--text-soft);
}

.review-structured-table textarea {
    min-height: 48px;
    line-height: 1.45;
    resize: vertical;
    overflow: hidden;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.review-structured-table textarea[readonly] {
    background: #fbfbff;
    color: var(--text-soft);
}

.review-structured-type-select {
    min-width: 0;
    font-weight: 600;
    text-align: center;
}

.service-note-review-shell #review-structured-table select.review-structured-type-select {
    padding: 0.24rem 0.08rem;
    text-align-last: center;
}

.review-structured-description-cell {
    display: block;
}

.review-structured-description-cell textarea {
    min-width: 240px;
}

.review-structured-actions-cell {
    white-space: nowrap;
}

.review-structured-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
    width: 100%;
}

.review-structured-insert-trigger,
.review-structured-row-actions-trigger {
    width: 34px;
    height: 34px;
}

.review-structured-empty-actions {
    display: flex;
    justify-content: center;
    margin-top: 0.8rem;
}

.review-structured-actions .button {
    min-width: 34px;
    width: 34px;
    min-height: 34px;
    height: 34px;
    padding: 0;
}

.review-structured-row-actions-menu {
    min-width: 0;
    display: inline-flex;
}

.review-structured-row-actions-dropdown {
    min-width: 9rem;
}

.review-structured-row-actions-dropdown .action-menu-link {
    min-height: 34px;
    padding: 0.54rem 0.66rem;
    font-size: 0.84rem;
}

.service-note-preview-tools {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.service-note-preview-view-btn {
    min-height: 34px;
    padding-inline: 0.9rem;
}

.service-note-preview-zoom-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.24rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-subtle);
}

.service-note-preview-zoom-btn {
    min-width: 32px;
    width: 32px;
    min-height: 32px;
    height: 32px;
    padding: 0;
    border-radius: 999px;
    font-size: 1rem;
    line-height: 1;
}

.service-note-preview-zoom-level {
    min-width: 3.6rem;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-soft);
}

.service-note-preview-image-modal-card {
    width: min(96vw, 980px);
    height: min(94vh, 920px);
    max-height: 94vh;
}

.service-note-preview-image-modal-filename {
    margin: 0.25rem 0 0;
    color: var(--text-soft);
    font-size: 0.85rem;
    word-break: break-word;
}

.service-note-preview-image-modal-body {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    min-height: 0;
    overflow: auto;
    padding: 1rem;
    background:
        linear-gradient(45deg, rgba(148, 163, 184, 0.14) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(148, 163, 184, 0.14) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.14) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.14) 75%);
    background-color: #f8fafc;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    background-size: 20px 20px;
    overscroll-behavior: contain;
}

.service-note-preview-image-modal-stage {
    width: max-content;
    min-width: 100%;
    height: max-content;
    min-height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.service-note-preview-image-modal-stage img {
    width: auto;
    max-width: none;
    max-height: none;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 20px 44px rgba(23, 23, 43, 0.18);
}

.service-note-preview-image-modal-footer,
.service-note-preview-image-modal-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.service-note-preview-frame {
    position: relative;
    min-height: 52vh;
    max-height: 66vh;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fafafe;
}

.service-note-preview-frame-zoomable {
    overflow: auto;
    overscroll-behavior: contain;
}

.service-note-preview-frame iframe,
.service-note-preview-frame img {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.service-note-preview-image-stage {
    --preview-zoom: 1;
    min-height: 100%;
    padding: 0.65rem;
}

.service-note-preview-image-stage img {
    width: calc(100% * var(--preview-zoom));
    max-width: none;
    height: auto;
    object-fit: unset;
    border-radius: 12px;
}

@media (max-width: 900px) {
    .review-structured-description-cell input {
        min-width: 180px;
    }
}

.ocr-status-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(2px);
    border-radius: 18px;
    overflow: hidden;
}

.ocr-status-overlay[hidden] {
    display: none;
}

.scanner-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, transparent, var(--primary), transparent);
    box-shadow: 0 0 15px var(--primary);
    animation: scan 2.5s ease-in-out infinite;
}

@keyframes scan {
    0% {
        top: 0;
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        top: 100%;
        opacity: 0;
    }
}

.status-steps {
    width: 90%;
    max-width: 320px;
    display: grid;
    gap: 0.7rem;
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

.status-step {
    padding: 0.8rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-soft);
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.status-step.active {
    color: var(--primary);
    transform: translateX(4px);
}

.status-step.active span::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
    display: inline-block;
    width: 1.5em;
    text-align: left;
}

@keyframes dots {
    0%,
    20% {
        content: '';
    }

    40% {
        content: '.';
    }

    60% {
        content: '..';
    }

    80%,
    100% {
        content: '...';
    }
}

.status-step.completed {
    color: #10b981;
}

.step-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.status-icon-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 1rem;
    line-height: 1;
}

.inline-review-body {
    margin: 0;
    padding: 1rem;
    background: var(--bg);
    color: var(--text);
    font-family: "Manrope", "Helvetica Neue", sans-serif;
    font-size: 14px;
}

.inline-review-body .service-note-review-layout {
    grid-template-columns: minmax(210px, 0.34fr) minmax(0, 1.66fr);
    align-items: start;
}

.inline-review-body .service-note-preview-pane {
    position: sticky;
    top: 1.25rem;
    max-height: calc(100vh - 2.5rem);
    overflow: auto;
    align-self: start;
    z-index: 3;
}

.inline-review-body .service-note-preview-frame {
    min-height: 50vh;
    max-height: 62vh;
}

.inline-review-body .service-note-form-pane {
    min-width: 0;
}

.inline-review-body .service-note-preview-pane,
.inline-review-body .service-note-form-pane {
    padding: 0.72rem;
    gap: 0.58rem;
}

.inline-review-body .service-note-pane-header h2 {
    font-size: 0.92rem;
}

.inline-review-body .service-note-pane-subtitle,
.inline-review-body .review-structured-hint,
.inline-review-body .review-inline-note {
    font-size: 0.74rem;
}

.inline-review-body .service-note-review-shell .field label {
    font-size: 0.71rem;
}

.inline-review-body .service-note-review-shell input,
.inline-review-body .service-note-review-shell select,
.inline-review-body .service-note-review-shell textarea {
    padding: 0.4rem 0.48rem;
    border-radius: 9px;
    font-size: 0.78rem;
}

.inline-review-body .service-note-review-shell textarea {
    min-height: 92px;
}

.inline-review-body .service-note-review-shell .button-row {
    gap: 0.38rem;
}

.inline-review-body .service-note-review-shell .button-row .button {
    font-size: 0.76rem;
    padding: 0.42rem 0.62rem;
}

.inline-review-body .service-note-review-shell .data-table {
    font-size: 0.78rem;
}

.inline-review-body .service-note-review-shell .data-table th,
.inline-review-body .service-note-review-shell .data-table td {
    padding: 0.24rem 0.18rem;
}

.inline-review-body .service-note-review-shell .data-table thead th {
    font-size: 0.66rem;
}

.inline-review-body .service-note-review-shell #review-structured-table input,
.inline-review-body .service-note-review-shell #review-structured-table select,
.inline-review-body .service-note-review-shell #review-structured-table textarea {
    min-height: 30px;
    padding: 0.28rem 0.38rem;
    font-size: 0.76rem;
    border-radius: 10px;
}

.inline-review-body .service-note-review-shell #review-structured-table textarea {
    min-height: 34px;
}

.inline-review-body .service-note-review-shell #review-structured-table .structured-col-type {
    width: 6.35rem;
}

.inline-review-body .service-note-review-shell #review-structured-table .structured-col-sn {
    width: 6.4rem;
}

.inline-review-body .service-note-review-shell #review-structured-table .structured-col-product-code {
    width: 6.6rem;
}

.inline-review-body .service-note-review-shell #review-structured-table .structured-col-po {
    width: 12rem;
}

.inline-review-body .service-note-review-shell #review-structured-table .structured-col-qty,
.inline-review-body .service-note-review-shell #review-structured-table .structured-col-unit {
    width: 3rem;
}

.inline-review-body .service-note-review-shell #review-structured-table .structured-col-unit-price,
.inline-review-body .service-note-review-shell #review-structured-table .structured-col-total {
    width: 4rem;
}

.inline-review-body .service-note-review-shell #review-structured-table .structured-col-actions {
    width: 5.2rem;
}

.inline-review-body .review-structured-type-select {
    min-width: 0;
    font-size: 0.74rem;
    font-weight: 600;
}

.inline-review-body.is-batch-sidebar-collapsed .service-note-review-layout {
    grid-template-columns: minmax(270px, 0.5fr) minmax(0, 1.5fr);
}

.inline-review-body.is-batch-sidebar-collapsed .service-note-preview-pane,
.inline-review-body.is-batch-sidebar-collapsed .service-note-form-pane {
    padding: 0.58rem;
}

.inline-review-body.is-batch-sidebar-collapsed .service-note-review-shell #review-structured-table .structured-col-type {
    width: 3.45rem;
}

.inline-review-body.is-batch-sidebar-collapsed .service-note-review-shell #review-structured-table .structured-col-sn {
    width: 5.75rem;
}

.inline-review-body.is-batch-sidebar-collapsed .service-note-review-shell #review-structured-table .structured-col-product-code {
    width: 5.8rem;
}

.inline-review-body.is-batch-sidebar-collapsed .service-note-review-shell #review-structured-table .structured-col-po {
    width: 8rem;
}

.inline-review-body.is-batch-sidebar-collapsed .service-note-review-shell #review-structured-table .structured-col-qty,
.inline-review-body.is-batch-sidebar-collapsed .service-note-review-shell #review-structured-table .structured-col-unit {
    width: 2.65rem;
}

.inline-review-body.is-batch-sidebar-collapsed .service-note-review-shell #review-structured-table .structured-col-unit-price,
.inline-review-body.is-batch-sidebar-collapsed .service-note-review-shell #review-structured-table .structured-col-total {
    width: 3.45rem;
}

.inline-review-body.is-batch-sidebar-collapsed .service-note-review-shell #review-structured-table .structured-col-actions {
    width: 4.45rem;
}

.inline-review-body.is-batch-sidebar-collapsed .service-note-review-shell #review-structured-table input,
.inline-review-body.is-batch-sidebar-collapsed .service-note-review-shell #review-structured-table select,
.inline-review-body.is-batch-sidebar-collapsed .service-note-review-shell #review-structured-table textarea {
    padding: 0.24rem 0.3rem;
    font-size: 0.72rem;
}

.inline-review-body.is-batch-sidebar-collapsed .review-structured-type-select {
    padding-inline: 0.08rem;
}

.inline-review-body.is-batch-sidebar-collapsed .service-note-review-shell #review-structured-table select.review-structured-type-select {
    padding: 0.18rem 0.04rem;
}

.inline-review-body .review-structured-description-cell textarea {
    min-width: 0;
}

.inline-review-body .review-structured-actions {
    gap: 0.18rem;
}

.inline-review-body .review-structured-insert-trigger,
.inline-review-body .review-structured-row-actions-trigger,
.inline-review-body .review-structured-actions .button {
    min-width: 22px;
    width: 22px;
    min-height: 22px;
    height: 22px;
    padding: 0;
    border-radius: 7px;
    font-size: 0.66rem;
}

.inline-review-body .action-menu-trigger-glyph {
    font-size: 0.82rem;
}

.auth-body {
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.auth-shell {
    width: min(100%, 440px);
}

.auth-card {
    display: grid;
    gap: 1.5rem;
    padding: 2rem;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.auth-title {
    margin: 0;
    font-family: "Sora", "Manrope", sans-serif;
    font-size: 1.5rem;
    letter-spacing: -0.03em;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@media (max-width: 1100px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        gap: 1rem;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .sidebar-nav {
        grid-auto-flow: column;
        grid-auto-columns: max-content;
        overflow-x: auto;
        padding-bottom: 0.25rem;
    }

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .module-summary-grid,
    .filters-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid,
    .workspace-grid,
    .workspace-grid-wide,
    .review-grid,
    .session-shell,
    .service-note-review-layout,
    .batch-workspace {
        grid-template-columns: 1fr;
    }

    .service-note-preview-pane {
        position: relative;
        top: auto;
        max-height: none;
        overflow: visible;
    }

    .invoice-print-header,
    .invoice-print-party-grid {
        grid-template-columns: 1fr;
    }

    .invoice-header-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .invoice-header-field-customer,
    .invoice-header-field-address {
        grid-column: 1 / -1;
    }

    .invoice-header-field-currency,
    .invoice-header-field-invoice-number,
    .invoice-header-field-reference,
    .invoice-header-field-service-note,
    .invoice-header-field-invoice-date,
    .invoice-header-field-payment-terms {
        grid-column: auto;
    }

    .invoice-builder-row-summary,
    .invoice-builder-row-grid-inline-header,
    .invoice-builder-row-grid-inline-line,
    .invoice-builder-row-grid-inline-separator {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1280px) {
    .invoice-show-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .invoice-preview-modal-shell {
        padding-left: 0;
    }

    .invoice-preview-modal-card,
    .invoice-preview-modal-drawer {
        width: min(100vw, 100%);
        border-radius: 0;
    }

    .invoice-editor-totals-bar,
    body.sidebar-collapsed .invoice-editor-totals-bar {
        left: 0;
        right: 0;
        bottom: 0;
        padding: 0.4rem 1rem max(0.4rem, env(safe-area-inset-bottom));
    }

    .app-content,
    .app-sidebar {
        padding: 1rem;
    }

    .page-header,
    .panel-header,
    .panel-header-actions,
    .service-note-pane-header,
    .workflow-modal-header,
    .workflow-modal-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .invoice-header-grid {
        grid-template-columns: 1fr;
    }

    .invoice-header-field-customer,
    .invoice-header-field-currency,
    .invoice-header-field-invoice-number,
    .invoice-header-field-reference,
    .invoice-header-field-service-note,
    .invoice-header-field-address,
    .invoice-header-field-invoice-date,
    .invoice-header-field-payment-terms {
        grid-column: auto;
    }

    .page-actions,
    .button-row,
    .page-header-right,
    .user-profile,
    .form-footer,
    .action-stack {
        width: 100%;
    }

    .page-actions .button,
    .page-actions .inline-action-form,
    .page-actions .inline-action-form .button,
    .page-header-right .button,
    .user-profile .button,
    .button-row .button,
    .button-row form,
    .button-row form button,
    .action-stack form,
    .action-stack form button,
    .workflow-modal-footer .button {
        width: 100%;
    }

    .metric-grid,
    .dashboard-grid,
    .form-grid,
    .module-summary-grid,
    .filters-bar {
        grid-template-columns: 1fr;
    }

    .invoice-builder-row-head-left,
    .invoice-builder-row-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .invoice-builder-row-summary,
    .invoice-builder-row-grid-inline-header,
    .invoice-builder-row-grid-inline-line,
    .invoice-builder-row-grid-inline-separator {
        grid-template-columns: 1fr;
    }

    .invoice-builder-row-summary-cell,
    .invoice-builder-row-summary-cell-short,
    .invoice-builder-row-summary-cell-money {
        text-align: left;
    }

    .filter-actions,
    .pager {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-actions .button,
    .pager .button {
        width: 100%;
    }

    .workflow-modal {
        padding: 1rem;
    }

    .workflow-modal-body {
        padding: 1rem;
    }

    .batch-flow-setup,
    .batch-flow-workspace,
    .batch-flow-workspace.has-review,
    .batch-flow-results-shell,
    .batch-flow-results-shell.is-reviewing {
        grid-template-columns: 1fr;
    }

    .batch-flow-workspace.is-collapsed,
    .batch-flow-workspace.is-collapsed.has-review {
        grid-template-columns: 1fr;
    }

    .batch-flow-sidebar,
    .batch-flow-review-card,
    .batch-flow-review-empty,
    .batch-review-frame,
    .session-review-frame {
        min-height: 56vh;
    }

    .batch-flow-window-actions,
    .batch-flow-summary-bar,
    .batch-flow-footer,
    .batch-flow-footer-actions {
        align-items: stretch;
    }

    .batch-flow-window-actions,
    .batch-flow-footer-actions {
        width: 100%;
        justify-content: stretch;
    }

    .batch-flow-files-table-wrap {
        overflow-x: auto;
    }

    .batch-flow-window-actions > *,
    .batch-flow-footer-actions > * {
        flex: 1 1 auto;
    }

    .batch-flow-file-row {
        grid-template-columns: 1fr;
    }

    .service-note-preview-frame,
    .batch-review-frame,
    .session-review-frame {
        min-height: 56vh;
    }

    .invoice-print-page-shell {
        padding: 1rem;
    }

    .invoice-print-toolbar {
        justify-content: stretch;
    }

    .invoice-print-toolbar .button,
    .invoice-print-toolbar button {
        width: 100%;
    }

    .invoice-print-sheet {
        min-width: 0;
        padding: 1.2rem;
    }
}

@media print {
    html,
    body.invoice-print-page {
        background: #fff;
    }

    .invoice-print-toolbar {
        display: none !important;
    }

    .invoice-print-page-shell {
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .invoice-print-sheet {
        min-width: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
}
