/* BOSS design system. Visual layer only. It does not change routes, permissions, or stored data. */
:root {
  --boss-ink: #17202a;
  --boss-muted: #667085;
  --boss-line: #e4e7ec;
  --boss-bg: #f4f6f8;
  --boss-surface: #ffffff;
  --boss-navy: #102033;
  --boss-accent: #175cd3;
  --boss-good: #067647;
  --boss-good-bg: #ecfdf3;
  --boss-warn: #b54708;
  --boss-warn-bg: #fffaeb;
  --boss-bad: #b42318;
  --boss-bad-bg: #fef3f2;
  --boss-radius: 12px;
  --boss-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--boss-bg);
  color: var(--boss-ink);
}

body > header,
.topnav {
  background: var(--boss-navy) !important;
  color: #fff;
}

.login-card,
.card,
.item,
.job,
.k,
section {
  border-color: var(--boss-line);
}

.card,
.item,
.job,
.login-card {
  box-shadow: var(--boss-shadow);
}

.sidebar {
  background: var(--boss-navy);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.app.boss-fpu-has-drawer > .sidebar.boss-fpu-side,
#appView > .sidebar {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100dvh;
  max-height: 100dvh;
}

.sidebar .brand {
  flex: none;
  align-items: center;
  gap: 10px;
  padding: 2px 4px 12px;
}

.sidebar .brand-copy {
  min-width: 0;
  flex: 1;
}

.sidebar .brand strong {
  font-size: 14px;
  line-height: 1.25;
}

.sidebar .brand span {
  margin-top: 2px;
  color: #98a2b3;
  font-size: 11px;
  line-height: 1.3;
}

.sidebar .small-mark {
  width: 36px;
  height: 36px;
  flex: none;
}

.boss-nav-close {
  display: none;
}

#nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 8px 0 12px;
}

.sidebar-footer {
  flex: none;
  background: var(--boss-navy);
}

.sidebar-footer .link-button {
  min-height: 44px;
  padding: 8px 10px;
}

.nav-item,
.nav button,
.bv59nav button {
  border-radius: 8px;
  min-height: 44px;
}

.boss-nav-section {
  margin: 0 0 4px;
}

.boss-nav-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #98a2b3;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.boss-nav-chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin: 0 6px 3px 0;
  flex: none;
}

.boss-nav-section.is-open > .boss-nav-group .boss-nav-chevron {
  transform: rotate(-135deg);
  margin-top: 4px;
}

.boss-nav-links {
  display: none;
}

.boss-nav-section.is-open > .boss-nav-links {
  display: block;
}

#nav a.nav-item {
  min-height: 44px;
  margin: 0;
  padding: 8px 12px 8px 16px;
  border-radius: 8px;
  line-height: 1.25;
}

#nav a.nav-item.active,
.nav button.active,
.bv59nav .boss-nav-links button.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-weight: 700;
  box-shadow: inset 3px 0 0 #7cc4ff;
}

#mainNav {
  gap: 2px;
}

#mainNav button {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 8px;
  text-align: left;
}

#mainNav button.active,
#mobileBar button.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: inset 3px 0 0 #7cc4ff;
}

#mobileBar button.active {
  background: #dbeafe;
  color: #1d4ed8;
  box-shadow: inset 0 -3px 0 #175cd3;
}

#bossNavToggle {
  display: none;
  min-height: 44px;
  border: 1px solid var(--boss-line);
  background: #fff;
  color: var(--boss-navy);
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 700;
}

main > header {
  background: var(--boss-surface);
  color: var(--boss-ink);
  border-bottom: 1px solid var(--boss-line);
}

main > header h2 {
  font-size: 22px;
  letter-spacing: -0.02em;
}

button,
.btn,
a.btn,
input,
select,
textarea {
  font-family: inherit;
}

#content button,
.main button,
main button,
.actions button,
.row button {
  border-radius: 10px;
  min-height: 44px;
}

button.primary,
button.blue,
a.btn.blue,
#content .primary {
  background: var(--boss-navy);
  color: #fff;
  border: 0;
}

