:root {
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", "Liberation Mono", Menlo, monospace;

    --color-bg-app: #f8fafc;
    --color-surface: #ffffff;
    --color-header: #f1f5f9;
    --color-border: #e2e8f0;
    --color-border-strong: #cbd5e1;

    --color-text: #0f172a;
    --color-text-secondary: #475569;
    --color-text-muted: #64748b;

    --color-brand: #0284c7;
    --color-brand-hover: #0369a1;
    --color-focus: #38bdf8;

    --color-success-bg: #dcfce7;
    --color-success-fg: #166534;
    --color-warn-bg: #fef9c3;
    --color-warn-fg: #854d0e;
    --color-neutral-bg: #f1f5f9;
    --color-neutral-fg: #334155;

    --color-surface-subtle: #f1f5f9;
    --color-secondary-text: #334155;

    --outcome-imported-accent: #0d9488;
    --outcome-imported-bg: #f0fdfa;
    --outcome-updated-accent: #0284c7;
    --outcome-updated-bg: #f0f9ff;
    --outcome-unchanged-accent: #475569;
    --outcome-unchanged-bg: #f8fafc;
    --outcome-invalid-accent: #dc2626;
    --outcome-invalid-bg: #fef2f2;
    --outcome-failed-accent: #d97706;
    --outcome-failed-bg: #fffbeb;
}

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

html {
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-bg-app);
}

body {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
}

code,
pre,
.ident,
.ticket-link,
.cell-amount,
.doc-number,
.totals-list dd,
.items-table .num {
    font-family: var(--font-mono);
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    padding: 6px 12px;
    background: var(--color-surface);
    color: var(--color-brand);
    z-index: 100;
}

.skip-link:focus {
    left: 0;
}

.focus-ring:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.app-header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 28px;
    min-height: 56px;
    padding: 0 24px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
    border-radius: 6px;
}

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

.app-brand:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.brand-mark {
    display: block;
    width: 26px;
    height: 26px;
}

.menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-left: auto;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--color-text);
    cursor: pointer;
}

.menu-toggle:hover {
    background: var(--color-header);
}

.menu-toggle:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.app-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

/* Right-side utility cluster: Admin begins the cluster (auto margin pushes
   it to the right edge); the account control remains the rightmost item. */
.nav-group-end {
    margin-left: auto;
}

.nav-top-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--color-text-secondary);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.nav-top-link:hover {
    background: var(--color-header);
    color: var(--color-text);
}

.nav-top-link:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.nav-page-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--color-text-secondary);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.nav-page-link:hover {
    background: var(--color-header);
    color: var(--color-text);
}

.nav-page-link:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.nav-page-link.is-active {
    color: var(--color-brand);
}

.nav-username {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-identity {
    display: block;
    padding: 9px 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.nav-signout-form {
    margin: 0;
}

.nav-link-button {
    width: 100%;
    border: 0;
    background: none;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.nav-group {
    position: relative;
}

.nav-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--color-text-secondary);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.nav-trigger:hover {
    background: var(--color-header);
    color: var(--color-text);
}

.nav-trigger:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.nav-trigger.is-active {
    color: var(--color-brand);
}

.nav-chevron {
    display: block;
}

.nav-group[data-open] .nav-chevron {
    transform: rotate(180deg);
}

.nav-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 244px;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 8px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

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

/* Right-cluster dropdowns anchor to the right edge of their group and open
   inward, so they never extend past the viewport or grow the scroll width.
   This rule must follow .nav-menu: equal specificity means only a later
   declaration can undo the left: 0 on .nav-menu. */
.nav-menu-end {
    left: auto;
    right: 0;
}

/* The Administration menu holds a few short destinations; size it to its
   content instead of the generic dropdown minimum. Natural rendered width
   measured in a real browser is ~137px; 168px covers font-metric variance
   without dead space. */
.nav-menu-compact {
    min-width: 168px;
}

.nav-link {
    display: block;
    padding: 9px 12px;
    border: 0;
    border-radius: 6px;
    color: var(--color-text);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.nav-link:hover {
    background: var(--color-header);
}

.nav-link:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: -2px;
}

.nav-link.is-active {
    color: var(--color-brand);
    box-shadow: inset 3px 0 0 var(--color-brand);
}

.nav-label {
    display: block;
}

.nav-divider {
    margin: 4px 6px;
    border-top: 1px solid var(--color-border);
}

.nav-helper {
    display: block;
    margin-top: 1px;
    font-size: 12px;
    font-weight: 400;
    color: var(--color-text-muted);
}

.app-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 24px 48px;
}

.page-toolbar {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.page-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.page-meta {
    margin: 0;
    color: var(--color-text-secondary);
}

.page-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.table-frame {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
}

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

.ticket-table th,
.ticket-table td,
.items-table th,
.items-table td {
    padding: 8px 12px;
    vertical-align: top;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.ticket-table thead th,
.items-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--color-header);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-border-strong);
}

.ticket-table tbody tr:hover {
    background: var(--color-bg-app);
}

.ticket-id-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.ticket-link {
    color: var(--color-brand);
    font-weight: 600;
    text-decoration: none;
}

.ticket-link:hover {
    color: var(--color-brand-hover);
    text-decoration: underline;
}

.cell-primary {
    display: block;
    font-weight: 600;
}

.cell-muted {
    display: block;
    color: var(--color-text-muted);
    font-size: 12px;
}

.cell-amount {
    display: block;
    font-weight: 600;
}

.ident {
    font-weight: 600;
}

.val-empty {
    color: var(--color-text-muted);
    font-style: normal;
}

.ticket-line-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

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

.ticket-line-main {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.ticket-line-identity {
    min-width: 0;
    font-family: var(--font-mono);
    font-weight: 600;
    overflow-wrap: break-word;
}

.ticket-line-identity.val-empty {
    font-weight: 400;
}

.ticket-line-vendor-item {
    color: var(--color-brand);
    text-decoration: none;
}

.ticket-line-price {
    flex-shrink: 0;
    margin-left: auto;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    white-space: nowrap;
}

.ticket-line-price.val-empty {
    font-weight: 400;
}

.ticket-line-upn-meta {
    min-width: 0;
    max-width: 100%;
    color: var(--color-text-muted);
    font-size: 12px;
    line-height: 1.35;
    overflow-wrap: break-word;
}

.col-numeric,
.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

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

/* Ready to Schedule: one shared five-column record per Ticket — identity
   wraps inside its cell; the action column stays clearly separated. */
.ready-schedule-table th.col-action,
.ready-schedule-table td.cell-action {
    text-align: right;
    white-space: nowrap;
}

.ready-schedule-table .cell-identity {
    max-width: 22rem;
    overflow-wrap: break-word;
}

.ready-schedule-table .cell-phone a {
    color: inherit;
    text-decoration: none;
}

.ready-schedule-table .cell-phone a:hover {
    text-decoration: underline;
}

.empty-state {
    margin: 24px 0;
    color: var(--color-text-secondary);
}

/* Copy controls */

.copy-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
}

.btn-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    min-width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}

.ticket-id-cell .btn-copy,
.doc-identity .btn-copy-prominent {
    border-color: var(--color-border);
    background: var(--color-header);
}

.btn-copy:hover,
.btn-copy:focus-visible {
    background: var(--color-neutral-bg);
    border-color: var(--color-border-strong);
    color: var(--color-text);
}

.btn-copy:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.btn-copy.is-copied {
    color: var(--color-success-fg);
    border-color: var(--color-success-fg);
}

.icon-copy {
    display: block;
}

.copy-status {
    display: inline-block;
    min-width: 44px;
    font-size: 12px;
    color: var(--color-text-secondary);
}

/* Ticket document */

.doc-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 16px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--color-brand);
    text-decoration: none;
    font-weight: 600;
}

.btn-print {
    padding: 8px 12px;
    border: 1px solid var(--color-border-strong);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
}

.btn-print:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.ticket-doc {
    /* Ticket detail sits inside the Tickets-area sidebar layout; fill the
       right-hand main area instead of centering in a leftover narrow cap.
       Print overrides remain document-focused below. */
    max-width: none;
    margin: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 28px 28px 24px;
}

.doc-header {
    border-bottom: 1px solid var(--color-border-strong);
    padding-bottom: 18px;
    margin-bottom: 18px;
}

.doc-eyebrow {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
}

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

.doc-number {
    margin: 0;
    font-size: 34px;
    font-weight: 700;
}

.doc-order-class {
    margin: 8px 0 14px;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.summary-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 10px 12px;
    margin: 0 0 16px;
    list-style: none;
    background: var(--color-header);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text-secondary);
}

.summary-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
}

.summary-item::after {
    content: "\2022";
    color: var(--color-text-muted);
    margin-left: 12px;
}

.summary-item:last-child::after {
    content: none;
}

.doc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 0;
}

.meta-item dt {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
}

.meta-item dd {
    margin: 2px 0 0;
    font-size: 15px;
}

.doc-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}

.doc-card,
.line-detail {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 18px;
    background: var(--color-surface);
}

.doc-card-soft {
    border-color: var(--color-border);
    box-shadow: none;
}

.card-title,
.section-title {
    margin: 0 0 14px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
}

.related-tickets {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}

.related-tickets-title {
    margin-bottom: 6px;
}

.related-tickets-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.identity-block {
    margin-bottom: 14px;
}

.identity-line + .identity-line {
    margin-top: 6px;
}

.identity-value {
    font-size: 17px;
    font-weight: 600;
    color: var(--color-text);
}

.kv-list {
    margin: 0;
}

.kv-row {
    display: grid;
    grid-template-columns: 136px 1fr;
    gap: 14px;
    padding: 7px 0;
}

.kv-row dt {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
}

.kv-row dd {
    margin: 0;
    color: var(--color-text);
}

.address-value {
    white-space: pre-line;
}

.doc-lines {
    margin-bottom: 18px;
}

.items-table-wrap {
    border: 1px solid var(--color-border-strong);
    border-radius: 8px;
    overflow: hidden;
    background: var(--color-surface);
}

.items-table {
    margin-bottom: 0;
}

.items-table thead th {
    background: #e8eef6;
    color: var(--color-text);
}

.items-table th,
.items-table td {
    padding: 12px 14px;
}

.items-table tbody th,
.items-table tbody td {
    vertical-align: top;
}

.items-table tbody tr:last-child th,
.items-table tbody tr:last-child td {
    border-bottom: none;
}

.items-table tbody th {
    color: var(--color-text-secondary);
    width: 52px;
}

.item-identity {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    white-space: nowrap;
}

.item-description {
    display: block;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
    color: var(--color-text);
}

.totals-wrap {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}

.totals-ledger {
    width: min(100%, 360px);
}

.totals-title {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    text-align: right;
}

.totals-list {
    margin: 0;
}

.totals-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    padding: 4px 0;
}

.totals-row dt {
    text-align: right;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.totals-row dd {
    margin: 0;
    min-width: 110px;
    text-align: right;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

.totals-grand {
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--color-border-strong);
}

.totals-grand dt,
.totals-grand dd {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
}

.line-detail {
    margin-top: 16px;
    padding: 18px;
    border-color: var(--color-border);
    background: #fbfcfe;
}

.line-heading {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
}

.line-operational-identity {
    margin: 6px 0 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.item-source-facts {
    font-size: 12px;
    color: var(--color-text-muted);
}

.line-operational-identity + .line-caption {
    margin-top: 4px;
}

.line-caption {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 12px;
    margin: 6px 0 0;
    color: var(--color-text-secondary);
}

.line-caption-text {
    font-size: 14px;
}

.subsection-title {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
}

.line-fees {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-brand);
    border-radius: 6px;
    background: var(--color-surface);
}

.line-fees-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.line-fees-table td {
    padding: 3px 0;
    border-bottom: 1px dotted var(--color-border);
}

.line-fees-table tr:last-child td {
    border-bottom: none;
}

.line-fees-table .fee-name {
    text-align: left;
    padding-right: 12px;
    word-wrap: break-word;
}

.line-fees-table .fee-price {
    text-align: right;
    font-family: var(--font-mono);
    white-space: nowrap;
}

.product-summary {
    margin-top: 14px;
}

.product-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 24px;
    margin: 0;
}

.product-summary-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 10px;
    padding: 6px 0;
    border-top: 1px solid var(--color-border);
}

.product-summary-row dt {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
}

.product-summary-row dd {
    margin: 0;
}

.line-disclosure {
    margin-top: 12px;
    padding: 0 12px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
}

.line-disclosure summary,
.disclosure summary {
    cursor: pointer;
    color: var(--color-brand);
    font-size: 13px;
    font-weight: 600;
    padding: 12px 0 0;
}

.line-disclosure[open] summary,
.disclosure[open] summary {
    margin-bottom: 10px;
}

.line-disclosure summary:focus-visible,
.disclosure summary:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.attr-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 24px;
    margin: 0;
}

.attr-pair {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 10px;
}

.attr-pair dt {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
}

.attr-pair dd {
    margin: 0;
}

.ident {
    white-space: nowrap;
}

.ident.wrap {
    white-space: normal;
    overflow-wrap: break-word;
}

.disclosure {
    margin-top: 10px;
}

.code-block {
    margin: 8px 0 0;
    padding: 12px;
    background: var(--color-header);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    overflow-x: auto;
    font-size: 12px;
    font-family: var(--font-mono);
}

.doc-evidence {
    margin-top: 36px;
    padding: 22px 18px 18px;
    border-top: 2px solid var(--color-border-strong);
    background: var(--color-header);
    border-radius: 8px;
}

.print-timestamp {
    display: none;
}

/* Responsive */

