/* --------------------------------------------------------------------------
   Ferry Telecom - Workbench 2035 Aesthetic (Engineered, Dense, Fast)
   -------------------------------------------------------------------------- */

:root {
    --primary: #087ce7;
    --primary-hover: #0768c3;
    --primary-active: #0554a0;
    --primary-light: #eaf3fc;
    
    --bg-body: #f5f6f8;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f9fafb;
    --bg-alt: #eef0f3;

    --text-main: #111827;
    --text-muted: #64748b;
    --text-inverse: #ffffff;

    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --border-focus: #087ce7;

    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;
    
    --success: #10b981;
    --success-bg: #ecfdf5;
    --success-border: #a7f3d0;
    
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --warning-border: #fde68a;

    --radius-sm: 4px;
    --radius: 6px;
    --radius-lg: 8px;
    
    --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 8px -2px rgba(0,0,0,0.1);
    --shadow-float: 0 10px 20px -5px rgba(0,0,0,0.15);
    
    --transition: 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Fast, controlled order management */
.admin-order-number {
    max-width: 220px;
    padding: 0;
    overflow: hidden;
    border: 0;
    background: transparent;
    color: var(--wb-primary);
    font: inherit;
    font-size: .875rem;
    font-weight: 700;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}
.admin-order-number:hover { text-decoration: underline; }

.catalog-gap-panel {
    margin: 0 0 2rem;
    padding: 1rem;
    border: 1px solid var(--warning-border);
    border-radius: var(--radius-lg);
    background: var(--warning-bg);
}
.catalog-gap-panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.catalog-gap-panel h3 { margin: 0 0 .25rem; font-size: 1rem; }
.catalog-gap-panel p { max-width: 700px; margin: 0; color: var(--text-muted); font-size: .8125rem; line-height: 1.45; }
.catalog-gap-summary {
    margin: 0 0 1rem;
    color: var(--text-muted);
    font-size: .875rem;
}
.catalog-gap-summary strong { color: var(--text-main); }
.catalog-gap-list {
    display: grid;
    gap: .5rem;
    min-width: 290px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.catalog-gap-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .5rem .625rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
}
.catalog-gap-entry span:first-child { display: grid; gap: .125rem; }
.catalog-gap-entry small { color: var(--text-muted); font-size: .6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.catalog-gap-entry strong { font-size: .8125rem; }
.catalog-gap-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }
.catalog-gap-actions a { color: var(--primary-active); font-size: .75rem; font-weight: 700; white-space: nowrap; }
@media (max-width: 700px) {
    .catalog-gap-panel-heading, .catalog-gap-entry { align-items: stretch; flex-direction: column; }
    .catalog-gap-actions { justify-content: flex-start; }
}

.modal-content:has(.admin-quick-edit) {
    width: min(720px, calc(100vw - 32px));
    max-width: 720px;
}
.admin-quick-edit-main {
    display: grid;
    grid-template-columns: minmax(150px, .65fr) minmax(220px, 1fr);
    gap: 14px;
}
.quick-edit-group-prices {
    margin: 4px 0 18px;
    padding: 16px;
    border: 1px solid var(--wb-border);
    border-radius: 10px;
    background: var(--wb-bg);
}
.quick-edit-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}
.quick-edit-section-head h3 { margin: 0 0 4px; font-size: .95rem; }
.quick-edit-section-head p {
    max-width: 430px;
    margin: 0;
    color: var(--wb-text-muted);
    font-size: .78rem;
    line-height: 1.45;
}
.quick-edit-group-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
}
.quick-edit-group-price > span {
    display: block;
    margin-bottom: 5px;
    color: var(--wb-text);
    font-size: .75rem;
    font-weight: 700;
}
.quick-edit-money-input { position: relative; }
.quick-edit-money-input > span {
    position: absolute;
    top: 50%;
    left: 11px;
    z-index: 1;
    color: var(--wb-text-muted);
    font-size: .8rem;
    transform: translateY(-50%);
}
.quick-edit-money-input .form-control { padding-left: 26px; font-variant-numeric: tabular-nums; }
@media (max-width: 620px) {
    .admin-quick-edit-main,
    .quick-edit-group-grid { grid-template-columns: 1fr; }
    .quick-edit-section-head { flex-direction: column; gap: 6px; }
}
.admin-order-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.modal-content:has(.admin-order-quick) {
    width: min(920px, calc(100vw - 32px));
    max-width: 920px;
    max-height: min(880px, calc(100dvh - 32px));
}
.admin-order-quick { color: var(--wb-text); }
.admin-order-quick-head,
.admin-order-manage-summary {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}
.admin-order-quick-head h3 {
    margin: 3px 0 5px;
    font-size: 1.05rem;
}
.admin-order-quick-head p { margin: 0; color: var(--wb-text-muted); }
.admin-order-quick-total {
    font-size: 1.25rem;
    font-weight: 800;
    white-space: nowrap;
}
.admin-order-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 20px 0;
    padding: 14px;
    border: 1px solid var(--wb-border);
    border-radius: 10px;
    background: var(--wb-bg);
}
.admin-order-facts > div {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}
.admin-order-facts > div > span,
.admin-order-quick h4,
.customer-application dt {
    color: var(--wb-text-muted);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.admin-order-facts strong,
.admin-order-facts small {
    overflow-wrap: anywhere;
}
.admin-order-quick h4 { margin: 20px 0 8px; }
.admin-order-quick-grid {
    display: grid;
    grid-template-columns: 1.25fr .75fr;
    gap: 24px;
}
.admin-order-quick-grid p { line-height: 1.55; }
.admin-order-quick-grid dl { margin: 0; }
.admin-order-quick-grid dl > div {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 5px 0;
}
.admin-order-quick-grid dt,
.admin-order-quick-grid dd { margin: 0; }
.admin-order-history {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.admin-order-history li {
    display: grid;
    grid-template-columns: minmax(100px, .4fr) minmax(150px, .6fr);
    gap: 4px 16px;
    padding-left: 12px;
    border-left: 2px solid var(--wb-border);
    font-size: .8rem;
}
.admin-order-history li span { color: var(--wb-text-muted); }
.admin-order-history li p { grid-column: 1 / -1; margin: 0; }
.admin-order-modal-actions {
    position: sticky;
    bottom: -1px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin: 24px -4px -4px;
    padding: 12px 4px 4px;
    background: var(--wb-surface);
    border-top: 1px solid var(--wb-border);
}
.admin-order-manage-form {
    display: grid;
    gap: 16px;
}
.admin-order-manage-form .form-group { margin: 0; }
.admin-order-manage-form .form-group > span {
    display: block;
    margin-bottom: 6px;
    font-size: .78rem;
    font-weight: 700;
}
.admin-order-manage-summary {
    padding: 12px 14px;
    border-radius: 8px;
    background: var(--wb-bg);
}

/* RMA workspace: line-level return and settlement controls */
.modal-content:has(.rma-workspace) {
    width: min(1040px, calc(100vw - 32px));
    max-width: 1040px;
    max-height: min(900px, calc(100dvh - 32px));
}
.rma-workspace { color: var(--wb-text, var(--text-main)); }
.rma-summary {
    display:flex; justify-content:space-between; align-items:flex-start; gap:20px;
    padding:3px 0 18px; border-bottom:1px solid var(--wb-border, var(--border));
}
.rma-eyebrow { margin:0 0 5px; color:var(--wb-text-muted, var(--text-muted)); font-size:.68rem; font-weight:700; letter-spacing:.08em; text-transform:uppercase; }
.rma-summary h3 { margin:0 0 5px; font-size:1.3rem; }
.rma-summary p { margin:0; color:var(--wb-text-muted, var(--text-muted)); }
.rma-summary-status { display:grid; gap:6px; justify-items:end; text-align:right; font-size:.8rem; }
.rma-summary-status strong { font-size:1.05rem; font-variant-numeric:tabular-nums; }
.rma-summary-status small { color:var(--wb-text-muted, var(--text-muted)); }
.rma-section { padding:18px 0; border-bottom:1px solid var(--wb-border, var(--border)); }
.rma-section h4 { margin:0; font-size:.92rem; }
.rma-section-head { margin-bottom:12px; }
.rma-section-head p, .rma-finance p { margin:4px 0 0; color:var(--wb-text-muted, var(--text-muted)); font-size:.8125rem; line-height:1.45; }
.rma-lines td { vertical-align:middle; }
.rma-lines td small { display:block; margin-top:3px; color:var(--wb-text-muted, var(--text-muted)); font-size:.75rem; }
.rma-lines .form-control { min-width:76px; max-width:116px; }
.rma-select { display:flex; align-items:center; gap:8px; }
.rma-of { display:block; margin-top:4px; color:var(--wb-text-muted, var(--text-muted)); font-size:.72rem; }
.rma-create-fields { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:14px; }
.rma-create-fields label, .rma-section > label { display:grid; gap:6px; font-size:.8rem; font-weight:700; }
.rma-create-fields label span { color:var(--wb-text-muted, var(--text-muted)); font-weight:400; }
.rma-finance { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; background:var(--wb-bg, var(--bg-body)); margin:18px -14px; padding:15px 14px; border:0; border-radius:9px; }
.rma-credit-note { display:grid; gap:.35rem; margin-top:.75rem; }
.rma-credit-preview strong { color:var(--wb-text, var(--text-main)); font-variant-numeric:tabular-nums; }
.rma-timeline { display:grid; gap:9px; padding:0; margin:12px 0 0; list-style:none; }
.rma-timeline li { display:grid; grid-template-columns:minmax(120px, .4fr) minmax(160px, .6fr); gap:4px 14px; padding-left:12px; border-left:2px solid var(--wb-border, var(--border)); font-size:.8rem; }
.rma-timeline li span, .rma-timeline li p { color:var(--wb-text-muted, var(--text-muted)); }
.rma-timeline li p { grid-column:1 / -1; margin:0; }
.rma-error { margin-top:14px; padding:10px 12px; border:1px solid var(--danger-border, #fecaca); border-radius:7px; background:var(--danger-bg, #fef2f2); color:var(--danger, #ef4444); font-size:.8125rem; }
.rma-status-summary { display:grid; grid-template-columns:repeat(auto-fit, minmax(112px, 1fr)); gap:9px; margin:0 0 18px; }
.rma-status-summary a { display:flex; justify-content:space-between; gap:8px; padding:11px 12px; border:1px solid var(--wb-border, var(--border)); border-radius:8px; background:var(--wb-surface, var(--bg-surface)); color:var(--wb-text-muted, var(--text-muted)); text-decoration:none; font-size:.75rem; }
.rma-status-summary a strong { color:var(--wb-text, var(--text-main)); font-size:1rem; }
.rma-status-summary a:hover, .rma-status-summary a.active { border-color:var(--wb-primary, var(--primary)); background:var(--wb-primary-light, var(--primary-light)); color:var(--wb-primary, var(--primary)); }
@media (max-width: 700px) {
    .admin-order-facts,
    .admin-order-quick-grid { grid-template-columns: 1fr; }
    .admin-order-quick-head { flex-direction: column; gap: 8px; }
    .admin-order-modal-actions .btn { flex: 1; }
    .rma-summary, .rma-finance { flex-direction:column; }
    .rma-summary-status { justify-items:start; text-align:left; }
    .rma-create-fields { grid-template-columns:1fr; }
    .rma-timeline li { grid-template-columns:1fr; }
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --transition: 0s;
    }
}

body {
    font-family: var(--font);
    background-color: var(--bg-body);
    color: var(--text-main);
    letter-spacing: -0.01em;
}

/* Header Overrides for Maximum Density */
.app-header .header-inner { min-height: 3.75rem; height: auto; gap: 1rem; }
.app-header .logo img { height: 28px; width: auto; }
.app-header .search-input-wrapper { padding: 0.125rem 0.375rem; border-radius: 4px; }
.app-header #search-input { padding: 0.375rem 0; font-size: 0.8125rem; }
.app-header .search-submit { padding: 0.375rem 0.75rem; font-size: 0.75rem; border-radius: 3px; }

/* --------------------------------------------------------------------------
   Home 2035 (Ultra-Compact)
   -------------------------------------------------------------------------- */
.ws-home-compact {
    padding-bottom: 2rem;
}

.ws-hero-compact {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.ws-title-compact {
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.ws-search-compact {
    flex: 1 1 300px;
    max-width: 500px;
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px 4px;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: border var(--transition), box-shadow var(--transition);
}
.ws-search-compact:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}
.ws-search-compact svg {
    color: var(--text-muted);
    margin: 0 6px;
    flex-shrink: 0;
}
.ws-search-input-compact {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    padding: 4px;
    font-size: 0.8125rem;
    font-weight: 600;
    outline: none;
}
.ws-search-btn-compact {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
}
.ws-search-btn-compact:hover {
    background: var(--primary-hover);
}

.ws-dashboard-compact {
    display: grid;
    gap: 12px;
    align-items: start;
}
@media (min-width: 800px) {
    .ws-dashboard-compact {
        grid-template-columns: minmax(0, 1fr) 280px;
    }
}

.ws-finder-panel-compact, .ws-cats-panel-compact {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    box-shadow: var(--shadow-sm);
}

.ws-cats-group h3 {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 6px 0;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 4px;
}

.ws-pill-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-body);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
    border: 1px solid transparent;
}
.cat-pill:hover {
    background: var(--primary-light);
    color: var(--primary-active);
    border-color: var(--primary);
}
.cat-pill-img, .cat-pill-icon {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}
.cat-pill:hover .cat-pill-icon {
    color: var(--primary);
}

.ws-featured-compact { margin-top: 1rem; }
.ws-featured-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 8px;
}
.ws-featured-header h2 { font-size: 1rem; margin: 0; font-weight: 700; }
.ws-featured-header a { font-size: 0.75rem; font-weight: 600; color: var(--primary); text-decoration: none; }
.ws-featured-header a:hover { text-decoration: underline; }


/* --------------------------------------------------------------------------
   FastFinder Compact (Used in Home & Modal)
   -------------------------------------------------------------------------- */
.fast-finder {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.finder-heading {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.finder-heading h2 {
    font-size: 1rem;
    margin: 0;
    color: var(--text-main);
    font-weight: 700;
}

.finder-eyebrow { display: none; }

.finder-caption {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.finder-brands {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 2px;
}

.finder-brands button {
    background: var(--bg-body);
    border: 1px solid transparent;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
}
.finder-brands button:hover { background: var(--border-light); }
.finder-brands button.active { background: var(--text-main); color: var(--text-inverse); }

.finder-search-label { display: none; }

.finder-model-search {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 8px;
    height: 32px;
}
.finder-model-search:focus-within {
    border-color: var(--primary);
    background: var(--bg-surface);
    box-shadow: 0 0 0 2px var(--primary-light);
}
.finder-model-search svg { width: 14px; height: 14px; color: var(--text-muted); }
.finder-model-search input {
    flex: 1; min-width: 0; border: none; background: transparent;
    font-size: 0.8125rem; font-weight: 600; outline: none; color: var(--text-main);
}
.finder-model-search kbd {
    font-size: 0.625rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted);
    background: var(--bg-surface); border: 1px solid var(--border); padding: 0 4px; border-radius: 3px;
}

.finder-list-tools {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 0; padding-bottom: 4px; border-bottom: 1px solid var(--border-light);
}
.finder-status { font-size: 0.6875rem; font-weight: 600; color: var(--text-muted); margin: 0; }
.finder-list-tools label { display: flex; align-items: center; gap: 4px; font-size: 0.6875rem; font-weight: 600; color: var(--text-muted); }
.finder-sort { border: 1px solid var(--border); background: var(--bg-body); padding: 0 4px; height: 20px; border-radius: 3px; font-weight: 600; font-size: 0.6875rem; color: var(--text-main); }

.finder-models {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 6px;
}

.finder-model {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    background: var(--bg-body);
    border: 1px solid transparent;
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-main);
    gap: 6px;
}
.finder-model:hover {
    background: var(--bg-surface);
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}
.finder-model span:first-child { min-width: 0; }
.finder-model strong {
    font-size: 0.75rem; font-weight: 700; display: block;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.finder-model small { display: none; } /* Kept visually quiet to save space */
.finder-model span:last-child {
    flex-shrink: 0; color: var(--text-muted); font-size: 0.875rem;
}
.finder-model:hover span:last-child { color: var(--primary); }

.finder-recent { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: 0.6875rem; font-weight: 600; color: var(--text-muted); }
.finder-recent[hidden] { display: none; }
.finder-recent a { background: var(--bg-body); padding: 2px 4px; border-radius: 3px; color: var(--text-main); text-decoration: none; }
.finder-recent a:hover { background: var(--border-light); }
.finder-recent button { background: transparent; border: none; color: var(--primary); font-weight: 600; cursor: pointer; padding: 0; margin-left: 4px; }

.finder-empty { padding: 1.5rem; text-align: center; background: var(--bg-body); border-radius: 6px; color: var(--text-muted); font-size: 0.75rem; font-weight: 600; }
.finder-empty a { display: inline-block; margin-top: 4px; color: var(--primary); text-decoration: none; }

.finder-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding-top: 6px; margin-top: 2px; font-size: 0.75rem; font-weight: 600;
}
.finder-footer button, .finder-footer a { color: var(--primary); background: transparent; border: none; cursor: pointer; text-decoration: none; }


/* --------------------------------------------------------------------------
   Catalog Main View Redesign (Hyper-Dense)
   -------------------------------------------------------------------------- */
.catalog-layout { display: block !important; margin-top: 0 !important; }

.catalog-breadcrumb {
    margin: 8px 0;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
}
.catalog-breadcrumb a { color: var(--text-muted); text-decoration: none; margin: 0 4px; }
.catalog-breadcrumb a:first-child { margin-left: 0; }
.catalog-breadcrumb a:hover { color: var(--primary); }

.catalog-heading {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0 0 8px 0;
    padding: 0;
    border: none;
}
.catalog-heading > div:first-child {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}
.catalog-eyebrow { display: none; }
.catalog-heading h1 {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
    color: var(--text-main);
}
.catalog-description {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

.model-command {
    width: auto;
    flex: 1 1 200px;
    max-width: 280px;
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
    display: flex;
    align-items: center;
    position: relative;
}
.model-command-label { display: none; }
.model-command-input {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
    height: 28px;
    transition: border var(--transition);
}
.model-command-input:focus-within { border-color: var(--primary); }
.model-command-input svg { width: 12px; height: 12px; color: var(--text-muted); margin-right: 6px; flex-shrink: 0; }
.model-command-input input {
    flex: 1; min-width: 0; border: none; background: transparent;
    font-size: 0.75rem; font-weight: 600; outline: none; color: var(--text-main);
}
.model-browse {
    height: 28px; padding: 0 6px; font-size: 0.6875rem; border-radius: 3px;
    border: 1px solid var(--border); background: var(--bg-body); cursor: pointer;
    white-space: nowrap; margin-left: 6px; color: var(--text-main); font-weight: 600;
}

.model-command-popover {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    background: var(--bg-surface); border: 1px solid var(--border); border-radius: 6px;
    box-shadow: var(--shadow-float); z-index: 100; max-height: 250px; overflow-y: auto;
}
.model-command-status {
    padding: 6px 8px; margin: 0; font-size: 0.6875rem; font-weight: 600;
    color: var(--text-muted); background: var(--bg-body); border-bottom: 1px solid var(--border-light);
}
#inline-model-results a {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 8px; border-bottom: 1px solid var(--border-light);
    color: var(--text-main); text-decoration: none; font-size: 0.75rem;
}
#inline-model-results a[aria-selected="true"], #inline-model-results a:hover {
    background: var(--primary-light); color: var(--primary-active);
}
#inline-model-results a strong { display: block; font-weight: 700; }
#inline-model-results a small { color: var(--text-muted); }

.quick-categories { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.quick-category {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--bg-surface); border: 1px solid var(--border-light);
    padding: 4px 8px; border-radius: 12px; font-size: 0.75rem; font-weight: 600;
    color: var(--text-main); text-decoration: none;
}
.quick-category:hover { background: var(--bg-body); border-color: var(--border); }
.quick-category.active, .quick-category[aria-current="page"] {
    background: var(--text-main); color: var(--text-inverse); border-color: var(--text-main);
}
.quick-category small {
    background: rgba(0,0,0,0.06); padding: 0 4px; border-radius: 8px; font-size: 0.625rem; font-variant-numeric: tabular-nums;
}
.quick-category.active small { background: rgba(255,255,255,0.2); color: #fff; }

.customer-payment-controls { min-width: 260px; }
.customer-payment-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 9px;
}
.customer-payment-options-form { max-width: 620px; }
.customer-payment-options-intro {
    margin: 0 0 18px;
    color: var(--wb-text-muted);
    line-height: 1.55;
}
.customer-payment-option-list {
    display: grid;
    gap: 10px;
}
.customer-payment-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 15px 16px;
    border: 1px solid var(--wb-border);
    border-radius: 10px;
    background: var(--wb-surface);
    cursor: pointer;
}
.customer-payment-option:hover { border-color: var(--wb-primary); }
.customer-payment-option-copy { flex: 1; min-width: 0; }
.customer-payment-option-copy strong { display: block; margin-bottom: 3px; }
.customer-payment-option-copy small {
    display: block;
    color: var(--wb-text-muted);
    line-height: 1.45;
}
.customer-payment-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.customer-payment-switch {
    position: relative;
    width: 42px;
    height: 24px;
    flex: 0 0 42px;
    border-radius: 999px;
    background: var(--wb-border);
    transition: background .18s ease;
}
.customer-payment-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .2);
    transition: transform .18s ease;
}
.customer-payment-option input:checked + .customer-payment-switch { background: var(--wb-primary); }
.customer-payment-option input:checked + .customer-payment-switch::after { transform: translateX(18px); }
.customer-payment-option input:focus-visible + .customer-payment-switch {
    outline: 3px solid color-mix(in srgb, var(--wb-primary) 25%, transparent);
    outline-offset: 2px;
}
.customer-payment-options-note {
    margin-top: 14px;
    padding: 11px 13px;
    border-radius: 8px;
    background: var(--wb-bg);
    color: var(--wb-text-muted);
    font-size: .8125rem;
    line-height: 1.45;
}

