:root {
    --bg: #f3f4f6;
    --panel: #ffffff;
    --panel-alt: #f8fafc;
    --ink: #111827;
    --muted: #6b7280;
    --line: #d1d5db;
    --line-strong: #9ca3af;
    --brand: #0f766e;
    --brand-dark: #134e4a;
    --danger: #b91c1c;
    --danger-bg: #fee2e2;
    --success-bg: #dcfce7;
    --success-ink: #166534;
    --font: "IBM Plex Sans", "Avenir Next", "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(15, 118, 110, 0.04), transparent 220px),
        linear-gradient(90deg, rgba(17, 24, 39, 0.03) 1px, transparent 1px),
        linear-gradient(rgba(17, 24, 39, 0.03) 1px, transparent 1px),
        var(--bg);
    background-size: auto, 28px 28px, 28px 28px, auto;
    color: var(--ink);
    font-family: var(--font);
}

body.has-modal {
    overflow: hidden;
}

body.has-nav {
    overflow: hidden;
}

[hidden] {
    display: none !important;
}

a {
    color: inherit;
    text-decoration: none;
}

p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

ul {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

small {
    color: var(--muted);
}

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

button {
    cursor: pointer;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    outline: none;
    border-radius: 0;
}

input[type="date"],
input[type="time"] {
    appearance: none;
    -webkit-appearance: none;
    min-width: 0;
    max-width: 100%;
    line-height: 1.25;
}

input[type="date"]::-webkit-date-and-time-value,
input[type="time"]::-webkit-date-and-time-value {
    text-align: left;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    margin: 0 2px 0 10px;
}

select {
    appearance: none;
    padding-right: 46px;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position:
        calc(100% - 22px) calc(50% - 3px),
        calc(100% - 16px) calc(50% - 3px);
    background-size: 6px 6px;
    background-repeat: no-repeat;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand);
}

textarea {
    min-height: 96px;
    resize: vertical;
}

input,
select,
.primary-button,
.ghost-button,
.danger-button {
    min-height: 50px;
}

.shell {
    max-width: 1240px;
    margin: 0 auto;
    padding: 20px 24px 56px;
}

.shell-guest {
    max-width: none;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 0 18px;
    border-bottom: 1px solid var(--line);
}

.topbar-left,
.topbar-actions,
.head-actions,
.button-row,
.form-links,
.section-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.nav-toggle {
    display: none;
    gap: 10px;
}

.company-chip,
.pill,
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
    font-size: 0.85rem;
}

.company-chip strong,
.pill,
.status-badge {
    font-weight: 600;
}

.company-chip small {
    color: var(--muted);
}

.main-nav {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
}

.main-nav-head {
    display: none;
}

.nav-toggle-icon {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
}

.nav-toggle-icon span {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
}

.nav-toggle-label {
    white-space: nowrap;
}

.main-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid transparent;
    color: var(--muted);
    font-weight: 600;
}

.main-nav a:hover,
.main-nav a.active {
    border-color: var(--line);
    background: var(--panel);
    color: var(--ink);
}

.page {
    padding-top: 24px;
}

.shell-guest .page {
    width: 100%;
    padding-top: 0;
}

.page-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.page-head p {
    max-width: 620px;
}

.page-head-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.eyebrow {
    display: none;
    margin-bottom: 8px;
    color: var(--brand);
    font-size: 0.77rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.grid {
    display: grid;
    gap: 18px;
}

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

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

.card,
.metric-card,
.hero-card {
    border: 1px solid var(--line);
    background: var(--panel);
    padding: 20px;
}

.card-muted {
    background: var(--panel-alt);
}

.hero-card {
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(17, 24, 39, 0.05)),
        var(--panel);
}

.hero-card p {
    max-width: 52ch;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric-card span {
    display: block;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 0.88rem;
}

.metric-card strong {
    display: block;
    font-size: 1.65rem;
}

.auth-wrap {
    width: min(460px, 100%);
    margin: 0 auto;
}

.narrow {
    max-width: 760px;
    margin: 0 auto;
}

.stack,
.form-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.inline-form {
    display: inline-flex;
}

label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--ink);
    font-weight: 600;
}

.primary-button,
.ghost-button,
.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
    font-weight: 600;
    white-space: nowrap;
}

.page-head .ghost-button,
.page-head .inline-form .ghost-button {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
}

.page-head .ghost-button:hover,
.page-head .inline-form .ghost-button:hover {
    background: var(--brand-dark);
}

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

.primary-button:hover {
    background: var(--brand-dark);
}

.ghost-button:hover {
    border-color: var(--line-strong);
}

.danger-button {
    border-color: #fecaca;
    background: var(--danger-bg);
    color: var(--danger);
}

.flash {
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    background: var(--panel);
}