@media (max-width: 768px) {
    .app-content {
        padding: 20px 12px 32px;
    }

    .app-header {
        gap: 12px;
        padding: 0 12px;
    }

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

    .app-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 8px 12px 12px;
        background: var(--color-surface);
        border-bottom: 1px solid var(--color-border-strong);
        box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
    }

    .app-nav.is-open {
        display: flex;
    }

    .nav-group {
        position: static;
    }

    .nav-trigger {
        width: 100%;
        min-height: 44px;
        justify-content: space-between;
    }

    .nav-top-link,
    .nav-page-link {
        width: 100%;
        min-height: 44px;
    }

    .nav-username {
        max-width: none;
    }

    .nav-menu {
        position: static;
        min-width: 0;
        margin-top: 2px;
        box-shadow: none;
        border-color: var(--color-border);
    }

    .nav-link {
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-height: 44px;
        padding: 9px 12px;
    }

    .doc-toolbar {
        margin-bottom: 12px;
    }

    .ticket-doc {
        padding: 18px 14px;
    }

    .ticket-table thead {
        display: none;
    }

    .ticket-table,
    .ticket-table tbody,
    .ticket-table tr,
    .ticket-table td {
        display: block;
        width: 100%;
    }

    .ticket-table tbody tr {
        border-bottom: none;
        border: 1px solid var(--color-border);
        border-radius: 8px;
        padding: 12px;
        margin: 0 0 12px;
        background: var(--color-surface);
    }

    .ticket-table td {
        padding: 4px 0;
        border-bottom: none;
    }

    .ticket-table td::before {
        content: attr(data-label);
        display: inline-block;
        flex: 0 0 120px;
        font-weight: 600;
        color: var(--color-text-muted);
        font-size: 12px;
    }

    .ticket-table td[data-label] {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
    }

    .ticket-table td[data-label] > * {
        flex: 1;
        text-align: right;
    }

    .ticket-table td.col-money,
    .ticket-table td.col-numeric {
        text-align: right;
    }

    .doc-columns,
    .product-summary-grid,
    .attr-grid {
        grid-template-columns: 1fr;
    }

    .kv-row,
    .product-summary-row,
    .attr-pair {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .summary-strip {
        gap: 6px 10px;
    }

    .doc-meta {
        flex-direction: column;
        gap: 8px;
    }

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

    .items-table th,
    .items-table td {
        padding: 10px 8px;
    }

    .item-description {
        font-size: 14px;
    }

    .totals-wrap {
        justify-content: stretch;
    }

    .totals-ledger {
        width: 100%;
    }

    .totals-title,
    .totals-row dt,
    .totals-row dd {
        text-align: left;
    }

    .copy-status {
        min-width: 0;
    }

    .items-table thead {
        position: static;
    }
}

/* Print */

@media print {
    html,
    body {
        background: #ffffff;
        color: #000000;
    }

    .app-header,
    .doc-toolbar,
    .btn-copy,
    .no-print,
    .print-timestamp,
    .app-nav,
    .psws-nav,
    .skip-link,
    .copy-status {
        display: none !important;
    }

    .app-content {
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .psws-layout {
        display: block;
        margin: 0;
    }

    .psws-main {
        margin: 0;
    }

    .ticket-doc {
        max-width: none;
        background: #ffffff;
        border: none;
        border-radius: 0;
        padding: 0;
    }

    .doc-header {
        border-bottom: 1pt solid #333333;
        padding-top: 0;
    }

    table,
    tr,
    td,
    th,
    .doc-card,
    .line-detail,
    .items-table-wrap,
    .line-disclosure {
        border-color: #333333 !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .ticket-table thead th,
    .items-table thead th {
        position: static;
        display: table-header-group;
        background: #ffffff !important;
        color: #000000;
    }

    .doc-card,
    .line-detail,
    .doc-evidence {
        background: #ffffff;
        box-shadow: none;
    }

    .doc-evidence .disclosure,
    .doc-evidence .code-block,
    .disclosure summary {
        display: none !important;
    }

    .print-timestamp {
        display: block !important;
        margin-top: 24px;
        text-align: right;
        font-size: 11px;
        color: #000000;
    }
}

/* Appointment Job Sheet -----------------------------------------------
   Standalone printable dispatch sheet for a confirmed Ticket appointment.
   Scoped to the js-job-sheet body class so print rules never leak into
   the rest of the application chrome. */

.js-job-sheet {
    margin: 0;
    padding: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #0f172a;
    background: #ffffff;
}

.js-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 20px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.js-toolbar-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
}

.js-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.js-doc {
    max-width: 8.5in;
    margin: 16px auto;
    padding: 28px 32px 36px;
    background: #ffffff;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-card);
}

.js-canceled-banner {
    margin: 0 0 18px;
    padding: 10px 14px;
    border: 2px solid #b91c1c;
    background: #fef2f2;
    color: #7f1d1d;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-align: center;
}

.js-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 18px;
    padding-bottom: 14px;
    border-bottom: 2px solid #0f172a;
}

.js-brand-name {
    margin: 0 0 2px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #475569;
}

.js-doc-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.js-heading-meta {
    margin: 0;
    text-align: right;
}

.js-heading-meta .js-meta {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.js-heading-meta dt {
    order: 1;
    font-weight: 600;
    color: #334155;
}

.js-heading-meta dd {
    order: 2;
    margin: 0;
}

.js-section {
    margin-top: 16px;
}

.js-section-title {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: #334155;
    border-bottom: 1px solid #cbd5e1;
    padding-bottom: 3px;
}

.js-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px 28px;
    margin: 0;
}

.js-meta {
    display: flex;
    gap: 10px;
}

.js-meta dt {
    flex: 0 0 92px;
    font-weight: 600;
    color: #334155;
}

.js-meta dd {
    margin: 0;
}

.js-meta-span {
    grid-column: 1 / -1;
}

.js-address-block {
    margin: 4px 0 0;
    white-space: normal;
}

/* Job Item cards: one bordered container per physical part. Attributes
   and fees stay inside their owning card so relationships can never be
   misread. */

.js-parts-list {
    display: grid;
    gap: 10px;
}

.js-item-card {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 10px 12px;
    background: #ffffff;
    break-inside: avoid;
    page-break-inside: avoid;
}

.js-item-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    padding-bottom: 6px;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 8px;
}

.js-item-num {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.js-item-desc {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
}

.js-item-facts,
.js-item-financial {
    margin: 0;
}

.js-item-facts {
    display: grid;
    gap: 4px 28px;
    margin-bottom: 10px;
}

.js-item-financial {
    display: grid;
    gap: 4px 28px;
    margin-bottom: 8px;
    padding-top: 8px;
    border-top: 1px dotted #e2e8f0;
}

.js-item-fact {
    display: flex;
    gap: 8px;
    min-width: 0;
}

.js-item-fact dt {
    flex: 0 0 110px;
    font-weight: 600;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 11px;
}

.js-item-fact dd {
    margin: 0;
    word-wrap: break-word;
}

.js-item-fact dd strong {
    font-weight: 700;
}

.js-sub-title {
    margin: 8px 0 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: #475569;
}

.js-item-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 24px;
    margin: 0;
}

.js-item-attr {
    display: flex;
    gap: 8px;
    min-width: 0;
}

.js-item-attr dt {
    flex: 0 0 158px;
    font-weight: 600;
    color: #334155;
    font-size: 12px;
}

.js-item-attr dd {
    margin: 0;
    font-size: 12px;
    word-wrap: break-word;
}

.js-fees-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.js-fees-table td {
    padding: 3px 0;
    border-bottom: 1px dotted #e2e8f0;
}

.js-fee-name {
    text-align: left;
}

.js-fee-price {
    text-align: right;
    font-family: var(--font-mono);
    white-space: nowrap;
}

.js-item-source {
    margin-left: 8px;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.js-vehicle-name,
.js-vehicle-note {
    margin: 0 0 2px;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
}

.js-vehicle-note {
    font-weight: 400;
    font-size: 12px;
    color: #334155;
}

.js-service-source {
    display: block;
    font-size: 11px;
    color: #64748b;
}

.js-vehicle-fields {
    display: grid;
    grid-template-columns: 110px 1fr 1fr;
    gap: 8px 18px;
    margin-top: 6px;
}

.js-vehicle-field {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    margin: 0;
    font-size: 12px;
}

.js-vehicle-field .js-line-fill {
    flex: 1;
    min-width: 40px;
    border-bottom: 1px solid #0f172a;
    height: 16px;
}

.js-fees-none {
    margin: 0;
    font-size: 12px;
    color: #475569;
}

.js-summary-list {
    display: grid;
    gap: 4px;
    margin: 0;
    max-width: 280px;
}

.js-summary-row {
    display: flex;
    align-items: baseline;
    gap: 16px;
    justify-content: space-between;
}

.js-summary-row dt {
    font-weight: 600;
    color: #334155;
}

.js-summary-row dd {
    margin: 0;
    font-family: var(--font-mono);
    text-align: right;
}

.js-summary-total {
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px solid #0f172a;
    font-size: 14px;
    font-weight: 700;
}

.js-summary-total dt {
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

@media screen and (max-width: 760px) {
    .js-item-grid {
        grid-template-columns: 1fr;
    }

    .js-item-card {
        padding: 8px 10px;
    }
}

.js-footer {
    margin-top: 32px;
}

.js-signoff {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 28px;
}

.js-sign-line {
    margin: 8px 0;
    font-size: 12px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.js-line-fill {
    flex: 1;
    display: inline-block;
    border-bottom: 1px solid #0f172a;
    height: 14px;
}

@page {
    size: letter portrait;
    margin: 0.5in;
}

@media print {
    .js-job-sheet {
        font-size: 11px;
    }

    .js-toolbar {
        display: none !important;
    }

    .js-doc {
        max-width: none;
        margin: 0;
        padding: 0;
        border: none;
        box-shadow: none;
    }

    .js-appointment,
    .js-identity,
    .js-address,
    .js-summary,
    .js-header,
    .js-item-card {
        break-inside: avoid;
    }

    /* Repeat nothing; cards break naturally and never share one page's
       distance-reading confusion the way a partially-rendered wide table did. */
    .js-item-attrs,
    .js-item-fees {
        break-before: auto;
        orphans: 2;
        widows: 2;
    }
}

/* Import page */

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

.import-page {
    max-width: 840px;
    margin: 0 auto;
}

.sync-guide {
    margin: 0 0 20px;
    padding: 12px 16px 12px 14px;
    background: var(--color-bg-app);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-brand);
    border-radius: 6px;
}

.sync-guide-title {
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}

.sync-guide-list {
    margin: 0;
    padding-left: 18px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--color-secondary-text);
}

.import-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 24px 28px 24px;
}

.field-group {
    margin-bottom: 20px;
}

.field-label {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.field-help {
    margin: 0 0 8px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--color-text-muted);
}

.import-panel fieldset {
    border: 0;
    margin: 0 0 16px;
    padding: 0;
}

.import-panel legend {
    margin-bottom: 8px;
    padding: 0;
}

.json-textarea {
    display: block;
    width: 100%;
    min-height: 320px;
    padding: 12px 14px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 6px;
    resize: vertical;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
}

.json-textarea:hover {
    border-color: #94a3b8;
}

.json-textarea:focus-visible {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px var(--color-focus);
}

.import-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0 20px;
    color: var(--color-text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.import-divider::before,
.import-divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--color-border);
}

.file-control {
    padding: 10px 12px;
    background: var(--color-surface-subtle);
    border: 1px dashed var(--color-border-strong);
    border-radius: 6px;
}

.file-control:focus-within {
    border-style: solid;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px var(--color-focus);
}

.file-selected {
    margin: 8px 0 0;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--color-secondary-text);
}

.errorlist {
    margin: 8px 0 0;
    padding-left: 18px;
    color: var(--outcome-invalid-accent);
    font-size: 13px;
}

.form-actions {
    margin-top: 4px;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 10px 20px;
    border: 1px solid var(--color-brand-hover);
    border-radius: 6px;
    background: var(--color-brand);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-sans);
    text-decoration: none;
    cursor: pointer;
}

.btn-primary:hover {
    background: var(--color-brand-hover);
}

.btn-primary:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.btn-primary[disabled] {
    opacity: 0.75;
    cursor: not-allowed;
}

.btn-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: import-spin 800ms linear infinite;
}

.btn-primary.is-processing .btn-spinner {
    display: inline-block;
}

@keyframes import-spin {
    to {
        transform: rotate(360deg);
    }
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 16px;
    border: 1px solid var(--color-border-strong);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-secondary-text);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-sans);
    text-decoration: none;
    cursor: pointer;
}

.btn-secondary:hover {
    background: var(--color-neutral-bg);
}

.btn-secondary:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.btn-link {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    color: var(--color-brand);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.btn-link:hover {
    color: var(--color-brand-hover);
    text-decoration: underline;
}

.btn-link:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

/* Inline import result banners */

.import-result {
    margin: 0 0 20px;
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    border-left-width: 3px;
    border-radius: 6px;
    background: var(--color-surface);
}

.import-result-text {
    margin: 0;
    font-size: 14px;
    color: var(--color-text);
}

.import-result-meta {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--color-secondary-text);
}

.import-result-heading {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
}

.import-result-imported {
    background: var(--outcome-imported-bg);
    border-left-color: var(--outcome-imported-accent);
}

.import-result-updated {
    background: var(--outcome-updated-bg);
    border-left-color: var(--outcome-updated-accent);
}

.import-result-unchanged {
    background: var(--outcome-unchanged-bg);
    border-left-color: var(--outcome-unchanged-accent);
}

.import-result-invalid {
    background: var(--outcome-invalid-bg);
    border-left-color: var(--outcome-invalid-accent);
}

.import-result-failed {
    background: var(--outcome-failed-bg);
    border-left-color: var(--outcome-failed-accent);
}

.validation-list {
    margin: 0;
    padding-left: 18px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--color-text);
}

.change-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 10px;
    padding: 0;
    list-style: none;
}

.change-chip {
    display: inline-block;
    padding: 3px 10px;
    border: 1px solid var(--color-border-strong);
    border-radius: 4px;
    background: var(--color-surface);
    font-size: 12px;
    font-weight: 500;
    color: var(--color-secondary-text);
}

/* Outcome dialogs */

