/* LSC 2.24.18: shared visual system. Load before order-clean.css. */
:root {
  color-scheme: light;
  --lsc-red: #410101;
  --lsc-gray: #323232;
  --ui-accent: #410101;
  --ui-accent-fill: #410101;
  --ui-accent-soft: #f4e9e9;
  --ui-surface: #ffffff;
  --ui-surface-soft: #f7f7f7;
  --ui-border: #d8d8d8;
  --ui-text: #323232;
  --ui-muted: #686868;
  --ui-success: #236a47;
  --ui-success-fill: #236a47;
  --ui-success-soft: #e7f3eb;
  --ui-focus: #8c3535;
  --ui-canvas: #f1f1f1;
  --ui-shadow: 0 4px 18px #32323208, 0 1px 3px #32323205;
  --ui-popover-shadow: 0 16px 44px #32323226;
  --red: var(--ui-accent-fill);
  --red-dark: #630909;
  --ink: var(--ui-text);
  --muted: var(--ui-muted);
  --line: var(--ui-border);
  --paper: var(--ui-canvas);
  --white: var(--ui-surface);
  --green: var(--ui-success);
  --surface-soft: var(--ui-surface-soft);
  --shadow: var(--ui-shadow);
  --accent: var(--ui-accent);
  --text-muted: var(--ui-muted);
  font-family: "Segoe UI", system-ui, sans-serif;
}
:root[data-theme="DARK"] {
  color-scheme: dark;
  --ui-accent: #efb2b2;
  --ui-accent-fill: #410101;
  --ui-accent-soft: #3c2929;
  --ui-surface: #323232;
  --ui-surface-soft: #393939;
  --ui-border: #595959;
  --ui-text: #f3f3f3;
  --ui-muted: #bcbcbc;
  --ui-success: #9ed9b7;
  --ui-success-fill: #286b49;
  --ui-success-soft: #233b2e;
  --ui-focus: #efb2b2;
  --ui-canvas: #242424;
  --ui-shadow: 0 5px 20px #0002, 0 1px 3px #0002;
  --ui-popover-shadow: 0 18px 48px #0007;
  --red-dark: #681010;
  --ink: var(--ui-text);
  --muted: var(--ui-muted);
  --line: var(--ui-border);
  --paper: var(--ui-canvas);
  --white: var(--ui-surface);
  --green: var(--ui-success);
  --shadow: var(--ui-shadow);
}
:root, :root[data-theme="DARK"] {
  --surface-card: var(--ui-surface);
  --surface-soft: var(--ui-surface-soft);
  --surface-raised: var(--ui-surface-soft);
  --surface-accent: var(--ui-accent-soft);
  --text-strong: var(--ui-text);
  --text-soft: var(--ui-muted);
  --border-soft: var(--ui-border);
  --stat-revenue: var(--ui-accent);
  --stat-margin: var(--ui-success);
  --stat-track: var(--ui-border);
  --stat-orders: var(--ui-muted);
  --stat-cost: var(--ui-muted);
}
/* Typography and rhythm: existing view and collapse states remain authoritative. */
:root:root body, :root:root .workspace { background: var(--ui-canvas); color: var(--ui-text); }
body { line-height: 1.5; -webkit-font-smoothing: antialiased; }
::selection { color: var(--ui-text); background: var(--ui-accent-soft); }
:root .content { padding: clamp(1.2rem, 2.5vw, 2.5rem); }
:root .section-head { gap: 1.25rem; margin-bottom: 1.25rem; }
:root .section-head h1 { font-size: clamp(1.75rem, 2.5vw, 2.55rem); letter-spacing: -.04em; line-height: 1.15; }
:root .section-head p:last-child { line-height: 1.6; color: var(--ui-muted); }
:root .eyebrow { color: var(--ui-accent); font-size: .69rem; letter-spacing: .12em; }
:root :is(.hint, .empty-hint, .privacy-note) { color: var(--ui-muted); }
:root:root :is(.copy-phone, .location-link, .copy-value, .copy-invoice) { color: var(--ui-accent); }
:root .form-error { color: #a62525; line-height: 1.5; }
:root[data-theme="DARK"] .form-error { color: #ffadad; }
/* Navigation keeps its original desktop/mobile widths and open behavior. */
:root .sidebar {
  background: linear-gradient(165deg, #323232, #292929 55%, #323232);
  color: #f5f5f5;
  border-right: 1px solid #ffffff12;
  padding-top: 1.2rem;
}
.sidebar .sidebar-brand { color: #fff; letter-spacing: -.02em; border-bottom: 1px solid #ffffff14; margin-bottom: .65rem; }
.sidebar .sidebar-brand img { object-fit: contain; }
.sidebar .navigation { gap: .3rem; padding-right: .15rem; scrollbar-width: thin; scrollbar-color: #686868 transparent; }
.sidebar .navigation button { min-height: 2.7rem; border-radius: 9px; color: #dddddd; font-size: .86rem; transition: background-color .16s ease, color .16s ease; }
.sidebar .navigation button:hover { background: #ffffff0f; color: #fff; }
.sidebar .navigation button.active { color: #fff; background: #410101; box-shadow: inset 3px 0 #cf8989; }
.sidebar .nav-label { color: #b9b9b9; margin-top: 1.1rem; font-size: .64rem; letter-spacing: .1em; }
.sidebar .nav-icon { filter: saturate(.8); }
.sidebar .sidebar-collapse { background: #410101; border-color: #896666; }
.sidebar .theme-toggle { background: #ffffff06; border-color: #ffffff1b; color: #e8e8e8; }
.sidebar .theme-toggle:hover { background: #ffffff10; }
.sidebar .nav-unread { color: #fff; background: #681010; }
/* Topbar and account menu. */
:root:root .topbar { background: var(--ui-surface); border-color: var(--ui-border); box-shadow: 0 2px 10px #32323203; min-height: 82px; }
:root .topbar h2 { color: var(--ui-text); font-size: 1.2rem; letter-spacing: -.025em; }
:root .topbar-actions { gap: .55rem; flex-wrap: wrap; justify-content: flex-end; }
:root:root .account-trigger { color: var(--ui-text); border-radius: 10px; }
:root:root .account-trigger small { color: var(--ui-muted); }
:root:root .account-trigger:hover, :root:root .account-menu:focus-within .account-trigger { background: var(--ui-accent-soft); }
:root:root .account-popover { border: 1px solid var(--ui-border); border-radius: 14px; background: var(--ui-surface); color: var(--ui-text); padding: .4rem; box-shadow: var(--ui-popover-shadow); }
:root:root .account-popover button { border-radius: 9px; padding: .7rem .8rem; color: var(--ui-text); background: transparent; }
:root:root .account-popover button:hover, :root:root .account-popover button:focus-visible { color: var(--ui-accent); background: var(--ui-accent-soft); }
:root #logoutButton { border-top: 1px solid var(--ui-border); margin-top: .25rem; }
:root:root .status-picker { background: var(--ui-surface-soft); border-color: var(--ui-border); }
:root:root .status-picker select { background: transparent; color: var(--ui-text); }
/* Surfaces share a restrained edge, without replacing module layouts. */
:root:root :is(.table-card, .module-card, .dashboard-panel, .panel-form, .accounting-summary article, .statistics-time-kpis article) {
  background: var(--ui-surface); color: var(--ui-text);
  border-color: var(--ui-border); border-radius: 16px; box-shadow: var(--ui-shadow);
}
:root:root .dashboard-panel h2 { color: var(--ui-text); font-size: 1.08rem; letter-spacing: -.02em; }
:root:root .dashboard-orders > article { background: var(--ui-surface-soft); color: var(--ui-text); border-color: var(--ui-border); border-radius: 11px; box-shadow: none; }
:root:root .employee-status-grid article { border-color: var(--ui-border); }
:root:root :is(.employee-status-grid, .dashboard-orders) strong { color: var(--ui-text); }
:root:root :is(.employee-status-grid, .dashboard-orders) span { color: var(--ui-muted); }
:root:root .dashboard-orders .dashboard-order-open { color: var(--ui-text); background: transparent; }
:root:root .module-card-icon { color: var(--ui-accent); background: var(--ui-accent-soft); }
:root:root .module-card button { color: var(--ui-accent); }
:root:root .accounting-summary span { color: var(--ui-muted); }
:root:root .accounting-summary strong { color: var(--ui-text); }
:root:root .accounting-summary .accounting-total { background: var(--ui-accent-soft); border-color: color-mix(in srgb, var(--ui-accent) 40%, var(--ui-border)); }
/* Tables: do not change established per-module column widths. */
:root:root .table-card { border-color: var(--ui-border); }
:root:root :is(th, .table-card thead th) { color: var(--ui-muted); background: var(--ui-surface-soft); border-color: var(--ui-border); letter-spacing: .065em; font-size: .69rem; }
:root:root td { border-bottom-color: var(--ui-border); color: var(--ui-text); line-height: 1.45; }
.table-card td { font-size: .86rem; padding-top: .9rem; padding-bottom: .9rem; }
:root:root .clickable-row:hover td { background: var(--ui-accent-soft); }
:root:root .permission-table td:first-child { background: var(--ui-surface); }
:root:root .permission-table thead th:first-child { background: var(--ui-surface-soft); }
:root .table-pagination { gap: .75rem; }
:root .pagination-summary { color: var(--ui-muted); font-weight: 600; }
:root .pagination-controls button { border-radius: 9px; }
/* General fields; the workshop sheet applies its own underlines afterwards. */
:root input:not([type="checkbox"]):not([type="radio"]), :root select, :root textarea,
:root[data-theme="DARK"] input:not([type="checkbox"]):not([type="radio"]), :root[data-theme="DARK"] select, :root[data-theme="DARK"] textarea {
  background: var(--ui-surface); color: var(--ui-text); border-color: var(--ui-border);
}
:root:root :is(.login-form, .dialog, .panel-form) label,
:root:root .panel-form legend { color: var(--ui-text); }
:root input::placeholder, :root textarea::placeholder { color: var(--ui-muted); opacity: 1; }
:root input:not([type="checkbox"]):not([type="radio"]):hover:not(:disabled):not([readonly]), :root select:hover:not(:disabled), :root textarea:hover:not(:disabled):not([readonly]),
:root[data-theme="DARK"] input:not([type="checkbox"]):not([type="radio"]):hover:not(:disabled):not([readonly]), :root[data-theme="DARK"] select:hover:not(:disabled), :root[data-theme="DARK"] textarea:hover:not(:disabled):not([readonly]) {
  background: var(--ui-surface); border-color: color-mix(in srgb, var(--ui-accent) 50%, var(--ui-border));
}
:root input:not([type="checkbox"]):not([type="radio"]):focus, :root select:focus, :root textarea:focus,
:root[data-theme="DARK"] input:not([type="checkbox"]):not([type="radio"]):focus, :root[data-theme="DARK"] select:focus, :root[data-theme="DARK"] textarea:focus {
  border-color: var(--ui-focus); outline: 2px solid color-mix(in srgb, var(--ui-focus) 35%, transparent); outline-offset: 2px; box-shadow: none;
}
:root:root :is(input, select, textarea):disabled, :root:root :is(input, textarea)[readonly] { background: var(--ui-surface-soft); color: var(--ui-muted); border-color: var(--ui-border); }
:root:root :is(input[type="checkbox"], input[type="radio"]) { accent-color: var(--ui-accent-fill); }
:root:root select option { background: var(--ui-surface); color: var(--ui-text); }
:root:root :is(.prefix-field, .suffix-field) { border-color: var(--ui-border); background: var(--ui-surface); }
:root:root :is(.prefix-field, .suffix-field) > span { color: var(--ui-muted); background: var(--ui-surface-soft); border-color: var(--ui-border); }
:root:root :is(.prefix-field, .suffix-field) input { background: transparent; border-color: transparent; }
/* Search inputs remain open and calm; results form compact suggestion cards. */
:root:root:root input[type="search"] {
  border-width: 0 0 1px; border-style: solid; border-color: var(--ui-border);
  border-radius: 0 !important; background: transparent; color: var(--ui-text);
  box-shadow: none; padding-inline: .15rem;
}
:root:root:root input[type="search"]:hover:not(:disabled):not([readonly]) { background: transparent; border-color: var(--ui-accent); }
:root:root:root input[type="search"]:focus { background: transparent; border-color: var(--ui-focus) !important; outline-offset: 3px; box-shadow: none; }
:root:root .search-bar { gap: .8rem; margin-bottom: 1.1rem; }
:root:root .search-bar input[type="search"] { height: 2.75rem; }
:root:root .smart-search-menu, :root:root .order-customer-suggestions {
  padding: .45rem; gap: .25rem; border: 1px solid var(--ui-border);
  border-radius: 14px; background: var(--ui-surface); color: var(--ui-text);
  box-shadow: var(--ui-popover-shadow); overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--ui-border) transparent;
}
:root:root .smart-search-option, :root:root .order-customer-suggestion {
  background: var(--ui-surface-soft); color: var(--ui-text);
  border: 1px solid transparent; border-radius: 9px;
  padding: .65rem .75rem; gap: .2rem .8rem; line-height: 1.35;
}
:root:root .smart-search-option:hover, :root:root .smart-search-option.is-active,
:root:root .smart-search-option:focus-visible, :root:root .order-customer-suggestion:hover,
:root:root .order-customer-suggestion:focus-visible {
  color: var(--ui-accent); background: var(--ui-accent-soft);
  border-color: color-mix(in srgb, var(--ui-accent) 35%, var(--ui-border));
}
:root:root .smart-search-option:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: -2px; }
:root:root .smart-search-main strong { font-weight: 700; font-size: .86rem; line-height: 1.4; }
:root:root .smart-search-main small, :root:root .smart-search-meta { color: var(--ui-muted); font-weight: 500; font-size: .75rem; }
/* Actions: burgundy for submit, green for adding records. */
:root:root :is(.primary-button, .secondary-button, .icon-action, .row-actions button) { border-radius: 9px; transition: background-color .16s ease, border-color .16s ease, color .16s ease; }
:root:root .primary-button { background: var(--ui-accent-fill); color: #fff; border-color: var(--ui-accent-fill); box-shadow: 0 3px 8px #41010115; }
:root:root .primary-button:hover:not(:disabled) { background: var(--red-dark); border-color: var(--red-dark); color: #fff; }
:root:root :is(.secondary-button, .icon-action, .row-actions button) { background: var(--ui-surface); color: var(--ui-text); border-color: var(--ui-border); box-shadow: none; }
:root:root :is(.secondary-button, .icon-action, .row-actions button):hover:not(:disabled) { background: var(--ui-accent-soft); color: var(--ui-accent); border-color: color-mix(in srgb, var(--ui-accent) 40%, var(--ui-border)); }
:root:root :is(.add-action, .quick-customer-button, .tow-create-action),
:root:root :is(.icon-action, .primary-button).add-action,
:root:root .topbar-actions .tow-create-action { background: var(--ui-success-fill); border-color: var(--ui-success-fill); color: #fff; box-shadow: none; }
:root:root :is(.add-action, .quick-customer-button, .tow-create-action):hover:not(:disabled),
:root:root :is(.icon-action, .primary-button).add-action:hover:not(:disabled),
:root:root .topbar-actions .tow-create-action:hover:not(:disabled) { background: #1b5539; border-color: #1b5539; color: #fff; }
button:disabled { cursor: not-allowed; }
:root:root :is(button, a, summary, [tabindex]):focus-visible { outline: 2px solid var(--ui-focus); outline-offset: 3px; }
.sidebar :is(button, a):focus-visible { outline-color: #edb3b3; }
:root .secondary-button.danger { color: var(--ui-accent); }
/* Dialog geometry and internal scrollers are retained. */
:root:root :is(.dialog, .app-confirm) { color: var(--ui-text); background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: 18px; box-shadow: 0 24px 80px #0004; }
:root:root .dialog::backdrop, :root:root .app-confirm::backdrop { background: #202020c2; backdrop-filter: blur(5px); }
:root:root .dialog-head { border-color: var(--ui-border); }
:root:root .dialog-head h2 { color: var(--ui-text); letter-spacing: -.025em; }
:root:root .dialog-close { color: var(--ui-muted); border-radius: 8px; }
:root:root .dialog-close:hover { color: var(--ui-accent); background: var(--ui-accent-soft); }
:root:root .dialog-actions { border-color: var(--ui-border); }
:root:root :is(.order-detail-dialog, #towDetailDialog, #workshopReviewDialog) > .dialog-actions { background: var(--ui-surface); }
:root:root :is(.detail-grid > div, .review-summary > div, .review-totals, .payout-summary > div, .secret-box, .payment-detail) { background: var(--ui-surface-soft); color: var(--ui-text); border-color: var(--ui-border); }
:root:root :is(.review-vehicle, .mailbox-message-new, .mailbox-detail-new-meta, .mailbox-recipient-list section) { background: var(--ui-surface); color: var(--ui-text); border-color: var(--ui-border); }
:root:root :is(.mailbox-tabs button, .mailbox-target-chips span) { background: var(--ui-surface-soft); color: var(--ui-text); border-color: var(--ui-border); }
:root:root .mailbox-tabs button.active { background: var(--ui-accent-fill); color: #fff; }
:root:root .review-grand-total { color: var(--ui-accent); border-color: var(--ui-border); }
:root:root .toast { color: #fff; background: #323232; border: 1px solid #808080; border-radius: 12px; box-shadow: var(--ui-popover-shadow); }
/* Status semantics remain green/amber/red, including existing yard rows. */
:root:root :is(.status.active, .permission-ok) { background: var(--ui-success-soft); color: var(--ui-success); }
:root:root .status.locked { background: var(--ui-accent-soft); color: var(--ui-accent); }
:root:root .status-chip.progress { background: var(--ui-surface-soft); color: var(--ui-muted); }
/* Login and public deckel page use the same visual vocabulary. */
:root:root .login-panel { background: var(--ui-canvas); }
:root .brand-panel { background: radial-gradient(ellipse at 15% 10%, #701b1b66, transparent 60%), linear-gradient(145deg, #410101, #323232); }
:root .brand-copy h1 { letter-spacing: -.055em; }
:root .brand-copy p { color: #e5dada; }
:root .brand-footer { color: #c9baba; }
:root .brand-kicker { border-color: #e7c5c54d; color: #f3e6e6; }
:root .login-card { padding: 2rem; border: 1px solid var(--ui-border); border-radius: 22px; background: var(--ui-surface); box-shadow: var(--ui-shadow); }
:root .login-heading h2 { color: var(--ui-text); font-size: 2.35rem; }
:root .login-heading > p:last-child { color: var(--ui-muted); }
:root .icon-button:hover { background: var(--ui-accent-soft); color: var(--ui-accent); }
:root:root :is(.global-loader, .login-loading) { background: #323232; color: #fff; }
:root:root :is(.global-loader img, .login-loading img, .logo-frame img, .sidebar-brand img) { object-fit: contain; }
body:has(> .public-card) { padding: clamp(1rem, 4vw, 3rem); background: var(--ui-canvas); }
:root .public-card { padding: clamp(1.2rem, 3vw, 2rem); color: var(--ui-text); background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: 20px; box-shadow: var(--ui-shadow); }
.public-card > img { height: auto; object-fit: contain; }
.public-card h1 { margin-top: .8rem; font-size: clamp(1.8rem, 4vw, 2.5rem); letter-spacing: -.04em; }
.public-card h2 { color: var(--ui-text); font-size: 1.3rem; }
.public-card label { display: grid; gap: .45rem; font-size: .86rem; font-weight: 600; }
.public-card input { width: 100%; }
.public-card form { margin-block: 1.5rem; }
.public-card .public-total { color: var(--ui-accent); font-size: 1.7rem; }
.public-card .public-order { padding: 1rem; border: 1px solid var(--ui-border); border-radius: 12px; background: var(--ui-surface-soft); }
.public-card .public-order header { border-color: var(--ui-border); gap: .75rem; }
.public-card .public-order header > * { min-width: 0; overflow-wrap: anywhere; }
.public-card .public-order h3 { color: var(--ui-text); }
/* Narrow screens retain existing menu toggles and table scrolling policies. */
@media (max-width: 1050px) {
  :root .topbar { gap: .8rem; padding-inline: 1.2rem; }
  :root .topbar-actions { gap: .4rem; }
}
@media (max-width: 800px) {
  :root .topbar { align-items: center; flex-wrap: wrap; padding: .85rem 1rem; }
  :root .topbar-actions { flex: 1 1 auto; min-width: 0; }
  :root .topbar h2 { font-size: 1.08rem; }
  :root .content { padding: 1.2rem 1rem; }
  :root .login-card { padding: 1.5rem; }
  :root .section-head { gap: 1rem; }
}
@media (max-width: 520px) {
  :root .topbar-actions { gap: .35rem; width: 100%; }
  :root .account-trigger { max-width: 155px; }
  :root .account-trigger > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  :root .login-panel { padding: 1rem; }
  :root .login-card { padding: 1.25rem; }
  :root .smart-search-option { grid-template-columns: minmax(0, 1fr); }
  :root .smart-search-meta { max-width: 100%; text-align: left; }
  :root .table-pagination { flex-wrap: wrap; }
  :root .toast { left: 1rem; right: 1rem; bottom: 1rem; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
/* Visibility is a functional contract, not a styling choice. Keep this last. */
[hidden], .hidden { display: none !important; }