/* Customer workspace: a calm, task-focused record view rather than an application dump. */
.modal-content:has(.customer-workspace),
.modal-content:has(.customer-workspace-state),
.modal-content:has(.customer-address-form) {
    width: min(1040px, calc(100vw - 32px));
    max-width: 1040px;
    max-height: min(900px, calc(100dvh - 32px));
    background: var(--wb-surface, var(--bg-surface));
}
.customer-workspace { color: var(--wb-text, var(--text-main)); }
.customer-workspace-summary {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 4px 0 20px;
    border-bottom: 1px solid var(--wb-border, var(--border));
}
.customer-workspace-eyebrow {
    margin: 0 0 5px;
    color: var(--wb-text-muted, var(--text-muted));
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.customer-workspace-summary h3 { margin: 0 0 6px; font-size: 1.35rem; line-height: 1.2; }
.customer-workspace-summary p { margin: 0; color: var(--wb-text-muted, var(--text-muted)); }
.customer-workspace-status { display: grid; justify-items: end; gap: 8px; color: var(--wb-text-muted, var(--text-muted)); font-size: .8125rem; text-align: right; }
.customer-workspace-section { padding: 20px 0; border-bottom: 1px solid var(--wb-border, var(--border)); }
.customer-workspace-section:last-child { border-bottom: 0; padding-bottom: 0; }
.customer-workspace-section h4 { margin: 0; font-size: .9rem; }
.customer-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.customer-section-heading p { margin: 4px 0 0; color: var(--wb-text-muted, var(--text-muted)); font-size: .8125rem; }
.customer-workspace-facts {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 12px 0 0;
}
.customer-workspace-facts > div { min-width: 0; padding: 11px 12px; border-radius: 8px; background: var(--wb-bg, var(--bg-body)); }
.customer-workspace-facts dt { margin-bottom: 4px; color: var(--wb-text-muted, var(--text-muted)); font-size: .67rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.customer-workspace-facts dd { margin: 0; overflow-wrap: anywhere; font-size: .8125rem; }
.customer-address-card, .customer-shipping-card {
    padding: 14px 15px;
    border: 1px solid var(--wb-border, var(--border));
    border-radius: 9px;
    background: var(--wb-surface, var(--bg-surface));
    color: var(--wb-text, var(--text-main));
    font-size: .875rem;
    line-height: 1.55;
}
.customer-shipping-list { display: grid; gap: 9px; }
.customer-shipping-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.customer-shipping-title { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; font-weight: 700; }
.customer-shipping-card p { margin: 7px 0 0; color: var(--wb-text-muted, var(--text-muted)); }
.customer-shipping-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.customer-recent-orders { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-top: 12px; }
.customer-recent-orders > div { display: grid; gap: 3px; padding: 10px 12px; border-radius: 8px; background: var(--wb-bg, var(--bg-body)); font-size: .8rem; }
.customer-recent-orders span { color: var(--wb-text-muted, var(--text-muted)); }
.customer-workspace-state { padding: 32px 20px; color: var(--wb-text-muted, var(--text-muted)); text-align: center; }
.customer-workspace-error { color: var(--danger, #ef4444); }
.customer-address-form { max-width: 760px; }
.customer-form-help { margin: 0 0 16px; color: var(--wb-text-muted, var(--text-muted)); font-size: .8125rem; }
.customer-address-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.customer-address-grid label { display: grid; gap: 5px; color: var(--wb-text, var(--text-main)); font-size: .8125rem; font-weight: 650; }
.customer-address-grid label > span { color: var(--danger, #ef4444); }
.customer-address-grid label > .caf-title { color: inherit; display: flex; align-items: baseline; gap: 4px; }
.customer-address-grid .caf-req { color: var(--danger, #ef4444); font-weight: 700; }
.customer-address-grid small { color: var(--wb-text-muted, var(--text-muted)); font-weight: 400; }
.customer-address-wide { grid-column: 1 / -1; }
.customer-default-choice { display: flex; gap: 8px; align-items: center; margin-top: 16px; font-size: .875rem; }
.page-header-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.staff-customer-create-form { max-width: 760px; }
.staff-customer-create-section {
    min-width: 0;
    margin: 0 0 18px;
    padding: 0 0 18px;
    border: 0;
    border-bottom: 1px solid var(--wb-border, var(--border));
}
.staff-customer-create-section:last-of-type { margin-bottom: 12px; }
.staff-customer-create-section legend {
    width: 100%;
    margin-bottom: 12px;
    color: var(--wb-text, var(--text-main));
    font-size: .9375rem;
    font-weight: 750;
}
.staff-customer-billing-choice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
    padding: 12px 13px;
    border: 1px solid var(--wb-border, var(--border));
    border-radius: 9px;
    background: var(--wb-bg, var(--bg-body));
    color: var(--wb-text, var(--text-main));
    cursor: pointer;
}
.staff-customer-billing-choice input { margin-top: 3px; }
.staff-customer-billing-choice span { display: grid; gap: 3px; }
.staff-customer-billing-choice strong { font-size: .875rem; }
.staff-customer-billing-choice small { color: var(--wb-text-muted, var(--text-muted)); font-size: .775rem; font-weight: 400; line-height: 1.4; }
.staff-customer-billing-fields { padding-top: 2px; }
.staff-customer-terms {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin-top: 14px;
    color: var(--wb-text, var(--text-main));
    font-size: .8125rem;
    line-height: 1.45;
}
.staff-customer-terms input { margin-top: 2px; }
.staff-customer-create-error {
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--danger, #ef4444) 12%, transparent);
    color: var(--danger, #b91c1c);
    font-size: .875rem;
}
@media (max-width: 620px) {
    .modal-content:has(.customer-workspace), .modal-content:has(.customer-workspace-state), .modal-content:has(.customer-address-form) { width: calc(100vw - 16px); }
    .customer-workspace-summary, .customer-section-heading, .customer-shipping-card { flex-direction: column; }
    .customer-workspace-status, .customer-shipping-actions { justify-items: start; justify-content: flex-start; text-align: left; }
    .customer-workspace-facts, .customer-address-grid { grid-template-columns: 1fr; }
    .customer-address-wide { grid-column: auto; }
}

.part-type-picker {
    display: flex; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px;
    background: transparent; border: none; border-bottom: 1px solid var(--border-light);
    padding: 0 0 8px 0; margin-bottom: 8px; border-radius: 0; box-shadow: none;
}
.part-type-intro { width: auto; flex-shrink: 0; }
.part-type-intro span { display: block; font-size: 0.6875rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.part-type-intro small { display: none; } /* Hide verbose descriptions */
.part-type-options { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; align-items: center; }
.part-type-option {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px;
    padding: 2px 8px; min-width: 0; flex: 0 0 auto; color: var(--text-main); text-decoration: none;
}
.part-type-option:hover { background: var(--bg-alt); border-color: var(--primary); }
.part-type-option.active, .part-type-option[aria-current="page"] {
    background: var(--primary-light); border-color: var(--primary); color: var(--primary-active);
}
.part-type-option.is-empty { opacity: 0.5; }
.part-type-option span { display: flex; align-items: center; gap: 4px; }
.part-type-option strong { font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.part-type-option b {
    font-size: 0.625rem; font-weight: 700; color: var(--text-muted);
    background: var(--bg-alt); padding: 0 4px; border-radius: 8px; font-variant-numeric: tabular-nums;
}
.part-type-option.active b { background: var(--primary); color: #fff; }
.part-type-option small { display: none; } /* Hide inner verbose desc */

.catalog-refine-row {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
    padding: 0 0 8px 0; margin-bottom: 8px;
    background: transparent; border: none; border-bottom: 1px solid var(--border-light);
    border-radius: 0; box-shadow: none;
}
.catalog-tool-field { display: flex; align-items: center; gap: 4px; font-size: 0.6875rem; font-weight: 600; color: var(--text-muted); }
.catalog-tool-field select {
    padding: 0 16px 0 6px; border: 1px solid var(--border); background-color: var(--bg-surface);
    font-weight: 600; font-size: 0.75rem; height: 26px; border-radius: 3px; color: var(--text-main);
}
.stock-shortcut {
    display: inline-flex; align-items: center; padding: 0 8px; height: 26px;
    background: var(--bg-surface); border: 1px solid var(--border); border-radius: 3px;
    font-size: 0.75rem; font-weight: 600; color: var(--text-main); cursor: pointer;
}
.stock-shortcut[aria-pressed="true"], .stock-shortcut.active {
    background: var(--primary-light); color: var(--primary-active); border-color: var(--primary);
}
#open-catalog-filters { height: 26px; padding: 0 8px; font-size: 0.75rem; border-radius: 3px; }

.catalog-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.result-range { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }
.catalog-sort { display: flex; align-items: center; gap: 4px; font-size: 0.6875rem; font-weight: 600; color: var(--text-muted); }
.catalog-sort select { height: 26px; padding: 0 16px 0 6px; font-size: 0.75rem; border: 1px solid var(--border); border-radius: 3px; }
.view-toggle { display: flex; background: var(--bg-surface); border-radius: 3px; padding: 2px; border: 1px solid var(--border); }
.view-toggle button { background: transparent; border: none; padding: 2px 6px; border-radius: 2px; font-size: 0.75rem; cursor: pointer; color: var(--text-muted); }
.view-toggle button.active { background: var(--bg-body); color: var(--primary); font-weight: 800; }

.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 8px; }
.filter-chip {
    display: inline-flex; align-items: center; gap: 4px; background: var(--bg-surface);
    border: 1px solid var(--border); padding: 2px 6px; border-radius: 4px;
    font-size: 0.6875rem; font-weight: 600; color: var(--text-main); text-decoration: none;
}
.filter-chip span { font-size: 0.875rem; line-height: 1; color: var(--text-muted); }
.filter-chip:hover { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.filter-chip:hover span { color: var(--danger); }
.clear-filters { font-size: 0.6875rem; font-weight: 700; color: var(--text-muted); margin-left: 4px; text-decoration: underline; }

.catalog-price-notice {
    background: var(--bg-surface); border: 1px solid var(--border); border-radius: 4px;
    padding: 6px 12px; margin-bottom: 12px; display: flex; justify-content: space-between;
    align-items: center; font-size: 0.75rem; font-weight: 700;
}
.catalog-price-notice a { color: var(--primary); text-decoration: none; }

/* --------------------------------------------------------------------------
   Product List View Optimization (Ultra-Dense)
   -------------------------------------------------------------------------- */
.view-list { display: flex; flex-direction: column; gap: 4px; }
.view-list .part-card {
    display: flex; flex-direction: column; background: var(--bg-surface);
    border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; gap: 8px;
}
@media (min-width: 640px) {
    .view-list .part-card { flex-direction: row; align-items: center; }
}
.view-list .part-card:hover { border-color: var(--primary); }
.view-list .part-img-link {
    width: 48px; height: 48px; flex-shrink: 0; border: 1px solid var(--border-light);
    border-radius: 4px; padding: 2px; background: var(--bg-body);
    display: flex; align-items: center; justify-content: center;
}
.view-list .part-img-link img { max-width: 100%; max-height: 100%; object-fit: contain; }
.view-list .part-main { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.view-list .part-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.view-list .part-sku { font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 700; color: var(--text-muted); }
.view-list .part-quality {
    font-size: 0.625rem; font-weight: 800; text-transform: uppercase; background: var(--bg-body);
    padding: 1px 4px; border-radius: 2px; color: var(--text-main); border: 1px solid var(--border);
}
.part-type-badge {
    font-size: 0.625rem; font-weight: 600; background: var(--bg-alt); color: var(--text-muted);
    padding: 1px 4px; border-radius: 2px; border: 1px solid var(--border-light); display: inline-block; vertical-align: middle; margin-left: 4px;
}
.view-list .part-name { font-size: 0.9375rem; font-weight: 700; margin: 0 0 4px 0; white-space: normal; overflow-wrap: anywhere; line-height:1.35; }
.view-list .part-name a { color: var(--text-main); text-decoration: none; }
.view-list .part-name a:hover { color: var(--primary); }
.view-list .part-stock { font-size: 0.6875rem; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.view-list .part-buy-area {
    display: flex; flex-direction: row; align-items: center; justify-content: flex-end; gap: 12px; flex-shrink: 0;
}
@media (max-width: 639px) {
    .view-list .part-buy-area { justify-content: space-between; margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--border-light); }
}
.view-list .part-price { font-size: 1rem; font-weight: 800; color: var(--text-main); margin: 0; font-variant-numeric: tabular-nums; }
.view-list .part-action { display: flex; align-items: stretch; }
.part-qty { width: 44px; height: 28px; text-align: center; border-radius: 3px 0 0 3px; font-weight: 700; font-size: 0.8125rem; border: 1px solid var(--border); padding: 0; }
.part-add-btn { height: 28px; padding: 0 8px; border-radius: 0 3px 3px 0; margin-left: -1px; border: 1px solid var(--primary); font-size: 0.75rem; display: flex; align-items: center; }

/* Grid View Optimization */
.view-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%,220px), 1fr)); gap: 10px; }
.view-grid .part-card { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-surface); padding: 0; }
.view-grid .part-img-link { width: 100%; height: 112px; padding: 8px; background: var(--bg-body); border:0; border-bottom: 1px solid var(--border-light); border-radius: 6px 6px 0 0; }
.view-grid .part-img-link img { max-width: 100%; max-height: 100%; object-fit: contain; }
.view-grid .part-main { padding:12px; flex:1 0 auto; min-height:0; display:flex; flex-direction:column; }
.view-grid .part-meta { margin-bottom:6px; flex-wrap:wrap; gap:4px; }
.view-grid .part-name { white-space:normal; display:block; -webkit-line-clamp:unset; height:auto; overflow:visible; overflow-wrap:anywhere; font-size:14px; line-height:1.4; margin-bottom:6px; }
.view-grid .part-stock { margin-top:auto; padding-top:6px; }
.view-grid .part-buy-area { padding:10px 12px; gap:8px; background:var(--bg-surface); border-top:1px solid var(--border-light); display:flex; justify-content:space-between; align-items:center; border-radius:0 0 6px 6px; }
.view-grid .part-price { white-space:nowrap; font-size:16px; }
.view-grid .part-action { width:auto; flex:0 0 auto; }

.status-dot { width: 6px; height: 6px; border-radius: 50%; }
.stock-ok { color: var(--success); } .stock-ok .status-dot { background: var(--success); }
.stock-low { color: #956108; } .stock-low .status-dot { background: var(--warning); }
.stock-out { color: var(--danger); } .stock-out .status-dot { background: var(--danger); }

/* --------------------------------------------------------------------------
   Modestly Enlarged Image Preview (Modals)
   -------------------------------------------------------------------------- */
dialog.photo-preview-dialog {
    margin: auto; padding: 0; border: none; border-radius: 8px; background: var(--bg-surface);
    box-shadow: var(--shadow-float); width: 90vw; max-width: 600px; max-height: 85vh; overflow: hidden;
}
dialog.photo-preview-dialog::backdrop { background: rgba(17, 24, 39, 0.7); backdrop-filter: blur(2px); }
.photo-preview-shell { display: flex; flex-direction: column; height: 100%; max-height: 85vh; }
.photo-preview-header {
    display: flex; justify-content: space-between; align-items: center; padding: 8px 12px;
    border-bottom: 1px solid var(--border-light); background: var(--bg-surface); color: var(--text-main); flex-shrink: 0;
}
.photo-preview-heading { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex: 1; }
.photo-preview-title { margin: 0; font-size: 0.875rem; font-weight: 700; letter-spacing: -0.01em; }
.photo-preview-counter { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }
.photo-preview-close { background: transparent; border: none; font-size: 1.25rem; cursor: pointer; color: var(--text-muted); border-radius: 3px; padding: 0 4px; line-height: 1; }
.photo-preview-close:hover { color: var(--text-main); background: var(--bg-body); }
.photo-preview-tools { display:flex; align-items:center; justify-content:center; gap:4px; flex-shrink:0; }
.photo-preview-tools button { min-width:32px; height:32px; padding:0 8px; border:1px solid var(--border); border-radius:4px; background:var(--bg-surface); color:var(--text-main); cursor:pointer; font-weight:700; }
.photo-preview-tools button:disabled { opacity:0.4; cursor:not-allowed; }
.photo-preview-zoom-level { width:54px; text-align:center; font-size:0.75rem; font-variant-numeric:tabular-nums; color:var(--text-muted); }
.photo-preview-content {
    position: relative; padding: 1rem; background: var(--bg-body); display: flex; align-items: center; justify-content: center; flex: 1; min-height: 250px; overflow: hidden;
}
.photo-preview-figure { margin: 0; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; overflow:auto; overscroll-behavior:contain; touch-action:pan-x pan-y; scrollbar-gutter:stable; }
.photo-preview-figure.is-zoomed { display:block; cursor:grab; }
.photo-preview-figure.is-dragging { cursor:grabbing; user-select:none; }
.photo-preview-image { max-width: 100%; max-height: 100%; object-fit: contain; }
.photo-preview-nav {
    position: absolute; top: 50%; transform: translateY(-50%); background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: 50%; width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; cursor: pointer; color: var(--text-main); box-shadow: var(--shadow-sm); z-index: 10;
}
.photo-preview-nav:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.photo-preview-nav:disabled { opacity: 0.3; cursor: not-allowed; }
.photo-preview-nav.prev { left: 8px; } .photo-preview-nav.next { right: 8px; }
.image-upload-result { display:flex; justify-content:space-between; gap:12px; padding:6px 0; border-bottom:1px solid var(--wb-border-light); font-size:0.8125rem; overflow-wrap:anywhere; }
.image-upload-result span { min-width:0; }
.image-upload-result strong { flex-shrink:0; }
.image-upload-result.success strong { color:var(--success); }
.image-upload-result.error strong { color:var(--danger); max-width:55%; text-align:right; }
button.part-img-link.part-photo-preview { cursor: zoom-in; }
button.part-img-link.part-photo-preview:hover { border-color: var(--primary); }
div.part-img-link.part-no-photo { opacity: 0.7; }

/* Dialog overriding for model-switch */
.finder-dialog { padding: 0; border: none; border-radius: 8px; background: var(--bg-surface); box-shadow: var(--shadow-float); width: 95vw; max-width: 700px; max-height: 90vh; margin: auto; overflow: hidden; }
.finder-dialog::backdrop { background: rgba(17, 24, 39, 0.7); backdrop-filter: blur(2px); }
.finder-dialog [data-finder-body] { padding: 1.5rem; max-height: 90vh; overflow-y: auto; }
.finder-dialog [data-close-finder] {
    position: absolute; top: 8px; right: 8px; width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center;
    background: var(--bg-body); border: none; border-radius: 50%; font-size: 1.25rem; cursor: pointer; color: var(--text-muted); z-index: 20;
}
.finder-dialog [data-close-finder]:hover { background: var(--border); color: var(--text-main); }
.finder-dialog .fast-finder { gap: 12px; }

/* Filter Dialog Mobile */
.filter-dialog { padding: 0; border: none; border-radius: 8px; width: 100%; max-width: 360px; margin: auto; box-shadow: var(--shadow-float); }
.filter-dialog::backdrop { background: rgba(17, 24, 39, 0.7); backdrop-filter: blur(2px); }
.filter-dialog-heading { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border-light); }
.filter-dialog-heading h2 { font-size: 1rem; font-weight: 700; margin: 0; }
.discovery-filters { padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.filter-dialog-actions { display: flex; gap: 8px; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--border-light); }
.filter-dialog-actions button { flex: 1; height: 32px; font-size: 0.8125rem; }

/* Compact dimensions without clipping names, touch targets or the mobile header. */
.app-header .logo img { height:34px; width:auto; }
.catalog-heading h1 { font-size:22px; line-height:1.25; }
.model-command { max-width:350px; min-width:0; }
.model-command-input { min-width:0; height:36px; }
.model-command-input input { width:0; font-size:13px; }
.model-browse { min-height:32px; font-size:12px; }
.model-command-popover { max-height:330px; }
#inline-model-results a { min-height:42px; font-size:13px; }
.quick-category, .part-type-option { min-height:28px; font-size:12px; }
.catalog-refine-row select, .catalog-sort select, .stock-shortcut, #open-catalog-filters { min-height:32px; font-size:12px; }
.view-list { gap:0; border-radius:8px; border:1px solid var(--border); overflow:hidden; background:var(--bg-surface); }
.view-list .part-card { display:grid; grid-template-columns:56px minmax(0,1fr) auto; align-items:center; gap:14px; padding:12px 14px; border:0; border-bottom:1px solid var(--border-light); border-radius:0; }
.view-list .part-card:last-child { border-bottom:0; }
.view-list .part-img-link { width:56px; height:56px; }
.view-list .part-main { padding:0; }
.view-list .part-meta { flex-wrap:wrap; row-gap:4px; }
.view-list .part-buy-area { min-width:160px; width:auto; background:transparent; border:0; padding:0; gap:16px; }
.view-list .part-price { font-size:18px; }
.view-list .part-stock { font-size:12px; }
.part-type-badge { font-size:11px; }
.part-qty, .part-add-btn { height:36px; }
.part-add-btn { min-width:38px; }
.photo-preview-header { position:relative; inset:auto; }
.photo-preview-heading { min-width:0; }
.photo-preview-title { overflow-wrap:anywhere; }
.photo-preview-close { width:36px; height:36px; flex-shrink:0; color:var(--text-main); }
.photo-preview-content { height:auto; min-height:0; max-height:min(70dvh,480px); }
.photo-preview-image { width:auto; height:auto; max-height:min(62dvh,420px); }
.photo-preview-nav[hidden] { display:none; }
@media(max-width:767px) {
    .app-header .header-inner { min-height:0; height:auto; padding:10px 16px; gap:8px; }
    .app-header .logo { flex:0 0 auto; }
    .app-header .logo img { width:130px; height:auto; }
    .app-header .user-nav { flex:1; min-width:0; justify-content:flex-end; gap:12px; }
    .app-header .user-nav .btn { font-size:12px; padding:8px; }
    .app-header .nav-text { position:absolute; width:1px; height:1px; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
    .app-header .search-bar { flex:0 0 100%; order:3; width:100%; min-width:0; margin-top:2px; }
    .catalog-heading { gap:10px; }
    .catalog-heading h1 { font-size:20px; }
    .model-command { width:100%; max-width:none; flex-basis:auto; }
    .model-command-input { height:40px; }
    .model-command-input input { font-size:14px; }
    .model-browse { height:36px; }
    .quick-categories { flex-wrap:nowrap; overflow-x:auto; padding-bottom:6px; gap:6px; scrollbar-width:thin; }
    .quick-category { flex:0 0 auto; min-height:36px; }
    .part-type-picker { display:block; min-width:0; padding-bottom:8px; }
    .part-type-intro { margin-bottom:5px; }
    .part-type-options { flex-wrap:nowrap; overflow-x:auto; padding-bottom:6px; gap:6px; scrollbar-width:thin; }
    .part-type-option { min-height:36px; white-space:nowrap; }
    .catalog-refine-row { gap:8px; }
    .catalog-refine-row select, .catalog-sort select, .stock-shortcut, #open-catalog-filters { min-height:36px; font-size:12px; }
    .catalog-toolbar { gap:8px; }
    .active-filters { gap:4px; margin:8px 0; }
    .view-list .part-card { grid-template-columns:48px minmax(0,1fr); align-items:start; gap:10px; padding:12px; }
    .view-list .part-img-link { width:48px; height:48px; }
    .view-list .part-main { padding:0; }
    .view-list .part-buy-area { grid-column:1 / -1; width:100%; min-width:0; justify-content:space-between; margin-top:0; padding-top:8px; border-top:1px solid var(--border-light); }
    .view-list .part-meta { gap:4px; }
    .view-list .part-name { font-size:14px; }
    .part-qty, .part-add-btn { height:40px; }
    .part-add-btn { min-width:44px; }
    .photo-preview-close { width:40px; height:40px; }
    dialog.photo-preview-dialog { width:100vw; max-width:none; height:100dvh; max-height:none; border-radius:0; }
    .photo-preview-shell { max-height:100dvh; }
    .photo-preview-header { flex-wrap:wrap; padding:6px 8px; }
    .photo-preview-heading { order:1; flex:1 1 calc(100% - 48px); }
    .photo-preview-close { order:2; }
    .photo-preview-tools { order:3; width:100%; }
    .photo-preview-tools button { min-width:40px; height:40px; }
    .photo-preview-content { padding:8px; max-height:none; }
    .photo-preview-nav.prev { left:4px; } .photo-preview-nav.next { right:4px; }
    .filter-dialog-actions button { height:40px; }
}

/* Per-customer payment choice: segmented Default | On | Off (24 Nov 2026). */
.customer-payment-choice { display: inline-flex; flex: 0 0 auto; border: 1px solid var(--wb-border); border-radius: 8px; overflow: hidden; background: var(--wb-surface, #fff); }
.customer-payment-choice label { position: relative; margin: 0; cursor: pointer; }
.customer-payment-choice label + label { border-left: 1px solid var(--wb-border); }
.customer-payment-choice label > span { display: block; padding: 7px 14px; font-size: .8125rem; font-weight: 600; color: var(--wb-text-muted); transition: background .15s, color .15s; user-select: none; }
.customer-payment-choice label:hover > span { background: color-mix(in srgb, var(--wb-primary) 8%, transparent); color: var(--wb-text); }
.customer-payment-choice input:checked + span { background: var(--wb-primary); color: #fff; }
.customer-payment-choice input[value="off"]:checked + span { background: var(--danger, #dc2626); }
.customer-payment-choice input[value="default"]:checked + span { background: var(--wb-text-muted, #64748b); }
.customer-payment-choice input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--wb-primary) 30%, transparent); outline-offset: -3px; }
.customer-payment-option { align-items: center; gap: 16px; }
@media (max-width: 560px) { .customer-payment-option { flex-wrap: wrap; } }
