:root {
    --bg: #09152b;
    --text: #f4f7fb;
    --muted: #96a9c6;
    --accent: #39b8ff;
    --accent-2: #1e90ff;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
    --shadow-soft: 0 10px 26px rgba(0, 0, 0, 0.16);
    --radius: 18px;
    --radius-sm: 14px;
    --sidebar-width: 270px;
    --field-bg: #101d35;
    --field-bg-hover: #12213b;
    --field-border: #2a3f61;
    --field-border-focus: rgba(57, 184, 255, 0.7);
    --panel-border: rgba(255, 255, 255, 0.07);
    --panel-border-soft: rgba(255, 255, 255, 0.05);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--accent);
    text-decoration: none;
    text-underline-offset: 0.18em;
    transition: color 0.12s ease;
}

a:hover,
a:focus-visible {
    color: #8ddcff;
    text-decoration: underline;
}

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

input,
select,
textarea {
    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        background-color 0.18s ease,
        color 0.18s ease;
}

button {
    transition:
        transform 0.14s ease,
        box-shadow 0.18s ease,
        background 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease;
}

::placeholder {
    color: var(--muted);
    opacity: 0.9;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    background: linear-gradient(180deg, #081327 0%, #0a1830 100%);
}

.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: rgba(3, 10, 24, 0.94);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    position: sticky;
    top: 0;
}

.sidebar-brand {
    padding: 0.15rem 0.25rem 1rem;
    margin-bottom: 0.65rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    min-height: 64px;
}

.sidebar-brand-logo {
    display: block;
    width: 100%;
    height: auto;
    max-height: 90px;
    object-fit: contain;
    object-position: left center;
}

.sidebar-brand-text {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    line-height: 1.15;
}

.sidebar-business-name {
    margin-top: 0.4rem;
    padding-left: 0.1rem;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    line-height: 1.35;
}

.sidebar-search {
    padding: 0 0.25rem 1.25rem;
}

.sidebar-search input {
    width: 100%;
    border: 1px solid var(--field-border);
    background: var(--field-bg);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.sidebar-search input:hover {
    background: var(--field-bg-hover);
}

.sidebar-search input:focus {
    border-color: var(--field-border-focus);
    box-shadow: 0 0 0 4px rgba(57, 184, 255, 0.12);
}

.sidebar-search input::placeholder {
    color: var(--muted);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.sidebar-section-label {
    color: var(--muted);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    padding: 1rem 0.5rem 0.45rem;
}

.sidebar-link {
    display: block;
    padding: 0.9rem 0.95rem;
    border-radius: 14px;
    color: #d8e3f3;
    transition: background 0.18s ease, color 0.18s ease;
}

.sidebar-link:hover {
    background: rgba(57, 184, 255, 0.1);
    color: #ffffff;
}

.sidebar-logout-form {
    margin: 0;
}

.sidebar-logout-button {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.sidebar-link-active,
.sidebar-link-active:hover,
.sidebar-link-active:focus-visible {
    background: rgba(57, 184, 255, 0.16);
    color: #ffffff;
    box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-footer {
    margin-top: auto;
    padding: 1.25rem 0.5rem 0.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-powered-by {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    line-height: 1.35;
}

.sidebar-powered-label {
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.sidebar-powered-name {
    color: #d8e3f3;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.sidebar-version {
    display: block;
    margin-top: 4px;
    font-size: 0.72rem;
    color: var(--muted);
    opacity: 0.75;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: 0;
    color: var(--text);
    font-size: 1.4rem;
    margin: 0 0 0.5rem;
    padding: 0;
    cursor: pointer;
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 2rem 2rem 1rem;
}

.topbar-eyebrow {
    margin: 0 0 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.72rem;
    color: var(--accent);
    font-weight: 700;
}

.topbar-title {
    margin: 0;
    font-size: 2.3rem;
    line-height: 1.05;
    letter-spacing: -0.04em;
}

.topbar-actions {
    display: flex;
    align-items: center;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    padding: 0.85rem 1.2rem;
    font-weight: 700;
    border: 1px solid transparent;
    cursor: pointer;
    min-height: 46px;
    line-height: 1;
}

.button:hover {
    transform: translateY(-1px);
}

.button:active {
    transform: translateY(0);
}

.button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(57, 184, 255, 0.16);
}

.button-primary {
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-2) 100%);
    color: #04101f;
    box-shadow: var(--shadow-soft);
}

.button-primary:hover {
    box-shadow: 0 16px 28px rgba(30, 144, 255, 0.22);
}

.button-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.button-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.16);
}

.button-small {
    min-height: 38px;
    padding: 0.65rem 0.95rem;
    border-radius: 12px;
}

.app-content {
    padding: 0 2rem 2rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.card {
    background: linear-gradient(180deg, rgba(24, 36, 58, 0.98) 0%, rgba(19, 31, 50, 0.98) 100%);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.metric-card {
    padding: 1.5rem;
}

.metric-label {
    margin: 0 0 0.8rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.78rem;
    font-weight: 700;
}

.metric-value {
    margin: 0 0 0.6rem;
    font-size: 2.2rem;
    line-height: 1;
    letter-spacing: -0.04em;
}

.metric-note {
    margin: 0;
    color: var(--muted);
}

/*
|--------------------------------------------------------------------------
| Dashboard
|--------------------------------------------------------------------------
*/

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

.dashboard-activity-list,
.dashboard-latest-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 0.5rem;
}

.dashboard-activity-item,
.dashboard-latest-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    align-items: flex-start;
}

.dashboard-activity-item:first-child,
.dashboard-latest-item:first-child {
    border-top: 0;
    padding-top: 0.25rem;
}

.dashboard-latest-link {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    width: 100%;
    color: inherit;
    text-decoration: none;
}

.dashboard-latest-link:hover .dashboard-latest-title,
.dashboard-latest-link:focus-visible .dashboard-latest-title {
    text-decoration: underline;
}

.dashboard-latest-link:focus-visible,
.dashboard-inline-link:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.18);
    outline-offset: 3px;
    border-radius: 6px;
}

