:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --panel-soft: #eef3f8;
    --text: #17202a;
    --muted: #5d6b7a;
    --line: #d8e0ea;
    --accent: #0f766e;
    --accent-strong: #115e59;
    --blue: #2563eb;
    --amber: #b45309;
    --red: #b91c1c;
    --green: #15803d;
    --shadow: 0 18px 40px rgba(27, 39, 55, 0.08);
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #10151d;
    --panel: #1b2430;
    --panel-soft: #253140;
    --text: #f3f6fa;
    --muted: #aeb9c7;
    --line: #3a4859;
    --accent: #2dd4bf;
    --accent-strong: #5eead4;
    --blue: #60a5fa;
    --amber: #fbbf24;
    --red: #f87171;
    --green: #4ade80;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.address-validation-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.invoice-payment-card { width: min(520px, calc(100% - 32px)); }
.invoice-payment-card h1 { font-size: 24px; }
.payment-link-summary { display: grid; grid-template-columns: 1fr auto; gap: 10px 18px; margin: 20px 0; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.payment-link-summary span { color: var(--muted); }

.label-page {
    margin: 0;
    padding: 24px;
    background: #eef2f6;
    color: #111827;
    font-family: Arial, sans-serif;
}

.label-controls {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.repair-bag-label {
    width: 4in;
    min-height: 2in;
    margin: 0 auto;
    padding: 0.18in;
    border: 2px solid #111827;
    background: #fff;
    box-sizing: border-box;
}

.repair-bag-label header,
.repair-bag-label .label-body {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.16in;
}

.repair-bag-label header {
    align-items: center;
    padding-bottom: 0.1in;
    border-bottom: 2px solid #0f766e;
}

.repair-bag-label header img { width: 1.75in; max-height: 0.45in; object-fit: contain; object-position: left center; }
.repair-bag-label h1 { margin: 0 0 0.08in; font-size: 18px; }
.repair-bag-label .label-body { padding-top: 0.1in; }
.repair-bag-label .label-details { flex: 1; min-width: 0; }
.repair-bag-label dl { display: grid; grid-template-columns: 0.65in 1fr; gap: 0.05in 0.08in; margin: 0; font-size: 12px; }
.repair-bag-label dt { font-weight: 700; }
.repair-bag-label dd { margin: 0; overflow-wrap: anywhere; }
.repair-bag-label .label-qr { flex: 0 0 0.95in; width: 0.95in; height: 0.95in; }
.repair-bag-label .label-qr svg { display: block; width: 100%; height: 100%; }
.repair-bag-label footer { margin-top: 0.12in; padding-top: 0.06in; border-top: 1px solid #94a3b8; text-align: center; font-size: 11px; font-weight: 700; }

@media print {
    @page { size: 4in 2in; margin: 0; }
    .label-page { padding: 0; background: #fff; }
    .label-controls { display: none; }
    .repair-bag-label { margin: 0; border: 0; }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
}

a {
    color: inherit;
}

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

.service-multi-select {
    min-height: 154px;
}

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

.sidebar {
    background: #26384b;
    color: #eef5fc;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.admin-shell {
    display: block;
}

.admin-shell .sidebar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto;
    gap: 12px 24px;
    width: 100%;
    padding: 14px 24px 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
}

.admin-shell .brand {
    align-self: center;
}

.admin-portal-identity {
    display: grid;
    gap: 2px;
    justify-self: start;
}

.admin-portal-identity strong {
    font-size: 1.05rem;
}

.admin-portal-identity small {
    margin: 0;
    color: #b9c5d2;
    font-size: 0.82rem;
}

.admin-left-logo {
    display: block;
    width: 148px;
    height: 44px;
    padding: 5px 8px;
    border: 1px solid #d5dbe1;
    border-radius: 6px;
    background: #eef1f4;
    object-fit: contain;
    object-position: left center;
}

.admin-brand-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    justify-self: end;
}

.header-user-identity {
    display: grid;
    gap: 2px;
    min-width: 150px;
    text-align: right;
}

.header-customer-logo {
    display: block;
    width: auto;
    max-width: 92px;
    max-height: 42px;
    object-fit: contain;
}

.header-user-identity span {
    color: #a7f3d0;
    font-size: 0.78rem;
    font-weight: 800;
}

.header-user-identity strong {
    color: #ffffff;
    font-size: 0.9rem;
}

.account-identity-link {
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
}

.account-identity-link:hover,
.account-identity-link:focus-visible {
    border-color: #4ade80;
    background: rgba(74, 222, 128, 0.12);
    outline: none;
}

.admin-brand-tools .theme-toggle {
    margin: 0;
    color: #cbd5e1;
}

.admin-shell .nav {
    grid-column: 1 / -1;
    display: flex;
    align-items: stretch;
    gap: 5px;
    flex-wrap: wrap;
    overflow: visible;
    padding: 2px 0 4px;
    scrollbar-width: thin;
}

.admin-shell .nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 38px;
    padding: 8px 11px;
    white-space: nowrap;
}

.admin-shell .nav > a,
.admin-shell .nav-settings > summary {
    gap: 7px;
    position: relative;
}

.admin-shell .nav > a:not(:first-child)::before,
.admin-shell .nav-settings::before,
.admin-shell .nav-theme-toggle::before {
    content: "|";
    position: absolute;
    left: -6px;
    top: 50%;
    color: rgba(255, 255, 255, 0.38);
    font-weight: 400;
    transform: translateY(-50%);
}

.admin-shell .nav > a.active,
.admin-shell .nav-settings.active > summary {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.12);
}

.nav-symbol {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    font-size: 1.12rem;
    font-weight: 900;
    line-height: 1;
}

.admin-shell .nav-settings {
    position: relative;
    flex: 0 0 auto;
}

.admin-shell .nav-settings > summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 11px;
    border-radius: 7px;
    color: #d8e4ef;
    cursor: pointer;
    list-style: none;
    white-space: nowrap;
}

.admin-shell .nav-settings > summary::-webkit-details-marker {
    display: none;
}

.admin-shell .nav-settings > summary:hover,
.admin-shell .nav-settings > summary:focus-visible {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
}

.admin-shell .nav-settings-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 80;
    display: grid;
    min-width: 190px;
    padding: 7px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 7px;
    background: #26384b;
    box-shadow: var(--shadow);
}

.admin-shell .nav-settings-menu a {
    justify-content: flex-start;
    width: 100%;
}

.admin-shell .nav-settings-menu a.active {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.12);
}

.admin-shell .nav-signout {
    margin-left: 0;
    padding-left: 14px;
}

.admin-shell .nav-theme-toggle {
    position: relative;
    flex: 0 0 auto;
    align-self: center;
    justify-content: flex-start;
    margin: 0 0 0 8px;
    padding: 7px 4px 7px 12px;
    color: #cbd5e1;
    white-space: nowrap;
}

.admin-shell .suggest-feature-link {
    margin-left: 8px;
    color: #fff7cc;
    background: #a16207;
    font-weight: 400;
}

