:root {
    --bg: #09152b;
    --panel: #16233a;
    --panel-2: #1b2a44;
    --border: #253755;
    --text: #f4f7fb;
    --muted: #96a9c6;
    --accent: #39b8ff;
    --accent-2: #1e90ff;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --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-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

.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-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(--text-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(3, 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);
}

.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;
}

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

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

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

.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;
}

.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;
}

/*
|--------------------------------------------------------------------------
| 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;
}

/*
|--------------------------------------------------------------------------
| 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;
}

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

.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-name-input {
    font-weight: 700;
}

.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-remove-button {
    min-width: 92px;
    opacity: 0.78;
}

.line-item-remove-button:hover,
.line-item-remove-button:focus-visible {
    opacity: 1;
}

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

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

.line-item-description-input {
    color: #a9bbd6;
    min-height: 60px;
}

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

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

.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: 1080px) {
    .dashboard-grid {
        grid-template-columns: 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;
    }

    .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;
    }

    .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;
}

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

.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);
}