.dashboard-activity-main,
.dashboard-latest-main {
    min-width: 0;
    flex: 1;
}

.dashboard-activity-title,
.dashboard-latest-title {
    margin: 0 0 0.2rem;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text);
}

.dashboard-activity-description,
.dashboard-latest-description {
    margin: 0;
    color: var(--muted);
    line-height: 1.4;
    word-break: break-word;
}

.dashboard-activity-time {
    color: var(--muted);
    font-size: 0.84rem;
    white-space: nowrap;
    flex-shrink: 0;
    padding-top: 0.05rem;
}

.dashboard-latest-meta {
    text-align: right;
    flex-shrink: 0;
    white-space: nowrap;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.dashboard-latest-amount {
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 700;
}

.dashboard-metric-revenue .metric-value,
.dashboard-metric-revenue .metric-label {
    color: #86efac;
}

.dashboard-metric-outstanding .metric-value,
.dashboard-metric-outstanding .metric-label {
    color: #fca5a5;
}

.dashboard-metric-open .metric-value,
.dashboard-metric-open .metric-label {
    color: #93c5fd;
}

.dashboard-metric-draft .metric-value,
.dashboard-metric-draft .metric-label {
    color: #c4b5fd;
}

.dashboard-metric-revenue,
.dashboard-metric-outstanding,
.dashboard-metric-open,
.dashboard-metric-draft {
    position: relative;
    overflow: hidden;
}

.dashboard-metric-revenue::before,
.dashboard-metric-outstanding::before,
.dashboard-metric-open::before,
.dashboard-metric-draft::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    border-radius: 999px;
}

.dashboard-metric-revenue::before {
    background: linear-gradient(90deg, rgba(134, 239, 172, 0.95), rgba(34, 197, 94, 0.55));
}

.dashboard-metric-outstanding::before {
    background: linear-gradient(90deg, rgba(252, 165, 165, 0.95), rgba(248, 113, 113, 0.55));
}

.dashboard-metric-open::before {
    background: linear-gradient(90deg, rgba(147, 197, 253, 0.95), rgba(96, 165, 250, 0.55));
}

.dashboard-metric-draft::before {
    background: linear-gradient(90deg, rgba(196, 181, 253, 0.95), rgba(168, 85, 247, 0.55));
}

.dashboard-inline-link {
    color: #93c5fd;
    text-decoration: none;
    font-weight: 600;
}

.dashboard-inline-link:hover,
.dashboard-inline-link:focus-visible {
    text-decoration: underline;
}

.dashboard-inline-separator {
    color: var(--muted);
}

.dashboard-activity-amount {
    color: var(--text);
    font-weight: 700;
}

.panel-card,
.form-card,
.detail-card {
    padding: 1.35rem;
}

.panel-header h2 {
    margin: 0 0 0.3rem;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}

.empty-state {
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    color: var(--muted);
    text-align: center;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
}

.app-footer {
    padding: 0 2rem 2rem;
    color: var(--muted);
    font-size: 0.9rem;
}

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

.panel-subtext {
    margin: 0.25rem 0 0;
    color: var(--muted);
    line-height: 1.5;
}

.panel-subtext-flush {
    margin: 0;
}

.inline-form {
    display: inline;
}

.alert-spaced {
    margin-top: 1rem;
}

.table-wrap,
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table-wrap {
    -webkit-overflow-scrolling: touch;
}

.invoice-table {
    min-width: 700px;
    table-layout: fixed;
}

.invoice-filter-bar {
    display: flex;
    gap: 0.75rem;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
    padding: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.025);
}

.invoice-filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 220px;
}