.admin-shell .suggest-feature-link:hover,
.admin-shell .suggest-feature-link:focus-visible,
.admin-shell .suggest-feature-link.active {
    color: #ffffff;
    background: #ca8a04;
}

.admin-shell .main {
    width: 100%;
}

.admin-shell .main > h1,
.admin-shell .topbar {
    display: none;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--accent);
    font-weight: 800;
}

.brand strong,
.account span {
    display: block;
    font-size: 1rem;
}

.brand small,
.account small {
    display: block;
    color: #aab8c7;
    font-size: 0.83rem;
    margin-top: 2px;
}

.account {
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}

.nav {
    display: grid;
    gap: 6px;
}

.nav a {
    text-decoration: none;
    color: #d8e4ef;
    padding: 10px 12px;
    border-radius: 7px;
    min-height: 42px;
}

.nav a:hover,
.nav a.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
}

.main {
    min-width: 0;
    padding: 26px;
}

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

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

.portal-logo {
    display: block;
    width: min(310px, 48vw);
    height: auto;
    margin-bottom: 10px;
}

.topbar-account {
    min-width: 190px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    text-align: right;
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 9px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.theme-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.theme-toggle i {
    position: relative;
    display: block;
    width: 34px;
    height: 19px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel-soft);
}

.theme-toggle i::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--muted);
    transition: transform 160ms ease, background 160ms ease;
}

.theme-toggle input:checked + i::after {
    transform: translateX(15px);
    background: var(--accent);
}

.theme-toggle input:focus-visible + i {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.customer-logo {
    display: block;
    width: auto;
    max-width: 150px;
    max-height: 54px;
    object-fit: contain;
    margin: 0 0 8px auto;
}

.topbar-account span,
.topbar-account strong,
.topbar-account small {
    display: block;
}

.topbar-account span {
    color: var(--accent-strong);
    font-size: 0.86rem;
    font-weight: 800;
}

.topbar-account strong {
    margin-top: 2px;
}

.topbar-account small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.8rem;
}

.portal-title {
    color: var(--accent-strong);
    font-size: 0.92rem;
    font-weight: 800;
    margin-bottom: 6px;
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 1.18;
}

h1 {
    font-size: clamp(1.65rem, 3vw, 2.35rem);
}

h2 {
    font-size: 1.15rem;
}

h3 {
    font-size: 1rem;
}

p {
    color: var(--muted);
    line-height: 1.55;
}

.notice {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
}

.notice.success {
    background: #ecfdf3;
    color: #166534;
    border-color: #bbf7d0;
}

.notice.error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

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

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

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

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

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

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

.dashboard-welcome {
    margin: 0 0 24px;
}

.stat {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    box-shadow: var(--shadow);
}

.stat-link {
    text-decoration: none;
    transition: border-color 150ms ease, transform 150ms ease;
}