.flash-success {
    border-color: #bbf7d0;
    background: var(--success-bg);
    color: var(--success-ink);
}

.flash-error {
    border-color: #fecaca;
    background: var(--danger-bg);
    color: #991b1b;
}

.section-head,
.list-row,
.summary-rows div,
.invoice-overview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.section-head {
    margin-bottom: 16px;
}

.card > h2 {
    margin-bottom: 16px;
}

.summary-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.summary-rows strong {
    font-size: 1rem;
}

.list-row,
.notification,
.table-card-row {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.list-row:last-child,
.notification:last-child,
.table-card-row:last-child {
    border-bottom: none;
}

.align-right {
    text-align: right;
}

.subtle-panel,
.status-panel {
    padding: 16px;
    border: 1px solid var(--line);
    background: var(--panel-alt);
}

.status-panel {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.notification {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.data-table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
}

.trial-balance-wrap {
    overflow-x: visible;
}

.trial-balance-table {
    min-width: 0;
    table-layout: fixed;
}

.trial-balance-table th:nth-child(2),
.trial-balance-table th:nth-child(3),
.trial-balance-table td:nth-child(2),
.trial-balance-table td:nth-child(3) {
    width: 140px;
}

.data-table th,
.data-table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.data-table th {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.line-item-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.line-item-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.invoice-form-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.invoice-form-shell {
    gap: 20px;
}

.invoice-meta-grid,
.invoice-payment-grid {
    gap: 12px;
}

.invoice-meta-grid {
    width: 100%;
    max-width: none;
}

.invoice-section-head {
    align-items: center;
}

.invoice-line-item {
    border: 1px solid var(--line);
    background: var(--panel);
}

.invoice-line-main {
    display: grid;
    grid-template-columns: minmax(0, 2fr) repeat(3, minmax(96px, 0.72fr)) minmax(118px, 0.9fr) 32px;
    gap: 10px;
    align-items: center;
    padding: 16px;
}

.line-item-field {
    min-width: 0;
}

.line-item-field-item {
    min-width: 0;
}

.line-item-total-box {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 50px;
    width: 100%;
    padding: 0 14px;
    border: 1px solid var(--line);
    background: var(--panel-alt);
}

.line-item-total-box span {
    font-size: 1rem;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
    text-align: left;
}

.line-item-remove-icon {
    width: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    font-size: 1.4rem;
    line-height: 1;
}

.line-item-remove-icon:hover {
    color: var(--danger);
}

.form-accordion {
    border: 1px solid var(--line);
    background: var(--panel);
}

.form-accordion summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}

.form-accordion summary::-webkit-details-marker {
    display: none;
}

.form-accordion summary::after {
    content: '+';
    color: var(--brand);
    font-size: 1.1rem;
    line-height: 1;
}

.form-accordion[open] summary::after {
    content: '\2212';
}

.form-accordion-light {
    border-top: 1px solid var(--line);
    border-right: none;
    border-bottom: none;
    border-left: none;
    background: transparent;
}

.accordion-field {
    padding: 0 16px 16px;
}

.accordion-field-tight {
    padding-top: 4px;
}

.invoice-line-description summary {
    padding: 12px 16px 10px;
}

.invoice-summary-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px;
}

.invoice-summary-head {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.invoice-summary-rows strong {
    font-variant-numeric: tabular-nums;
}

.payment-accordion {
    background: var(--panel);
}

.invoice-payment-grid {
    padding: 0 16px 16px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.payment-notes-field {
    grid-column: 1 / -1;
}

.page-search-actions {
    width: auto;
    max-width: 100%;
    flex: 1 1 auto;
    flex-wrap: wrap;
    justify-content: end;
}

.search-field {
    display: block;
    width: min(280px, 100%);
}

.search-field-wide {
    width: min(360px, 100%);
}

.search-field input {
    background: var(--panel);
}

.table-title-with-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.list-row-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.record-actions-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
}

.ledger-metric-grid {
    margin-bottom: 18px;
}

.ledger-contact-list {
    gap: 0;
}

.ledger-contact-card {
    align-items: stretch;
}

.ledger-contact-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    width: 100%;
}

.ledger-contact-copy {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.ledger-link {
    transition: color 0.2s ease;
}

.ledger-link:hover {
    color: var(--brand);
}

.ledger-contact-stats {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    width: min(180px, 100%);
}

.ledger-page-head {
    align-items: center;
}

.ledger-page-head .ledger-head-actions {
    margin-left: auto;
    justify-content: flex-end;
    width: 100%;
}

.ledger-head-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.ledger-hero {
    margin-bottom: 18px;
    padding: 22px;
}

.ledger-hero-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.ledger-party-block {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    min-height: 110px;
}

.ledger-party-title {
    display: flex;
    align-items: end;
    gap: 12px;
    flex-wrap: wrap;
}

.ledger-hero-main h2 {
    font-size: 1.65rem;
    margin: 0;
}

.ledger-balance-card {
    min-width: 220px;
    padding: 18px;
    border: 1px solid var(--line);
    background: var(--panel-alt);
    text-align: right;
}

.ledger-balance-card small,
.ledger-entry-cell small {
    display: block;
    margin-top: 6px;
}

.ledger-balance-card strong {
    display: block;
    margin: 8px 0 6px;
    font-size: 1.55rem;
}

.ledger-balance-card span {
    color: var(--muted);
    font-weight: 600;
}

.ledger-table-card {
    padding-top: 18px;
}

.ledger-table td:last-child strong {
    display: block;
}

.ledger-entry-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ledger-entry-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 5px 10px;
    border: 1px solid var(--line);
    background: var(--panel-alt);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ledger-entry-badge.is-positive {
    border-color: rgba(15, 118, 110, 0.22);
    color: var(--brand);
    background: rgba(15, 118, 110, 0.08);
}

.ledger-entry-badge.is-negative {
    border-color: rgba(30, 64, 175, 0.18);
    color: #1d4ed8;
    background: rgba(59, 130, 246, 0.08);
}

.icon-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.icon-actions form {
    margin: 0;
}

.icon-actions-table {
    justify-content: flex-end;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    min-width: 34px;
    min-height: 34px;
    padding: 0;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
    font-size: 0.95rem;
}

.icon-button:hover {
    border-color: var(--line-strong);
}

.icon-button-danger {
    color: var(--danger);
}

.empty-search-state {
    margin-top: 14px;
    color: var(--muted);
}

.line-row {
    display: grid;
    grid-template-columns: 1.2fr 1.8fr repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.checkbox {
    display: flex;
    gap: 12px;
    align-items: center;
}

.checkbox input {
    width: 18px;
    height: 18px;
    margin: 0;
}

.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 4px;
}

.bar {
    display: grid;
    grid-template-columns: 1fr 120px;
    gap: 14px;
    align-items: center;
}

.bar-track {
    margin-top: 6px;
    height: 10px;
    background: #e5e7eb;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand), #22c55e);
}

.section-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
}

.list-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
}

