/* Keep bulk prospect classification usable in split/narrow windows. */
.bulk-classify-dialog { overflow: hidden; }
.bulk-classify-table-wrap { overflow-x: hidden; overflow-y: auto; }
.bulk-classify-table { display: block; width: 100%; min-width: 0; table-layout: auto; }
.bulk-classify-table thead { display: none; }
.bulk-classify-table tbody { display: block; width: 100%; }
.bulk-classify-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, 220px); gap: 8px 14px; border: 1px solid var(--line); border-radius: 10px; padding: 11px; margin: 8px 0; background: #fff; }
.bulk-classify-table td { display: block; min-width: 0; border: 0; padding: 0; word-break: break-word; overflow-wrap: anywhere; }
.bulk-classify-table td::before { display: block; color: var(--muted); font-size: 10px; font-weight: 800; margin: 2px 0 3px; }
.bulk-classify-table td:nth-child(1), .bulk-classify-table td:nth-child(2), .bulk-classify-table td:nth-child(3), .bulk-classify-table td:nth-child(4), .bulk-classify-table td:nth-child(5) { grid-column: 1; }
.bulk-classify-table td:nth-child(6) { grid-column: 2; grid-row: 1 / span 5; align-self: center; padding: 10px; border: 1px solid #d7e6e8; border-radius: 8px; background: #f7fbfc; }
.bulk-classify-table td:nth-child(1)::before { content: 'Customer'; }
.bulk-classify-table td:nth-child(2)::before { content: 'Contact'; }
.bulk-classify-table td:nth-child(3)::before { content: 'Address'; }
.bulk-classify-table td:nth-child(4)::before { content: 'Product / Rooms'; }
.bulk-classify-table td:nth-child(5)::before { content: 'Expected Purchase'; }
.bulk-classify-table td:nth-child(6)::before { content: 'Priority'; }

/* Compact Operations Core banner: roughly one fifth of the former footprint. */
.hero { padding: 9px 14px; border-radius: 10px; align-items: center; gap: 14px; box-shadow: 0 6px 14px #14364b1c; }
.hero > div { display: grid; grid-template-columns: auto auto minmax(220px, 1fr); align-items: center; gap: 10px; min-width: 0; }
.hero h1 { font-size: clamp(13px, 1.4vw, 16px); line-height: 1.1; margin: 0; max-width: none; white-space: nowrap; }
.hero p { font-size: 10px; line-height: 1.15; margin: 0; max-width: none; }
.hero .eyebrow { font-size: 8px; }
.hero .button { padding: 7px 10px; font-size: 11px; white-space: nowrap; }
@media (max-width: 760px) {
  .hero > div { grid-template-columns: 1fr; gap: 2px; }
  .hero h1 { white-space: normal; }
}

/* Sticky navigation must never cover the destination section. */
html { scroll-padding-top: 58px; }

main {
  padding-top: 18px;
}

#app-shell {
  padding-top: 48px;
}

main [id] {
  scroll-margin-top: 58px;
}

.order-navigation {
  position: fixed !important;
  top: 0 !important;
  left: 0;
  transform: none;
  width: 100vw;
  max-width: none !important;
  margin: 0 !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  padding: 7px 12px !important;
  z-index: 1000;
  background: #fff;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  box-shadow: 0 5px 16px rgba(15, 43, 58, 0.18);
  scrollbar-width: thin;
}

.order-navigation a { flex: 0 0 auto; }

@media (max-width: 800px) {
  html { scroll-padding-top: 58px; }
  #app-shell { padding-top: 48px; }
  main { padding-top: 18px; }
  main [id] { scroll-margin-top: 58px; }
}

body.operations-module-view main section.panel:not([data-module-visible="true"]) {
  display: none !important;
}

body.operations-module-view main section.panel[data-module-visible="true"] {
  display: block !important;
}

body.separate-module-page main > section {
  display: none !important;
}

body.separate-module-page main > section[data-page-visible="true"] {
  display: block !important;
}

body[data-page-route="home"] main > section:has(#refresh),
body[data-page-route="home"] main > section#metrics,
body[data-page-route="home"] main > section#attention,
body[data-page-route="customers"] main > section:has(#customers),
body[data-page-route="prospects"] main > section:has(#lead-form),
body[data-page-route="prospects"] main > section:has(#negotiation-form),
body[data-page-route="prospects"] main > section:has(#opportunities),
body[data-page-route="big-orders"] main > section#big-orders,
body[data-page-route="small-orders"] main > section#small-orders,
body[data-page-route="installation-preparation"] main > section#installation-preparation,
body[data-page-route="finance"] main > section#finance-collections-panel,
body[data-page-route="inventory"] main > section:has(#inventory-form),
body[data-page-route="hr"] main > section:has(#employee-form),
body[data-page-route="hr"] main > section:has(#attendance-form),
body[data-page-route="returns"] main > section#returns,
body[data-page-route="customer-service"] main > section#service-call-desk,
body[data-page-route="tickets"] main > section#tickets,
body[data-page-route="installation-queue"] main > section#installation-management-queue,
body[data-page-route="installation"] main > section#installation-management-queue,
body[data-page-route="user-management"] main > section#user-admin-panel {
  display: block !important;
}

body.separate-module-page .order-navigation a[aria-current="page"] {
  background: #f28b39 !important;
  color: #fff !important;
}

body[data-page-route="inventory"] #negotiation-form {
  display: none !important;
}

body[data-page-route="prospects"] #inventory-form,
body[data-page-route="prospects"] #inventory-batch-form,
body[data-page-route="prospects"] #inventory {
  display: none !important;
}

.order-navigation a.active {
  background: #f28b39 !important;
  color: #fff !important;
}

.module-context-title {
  display: none;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-left: 4px solid #f28b39;
  background: #f5fbfd;
  color: #123d50;
  font-size: 1.05rem;
  font-weight: 800;
}

body[data-operations-module="inventory-management"] .module-context-title[data-for-module="inventory-management"],
body[data-operations-module="sales-pipeline"] .module-context-title[data-for-module="sales-pipeline"] {
  display: block;
}

body[data-page-route="inventory"] #negotiation-form,
body[data-operations-module="inventory-management"] #negotiation-form,
body[data-operations-module="inventory-management"] #negotiation-opportunity {
  display: none !important;
}

body[data-page-route="prospects"] #inventory-form,
body[data-page-route="prospects"] #inventory-batch-form,
body[data-page-route="prospects"] #inventory,
body[data-operations-module="sales-pipeline"] #inventory-form,
body[data-operations-module="sales-pipeline"] #inventory-batch-form,
body[data-operations-module="sales-pipeline"] #inventory {
  display: none !important;
}

.scheduler-workspace {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  grid-template-rows: auto 1fr;
  background: #eef6f8;
}

.scheduler-workspace[hidden] { display: none !important; }

.scheduler-workspace-header {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 54px;
  padding: 8px 16px;
  background: #0e3b50;
  color: #fff;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .2);
}

.scheduler-workspace-header button {
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 7px;
  padding: 8px 13px;
  background: #fff;
  color: #0e3b50;
  font-weight: 800;
  cursor: pointer;
}

.scheduler-workspace-header strong { font-size: 1rem; }
.scheduler-workspace iframe { width: 100%; height: 100%; border: 0; background: #fff; }

/* Stable application shell: normal document flow, no overlay or offset math. */
#app-shell {
  padding-top: 0 !important;
}

main {
  padding-top: 0 !important;
}

.order-navigation {
  position: static !important;
  inset: auto !important;
  transform: none !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 0 16px !important;
  padding: 9px 10px !important;
  display: grid !important;
  grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
  gap: 7px !important;
  overflow: visible !important;
  white-space: normal !important;
  box-shadow: none !important;
  border-radius: 9px !important;
}

.order-navigation a {
  display:flex !important;
  align-items:center;
  justify-content:center;
  min-width:0;
  text-align:center;
  white-space:normal;
  line-height:1.15;
}

/* Permission hiding must win over route/layout display rules. */
#app-shell [hidden], .order-navigation a[hidden] { display:none !important; }

@media (max-width: 1000px) { .order-navigation { grid-template-columns:repeat(4,minmax(0,1fr)) !important; } }
@media (max-width: 620px) { .order-navigation { grid-template-columns:repeat(2,minmax(0,1fr)) !important; } }

/* Home department queues keep each department, count, and customer together. */
.department-queues {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
  gap: 10px !important;
  align-items: stretch;
}

.department-queue {
  min-width: 0;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.department-queue b,
.department-queue strong,
.department-queue small {
  width: 100%;
  position: static !important;
  float: none !important;
}

.department-queue b {
  min-height: 30px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.department-queue small {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.attention-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)) !important;
}

/* Restore the native layout type of each server-selected page section. */
body[data-page-route="home"] main > section:has(#refresh) {
  display: flex !important;
}

body[data-page-route="home"] main > section#metrics {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important;
}

body[data-page-route="home"] main > section#attention {
  display: block !important;
}

body[data-page-route="prospects"] main > section:has(#lead-form),
body[data-page-route="prospects"] main > section:has(#negotiation-form),
body[data-page-route="hr"] main > section:has(#employee-form),
body[data-page-route="hr"] main > section:has(#attendance-form) {
  display: grid !important;
}

/* Inventory is a full-width working directory, not the right half of the quote grid. */
body[data-page-route="inventory"] main > section:has(#inventory-form) {
  display: block !important;
}
body[data-page-route="inventory"] #bom-panel:not([hidden]) { display:block !important; margin-top:16px; }
body[data-page-route="inventory"] #bom-panel[hidden] { display:none !important; }
.bom-operation-tabs { display:flex; align-items:center; gap:10px; margin:12px 0; padding:12px; border:1px solid #c9dce2; border-radius:10px; background:#f3fafb; }
.bom-operation-tabs .button { background:#345c6c; }
.bom-operation-tabs .button.active { background:#ef8434; }
.bom-operation-tabs span { color:#536b79; font-size:12px; }
.bom-forms > form[hidden] { display:none !important; }
.bom-forms:has(#bom-form[hidden]),.bom-forms:has(#assembly-form[hidden]) { grid-template-columns:1fr; }
.bom-inventory-picker { position:relative; min-width:0; }
.bom-inventory-picker > input[type="search"] { width:100%; }
.bom-selected-item { display:block; margin-top:4px; color:#396879; font-weight:700; }
.bom-inventory-results { position:absolute; left:0; right:0; z-index:30; max-height:280px; overflow:auto; background:#fff; border:1px solid #8fb9c4; border-radius:7px; box-shadow:0 10px 28px #16394d33; }
.bom-inventory-results button { display:grid; grid-template-columns:120px 1fr auto; gap:8px; width:100%; padding:8px 10px; border:0; border-bottom:1px solid #e1eaed; background:#fff; text-align:left; }
.bom-inventory-results button:hover { background:#e9f7fa; }
.bom-inventory-results small { color:#287146; white-space:nowrap; }
.bom-form-error { display:grid; gap:3px; grid-column:1/-1; padding:10px 12px; border:2px solid #b43d35; border-radius:8px; background:#fff1ef; color:#8b211b; }
.bom-form-error[hidden] { display:none; }
.bom-field-error { outline:2px solid #c43e34 !important; outline-offset:2px; background:#fff4f2 !important; }

body[data-page-route="inventory"] main > section:has(#inventory-form) > article:has(#negotiation-form) {
  display: none !important;
}

body[data-page-route="inventory"] main > section:has(#inventory-form) > article:has(#inventory-form) {
  width: 100%;
  max-width: none;
}

body[data-page-route="inventory"] #inventory {
  min-height: 420px;
  max-height: 62vh;
  overflow: auto;
}

body[data-page-route="inventory"] .inventory-row {
  padding: 10px 6px;
  font-size: 13px;
}

@media (max-width: 800px) {
  body[data-page-route="home"] main > section:has(#refresh) {
    display: flex !important;
  }
}

/* Shared multi-field lookup used by every workflow that selects a customer. */
.form .customer-lookup-owner { grid-column:span 2; }
.customer-lookup-grid { display:grid; grid-template-columns:1fr 1fr; gap:6px; margin-top:5px; }
.customer-lookup { display:block; width:100%; min-width:0; margin:0!important; padding:8px 9px!important; border:1px solid #9fc5cf!important; border-radius:8px; background:#f3fbfc!important; color:var(--ink); font:inherit; }
.customer-lookup-grid + select { margin-top:6px; }
@media (max-width:620px) { .customer-lookup-grid { grid-template-columns:1fr; } }
.big-order-search { display:grid; grid-template-columns:repeat(6,minmax(110px,1fr)); gap:8px; align-items:end; margin:0 0 14px; padding:12px; border:1px solid var(--line); border-radius:10px; background:#f4fafb; }
.big-order-search label { font-size:11px; font-weight:800; color:var(--muted); }
.big-order-search input,.big-order-search select { display:block; width:100%; margin-top:4px; padding:8px; border:1px solid #b9cbd3; border-radius:7px; background:#fff; color:var(--ink); font:inherit; }
.big-order-search [data-big-order-count] { grid-column:1/-1; margin:0; }
.project-work-summary { display:grid; grid-template-columns:1.3fr 1.5fr 1.3fr; gap:9px; margin-top:12px; }
.project-work-summary > div { min-width:0; padding:10px 11px; border:1px solid #d9e6ea; border-radius:8px; background:#fff; }
.project-work-summary small { display:block; margin-bottom:4px; color:#6b7c8d; font-size:9px; font-weight:900; letter-spacing:.7px; }
.project-work-summary b,.project-work-summary span { display:block; overflow-wrap:anywhere; }
.project-work-summary b { font-size:12px; line-height:1.35; }
.project-work-summary span,.project-work-summary a { margin-top:3px; color:#536b79; font-size:11px; }
.project-work-summary .project-next-action { border-color:#f0b474; background:#fff7ec; }
.project-work-summary .project-next-action b { color:#9b5514; }
.project-field-note { margin-top:8px; padding:9px 11px; border-left:3px solid #6eb5b8; background:#f2f9fa; color:#455e6b; font-size:11px; line-height:1.45; }
.project-priority-heading { display:flex; align-items:center; justify-content:space-between; margin:20px 0 8px; padding:10px 13px; border-radius:9px; background:#eaf2f5; color:#324d5c; }
.project-priority-heading b { font-size:13px; }
.project-priority-heading span { font-size:11px; font-weight:800; }
.project-priority-heading.urgent { background:#ffe7e3; color:#a52d22; }
.project-priority-heading.soon { background:#fff1d8; color:#916019; }
.project-priority-heading.unscheduled { background:#eef0ff; color:#4e5695; }
.project-priority-heading.completed { background:#e9f4ec; color:#36734a; }
.project-priority-badge { display:inline-block; margin-right:8px; padding:3px 6px; border-radius:5px; background:#e5edf1; color:#49606d; font-size:9px; font-weight:900; vertical-align:1px; }
.project-card[data-priority="urgent"] { border-left:5px solid #d94b3d; }
.project-card[data-priority="urgent"] .project-priority-badge { background:#ffe1dd; color:#ae3024; }
.project-card[data-priority="soon"] { border-left:5px solid #e9a63a; }
.project-card[data-priority="soon"] .project-priority-badge { background:#fff0d2; color:#956018; }
.project-card[data-priority="unscheduled"] { border-left:5px solid #737fc5; }
.project-card[data-priority="unscheduled"] .project-priority-badge { background:#e9ebff; color:#505a9d; }
@media (max-width:900px) { .big-order-search { grid-template-columns:1fr 1fr; } }
@media (max-width:900px) { .project-work-summary { grid-template-columns:1fr 1fr; } }
.contract-ledger-head h2 { margin:5px 0; }
#detail-modal .detail-dialog { width:min(1050px,96vw); }
#detail-modal .detail-dialog.quotation-dialog { width:min(1600px,98vw); max-height:95vh; }
.quote-toolbar { display:flex; justify-content:space-between; align-items:end; gap:16px; margin:12px 0; padding:10px 12px; background:#eef7f9; border:1px solid #c9e0e6; border-radius:9px; }
.quote-toolbar label { min-width:150px; font-weight:800; }
.quote-toolbar select { display:block; width:100%; margin-top:4px; }
.quote-table-wrap { max-height:62vh; overflow:auto; border:1px solid #d8e4e8; }
.quote-lines-table { min-width:1150px; }
.quote-lines-table thead { position:sticky; top:0; z-index:4; background:#edf6f8; }
.quote-lines-table tfoot { position:sticky; bottom:0; z-index:3; background:#fff7e9; }
.quote-lines-table td,.quote-lines-table th { vertical-align:top; }
.quote-lines-table input { width:100%; min-width:80px; }
.quote-search-cell { position:relative; min-width:360px; }
.quote-selected-name { display:block; margin-top:4px; color:#536b79; }
.quote-bom-breakdown { margin-top:6px; padding:6px; border:1px solid #c7dde3; border-radius:6px; background:#f5fbfc; }
.quote-bom-breakdown summary { cursor:pointer; color:#1e6075; font-weight:800; }
.quote-bom-breakdown span { display:block; padding:3px 0; color:#536b79; }
#detail-modal .detail-dialog.signed-contract-dialog { width:min(1180px,97vw); max-height:95vh; }
.marketing-return-dialog{width:min(1280px,97vw);max-height:94vh;padding:24px}
.marketing-return-layout{display:grid;grid-template-columns:minmax(320px,.9fr) minmax(460px,1.35fr);gap:24px;align-items:start}
.marketing-case-summary,.marketing-case-form{border:1px solid var(--line);border-radius:14px;padding:18px;background:#fff}
.marketing-case-summary dl{display:grid;grid-template-columns:130px 1fr;gap:12px;margin:0}.marketing-case-summary dt{font-weight:800;color:var(--muted)}.marketing-case-summary dd{margin:0;white-space:pre-wrap;word-break:break-word}
.marketing-choice{display:flex!important;grid-column:1/-1;align-items:flex-start;gap:12px;padding:14px;border:1px solid var(--line);border-radius:12px;background:#f8fbfc;cursor:pointer}.marketing-choice input{width:auto;margin-top:4px}.marketing-choice span{display:grid;gap:4px}.marketing-choice small{color:var(--muted)}.marketing-choice.exceptional{border-color:#e6b16b;background:#fff9ef}
.marketing-case-form [data-upgrade-fields],.marketing-case-form [data-charge-fields]{grid-column:1/-1}.marketing-case-form [data-charge-fields]{display:grid;grid-template-columns:1fr 1fr;gap:12px}.marketing-case-form [data-charge-fields][hidden],.marketing-case-form [data-upgrade-fields][hidden]{display:none}
@media(max-width:850px){.marketing-return-layout{grid-template-columns:1fr}.marketing-return-dialog{width:98vw;padding:14px}.marketing-case-form [data-charge-fields]{grid-template-columns:1fr}}
.workflow-inbox-dialog{width:min(1120px,97vw);max-height:94vh;padding:24px}.workflow-inbox-dialog .detail-head h2{font-size:25px}.workflow-inbox-dialog .detail-head p{margin:5px 0 0}
.workflow-inbox-list{display:grid;gap:12px}.workflow-inbox-item{display:grid;grid-template-columns:1fr auto;gap:18px;align-items:center;border:1px solid var(--line);border-left:6px solid #4c9ca2;border-radius:13px;padding:16px 18px;background:#fff}.workflow-inbox-item.priority-urgent{border-left-color:#bd2f2f;background:#fff7f7}.workflow-inbox-item.priority-high{border-left-color:#e78328;background:#fffaf4}.workflow-inbox-item h3{margin:5px 0;font-size:17px}.workflow-inbox-item p{margin:0 0 4px}.workflow-inbox-priority{display:inline-block;padding:3px 8px;border-radius:999px;background:#e9f3f4;font-size:11px;font-weight:900;text-transform:uppercase}.workflow-inbox-footer{display:flex;justify-content:space-between;align-items:center;gap:15px;margin-top:16px;padding-top:14px;border-top:1px solid var(--line);color:var(--muted)}.workflow-inbox-empty{padding:34px;text-align:center;color:var(--muted)}
.workflow-inbox-button{position:fixed;right:18px;bottom:18px;z-index:8;display:flex;align-items:center;gap:9px;border:0;border-radius:999px;padding:10px 15px;background:#0b4f67;color:#fff;box-shadow:0 8px 25px #16374655;cursor:pointer}.workflow-inbox-button b{display:grid;place-items:center;min-width:25px;height:25px;border-radius:50%;background:#fff;color:#0b4f67}.workflow-inbox-button.has-new{background:#c94f20;animation:workflow-inbox-pulse 1.5s ease-in-out 2}.workflow-inbox-button.has-new b{color:#c94f20}@keyframes workflow-inbox-pulse{50%{transform:scale(1.06);box-shadow:0 8px 30px #c94f2088}}
@media(max-width:700px){.workflow-inbox-dialog{width:98vw;padding:13px}.workflow-inbox-item{grid-template-columns:1fr}.workflow-inbox-item .button{width:100%}.workflow-inbox-footer{align-items:flex-start;flex-direction:column}}
.contract-signing-form { margin-top:14px; }
.contract-payment-preview { grid-column:1/-1; display:grid; gap:4px; padding:12px; border:1px solid #efb477; border-radius:8px; background:#fff8ed; }
.flow-complete { display:block; margin-top:5px; color:#26734b; font-weight:800; }
.quote-search-results { position:absolute; left:0; right:0; z-index:20; max-height:270px; overflow:auto; background:#fff; border:1px solid #8fb9c4; border-radius:7px; box-shadow:0 10px 28px #16394d33; }
.quote-search-results button { display:grid; grid-template-columns:110px 1fr auto; gap:8px; width:100%; padding:8px 10px; border:0; border-bottom:1px solid #e1eaed; background:#fff; text-align:left; }
.quote-search-results button:hover { background:#e9f7fa; }
.quote-search-results small { color:#287146; white-space:nowrap; }
.contract-ledger-head p { margin:0; color:var(--muted); font-size:12px; }
.contract-money-summary { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin:15px 0; }
.contract-money-summary > div { padding:13px; border:1px solid #d8e4e9; border-radius:10px; background:#f7fafb; }
.contract-money-summary small { display:block; color:#6b7c8d; font-size:9px; font-weight:900; letter-spacing:.6px; }
.contract-money-summary b { display:block; margin-top:6px; font-size:20px; }
.money-received { color:#28784a !important; }
.money-balance { color:#b24b31 !important; }
.current-installment { display:flex; justify-content:space-between; gap:12px; padding:11px 13px; border-left:4px solid #ee9a3c; background:#fff6e8; font-size:12px; }
.current-installment span { color:#6c5637; }
.contract-ledger { margin-top:16px; }
.ledger-title { display:flex; justify-content:space-between; align-items:center; }
.ledger-table { margin-top:8px; border:1px solid #dce6ea; border-radius:9px; overflow:hidden; }
.ledger-row { display:grid; grid-template-columns:1.15fr .85fr .95fr .85fr .95fr .95fr .8fr; gap:8px; align-items:center; padding:10px; border-top:1px solid #e2eaed; font-size:11px; }
.ledger-row:first-child { border-top:0; }
.ledger-header { background:#edf4f6; color:#536977; }
.ledger-status { display:inline-block; justify-self:start; padding:4px 7px; border-radius:10px; background:#fff0d9; color:#965f19; font-weight:800; }
.ledger-balance { background:#eaf3f5; border-top:2px solid #9dbbc2; color:#173f4b; font-weight:800; }
.ledger-past-due { background:#fff0ee; color:#a13c31; font-weight:800; }
.ledger-status.paid { background:#e5f4e9; color:#287047; }
.ledger-empty { padding:18px; border:1px dashed #d5a669; border-radius:9px; background:#fff9ef; color:#74562f; }
.contract-basic { margin-top:17px !important; padding-top:14px; border-top:1px solid #e1e8eb; }
.contract-ledger-actions { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-top:18px; }
.contract-ledger-actions form { padding:13px; border:1px solid #dce6ea; border-radius:10px; background:#f8fbfc; }
.contract-ledger-actions h3 { grid-column:1/-1; margin:0 0 4px; }
@media(max-width:800px){.contract-money-summary{grid-template-columns:1fr 1fr}.ledger-row{grid-template-columns:1fr 1fr}.ledger-header{display:none}.contract-ledger-actions{grid-template-columns:1fr}.current-installment{flex-direction:column}}
.finance-summary { display:grid; grid-template-columns:repeat(5,1fr); gap:10px; margin-bottom:14px; }
.finance-summary > div { padding:12px; border:1px solid #dce6ea; border-radius:9px; background:#f7fafb; }
.finance-summary small,.finance-summary span { display:block; color:#6b7c8d; font-size:9px; font-weight:800; }
.finance-summary b { display:block; margin:5px 0; font-size:20px; }
.finance-search { display:grid; grid-template-columns:2fr 1fr 1.25fr auto; gap:9px; align-items:end; padding:12px; border:1px solid #dce6ea; border-radius:10px; background:#f3f8fa; }
.finance-search label { color:#607684; font-size:10px; font-weight:900; }
.finance-search input,.finance-search select { display:block; width:100%; margin-top:4px; padding:9px; border:1px solid #bacbd3; border-radius:7px; background:#fff; }
.finance-queue-group { margin-top:17px; }
.finance-queue-title { display:flex; justify-content:space-between; padding:10px 12px; border-radius:8px; background:#e8f0f3; color:#3e5967; font-size:12px; }
.finance-queue-group.past-due .finance-queue-title { background:#ffe3df; color:#a32f24; }
.finance-queue-group.due-today .finance-queue-title { background:#fff0d5; color:#906018; }
.finance-queue-group.needs-setup .finance-queue-title { background:#eceeff; color:#515b9c; }
.finance-contract-row { margin-top:8px; padding:13px; border:1px solid #dce6ea; border-left:4px solid #6b9faf; border-radius:9px; background:#fff; }
.finance-queue-group.past-due .finance-contract-row { border-left-color:#d94b3d; }
.finance-contract-main { display:grid; grid-template-columns:1.45fr 1fr; gap:18px; }
.finance-contract-no { color:#607684; font-size:10px; font-weight:900; }
.finance-contract-main h3 { margin:3px 0 6px; font-size:14px; }
.finance-contract-main p { margin:3px 0; color:#647886; font-size:11px; }
.finance-amounts { display:grid; grid-template-columns:1fr 1fr; gap:7px; }
.finance-amounts span { padding:8px; border-radius:7px; background:#f4f8fa; color:#687b87; font-size:10px; }
.finance-amounts b { display:block; margin-top:3px; color:#243c49; font-size:13px; }
.finance-contract-foot { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-top:10px; padding-top:9px; border-top:1px solid #e4ebee; color:#6a7d88; font-size:10px; }
.finance-installments { display:none; margin-top:11px; border:1px solid #dfe8eb; border-radius:8px; overflow:hidden; }
.finance-details-expanded .finance-installments { display:block; }
.finance-toggle-details { grid-column:1/-1; justify-self:start; }
.finance-installment { display:grid; grid-template-columns:1.05fr .85fr .95fr .95fr .95fr .95fr 1.25fr; gap:8px; align-items:center; padding:9px 10px; border-top:1px solid #e3eaed; font-size:10px; }
.finance-installment:first-child { border-top:0; }
.finance-installment.header { background:#edf3f5; color:#607580; }
.finance-installment.past-due { background:#fff3f1; }
.finance-installment.due-today { background:#fff8eb; }
.finance-installment.paid { background:#edf8f0; }
.finance-installment.balance-summary { background:#eaf3f5; border-top:2px solid #9dbbc2; color:#173f4b; font-weight:800; }
.finance-queue-collapse { margin-left:auto; white-space:nowrap; }
.finance-collection-body[hidden] { display:none!important; }
.finance-approval-workbench { border-top:4px solid #e98235; }
.finance-approval-count { min-width:74px; padding:9px 14px; border-radius:9px; background:#fff3e8; text-align:center; color:#9d4e16; }
.finance-approval-count b,.finance-approval-count span { display:block; }
.finance-approval-count b { font-size:22px; }
.finance-approval-queue { display:grid; gap:10px; }
.finance-approval-card { display:grid; grid-template-columns:minmax(0,1.7fr) minmax(160px,.7fr) minmax(170px,.65fr); gap:14px; align-items:center; padding:13px; border:1px solid #e1e8eb; border-left:4px solid #e98235; border-radius:9px; background:#fff; }
.finance-approval-card h3,.finance-approval-card p { margin:3px 0; }
.finance-approval-stage { color:#a75218; font-size:10px; font-weight:900; letter-spacing:.08em; }
.finance-approval-money span,.finance-approval-actions button { display:block; margin:5px 0; }
@media(max-width:800px){.finance-approval-card{grid-template-columns:1fr}}
.project-fund-list { display:grid; gap:10px; }
.project-fund-card { display:grid; grid-template-columns:minmax(0,1.4fr) minmax(190px,.8fr) minmax(190px,.7fr); gap:12px; padding:13px; border:1px solid #dfe7ea; border-radius:9px; background:#fff; }
.project-fund-card h3,.project-fund-card p { margin:4px 0; }
.project-fund-totals span,.project-fund-actions button,.project-fund-history span { display:block; margin:5px 0; }
.project-fund-history { grid-column:1/-1; padding-top:8px; border-top:1px solid #e4eaed; font-size:10px; }
@media(max-width:800px){.project-fund-card{grid-template-columns:1fr}.project-fund-history{grid-column:1}}
.inventory-directory-tools { display:flex; align-items:end; justify-content:space-between; gap:12px; margin:12px 0; padding:11px; border:1px solid #dce6ea; border-radius:9px; background:#f6fafb; }
.inventory-directory-tools label { flex:1; }
.inventory-directory-tools input { width:100%; box-sizing:border-box; }
.inventory-directory-tools span { color:#607580; font-size:11px; white-space:nowrap; }
@media(max-width:700px){.inventory-directory-tools{align-items:stretch;flex-direction:column}.inventory-directory-tools span{white-space:normal}}
.finance-installment button { margin-left:6px; padding:4px 7px; font-size:9px; }
.finance-plan-editor { margin-top:18px; padding:12px; border:1px solid #dce6ea; border-radius:9px; background:#f8fbfc; }
.finance-plan-editor summary { cursor:pointer; font-weight:800; }
.finance-plan-editor form { margin-top:12px; }
.finance-contract-rule { margin-top:18px; padding:11px 13px; border-left:4px solid #438b91; background:#edf7f7; color:#47666c; font-size:11px; font-weight:700; }
.payment-receipt-dialog { width:min(760px,96vw) !important; }
.receipt-balance { display:grid; grid-template-columns:repeat(3,1fr); gap:9px; margin-bottom:15px; }
.receipt-balance span { padding:11px; border:1px solid #dce6ea; border-radius:8px; background:#f5f9fa; color:#637986; font-size:10px; }
.receipt-balance b { display:block; margin-top:4px; color:#263f4c; font-size:16px; }
.payment-receipt-dialog .span-all { grid-column:1/-1; }
.payment-receipt-dialog input[type="file"] { background:#fff; }
.receipt-error { color:#a3332b; font-size:12px; font-weight:700; }
.payment-receipt-links { display:block; margin-top:5px; }
.payment-receipt-links a { display:block; color:#287887; font-size:9px; font-weight:700; overflow-wrap:anywhere; }
.ledger-row .small-button { display:block; margin-top:5px; padding:5px 7px; font-size:9px; }
.installment-explanation { align-self:end; padding:9px; border-left:3px solid #4b9ca1; background:#eef8f8; }
@media(max-width:700px){.receipt-balance{grid-template-columns:1fr}}
@media(max-width:800px){.finance-summary{grid-template-columns:1fr 1fr}.finance-search{grid-template-columns:1fr}.finance-contract-main{grid-template-columns:1fr}.finance-contract-foot{align-items:flex-start;flex-direction:column}.finance-installment{grid-template-columns:1fr 1fr}.finance-installment.header{display:none}}
.bulk-classify-table td:nth-child(6) select { width: 100%; min-width: 0; box-sizing: border-box; }
.bulk-classify-pager { display: flex; justify-content: center; align-items: center; gap: 10px; min-height: 38px; padding: 8px 0 2px; color: var(--muted); font-size: 12px; }
.bulk-classify-pager button:disabled { opacity: .45; cursor: not-allowed; }
.customer-directory-pager { display: flex; justify-content: center; align-items: center; gap: 10px; min-height: 38px; padding: 8px 0 12px; color: var(--muted); font-size: 12px; }
.customer-directory-pager button:disabled { opacity: .45; cursor: not-allowed; }
.language-control { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: #9fb1c9; }
.language-control span { white-space: nowrap; }
.language-switcher { border: 1px solid rgba(159,177,201,.45); border-radius: 7px; padding: 5px 8px; background: #fff; color: #17263b; font: inherit; }
.login-card .language-control { justify-content: flex-end; margin: 0 0 12px; }
html[lang="en"] .bulk-classify-table td:nth-child(1)::before { content: 'Customer'; }
html[lang="en"] .bulk-classify-table td:nth-child(2)::before { content: 'Contact'; }
html[lang="en"] .bulk-classify-table td:nth-child(3)::before { content: 'Address'; }
html[lang="en"] .bulk-classify-table td:nth-child(4)::before { content: 'Product / rooms'; }
html[lang="en"] .bulk-classify-table td:nth-child(5)::before { content: 'Expected purchase'; }
html[lang="en"] .bulk-classify-table td:nth-child(6)::before { content: 'Prospect score'; }
@media (max-width: 620px) {
  .bulk-classify-table tr { grid-template-columns: 1fr; gap: 5px; }
  .bulk-classify-table td:nth-child(6) { grid-column: 1; grid-row: auto; align-self: stretch; }
}

body[data-page-route="department-signoff"] main > section#department-signoff-workbench:not([hidden]) { display:block !important; }
.payment-reconciliation { padding:12px 0; font-weight:600; }

#department-signoff-workbench .prep-stage-line { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:12px; margin:12px 0; }
#department-signoff-workbench .prep-stage { display:block; white-space:normal; border-radius:6px; padding:12px; font-size:14px; }
#department-signoff-workbench .prep-stage span { display:block; margin-top:6px; overflow-wrap:anywhere; }

/* Keep the independent signature fields readable on desktop and mobile. */
#site-signature-form { display:grid; grid-template-columns:minmax(0,1fr); gap:16px; }
#site-signature-form label { display:grid; gap:8px; font-weight:600; }
#site-signature-form input { box-sizing:border-box; width:100%; min-width:0; padding:10px; border:1px solid #a8becb; border-radius:6px; background:white; font:inherit; }
#site-signature-form button { justify-self:start; }
#site-signature-status { margin:0; overflow-wrap:anywhere; }
#site-signature-status:empty { display:none; }

body[data-page-route="logistics"] main > section#big-orders:not([hidden]) { display:block !important; }
#toast { top:85px; bottom:auto; left:50%; right:auto; transform:translateX(-50%); z-index:10000; width:max-content; max-width:min(680px,calc(100vw - 32px)); transition:opacity .2s; max-height:60vh; overflow:auto; box-sizing:border-box; white-space:pre-wrap; overflow-wrap:anywhere; padding:16px 48px 16px 18px; }
#toast button { position:absolute; top:6px; right:8px; padding:4px 8px; border:0; color:white; background:transparent; font-size:24px; cursor:pointer; }

body[data-page-route="finance"] #department-signoff-workbench { display:none !important; }
.shipping-linked-orders { margin:12px 0; padding:12px; border:1px solid #d6e1e7; border-radius:8px; }
.shipping-linked-orders h4 { margin:0 0 8px; }
.shipping-linked-orders details { padding:6px 0; }

#installation-management-queue { min-width:0; max-width:100%; box-sizing:border-box; }
.installation-queue-table { display:block; width:100%; max-width:100%; overflow-x:auto; }
.installation-queue-table table { min-width:1180px; width:100%; table-layout:auto; }
.installation-queue-table td.installation-work-actions { display:table-cell; min-width:190px; }
.installation-queue-table .button { white-space:normal; word-break:normal; overflow-wrap:normal; min-width:175px; }
.shipping-site-parts { border-bottom:1px solid #d6e1e7; padding-bottom:8px; margin-bottom:10px; }

/* Historical order lines retain readable source fields in Return review. */
.return-customer-history .history-scroll article.history-order-detail { display:grid; grid-template-columns:minmax(0,1fr); gap:6px; padding:12px 4px; }
.return-customer-history .history-order-detail > strong,.return-customer-history .history-order-detail > span { font-size:13px; line-height:1.45; }
.return-customer-history .history-order-detail small { font-size:12px; line-height:1.4; overflow-wrap:anywhere; }
.return-customer-history .history-order-detail details { grid-column:1 / -1; font-size:13px; overflow-wrap:anywhere; }
.return-customer-history .history-order-detail summary { cursor:pointer; font-weight:600; }
.return-customer-history .history-order-detail details > div { padding:3px 0; }