dialog.outcome-dialog {
    width: min(520px, 92vw);
    max-height: 85vh;
    margin: auto;
    padding: 0;
    border: 1px solid var(--color-border-strong);
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

dialog.outcome-dialog::backdrop {
    background: rgba(15, 23, 42, 0.45);
}

.outcome-dialog-inner {
    position: relative;
    padding: 28px 28px 24px;
    border-top: 4px solid var(--color-border-strong);
    overflow-y: auto;
    max-height: 85vh;
}

.outcome-dialog-imported .outcome-dialog-inner {
    border-top-color: var(--outcome-imported-accent);
}

.outcome-dialog-updated .outcome-dialog-inner {
    border-top-color: var(--outcome-updated-accent);
}

.outcome-dialog-unchanged .outcome-dialog-inner {
    border-top-color: var(--outcome-unchanged-accent);
}

.outcome-dialog-invalid .outcome-dialog-inner {
    border-top-color: var(--outcome-invalid-accent);
}

.outcome-dialog-failed .outcome-dialog-inner {
    border-top-color: var(--outcome-failed-accent);
}

.dialog-close {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.dialog-close:hover {
    background: var(--color-neutral-bg);
    color: var(--color-text);
}

.dialog-close:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.outcome-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
    border-radius: 50%;
    color: #ffffff;
}

.outcome-dialog-imported .outcome-icon {
    background: var(--outcome-imported-accent);
}

.outcome-dialog-updated .outcome-icon {
    background: var(--outcome-updated-accent);
}

.outcome-dialog-unchanged .outcome-icon {
    background: var(--outcome-unchanged-accent);
}

.outcome-dialog-invalid .outcome-icon {
    background: var(--outcome-invalid-accent);
}

.outcome-dialog-failed .outcome-icon {
    background: var(--outcome-failed-accent);
}

.outcome-title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-text);
}

.outcome-message {
    margin: 0 0 6px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text);
}

.outcome-support {
    margin: 0 0 6px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-secondary-text);
}

.outcome-reference {
    margin: 10px 0 0;
    font-size: 12px;
    color: var(--color-secondary-text);
}

.outcome-dialog .change-chips {
    margin: 14px 0 4px;
}

.dialog-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.dialog-actions .btn-primary,
.dialog-actions .btn-secondary {
    min-height: 44px;
}

body.dialog-open {
    overflow: hidden;
}

/* Import page responsive behavior */

@media (max-width: 768px) {
    .import-page {
        max-width: none;
    }

    .import-panel {
        padding: 20px 16px;
    }

    .json-textarea {
        min-height: 220px;
        font-size: 16px;
    }

    dialog.outcome-dialog {
        width: 100%;
        max-width: 100%;
        margin: auto 0 0;
        border-radius: 12px 12px 0 0;
        border-bottom: none;
    }

    .dialog-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .dialog-actions .btn-primary,
    .dialog-actions .btn-secondary {
        width: 100%;
    }
}

/* Reduced motion support */

@media (prefers-reduced-motion: reduce) {
    .btn-spinner {
        animation: none;
        border-top-color: rgba(255, 255, 255, 0.9);
    }

    .btn-primary.is-processing .btn-spinner {
        animation: import-pulse 1.2s ease-in-out infinite;
    }

    @keyframes import-pulse {
        0%,
        100% {
            opacity: 1;
        }
        50% {
            opacity: 0.35;
        }
    }
}

/* Operational job columns */

.job-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
}

.work-status {
    display: block;
    font-size: 12px;
    font-weight: 600;
}

.work-status-neutral {
    color: var(--color-text-muted);
}

.work-status-warn {
    color: #b45309;
}

.work-status-success {
    color: #0f766e;
}

.btn-link-quiet {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    margin-top: 2px;
    padding: 2px 0;
    border: none;
    background: none;
    color: var(--color-brand);
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: var(--color-border-strong);
    text-underline-offset: 2px;
}

.btn-link-quiet:hover {
    color: var(--color-brand-hover);
    text-decoration-color: currentColor;
}

.btn-link-quiet:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

/* Shared application dialogs (technician, fee catalog, user access, etc.) */

dialog.job-dialog {
    width: min(460px, 92vw);
    max-height: 85vh;
    margin: auto;
    padding: 0;
    border: 1px solid var(--color-border-strong);
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

dialog.job-dialog::backdrop {
    background: rgba(15, 23, 42, 0.45);
}

.job-dialog-inner {
    position: relative;
    padding: 24px 24px 20px;
    border-top: 4px solid var(--color-border-strong);
    overflow-y: auto;
    max-height: 85vh;
}

.job-dialog-title {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
}

/* Reusable modal header foundation, generalized from the Parts Review
   dialog's title bar (see dialog.parts-review-dialog below) so any job
   dialog can opt in by using .job-dialog-head as the first child of
   .job-dialog-inner — no per-dialog ID selector required.

   A dialog adopting this header automatically gets a single scrolling
   region: the sticky header stays put while .job-dialog-inner (the one
   and only overflow container) scrolls beneath it. Pairing a tall
   fixed-height outer <dialog> with an independently scrolling inner
   wrapper is what causes a duplicate/nested scrollbar, so dialogs using
   this header also drop their own max-height here. */
dialog.job-dialog:has(.job-dialog-head) {
    max-height: none;
}

.job-dialog-inner:has(> .job-dialog-head) {
    padding: 0;
    border-top: none;
}

.job-dialog-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 14px 24px;
    background: var(--color-border);
    border-bottom: 1px solid var(--color-border);
    border-radius: 7px 7px 0 0;
}

.job-dialog-head .job-dialog-title {
    margin: 0;
}

.job-dialog-head-copy {
    min-width: 0;
}

/* Drag affordance: the whole header is the move target on desktop pointers
   (reuses enableMovableDialog, see tickets.js); touch and narrow viewports
   never engage drag, so no cursor/selection change is needed there. */
@media (min-width: 1024px) and (pointer: fine) {
    .job-dialog-head {
        cursor: grab;
        user-select: none;
        touch-action: none;
    }

    .job-dialog-head:active {
        cursor: grabbing;
    }
}

.job-dialog-head .dialog-close {
    cursor: pointer;
}

.job-dialog-subtitle {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--color-text-muted);
}

.job-dialog-body {
    padding: 20px 24px 20px;
}

.job-dialog-context {
    margin: 0 0 18px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-text-secondary);
}

#technician-form input[type="text"],
#technician-form input[type="date"] {
    display: block;
    width: 100%;
    padding: 9px 10px;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 6px;
}

#technician-form input[type="text"]:hover,
#technician-form input[type="date"]:hover {
    border-color: #94a3b8;
}

#technician-form input[type="text"]:focus-visible,
#technician-form input[type="date"]:focus-visible {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px var(--color-focus);
}

#technician-form .errorlist {
    margin: 6px 0 0;
}

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

#technician-form .field-inline .field-label,
#technician-form .field-inline .errorlist {
    margin: 0;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 16px;
}

.row-actions .btn-link-quiet {
    margin-top: 0;
}

/* Mobile cards and dialog */

@media (max-width: 768px) {
    .ticket-table td[data-label] > .job-cell {
        align-items: flex-end;
    }

    .btn-link-quiet {
        min-height: 40px;
    }

    dialog.job-dialog {
        width: 100%;
        max-width: 100%;
        margin: auto 0 0;
        border-radius: 12px 12px 0 0;
        border-bottom: none;
    }

    dialog.job-dialog .job-dialog-inner {
        max-height: calc(85vh - env(safe-area-inset-bottom, 0px));
        padding: 20px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    }
}

/* Login page */

.login-panel {
    max-width: 420px;
}

#login-form input[type="text"],
#login-form input[type="password"] {
    display: block;
    width: 100%;
    padding: 9px 10px;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 6px;
}

#login-form input[type="text"]:hover,
#login-form input[type="password"]:hover {
    border-color: #94a3b8;
}

#login-form input[type="text"]:focus-visible,
#login-form input[type="password"]:focus-visible {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px var(--color-focus);
}

#login-form .btn-primary {
    width: 100%;
    min-height: 44px;
}

/* Fee Catalog module */

.fee-section {
    margin-top: 28px;
}

.fee-section-title {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
}

.fee-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.fee-table td {
    vertical-align: middle;
}

.fee-row .fee-icon-cell {
    width: 64px;
}

.fee-name-cell .cell-primary {
    line-height: 1.35;
}

.fee-code {
    margin-top: 3px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.03em;
}

.fee-meta {
    margin-top: 4px;
    font-size: 11px;
}

.fee-applies-cell {
    min-width: 210px;
}

.fee-icon {
    --fee-icon-fg: var(--color-text-secondary);
    --fee-icon-bg: #f8fafc;
    --fee-icon-border: #dbe5f0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--fee-icon-border);
    border-radius: 10px;
    background: var(--fee-icon-bg);
    color: var(--fee-icon-fg);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.fee-icon svg {
    width: 18px;
    height: 18px;
}

.fee-icon--tag {
    --fee-icon-fg: #475569;
    --fee-icon-bg: #f8fafc;
    --fee-icon-border: #cbd5e1;
}

.fee-icon--key {
    --fee-icon-fg: #166534;
    --fee-icon-bg: #f0fdf4;
    --fee-icon-border: #bbf7d0;
}

.fee-icon--key_fob {
    --fee-icon-fg: #0f766e;
    --fee-icon-bg: #f0fdfa;
    --fee-icon-border: #99f6e4;
}

.fee-icon--key_cutting {
    --fee-icon-fg: #c2410c;
    --fee-icon-bg: #fff7ed;
    --fee-icon-border: #fed7aa;
}

.fee-icon--cpu_chip {
    --fee-icon-fg: #1d4ed8;
    --fee-icon-bg: #eff6ff;
    --fee-icon-border: #bfdbfe;
}

.fee-icon--diagnostic {
    --fee-icon-fg: #4338ca;
    --fee-icon-bg: #eef2ff;
    --fee-icon-border: #c7d2fe;
}

.fee-icon--labor {
    --fee-icon-fg: #b45309;
    --fee-icon-bg: #fffbeb;
    --fee-icon-border: #fde68a;
}

.fee-icon--mobile_service {
    --fee-icon-fg: #7c3aed;
    --fee-icon-bg: #f5f3ff;
    --fee-icon-border: #ddd6fe;
}

.fee-icon--certificate {
    --fee-icon-fg: #b91c1c;
    --fee-icon-bg: #fef2f2;
    --fee-icon-border: #fecaca;
}

.fee-icon--shop_supplies {
    --fee-icon-fg: #475569;
    --fee-icon-bg: #f8fafc;
    --fee-icon-border: #cbd5e1;
}

.fee-icon--phone {
    --fee-icon-fg: #0284c7;
    --fee-icon-bg: #f0f9ff;
    --fee-icon-border: #bae6fd;
}

.fee-icon--mailbox {
    --fee-icon-fg: #ea580c;
    --fee-icon-bg: #fff7ed;
    --fee-icon-border: #fed7aa;
}

.fee-icon--calendar {
    --fee-icon-fg: #0d9488;
    --fee-icon-bg: #f0fdfa;
    --fee-icon-border: #99f6e4;
}

.fee-icon--pause {
    --fee-icon-fg: #7c3aed;
    --fee-icon-bg: #f5f3ff;
    --fee-icon-border: #ddd6fe;
}

.fee-icon--warning {
    --fee-icon-fg: #dc2626;
    --fee-icon-bg: #fef2f2;
    --fee-icon-border: #fecaca;
}

.fee-icon--user {
    --fee-icon-fg: #2563eb;
    --fee-icon-bg: #eff6ff;
    --fee-icon-border: #bfdbfe;
}

.fee-icon--phone_incoming {
    --fee-icon-fg: #0891b2;
    --fee-icon-bg: #ecfeff;
    --fee-icon-border: #a5f3fc;
}

.fee-icon--clock {
    --fee-icon-fg: #475569;
    --fee-icon-bg: #f8fafc;
    --fee-icon-border: #cbd5e1;
}

.fee-icon--chat {
    --fee-icon-fg: #059669;
    --fee-icon-bg: #ecfdf5;
    --fee-icon-border: #a7f3d0;
}

.fee-icon--check {
    --fee-icon-fg: #166534;
    --fee-icon-bg: #f0fdf4;
    --fee-icon-border: #bbf7d0;
}

.fee-icon--ban {
    --fee-icon-fg: #be123c;
    --fee-icon-bg: #fff1f2;
    --fee-icon-border: #fecdd3;
}

.fee-icon--truck {
    --fee-icon-fg: #4338ca;
    --fee-icon-bg: #eef2ff;
    --fee-icon-border: #c7d2fe;
}

.fee-badge {
    display: inline-flex;
    align-items: center;
    margin: 0 6px 4px 0;
    padding: 3px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: var(--color-neutral-bg);
    color: var(--color-neutral-fg);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    white-space: nowrap;
}

.fee-badge--retail {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.fee-badge--business {
    background: #f5f3ff;
    border-color: #ddd6fe;
    color: #6d28d9;
}

.fee-badge--government {
    background: #ecfdf5;
    border-color: #bbf7d0;
    color: #047857;
}

.fee-badge--dealership {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #c2410c;
}

.fee-row-inactive td {
    opacity: 0.6;
}

dialog.fee-dialog {
    width: min(620px, 94vw);
}

#fee-definition-form input[type="text"],
#fee-definition-form input[type="number"],
#fee-definition-form textarea,
#outcome-form input[type="text"],
#outcome-form input[type="number"],
#outcome-form textarea,
#reason-form input[type="text"],
#reason-form input[type="number"],
#reason-form textarea {
    display: block;
    width: 100%;
    padding: 9px 10px;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 6px;
}

#fee-definition-form textarea,
#outcome-form textarea,
#reason-form textarea {
    resize: vertical;
    min-height: 64px;
}

#fee-definition-form input[type="text"]:hover,
#fee-definition-form input[type="number"]:hover,
#fee-definition-form textarea:hover,
#outcome-form input[type="text"]:hover,
#outcome-form input[type="number"]:hover,
#outcome-form textarea:hover,
#reason-form input[type="text"]:hover,
#reason-form input[type="number"]:hover,
#reason-form textarea:hover {
    border-color: #94a3b8;
}