.list-card:last-child {
    border-bottom: none;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: calc(24px + env(safe-area-inset-top, 0px)) calc(24px + env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) calc(24px + env(safe-area-inset-left, 0px));
    background: rgba(17, 24, 39, 0.6);
    overflow: auto;
}

.modal[hidden] {
    display: none;
}

.modal-panel {
    width: min(820px, 100%);
    max-width: 100%;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 48px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    border: 1px solid var(--line);
    background: var(--panel);
    padding: 22px;
}

.modal-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.mobile-only {
    display: none;
}

.desktop-only {
    display: flex;
}

.nav-overlay {
    display: none;
}

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

.logo-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 88px;
    height: 88px;
    border: 1px solid var(--line);
    background: var(--panel-alt);
    overflow: hidden;
}

.logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.settings-team-card .section-head {
    align-items: flex-start;
}

.settings-team-card .section-head > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.settings-team-action,
.settings-team-action .primary-button {
    width: 100%;
}

.settings-shell {
    width: 100%;
}

.settings-form-grid .full-span {
    grid-column: 1 / -1;
}

.dashboard-actions {
    width: auto;
}

.invoice-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.invoice-brand-mark {
    width: 52px;
    height: 52px;
    border: 1px solid var(--line);
    background: var(--panel-alt);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

@media (max-width: 980px) {
    .shell {
        padding: 12px 14px 40px;
    }

    .auth-wrap,
    .grid.two,
    .metric-grid,
    .grid-form,
    .modal-form-grid,
    .page-head,
    .section-head,
    .list-row,
    .summary-rows div,
    .invoice-overview {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }

    .topbar {
        display: grid;
        grid-template-columns: auto 1fr;
        align-items: start;
        padding-bottom: 12px;
    }

    .form-links {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .head-actions:not(.page-search-actions):not(.topbar-actions),
    .button-row,
    .section-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        align-items: stretch;
    }

    .head-actions:not(.page-search-actions):not(.topbar-actions) > *,
    .button-row > *,
    .section-actions > * {
        width: 100%;
        min-width: 0;
    }

    .head-actions:not(.page-search-actions):not(.topbar-actions) > :only-child,
    .button-row > :only-child,
    .section-actions > :only-child {
        grid-column: 1 / -1;
    }

    .topbar-left {
        display: contents;
    }

    .topbar-actions {
        width: 100%;
        flex-direction: row;
        align-items: flex-start;
        justify-content: flex-end;
        grid-column: 2;
        grid-row: 1;
    }

    .topbar-actions form {
        width: auto;
    }

    .company-chip {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
    }

    .nav-toggle,
    .mobile-only {
        display: inline-flex;
    }

    .desktop-only {
        display: none !important;
    }

    .nav-toggle {
        justify-self: start;
        align-self: start;
        grid-column: 1;
        grid-row: 1;
    }

    .nav-toggle-label,
    .main-nav-head strong {
        display: none;
    }

    .main-nav {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 60;
        width: min(280px, calc(100vw - 44px));
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 0;
        margin: 0;
        padding: 18px 14px;
        background: var(--panel);
        border-right: 1px solid var(--line);
        transform: translateX(-110%);
        transition: transform 0.2s ease;
        box-shadow: 0 0 0 rgba(17, 24, 39, 0);
    }

    .main-nav-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 10px;
    }

    .main-nav a {
        min-height: 48px;
        padding: 0 12px;
        border-bottom: 1px solid var(--line);
    }

    .shell.menu-open .main-nav {
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(17, 24, 39, 0.18);
    }

    .nav-overlay {
        position: fixed;
        inset: 0;
        z-index: 55;
        display: block;
        background: rgba(17, 24, 39, 0.45);
    }

    .metric-card strong {
        font-size: 1.4rem;
    }

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

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

    .data-table {
        min-width: 560px;
    }

    .trial-balance-wrap {
        overflow-x: visible;
    }

    .trial-balance-table {
        min-width: 0;
    }

    .trial-balance-table th,
    .trial-balance-table td {
        padding: 12px 10px;
        font-size: 0.92rem;
    }

    .modal {
        align-items: center;
        padding: calc(12px + env(safe-area-inset-top, 0px)) calc(12px + env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) calc(12px + env(safe-area-inset-left, 0px));
    }

    .modal-panel {
        width: 100%;
        max-width: 100%;
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 24px);
        padding: 18px;
    }

    .line-row,
    .invoice-meta-grid,
    .invoice-line-main,
    .invoice-payment-grid {
        grid-template-columns: 1fr;
    }

    .invoice-line-main {
        align-items: stretch;
    }

    .page-search-actions,
    .search-field {
        width: 100%;
    }

    .page-head-tools,
    .bills-page-tools,
    .payments-page-tools {
        width: 100%;
        margin-left: 0;
        flex-direction: column;
        align-items: stretch;
    }

    .search-field-wide {
        width: 100%;
    }

    .bills-action-grid {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .bills-action-grid > * {
        width: 100%;
    }

    .payments-action-stack {
        width: 100%;
        display: flex;
        flex-direction: column;
    }

    .payments-action-stack > * {
        width: 100%;
    }

    .ledger-index-tools,
    .stock-page-tools {
        width: 100%;
        margin-left: 0;
        flex-direction: column;
        align-items: stretch;
    }

    .ledger-index-action,
    .stock-action-stack {
        width: 100%;
        display: flex;
        flex-direction: column;
    }

    .ledger-index-action > *,
    .stock-action-stack > * {
        width: 100%;
    }

    .ledger-hero-main,
    .ledger-contact-main,
    .ledger-contact-stats,
    .record-actions-wrap,
    .list-row-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .icon-actions {
        justify-content: flex-end;
    }

    .invoice-meta-grid {
        max-width: none;
    }

    .line-item-remove-icon {
        justify-self: end;
    }

    .ledger-balance-card {
        min-width: 0;
        text-align: left;
    }

    .ledger-party-block {
        min-height: 0;
    }

    .ledger-page-head {
        align-items: stretch;
    }

    .ledger-page-head .ledger-head-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        justify-content: stretch;
        align-items: stretch;
    }

    .ledger-page-head .ledger-head-actions > * {
        width: 100%;
    }

    #inventory-list,
    #contacts-list,
    #payments-list {
        overflow-x: auto;
        gap: 12px;
    }

    #inventory-list .list-row-actions,
    #contacts-list .ledger-contact-card,
    #payments-list .list-row-actions {
        min-width: 560px;
        flex-direction: row;
        align-items: center;
    }

    #inventory-list .record-actions-wrap,
    #contacts-list .record-actions-wrap,
    #payments-list .record-actions-wrap,
    #contacts-list .ledger-contact-main,
    #contacts-list .ledger-contact-stats {
        width: auto;
        flex-direction: row;
        align-items: center;
    }

    #inventory-list .align-right,
    #payments-list .align-right,
    #contacts-list .ledger-contact-stats .align-right {
        min-width: 96px;
    }

    .settings-shell {
        max-width: none;
    }
}

@media (min-width: 981px) {
    .nav-toggle,
    .mobile-only,
    .nav-overlay {
        display: none !important;
    }
}
