/*
 * Borem Core — unified product UI layer
 * Loaded last so every application route, dynamically mounted panel, and
 * body-level overlay shares one accessible visual system.
 */
.borem-app, .borem-ui-root, .borem-v42-modal {
  --borem-font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --borem-ink: #172033;
  --borem-muted: #60708a;
  --borem-subtle: #8a97aa;
  --borem-canvas: #f5f7fb;
  --borem-surface: #ffffff;
  --borem-surface-raised: #ffffff;
  --borem-border: #dce3ed;
  --borem-border-strong: #bec9d8;
  --borem-primary: var(--borem-app-primary, #e8572b);
  --borem-primary-strong: #c84620;
  --borem-primary-soft: #fff1eb;
  --borem-focus: rgba(232, 87, 43, .22);
  --borem-success: #087d55;
  --borem-warning: #a65f05;
  --borem-danger: #bf2c34;
  --borem-radius-sm: 8px;
  --borem-radius: 14px;
  --borem-radius-lg: 20px;
  --borem-shadow: 0 1px 2px rgba(16, 24, 40, .03), 0 10px 28px rgba(16, 24, 40, .06);
  font-family: var(--borem-font-family) !important;
}
[data-borem-theme="dark"] .borem-app, [data-borem-theme="dark"].borem-app, [data-borem-theme="dark"] .borem-ui-root, [data-borem-theme="dark"] .borem-v42-modal {
  --borem-ink: #edf2f8;
  --borem-muted: #a9b5c7;
  --borem-subtle: #7e8ca2;
  --borem-canvas: #0e1522;
  --borem-surface: #151f2e;
  --borem-surface-raised: #1b2839;
  --borem-border: #2c3a4d;
  --borem-border-strong: #40526a;
  --borem-primary-soft: #3a211c;
  --borem-focus: rgba(255, 132, 91, .30);
  --borem-success: #44d39a;
  --borem-warning: #f4b75c;
  --borem-danger: #ff9ca3;
  --borem-shadow: 0 1px 2px rgba(0, 0, 0, .22), 0 18px 42px rgba(0, 0, 0, .24);
}

.borem-app :where(h1,h2,h3,h4,h5,h6), .borem-ui-root :where(h1,h2,h3,h4,h5,h6) { color: var(--borem-ink) !important; font-family: inherit !important; letter-spacing: -.018em; }
.borem-app :where(p,small,.muted,.text-muted), .borem-ui-root :where(p,small,.muted,.text-muted) { color: var(--borem-muted); }
.borem-app { background: var(--borem-canvas) !important; color: var(--borem-ink) !important; }
.borem-content { padding: 24px clamp(16px, 2.2vw, 34px) 42px !important; background: var(--borem-canvas) !important; }
.borem-page-title { font-size: clamp(18px, 1.8vw, 23px) !important; font-weight: 720 !important; letter-spacing: -.025em !important; }
.borem-topbar { min-height: 68px !important; padding: 0 clamp(16px, 2.2vw, 34px) !important; background: color-mix(in srgb, var(--borem-surface) 94%, transparent) !important; border-bottom: 1px solid var(--borem-border) !important; box-shadow: 0 1px 0 rgba(16,24,40,.02); backdrop-filter: blur(14px); }
.borem-sidebar { background: var(--borem-surface) !important; border-right-color: var(--borem-border) !important; }
.borem-logo { min-height: 68px; border-bottom: 1px solid var(--borem-border); }
.borem-logo-wordmark { font-weight: 750 !important; letter-spacing: -.03em; }
.borem-nav-link { border-radius: 9px !important; min-height: 38px !important; margin: 1px 8px !important; padding: 8px 10px !important; color: var(--borem-muted) !important; transition: color .16s ease, background .16s ease, transform .16s ease !important; }
.borem-nav-link:hover { background: var(--borem-primary-soft) !important; color: var(--borem-primary) !important; transform: translateX(1px); text-decoration: none !important; }
.borem-nav-link.active, .borem-nav-link[aria-current="page"] { background: var(--borem-primary-soft) !important; color: var(--borem-primary) !important; font-weight: 700 !important; }
.borem-nav-group-label, .borem-nav-group-summary { color: var(--borem-subtle) !important; font-size: 10px !important; font-weight: 800 !important; letter-spacing: .09em !important; }
.borem-sidebar-profile { margin: 8px !important; border: 1px solid transparent; border-radius: 12px !important; }
.borem-sidebar-profile:hover { background: var(--borem-primary-soft) !important; border-color: color-mix(in srgb, var(--borem-primary) 18%, var(--borem-border)) !important; }

/* Shared controls: comfortable, touch-safe, and resistant to host-theme CSS. */
.borem-app :where(input:not([type="checkbox"]):not([type="radio"]),select,textarea), .borem-ui-root :where(input:not([type="checkbox"]):not([type="radio"]),select,textarea), .borem-v42-modal :where(input,select,textarea) { min-height: 42px !important; border: 1px solid var(--borem-border) !important; border-radius: var(--borem-radius-sm) !important; background: var(--borem-surface) !important; color: var(--borem-ink) !important; font-size: 14px !important; line-height: 1.35 !important; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease !important; }
.borem-app textarea, .borem-ui-root textarea, .borem-v42-modal textarea { min-height: 108px !important; }
.borem-app :where(input,select,textarea)::placeholder, .borem-ui-root :where(input,select,textarea)::placeholder { color: #98a4b5 !important; opacity: 1 !important; }
.borem-v42-modal :where(input,select,textarea)::placeholder, .borem-admin-wrap :where(input,select,textarea)::placeholder { color: #98a4b5 !important; opacity: 1 !important; }
.borem-app :where(input,select,textarea):focus-visible, .borem-ui-root :where(input,select,textarea):focus-visible, .borem-v42-modal :where(input,select,textarea):focus-visible { border-color: var(--borem-primary) !important; box-shadow: 0 0 0 3px var(--borem-focus) !important; outline: none !important; }
.borem-app :where(input[type="checkbox"],input[type="radio"]), .borem-ui-root :where(input[type="checkbox"],input[type="radio"]) { accent-color: var(--borem-primary); width: 18px !important; height: 18px !important; flex: 0 0 auto; }
.borem-app :where(button,a,input,select,textarea):focus-visible, .borem-ui-root :where(button,a,input,select,textarea):focus-visible, .borem-v42-modal :where(button,a,input,select,textarea):focus-visible { outline: 3px solid var(--borem-focus) !important; outline-offset: 2px !important; }
.borem-field-group { gap: 7px !important; }
.borem-field-group > label, .borem-form-grid label, .borem-v42-field { color: var(--borem-ink) !important; font-size: 12px !important; font-weight: 700 !important; letter-spacing: .01em !important; }

.borem-btn, .borem-admin-btn { display: inline-flex !important; align-items: center !important; justify-content: center !important; gap: 7px !important; min-height: 38px !important; padding: 8px 14px !important; border: 1px solid var(--borem-border, #dce3ed) !important; border-radius: 9px !important; background: var(--borem-surface, #fff) !important; color: var(--borem-ink, #172033) !important; font-family: var(--borem-font-family, inherit) !important; font-size: 13px !important; font-weight: 700 !important; line-height: 1.1 !important; text-decoration: none !important; transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease !important; }
.borem-btn:hover, .borem-admin-btn:hover { border-color: var(--borem-primary, #e8572b) !important; background: var(--borem-primary-soft, #fff1eb) !important; color: var(--borem-primary, #e8572b) !important; box-shadow: 0 4px 12px rgba(16,24,40,.07) !important; text-decoration: none !important; }
.borem-btn.primary, .borem-admin-btn.primary { border-color: var(--borem-primary, #e8572b) !important; background: var(--borem-primary, #e8572b) !important; color: #fff !important; box-shadow: 0 7px 16px color-mix(in srgb, var(--borem-primary, #e8572b) 23%, transparent) !important; }
.borem-btn.primary:hover, .borem-admin-btn.primary:hover { border-color: var(--borem-primary-strong, #c84620) !important; background: var(--borem-primary-strong, #c84620) !important; color: #fff !important; transform: translateY(-1px); }
.borem-btn.borem-btn-danger, .borem-btn.danger { border-color: color-mix(in srgb, var(--borem-danger) 35%, var(--borem-border)) !important; background: color-mix(in srgb, var(--borem-danger) 8%, var(--borem-surface)) !important; color: var(--borem-danger) !important; }
.borem-btn-sm { min-height: 32px !important; padding: 6px 10px !important; font-size: 12px !important; }
.borem-icon-btn { width: 38px !important; height: 38px !important; min-height: 38px !important; border: 1px solid transparent !important; border-radius: 9px !important; color: var(--borem-muted) !important; }
.borem-icon-btn:hover { border-color: var(--borem-border) !important; background: var(--borem-primary-soft) !important; color: var(--borem-primary) !important; }
.borem-btn:disabled, .borem-btn[disabled], .borem-admin-btn:disabled { opacity: .48 !important; box-shadow: none !important; cursor: not-allowed !important; transform: none !important; }

/* Surfaces, data density, and scan hierarchy. */
.borem-card, .borem-panel, .borem-panel-inline, .borem-command-widget-panel, .borem-command-widget, .borem-empty-state { border-color: var(--borem-border) !important; background: var(--borem-surface) !important; box-shadow: var(--borem-shadow) !important; }
.borem-card { border-radius: var(--borem-radius) !important; overflow: clip; }
.borem-card-head { min-height: 58px; padding: 15px 18px !important; border-bottom: 1px solid var(--borem-border) !important; background: color-mix(in srgb, var(--borem-surface) 94%, var(--borem-canvas)) !important; }
.borem-card-head h2, .borem-card-head h3 { font-size: 15px !important; font-weight: 750 !important; }
.borem-card-body { padding: 18px !important; }
.borem-panel, .borem-panel-inline { border-radius: 11px !important; padding: 14px !important; }
.borem-grid, .borem-grid2 { gap: 18px !important; }
.borem-table-wrap { border: 1px solid var(--borem-border) !important; border-radius: 11px !important; background: var(--borem-surface) !important; }
.borem-table { overflow: hidden; }
.borem-table th { height: 42px !important; padding: 10px 14px !important; border-bottom-color: var(--borem-border) !important; background: color-mix(in srgb, var(--borem-canvas) 75%, var(--borem-surface)) !important; color: var(--borem-muted) !important; font-size: 10px !important; font-weight: 800 !important; letter-spacing: .075em !important; }
.borem-table td { min-height: 54px; padding: 13px 14px !important; border-bottom-color: var(--borem-border) !important; color: var(--borem-ink) !important; }
.borem-table tbody tr { transition: background .14s ease; }
.borem-table tbody tr:hover td { background: color-mix(in srgb, var(--borem-primary-soft) 68%, var(--borem-surface)) !important; }
.borem-table tbody tr:last-child td { border-bottom: 0 !important; }
.borem-table-tools { gap: 12px !important; margin-bottom: 14px !important; }
.borem-table-search { min-height: 42px !important; border-color: var(--borem-border) !important; background: var(--borem-surface) !important; border-radius: 9px !important; }
.borem-status-pill, .borem-loc-status-pill, .st-badge, .borem-kicker, .borem-release-badge { border: 1px solid color-mix(in srgb, currentColor 16%, transparent) !important; border-radius: 999px !important; font-size: 11px !important; font-weight: 750 !important; letter-spacing: .02em !important; }
.borem-empty-state { padding: clamp(28px, 5vw, 52px) 22px !important; border-style: dashed !important; text-align: center; }
.borem-empty-state h3 { margin-bottom: 7px !important; font-size: 17px !important; }

/* Command center retains its identity while now sharing app rhythm. */
.borem-command-center { gap: 26px !important; padding: clamp(30px, 6vh, 74px) clamp(14px, 2vw, 28px) 48px !important; background: radial-gradient(circle at 50% -12%, color-mix(in srgb, var(--borem-primary) 11%, transparent), transparent 43%), var(--borem-canvas) !important; }
.borem-command-hero h2 { font-weight: 760 !important; letter-spacing: -.045em !important; }
.borem-command-search-wrap { min-height: 62px; border-color: var(--borem-border) !important; background: var(--borem-surface) !important; box-shadow: 0 16px 36px rgba(16,24,40,.10) !important; }
.borem-command-search-wrap:focus-within { border-color: var(--borem-primary) !important; box-shadow: 0 0 0 4px var(--borem-focus), 0 16px 36px rgba(16,24,40,.10) !important; }
.borem-command-card { border-color: var(--borem-border) !important; background: var(--borem-surface) !important; box-shadow: var(--borem-shadow) !important; }
.borem-command-card:hover { border-color: color-mix(in srgb, var(--borem-primary) 45%, var(--borem-border)) !important; background: color-mix(in srgb, var(--borem-primary-soft) 45%, var(--borem-surface)) !important; }

/* Overlays must sit above host navigation and remain legible in both themes. */
.borem-modal-backdrop, .borem-v42-modal__backdrop, .borem-location-create-backdrop, .borem-tech-modal-backdrop { background: rgba(12, 20, 33, .56) !important; backdrop-filter: blur(5px); }
.borem-modal-backdrop { position: fixed !important; inset: 0 !important; z-index: 2147483500 !important; display: flex !important; align-items: center !important; justify-content: center !important; padding: 18px !important; }
.borem-modal-backdrop > .borem-modal-backdrop { position: absolute !important; z-index: 0 !important; padding: 0 !important; }
.borem-modal-backdrop > .borem-modal-dialog { position: relative !important; z-index: 1 !important; margin: 0 !important; }
/* Create Job uses a sibling panel, so it must sit above its fullscreen backdrop. */
#borem-wo-create-backdrop.borem-modal-backdrop { z-index: 2147483500 !important; }
#borem-wo-create-panel.borem-wo-create-modal { z-index: 2147483501 !important; }
/* Job-detail action dialogs render the backdrop and panel as siblings. */
#wo-appt-modal, #wo-edit-modal { z-index: 2147483600 !important; }
#wo-appt-modal > .borem-modal-backdrop, #wo-edit-modal > .borem-modal-backdrop { position:absolute !important; z-index:0 !important; }
#wo-appt-modal > .borem-modal-dialog, #wo-edit-modal > .borem-modal-dialog { position:fixed !important; z-index:1 !important; }
/* Every standard dialog is pinned to the viewport, never to a scrolled page container. */
.borem-modal-dialog { position:fixed !important; top:50% !important; left:50% !important; right:auto !important; bottom:auto !important; transform:translate(-50%, -50%) !important; margin:0 !important; z-index:2147483501 !important; max-height:calc(100dvh - 32px) !important; }
.borem-modal-backdrop > .borem-modal-dialog { position:fixed !important; z-index:1 !important; }
.borem-modal-dialog, .borem-record-dialog, .borem-location-create-modal, .borem-tech-modal-sheet, .borem-v42-modal__panel { border: 1px solid var(--borem-border) !important; border-radius: var(--borem-radius-lg) !important; background: var(--borem-surface) !important; color: var(--borem-ink) !important; box-shadow: 0 28px 74px rgba(5,13,26,.32) !important; }
.borem-modal-head, .borem-v42-modal__panel > header { min-height: 64px; padding: 16px 20px !important; border-bottom-color: var(--borem-border) !important; }
.borem-modal-head h3, .borem-v42-modal__panel h3 { font-size: 17px !important; font-weight: 760 !important; }
.borem-modal-body, .borem-v42-modal__body { padding: 20px !important; }
.borem-modal-foot, .borem-v42-modal__panel > footer { min-height: 68px; padding: 14px 20px !important; border-top-color: var(--borem-border) !important; background: color-mix(in srgb, var(--borem-surface) 92%, var(--borem-canvas)) !important; }
.borem-toast, .borem-v42-toast { border: 1px solid rgba(255,255,255,.14); border-radius: 12px !important; box-shadow: 0 18px 42px rgba(0,0,0,.28) !important; }

/* My Day route: keeps the full day and the next day scannable without a map key. */
.borem-tech-route-overview { margin: 0 0 14px; border: 1px solid var(--borem-border); border-radius: 12px; overflow: hidden; background: var(--borem-surface); }
.borem-tech-route-head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 14px; background:color-mix(in srgb, var(--borem-primary-soft) 48%, var(--borem-surface)); }
.borem-tech-route-head div { display:grid; gap:2px; }
.borem-tech-route-head span, .borem-tech-route-head small, .borem-tech-route-stops small { color:var(--borem-muted); font-size:11px; }
.borem-tech-route-head strong { font-size:14px; color:var(--borem-ink); }
.borem-tech-route-stops { list-style:none; margin:0; padding:0; }
.borem-tech-route-stops li { display:grid; grid-template-columns:28px minmax(0,1fr) auto; align-items:center; gap:10px; padding:11px 14px; border-top:1px solid var(--borem-border); }
.borem-tech-route-stops li > div { display:grid; gap:3px; min-width:0; }
.borem-tech-route-stops strong { font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.borem-tech-route-number { display:grid; place-items:center; width:24px; height:24px; border-radius:50%; background:var(--borem-primary); color:#fff; font-size:11px; font-weight:800; }
.borem-tech-route-stops .borem-btn { min-height:32px !important; padding:6px 9px !important; font-size:11px !important; }

/* Technician home: route-first, not office-command-center-first. */
.borem-tech-home { display:grid; gap:16px; }
.borem-tech-home-hero { background:linear-gradient(135deg, color-mix(in srgb, var(--borem-primary) 15%, var(--borem-surface)), var(--borem-surface)) !important; }
.borem-tech-home-hero .borem-card-body { display:grid; justify-items:start; gap:10px; }
.borem-tech-home-hero h1 { margin:0; font-size:clamp(28px,4vw,40px); letter-spacing:-.04em; }
.borem-tech-home-hero p:not(.borem-kicker) { margin:0; color:var(--borem-muted); max-width:580px; }
.borem-tech-home-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; align-items:start; }
.borem-tech-home-grid .borem-card-head p { margin:3px 0 0; font-size:12px; }
.borem-tech-stop { display:grid; grid-template-columns:30px minmax(0,1fr); gap:10px; padding:11px 0; border-bottom:1px solid var(--borem-border); text-decoration:none; color:var(--borem-ink); }
.borem-tech-stop:last-child { border-bottom:0; }
.borem-tech-stop time { color:var(--borem-primary); font-size:11px; font-weight:800; }
.borem-tech-stop strong,.borem-tech-stop span { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.borem-tech-stop span { margin-top:3px; color:var(--borem-muted); font-size:12px; }
.borem-tech-stop em { display:block; margin-top:5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--borem-muted); font-size:11px; font-style:normal; }
.borem-tech-stop-index { display:grid; place-items:center; width:25px; height:25px; border:1px solid var(--borem-border); border-radius:50%; color:var(--borem-primary); font-size:11px; font-weight:800; }
.borem-tech-home-time-total { font-size:34px; font-weight:800; letter-spacing:-.05em; color:var(--borem-ink); }
.borem-tech-home-time-total small { font-size:13px; color:var(--borem-muted); letter-spacing:0; }
.borem-tech-home-week { display:grid; grid-template-columns:repeat(7,1fr); gap:5px; align-items:end; min-height:100px; margin-top:14px; }
.borem-tech-home-day { display:grid; gap:6px; text-align:center; font-size:10px; color:var(--borem-muted); }
.borem-tech-home-bar { min-height:4px; border-radius:5px 5px 2px 2px; background:var(--borem-primary); }

/* Knowledge Base: a searchable reference surface, distinct from task-based Training. */
.borem-kb-page { display:grid; gap:16px; }
.borem-kb-hero .borem-card-body { display:grid; gap:12px; max-width:850px; }
.borem-kb-hero h1 { margin:0; font-size:28px; letter-spacing:-.035em; }
.borem-kb-hero p:not(.borem-kicker) { margin:0; color:var(--borem-muted); max-width:720px; }
.borem-kb-search { display:flex; align-items:center; gap:8px; max-width:700px; padding:0 12px; border:1px solid var(--borem-border); border-radius:10px; background:var(--borem-surface); }
.borem-kb-search input { width:100%; min-height:44px; border:0 !important; box-shadow:none !important; background:transparent !important; }
.borem-kb-starts { display:flex; flex-wrap:wrap; gap:8px; }
.borem-kb-layout { display:grid; grid-template-columns:230px minmax(0, 1fr); gap:16px; align-items:start; }
.borem-kb-sidebar { position:sticky; top:16px; }
.borem-kb-sidebar .borem-card-body { padding:10px; }
.borem-kb-all, .kb-cat-item { width:100%; border:0; background:transparent; text-align:left; color:var(--borem-ink); }
.borem-kb-all { padding:9px 10px; border-radius:8px; cursor:pointer; font-size:13px; font-weight:750; }
.borem-kb-all:hover, .kb-cat-item:hover { background:var(--borem-primary-soft); }
.borem-kb-content { min-width:0; }
.borem-kb-article-content { line-height:1.62; color:var(--borem-ink); }
.borem-kb-article-content h2, .borem-kb-article-content h3 { margin:24px 0 8px; }
.borem-kb-article-content p, .borem-kb-article-content li { color:var(--borem-muted); }
.borem-kb-article-content table { width:100%; border-collapse:collapse; }
.borem-kb-article-content th, .borem-kb-article-content td { padding:10px; border:1px solid var(--borem-border); text-align:left; vertical-align:top; }

@media (max-width: 767px) {
  .borem-kb-layout { grid-template-columns:1fr; }
  .borem-kb-sidebar { position:static; }
  .borem-tech-home-grid { grid-template-columns:1fr; }
  .borem-modal-dialog { width:calc(100vw - 20px) !important; max-height:calc(100dvh - 20px) !important; }
  .borem-content { padding: 16px 12px calc(90px + env(safe-area-inset-bottom)) !important; }
  .borem-topbar { min-height: 56px !important; padding: 0 12px !important; }
  .borem-card-head { min-height: 54px; padding: 13px 14px !important; }
  .borem-card-body { padding: 14px !important; }
  .borem-table-wrap { overflow: visible !important; border: 0 !important; background: transparent !important; }
  .borem-table thead { display: none !important; }
  .borem-table tbody { display: grid; gap: 10px; }
  .borem-table tbody tr { display: block !important; overflow: hidden; border: 1px solid var(--borem-border); border-radius: 11px; background: var(--borem-surface); box-shadow: 0 2px 7px rgba(16,24,40,.03); }
  .borem-table tbody td { display: grid !important; grid-template-columns: minmax(84px, .76fr) minmax(0, 1.35fr); gap: 12px; min-height: 0; padding: 11px 12px !important; border-bottom-color: var(--borem-border) !important; text-align: right !important; }
  .borem-table tbody td::before { color: var(--borem-muted) !important; font-size: 10px !important; font-weight: 800 !important; letter-spacing: .065em !important; text-align: left !important; }
  .borem-table tbody td:last-child { border-bottom: 0 !important; }
  .borem-table-actions { justify-content: flex-end; }
  .borem-modal-dialog, .borem-record-dialog, .borem-location-create-modal, .borem-tech-modal-sheet { width: calc(100vw - 20px) !important; max-height: calc(100dvh - 20px) !important; margin: 10px !important; border-radius: 16px !important; }
  .borem-command-actions { gap: 11px !important; }
}
@media (prefers-reduced-motion: reduce) {
  .borem-app *, .borem-ui-root *, .borem-v42-modal * { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