.stat-link:hover,
.stat-link:focus-visible,
.stat-link.active {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.stat-to-be-processed { background: #f8fafc; border-color: #94a3b8; }
.stat-new { background: #e8f1ff; border-color: #73a6ef; }
.stat-in-process { background: #e8f8fb; border-color: #58b7c7; }
.stat-parts { background: #f1eafe; border-color: #9b7ed6; }
.stat-awaiting-approval { background: #fff4d6; border-color: #dda93c; }
.stat-customer-approved { background: #e4f7e9; border-color: #64b77a; }

html[data-theme="dark"] .stat-to-be-processed { background: #27313d; border-color: #64748b; }
html[data-theme="dark"] .stat-new { background: #172d4b; border-color: #3b82f6; }
html[data-theme="dark"] .stat-in-process { background: #14363d; border-color: #2496a8; }
html[data-theme="dark"] .stat-parts { background: #30264a; border-color: #8065ba; }
html[data-theme="dark"] .stat-awaiting-approval { background: #3a2d12; border-color: #c68b20; }
html[data-theme="dark"] .stat-customer-approved { background: #173823; border-color: #3f9b5c; }

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .repair-action-summary,
html[data-theme="dark"] .repair-action-box,
html[data-theme="dark"] .delete-box,
html[data-theme="dark"] .camera-box,
html[data-theme="dark"] .price-breakdown-table,
html[data-theme="dark"] .searchable-select-results,
html[data-theme="dark"] .filter-details-plus,
html[data-theme="dark"] .filter-details-minus {
    color: var(--text);
    border-color: var(--line);
    background: var(--panel-soft);
}

html[data-theme="dark"] table,
html[data-theme="dark"] th,
html[data-theme="dark"] td {
    border-color: var(--line);
}

html[data-theme="dark"] .sidebar {
    background: #172330;
}

html[data-theme="dark"] th,
html[data-theme="dark"] .panel-header,
html[data-theme="dark"] .archived-panel,
html[data-theme="dark"] .archived-panel .panel-header,
html[data-theme="dark"] .subnav a,
html[data-theme="dark"] .repair-action-panel,
html[data-theme="dark"] .account-logo-card,
html[data-theme="dark"] .invoice-pay-form,
html[data-theme="dark"] .code-block {
    color: var(--text);
    background: var(--panel-soft);
}

html[data-theme="dark"] .button.secondary,
html[data-theme="dark"] button.secondary {
    color: var(--text);
    background: #344256;
}

html[data-theme="dark"] .repair-sheet-row:hover > td,
html[data-theme="dark"] .repair-sheet-row:focus-visible > td {
    background: #2a3747;
}

html[data-theme="dark"] .status-row-pending-approval > td {
    background: #3a2d1a;
}

html[data-theme="dark"] .status-row-new > td {
    background: #1d3048;
}

html[data-theme="dark"] .status-row-in-process > td {
    background: #2c2948;
}

html[data-theme="dark"] .status-row-part-order > td {
    background: #3b321d;
}

html[data-theme="dark"] .status-row-to-be-processed > td {
    background: #1d3935;
}

html[data-theme="dark"] .status-row-completed > td,
html[data-theme="dark"] .status-row-paid > td {
    background: #1c3828;
}

html[data-theme="dark"] .status-row-canceled > td {
    background: #402326;
}

.stat span {
    display: block;
    color: var(--muted);
    font-size: 0.9rem;
}

.stat strong {
    display: block;
    font-size: 2rem;
    margin-top: 8px;
}

.stat-completed strong {
    color: #15803d;
}

.stat-balance strong {
    color: #b91c1c;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-top: 18px;
}

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

.panel-body {
    padding: 18px;
}

.focused-panel {
    max-width: 960px;
}

.archived-panel {
    border-color: #e5e7eb;
    background: #fbfcfd;
}

.archived-panel .panel-header {
    background: #f8fafc;
}

.archived-card {
    border-style: dashed;
    opacity: 0.9;
}

.subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.subnav a {
    min-height: 38px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #ffffff;
    color: #2f3b48;
    font-size: 0.9rem;
    font-weight: 750;
    text-decoration: none;
}

.subnav a:hover,
.subnav a.active {
    border-color: rgba(15, 118, 110, 0.45);
    background: #ecfdf5;
    color: var(--accent-strong);
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.per-page-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.per-page-control span {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 750;
}

.button.small.active {
    background: var(--accent);
    color: #ffffff;
}

.pagination-control {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 18px;
}

.pagination-control span {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 750;
}

.check-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
}

.check-label.compact {
    min-height: 34px;
}

.check-label input {
    width: auto;
    min-height: 0;
}

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

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

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

.form-grid.five {
    grid-template-columns: 1.2fr repeat(4, minmax(150px, 1fr));
}

.form-grid.six {
    grid-template-columns: 1.3fr repeat(5, minmax(135px, 1fr));
}

.form-grid.two-tight {
    grid-template-columns: minmax(180px, 0.7fr) minmax(260px, 1.3fr);
}

.form-grid .field.wide {
    grid-column: span 1;
}

.field {
    display: grid;
    gap: 7px;
}

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

label {
    color: #2f3b48;
    font-size: 0.9rem;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 11px;
    border: 1px solid #c8d3df;
    border-radius: 7px;
    background: #ffffff;
    color: var(--text);
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    outline: 3px solid rgba(15, 118, 110, 0.16);
}

.intake-form {
    display: grid;
    gap: 18px;
}

.compact-intake {
    gap: 14px;
}

.intake-band {
    display: grid;
    gap: 12px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.compact-intake .intake-band {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
}

.intake-band:last-of-type {
    border-bottom: 0;
}

.compact-intake .intake-band:last-of-type {
    border-bottom: 1px solid var(--line);
}

.intake-band h3 {
    margin: 0;
    color: var(--accent-strong);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0;
}

.compact-grid {
    gap: 10px;
}

.intake-actions {
    display: flex;
    justify-content: flex-end;
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    border: 0;
    border-radius: 7px;
    padding: 10px 14px;
    background: var(--accent);
    color: #ffffff;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
}

.button.secondary,
button.secondary {
    background: #dfe7ef;
    color: #1f2937;
}

.button.warning,
button.warning {
    background: var(--amber);
}

.button.danger,
button.danger {
    background: var(--red);
}

.button.small,
button.small {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 0.88rem;
}

.collapse-button {
    width: 36px;
    min-height: 36px;
    padding: 0;
    border-radius: 7px;
    background: #ffffff;
    color: var(--accent-strong);
    border: 1px solid rgba(15, 118, 110, 0.35);
    box-shadow: none;
    font-size: 1.2rem;
    font-weight: 850;
}

.collapse-button:hover,
.collapse-button:focus-visible {
    background: #ecfdf5;
    outline: 3px solid rgba(15, 118, 110, 0.12);
}

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

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

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

th {
    color: var(--muted);
    background: #f8fafc;
    font-size: 0.83rem;
    text-transform: uppercase;
    letter-spacing: 0;
}

.sort-link {
    color: inherit;
    text-decoration: none;
}

.sort-link:hover,
.sort-link.active {
    color: var(--accent-strong);
}

td.actions {
    min-width: 240px;
}

.repair-sheet {
    min-width: 820px;
    table-layout: fixed;
    font-size: 0.92rem;
}

.repair-sheet th,
.repair-sheet td {
    padding: 9px 10px;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.repair-sheet th:nth-child(1),
.repair-sheet td:nth-child(1) {
    width: 140px;
}

.repair-sheet th:nth-child(2),
.repair-sheet td:nth-child(2) {
    width: 190px;
}

.repair-sheet th:nth-child(3),
.repair-sheet td:nth-child(3) {
    width: 270px;
}

.repair-sheet th:nth-child(4),
.repair-sheet td:nth-child(4) {
    width: 170px;
}

.repair-sheet th:nth-child(5),
.repair-sheet td:nth-child(5) {
    width: 120px;
}

.repair-sheet.admin-repair-queue-sheet {
    min-width: 980px;
}

.repair-sheet.admin-repair-queue-sheet th:nth-child(5),
.repair-sheet.admin-repair-queue-sheet td:nth-child(5) {
    width: 205px;
    overflow: visible;
}

.repair-sheet.admin-repair-queue-sheet th:nth-child(6),
.repair-sheet.admin-repair-queue-sheet td:nth-child(6) {
    width: 125px;
}

.repair-sheet.selectable-sheet th:nth-child(1),
.repair-sheet.selectable-sheet td:nth-child(1) {
    width: 42px;
}

.repair-sheet.selectable-sheet th:nth-child(2),
.repair-sheet.selectable-sheet td:nth-child(2) {
    width: 140px;
}

.repair-sheet.selectable-sheet th:nth-child(3),
.repair-sheet.selectable-sheet td:nth-child(3) {
    width: 190px;
}

.repair-sheet.selectable-sheet th:nth-child(4),
.repair-sheet.selectable-sheet td:nth-child(4) {
    width: 270px;
}

.repair-sheet.selectable-sheet th:nth-child(5),
.repair-sheet.selectable-sheet td:nth-child(5) {
    width: 170px;
}

.repair-sheet.selectable-sheet th:nth-child(6),
.repair-sheet.selectable-sheet td:nth-child(6) {
    width: 120px;
}

.repair-sheet.packing-slip-sheet {
    min-width: 720px;
}

.repair-sheet.packing-slip-sheet th:nth-child(2),
.repair-sheet.packing-slip-sheet td:nth-child(2) {
    width: 140px;
}

.repair-sheet.packing-slip-sheet th:nth-child(3),
.repair-sheet.packing-slip-sheet td:nth-child(3) {
    width: 250px;
}

.repair-sheet.packing-slip-sheet th:nth-child(4),
.repair-sheet.packing-slip-sheet td:nth-child(4) {
    width: 220px;
}

.repair-sheet.packing-slip-sheet th:nth-child(5),
.repair-sheet.packing-slip-sheet td:nth-child(5) {
    width: 220px;
}

.repair-sheet-row {
    cursor: pointer;
}

.repair-sheet-row:hover,
.repair-sheet-row:focus-visible {
    background: #f8fafc;
    outline: 2px solid rgba(15, 118, 110, 0.2);
    outline-offset: -2px;
}

.sheet-main,
.sheet-sub {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sheet-sub {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.8rem;
}

.repair-sheet .badge {
    min-height: 24px;
    padding: 3px 8px;
    font-size: 0.78rem;
}

.repair-sheet .photo-strip {
    flex-wrap: nowrap;
    gap: 4px;
}

.repair-sheet .photo-strip img {
    width: 34px;
    height: 34px;
    border-radius: 5px;
}

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

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.price {
    font-weight: 800;
    color: var(--accent-strong);
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 9px;
    border-radius: 999px;
    background: #e5e7eb;
    color: #374151;
    font-size: 0.82rem;
    font-weight: 800;
    white-space: nowrap;
}

.badge.pending-receipt,
.badge.to-be-processed {
    background: #fef3c7;
    color: #92400e;
}

.badge.received,
.badge.diagnosing,
.badge.in-repair,
.badge.waiting-parts,
.badge.new,
.badge.pending-approval {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge.in-process {
    background: #e0e7ff;
    color: #4338ca;
}

.badge.part-order {
    background: #fce7f3;
    color: #9d174d;
}

.badge.ready,
.badge.completed {
    background: #dcfce7;
    color: #166534;
}

.badge.delivered,
.badge.paid {
    background: #e0f2fe;
    color: #075985;
}

.badge.cancelled,
.badge.canceled,
.badge.void {
    background: #fee2e2;
    color: #991b1b;
}

.badge.posted {
    background: #dcfce7;
    color: #166534;
}

.badge.paid {
    background: #dcfce7;
    color: #166534;
}

.badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.badge.draft {
    background: #e5e7eb;
    color: #374151;
}

.badge.sent {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge.unpaid {
    background: #fef3c7;
    color: #92400e;
}

.badge.no-charge {
    background: #e5e7eb;
    color: #374151;
}

.empty {
    padding: 32px;
    color: var(--muted);
    text-align: center;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.inline-form select,
.inline-form input {
    width: auto;
    min-width: 140px;
}

.compact-status-form {
    flex-wrap: nowrap;
    gap: 6px;
}

.compact-status-form select {
    min-width: 145px;
    max-width: 170px;
    min-height: 34px;
    padding-top: 5px;
    padding-bottom: 5px;
}

.compact-status-form button {
    white-space: nowrap;
}

.compact-save-state {
    min-width: 54px;
    color: var(--muted);
    font-size: 0.78rem;
}

.status-row-pending-approval > td {
    background: #fff4cc;
}

.status-row-new > td {
    background: #eaf2ff;
}

.status-row-in-process > td {
    background: #eeeafe;
}

.status-row-part-order > td {
    background: #fdf0f7;
}

.status-row-to-be-processed > td {
    background: #fff9e8;
}

.status-row-completed > td {
    background: #eaf8ee;
}

.status-row-paid > td {
    background: #eef8f6;
}

.status-row-canceled > td {
    background: #fff0f0;
}

.cost-items-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.cost-items {
    display: grid;
    gap: 8px;
}

.customer-intake-form {
    display: grid;
    gap: 18px;
}

.customer-service-price-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(150px, 0.22fr);
    gap: 10px;
    align-items: start;
}

.service-line-headings {
    display: grid;
    grid-template-columns: minmax(180px, 2fr) minmax(110px, 1fr) minmax(110px, 1fr) 38px;
    gap: 8px;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 750;
}

.customer-price-summary {
    display: grid;
    gap: 10px;
    align-content: start;
}

.customer-price-summary .field {
    align-content: start;
}

.customer-price-summary input {
    min-height: 44px;
    font-weight: 800;
    text-align: right;
}

.service-add-row {
    display: flex;
    justify-content: flex-end;
    padding-top: 7px;
}

.service-add-row button {
    width: 58px;
}

.cost-item-row {
    display: grid;
    grid-template-columns: minmax(180px, 2fr) minmax(110px, 1fr) minmax(110px, 1fr) 44px 38px;
    gap: 8px;
    align-items: center;
}

.cost-item-row.customer-service-row {
    grid-template-columns: minmax(180px, 2fr) minmax(100px, 0.8fr) minmax(100px, 0.8fr) 38px;
}

.charge-complete-control {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin: 0;
    cursor: pointer;
}

.charge-complete-control input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.charge-complete-control span {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 2px solid var(--line);
    border-radius: 4px;
    color: transparent;
    font-weight: 900;
}

.charge-complete-control input[type="checkbox"]:checked + span {
    border-color: #178447;
    background: #178447;
    color: #fff;
}

.customer-charge-check {
    display: inline-grid;
    place-items: center;
    width: 24px;
    min-height: 24px;
    color: transparent;
    font-weight: 900;
    justify-self: start;
}

.customer-charge-check.is-complete {
    color: #178447;
}

.icon-button {
    min-width: 34px;
    padding-inline: 9px;
    font-size: 1.15rem;
    line-height: 1;
}

.repair-action-edit-form {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(120px, 1fr);
    gap: 8px 12px;
    align-items: end;
}

.quick-form-field {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.repair-action-edit-form > textarea,
.repair-action-edit-form > button {
    grid-column: 1 / -1;
}

.note-format-toolbar {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel-soft);
}

.note-format-toolbar select {
    width: auto;
    min-width: 145px;
}

.note-format-toolbar .note-format-button {
    grid-column: auto;
    width: 36px;
    min-width: 36px;
    padding: 8px;
}

.note-format-button.note-size-small {
    font-size: 0.72rem;
}

.note-format-button.note-size-large {
    font-size: 1.18rem;
}

.note-color-grid {
    display: grid;
    grid-template-columns: repeat(8, 20px);
    gap: 2px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--panel);
}

.note-color-picker {
    position: relative;
}

.note-color-picker > summary {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 36px;
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--panel);
    cursor: pointer;
    list-style: none;
}

.note-color-picker > summary::-webkit-details-marker {
    display: none;
}

.note-current-color {
    display: block;
    width: 22px;
    height: 20px;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: #000000;
}

.note-color-picker .note-color-grid {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    z-index: 95;
    width: max-content;
    box-shadow: var(--shadow);
}

.note-color-grid .note-color-swatch {
    grid-column: auto;
    width: 20px;
    min-width: 20px;
    height: 20px;
    min-height: 20px;
    padding: 0;
    border: 2px solid #ffffff;
    border-radius: 1px;
    background: var(--note-color);
    box-shadow: 0 0 0 1px var(--line);
}

.note-color-grid .note-color-swatch:hover,
.note-color-grid .note-color-swatch:focus-visible {
    transform: scale(1.12);
    outline: 2px solid var(--blue);
    outline-offset: 1px;
}

.rich-note-editor {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 92px;
    padding: 10px 12px;
    overflow-wrap: anywhere;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
    color: var(--text);
    line-height: 1.45;
}

.rich-note-editor:focus {
    border-color: var(--accent);
    outline: 2px solid color-mix(in srgb, var(--accent) 22%, transparent);
}

.rich-note-editor:empty::before {
    content: attr(data-placeholder);
    color: var(--muted);
    pointer-events: none;
}

.note-size-small-text {
    font-size: 0.82em;
}

.note-size-normal-text {
    font-size: 1em;
}

.note-size-large-text {
    font-size: 1.28em;
}

.note-log-entry ul,
.note-log-entry ol {
    margin: 6px 0 6px 22px;
    padding: 0;
}

.note-color-control {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--panel);
    cursor: pointer;
}

.note-color-control input[type="color"] {
    width: 30px;
    height: 26px;
    padding: 0;
    border: 0;
}

.previous-notes-title {
    margin-top: 22px;
}

@media (max-width: 720px) {
    .cost-item-row,
    .customer-service-price-line,
    .service-line-headings {
        grid-template-columns: 1fr;
    }

    .quick-cost-heading {
        display: none;
    }
}

.searchable-select {
    position: relative;
    width: 100%;
}

.searchable-select-input {
    width: 100%;
}

.searchable-select-native {
    position: absolute;
    width: 1px;
    height: 1px;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0;
    pointer-events: none;
}

.searchable-select-options {
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18);
}

.searchable-select-option {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    font-size: 0.9rem;
    font-weight: 750;
}

.searchable-select-option:hover,
.searchable-select-option.active {
    background: #e0f2fe;
}

.searchable-select-option.selected {
    color: var(--accent-strong);
}

.pricing-grid-wrap {
    width: 100%;
    overflow-x: auto;
}

.pricing-grid-wrap.search-open {
    overflow: visible;
}

.pricing-grid {
    width: 100%;
    min-width: 1040px;
    table-layout: fixed;
    font-size: 0.9rem;
}

.pricing-grid th,
.pricing-grid td {
    padding: 8px;
    vertical-align: middle;
}

.pricing-grid th:nth-child(1),
.pricing-grid td:nth-child(1) {
    width: 210px;
}

.pricing-grid th:nth-child(2),
.pricing-grid td:nth-child(2),
.pricing-grid th:nth-child(3),
.pricing-grid td:nth-child(3) {
    width: 150px;
}

.pricing-grid th:nth-child(4),
.pricing-grid td:nth-child(4) {
    width: 180px;
}

.pricing-grid th:nth-child(5),
.pricing-grid td:nth-child(5) {
    width: 220px;
}

.pricing-grid th:nth-child(6),
.pricing-grid td:nth-child(6) {
    width: 118px;
}

.pricing-grid th:nth-child(7),
.pricing-grid td:nth-child(7) {
    width: 86px;
}

.pricing-grid select,
.pricing-grid input {
    min-height: 36px;
    padding: 7px 8px;
    border-radius: 6px;
}

.pricing-grid .price-edit-cell input {
    color: var(--accent-strong);
    font-weight: 850;
    text-align: right;
}

.pricing-cell-main {
    color: var(--accent-strong);
    font-weight: 850;
}

.pricing-add-grid {
    min-width: 1100px;
}

.pricing-filter-form {
    align-items: end;
}

.price-grid-status {
    margin-left: auto;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 850;
}

.price-grid-status.saving {
    color: #92400e;
}

.price-grid-status.saved {
    color: #166534;
}

.price-grid-status.error {
    color: #991b1b;
}

.save-status {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 850;
}

.save-status.saving {
    color: #92400e;
}

.save-status.saved {
    color: #166534;
}

.save-status.error {
    color: #991b1b;
}

.price-builder {
    display: grid;
    gap: 14px;
}

.price-builder-main {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(160px, 220px);
    gap: 14px;
}

.price-scope-grid,
.price-card-scope {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.price-builder-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
}

.price-field input {
    color: var(--accent-strong);
    font-weight: 850;
}

.price-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
}

.price-card {
    display: grid;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--accent);
    border-radius: 8px;
    background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 72%);
}

.price-card:nth-child(6n+2) {
    border-left-color: #2563eb;
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 72%);
}

.price-card:nth-child(6n+3) {
    border-left-color: #b45309;
    background: linear-gradient(135deg, #fffbeb 0%, #ffffff 72%);
}

.price-card:nth-child(6n+4) {
    border-left-color: #0e7490;
    background: linear-gradient(135deg, #ecfeff 0%, #ffffff 72%);
}

.price-card:nth-child(6n+5) {
    border-left-color: #be123c;
    background: linear-gradient(135deg, #fff1f2 0%, #ffffff 72%);
}

.price-card:nth-child(6n+6) {
    border-left-color: #6d28d9;
    background: linear-gradient(135deg, #f5f3ff 0%, #ffffff 72%);
}

.price-card.archived-card {
    border-left-color: #991b1b;
    background: #f9fafb;
}

.price-card-top,
.price-card-footer {
    display: grid;
    gap: 10px;
}

.price-card-top {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
}

.price-card-summary {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 750;
}

.price-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.invoice-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    min-width: 360px;
}

.invoice-pay-form {
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.invoice-pay-form input,
.invoice-pay-form select {
    min-width: 126px;
}

.invoice-detail-panel {
    scroll-margin-top: 18px;
}

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

.invoice-detail-table th {
    background: #dcefed;
    color: var(--ink);
    border: 1px solid #a7bbc6;
}

.invoice-detail-table td {
    border: 1px solid #cbd7df;
}

.invoice-detail-table tfoot td {
    background: #fff8f8;
    font-weight: 850;
}

.invoice-total-red {
    color: #b01818;
    font-size: 1.04rem;
    font-weight: 900;
}

.account-profile {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: start;
}

.account-logo-card {
    display: grid;
    place-items: center;
    min-height: 132px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    background: #ffffff;
    order: 1;
    width: 100%;
}

.account-logo-card img {
    max-width: 190px;
    max-height: 96px;
    object-fit: contain;
}

.account-logo-upload {
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 12px;
}

.account-logo-upload input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.account-logo-upload .button {
    margin: 0;
}

.account-logo-help {
    grid-column: 1 / -1;
    max-width: 360px;
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.4;
    text-align: center;
}

.account-logo-remove {
    margin-top: 8px;
}

.account-profile-details {
    display: grid;
    gap: 16px;
    order: 2;
}

.account-profile-heading {
    display: grid;
    gap: 3px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.account-profile-heading span,
.account-profile-heading small {
    color: var(--muted);
}

.account-profile-heading strong {
    font-size: 1.2rem;
}

.account-contact-form input[readonly] {
    color: var(--muted);
    background: var(--panel-soft);
}

.account-profile-actions {
    align-self: end;
}

.suggestion-list {
    display: grid;
    gap: 12px;
}

.suggestion-entry {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--panel);
}

.suggestion-meta {
    display: grid;
    gap: 2px;
    margin-bottom: 10px;
}

.suggestion-meta span {
    color: var(--muted);
    font-size: 0.82rem;
}

.suggestion-text {
    margin-bottom: 14px;
    padding: 12px;
    border-left: 3px solid var(--accent);
    background: var(--panel-soft);
}

.logo-placeholder {
    color: var(--muted);
    font-weight: 750;
}

.note-cell {
    min-width: 180px;
    max-width: 260px;
    color: #2f3b48;
    line-height: 1.45;
}

.user-list-table {
    min-width: 940px;
}

.user-list-row {
    border-left: 5px solid var(--accent);
    cursor: pointer;
}

.user-list-row.role-super-admin {
    border-left-color: #6d28d9;
    background: #faf5ff;
}

.user-list-row.role-data-entry {
    border-left-color: #2563eb;
    background: #eff6ff;
}

.user-list-row.role-customer {
    border-left-color: #0f766e;
    background: #ecfdf5;
}

.user-list-row.archived-row {
    cursor: default;
    opacity: 0.82;
}

.user-list-row:hover,
.user-list-row:focus-visible {
    background: #ffffff;
    outline: 3px solid rgba(15, 118, 110, 0.12);
}

.role-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 850;
}

.role-badge.role-super-admin {
    background: #ede9fe;
    color: #5b21b6;
}

.role-badge.role-data-entry {
    background: #dbeafe;
    color: #1d4ed8;
}

.role-badge.role-customer {
    background: #d1fae5;
    color: #065f46;
}

.note-edit {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.note-edit textarea {
    min-width: 220px;
}

.repair-action-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    place-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.66);
}

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

.repair-action-modal.open {
    display: grid;
}

.repair-action-box {
    width: min(860px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: #ffffff;
    border-radius: 8px;
    padding: 18px;
    box-shadow: var(--shadow);
}

.repair-action-box.search-open {
    overflow: visible;
}

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

.repair-action-header h2 {
    margin-bottom: 4px;
}

.repair-action-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.repair-action-summary strong {
    display: block;
    overflow-wrap: anywhere;
}

.repair-action-summary .sheet-sub {
    font-weight: 800;
}

.export-excel-button {
    background: #15803d;
    color: #ffffff;
}

.export-excel-button:hover,
.export-excel-button:focus-visible { background: #166534; }

.payment-security-message {
    margin: 0 0 14px;
    padding: 11px 13px;
    border: 1px solid #f3a5a5;
    border-radius: 7px;
    color: #b91c1c;
    background: #fff1f2;
    font-weight: 700;
    line-height: 1.4;
}

.invoice-entry-sheet {
    table-layout: fixed;
    min-width: 1180px;
}

.invoice-entry-sheet th:nth-child(2),
.invoice-entry-sheet td:nth-child(2) { width: 84px; }

.invoice-entry-sheet th:nth-child(4),
.invoice-entry-sheet td:nth-child(4) { width: 88px; }

.invoice-entry-sheet th:nth-child(5),
.invoice-entry-sheet td:nth-child(5) { width: 72px; }

.invoice-entry-sheet th:nth-child(9),
.invoice-entry-sheet td:nth-child(9) { width: 330px; }

.invoice-detail-description {
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px solid var(--line);
}

.invoice-detail-description span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.invoice-detail-description p {
    margin: 3px 0 0;
    color: var(--text);
    line-height: 1.4;
}

.suggestion-action-row {
    display: flex;
    gap: 10px;
    align-items: end;
}

.suggestion-update-form {
    display: grid;
    grid-template-columns: minmax(120px, 0.35fr) minmax(320px, 1.65fr) auto;
    gap: 10px;
    align-items: end;
    flex: 1;
}

.suggestion-delete-form { padding-bottom: 1px; }

@media (max-width: 760px) {
    .suggestion-action-row,
    .suggestion-update-form { display: grid; grid-template-columns: 1fr; }
}

.filter-details {
    margin-top: 10px;
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.filter-details summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--primary);
    font-weight: 800;
    list-style: none;
}

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

.filter-details-plus,
.filter-details-minus {
    display: inline-grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    font-size: 1.1rem;
}

.filter-details-minus,
.filter-details[open] .filter-details-plus {
    display: none;
}

.filter-details[open] .filter-details-minus {
    display: inline-grid;
}

.filter-details .form-grid {
    margin-top: 12px;
}

.full-summary-row {
    grid-column: 1 / -1;
}

.price-breakdown summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    list-style: none;
}

.price-breakdown summary::-webkit-details-marker {
    display: none;
}

.price-breakdown summary > span {
    color: var(--primary);
    font-size: 1.2rem;
    font-weight: 800;
}

.price-breakdown[open] summary > span {
    transform: rotate(45deg);
}

.price-breakdown-table {
    position: absolute;
    z-index: 6;
    right: 0;
    min-width: 500px;
    max-width: min(680px, calc(100vw - 64px));
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    box-shadow: var(--shadow);
    font-size: 0.86rem;
}

.price-breakdown-table.inline {
    position: static;
    min-width: 0;
    max-width: none;
    margin-top: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.price-breakdown {
    position: relative;
}

.price-breakdown > div:not(.price-breakdown-table) {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.86rem;
}

.price-breakdown-heading,
.price-breakdown-row {
    display: grid;
    grid-template-columns: minmax(120px, 1.4fr) repeat(3, minmax(72px, 0.7fr)) 28px;
    gap: 8px;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--line);
}

.repair-charge-summary .price-breakdown-table {
    width: 100%;
    min-width: 0;
}

.repair-charge-summary > .summary-label {
    display: block;
    width: 100%;
    margin-bottom: 6px;
    padding-bottom: 5px;
    border-bottom: 1px solid #111111;
    color: #111111;
    font-weight: 850;
}

html[data-theme="dark"] .repair-charge-summary > .summary-label {
    border-bottom-color: var(--text);
    color: var(--text);
}

.price-breakdown-heading {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.price-breakdown-row span,
.price-breakdown-row strong:not(:first-child),
.price-breakdown-heading span:not(:first-child) {
    text-align: right;
}

.price-breakdown-row:last-child {
    border-bottom: 0;
}

.charge-part-value,
.charge-labor-value,
.charge-total-value {
    display: inline-block;
    justify-self: end;
    padding: 3px 7px;
    border-radius: 4px;
    font-weight: 800;
}

.charge-part-value {
    color: #1d4ed8;
    background: #dbeafe;
}

.charge-labor-value {
    color: #0f766e;
    background: #ccfbf1;
}

.charge-total-value.unpaid {
    color: #111827;
    background: #fee2e2;
}

.charge-total-value.paid {
    color: #111827;
    background: #dcfce7;
}

.customer-quick-price {
    color: #b91c1c;
}

@media (max-width: 620px) {
    .price-breakdown-table:not(.inline) {
        right: 0;
        width: calc(100vw - 48px);
        min-width: 0;
        max-width: none;
    }

    .price-breakdown-heading,
    .price-breakdown-row {
        grid-template-columns: minmax(90px, 1.25fr) repeat(3, minmax(58px, 0.75fr)) 24px;
        font-size: 0.76rem;
    }
}

.quick-cost-editor {
    margin: 12px 0;
    overflow: visible;
}

.repair-action-modal .searchable-select-options {
    z-index: 250;
    max-height: 260px;
}

.invoice-entry-row.invoice-paid > td {
    background: #e9f8ee;
}

.invoice-entry-row.invoice-unpaid > td {
    background: #fff0f0;
}

.api-key-stat strong {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-size: 0.82rem;
}

html[data-theme="dark"] .user-list-row.role-super-admin,
html[data-theme="dark"] .user-list-row.role-data-entry,
html[data-theme="dark"] .user-list-row.role-customer,
html[data-theme="dark"] .user-list-row.archived-row {
    color: var(--text);
    background: var(--panel);
}

html[data-theme="dark"] .user-list-row:hover > td,
html[data-theme="dark"] .user-list-row:focus-visible > td {
    color: var(--text);
    background: #2a3747;
}

html[data-theme="dark"] .invoice-entry-row.invoice-paid > td {
    color: var(--text);
    background: #183b2b;
}

html[data-theme="dark"] .invoice-entry-row.invoice-unpaid > td {
    color: var(--text);
    background: #45282d;
}

html[data-theme="dark"] .invoice-entry-row a,
html[data-theme="dark"] .user-list-row a {
    color: #93c5fd;
}

.invoices-admin-layout {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas: "create" "selection" "list";
    gap: 18px;
    align-items: start;
}

.invoice-create-flow {
    display: grid;
    grid-template-columns: minmax(260px, 1.4fr) minmax(220px, 0.8fr) auto;
    gap: 12px;
    align-items: end;
}

.invoice-description-form {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) auto;
    gap: 6px;
    min-width: 240px;
}

.invoice-identity-box {
    display: grid;
    gap: 3px;
    min-width: 250px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--panel-soft);
}

.invoice-identity-box span,
.invoice-identity-box small { color: var(--muted); }

.invoice-identity-box strong { font-size: 1.05rem; }

.invoice-identity-box .invoice-identity-total {
    font-size: 1rem;
}

.invoice-identity-total.unpaid { color: #b91c1c; }
.invoice-identity-total.paid { color: #15803d; }

.invoice-create-panel { grid-area: create; }
.invoice-list-panel { grid-area: list; }
.invoice-selection-panel { grid-area: selection; }

@media (max-width: 980px) {
    .invoices-admin-layout {
        grid-template-columns: 1fr;
        grid-template-areas: "create" "selection" "list";
    }

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

.quick-cost-heading,
.quick-cost-row {
    display: grid;
    grid-template-columns: minmax(150px, 1.8fr) repeat(2, minmax(68px, 0.55fr)) 38px 38px;
    gap: 8px;
    align-items: center;
    min-width: 480px;
}

.quick-cost-row > .icon-button,
.quick-cost-row > .charge-complete-control {
    align-self: center;
    justify-self: center;
}

.repair-action-edit-form .quick-cost-row > button {
    grid-column: auto;
    width: 34px;
    min-width: 34px;
    margin: 0;
    padding-inline: 7px;
}

.quick-cost-row input[data-cost-item-part],
.quick-cost-row input[data-cost-item-labor] {
    min-width: 0;
    width: 100%;
    padding-inline: 8px;
}

.quick-total-row {
    display: grid;
    grid-template-columns: minmax(150px, 1.8fr) repeat(2, minmax(68px, 0.55fr)) 38px 38px;
    gap: 8px;
    align-items: center;
    min-width: 480px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.quick-total-row label {
    grid-column: 2;
    text-align: right;
}

.quick-total-row input {
    grid-column: 3;
    min-width: 0;
    font-weight: 850;
    text-align: right;
}

.customer-charge-totals {
    display: grid;
    justify-content: end;
    gap: 5px;
    margin-top: 8px;
}

.customer-charge-totals > div {
    display: grid;
    grid-template-columns: 90px 110px;
    gap: 12px;
    align-items: center;
    text-align: right;
}

.customer-charge-totals > div:last-child {
    padding-top: 6px;
    border-top: 1px solid var(--line);
}

.customer-quick-price.unpaid {
    color: #111827;
    padding: 4px 8px;
    border-radius: 4px;
    background: #fee2e2;
}

.customer-quick-price.paid {
    color: #111827;
    padding: 4px 8px;
    border-radius: 4px;
    background: #dcfce7;
}

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

.checkbox-option {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.checkbox-option input {
    width: auto;
}

.checkbox-choice-group {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 10px 16px;
}

.quick-cost-heading {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
}

.quick-cost-row + .quick-cost-row {
    margin-top: 8px;
}

.summary-label {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
}

.repair-action-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0;
}

.repair-label-print-button {
    margin-left: auto;
}

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

.repair-action-panel {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.repair-action-panel.full {
    grid-column: 1 / -1;
}

.repair-action-panel h3 {
    margin-bottom: 10px;
    font-size: 0.98rem;
}

.repair-action-modal .inline-form input,
.repair-action-modal .inline-form select {
    min-width: 150px;
}

.repair-action-modal .note-edit textarea {
    width: 100%;
}

.note-log {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
}

.note-log-entry {
    width: fit-content;
    max-width: min(78%, 720px);
    padding: 10px 12px;
    border: 0;
    border-radius: 16px;
    color: #ffffff;
}

.note-log-entry.note-role-admin {
    justify-self: end;
    background: #0b84fe;
}

.note-log-entry.note-role-customer {
    justify-self: start;
    background: #34c759;
}

.note-log-entry .note-log-meta,
.note-log-entry .muted {
    color: rgba(255, 255, 255, 0.82);
}

.note-log-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.82rem;
    font-weight: 750;
}

.note-delete-form {
    margin-left: auto;
}

.note-delete-form button {
    min-height: 28px;
    padding: 4px 8px;
    font-size: 0.76rem;
}

.code-block {
    overflow-x: auto;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text);
}

.check-cell {
    width: 42px;
}

.delete-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
    place-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.7);
}

.delete-modal.open {
    display: grid;
}

.delete-box {
    width: min(460px, 100%);
    background: #ffffff;
    border: 2px solid var(--red);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.delete-box h2 {
    color: var(--red);
    margin-bottom: 10px;
}

.delete-box p {
    color: #7f1d1d;
}

.camera-modal {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: none;
    place-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.74);
}

.camera-modal.open {
    display: grid;
}

.camera-box {
    width: min(720px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: #ffffff;
    border-radius: 8px;
    padding: 16px;
    box-shadow: var(--shadow);
}

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

.camera-header h2 {
    margin-bottom: 4px;
}

.camera-stage {
    margin-top: 12px;
}

.camera-stage video,
.camera-stage img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    border-radius: 7px;
    background: #0f172a;
}

.camera-status {
    min-height: 24px;
    color: var(--muted);
    margin: 10px 0;
}

@media print {
    .sidebar,
    .topbar .toolbar,
    .button,
    button,
    form {
        display: none !important;
    }

    .shell {
        display: block;
    }

    .main {
        padding: 0;
    }

    .panel {
        box-shadow: none;
        border: 0;
    }
}

.photo-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.photo-strip img {
    width: 76px;
    height: 76px;
    object-fit: cover;
    border-radius: 7px;
    border: 1px solid var(--line);
}

/* New Entry photo controls and timestamped note thumbnails */
.new-entry-photo {
    display: grid;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.new-entry-photo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.new-entry-camera {
    max-width: 640px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
}

.new-entry-camera video {
    display: block;
    width: 100%;
    max-height: 420px;
    margin-bottom: 10px;
    object-fit: contain;
    background: #111111;
}

.new-entry-photo-preview,
.note-photo-entry {
    width: 132px;
    margin: 0;
}

.new-entry-photo-preview img,
.note-photo-entry img {
    display: block;
    width: 132px;
    height: 96px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 5px;
}

.new-entry-photo-preview figcaption,
.note-photo-entry figcaption {
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.note-photo-log {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #111111;
}

html[data-theme="dark"] .note-photo-log {
    border-top-color: var(--line);
}

.photo-toolbar {
    margin-top: 14px;
}

.auth {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-card {
    width: min(460px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 28px;
}

.auth-card .brand {
    align-items: flex-start;
    flex-direction: column;
    color: var(--text);
    margin-bottom: 22px;
}

.auth-logo {
    display: block;
    width: min(330px, 100%);
    height: auto;
}

.price-preview {
    width: fit-content;
    min-width: min(100%, 280px);
    max-width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    border: 1px solid #b8d8d4;
    border-radius: 8px;
    background: #effcf9;
    color: #2f3b48;
    font-size: 0.88rem;
    font-weight: 750;
    line-height: 1.25;
}

.price-preview strong {
    color: var(--accent-strong);
    font-size: 1rem;
    white-space: nowrap;
}

.price-estimate-disclaimer {
    max-width: 560px;
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.35;
}

.scanner-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    place-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.74);
}

.scanner-modal.open {
    display: grid;
}

.scanner-box {
    width: min(560px, 100%);
    background: #ffffff;
    border-radius: 8px;
    padding: 16px;
}

.scanner-box video {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 7px;
    background: #0f172a;
}

.scanner-status {
    min-height: 24px;
    color: var(--muted);
    margin: 10px 0;
}

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

    .sidebar {
        position: static;
    }

    .admin-shell .sidebar {
        position: sticky;
        grid-template-columns: minmax(0, 1fr) auto;
        padding-inline: 16px;
    }

    .admin-shell .nav {
        grid-template-columns: none;
    }

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

    .grid.three,
    .grid.four,
    .grid.five,
    .grid.six,
    .form-grid,
    .form-grid.three,
    .form-grid.four,
    .form-grid.five,
    .form-grid.six,
    .form-grid.two-tight,
    .price-builder-main,
    .price-scope-grid,
    .price-card-scope,
    .price-builder-footer,
    .account-profile {
        grid-template-columns: 1fr;
    }

    .form-grid .field.wide {
        grid-column: 1;
    }
}

@media (max-width: 620px) {
    .main {
        padding: 18px;
    }

    .topbar,
    .panel-header {
        align-items: stretch;
        flex-direction: column;
    }

    .portal-logo {
        width: min(270px, 100%);
    }

    .topbar-account {
        text-align: left;
    }

    .customer-logo {
        margin-left: 0;
    }

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

    .admin-shell .sidebar {
        grid-template-columns: 1fr;
    }

    .admin-brand-tools {
        justify-self: stretch;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .header-user-identity {
        text-align: left;
    }

    .admin-left-logo {
        width: 125px;
        height: 40px;
    }

    .admin-shell .nav {
        grid-column: 1;
        display: flex;
    }

    td.actions {
        min-width: 180px;
    }

    .repair-action-summary,
    .repair-action-grid {
        grid-template-columns: 1fr;
    }

    .repair-action-modal .inline-form input,
    .repair-action-modal .inline-form select {
        width: 100%;
    }
}

/* Received note control */
.approval-panel {
    margin: 14px 0;
    padding: 14px;
    border: 1px solid #f1c96b;
    border-radius: 7px;
    background: #fff8df;
}

.approval-panel.approval-approved {
    border-color: #78c995;
    background: #eaf8ef;
}

.approval-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.approval-panel-heading > div {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.approval-panel-heading strong {
    color: #a61b1b;
    font-size: 1.15rem;
}

.approval-approved .approval-panel-heading strong {
    color: #14733b;
}

.approval-summary {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(15, 23, 42, 0.16);
    line-height: 1.55;
}

.approval-meta,
.approval-sms-status {
    margin-top: 8px;
    color: #526071;
    font-size: 0.84rem;
}

.approval-sms-status span {
    display: block;
    margin-top: 3px;
    color: #a61b1b;
}

.approval-form {
    margin-top: 12px;
}

.badge.approval-pending {
    background: #fef0b7;
    color: #875300;
}

.badge.approval-approved {
    background: #ccf1d9;
    color: #126534;
}

html[data-theme="dark"] .approval-panel {
    border-color: #8b6a25;
    background: #332a16;
}

html[data-theme="dark"] .approval-panel.approval-approved {
    border-color: #2f7c4b;
    background: #173324;
}

html[data-theme="dark"] .approval-meta,
html[data-theme="dark"] .approval-sms-status {
    color: #c7d2df;
}

.received-note-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--panel);
    color: var(--text);
    font-size: 0.84rem;
    font-weight: 750;
    cursor: pointer;
    white-space: nowrap;
}

.received-note-control input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: #15803d;
}

.received-note-control span {
    color: #15803d;
    font-weight: 900;
}

/* Dashboard status colors and attention pulse. */
.stat-completed { background: #e8f7ed; border-color: #6db984; }
.stat-balance-box { background: #fdeaea; border-color: #db8585; }
html[data-theme="dark"] .stat-completed { background: #173823; border-color: #3f9b5c; }
html[data-theme="dark"] .stat-balance-box { background: #432326; border-color: #b85b63; }

@keyframes stat-attention-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(185, 28, 28, 0), var(--shadow); }
    50% { box-shadow: 0 0 0 6px rgba(185, 28, 28, 0.34), var(--shadow); }
}

.stat-attention {
    animation: stat-attention-pulse 0.6s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    .stat-attention { animation: none; outline: 3px solid #b91c1c; }
}

/* Customer password panel. */
.account-password-panel {
    margin-top: 18px;
}

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

/* On-page IMEI label print preview. */
.imei-label-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    place-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.68);
}

.imei-label-modal.open {
    display: grid;
}

.imei-label-box {
    width: min(560px, 100%);
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.imei-label-preview {
    display: grid;
    place-items: center;
    min-height: 180px;
    margin: 16px 0;
    padding: 24px;
    overflow: auto;
    border: 1px solid var(--line);
    background: #eef2f6;
}

.imei-label-preview iframe {
    width: 2in;
    height: 0.5in;
    border: 0;
    background: #ffffff;
}

.imei-label-actions {
    justify-content: flex-end;
}

/* Navy admin action button. */
.repair-label-print-button {
    margin-left: auto;
    border-color: #082b5c;
    background: #082b5c;
    color: #ffffff;
}

.repair-label-print-button:hover,
.repair-label-print-button:focus-visible {
    border-color: #061f42;
    background: #061f42;
    color: #ffffff;
}

@media (max-width: 720px) {
    .account-password-actions {
        align-items: stretch;
        flex-direction: column;
    }
}