#fee-definition-form input[type="text"]:focus-visible,
#fee-definition-form input[type="number"]:focus-visible,
#fee-definition-form textarea:focus-visible,
#outcome-form input[type="text"]:focus-visible,
#outcome-form input[type="number"]:focus-visible,
#outcome-form textarea:focus-visible,
#reason-form input[type="text"]:focus-visible,
#reason-form input[type="number"]:focus-visible,
#reason-form textarea:focus-visible {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px var(--color-focus);
}

#fee-definition-form fieldset,
#outcome-form fieldset,
#reason-form fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}

#fee-definition-form legend,
#outcome-form legend,
#reason-form legend {
    padding: 0;
    margin-bottom: 6px;
}

#fee-definition-form .field-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

#fee-definition-form .field-inline .field-label,
#fee-definition-form .field-inline .errorlist {
    margin: 0;
}

#fee-definition-form .errorlist {
    margin: 6px 0 0;
}

#fee-definition-form .section-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
}

#fee-definition-form .icon-picker,
#outcome-form .icon-picker,
#reason-form .icon-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 10px;
}

/* Job Problem Reason dialog: balanced code + technician-label pair on desktop,
   collapsing to a single column on narrow widths. */
#reason-form .field-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

#reason-form .field-pair .field-group {
    min-width: 0;
}

@media (max-width: 520px) {
    #reason-form .field-pair {
        grid-template-columns: 1fr;
    }
}

.icon-choice {
    display: block;
    position: relative;
}

.icon-choice-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 12px 8px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    cursor: pointer;
    text-align: center;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.icon-choice:hover .icon-choice-tile {
    border-color: var(--color-border-strong);
    background: #fbfdff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.icon-choice input:checked + .icon-choice-tile {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 1px var(--color-brand), 0 2px 6px rgba(15, 23, 42, 0.08);
    background: #f8fbff;
}

.icon-choice input:focus-visible + .icon-choice-tile {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

/* Selected state is never color-only: a small check badge appears in the
   corner, in addition to the accent border/background above. */
.icon-choice input:checked + .icon-choice-tile::after {
    content: '';
    position: absolute;
    top: -6px;
    right: -6px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-brand);
    border: 2px solid var(--color-surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M4 8.3 6.7 11 12 5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 10px 10px;
}

.fee-option-icon {
    width: 24px;
    height: 24px;
    color: var(--color-text-secondary);
}

.icon-choice-tile .fee-option-icon {
    padding: 4px;
    border-radius: 999px;
    background: var(--color-bg-app);
}

.icon-choice input:checked + .icon-choice-tile .fee-option-icon {
    color: var(--color-brand-hover);
    background: #eff6ff;
}

.icon-choice-label {
    font-size: 12px;
    color: var(--color-text-secondary);
}

/* Scheduling Outcomes Behavior Configuration Cards */

.behavior-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-top: 6px;
}

.behavior-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 14px 14px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.behavior-card:hover {
    border-color: var(--color-border-strong);
}

.behavior-card.is-active {
    border-color: var(--color-brand);
    background: #f8fbff;
    box-shadow: 0 0 0 1px var(--color-brand), 0 2px 6px rgba(15, 23, 42, 0.06);
}

.behavior-card-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.behavior-card-header .fee-icon {
    flex: 0 0 auto;
}

.behavior-card-text {
    flex: 1 1 auto;
    min-width: 0;
}

.behavior-card-title {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}

.behavior-card-desc {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--color-text-secondary);
}

.behavior-card-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--color-border);
}

.behavior-toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    user-select: none;
}

.behavior-toggle-row input[type="checkbox"] {
    accent-color: var(--color-brand);
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
}

/* ---------------------------------------------------------------------
   Scheduling workspace visual prototype (UI only — no persistence)
   --------------------------------------------------------------------- */

.ticket-views {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 6px;
}

.ticket-view {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: 14px;
}

.ticket-view.is-active {
    border-color: var(--color-brand);
    color: var(--color-text);
    font-weight: 600;
}

.ticket-view-count {
    padding: 0 8px;
    border-radius: 999px;
    background: var(--color-neutral-bg);
    color: var(--color-neutral-fg);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.ticket-view-prototype {
    border-style: dashed;
    color: var(--color-text-muted);
}

.ticket-view-hint {
    font-size: 11px;
    font-style: normal;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-warn-fg);
    background: var(--color-warn-bg);
    border-radius: 999px;
    padding: 1px 8px;
}

.ticket-views-note {
    margin: 0 0 12px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.quick-proto-tag {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-warn-fg);
    background: var(--color-warn-bg);
    border-radius: 999px;
    padding: 1px 7px;
    vertical-align: middle;
}

/* Wide two-column prototype dialog */

dialog.quick-schedule-dialog {
    width: min(1000px, 94vw);
    max-height: none;
}

dialog.quick-schedule-dialog .job-dialog-inner {
    overflow-y: visible;
}

@media (max-height: 640px) {
    dialog.quick-schedule-dialog .job-dialog-inner {
        max-height: calc(100vh - 32px);
        overflow-y: auto;
    }
}

.qs-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin: -24px -24px 0;
    padding: 14px 24px 10px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-header);
}

@media (min-width: 1024px) and (pointer: fine) {
    .qs-head {
        cursor: move;
        user-select: none;
    }
}

.qs-head-sub {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.qs-head .dialog-close {
    cursor: pointer;
}

.qs-banner {
    margin: 12px 0 0;
    padding: 8px 12px;
    border: 1px dashed var(--color-border-strong);
    border-radius: 6px;
    background: var(--color-warn-bg);
    color: var(--color-warn-fg);
    font-size: 13px;
}

.qs-context {
    margin-top: 12px;
}

.qs-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 20px;
    align-items: start;
    margin-top: 4px;
}

.qs-fieldset {
    margin: 0;
    padding: 0;
    border: none;
}

.qs-fieldset .field-label {
    display: block;
    margin-bottom: 6px;
}

.qs-radio,
.qs-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: 18px;
    padding: 6px 0;
    font-size: 14px;
    cursor: pointer;
}

.qs-check {
    margin-right: 0;
}

.qs-suggested {
    margin: -2px 0 6px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.qs-onsite,
.qs-altcontact {
    margin: 4px 0 10px;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg-app);
}

.qs-fieldpair {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.qs-onsite input,
.qs-altcontact input,
#qs-note,
#qs-follow-up,
#qs-date,
#qs-technician,
#qs-duration,
#qs-call-outcome,
#qs-contact-name,
#qs-contact-phone,
#qs-street,
#qs-city,
#qs-state,
#qs-zip {
    width: 100%;
}

/* Compact sample day preview — never live availability */

.qs-day {
    margin-top: 12px;
    border: 1px solid var(--color-border-strong);
    border-radius: 8px;
    background: var(--color-header);
    padding: 12px;
}

.qs-day-banner {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-warn-fg);
    background: var(--color-warn-bg);
    border: 1px dashed var(--color-border-strong);
    border-radius: 6px;
    padding: 6px 10px;
}

.qs-day-lines {
    list-style: none;
    margin: 0 0 10px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.qs-blocked {
    padding: 8px 10px;
    border-radius: 6px;
    background: var(--color-neutral-bg);
    color: var(--color-neutral-fg);
    border: 1px solid var(--color-border);
    font-size: 13px;
}

.qs-opening {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px dashed var(--color-border-strong);
    background: var(--color-surface);
    font-size: 13px;
}

.qs-opening-chip {
    padding: 6px 12px;
    border: 1px solid var(--color-border-strong);
    border-radius: 999px;
    background: var(--color-success-bg);
    color: var(--color-success-fg);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}

.qs-opening-chip:hover {
    border-color: var(--color-success-fg);
}

.qs-opening-chip:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.qs-opening-chip.is-selected {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 1px var(--color-brand);
    background: #f0f9ff;
    color: var(--color-brand-hover);
}

.qs-muted {
    color: var(--color-text-muted);
    font-size: 12px;
}

.qs-selection {
    border-top: 1px solid var(--color-border);
    padding-top: 10px;
}

.qs-selection-label {
    margin: 0 0 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.qs-selection-value {
    margin: 0;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

.qs-selection-note {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--color-text-muted);
}

/* Preview-only actions stay visibly disabled and labeled */

.qs-actions {
    justify-content: space-between;
    gap: 12px;
}

#qs-save-progress,
#qs-book {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#qs-save-progress[disabled],
#qs-book[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    border-style: dashed;
}

.qs-preview-flag {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 999px;
    padding: 1px 7px;
}

#qs-save-progress .qs-preview-flag {
    color: var(--color-warn-fg);
    background: var(--color-warn-bg);
}

#qs-book .qs-preview-flag {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.25);
}

/* Tablet: single column, centered; no drag affordance */

@media (max-width: 1024px) {
    dialog.quick-schedule-dialog {
        width: min(700px, 92vw);
    }

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

/* Phone: bottom sheet, one scrolling surface */

@media (max-width: 768px) {
    dialog.quick-schedule-dialog {
        width: 100%;
        max-width: 100%;
        margin: auto 0 0;
        border-radius: 12px 12px 0 0;
        border-bottom: none;
        max-height: none;
    }

    dialog.quick-schedule-dialog .job-dialog-inner {
        max-height: calc(92vh - env(safe-area-inset-bottom, 0px));
        overflow-y: auto;
        padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    }

    .qs-head {
        margin: -16px -16px 0;
        padding: 12px 16px 10px;
    }

    .qs-banner {
        font-size: 12px;
    }

    .qs-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .qs-actions .btn-secondary,
    .qs-actions .btn-primary,
    .qs-actions .btn-link-quiet {
        width: 100%;
        justify-content: center;
    }
}

/* ---------------------------------------------------------------------
   Parts Review visual prototype (UI only — no persistence)
   --------------------------------------------------------------------- */

dialog.parts-review-dialog {
    width: min(860px, 94vw);
    max-height: none;
}

/* Ready to Schedule confirmation: fixed seven-column grid per physical Job
   Item, with that item's Operational Fees spanning the full row beneath. */
.rc-table {
    table-layout: fixed;
}

.rc-table .rc-col-vendor { width: 19%; }
.rc-table .rc-col-item { width: 13%; }
.rc-table .rc-col-vehicle { width: 22%; }
.rc-table .rc-col-decision { width: 16%; }
.rc-table .rc-col-qty { width: 10%; }

.rc-table th,
.rc-table td {
    vertical-align: top;
    overflow-wrap: anywhere;
}

.rc-table thead th {
    position: static;
    white-space: normal;
}

.rc-table tbody tr:hover {
    background: transparent;
}

.rc-table .rc-row td {
    border-bottom: none;
}

.rc-strong {
    font-weight: 600;
}

.rc-table .rc-fees td {
    padding-top: 0;
    border-bottom: 1px solid var(--color-border-strong);
}

.rc-fees-title {
    margin: 0 0 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.rc-fee-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.rc-fee-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 0;
    font-size: 14px;
}

.rc-fee-name {
    min-width: 0;
    overflow-wrap: anywhere;
}

.rc-fee-price {
    flex: none;
    font-variant-numeric: tabular-nums;
}

.rc-fees-none {
    margin: 0;
    font-size: 13px;
    color: var(--color-text-secondary);
}

@media (max-width: 767px) {
    .rc-table,
    .rc-table tbody,
    .rc-table tr,
    .rc-table td {
        display: block;
        width: 100%;
    }

    .rc-table colgroup,
    .rc-table thead {
        display: none;
    }

    .rc-table .rc-item {
        margin: 0 0 12px;
        border: 1px solid var(--color-border);
        border-radius: 8px;
        overflow: hidden;
    }

    .rc-table .rc-row td {
        display: grid;
        grid-template-columns: minmax(110px, 40%) minmax(0, 1fr);
        gap: 8px;
        padding: 6px 12px;
        text-align: left;
    }

    .rc-table .rc-row td::before {
        content: attr(data-label);
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        color: var(--color-text-muted);
    }

    .rc-table .rc-fees td {
        padding: 8px 12px 12px;
        border-bottom: none;
        background: var(--color-surface-subtle);
    }
}

dialog.parts-review-dialog .job-dialog-inner {
    overflow-y: auto;
    max-height: 85vh;
    border-top: none;
    border-radius: 7px;
}

/* The Parts Review dialog is a genuine title-bar dialog: the single scroll
   container carries NO padding, the body wrapper owns the content padding,
   and the header — first child of the scroller — sticks flush against the
   dialog's top/left/right interior edges as its native title bar. */
#parts-review-dialog .job-dialog-inner {
    padding: 0;
}

#parts-review-dialog .pr-body {
    /* Content keeps the same spacing it had when the scroll container owned
       the padding: a 24px breathing zone between the title bar and the
       instruction callout that slides beneath the sticky header cleanly. */
    padding: 24px 24px 20px;
}

#parts-review-dialog .qs-head {
    position: sticky;
    top: 0;
    z-index: 1;
    margin: 0;
    padding: 14px 24px 14px;
    background: var(--color-border);
    border-bottom: 1px solid var(--color-border);
    border-radius: 7px 7px 0 0;
}

dialog.parts-review-dialog .qs-head-sub {
    color: var(--color-text-secondary);
}

.pr-head-identity {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    overflow-wrap: break-word;
}

.pr-head-number {
    /* .ident nowrap protects tables; the dialog header needs wrapping so a
       narrow viewport never grows the popup horizontally. */
    white-space: normal;
    overflow-wrap: break-word;
}

.pr-head-org {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--color-text-muted);
    overflow-wrap: break-word;
}

@media (min-width: 1024px) and (pointer: fine) {
    dialog.parts-review-dialog .qs-head {
        cursor: grab;
    }

    dialog.parts-review-dialog .qs-head:active {
        cursor: grabbing;
    }
}

dialog.parts-review-dialog .qs-banner {
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-brand);
    background: var(--color-bg-app);
    color: var(--color-text-secondary);
}

.pr-summary {
    margin: 12px 0 10px;
    padding: 8px 12px;
    border-radius: 6px;
    background: var(--color-header);
    border: 1px solid var(--color-border);
    font-size: 13px;
    color: var(--color-text-secondary);
}

.pr-lines {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 8px;
}