button.secondary,
button.alt,
a.btn:not(.blue) {
  background: #f2f4f7;
  color: var(--boss-navy);
}

button.danger,
button.bad {
  background: var(--boss-bad);
  color: #fff;
}

button.green,
button.approve {
  background: var(--boss-good);
  color: #fff;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
select,
textarea {
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  background: #fff;
  color: var(--boss-ink);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible,
.nav-item:focus-visible {
  outline: 2px solid var(--boss-accent);
  outline-offset: 2px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th {
  text-align: left;
  font-size: 12px;
  color: var(--boss-muted);
  font-weight: 700;
  background: #f9fafb;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--boss-line);
  vertical-align: top;
}

.status,
.pill,
.badge {
  border-radius: 999px;
  font-weight: 700;
}

.status.good,
.badge.ok,
.live {
  background: var(--boss-good-bg);
  color: var(--boss-good);
}

.status.pending,
.badge.warn {
  background: var(--boss-warn-bg);
  color: var(--boss-warn);
}

.status.bad,
.badge.bad,
.bad {
  background: var(--boss-bad-bg);
  color: var(--boss-bad);
}

.modal,
[role="dialog"] {
  border-radius: 16px;
  border: 1px solid var(--boss-line);
  box-shadow: 0 16px 40px rgba(16, 24, 40, 0.16);
}

/* Canonical BOSS form pattern. Create Job uses these classes; later forms should reuse them. */
.boss-form-dialog {
  position: fixed;
  inset: 0;
  z-index: 140200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(16, 32, 51, 0.48);
  box-sizing: border-box;
}
.boss-form-workspace [hidden] { display: none !important; }
.boss-form-workspace {
  width: min(1040px, 100%);
  max-height: min(900px, calc(100dvh - 48px));
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(16, 24, 40, 0.22);
}
.boss-form-header,
.boss-form-footer {
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 28px;
  background: #fff;
}
.boss-form-header { border-bottom: 1px solid var(--boss-line); }
.boss-form-footer {
  align-items: center;
  border-top: 1px solid var(--boss-line);
}
.boss-form-header h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}
.boss-form-header p,
.boss-form-help {
  margin: 6px 0 0;
  color: var(--boss-muted);
  font-size: 14px;
  line-height: 1.45;
}
.boss-form-badge {
  flex: none;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eff8ff;
  color: #175cd3;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.boss-contact-mode { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.boss-contact-mode button, .boss-existing-result { min-height: 44px; }
.boss-existing-result { display: flex; flex-direction: column; align-items: flex-start; width: 100%; margin-top: 8px; text-align: left; }
.boss-form-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 4px 28px 28px;
}
.boss-form-section { margin-top: 8px; padding-top: 20px; }
.boss-form-section + .boss-form-section { border-top: 1px solid var(--boss-line); margin-top: 20px; }
.boss-form-section h3 {
  margin: 0 0 16px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--boss-muted);
}
.boss-form-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px 20px;
  align-items: start;
}
.boss-field,
.boss-span-12 { grid-column: span 12; }
.boss-span-8 { grid-column: span 8; }
.boss-span-6 { grid-column: span 6; }
.boss-span-4 { grid-column: span 4; }
.boss-span-3 { grid-column: span 3; }
.boss-span-2 { grid-column: span 2; }
.boss-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
}
.boss-field > span,
.boss-field-label {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 700;
  color: #344054;
  line-height: 1.3;
}
.boss-field input,
.boss-field select,
.boss-field textarea,
.boss-search-selector input {
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  color: var(--boss-ink);
  font: inherit;
}
.boss-field textarea { min-height: 132px; resize: vertical; }
.boss-field.is-invalid input,
.boss-field.is-invalid select,
.boss-field.is-invalid textarea { border-color: var(--boss-bad); }
.boss-form-error { color: var(--boss-bad); font-size: 13px; font-weight: 600; }
.boss-form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.boss-btn {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.boss-btn-primary { border: 0; background: var(--boss-accent); color: #fff; }
.boss-btn-danger { border: 0; background: var(--boss-bad); color: #fff; }
.boss-btn-secondary { border: 1px solid #d0d5dd; background: #fff; color: #344054; }
.boss-btn:disabled { opacity: 0.7; cursor: wait; }
.boss-selected-record-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 16px;
  align-items: center;
  padding: 16px;
  border: 1px solid #d0d5dd;
  border-radius: 12px;
  background: #f8fafc;
}
.boss-selected-record-card strong { display: block; font-size: 18px; }
.boss-selected-record-card p { margin: 4px 0 0; color: #475467; }
.boss-search-results { display: flex; flex-direction: column; gap: 8px; }
.boss-search-option {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.boss-field > .boss-btn { align-self: flex-start; }
.boss-field > .boss-money { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; }
.boss-money span { color: #475467; font-weight: 700; flex: none; }
.boss-money input { width: 0; flex: 1; min-width: 0; }
.boss-line-total {
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 20px;
  font-weight: 800;
}
.boss-line-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.boss-line-row {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) 88px minmax(140px, 0.9fr) 120px auto;
  gap: 12px;
  align-items: end;
}
.boss-line-row > .boss-field,
.boss-line-row > .boss-line-remove { grid-column: auto; min-width: 0; }
.boss-line-row .boss-line-total { font-size: 16px; }
.boss-price-summary {
  width: min(320px, 100%);
  margin: 16px 0 0 auto;
  display: grid;
  gap: 8px;
}
.boss-price-summary div { display: flex; justify-content: space-between; gap: 16px; }
.boss-price-total { border-top: 1px solid var(--boss-line); padding-top: 8px; font-weight: 800; }
.boss-doc-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.boss-doc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--boss-line);
  border-radius: 10px;
  background: #f8fafc;
}
.boss-doc-row > span { min-width: 0; overflow-wrap: anywhere; }
.boss-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.boss-choice .boss-btn { min-height: 72px; text-align: left; }
.boss-choice .boss-btn[aria-pressed="true"] { border-color: #101828; box-shadow: inset 0 0 0 1px #101828; background: #f8fafc; }
.boss-choice-stack { grid-template-columns: 1fr; }
@media (max-width: 640px) { .boss-choice { grid-template-columns: 1fr; } }
.boss-address-card {
  padding: 12px 14px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--boss-line);
}

@media (max-width: 900px) {
  .boss-line-row { grid-template-columns: 1fr 1fr; }
  .boss-line-row .boss-line-name,
  .boss-line-row .boss-line-amount,
  .boss-line-row .boss-line-remove { grid-column: 1 / -1; }
}

@media (max-width: 900px) and (min-width: 641px) {
  .boss-line-name { grid-column: span 12; }
  .boss-span-2 { grid-column: span 4; }
}

@media (max-width: 640px) {
  .boss-form-dialog { padding: 0; align-items: stretch; }
  .boss-form-workspace {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .boss-form-header,
  .boss-form-footer,
  .boss-form-body { padding-left: 16px; padding-right: 16px; }
  .boss-form-footer { flex-wrap: wrap; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .boss-contact-mode { flex-direction: column; }
  .boss-contact-mode button { width: 100%; }
  .boss-span-8,
  .boss-span-6,
  .boss-span-4,
  .boss-span-3,
  .boss-span-2,
  .boss-field { grid-column: 1 / -1; }
  .boss-selected-record-card { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  #bossNavToggle { display: inline-flex; align-items: center; }
  .boss-nav-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: transparent;
    color: #fff;
    font-weight: 700;
  }
  .boss-nav-group,
  #nav a.nav-item {
    min-height: 44px;
  }
  body:has(> .app > .sidebar) .app {
    grid-template-columns: 1fr;
  }
  html.boss-fpu-nav-open,
  html.boss-fpu-nav-open body {
    overflow: hidden;
  }
  table {
    display: block;
    overflow-x: auto;
  }
}

.boss-record { display: grid; gap: 16px; min-width: 0; }
.boss-record-header { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.boss-record-kicker { font-size: 12px; font-weight: 800; letter-spacing: .08em; color: #4aa3d8; }
.boss-record-title { margin: 4px 0 0; font-size: 26px; line-height: 1.15; color: #101828; }
.boss-record-meta { margin-top: 6px; color: #475467; line-height: 1.45; }
.boss-record-meta a { color: #175cd3; font-weight: 700; }
.boss-record-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.boss-record-more { position: relative; }
.boss-record-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 3; min-width: 220px; background: #fff; border: 1px solid #e4e7ec; border-radius: 12px; padding: 8px; display: grid; gap: 6px; box-shadow: 0 12px 30px rgba(16,24,40,.12); }
.boss-record-menu[hidden] { display: none !important; }
.boss-record-menu .boss-btn { width: 100%; justify-content: flex-start; }
.boss-record-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.boss-record-metric { border: 1px solid #e4e7ec; border-radius: 12px; padding: 12px 14px; background: #fff; min-width: 0; }
.boss-record-metric small { display: block; color: #667085; font-weight: 700; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.boss-record-metric strong { display: block; margin-top: 6px; font-size: 22px; color: #101828; overflow-wrap: anywhere; }
.boss-record-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.boss-record-tabs button { min-height: 44px; border: 1px solid #e4e7ec; background: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.boss-record-tabs button[aria-selected="true"] { background: #101828; color: #fff; border-color: #101828; }
.boss-record-panel[hidden] { display: none !important; }
.boss-record-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.boss-record-card { padding: 16px; border: 1px solid #eaecf0; border-radius: 12px; background: #fff; min-width: 0; }
.boss-record-card h3, .boss-record-card h4 { margin: 0 0 12px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: #667085; }
.boss-record-list { display: grid; gap: 10px; }
.boss-record-row { border: 1px solid #eaecf0; border-radius: 12px; padding: 12px 14px; background: #fff; display: grid; gap: 4px; min-width: 0; }
.boss-record-row strong { overflow-wrap: anywhere; }
.boss-record-empty { padding: 18px; color: #667085; text-align: center; border: 1px dashed #d0d5dd; border-radius: 12px; background: #f8fafc; }
.boss-record-fail { border: 1px solid #fecdca; background: #fef3f2; color: #912018; border-radius: 12px; padding: 12px 14px; }
.boss-lifecycle { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.boss-lifecycle-step { border: 1px solid #e4e7ec; border-radius: 999px; padding: 8px 12px; font-size: 12px; font-weight: 700; color: #667085; background: #fff; }
.boss-lifecycle-step.is-current { background: #101828; color: #fff; border-color: #101828; }
.boss-portal-pay-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 16px 0 22px; }
.boss-portal-pay-card { border: 1px solid #e4e7ec; border-radius: 12px; padding: 14px; background: #fff; min-width: 0; }
.boss-portal-pay-card small { display: block; color: #667085; font-weight: 700; font-size: 12px; }
.boss-portal-pay-card strong { display: block; margin-top: 6px; font-size: 22px; overflow-wrap: anywhere; }
@media (max-width: 430px) {
  .boss-record-title { font-size: 22px; }
  .boss-record-actions, .boss-record-actions .boss-btn { width: 100%; }
  .boss-record-menu { left: 0; right: 0; }
}
@media (max-width: 768px) {
  .boss-dispatch-layout { grid-template-columns: 1fr !important; }
  #r20Calendar { display: grid !important; grid-template-columns: 1fr !important; min-width: 0; }
  #r20Calendar .r20day { min-width: 0 !important; width: auto !important; }
}
#eb2AiDescription, #eb2CustomerNotes, #eb2InternalNotes, #eb2Warranty { min-height: 140px; }
@media (max-width: 768px) {
  .boss-acct-tx-table thead { display: none; }
  .boss-acct-tx-table, .boss-acct-tx-table tbody, .boss-acct-tx-table tr, .boss-acct-tx-table td { display: block; width: auto; }
  .boss-acct-tx-table tr { border: 1px solid #e4e7ec; border-radius: 12px; margin: 0 0 8px; padding: 8px; background: #fff; }
  .boss-acct-tx-table td { text-align: left !important; padding: 4px 8px !important; }
  .boss-acct-tx-table td::before { content: attr(data-label); display: block; color: #667085; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
}
