/* Bindr's shared screen tokens and component rules. Printed quotations keep
   the contractor's selected template; technical drawing and KU geometry stay local. */
@media screen {
  :root {
    --bindr-accent:#ff8a24; --bindr-accent-hover:#ff9c48; --bindr-accent-soft:#fff1e4;
    --bindr-shell:#171b22; --bindr-bg:#e3e7ed; --bindr-card:#fff; --bindr-subtle:#f3f5f8;
    --bindr-text:#202a38; --bindr-muted:#566477; --bindr-border:#ccd4df;
    --bindr-danger:#a52d27; --bindr-danger-bg:#fff2f0; --bindr-danger-border:#d9a39e;
    --bindr-focus:#b34d00; --bindr-radius:8px; --bindr-control-radius:6px;
    --bindr-gap:16px; --bindr-padding:20px; --bindr-shadow:0 3px 12px #1723360b;
    --ink:var(--bindr-text); --muted:var(--bindr-muted); --line:var(--bindr-border);
    --surface:var(--bindr-bg); --green:var(--bindr-accent); --green-dark:var(--bindr-focus);
  }
  body {background:var(--bindr-bg);color:var(--bindr-text);font-size:1rem;line-height:1.5;letter-spacing:0}
  .app-shell>main {min-width:0}
  .view {padding:24px 24px 40px}
  .topbar {padding:16px 24px;gap:16px;min-height:88px}
  .screen-heading {gap:16px;flex-shrink:0;align-items:center}
  .topbar h1 {font-size:1.625rem;line-height:1.25;letter-spacing:-.025em}
  .software-section-label,.sidebar .nav-section .nav-divider {font-size:.75rem;line-height:1.5}
  .sidebar .nav-item {font-size:.875rem;min-height:38px}
  .brand-copy>span {white-space:normal;font-size:.75rem;letter-spacing:.06em;line-height:1.4}
  .sidebar-company small,.bindr-company-edit {font-size:.75rem}
  .top-actions {gap:8px;flex-wrap:wrap}
  .btn,.view .btn,.topbar .btn,#takeoffView .btn,dialog .btn,.project-file-explorer .btn {
    display:inline-flex;align-items:center;justify-content:center;gap:8px;
    min-height:38px;padding:8px 12px;border-radius:var(--bindr-control-radius);
    font-family:inherit;font-size:.875rem;font-weight:600;line-height:1.4;text-decoration:none;
    border:1px solid var(--bindr-border);cursor:pointer;box-shadow:none;
  }
  .btn.primary {background:var(--bindr-accent);border-color:var(--bindr-accent);color:#171b22}
  .btn.primary:hover {background:var(--bindr-accent-hover);border-color:var(--bindr-accent-hover)}
  .btn.secondary {background:var(--bindr-subtle);border-color:var(--bindr-border);color:var(--bindr-text)}
  .btn.ghost {background:var(--bindr-card);border-color:var(--bindr-border);color:var(--bindr-text)}
  .btn.secondary:hover,.btn.ghost:hover {background:#e9eef4;border-color:#a9b6c7}
  .btn.link {background:transparent;border-color:transparent;color:#314d6d}
  .btn.link:hover {background:var(--bindr-subtle);text-decoration:underline}
  .btn.danger,.view .btn.danger,dialog .btn.danger,#takeoffView .btn.danger,.icon-btn.danger {
    color:var(--bindr-danger)!important;background:var(--bindr-danger-bg);border:1px solid var(--bindr-danger-border);box-shadow:none;
  }
  .btn.danger:hover,.icon-btn.danger:hover {background:#fbe0dc;border-color:#bd6c65}
  .bindr-confirm .btn.danger {background:var(--bindr-danger);color:white!important;border-color:var(--bindr-danger)}
  .bindr-confirm .btn.danger:hover {background:#89231e}
  .icon-btn {display:inline-flex;align-items:center;justify-content:center;width:34px;min-width:34px;height:34px;min-height:34px;padding:6px;border-radius:6px;font-family:inherit;font-size:1.125rem;font-weight:600;line-height:1;cursor:pointer}
  .bindr-delete-icon {font-size:0!important}
  .bindr-delete-icon:before {content:'';display:block;width:18px;height:18px;background:currentColor;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16M9 7V4h6v3M6 7l1 13h10l1-13M10 10v7M14 10v7'/%3E%3C/g%3E%3C/svg%3E") center/contain no-repeat}
  :where(button,input,select,textarea,a,summary):focus-visible {outline:2px solid var(--bindr-focus)!important;outline-offset:3px}
  :where(.topbar,.tw-header,.sidebar) :focus-visible {outline-color:#ffb575!important}
  :where(button,.btn):disabled {opacity:.48;cursor:not-allowed;box-shadow:none}
  [hidden] {display:none!important}
  .bindr-back,.topbar .bindr-back,#takeoffView .bindr-back {min-width:84px;min-height:38px;flex-shrink:0;background:#2a313d;color:#f5f7fa;border-color:#566171}
  .bindr-back:before {content:'←';font-size:1.125rem;line-height:1}
  .bindr-back:hover,.topbar .bindr-back:hover,#takeoffView .bindr-back:hover {background:#3a4352;color:white}
  .record-back,#backToEstimate,#templateBackToEstimate,[data-job-return] {display:none!important}
  .view>.section-heading,.view>.crm-page-heading,.qr-section-heading {margin:0 0 20px;gap:16px}
  .view .section-heading h2,.view .crm-panel-heading h3,.view .cvr-report-panel h3,.qr-section-heading h2 {font-size:1.125rem;line-height:1.4;font-weight:650}
  .crm-page-heading h2 {font-size:1.375rem;line-height:1.35}
  .view p,.view .muted,.crm-page-heading p {line-height:1.5;color:var(--bindr-muted)}
  :is(.panel,.crm-panel,.crm-table-wrap,.saved-card,.cvr-report-panel,.cvr-report-metrics,.crm-kpis,.metric-grid,.pipeline-column,.qr-info-card,.qr-quote-card,.project-file-explorer,.cvr-costing-box,.cvr-comparison-box) {
    border-color:var(--bindr-border);border-radius:var(--bindr-radius);background:var(--bindr-card);box-shadow:var(--bindr-shadow);color:var(--bindr-text);
  }
  .view .panel,.view .crm-panel,.view .crm-table-wrap {border-color:var(--bindr-border);border-radius:var(--bindr-radius);box-shadow:var(--bindr-shadow)}
  :is(.crm-panel-heading,.workspace-section-heading,.fx-toolbar,.pipeline-toolbar,.cvr-section-heading,.qr-view-heading) {gap:16px;border-color:var(--bindr-border);color:var(--bindr-text)}
  .view .panel>.section-heading,.view .crm-panel-heading,.view .workspace-section>.workspace-section-heading {padding:16px 20px;background:var(--bindr-subtle)!important;color:var(--bindr-text)}
  .view .workspace-section-heading p,.surfacing-heading p {color:var(--bindr-muted)}
  .crm-two-col,.business-setup-grid,.qr-record-grid,.split-grid {gap:20px}
  .recovery-density {display:flex;flex-wrap:wrap;gap:16px 40px;padding:16px 20px;border-block:1px solid var(--bindr-border);background:var(--bindr-accent-soft)}
  .recovery-density>div {display:flex;align-items:baseline;flex-wrap:wrap;gap:6px 12px}
  .recovery-density span {font-size:.875rem;color:var(--bindr-muted)}
  .recovery-density strong {font-size:1rem;color:var(--bindr-text);font-variant-numeric:tabular-nums}
  .recovery-density small {flex-basis:100%;font-size:.8125rem;color:var(--bindr-muted)}
  .recovery-density .btn.link {padding:0;min-height:28px}
  .crm-filters,.estimate-link,.cvr-report-filters,.bindr-company-summary {padding:16px;border-radius:var(--bindr-radius);border-color:var(--bindr-border);gap:16px;box-shadow:var(--bindr-shadow)}
  .qr-info-card,.business-setup-grid .template-panel {padding:20px;border-color:var(--bindr-border);border-radius:var(--bindr-radius)}
  .qr-quote-body {padding:20px}.qr-quote-card>summary {padding:16px 20px}
  .qr-record-hero {border-radius:var(--bindr-radius);background:var(--bindr-shell);padding:24px}
  .qr-record-hero p,.qr-record-hero .qr-hero-status>span:last-child {color:#c8d1df}
  .qr-quote-tabs button {border-color:var(--bindr-border);border-radius:6px;background:var(--bindr-subtle)}
  .qr-quote-tabs button[aria-selected=true],.job-pricing-tab.active,.job-pricing-tab[aria-selected=true] {background:var(--bindr-accent-soft);border-color:#c47a3a;box-shadow:inset 0 3px var(--bindr-accent);color:var(--bindr-text)}
  .qr-quote-tabs strong,.qr-drawing strong,.qr-measured-areas strong,.qr-info-card dd,.qr-info-card label,.qr-record-notes p,.qr-record-notes h3 {font-size:.875rem}
  .qr-eyebrow,.qr-quote-kind,.qr-quote-identity>span:last-child,.qr-drawing span,.qr-quote-tabs span,.qr-info-card dt,.qr-view-heading>div>span {font-size:.75rem}
  .qr-quote-status,.qr-view-status,.qr-upload-row p,.qr-editor-action p,.qr-quote-actions p,.qr-empty,.qr-section-heading p {font-size:.875rem}
  .qr-quote-panel .btn {font-size:.875rem}.qr-file-symbol {font-size:.75rem}
  .qr-support>.job-folder,.job-folder {border-radius:var(--bindr-radius);border-color:var(--bindr-border)}
  .job-folder>summary,.qr-support>.job-folder>summary {padding:16px 20px;background:var(--bindr-subtle);color:var(--bindr-text)}
  .view label,dialog label,#takeoffView label {font-size:.875rem;font-weight:500;color:var(--bindr-muted)}
  .view input:not([type=checkbox]):not([type=radio]):not([type=color]),.view select,.view textarea,dialog input:not([type=checkbox]):not([type=radio]):not([type=color]),dialog select,dialog textarea {
    border:1px solid var(--bindr-border);border-radius:6px;background:#fff;color:var(--bindr-text);font-family:inherit;font-size:.875rem;line-height:1.4;padding:8px 10px;min-height:38px;max-width:100%;
  }
  .view :is(input,select,textarea):focus,dialog :is(input,select,textarea):focus {border-color:var(--bindr-focus);outline-color:var(--bindr-focus)}
  input[type=checkbox],input[type=radio] {accent-color:#b34d00}
  :is(.crm-table,.rate-table,.fx-table,.cvr-table,.job-saved-table) {font-size:.875rem}
  :is(.crm-table,.rate-table,.fx-table,.cvr-table,.job-saved-table) th {background:var(--bindr-subtle);color:var(--bindr-muted);font-size:.875rem;font-weight:600;padding:12px;border-color:var(--bindr-border)}
  :is(.crm-table,.rate-table,.fx-table,.cvr-table,.job-saved-table) td {padding:12px;border-color:#e1e6ed;font-variant-numeric:tabular-nums}
  .estimate-table th,.estimate-table td,.estimate-table input,.estimate-table select {font-size:.875rem}
  .estimate-table .estimate-section-headings th {font-size:.75rem}
  .crm-table tr:hover td,.fx-folder-row:hover,.fx-file-row:hover {background:#edf2f7}
  .fx-file-row.is-selected,.fx-tree button[aria-current] {background:var(--bindr-accent-soft);color:var(--bindr-text)}
  .crm-table-wrap,.table-wrap,.fx-table-wrap,.cvr-table-wrap,.qr-saved-pricing {overflow-x:auto;max-width:100%}
  .crm-empty,.qr-empty,.journey-empty,.pipeline-empty,.fx-empty {border-radius:var(--bindr-radius);color:var(--bindr-muted);font-size:.875rem}
  .crm-empty,.qr-empty,.journey-empty {background:var(--bindr-subtle);border:1px dashed var(--bindr-border);padding:24px}
  .stage-badge,.crm-stat-badge {font-size:.875rem;font-weight:600;border-radius:999px;padding:4px 10px;line-height:1.4}
  .metric-grid,.crm-kpis {margin:20px 0;padding:16px 0}
  .metric-grid span,.crm-kpis span {font-size:.875rem}.metric-grid small,.crm-kpis small {font-size:.75rem}
  .metric-grid strong,.crm-kpis strong {font-size:1.75rem;line-height:1.3;font-variant-numeric:tabular-nums}
  .ku-table .ku-area-head th {background:var(--bindr-shell)}
  .ku-table .ku-layer-head th,.ku-table th:last-child,.ku-table td:last-child {background:var(--bindr-subtle)}
  .ku-labour {--ku-tint:#edf4ff;--ku-accent:#2456a6}
  .ku-plant {--ku-tint:#eff8e9;--ku-accent:#316a22}
  .ku-transport {--ku-tint:#f0f3f7;--ku-accent:#445267}
  .ku-waiting,.ku-other,.ku-extras,.ku-subcontract {--ku-tint:#fff6e5;--ku-accent:#8a520b}
  .qr-quote-panel .ku-table {min-width:0}
  .tw-header {background:var(--bindr-shell);color:#f4f6fa;padding:16px 24px;border-color:#3d4755;gap:16px}
  .tw-header .tw-drawing-title,.tw-header .tw-drawing-title strong {color:#f4f6fa}
  .tw-header :is(.eyebrow,small,#workspaceSaved) {color:#c1ccdb}
  .tw-toolbar {padding:12px 16px;background:var(--bindr-subtle);border-color:var(--bindr-border)}
  #takeoffView .tw-toolbar .btn[aria-pressed=true],.tw-focus[aria-pressed=true] {background:var(--bindr-accent-soft);color:var(--bindr-text);border-color:#c47a3a;box-shadow:inset 0 -2px var(--bindr-accent)}
  #takeoffView .eyebrow,.tw-dialog .eyebrow,.tw-detail-heading>span {font-size:.75rem}
  #takeoffView .tw-detail-heading h3,#workspaceDetails .tw-detail-heading h3,#workspaceAreaEditor summary {font-size:.875rem}
  .tw-panel,.tw-area-card,.tw-quantity-box,.tw-layer,.tw-measurement {border-color:var(--bindr-border);border-radius:var(--bindr-radius)}
  .journey-steps button,.workflow-steps button {font-size:.875rem;border-radius:6px;min-height:38px}
  .journey-steps button[aria-current],.workflow-steps button[aria-current] {background:var(--bindr-accent-soft);color:var(--bindr-text);border-color:#d29a69}
  .journey-steps button[aria-current]>span {background:var(--bindr-accent);color:#171b22}
  dialog {box-sizing:border-box;max-width:calc(100vw - 32px);max-height:90dvh;overflow:auto;padding:24px;border:1px solid var(--bindr-border)!important;border-radius:10px!important;background:white;color:var(--bindr-text);box-shadow:0 24px 80px #0e15294d}
  dialog::backdrop,#crmDialog::backdrop,#cvrDialog::backdrop,.tw-dialog::backdrop,.fx-dialog::backdrop {background:#0c1426a6}
  dialog h2,.tw-dialog h2,.fx-dialog h2 {font-size:1.25rem;font-weight:650;line-height:1.4;margin-top:0;color:var(--bindr-text)}
  dialog p,.tw-dialog p {font-size:.875rem;line-height:1.6;color:var(--bindr-muted)}
  .bindr-dialog-actions,.fx-dialog-actions {display:flex;justify-content:flex-end;gap:8px;margin-top:24px;flex-wrap:wrap}
  dialog form>footer,dialog form>.top-actions:last-child,.tw-summary-actions,.tw-report-actions {display:flex;justify-content:flex-end;gap:8px;margin-top:24px;flex-wrap:wrap}
  .bindr-confirm {width:520px;padding:24px}
  .bindr-confirm-heading {display:flex;align-items:center;gap:12px;margin-bottom:16px}
  .bindr-confirm-heading h2 {margin:0}
  .bindr-confirm-icon {display:grid;place-items:center;width:36px;height:36px;border-radius:8px;background:var(--bindr-accent-soft);color:var(--bindr-focus);font-weight:750;flex-shrink:0}
  .bindr-confirm.is-destructive .bindr-confirm-icon {background:var(--bindr-danger-bg);color:var(--bindr-danger)}
  #bindrConfirmMessage {white-space:pre-wrap;overflow-wrap:anywhere;margin:0;max-height:55dvh;overflow-y:auto}
  #cvrForm>header {justify-content:flex-start;align-items:center;margin-bottom:20px;padding-bottom:20px;border-bottom:1px solid var(--bindr-border)}
  #cvrForm>header .cvr-recovery {margin-left:auto}
  #cvrForm>footer [data-cvr-close] {display:none}
  #cvrForm>footer {justify-content:flex-end;border-top:1px solid var(--bindr-border);padding-top:20px}
  #toast {background:var(--bindr-shell);font-size:.875rem;border:1px solid #485366;z-index:10000}
  .crm-status {font-size:.875rem}
  @media(max-width:1100px) {.topbar {flex-wrap:wrap}.topbar .estimate-actions {justify-content:flex-start}.qr-quote-body {padding:16px}}
  @media(max-width:720px) {
    .view {padding:16px 12px 32px}.topbar,.tw-header {padding:16px 12px}.screen-heading {gap:12px}
    .btn,.view .btn,#takeoffView .btn,dialog .btn {min-height:40px}
    .qr-info-card,.view .panel>.section-heading,.view .crm-panel-heading {padding:16px}
    .qr-quote-tabs {grid-template-columns:repeat(2,minmax(0,1fr))}.qr-quote-card>summary {padding:16px}
    dialog {padding:20px}.bindr-confirm {width:calc(100vw - 24px)}
    .metric-grid strong,.crm-kpis strong {font-size:1.5rem}
  }
  @media(prefers-reduced-motion:reduce) {* {scroll-behavior:auto!important}.btn,.qr-expand,#toast {transition:none}}
}