.pr-line {
    margin: 0 0 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    padding: 16px 18px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.pr-line:last-of-type {
    margin-bottom: 0;
}

.pr-line-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.pr-line-title {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 2px 10px;
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.pr-line-number {
    color: var(--color-text-muted);
    font-size: 13px;
}

.pr-remembered {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 12px;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-bg-app);
    font-size: 14px;
}

.pr-remembered-text {
    margin: 0;
}

.pr-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px 16px;
    margin: 0 0 14px;
    padding: 10px 14px;
    background: var(--color-bg-app);
    border: 1px solid var(--color-border);
    border-radius: 6px;
}

.pr-fact {
    min-width: 0;
}

.pr-fact dt {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 2px;
}

.pr-fact dd {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    overflow-wrap: break-word;
}

.pr-facts .ident {
    white-space: normal;
    overflow-wrap: break-word;
}

.pr-choices {
    border: 0;
    margin: 0 0 4px;
    padding: 0;
}

.pr-choice-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin-top: 6px;
}

.pr-choice-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.pr-needed,
.pr-stockask,
.pr-vendor {
    margin: 10px 0 2px;
}

.pr-vendor select {
    width: min(420px, 100%);
}

.pr-gate-note,
.pr-gate-toggle {
    margin: 8px 0 2px;
}

/* Parts Review two-level interaction: summary-only line cards in the main
   dialog, plus one focused native dialog per imported line holding that
   line's authoritative form controls. Scoped to Parts Review classes. */

/* Main-dialog sections: Services Needing Assignment / Physical Job Items /
   Other Imported Lines. Each line summary appears in exactly one place. */

.pr-line-store,
.pr-line-holder {
    display: contents;
}

.pr-group {
    margin: 0 0 20px;
}

.pr-group[hidden] {
    display: none;
}

.pr-group-title {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.pr-group-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pr-group[data-pr-group="services"] .pr-summary {
    border-color: #fca5a5;
}

.pr-summary {
    padding: 16px 18px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.pr-summary-status[hidden] {
    display: none;
}

/* Confirmed physical Job Item card: Vendor + Vendor Item identity, the
   description and Source Line, then UPN / Qty / imported price facts. */
.pr-summary-facts--physical {
    display: none;
}

.pr-summary--physical > .pr-summary-facts:not(.pr-summary-facts--physical) {
    display: none;
}

.pr-summary--physical > .pr-summary-facts--physical {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 4px;
}

.pr-summary--physical > .pr-summary-facts--physical .pr-summary-fact dd {
    font-weight: 600;
}

/* Scheduled Job Sheet: appointment context above the operational Job Items. */
.pr-appointment {
    margin: 0 0 14px;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface-subtle);
}

.pr-appointment-title {
    margin: 0 0 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.pr-appointment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px 20px;
    margin: 0 0 10px;
}

.pr-appointment-grid dt {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.pr-appointment-grid dd {
    margin: 2px 0 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.pr-appointment-print {
    display: inline-block;
    text-decoration: none;
}

@media (max-width: 767px) {
    .pr-appointment-print {
        display: block;
        text-align: center;
        min-height: 44px;
        line-height: 44px;
        padding-top: 0;
        padding-bottom: 0;
    }
}

.pr-sheet-status {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 8px;
    border: 1px solid #86efac;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: 1px;
}

.pr-sheet-classify {
    margin: 0 0 2px;
}

.pr-sheet-classify summary {
    display: inline-block;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-brand);
    min-height: 32px;
    line-height: 32px;
}

.pr-sheet-classify .field-label {
    display: block;
    margin: 4px 0;
}

.pr-sheet-classify select {
    min-width: 220px;
    max-width: 100%;
}

/* Scheduled Job Sheet: the physical Job Item card follows the printable
   Job Item structure. These are presentation rules for the same card the
   Parts Review uses; nothing here hides invalid markup. */
.pr-sheet .pr-summary--physical > .pr-summary-facts--physical {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
}

.pr-sheet-block {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--color-border);
}

.pr-sheet-block[hidden] {
    display: none;
}

.pr-sheet-attrs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 4px 24px;
    margin: 0;
}

.pr-sheet-attrs > div {
    display: flex;
    gap: 8px;
    min-width: 0;
    font-size: 13px;
}

.pr-sheet-attrs dt {
    flex: 0 0 auto;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.pr-sheet-attrs dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.pr-sheet .pr-summary--nested > .pr-summary-nested-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.pr-summary-nested-amount {
    flex: 0 0 auto;
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--color-text);
}

.pr-sheet-totals {
    display: grid;
    gap: 4px;
    margin: 0;
    max-width: 320px;
}

.pr-sheet-totals > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    font-size: 14px;
}

.pr-sheet-totals dt {
    color: var(--color-text-secondary);
}

.pr-sheet-totals dd {
    margin: 0;
    font-family: var(--font-mono);
}

.pr-sheet-totals .pr-sheet-total {
    margin-top: 4px;
    padding-top: 6px;
    border-top: 2px solid var(--color-text);
    font-weight: 700;
}

.pr-sheet-summary {
    margin-top: 14px;
}

@media (max-width: 767px) {
    .pr-sheet .pr-summary--physical > .pr-summary-facts--physical {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pr-sheet-attrs {
        grid-template-columns: 1fr;
    }

    .pr-sheet-totals {
        max-width: none;
    }
}

.pr-sheet-status--attempted {
    border-color: #fde68a;
    background: var(--color-warn-bg);
    color: var(--color-warn-fg);
}

.pr-result {
    border-left: 4px solid var(--color-border-strong);
}

.pr-result--outcome {
    border-left-color: #fb923c;
}

.pr-result--completed {
    border-left-color: #22c55e;
}

.pr-result-details {
    margin: 4px 0 8px;
    font-size: 14px;
    color: var(--color-text);
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.pr-result-note {
    margin: 0;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.pr-complete-lock-note {
    margin: 8px 0 0;
    padding: 8px 12px;
    border: 1px solid #fde68a;
    border-radius: 6px;
    background: var(--color-warn-bg);
    color: var(--color-warn-fg);
    font-size: 13px;
}

.pr-complete-lock-note[hidden] {
    display: none;
}

.pr-cj-modes {
    flex-direction: column;
    align-items: stretch;
}

.pr-cj-reason {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 8px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--reason-accent, var(--color-border-strong));
    border-radius: 8px;
    background: var(--color-surface);
    cursor: pointer;
}

.pr-cj-reason:has(input:checked) {
    background: var(--reason-tint, var(--color-surface-subtle));
    border-color: var(--reason-accent, var(--color-brand));
}

.pr-cj-reason input {
    margin-top: 4px;
}

.pr-cj-reason .fee-icon {
    flex: none;
    width: 28px;
    height: 28px;
}

.pr-cj-reason-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.pr-cj-reason-name {
    font-weight: 600;
    color: var(--color-text);
}

.pr-cj-reason-desc {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.pr-cj-details textarea,
#pr-cj-notes,
#ro-reason {
    width: 100%;
}

.pr-cj-table-details {
    max-width: 280px;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

/* Job Details: read-only summary card rendered only on a physical Job Item
   (Vehicle and Operational Fees, edited in the Manage Job Details modal). */
.pr-jobdetails {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface-subtle);
}

.pr-jobdetails-title {
    margin: 0 0 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.pr-jobdetails-section + .pr-jobdetails-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--color-border);
}

.pr-jobdetails-label {
    margin: 0 0 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.pr-jobdetails .pr-jd-lock-note {
    margin: 10px 0 0;
}

.pr-jobdetails .pr-summary-fee-list {
    margin: 0 0 2px;
}

.pr-vehicle-name {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.pr-vehicle-source,
.pr-vehicle-source {
    margin-left: 6px;
}

.pr-vehicle-empty {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--color-text-secondary);
    overflow-wrap: anywhere;
}

#parts-review-dialog dialog.pr-jd-dialog {
    width: min(740px, 94vw);
    max-height: 86vh;
    padding: 0;
}

#parts-review-dialog dialog.pr-jd-dialog > .job-dialog-inner {
    display: flex;
    flex-direction: column;
    max-height: 86vh;
    overflow: hidden;
    padding: 0;
}

#parts-review-dialog dialog.pr-jd-dialog .job-dialog-head {
    flex: none;
    padding: 16px 24px 12px;
}

.pr-jd-line {
    margin: 2px 0 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}

.pr-jd-identity {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--color-text-secondary);
    overflow-wrap: anywhere;
}

.pr-jd-form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
}

.pr-jd-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px 24px;
}

.pr-jd-section {
    margin: 0 0 20px;
    padding: 0;
    border: 0;
    min-width: 0;
}

.pr-jd-section + .pr-jd-section {
    padding-top: 18px;
    border-top: 1px solid var(--color-border);
}

.pr-jd-heading {
    margin: 0 0 10px;
    padding: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text);
}

.pr-jd-label {
    margin: 0 0 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.pr-jd-evidence,
.pr-jd-current,
.pr-jd-shared {
    margin: 0 0 12px;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface-subtle);
}

.pr-jd-evidence p,
.pr-jd-current p,
.pr-jd-shared p {
    margin: 0;
}

.pr-jd-evidence-text,
.pr-jd-current-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    overflow-wrap: anywhere;
}

.pr-jd-shared {
    border-color: #fde047;
    background: #fefce8;
    color: #854d0e;
    font-size: 13px;
}

.pr-jd-shared .pr-jd-label {
    color: #854d0e;
}

.pr-jd-none,
.pr-jd-help {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.pr-jd-warn {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: #854d0e;
}

.pr-jd-modes {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0 0 10px;
}

.pr-jd-mode,
.pr-jd-choice {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

.pr-jd-mode input,
.pr-jd-choice input,
.pr-jd-fee input {
    flex: none;
    width: 18px;
    height: 18px;
    margin: 0;
}

.pr-jd-panel {
    margin: 4px 0 0;
    padding: 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
}

.pr-jd-panel[hidden] {
    display: none;
}

.pr-jd-choice {
    align-items: flex-start;
    border: 1px solid var(--color-border);
    margin-bottom: 6px;
}

.pr-jd-choice:has(input:checked) {
    border-color: var(--color-brand);
    background: var(--color-surface-subtle);
}

.pr-jd-choice small,
.pr-jd-fee small {
    display: block;
    font-size: 12px;
    color: var(--color-text-secondary);
}

.pr-jd-panel > .pr-jd-label {
    margin-bottom: 12px;
}

.pr-jd-fields {
    display: grid;
    grid-template-columns: minmax(140px, 0.6fr) minmax(240px, 1.4fr);
    gap: 16px;
    align-items: start;
}

.pr-jd-fields .field-group {
    margin: 0;
    min-width: 0;
}

.pr-jd-fields .pr-jd-model {
    grid-column: 1 / -1;
}

.pr-jd-fields .field-label {
    margin-bottom: 6px;
}

.pr-jd-fields input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 9px 10px;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 6px;
}

.pr-jd-fields input:hover {
    border-color: #94a3b8;
}

.pr-jd-fields input:focus-visible {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px var(--color-focus);
}

.pr-jd-fields input[aria-invalid="true"] {
    border-color: var(--outcome-invalid-accent);
}

.pr-jd-fields input[aria-invalid="true"]:focus-visible {
    box-shadow: 0 0 0 3px var(--color-focus);
}

.pr-jd-dialog .field-error {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.4;
    color: var(--outcome-invalid-accent);
}

.pr-jd-helper {
    margin: 16px 0 0;
}

.pr-jd-helper p {
    margin: 0 0 6px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--color-text-secondary);
}

.pr-jd-helper p:last-child {
    margin-bottom: 0;
}

.pr-jd-fee {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-bottom-width: 0;
    background: var(--color-surface);
    cursor: pointer;
}

.pr-jd-fee:first-of-type {
    border-radius: 8px 8px 0 0;
}

.pr-jd-fee:last-of-type {
    border-bottom-width: 1px;
    border-radius: 0 0 8px 8px;
}

.pr-jd-fee:first-of-type:last-of-type {
    border-radius: 8px;
}

.pr-jd-fee:has(input:checked) {
    background: var(--color-surface-subtle);
}

.pr-jd-fee.is-disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.pr-jd-fee-main {
    flex: 1 1 auto;
    min-width: 0;
}

.pr-jd-fee-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.pr-jd-fee-price {
    flex: none;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    color: var(--color-text);
}

.pr-jd-pending {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface-subtle);
}

.pr-jd-pending[hidden] {
    display: none;
}

.pr-jd-pending-list {
    margin: 0;
    padding-left: 18px;
    font-size: 13px;
    color: var(--color-text);
}

.pr-jd-foot {
    flex: none;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 24px;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
}

#parts-review-dialog dialog.pr-jd-dialog :focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: 2px;
}

@media (max-width: 767px) {
    #parts-review-dialog dialog.pr-jd-dialog {
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        margin: auto 0 0;
        border-radius: 12px 12px 0 0;
    }

    #parts-review-dialog dialog.pr-jd-dialog > .job-dialog-inner {
        max-height: 92vh;
    }

    .pr-jd-fields {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .pr-jd-fields input {
        min-height: 44px;
    }

    .pr-jd-fee,
    .pr-jd-mode,
    .pr-jd-choice {
        min-height: 48px;
    }

    .pr-jd-foot {
        flex-direction: column-reverse;
    }

    .pr-jd-foot .btn-primary,
    .pr-jd-foot .btn-secondary {
        width: 100%;
        min-height: 44px;
    }
}

.pr-line-dialog-vehicle[hidden] {
    display: none;
}

.pr-line-dialog-vehicle strong {
    color: var(--color-text);
    font-weight: 600;
}

@media (max-width: 480px) {
    .pr-summary--physical > .pr-summary-facts--physical {
        grid-template-columns: 1fr 1fr;
    }
}

.pr-summary-nested-line {
    display: none;
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--color-text-muted);
}

/* Job Item status chips: compact, text-and-number, not actions. */
.pr-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    margin: 0;
}

.pr-summary--physical > .pr-summary-head {
    align-items: flex-start;
}

.pr-chips[hidden] {
    display: none;
}

.pr-chips--dialog {
    justify-content: flex-start;
}