.invoice-filter-field label {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.invoice-filter-field input,
.invoice-filter-field select {
    width: 100%;
    border: 1px solid var(--field-border);
    background: var(--field-bg);
    color: var(--text);
    border-radius: 14px;
    padding: 0.85rem 1rem;
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.invoice-filter-field input:hover,
.invoice-filter-field select:hover {
    background: var(--field-bg-hover);
    border-color: #324a72;
}

.invoice-filter-field input:focus,
.invoice-filter-field select:focus {
    border-color: var(--field-border-focus);
    box-shadow:
        0 0 0 4px rgba(57, 184, 255, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.invoice-filter-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.invoice-results-summary {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 14px;
    font-size: 0.95rem;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.025);
}

.invoice-actions-cell .text-link:last-child {
    margin-right: 0;
}

.invoice-table th:nth-child(1),
.invoice-table td:nth-child(1) {
    width: 15%;
}

.invoice-table th:nth-child(2),
.invoice-table td:nth-child(2) {
    width: 24%;
}

.invoice-table th:nth-child(3),
.invoice-table td:nth-child(3) {
    width: 14%;
}

.invoice-table th:nth-child(4),
.invoice-table td:nth-child(4),
.invoice-table th:nth-child(5),
.invoice-table td:nth-child(5),
.invoice-table th:nth-child(6),
.invoice-table td:nth-child(6) {
    width: 12%;
    white-space: nowrap;
}

.invoice-table th:nth-child(7),
.invoice-table td:nth-child(7) {
    width: 11%;
}

.line-item-catalog-head {
    width: 15%;
}

.line-item-item-head {
    width: 20%;
}

.line-item-description-head {
    width: 18%;
}

.line-item-quantity-head {
    width: 7%;
}

.line-item-unit-price-head {
    width: 9%;
}

.line-item-discount-head {
    width: 8%;
}

.line-item-tax-head,
.line-item-actions-head {
    width: 6%;
}

.line-item-total-head {
    width: 9%;
}

.payment-date-col {
    width: 22%;
}

.payment-amount-col {
    width: 14%;
}

.payment-method-col {
    width: 18%;
}

.payment-notes-col {
    width: 46%;
}

/*
|--------------------------------------------------------------------------
| Invoice Create/Edit Screens
|--------------------------------------------------------------------------
*/

.invoice-page-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.invoice-hero {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.invoice-hero-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 280px;
}

.invoice-reference-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.invoice-guidance,
.invoice-create-guidance {
    padding: 0.85rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
    line-height: 1.55;
}

.invoice-create-guidance {
    margin: 0.85rem 0 1rem;
    padding: 0.9rem 1rem;
}

.invoice-guidance strong,
.invoice-create-guidance strong {
    color: var(--text);
}

.invoice-toolbar {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.invoice-toolbar-primary,
.invoice-toolbar-secondary {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.invoice-section-heading {
    margin-bottom: 0.9rem;
}

.invoice-section-heading h2 {
    margin: 0 0 0.25rem;
    font-size: 1.15rem;
}

.invoice-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.invoice-summary-card {
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.025);
}

.invoice-summary-card-label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.invoice-summary-card-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.invoice-subsection-note {
    margin: 0.85rem 0 0;
    color: var(--muted);
}

.invoice-create-form {
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
}

.invoice-header-grid,
.invoice-create-header-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0.9rem 1rem;
    align-items: start;
}

.invoice-compact-form .form-grid {
    gap: 0.9rem 1rem;
}

.invoice-compact-form .form-actions {
    margin-top: 0.25rem;
}

.invoice-header-grid .invoice-field-customer,
.invoice-create-header-grid .invoice-field-customer,
.invoice-header-grid .invoice-field-vehicle,
.invoice-create-header-grid .invoice-field-vehicle {
    grid-column: span 5;
}

.invoice-header-grid .invoice-field-tax,
.invoice-create-header-grid .invoice-field-tax {
    grid-column: span 2;
}

.invoice-header-grid .invoice-field-notes,
.invoice-header-grid .invoice-field-internal-notes,
.invoice-create-header-grid .invoice-field-notes,
.invoice-create-header-grid .invoice-field-internal-notes {
    grid-column: span 6;
}

.invoice-header-grid textarea {
    min-height: 88px;
}

.invoice-create-header-grid textarea {
    min-height: 104px;
}

.invoice-header-grid .invoice-field-tax input,
.invoice-create-header-grid .invoice-field-tax input {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.package-insert-bar {
    display: flex;
    gap: 0.75rem;
    align-items: end;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.package-insert-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 280px;
}

.package-insert-field label {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.line-item-controls-bar {
    display: flex;
    gap: 0.75rem;
    align-items: end;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.line-item-controls-bar .package-insert-bar {
    margin-top: 0;
}

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

.line-item-top-actions-separated {
    padding-left: 0.25rem;
    margin-left: 0.25rem;
}

.line-items-table .catalog-item-select {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.12);
    color: #d7e2f1;
}

.line-items-table .catalog-item-select:hover {
    background: rgba(255, 255, 255, 0.045);
    border-color: rgba(255, 255, 255, 0.16);
}

.line-items-table .item-name-input {
    font-weight: 700;
}

.line-item-row > td {
    transition: background 0.12s ease;
}

.line-item-row:hover > td {
    background: rgba(255, 255, 255, 0.045);
}

.line-items-table .line-item-qty-cell input,
.line-items-table .line-item-unit-price-cell input,
.line-items-table .line-item-discount-cell input {
    text-align: right;
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
    appearance: textfield;
}

.line-items-table .line-item-qty-cell input::-webkit-outer-spin-button,
.line-items-table .line-item-qty-cell input::-webkit-inner-spin-button,
.line-items-table .line-item-unit-price-cell input::-webkit-outer-spin-button,
.line-items-table .line-item-unit-price-cell input::-webkit-inner-spin-button,
.line-items-table .line-item-discount-cell input::-webkit-outer-spin-button,
.line-items-table .line-item-discount-cell input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.line-items-table .line-item-total-cell,
.line-items-table .line-item-remove-cell {
    white-space: nowrap;
}

.line-items-table .line-total-display {
    display: inline-block;
    min-width: 78px;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--text);
}

.line-items-table .line-item-remove-cell {
    text-align: right;
}

.line-items-table .remove-line-item-button {
    min-width: 92px;
}

.line-items-table .line-item-description-cell {
    width: 18%;
}

.line-items-table .item-description-input {
    min-height: 44px;
    max-height: 44px;
    padding: 0.55rem 0.7rem;
    line-height: 1.25;
    font-size: 0.88rem;
}

.invoice-totals-inline-total {
    padding: 0.55rem 0.8rem;
    border: 1px solid rgba(57, 184, 255, 0.2);
    border-radius: 12px;
    background: rgba(57, 184, 255, 0.08);
}

.invoice-totals-inline-total .totals-label {
    color: #b9dfff;
}

.invoice-totals-inline-total .totals-value {
    font-size: 1.08rem;
    font-weight: 800;
    color: #ffffff;
}

.invoice-totals-inline-status .totals-value {
    color: #dbe8f8;
}

.invoice-totals-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
    margin-left: auto;
    padding-left: 1rem;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.payment-history-wrap {
    margin-top: 1rem;
}

.payment-history-table {
    width: 100%;
    table-layout: fixed;
}

.payment-history-table th,
.payment-history-table td {
    vertical-align: middle;
}

.payment-history-table th {
    white-space: nowrap;
}

.payment-history-table td {
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
}

.payment-history-amount-col {
    text-align: right !important;
}

.payment-history-date,
.payment-history-method {
    white-space: nowrap;
}

.payment-history-date {
    font-weight: 600;
}

.payment-history-amount {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.payment-history-notes,
.payment-history-notes-empty {
    color: var(--muted);
}

.payment-history-notes {
    line-height: 1.5;
}

.payment-history-notes-empty {
    font-style: italic;
}

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

.data-table tbody tr {
    transition:
        background-color 0.14s ease,
        box-shadow 0.14s ease;
}

.data-table tbody tr:hover {
    background: rgba(57, 184, 255, 0.045);
}

.data-table tbody tr:hover td {
    border-top-color: rgba(57, 184, 255, 0.14);
}

.data-table th,
.data-table td {
    padding: 0.95rem 0.85rem;
    text-align: left;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    vertical-align: top;
}

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

.data-table td {
    color: var(--text);
}

.data-table strong {
    font-weight: 700;
}

.table-actions {
    white-space: nowrap;
}

.text-link {
    color: var(--accent);
    margin-right: 0.75rem;
    font-weight: 700;
    text-decoration: none;
    text-underline-offset: 0.18em;
}

.text-link:hover,
.text-link:focus-visible {
    color: #8ddcff;
    text-decoration: underline;
}

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

.entity-link-medium {
    font-weight: 500;
}

.entity-link:hover,
.entity-link:focus-visible {
    color: #8ddcff;
    text-decoration: underline;
}

.customer-invoice-status-cell,
.invoice-actions-cell,
.invoice-status-cell {
    white-space: nowrap;
}

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

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: 0;
}

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

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

.form-field input,
.form-field textarea,
.form-field select,
.sidebar-search input,
.data-table input,
.data-table textarea,
.data-table select,
.package-insert-field select {
    width: 100%;
    border: 1px solid var(--field-border);
    background: var(--field-bg);
    color: var(--text);
    border-radius: 14px;
    padding: 0.85rem 1rem;
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.form-field input:hover,
.form-field textarea:hover,
.form-field select:hover,
.data-table input:hover,
.data-table textarea:hover,
.data-table select:hover,
.package-insert-field select:hover {
    background: var(--field-bg-hover);
    border-color: #324a72;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus,
.data-table input:focus,
.data-table textarea:focus,
.data-table select:focus,
.package-insert-field select:focus {
    border-color: var(--field-border-focus);
    box-shadow:
        0 0 0 4px rgba(57, 184, 255, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.form-field input[readonly],
.form-field textarea[readonly],
.form-field select:disabled,
.form-field input:disabled,
.form-field textarea:disabled,
.data-table input:disabled,
.data-table textarea:disabled,
.data-table select:disabled {
    background: rgba(255, 255, 255, 0.04);
    color: #c2d0e6;
    border-color: rgba(255, 255, 255, 0.08);
    cursor: not-allowed;
}

.form-field textarea {
    resize: vertical;
    min-height: 110px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.35rem;
}

.alert {
    border-radius: 14px;
    padding: 0.9rem 1rem;
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.5;
}

.alert-error {
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.28);
    color: #fecaca;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.14);
    border: 1px solid rgba(245, 158, 11, 0.28);
    color: #fde68a;
}

.alert-success {
    background: rgba(34, 197, 94, 0.14);
    border: 1px solid rgba(34, 197, 94, 0.28);
    color: #bbf7d0;
}

.alert-info {
    background: rgba(57, 184, 255, 0.1);
    border: 1px solid rgba(57, 184, 255, 0.18);
    color: #c9ecff;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

.detail-list {
    display: grid;
    gap: 1rem;
    margin: 0;
}

.detail-list div {
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    padding-top: 1rem;
}

.detail-list dt {
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 0.4rem;
}

.detail-list dd {
    margin: 0;
    line-height: 1.6;
}

.button-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

select {
    appearance: none;
}

.checkbox-field {
    justify-content: flex-end;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--text);
    font-weight: 600;
    min-height: 48px;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/*
|--------------------------------------------------------------------------
| Status Badges
|--------------------------------------------------------------------------
*/

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-badge-draft {
    background: rgba(57, 184, 255, 0.12);
    border-color: rgba(57, 184, 255, 0.22);
    color: #bfe7ff;
}

.status-badge-final {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
    color: #e8eef8;
}

.status-badge-paid {
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(34, 197, 94, 0.24);
    color: #bbf7d0;
}

.status-badge-unpaid {
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(239, 68, 68, 0.24);
    color: #fecaca;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

/* Type */
.badge-service {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
}

.badge-product {
    background: rgba(168, 85, 247, 0.15);
    color: #d8b4fe;
}

/* Status */
.badge-active {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
}

.badge-inactive {
    background: rgba(148, 163, 184, 0.15);
    color: #cbd5f5;
}

/*
|--------------------------------------------------------------------------
| Vehicle Form Density
|--------------------------------------------------------------------------
*/

.vehicle-form-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0.85rem 1rem;
    align-items: start;
}

.vehicle-customer-field,
.vehicle-notes-field,
.vehicle-form-actions {
    grid-column: 1 / -1;
}

.vehicle-field-year {
    grid-column: span 2;
}

.vehicle-field-make {
    grid-column: span 4;
}

.vehicle-field-model {
    grid-column: span 6;
}

.vehicle-field-trim {
    grid-column: span 3;
}

.vehicle-field-color {
    grid-column: span 3;
}

.vehicle-field-vin {
    grid-column: span 3;
}

.vehicle-field-plate {
    grid-column: span 3;
}

.vehicle-form-card .panel-header {
    margin-bottom: 1rem;
}

.vehicle-form-card .panel-subtext {
    max-width: 60ch;
}

.vehicle-form-card .form-field textarea {
    min-height: 92px;
}

.vehicle-form-card .form-actions {
    margin-top: 0.15rem;
}

/*
|--------------------------------------------------------------------------
| Vehicle Detail Screen
|--------------------------------------------------------------------------
*/

.vehicle-detail-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.vehicle-detail-card {
    padding: 1.35rem;
}

.vehicle-detail-row {
    display: grid;
    gap: 0.9rem 1rem;
    margin-top: 1rem;
}

.vehicle-detail-row-identity {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.vehicle-detail-row-attributes {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 0.9rem;
}

.vehicle-detail-item {
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.025);
    padding: 0.9rem 1rem;
    min-width: 0;
}

.vehicle-detail-notes-card {
    margin-top: 0.9rem;
}

.vehicle-detail-label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.vehicle-detail-value {
    color: var(--text);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.45;
    word-break: break-word;
}

.vehicle-detail-notes {
    white-space: pre-wrap;
    min-height: 2.2rem;
}

/*
|--------------------------------------------------------------------------
| Settings Screen
|--------------------------------------------------------------------------
*/

.settings-form-card .panel-header {
    margin-bottom: 1rem;
}

.settings-form-grid {
    gap: 1rem;
}

.settings-section {
    border: 1px solid var(--panel-border-soft);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.025);
    padding: 1rem;
}

.settings-section-header {
    margin-bottom: 0.9rem;
}

.settings-section-header h3 {
    margin: 0;
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.settings-section-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.95rem 1.1rem;
}

.settings-identity-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(220px, 0.8fr);
    gap: 0.95rem 1.1rem;
    align-items: end;
}

.settings-field-business-name {
    grid-column: 1;
}

.settings-field-phone {
    grid-column: 2;
}

.settings-field-email {
    grid-column: 1;
}

.settings-field-website {
    grid-column: 2;
}

.settings-address-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(120px, 0.4fr) minmax(140px, 0.45fr) minmax(160px, 0.55fr);
    gap: 0.95rem 1.1rem;
    align-items: end;
}

.settings-field-address-1,
.settings-field-address-2 {
    grid-column: 1 / -1;
}

.settings-field-city {
    grid-column: 1;
}

.settings-field-state {
    grid-column: 2;
}

.settings-field-postal-code {
    grid-column: 3;
}

.settings-field-tax-rate {
    grid-column: 4;
}

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

.settings-logo-card {
    border: 1px solid var(--panel-border-soft);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    min-width: 0;
}

.settings-logo-card-header h4 {
    margin: 0;
    font-size: 0.92rem;
    letter-spacing: -0.01em;
}

.settings-logo-preview {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 96px;
    padding: 0.9rem 1rem;
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.018);
}

.settings-logo-image {
    display: block;
    max-height: 72px;
    max-width: 240px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.settings-logo-actions {
    display: flex;
    justify-content: flex-start;
}

.settings-empty-note {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.settings-info-alert,
.settings-muted-alert {
    margin-bottom: 0;
}

.settings-muted-alert {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #d5e0f0;
}

.settings-form-actions {
    margin-top: 0.15rem;
}

/* File Input (Settings) */
.file-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-input-hidden {
    display: none;
}

.file-input-name {
    color: var(--muted);
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

/* Unsaved Logo Warning refinement */
.logo-unsaved-warning {
    margin-top: 0.5rem;
    padding: 0.6rem 0.75rem;
    font-size: 0.78rem;
    border-radius: 10px;
}

/*
|--------------------------------------------------------------------------
| Service Package Items
|--------------------------------------------------------------------------
*/

.package-items-section {
    margin-top: 1.5rem;
}

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

.package-items-title {
    margin: 0 0 0.25rem;
}

.package-items-grid {
    display: grid;
    gap: 0.85rem;
}

.package-item-card {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 14px;
    padding: 0.95rem 1rem;
    background: rgba(15, 23, 42, 0.18);
}

.package-item-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
    flex-wrap: wrap;
}

.package-item-card-header h3 {
    margin: 0;
    font-size: 0.95rem;
}

.package-item-grid {
    display: grid;
    gap: 0.9rem 1rem;
    grid-template-columns: 1.05fr 0.9fr 0.62fr 0.7fr 0.78fr minmax(260px, 1.55fr) auto;
    align-items: end;
}

.package-item-grid .package-description-field textarea {
    min-height: 42px;
    max-height: 42px;
    resize: none;
    overflow: hidden;
    line-height: 1.4;
}

.package-item-grid .checkbox-field {
    justify-content: flex-end;
}

.package-item-grid .checkbox-label {
    min-height: 46px;
}

.package-remove-button {
    min-width: 96px;
}

.package-items-empty {
    border: 1px dashed rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    padding: 1rem 1.1rem;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.02);
}

.package-item-card .package-catalog-field label {
    color: #8ea4c3;
}

.package-item-card .package-catalog-field select.package-catalog-select,
.package-item-card .package-catalog-field select.line-item-catalog-select,
.package-item-card .package-catalog-field select.package-catalog-select.line-item-catalog-select {
    width: 100%;
    min-height: 42px;
    padding: 0.72rem 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.035);
    color: #c4d3e8;
    box-shadow: none;
    font-weight: 500;
}

.package-item-card .package-catalog-field select.package-catalog-select:hover,
.package-item-card .package-catalog-field select.line-item-catalog-select:hover,
.package-item-card .package-catalog-field select.package-catalog-select.line-item-catalog-select:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(148, 163, 184, 0.22);
    color: #d2deee;
    box-shadow: none;
}

.package-item-card .package-catalog-field select.package-catalog-select:focus,
.package-item-card .package-catalog-field select.line-item-catalog-select:focus,
.package-item-card .package-catalog-field select.package-catalog-select.line-item-catalog-select:focus {
    background: rgba(255, 255, 255, 0.055);
    color: #dbe7f5;
    border-color: rgba(57, 184, 255, 0.42);
    box-shadow: 0 0 0 4px rgba(57, 184, 255, 0.08);
    outline: none;
}

.package-item-card .package-catalog-field select.package-catalog-select option,
.package-item-card .package-catalog-field select.line-item-catalog-select option,
.package-item-card .package-catalog-field select.package-catalog-select.line-item-catalog-select option {
    background: #101d35;
    color: #f4f7fb;
}

.is-hidden {
    display: none !important;
}

@media (max-width: 1180px) {
    .package-item-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .package-remove-button-wrap,
    .package-item-grid .checkbox-field,
    .package-item-grid .form-field-full {
        grid-column: 1 / -1;
    }
}

@media (max-width: 860px) {
    .package-item-grid {
        grid-template-columns: 1fr;
    }

    .package-remove-button-wrap,
    .package-item-grid .checkbox-field,
    .package-item-grid .form-field-full {
        grid-column: auto;
    }

    .package-item-card-header {
        align-items: flex-start;
    }

    .package-item-card-header .button,
    .package-items-header .button {
        width: 100%;
    }
}

/*
|--------------------------------------------------------------------------
| Table Form Controls
|--------------------------------------------------------------------------
*/

.line-items-table input,
.line-items-table textarea,
.line-items-table select,
.line-item-name-input,
.line-item-description-input,
.line-item-catalog-select,
.line-item-quantity-input,
.line-item-unit-price-input,
.line-item-discount-input {
    padding: 0.7rem 0.8rem;
    min-height: 42px;
    border-radius: 12px;
}

.line-items-table textarea,
.line-item-description-input {
    min-height: 70px;
    max-height: 70px;
    resize: none;
    overflow: hidden;
    line-height: 1.4;
}

.line-items-table td {
    vertical-align: middle;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.line-items-table .text-center {
    text-align: center;
}

.line-items-table input[type="checkbox"],
.line-item-taxable-input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
    vertical-align: middle;
}

/*
|--------------------------------------------------------------------------
| Shared Line Item Controls
|--------------------------------------------------------------------------
*/

.line-item-catalog-select {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.12);
    color: #d7e2f1;
}

.line-item-catalog-select:hover {
    background: rgba(255, 255, 255, 0.045);
    border-color: rgba(255, 255, 255, 0.16);
}

.line-item-quantity-input,
.line-item-unit-price-input,
.line-item-discount-input {
    text-align: right;
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
    appearance: textfield;
}

.line-item-quantity-input::-webkit-outer-spin-button,
.line-item-quantity-input::-webkit-inner-spin-button,
.line-item-unit-price-input::-webkit-outer-spin-button,
.line-item-unit-price-input::-webkit-inner-spin-button,
.line-item-discount-input::-webkit-outer-spin-button,
.line-item-discount-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.line-item-total-display {
    min-width: 78px;
    font-variant-numeric: tabular-nums;
}

.line-item-name-input {
    font-weight: 700;
    color: #f4f7fb;
}

.line-item-catalog-select {
    font-weight: 500;
}

.line-item-description-input {
    color: #a9bbd6;
}

.line-item-row:hover,
.package-item-card:hover {
    background: rgba(255, 255, 255, 0.03);
}

.line-item-name-input,
.line-item-catalog-select,
.line-item-description-input,
.line-item-quantity-input,
.line-item-unit-price-input,
.line-item-discount-input,
.line-item-type-select {
    transition:
        border-color 0.14s ease,
        box-shadow 0.14s ease,
        background-color 0.14s ease,
        color 0.14s ease;
}

.line-item-name-input:focus,
.line-item-catalog-select:focus,
.line-item-description-input:focus,
.line-item-quantity-input:focus,
.line-item-unit-price-input:focus,
.line-item-discount-input:focus,
.line-item-type-select:focus {
    border-color: rgba(57, 184, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(57, 184, 255, 0.14);
}

.line-item-name-input:focus {
    background: #112241;
}

.line-item-catalog-select:focus,
.line-item-type-select:focus {
    background: rgba(255, 255, 255, 0.05);
}

.line-item-description-input:focus {
    background: #10203c;
}

.line-item-total-display {
    font-weight: 700;
    color: #ffffff;
}

.invoice-totals-inline .totals-value {
    font-size: 1.05rem;
}

.totals-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.totals-panel > div {
    border: 1px solid var(--panel-border-soft);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.025);
    padding: 0.85rem 1rem;
}

.totals-panel strong {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.totals-panel span {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

/*
|--------------------------------------------------------------------------
| Auth Layout
|--------------------------------------------------------------------------
*/

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-shell {
    width: 100%;
    padding: 40px 20px;
}

.auth-card-wrap {
    max-width: 460px;
    margin: 0 auto;
}

/* Account screen layout tweak (scoped) */
.auth-shell-account {
    align-items: stretch;
    padding-top: 40px;
}

.auth-body .auth-shell-account {
    justify-content: flex-start;
}

/* Account button layout */
.account-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.account-actions-top {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
}

.account-actions-top .button {
    min-width: 140px;
}

.account-password-button {
    width: 100%;
}

@media (max-width: 1280px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1080px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-lower-grid {
        grid-template-columns: 1fr;
    }

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

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

    .invoice-header-grid .invoice-field-customer,
    .invoice-header-grid .invoice-field-vehicle,
    .invoice-header-grid .invoice-field-tax,
    .invoice-header-grid .invoice-field-notes,
    .invoice-header-grid .invoice-field-internal-notes,
    .invoice-create-header-grid .invoice-field-customer,
    .invoice-create-header-grid .invoice-field-vehicle,
    .invoice-create-header-grid .invoice-field-tax {
        grid-column: span 1;
    }

    .invoice-header-grid .invoice-field-notes,
    .invoice-header-grid .invoice-field-internal-notes,
    .invoice-create-header-grid .invoice-field-notes,
    .invoice-create-header-grid .invoice-field-internal-notes {
        grid-column: 1 / -1;
    }

    .vehicle-detail-row-attributes {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

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

    .vehicle-field-year,
    .vehicle-field-make,
    .vehicle-field-model,
    .vehicle-field-trim,
    .vehicle-field-color,
    .vehicle-field-vin,
    .vehicle-field-plate {
        grid-column: span 1;
    }

    .vehicle-customer-field,
    .vehicle-notes-field,
    .vehicle-form-actions {
        grid-column: 1 / -1;
    }

    .settings-logo-grid,
    .settings-section-grid,
    .settings-identity-grid {
        grid-template-columns: 1fr;
    }

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

    .settings-field-address-1,
    .settings-field-address-2 {
        grid-column: 1 / -1;
    }

    .settings-field-city,
    .settings-field-state,
    .settings-field-postal-code,
    .settings-field-tax-rate {
        grid-column: auto;
    }
}

/* Customer Form Layout */
.customer-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr);
    gap: 0.95rem 1.1rem;
}

/* Row sizing */
.customer-field-full {
    grid-column: 1 / -1;
}

.customer-field-phone {
    grid-column: 1;
}

.customer-field-email {
    grid-column: 2;
}

/* City / State / Postal row */
.customer-address-row {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(120px, 0.4fr) minmax(140px, 0.5fr);
    gap: 0.95rem 1.1rem;
    grid-column: 1 / -1;
}

@media (max-width: 860px) {
    .app-shell {
        flex-direction: column;
    }

    .invoice-filter-actions {
        width: 100%;
    }

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

    .sidebar {
		position: fixed;
		top: 0;
		left: 0;
		height: 100vh;
		width: var(--sidebar-width);
		transform: translateX(-100%);
		transition: transform 0.25s ease;
		z-index: 1000;
	}

	.sidebar-open .sidebar {
		transform: translateX(0);
	}

	/* Overlay */
	.sidebar-overlay {
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, 0.55);
		backdrop-filter: blur(2px);
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.2s ease;
		z-index: 900;
	}

	.sidebar-open .sidebar-overlay {
		opacity: 1;
		pointer-events: auto;
	}

	.sidebar-toggle {
		display: inline-flex;
	}

    .topbar {
        padding: 1.5rem 1rem 1rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-activity-item,
    .dashboard-latest-item,
    .dashboard-latest-link,
    .invoice-hero {
        flex-direction: column;
    }

    .dashboard-activity-time,
    .dashboard-latest-meta {
        white-space: normal;
        text-align: left;
        align-items: flex-start;
    }

    .dashboard-activity-item,
    .dashboard-latest-item,
    .dashboard-latest-link {
        gap: 0.3rem;
    }

    .invoice-toolbar {
        width: 100%;
        justify-content: flex-start;
    }

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

    .invoice-header-grid .invoice-field-customer,
    .invoice-header-grid .invoice-field-vehicle,
    .invoice-header-grid .invoice-field-tax,
    .invoice-header-grid .invoice-field-notes,
    .invoice-header-grid .invoice-field-internal-notes,
    .invoice-create-header-grid .invoice-field-customer,
    .invoice-create-header-grid .invoice-field-vehicle,
    .invoice-create-header-grid .invoice-field-tax,
    .invoice-create-header-grid .invoice-field-notes,
    .invoice-create-header-grid .invoice-field-internal-notes {
        grid-column: span 1;
    }

    .line-item-controls-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .line-item-controls-bar .package-insert-bar,
    .line-item-top-actions {
        width: 100%;
    }

    .line-item-top-actions-separated {
        padding-left: 0;
        margin-left: 0;
    }

    .invoice-totals-actions {
        margin-left: 0;
        width: 100%;
        padding-left: 0;
        border-left: 0;
        padding-top: 0.5rem;
    }

    .invoice-totals-actions .button {
        width: 100%;
    }

    .vehicle-detail-row-identity,
    .vehicle-detail-row-attributes {
        grid-template-columns: 1fr;
    }

    .app-content,
    .app-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .vehicle-form-grid {
        grid-template-columns: 1fr;
    }

    .panel-header-between {
        flex-direction: column;
    }

    .form-actions {
        justify-content: stretch;
        flex-direction: column;
    }

    .form-actions .button {
        width: 100%;
    }

    .totals-panel {
        grid-template-columns: 1fr;
    }

    .line-items-table input,
    .line-items-table textarea,
    .line-items-table select,
    .line-item-name-input,
    .line-item-description-input,
    .line-item-catalog-select,
    .line-item-quantity-input,
    .line-item-unit-price-input,
    .line-item-discount-input {
        min-width: 140px;
    }

    .sidebar-brand {
        padding-bottom: 0.85rem;
        margin-bottom: 0.65rem;
    }

    .sidebar-brand-link {
        min-height: 52px;
    }

    .sidebar-brand-logo {
        max-height: 72px;
    }

    .sidebar-brand-text {
        font-size: 1.35rem;
    }

    .sidebar-business-name {
        font-size: 0.68rem;
        letter-spacing: 0.1em;
    }

    .sidebar-footer {
        padding-top: 1rem;
    }

    .settings-section {
        padding: 0.9rem;
    }

    .settings-logo-card {
        padding: 0.9rem;
    }

    .settings-address-grid {
        grid-template-columns: 1fr;
    }
}

.invoice-totals-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--panel-border-soft);
}

.invoice-totals-inline {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.totals-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    font-weight: 700;
}

.totals-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.invoice-totals-row .button {
    margin-left: auto;
}

.payments-grid-compact {
    display: grid;
    grid-template-columns: 1.15fr 0.8fr 1fr;
    gap: 0.9rem 1rem;
    align-items: start;
}

.payments-grid-compact .form-field {
    min-width: 0;
}

@media (max-width: 1080px) {
    .payments-grid-compact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .payments-grid-compact .form-field-full {
        grid-column: 1 / -1;
    }
}

@media (max-width: 860px) {
    .payments-grid-compact {
        grid-template-columns: 1fr;
    }
}

/*
|--------------------------------------------------------------------------
| Select Dropdown (Option List) Styling
|--------------------------------------------------------------------------
*/

select option {
    background: #101d35;
    color: #f4f7fb;
}

select optgroup {
    background: #101d35;
    color: #96a9c6;
}

.line-item-remove-button {
    min-width: 92px;
    opacity: 0.7;
    transition: opacity 0.12s ease, transform 0.12s ease;
}

.line-item-remove-button:hover,
.line-item-remove-button:focus-visible {
    opacity: 1;
    transform: translateY(-1px);
}