.pr-chip {
    display: inline-block;
    padding: 2px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}

.pr-chip--ready {
    color: var(--color-success-fg);
    background: var(--color-success-bg);
    border-color: #bbf7d0;
}

.pr-chip--order {
    color: #9a3412;
    background: #ffedd5;
    border-color: #fdba74;
}

.pr-chip--review {
    color: var(--color-warn-fg);
    background: var(--color-warn-bg);
    border-color: #fde68a;
}

.pr-chip--neutral {
    color: var(--color-neutral-fg);
    background: var(--color-neutral-bg);
    border-color: var(--color-border);
}

.pr-chip--info {
    color: #1e40af;
    background: #dbeafe;
    border-color: #bfdbfe;
}

.pr-chip--warn {
    color: var(--color-warn-fg);
    background: var(--color-warn-bg);
    border-color: #fde68a;
}

.pr-chip--attention {
    color: #7c2d12;
    background: #fed7aa;
    border-color: #fb923c;
}

.pr-chips-break {
    flex-basis: 100%;
    height: 0;
}

.pr-vehicle-flag--ready { color: var(--color-success-fg); }
.pr-vehicle-flag--info { color: #1e40af; }
.pr-vehicle-flag--warn { color: var(--color-warn-fg); }
.pr-vehicle-flag--attention { color: #7c2d12; }

.pr-jd-muted {
    color: var(--color-text-muted);
}

.pr-summary-source {
    margin: 2px 0 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
}

.pr-summary-source[hidden] {
    display: none;
}

.pr-summary-fees {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--color-border);
}

.pr-summary-fees[hidden],
.pr-summary-fees [hidden] {
    display: none;
}

.pr-summary-fee-list {
    margin: 0 0 4px;
    padding: 0;
    list-style: none;
}

.pr-summary-fee-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
}

.pr-summary-fee-price {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.pr-assigned-services {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* An assigned Service/Labor summary rendered inside its owning physical
   line: same element, compact row layout, no card chrome. */
.pr-summary--nested {
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface-subtle);
    box-shadow: none;
}

.pr-summary--nested > .pr-summary-head .pr-summary-line,
.pr-summary--nested > .pr-summary-facts,
.pr-summary--nested > .pr-summary-fees {
    display: none;
}

.pr-summary--nested > .pr-summary-head {
    margin: 0;
    justify-content: flex-end;
}

.pr-summary--nested > .pr-summary-head:has(.pr-summary-status[hidden]) {
    display: none;
}

.pr-summary--nested > .pr-summary-identity {
    font-size: 13px;
}

.pr-summary--nested > .pr-summary-nested-line {
    display: block;
}

.pr-summary--nested > .pr-summary-actions {
    justify-content: flex-start;
    margin-top: 4px;
}

.pr-summary--nested > .pr-summary-actions .pr-summary-open {
    min-height: 30px;
    padding: 3px 10px;
}

@media (max-width: 767px) {
    .pr-summary {
        padding: 14px;
    }

    .pr-summary--nested > .pr-summary-actions .pr-summary-open {
        min-height: 44px;
    }
}

.pr-summary-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.pr-summary-line {
    margin: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
}

.pr-summary-status {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 3px 10px;
    border: 1px solid var(--color-border-strong);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
}

.pr-status-review { background: #fef9c3; color: #854d0e; border-color: #fde047; }
.pr-status-warn { background: #fef9c3; color: #854d0e; border-color: #facc15; }
.pr-status-ready { background: #dcfce7; color: #166534; border-color: #86efac; }
.pr-status-order { background: #ffedd5; color: #9a3412; border-color: #fdba74; }
.pr-status-neutral { background: #f1f5f9; color: #334155; border-color: #cbd5e1; }
.pr-status-error { background: #fef2f2; color: #991b1b; border-color: #fca5a5; }

.pr-summary-identity {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
    overflow-wrap: anywhere;
}

.pr-summary-desc {
    margin: 2px 0 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    overflow-wrap: anywhere;
}

.pr-summary-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px 16px;
    margin: 10px 0 0;
}

.pr-summary-fact {
    min-width: 0;
}

.pr-summary-fact dt {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.pr-summary-fact dd {
    margin: 0;
    font-size: 13px;
    color: var(--color-text);
    overflow-wrap: anywhere;
}

.pr-summary-result {
    margin-top: 10px;
}

.pr-summary-result:empty {
    display: none;
}

.pr-summary-note {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.pr-summary-inline-action {
    margin-top: 4px;
    font-weight: 600;
}

.pr-summary-unsaved {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 10px 0 0;
    font-size: 12px;
    font-style: italic;
    color: var(--color-text-secondary);
}

.pr-summary-unsaved[hidden] {
    display: none;
}

.pr-summary-unsaved-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: 1px solid var(--color-text-muted);
    border-radius: 50%;
    font-size: 10px;
    font-style: normal;
    font-weight: 700;
    color: var(--color-text-muted);
}

.pr-summary-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.pr-summary-actions [hidden] {
    display: none;
}

.pr-summary-fee-name {
    min-width: 0;
    margin-right: auto;
    overflow-wrap: anywhere;
}

.pr-summary-open[data-pr-jd-action]:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    border-style: dashed;
}

.pr-summary-open {
    min-height: 36px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
}

.pr-error-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
}

.pr-error-line {
    font-weight: 700;
}

.pr-error-open {
    font-weight: 600;
}

.pr-main-foot {
    position: sticky;
    bottom: 0;
    z-index: 1;
    margin: 16px -24px -20px;
    padding: 12px 24px;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
}

/* Focused line dialog (nested inside the main Parts Review form). The
   higher-specificity selectors undo the main dialog's scroll-container
   rules that would otherwise cascade into this nested dialog. */

#parts-review-dialog dialog.pr-line-dialog {
    width: min(560px, 92vw);
    max-height: 84vh;
    padding: 0;
}

#parts-review-dialog dialog.pr-line-dialog .job-dialog-inner {
    display: flex;
    flex-direction: column;
    max-height: 84vh;
    overflow: hidden;
    padding: 0;
}

#parts-review-dialog dialog.pr-line-dialog .pr-line-dialog-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px 22px;
}

.pr-line-dialog-identity {
    margin: 4px 0 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
    overflow-wrap: anywhere;
}

.pr-line-dialog-desc {
    margin: 1px 0 0;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.pr-line-dialog-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 14px;
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--color-text-muted);
}

.pr-line-dialog-foot {
    flex: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin: 0;
    padding: 12px 22px;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
}

.pr-line-save-note {
    flex: 1 1 100%;
    margin: 0;
    text-align: right;
}

.pr-line-errors {
    margin-bottom: 12px;
}

.pr-related {
    margin: 12px 0 2px;
}

.pr-jobitem-question {
    margin: 0 0 8px;
}

.pr-jobitem-invalid-note {
    margin: 0 0 10px;
    padding: 8px 10px;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    background: #fef2f2;
    font-size: 13px;
    color: #991b1b;
}

.pr-jobitem-section-label {
    margin: 6px 0 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.pr-jobitem-empty {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.pr-jobitem-candidates {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.pr-jobitem-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border: 1px solid var(--color-border-strong);
    border-radius: 8px;
    background: var(--color-surface);
}

.pr-jobitem-card--selected,
.pr-jobitem-card--proposed {
    border: 1.5px solid var(--color-brand);
}

.pr-jobitem-number {
    margin: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--color-brand);
}

.pr-jobitem-identity {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text);
}

.pr-jobitem-desc {
    margin: 0;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.pr-jobitem-upn {
    margin: 0;
    font-size: 12px;
    color: var(--color-text-muted);
}

.pr-jobitem-status {
    margin: 2px 0 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
}

.pr-jobitem-select {
    align-self: flex-start;
    margin-top: 8px;
    min-height: 36px;
}

.pr-jobitem-change {
    margin-top: 6px;
    font-weight: 600;
}

.pr-jobitem-pending-note {
    margin-top: 8px;
    color: #854d0e;
}

.pr-line-fees {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px dashed var(--color-border);
}

.pr-card-fees-subtitle {
    margin: 6px 0 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.pr-imported-service-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 10px;
    font-size: 13px;
}

.pr-imported-service-meta {
    flex: 1 1 100%;
    font-size: 12px;
    color: var(--color-text-muted);
}

.pr-jd-lock-note {
    margin: 6px 0 0;
    padding: 6px 10px;
    border: 1px solid #fde047;
    border-radius: 6px;
    background: #fefce8;
    font-size: 12px;
    color: #854d0e;
}

[data-pr-jd-action]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 767px) {
    .pr-summary-facts {
        grid-template-columns: 1fr 1fr;
    }

    .pr-summary-actions {
        flex-direction: column;
    }

    .pr-summary-actions .pr-summary-open {
        width: 100%;
        min-height: 44px;
    }

    #parts-review-dialog dialog.pr-line-dialog {
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        margin: auto 0 0;
        border-radius: 12px 12px 0 0;
    }

    #parts-review-dialog dialog.pr-line-dialog .job-dialog-inner {
        max-height: 92vh;
    }

    .pr-jobitem-candidates {
        grid-template-columns: 1fr;
    }

    .pr-jobitem-select {
        width: 100%;
        min-height: 44px;
    }

    .pr-line-dialog-foot .btn-primary,
    .pr-line-dialog-foot .btn-secondary {
        flex: 1 1 auto;
        min-height: 44px;
    }
}

/* ---- Purchase Orders workspace (visual slice) ---- */

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

.po-summary {
    margin-bottom: 16px;
}

.po-summary-count {
    font-size: 20px;
    font-weight: 700;
}

.po-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 14px;
}

.po-toolbar .field-block {
    margin: 0;
}

.po-toolbar .po-search {
    flex: 1 1 280px;
    max-width: 420px;
}

.po-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 12px;
}

.po-tab {
    padding: 8px 12px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    font: inherit;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
}

.po-tab.is-active {
    color: var(--color-brand);
    border-bottom-color: var(--color-brand);
}

.po-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.po-status-draft {
    color: var(--color-warn-fg);
    background: var(--color-warn-bg);
}

.po-status-ordered {
    color: #1d4ed8;
    background: #dbeafe;
}

.po-status-partial {
    color: #9a3412;
    background: #ffedd5;
}

.po-status-closed {
    color: var(--color-success-fg);
    background: var(--color-success-bg);
}

.po-status-canceled {
    color: var(--color-neutral-fg);
    background: var(--color-neutral-bg);
}

.po-progress {
    display: inline-block;
    width: 110px;
    height: 6px;
    margin: 2px 8px 0 0;
    border-radius: 999px;
    background: var(--color-neutral-bg, #e2e8f0);
    overflow: hidden;
    vertical-align: middle;
}

.po-progress > span {
    display: block;
    height: 100%;
    background: var(--color-brand);
}

.po-needs {
    border: 1px dashed var(--color-border);
    border-radius: 8px;
    padding: 12px 16px;
    margin: 0 0 14px;
    background: var(--color-bg-app, #f8fafc);
}

.po-needs-title {
    margin: 0 0 2px;
    font-size: 14px;
    font-weight: 600;
}

.po-needs .field-help {
    margin: 0 0 10px;
}

.po-needs-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 16px;
}

.po-manual-lines input {
    width: 100%;
}

/* ---- Purchase Order detail page ---- */

.po-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.po-title-row .page-title {
    margin: 0;
}

.po-facts {
    margin-top: 10px;
    margin-bottom: 20px;
}

.po-detail-section {
    margin-bottom: 24px;
}

.po-section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.po-section-header .pv-section-title {
    margin: 0;
}

.po-section-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.po-lines-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}

.po-lines-table th,
.po-lines-table td {
    display: table-cell;
    padding: 10px 12px;
    vertical-align: middle;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.po-lines-table thead th {
    border-bottom: 1px solid var(--color-border-strong);
}

.po-lines-table tbody tr {
    border-bottom: 1px solid var(--color-border);
}

.po-lines-table td.cell-primary,
.po-lines-table td.cell-muted {
    display: table-cell;
}

.po-lines-table .num {
    text-align: right;
}

.po-lines-table .cell-actions {
    text-align: right;
    white-space: nowrap;
    width: 90px;
    vertical-align: middle;
}

.po-inline-form {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    margin: 0;
    padding: 0;
    vertical-align: middle;
}

.po-lines-table .btn-link-quiet {
    margin: 0;
    min-height: auto;
    padding: 0;
    line-height: 1.4;
    vertical-align: middle;
}

/* ---- Add Keys / Fobs dialog ---- */

dialog.po-lines-dialog {
    width: min(1024px, 94vw);
    max-height: none;
}

dialog.po-lines-dialog .job-dialog-inner {
    padding: 0;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    border-top: none;
    border-radius: 7px;
    overflow: hidden;
}

dialog.po-lines-dialog .qs-head {
    flex: none;
    margin: 0;
    padding: 14px 24px 12px;
    background: var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

dialog.po-lines-dialog .qs-head .qs-head-copy {
    flex: 1;
    min-width: 0;
}

dialog.po-lines-dialog .job-dialog-title {
    margin: 0 0 2px;
    font-size: 18px;
}

dialog.po-lines-dialog .qs-head-sub {
    margin: 0;
    font-size: 13px;
    color: var(--color-text-secondary);
}

/* Same visible hand/grab affordance as the Parts Review dialog header:
   open-hand cursor over the header on desktop pointers. */
@media (min-width: 1024px) and (pointer: fine) {
    dialog.po-lines-dialog .qs-head {
        cursor: grab;
        user-select: none;
        touch-action: none;
    }

    dialog.po-lines-dialog .qs-head:active {
        cursor: grabbing;
    }
}

dialog.po-lines-dialog form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    margin: 0;
}

.po-dialog-content {
    flex: 1;
    min-height: 0;
    padding: 16px 22px;
    overflow-y: auto;
}

.po-dialog-table-wrap {
    margin-bottom: 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    max-height: min(46vh, 420px);
    overflow-y: auto;
    overflow-x: hidden;
}

.po-dialog-lines-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    margin-bottom: 0;
}

.po-dialog-lines-table th {
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    background: var(--color-header);
    border-bottom: 1px solid var(--color-border-strong);
    white-space: nowrap;
}

.po-dialog-lines-table td {
    padding: 8px 12px;
    vertical-align: middle;
    border-bottom: 1px solid var(--color-border);
}

.po-dialog-lines-table tbody tr:last-child td {
    border-bottom: none;
}

.po-dialog-lines-table input {
    width: 100%;
    padding: 8px 12px;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 4px;
    box-sizing: border-box;
}

.po-dialog-lines-table input.ident {
    font-family: var(--font-mono);
}

.po-dialog-lines-table input:focus-visible {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 2px var(--color-focus);
}

.po-dialog-lines-table .cell-actions {
    text-align: center;
    padding: 8px 6px;
}

.po-dialog-lines-table .js-remove-row {
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    color: var(--color-text-muted);
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 4px;
}

.po-dialog-lines-table .js-remove-row:hover {
    color: #dc2626;
    background: var(--color-neutral-bg, #f1f5f9);
}

.po-dialog-add-row-bar {
    margin: 8px 0 4px;
}

.po-dialog-add-row-bar .btn-link-quiet {
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}

dialog.po-lines-dialog .dialog-actions {
    flex: none;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    padding: 12px 22px;
    background: var(--color-bg-app);
    border-top: 1px solid var(--color-border);
    margin: 0;
}

@media (max-width: 768px) {
    dialog.po-lines-dialog .qs-head {
        padding: 14px 16px 12px;
    }

    .po-dialog-content {
        padding: 14px 16px;
    }

    dialog.po-lines-dialog .dialog-actions {
        padding: 12px 16px;
    }
}

.po-composer-card {
    margin-top: 24px;
    margin-bottom: 20px;
}

.po-composer-card .pv-section-title,
.po-place-card .pv-section-title {
    margin: 0 0 4px;
}

.po-card-head {
    margin-bottom: 12px;
}

.po-form-grid {
    display: grid;
    grid-template-columns: minmax(200px, 1.2fr) minmax(240px, 2fr) minmax(190px, 220px);
    gap: 14px 16px;
    align-items: end;
    margin-bottom: 14px;
}

.po-form-grid .field-group {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    margin-bottom: 0;
}

.po-form-grid .field-label {
    white-space: nowrap;
    margin-bottom: 6px;
}

.po-receipt-grid .field-group {
    margin-bottom: 0;
}

.po-form-grid input,
.po-place-form input,
.po-receipt-grid input,
.po-receipt-grid select {
    width: 100%;
    padding: 8px 10px;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 6px;
    box-sizing: border-box;
}

.po-form-grid input:hover,
.po-place-form input:hover,
.po-receipt-grid input:hover,
.po-receipt-grid select:hover {
    border-color: #94a3b8;
}

.po-form-grid input:focus-visible,
.po-place-form input:focus-visible,
.po-receipt-grid input:focus-visible,
.po-receipt-grid select:focus-visible {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px var(--color-focus);
}

.po-place-card {
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-brand);
    border-radius: 8px;
    background: var(--color-surface);
    padding: 18px 20px;
    margin-top: 20px;
    margin-bottom: 24px;
}

.po-place-intro {
    margin-bottom: 12px;
}

.po-place-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.po-place-input-group {
    flex: 1 1 320px;
    max-width: 440px;
    margin-bottom: 0;
}

.po-place-btn {
    padding: 9px 20px;
    font-weight: 600;
}

.po-receipt-grid {
    display: grid;
    grid-template-columns: minmax(200px, 2fr) minmax(100px, 1fr) minmax(100px, 1fr);
    gap: 14px 16px;
    align-items: start;
    margin-bottom: 14px;
}

.field-label-desc {
    font-weight: 400;
    color: var(--color-text-muted);
    font-size: 12px;
}

@media (max-width: 768px) {
    .po-form-grid,
    .po-receipt-grid {
        grid-template-columns: 1fr;
    }
    .po-form-grid .field-label {
        white-space: normal;
    }
    .po-place-row {
        flex-direction: column;
        align-items: stretch;
    }
    .po-place-input-group {
        max-width: 100%;
    }
    .po-place-btn {
        width: 100%;
    }
}

.psws-nav-child {
    padding-left: 30px;
    font-size: 13px;
}

.pr-order-hint {
    margin-top: 6px;
    font-weight: 600;
}

.pr-exception {
    margin: 0 0 12px;
    padding: 10px 14px;
    border: 1px dashed var(--color-border);
    border-radius: 6px;
}

.pr-qty-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.pr-qty-grid .field-group {
    margin-bottom: 0;
}

.pr-qty-grid input {
    width: 100%;
}

#parts-review-form input[type="text"],
#parts-review-form input[type="number"],
#parts-review-form select {
    display: block;
    width: 100%;
    padding: 9px 12px;
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.4;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 6px;
}

#parts-review-form input[type="text"]:hover,
#parts-review-form input[type="number"]:hover,
#parts-review-form select:hover {
    border-color: #94a3b8;
}

#parts-review-form input[type="text"]:focus-visible,
#parts-review-form input[type="number"]:focus-visible,
#parts-review-form select:focus-visible {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px var(--color-focus);
}

.pr-help-proposed {
    margin-top: 4px;
}

.pr-coverage {
    margin: 10px 0 2px;
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.pr-coverage-note,
.pr-nogate-note,
.pr-empty {
    margin: 0;
    font-size: 12px;
    color: var(--color-text-muted);
}

.pr-nogate-note {
    margin-top: 4px;
}

.pr-empty {
    margin: 12px 0;
}

/* Design-example panel for future approved-default appearance */

.pr-example {
    margin: 12px 0 0;
    border: 1px dashed var(--color-border-strong);
    border-radius: 8px;
    background: var(--color-warn-bg);
}

.pr-example > summary {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-warn-fg);
    cursor: pointer;
    border-radius: 8px;
}

.pr-example-body {
    border-top: 1px dashed var(--color-border-strong);
    background: var(--color-surface);
    border-radius: 0 0 8px 8px;
    padding: 12px 14px;
}

.pr-example-note {
    margin: 10px 0 0;
    font-size: 12px;
    color: var(--color-text-muted);
}

.pr-provenance {
    margin: 6px 0 0;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12.5px;
}

.pr-prov-suggested {
    border: 1px solid #bbf7d0;
    background: var(--color-success-bg);
    color: var(--color-success-fg);
}

.pr-prov-exception {
    border: 1px solid var(--color-warn-bg);
    background: #fffbeb;
    color: var(--color-warn-fg);
}

.pr-prov-conflict {
    border: 1px solid #fecaca;
    background: var(--outcome-invalid-bg, #fef2f2);
    color: var(--outcome-invalid-accent, #dc2626);
}

.pr-actions {
    justify-content: space-between;
}

#pr-complete[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    border-style: dashed;
}

@media (max-width: 768px) {
    dialog.parts-review-dialog {
        width: 100%;
        max-width: 100%;
        margin: auto 0 0;
        border-radius: 12px 12px 0 0;
        border-bottom: none;
    }

    dialog.parts-review-dialog .job-dialog-inner {
        max-height: calc(92vh - env(safe-area-inset-bottom, 0px));
        padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    }

    #parts-review-dialog .job-dialog-inner {
        padding: 0;
    }

    #parts-review-dialog .pr-body {
        padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    }

    #parts-review-dialog .qs-head {
        padding: 12px 16px 10px;
        border-radius: 12px 12px 0 0;
    }

    .pr-line {
        padding: 14px;
    }

    .pr-line-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .pr-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .pr-actions .btn-primary,
    .pr-actions .btn-link-quiet {
        width: 100%;
        justify-content: center;
    }
}

/* ---------------------------------------------------------------------
   PO list / detail preview additions
   --------------------------------------------------------------------- */

.pv-back {
    margin-top: 0;
    margin-bottom: 10px;
}

.pv-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* ---------------------------------------------------------------------
   Slice 6: Parts & Scheduling workspace local navigation (UI only)
   --------------------------------------------------------------------- */

.psws-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
    margin-top: 4px;
}

.psws-nav {
    position: sticky;
    top: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
}

.psws-nav-link {
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    color: var(--color-text-secondary);
    text-decoration: none;
    border: 1px solid transparent;
}

.psws-nav-link:hover {
    background: var(--color-neutral-bg);
    color: var(--color-text);
}

.psws-nav-link:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.psws-nav-link.is-active {
    background: #f0f9ff;
    border-color: var(--color-brand);
    color: var(--color-text);
    font-weight: 600;
}

.psws-nav-external {
    border-top: 1px solid var(--color-border);
    margin-top: 6px;
    border-radius: 0 0 6px 6px;
    padding-top: 10px;
}

.psws-nav-note {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: var(--color-text-muted);
}

.pv-view[hidden] {
    display: none;
}

.psws-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin-top: 12px;
}

.psws-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    text-decoration: none;
    color: var(--color-text);
}

.psws-card:hover {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 1px var(--color-brand);
}

.psws-card:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.psws-card-title {
    font-size: 15px;
    font-weight: 600;
}

.psws-card-copy {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.psws-card-action {
    margin-top: auto;
    font-size: 13px;
    color: var(--color-brand);
    font-weight: 600;
}

.psws-card-external {
    border-style: dashed;
}

.psws-nav-heading {
    margin: 8px 4px 2px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
}

.psws-nav-heading:first-child {
    margin-top: 0;
}

/* Tablet: nav becomes a wrapped pill strip above the single active view;
   nothing scrolls horizontally. */

@media (max-width: 1024px) {
    .psws-layout {
        grid-template-columns: 1fr;
    }

    .psws-nav {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .psws-nav-external {
        border-top: none;
        margin-top: 0;
        padding-top: 8px;
    }

    .psws-nav-heading {
        display: none;
    }
}

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

/* ---------------------------------------------------------------------
   Slice 4: Job Classification concept inside Parts Review + Job Card
   (all visual-only)
   --------------------------------------------------------------------- */

.pr-classify {
    margin: 12px 0 14px;
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg-app);
}

.pr-classify-current {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.pr-classify .field-group {
    margin-bottom: 0;
}

.pr-classify-controls {
    margin-top: 4px;
}

#parts-review-form .pr-classify-controls select {
    width: min(420px, 100%);
}

/* Unresolved-input attention ring: an inset-free box shadow, so it adds zero
   layout size, never clips the native select arrow, and never replaces the
   project focus outline. "Unresolved" means operator input is still needed,
   not a failed validation or a bad business outcome. */
#pr-job-classification.pr-unresolved,
.pr-needed input.pr-unresolved,
.pr-stockask input.pr-unresolved,
.pr-vendor select.pr-unresolved {
    box-shadow: 0 0 0 2px var(--outcome-invalid-accent);
}

/* .pr-choicearea wraps the editable decision controls below the fieldset
   legend, so the ring can surround the radios/toggles without ever
   crossing the "Decision for this item" heading. */
.pr-choicearea.pr-unresolved {
    border-radius: 8px;
    padding: 8px 12px 12px;
    box-shadow: 0 0 0 2px var(--outcome-invalid-accent);
}

.pr-classify-gate {
    margin-top: 12px;
    padding: 12px 14px;
    border: 1px solid var(--color-border-strong);
    border-left: 3px solid var(--color-brand);
    border-radius: 6px;
    background: var(--color-surface);
}

.pr-classify-gate-heading {
    margin: 0 0 6px;
    font-size: 14px;
    font-weight: 600;
}

.pr-classify-gate-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

dialog.job-card-dialog {
    width: min(700px, 92vw);
    max-height: none;
}

dialog.job-card-dialog .job-dialog-inner {
    overflow-y: auto;
    max-height: 85vh;
}

.jc-details {
    margin: 12px 0;
}

.jc-status-line {
    margin: 14px 0 4px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.jc-status-chip {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--color-border);
}

.jc-scheduled {
    background: var(--color-neutral-bg);
    color: var(--color-neutral-fg);
}

.jc-in-progress {
    background: var(--color-warn-bg);
    color: var(--color-warn-fg);
    border-color: #fde68a;
}

.jc-completed {
    background: var(--color-success-bg);
    color: var(--color-success-fg);
    border-color: #bbf7d0;
}

.jc-status-chip::after {
    content: ' — not a real state';
    font-weight: 400;
    color: var(--color-text-muted);
}

@media (max-width: 768px) {
    dialog.job-card-dialog {
        width: 100%;
        max-width: 100%;
        margin: auto 0 0;
        border-radius: 12px 12px 0 0;
        border-bottom: none;
    }

    dialog.job-card-dialog .job-dialog-inner {
        max-height: calc(92vh - env(safe-area-inset-bottom, 0px));
        padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    }
}

/* ---------------------------------------------------------------------
   Slice 3: Add-to-Draft-PO dialog + design-preview pages (UI only)
   --------------------------------------------------------------------- */

/* Full-width workspace opt-in (same convention the Calendar page uses;
   declared here so non-Calendar pages loading only this stylesheet can opt
   into it too) */
.app-content--wide.app-content--wide {
    max-width: none;
    padding-inline: clamp(16px, 3vw, 40px);
}

dialog.po-preview-dialog {
    width: min(760px, 92vw);
    max-height: none;
}

.po-facts {
    margin-top: 12px;
}

.po-notice {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-left: 3px solid var(--color-warn-fg);
    background: var(--color-warn-bg);
    color: var(--color-warn-fg);
    font-size: 13px;
}

.pr-po-trigger {
    margin-top: 10px;
}

/* Design-preview pages */

.preview-banner {
    margin: 0 0 16px;
    padding: 10px 14px;
    border: 1px dashed var(--color-border-strong);
    border-radius: 8px;
    background: var(--color-warn-bg);
    color: var(--color-warn-fg);
    font-size: 13px;
}

.pv-section {
    margin-bottom: 22px;
}

.pv-section-title {
    margin: 0 0 10px;
    font-size: 18px;
}

.pv-card {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    padding: 16px 18px;
    margin-bottom: 14px;
}

.pv-card h2,
.pv-card h3 {
    margin-top: 0;
}

.pv-honest {
    border-left: 3px solid var(--color-brand);
    background: #f0f9ff;
}

.pv-honest p {
    margin: 8px 0 0;
}

.pv-fictional {
    border-style: dashed;
    border-left: 3px solid var(--color-warn-fg);
}

.pv-fictional > h3 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-warn-fg);
}

.pv-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.pv-audit {
    margin: 0;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.pv-muted {
    color: var(--color-text-muted);
    font-size: 12px;
}

.pv-chip {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--color-neutral-bg);
    border: 1px solid var(--color-border);
    color: var(--color-neutral-fg);
    font-size: 12px;
    font-weight: 600;
}

.pv-chip-state {
    background: var(--color-success-bg);
    color: var(--color-success-fg);
    border-color: #bbf7d0;
}

.pv-columns {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
}

.pv-alloc {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
}

.pv-alloc input {
    width: 64px;
    margin: 0 4px;
}

.pv-receive-demo {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 16px;
}

.pv-receive-demo .field-group {
    min-width: 220px;
    flex: 1;
}

.pv-rows {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pv-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg-app);
}

.pv-row-facts {
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.pv-row-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pv-divider {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 20px 0;
}

.pv-footer {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.pv-empty-real {
    margin: 8px 0 0;
    font-size: 14px;
}

@media (max-width: 768px) {
    dialog.po-preview-dialog {
        width: 100%;
        max-width: 100%;
        margin: auto 0 0;
        border-radius: 12px 12px 0 0;
        border-bottom: none;
    }

    dialog.po-preview-dialog .job-dialog-inner {
        max-height: calc(92vh - env(safe-area-inset-bottom, 0px));
        overflow-y: auto;
        padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    }

    .pv-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .pv-row-actions {
        width: 100%;
    }

    .pv-row-actions .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}

/* Parts Review list-state chip (read-only derived status, not a queue). */

.pr-state {
    display: inline-flex;
    margin-top: 2px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    background: var(--color-neutral-bg);
}

.pr-state-needs_rereview {
    color: var(--color-warn-fg);
    background: var(--color-warn-bg);
}

.pr-state-complete {
    color: var(--color-success-fg);
    background: var(--color-success-bg);
    border-color: #bbf7d0;
}

/* ---- Ticket scheduling panel (included by the Calendar page) ----
   Inner presentation only; the panel shell, grid track, collapse geometry,
   and proposed-appointment marker live in scheduling/css/calendar.css. */

.tsp-inner {
    padding: 14px 16px 16px;
}

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

.tsp-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
}

.tsp-identity {
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface-subtle);
}

.tsp-identity p {
    margin: 0;
}

.tsp-number {
    font-size: 13px;
}

.tsp-primary {
    font-weight: 600;
    color: var(--color-text);
}

.tsp-secondary {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.tsp-phone {
    font-size: 13px;
}

.tsp-phone a {
    color: var(--color-text-secondary);
    text-decoration: none;
}

.tsp-phone a:hover {
    color: var(--color-brand-hover);
    text-decoration: underline;
}

/* Imported billing address as a compact block under the phone line; the
   text field may carry source line breaks worth preserving. */
.tsp-address {
    font-size: 12px;
    color: var(--color-text-secondary);
    white-space: pre-line;
    overflow-wrap: break-word;
}

.tsp-meta {
    margin-top: 4px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.tsp-window {
    margin: 0 0 6px;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px dashed var(--color-border-strong);
    background: var(--color-neutral-bg);
    font-size: 13px;
    color: var(--color-text-secondary);
}

.tsp-goto-row {
    margin: 0 0 6px;
    font-size: 12px;
}

.tsp-outcome-block {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
}

.tsp-outcome-block select {
    font-weight: 600;
}

.tsp-outcome-fields {
    margin-bottom: 12px;
}

.contact-log-list {
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.contact-log-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 13px;
}

.contact-log-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.contact-log-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.contact-log-outcome {
    color: var(--color-text);
    font-weight: 600;
}

.contact-log-meta {
    margin: 4px 0 0;
    color: var(--color-text-secondary);
    font-size: 12px;
}

.contact-log-notes {
    margin: 6px 0 0;
    color: var(--color-text);
    font-size: 13px;
    white-space: pre-wrap;
}

.tsp-form .field-block {
    display: block;
    margin-bottom: 10px;
}

.tsp-pair {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
}

.tsp-form input,
.tsp-form select,
.tsp-form textarea {
    display: block;
    width: 100%;
    padding: 8px 10px;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 6px;
    box-sizing: border-box;
}

.tsp-form textarea {
    resize: vertical;
    min-height: 60px;
}

.tsp-form input:hover,
.tsp-form select:hover,
.tsp-form textarea:hover {
    border-color: #94a3b8;
}

.tsp-form input:focus-visible,
.tsp-form select:focus-visible,
.tsp-form textarea:focus-visible {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px var(--color-focus);
}

.tsp-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.tsp-actions .btn-primary,
.tsp-actions .btn-secondary {
    width: 100%;
    justify-content: center;
    text-align: center;
}

.tsp-return {
    margin: 10px 0 0;
    font-size: 12px;
    text-align: center;
}

.tsp-form .import-result {
    margin-bottom: 12px;
}

/* ---- Technician Administration forms (Add page + Edit dialog) ----
   Shared class system so profile and access editing present identically;
   scoped to .ta-form, following the existing per-form convention. */

.ta-intro {
    margin: 0 0 18px;
    max-width: 62ch;
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text-secondary);
}

.ta-form .ta-section {
    margin: 0;
    padding: 4px 0 0;
    border: 0;
    border-radius: 0;
}

.ta-form .ta-section + .ta-section {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

.ta-legend {
    display: block;
    margin: 0 0 2px;
    padding: 0;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}

.ta-legend-note {
    margin: 0 0 14px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--color-text-muted);
}

/* Paired fields (date pair, password pair): both cells keep an identical
   label row so labels start on one line and inputs start on one line; an
   error list beneath one cell only grows that cell downward. */

.ta-grid-pair {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 14px;
    align-items: start;
}

.ta-grid-pair > .field-group {
    display: flex;
    flex-direction: column;
}

.ta-grid-pair > .field-group > .field-label {
    min-height: 21px;
    line-height: 21px;
}

.ta-form input[type="text"],
.ta-form input[type="date"],
.ta-form input[type="password"] {
    display: block;
    width: 100%;
    min-height: 40px;
    padding: 9px 10px;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 6px;
    box-sizing: border-box;
}

.ta-form input[type="text"]:hover,
.ta-form input[type="date"]:hover,
.ta-form input[type="password"]:hover {
    border-color: #94a3b8;
}

.ta-form input[type="text"]:focus-visible,
.ta-form input[type="date"]:focus-visible,
.ta-form input[type="password"]:focus-visible {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px var(--color-focus);
}

/* Password pair: labels share one grid row and inputs share the next, so
   both labels start on the same line and both inputs start at the same
   offset with identical geometry — regardless of label text length, error
   rows beneath a field, or browser password-reveal adornments. */

.ta-split-pair {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 14px;
    align-items: start;
    align-content: start;
    margin-bottom: 20px;
    grid-template-areas:
        "label-a label-b"
        "field-a field-b";
}

.ta-split-label-a { grid-area: label-a; }

.ta-split-label-b { grid-area: label-b; }

.ta-split-field-a { grid-area: field-a; }

.ta-split-field-b { grid-area: field-b; }

.ta-split-pair > .field-label {
    margin: 0 0 4px;
    min-height: 21px;
    line-height: 21px;
}

.ta-form .errorlist {
    margin: 6px 0 0;
}

@media (max-width: 560px) {
    .ta-split-pair {
        grid-template-columns: 1fr;
        grid-template-areas:
            "label-a"
            "field-a"
            "label-b"
            "field-b";
        margin-bottom: 0;
    }

    .ta-split-field-a {
        margin-bottom: 14px;
    }
}

.ta-optional {
    font-weight: 400;
    color: var(--color-text-muted);
}

/* Checkbox presented as a readable operational setting, never color-only:
   the box state, check mark, and focus outline all carry the meaning. */

.ta-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 4px 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface-subtle);
}

.ta-check input[type="checkbox"] {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    accent-color: var(--color-brand);
    cursor: pointer;
}

.ta-check input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.ta-check-text {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.ta-check-note {
    margin: 2px 0 0;
    font-weight: 400;
    font-size: 13px;
    line-height: 1.4;
    color: var(--color-text-muted);
}


/* Action footer: secondary Cancel on the left, primary Save on the right. */

.ta-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.ta-error-summary {
    /* reuse the established import-result banner presentation */
    margin-bottom: 18px;
}

@media (max-width: 560px) {
    .ta-grid-pair {
        grid-template-columns: 1fr;
    }

    .ta-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }
}

/* ---- People & Access workspace (shared by Application Users and Technicians) ---- */

.pa-intro {
    margin: -6px 0 16px;
    max-width: 62ch;
    font-size: 14px;
    color: var(--color-text-secondary);
}

/* Underline section navigation: Application Users first, Technicians
   second, in DOM, keyboard, and visual order at every width. */

.pa-nav {
    display: flex;
    gap: 26px;
    margin: 0 0 24px;
    border-bottom: 1px solid var(--color-border);
}

.pa-nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 2px 8px;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
}

.pa-nav-link:hover {
    color: var(--color-text);
    border-bottom-color: var(--color-border-strong);
}

.pa-nav-link:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

/* Active view: darker semibold text + brand underline — the state is
   carried by weight and underline, never by color alone. */
.pa-nav-link.is-active {
    color: var(--color-text);
    font-weight: 650;
    border-bottom-color: var(--color-brand);
}

/* Section header: title and quiet count on the left, primary action on
   the right, one aligned row; stacks cleanly on narrow screens. */

.pa-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px 20px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.pa-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 650;
    color: var(--color-text);
}

.pa-count {
    display: inline-flex;
    align-items: center;
    min-width: 24px;
    justify-content: center;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--color-neutral-bg);
    color: var(--color-neutral-fg);
    font-size: 12px;
    font-weight: 600;
}

.pa-section-desc {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--color-text-muted);
}

/* Compact empty panel: quiet border and background, no decoration. */

.pa-empty {
    padding: 22px 20px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface-subtle);
}

.pa-empty-title {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.pa-empty-copy {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--color-text-muted);
}

.ta-back {
    display: inline-block;
    margin-bottom: 6px;
    font-size: 13px;
}

@media (max-width: 560px) {
    .pa-nav {
        gap: 18px;
    }

    .pa-nav-link {
        min-height: 44px;
    }
}

/* Read-only acknowledgment of technical (System Administration) accounts:
   classification shown, management controls never present. */

.pa-technical {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.pa-technical-title {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}

.pa-technical-copy {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.pa-technical-list {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 13px;
}

.pa-technical-list li + li {
    margin-top: 4px;
}

/* Calendar Color swatch radio group (Add/Edit Technician): each swatch
   pairs a palette dot with its human-readable name; selection state comes
   from the real radio input, never color alone. */

.ta-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.ta-swatch {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px 6px 8px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface);
    cursor: pointer;
    font-size: 13px;
}

.ta-swatch:hover {
    border-color: #94a3b8;
}

.ta-swatch input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.ta-swatch:has(input:focus-visible) {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.ta-swatch:has(input:checked) {
    border-color: var(--color-brand);
    background: var(--color-surface-subtle);
}

.ta-swatch:has(input:checked) .ta-swatch-name {
    font-weight: 600;
    color: var(--color-text);
}

.ta-swatch-dot {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--swatch-accent, var(--color-text-muted));
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.18);
}

.ta-swatch-name {
    color: var(--color-text-secondary);
}

/* Physical-part card Fee / Service rows (Parts Review): name left,
   informational price right, Remove inline. Presentation only. */

.pr-card-fees {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed var(--color-border);
}

.pr-card-fees-title {
    margin: 0 0 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.pr-card-fee-list {
    margin: 0 0 8px;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pr-card-fee-list li {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 13px;
}

.pr-card-fee-name {
    min-width: 0;
    color: var(--color-text);
}

.pr-card-fee-price {
    margin-left: auto;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--color-text);
}

.pr-card-fees-empty {
    margin: 0 0 6px;
    font-size: 13px;
    color: var(--color-text-muted);
}

/* Ready to Schedule Contact Status presentation */

.ready-row--tinted {
    background-color: var(--row-tint, #f8fafc) !important;
}

.ready-row--tinted:hover {
    filter: brightness(0.97);
}

.ready-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 3px 8px 3px 4px;
    border-radius: 999px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.ready-status-pill--neutral {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    padding: 0;
}

.ready-status-pill--neutral .ready-status-label {
    color: var(--color-text-muted);
    font-weight: 500;
}

.ready-status-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.ready-status-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
}

.ready-status-follow-up {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-secondary);
    white-space: nowrap;
}

.ready-status-pill--blue {
    border-color: #bae6fd;
    background: #f0f9ff;
}
.ready-status-pill--blue .ready-status-label {
    color: #0369a1;
}

.ready-status-pill--amber {
    border-color: #fed7aa;
    background: #fff7ed;
}
.ready-status-pill--amber .ready-status-label {
    color: #c2410c;
}

.ready-status-pill--purple {
    border-color: #ddd6fe;
    background: #f5f3ff;
}
.ready-status-pill--purple .ready-status-label {
    color: #6d28d9;
}

.ready-status-pill--red {
    border-color: #fecaca;
    background: #fef2f2;
}
.ready-status-pill--red .ready-status-label {
    color: #b91c1c;
}

.ready-status-pill--teal {
    border-color: #99f6e4;
    background: #f0fdfa;
}
.ready-status-pill--teal .ready-status-label {
    color: #0f766e;
}

.ready-status-pill--slate {
    border-color: #cbd5e1;
    background: #f8fafc;
}
.ready-status-pill--slate .ready-status-label {
    color: #475569;
}

/* Quiet notification toast for contact outcomes */

.outcome-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    margin-bottom: 12px;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px solid var(--color-border);
    font-size: 13px;
    color: var(--color-text);
}

.outcome-toast-text {
    flex: 1 1 auto;
}
