:root {
  --page: #e7ebee;
  --panel: #ffffff;
  --panel-soft: #f5f7f8;
  --ink: #172027;
  --muted: #68747d;
  --line: #d6dde1;
  --line-strong: #bdc7cd;
  --shell: #edf1f3;
  --shell-soft: #f5f7f8;
  --shell-line: #d3dce1;
  --gold: #e9aa21;
  --gold-dark: #b87808;
  --green: #176b38;
  --green-soft: #e9f5ed;
  --blue: #2464b4;
  --blue-soft: #eaf2fc;
  --plum: #87366e;
  --plum-soft: #f8edf4;
  --amber: #c67b12;
  --amber-soft: #fff4e3;
  --red: #b42318;
  --shadow: 0 8px 22px rgba(17, 27, 34, 0.1);
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.action-button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    color 150ms ease;
}

button:hover:not(:disabled),
.action-button:hover {
  border-color: #8f9da5;
  background: #f5f7f8;
}

button:focus-visible,
.action-button:focus-within,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h2 {
  font-size: 1rem;
  letter-spacing: 0;
}

h3 {
  font-size: 0.94rem;
  letter-spacing: 0;
}

.app-shell {
  width: 100%;
  min-height: 100vh;
}

.command-header {
  display: grid;
  grid-template-columns: 252px minmax(220px, 1fr) auto;
  align-items: center;
  gap: 22px;
  min-height: 94px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--shell);
  color: var(--ink);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  padding-right: 20px;
  border-right: 1px solid var(--line-strong);
}

.claimstar-logo {
  display: block;
  width: 222px;
  max-width: 100%;
  height: 70px;
  object-fit: contain;
  object-position: left center;
}

.estimate-context {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.context-label,
.panel-kicker,
.structure-heading-kicker,
.navigation-heading {
  color: #8e9ba3;
  font-size: 0.69rem;
  font-weight: 780;
  letter-spacing: 0;
  text-transform: uppercase;
}

.estimate-context strong {
  max-width: 540px;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 9px;
}

.header-actions button,
.header-actions .action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  padding: 9px 14px;
  border-color: #abb7be;
  background: #fff;
  color: #27343c;
  font-size: 0.82rem;
  font-weight: 720;
  white-space: nowrap;
}

.header-actions button:hover:not(:disabled),
.header-actions .action-button:hover {
  border-color: #7f8f98;
  background: #f8fafb;
}

.header-actions .primary-action {
  border-color: var(--gold);
  background: var(--gold);
  color: #18140a;
}

.header-actions .primary-action:hover:not(:disabled) {
  border-color: #f2bb46;
  background: #f2bb46;
}

.header-actions .quiet-action {
  min-width: 68px;
}

.upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.upload-button.is-dragging {
  border-color: var(--gold);
  background: #2a3237;
  color: #ffd675;
}

.project-summary {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(6, minmax(120px, 1fr));
  gap: 1px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--line);
}

.project-estimates {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 16px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line-strong);
  background: #f7f9fa;
}

.project-estimates[hidden] {
  display: none;
}

.project-estimates-heading {
  display: grid;
  gap: 4px;
  align-content: center;
}

.project-estimates-heading p {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.project-estimate-list {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  padding: 2px 0;
}

.project-estimate-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 10px;
  min-width: 210px;
  max-width: 290px;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-left: 4px solid #7f8f98;
  border-radius: 5px;
  background: #fff;
}

.project-estimate-chip[data-state="active"] {
  border-left-color: var(--green);
  background: #f2f9f4;
}

.project-estimate-chip[data-state="additive"] {
  border-left-color: var(--blue);
  background: #f1f6fc;
}

.project-estimate-chip[data-state="superseded"] {
  opacity: 0.72;
  border-left-color: #9aa7af;
  background: #f3f5f6;
}

.project-estimate-chip strong,
.project-estimate-chip small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-estimate-chip strong {
  color: var(--ink);
  font-size: 0.76rem;
}

.project-estimate-chip small {
  color: var(--muted);
  font-size: 0.67rem;
}

.project-estimate-state {
  align-self: start;
  padding: 2px 5px;
  border-radius: 4px;
  background: #e8edef;
  color: #52616a;
  font-size: 0.61rem;
  font-weight: 780;
  text-transform: uppercase;
}

.project-estimate-remove {
  grid-column: 2;
  align-self: end;
  justify-self: end;
  min-height: 24px;
  padding: 3px 6px;
  border-color: #c9d1d5;
  color: #6b7880;
  font-size: 0.62rem;
}

.summary-cell {
  min-width: 0;
  padding: 14px 18px;
  background: #fff;
}

.customer-cell {
  background: #f7f9fa;
}

.acv-summary-cell strong {
  color: #087b6b;
}

.added-value-summary-cell,
.increase-summary-cell {
  background: #f1f8f4;
}

.added-value-summary-cell strong,
.increase-summary-cell strong {
  color: #087b6b;
}

.added-value-summary-cell[data-state="decrease"],
.increase-summary-cell[data-state="decrease"] {
  background: #fff3f1;
}

.added-value-summary-cell[data-state="decrease"] strong,
.increase-summary-cell[data-state="decrease"] strong {
  color: #b42318;
}

.added-value-summary-cell[data-state="baseline"],
.increase-summary-cell[data-state="baseline"] {
  background: #f7f9fa;
}

.added-value-summary-cell[data-state="baseline"] strong,
.increase-summary-cell[data-state="baseline"] strong {
  color: var(--ink);
}

.summary-label,
.metric-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 780;
  letter-spacing: 0;
  text-transform: uppercase;
}

.summary-cell strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 1.06rem;
  line-height: 1.2;
}

.command-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 250px;
  align-items: start;
  min-height: calc(100vh - 150px);
}

.side-navigation,
.reconciliation-panel {
  position: sticky;
  top: 0;
  min-height: calc(100vh - 150px);
  background: var(--shell-soft);
  color: var(--ink);
}

.side-navigation {
  align-self: stretch;
  border-right: 1px solid var(--line-strong);
}

.navigation-heading {
  padding: 20px 18px 9px;
}

.navigation-link {
  position: relative;
  display: grid;
  grid-template-columns: 5px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 55px;
  padding: 10px 18px 10px 0;
  border-bottom: 1px solid var(--line);
  color: #46545d;
  font-size: 0.84rem;
  font-weight: 650;
  text-decoration: none;
}

.navigation-link:hover,
.navigation-link.is-active {
  background: #e3e9ec;
  color: var(--ink);
}

.navigation-marker {
  display: block;
  align-self: stretch;
  width: 5px;
  background: #697982;
}

.overview-marker {
  background: var(--gold);
}

.roof-marker {
  background: #39a766;
}

.line-items-marker {
  background: #4b90e1;
}

.tools-marker {
  background: #d68b26;
}

.rules-marker {
  background: #a65b93;
}

.sidebar-rule-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 12px;
  padding: 11px 12px;
  border: 1px solid var(--shell-line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.sidebar-rule-summary strong {
  color: var(--ink);
  font-size: 1rem;
}

.primary-workspace {
  min-width: 0;
  padding: 0 14px 28px;
}

.workspace-tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  min-height: 48px;
  margin: 0 -14px 14px;
  padding: 0 14px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line-strong);
  background: #fff;
}

.workspace-tab {
  display: inline-flex;
  align-items: center;
  min-width: max-content;
  padding: 0 20px;
  border-bottom: 3px solid transparent;
  color: #58656e;
  font-size: 0.82rem;
  font-weight: 680;
  text-decoration: none;
}

.workspace-tab:hover,
.workspace-tab.is-active {
  border-bottom-color: var(--gold);
  color: var(--ink);
}

.structure-deck {
  display: grid;
  gap: 10px;
  scroll-margin-top: 58px;
}

.roof-summary-section,
.siding-summary-section,
.roof-area-banner {
  display: grid;
  grid-template-columns: 172px minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 2px 7px rgba(17, 27, 34, 0.05);
}

.roof-summary-section[hidden],
.siding-summary-section[hidden],
.roof-areas-panel[hidden] {
  display: none;
}

.roof-summary-heading,
.roof-area-banner-heading {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding: 14px 16px;
  border-left: 7px solid var(--green);
  background: var(--green-soft);
  color: #14522d;
}

.roof-summary-heading h2,
.roof-area-banner-heading strong {
  color: #14522d;
  font-size: 0.96rem;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.area-heading-title-row {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  min-width: 0;
}

.area-heading-title-row h2,
.area-heading-title-row strong {
  min-width: 0;
  margin: 0;
}

.area-rename-button {
  flex: 0 0 auto;
  min-height: 26px;
  padding: 4px 7px;
  border: 1px solid color-mix(in srgb, currentColor 35%, transparent);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.72);
  color: inherit;
  font-size: 0.64rem;
  font-weight: 760;
  line-height: 1;
}

.area-rename-button:hover:not(:disabled) {
  border-color: currentColor;
  background: #fff;
}

.structure-heading-kicker,
.roof-area-banner-heading .roof-area-line-count {
  color: #47765a;
}

.summary-banner-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  min-width: 0;
}

.metric-strip {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(180px, 1.35fr) repeat(3, minmax(105px, 0.8fr));
  margin: 0;
}

.metric {
  min-width: 0;
  padding: 13px 14px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

.metric:first-child {
  border-left: 0;
}

.metric strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.15;
}

.material-select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 32px;
  margin-top: 2px;
  padding: 5px 24px 5px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 730;
  line-height: 1.2;
}

.material-select:focus {
  border-color: var(--blue);
  outline: 2px solid rgba(36, 100, 180, 0.16);
  outline-offset: 1px;
}

.material-select:disabled {
  background: #eef1f3;
  color: var(--muted);
}

.metric:not(.metric-primary) strong {
  font-size: 0.88rem;
  white-space: nowrap;
}

.metric-subvalue {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 620;
  overflow-wrap: anywhere;
}

.roof-area-color-1 {
  --roof-area-accent: #176b38;
  --roof-area-bg: #edf7f0;
  --roof-area-soft: #d9efdf;
  --roof-area-ink: #14522d;
}

.roof-area-color-2 {
  --roof-area-accent: #2464b4;
  --roof-area-bg: #edf4fc;
  --roof-area-soft: #dceafa;
  --roof-area-ink: #1d4f8e;
}

.roof-area-color-3 {
  --roof-area-accent: #7153a6;
  --roof-area-bg: #f3effa;
  --roof-area-soft: #e9e1f6;
  --roof-area-ink: #523981;
}

.roof-area-color-4 {
  --roof-area-accent: #b7651b;
  --roof-area-bg: #fff5e8;
  --roof-area-soft: #fbe6cb;
  --roof-area-ink: #854411;
}

.roof-area-color-5 {
  --roof-area-accent: #287d7a;
  --roof-area-bg: #eaf7f6;
  --roof-area-soft: #d9eeec;
  --roof-area-ink: #1f5e5c;
}

.roof-area-color-6 {
  --roof-area-accent: #765145;
  --roof-area-bg: #f6f0ed;
  --roof-area-soft: #eaded8;
  --roof-area-ink: #573a31;
}

.siding-area-color {
  --roof-area-accent: var(--plum);
  --roof-area-bg: var(--plum-soft);
  --roof-area-soft: #eed9e7;
  --roof-area-ink: #6e2959;
}

.roof-area-metric[class*="roof-area-color-"] {
  border-color: var(--line);
  box-shadow: none;
}

.roof-area-metric[class*="roof-area-color-"] .metric-label,
.roof-area-metric[class*="roof-area-color-"] .metric-subvalue {
  color: var(--roof-area-ink);
}

.move-to-other-trades-button {
  min-height: 100%;
  padding: 9px;
  border: 0;
  border-left: 1px solid #e0b979;
  border-radius: 0;
  background: #fff9ef;
  color: #75501b;
  font-size: 0.71rem;
  font-weight: 760;
  line-height: 1.25;
  white-space: normal;
}

.move-to-other-trades-button:hover:not(:disabled) {
  border-color: #d6972e;
  background: #fff0d6;
  color: #56370e;
}

.roof-areas-panel {
  display: grid;
  gap: 8px;
}

.compact-panel-header {
  padding: 7px 2px 2px;
  border: 0;
}

.compact-panel-header p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.roof-area-banners {
  display: grid;
  gap: 8px;
}

.roof-area-banner {
  grid-template-columns: 172px minmax(0, 1fr);
}

.roof-area-banner-heading {
  border-left-color: var(--roof-area-accent);
  background: var(--roof-area-bg);
  color: var(--roof-area-ink);
}

.roof-area-banner-heading strong {
  color: var(--roof-area-ink);
}

.roof-area-banner-heading .roof-area-line-count {
  color: var(--roof-area-ink);
}

.roof-area-banner-heading .roof-area-summary-label {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.roof-area-banner-heading .roof-area-summary-label strong {
  min-width: 0;
}

.roof-area-banner-heading .roof-area-summary-label .area-rename-button {
  grid-column: 2;
  justify-self: start;
}

.roof-area-swatch {
  width: 9px;
  height: 9px;
  border: 1px solid var(--roof-area-accent);
  border-radius: 50%;
  background: var(--roof-area-accent);
}

.roof-area-line-count {
  font-size: 0.69rem;
  font-weight: 620;
}

.roof-area-metric-strip {
  grid-template-columns: minmax(180px, 1.35fr) repeat(3, minmax(105px, 0.8fr));
}

.roof-area-metric-strip .metric {
  padding: 13px 14px;
  background: var(--roof-area-bg, #fff);
}

.siding-summary-section .roof-summary-heading {
  border-left-color: var(--plum);
  background: var(--plum-soft);
}

.siding-summary-section .roof-summary-heading h2 {
  color: #6e2959;
}

.siding-summary-section .structure-heading-kicker {
  color: #8b5879;
}

.siding-metric {
  border-color: var(--line);
  background: var(--plum-soft);
  box-shadow: none;
}

.siding-metric .metric-label,
.siding-metric .metric-subvalue {
  color: var(--roof-area-ink);
}

.heading-supplement-value {
  display: grid;
  gap: 2px;
  width: 100%;
  margin-top: 5px;
  padding-top: 8px;
  border-top: 1px solid color-mix(in srgb, currentColor 22%, transparent);
}

.heading-supplement-value span {
  color: inherit;
  font-size: 0.59rem;
  font-weight: 780;
  text-transform: uppercase;
}

.heading-supplement-value strong {
  color: var(--roof-area-ink, #087b6b);
  font-size: 0.89rem;
}

.heading-supplement-value small {
  color: inherit;
  font-size: 0.64rem;
  line-height: 1.25;
}

.square-policy-control {
  display: grid;
  gap: 3px;
  margin-top: 6px;
}

.square-policy-control span {
  color: var(--muted);
  font-size: 0.61rem;
  font-weight: 720;
  text-transform: uppercase;
}

.square-policy-select {
  width: 100%;
  min-height: 25px;
  padding: 3px 5px;
  border: 1px solid color-mix(in srgb, var(--roof-area-accent, #7f8f98) 38%, #d8dfe3);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font-size: 0.64rem;
}

.other-trades-section {
  display: block;
  margin-bottom: 2px;
}

.other-trades-metric {
  display: grid;
  grid-template-columns: minmax(160px, 0.7fr) minmax(140px, 0.45fr) minmax(260px, 1.3fr);
  align-items: center;
  gap: 18px;
  padding: 11px 16px;
  border: 1px solid #e3bb7d;
  border-left: 7px solid var(--amber);
  border-radius: 4px;
  background: var(--amber-soft);
}

.other-trades-metric .metric-label {
  margin: 0;
  color: #85500d;
}

.other-trades-metric strong {
  font-size: 1rem;
}

.other-trades-metric .metric-subvalue {
  margin: 0;
  text-align: right;
}

.panel {
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.results-panel {
  min-width: 0;
  margin-top: 14px;
  overflow: hidden;
  scroll-margin-top: 58px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
}

.panel-kicker {
  display: block;
  margin-bottom: 4px;
  color: #7a878f;
}

#statusText {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
}

.warnings {
  margin: 10px 14px 0;
  padding: 11px 12px;
  border-left: 4px solid var(--amber);
  border-radius: 4px;
  background: #fff7e8;
  color: #6f4b12;
  font-size: 0.82rem;
}

.warnings ul {
  margin: 0;
  padding-left: 18px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 9px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th:nth-child(1),
td:nth-child(1) {
  width: 142px;
}

th:nth-child(3),
td:nth-child(3) {
  width: 50px;
}

th:nth-child(4),
td:nth-child(4) {
  width: 42px;
}

th:nth-child(5),
td:nth-child(5),
th:nth-child(6),
td:nth-child(6),
th:nth-child(7),
td:nth-child(7),
th:nth-child(8),
td:nth-child(8) {
  width: 65px;
}

th:nth-child(9),
td:nth-child(9) {
  width: 148px;
}

th {
  background: #e2e8eb;
  color: #34434c;
  font-size: 0.69rem;
  font-weight: 760;
  text-transform: uppercase;
  letter-spacing: 0;
}

td {
  font-size: 0.82rem;
}

.section-row td {
  padding: 13px 12px;
  border-top: 2px solid #b8c5cb;
  border-bottom: 1px solid #b8c5cb;
  background: #dce4e8;
  box-shadow: inset 4px 0 0 #71848e;
}

.section-row.roof-section-row td {
  background: var(--roof-area-bg);
  border-top-color: var(--roof-area-ink);
  box-shadow: inset 4px 0 0 var(--roof-area-ink);
}

.section-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #34434c;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: uppercase;
}

.section-row.roof-section-row .section-title {
  color: var(--roof-area-ink);
}

.status-cell {
  white-space: normal;
}

.bucket-select {
  display: block;
  width: 100%;
  min-width: 136px;
  min-height: 32px;
  padding: 5px 26px 5px 8px;
  border: 1px solid #aebbc2;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 710;
}

.bucket-select:focus {
  border-color: var(--blue);
  outline: 2px solid rgba(36, 100, 180, 0.16);
  outline-offset: 1px;
}

.line-item-note-input {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid #aebbc2;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.74rem;
}

.line-item-note-input:focus {
  border-color: var(--blue);
  outline: 2px solid rgba(36, 100, 180, 0.16);
  outline-offset: 1px;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.original-line {
  max-width: none;
  font-family: "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.line-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.71rem;
}

.document-source-row td {
  padding: 11px 14px;
  border-top: 2px solid #8d9aa2;
  border-bottom: 1px solid #b8c2c8;
  background: #e8edef;
}

.document-source-row div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.document-source-row strong {
  color: var(--ink);
  font-size: 0.88rem;
}

.document-source-row span {
  color: #58666e;
  font-size: 0.7rem;
  font-weight: 760;
  text-transform: uppercase;
}

.source-estimate-badge {
  display: inline-block;
  margin: 0 6px 2px 0;
  padding: 2px 5px;
  border-radius: 4px;
  background: #e8edef;
  color: #42515a;
  font-weight: 760;
}

.driver-badge,
.code-badge,
.saved-rule-badge {
  display: inline-block;
  margin-left: 5px;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.66rem;
  font-weight: 760;
}

.driver-badge {
  background: var(--blue-soft);
  color: var(--blue);
}

.code-badge {
  background: #f0e7ff;
  color: #5b21b6;
}

.saved-rule-badge {
  background: #e6f7f4;
  color: #11655d;
}

.numeric {
  text-align: right;
  white-space: nowrap;
}

.included-row td {
  background: var(--green-soft);
}

.included-row.roof-area-line td {
  background: var(--roof-area-bg);
}

.excluded-row td {
  background: var(--amber-soft);
}

.included-row td:first-child {
  box-shadow: inset 4px 0 var(--green);
}

.included-row.roof-area-line td:first-child {
  box-shadow: inset 4px 0 var(--roof-area-accent);
}

.excluded-row td:first-child {
  box-shadow: inset 4px 0 var(--amber);
}

.scope-pill,
.roof-area-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.67rem;
  font-weight: 760;
  white-space: nowrap;
}

.scope-pill {
  margin-top: 6px;
}

.included-pill {
  background: #d5ebdc;
  color: #14522d;
}

.roof-area-line .included-pill {
  background: var(--roof-area-accent);
  color: #fff;
}

.excluded-pill {
  background: #fbe3bf;
  color: #764708;
}

.roof-area-badge {
  gap: 5px;
  min-height: 21px;
  margin-left: 6px;
  border: 1px solid color-mix(in srgb, var(--roof-area-accent) 34%, transparent);
  background: var(--roof-area-soft);
  color: var(--roof-area-ink);
}

.empty-state {
  padding: 42px 16px;
  color: var(--muted);
  text-align: center;
}

.estimate-tools-panel {
  margin-top: 14px;
  scroll-margin-top: 58px;
}

.estimate-tools-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.75fr) minmax(360px, 1.25fr);
  gap: 0;
}

.tool-section {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 15px;
}

.tool-section + .tool-section {
  border-left: 1px solid var(--line);
}

.tool-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.tool-section-heading span {
  color: var(--muted);
  font-size: 0.72rem;
  text-align: right;
}

.field-row,
.checkbox-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(130px, 190px);
  align-items: center;
  gap: 12px;
}

.checkbox-row {
  grid-template-columns: 18px 1fr;
  cursor: pointer;
}

.field-row label,
.text-entry span,
.checkbox-row span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 680;
}

input[type="number"],
input[type="text"],
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
}

input[type="number"],
input[type="text"] {
  min-height: 36px;
  padding: 7px 9px;
}

input[type="number"] {
  text-align: right;
}

input:disabled,
textarea:disabled {
  background: #eef1f3;
  color: var(--muted);
  cursor: not-allowed;
}

.text-entry {
  display: grid;
  gap: 7px;
}

textarea {
  min-height: 170px;
  padding: 9px;
  resize: vertical;
  font-family: "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  font-size: 0.75rem;
  line-height: 1.4;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.reconciliation-panel {
  align-self: stretch;
  padding: 18px 16px;
  border-left: 1px solid var(--line-strong);
}

.reconciliation-heading {
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.reconciliation-heading .panel-kicker {
  color: #78858d;
}

.reconciliation-heading h2 {
  color: var(--ink);
}

.reconciliation-values {
  display: grid;
  gap: 0;
  margin: 0;
}

.reconciliation-values > div {
  display: grid;
  gap: 5px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.reconciliation-values dt {
  color: var(--muted);
  font-size: 0.71rem;
  font-weight: 720;
  text-transform: uppercase;
}

.reconciliation-values dd {
  margin: 0;
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 720;
}

.reconciliation-values .difference-row dd {
  color: #59cb7a;
}

.reconciliation-values .difference-row[data-state="warning"] dd {
  color: #ffb45f;
}

.assignment-status {
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
}

.assignment-status-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.assignment-status-copy strong {
  color: var(--ink);
  font-size: 1.35rem;
}

.assignment-status-copy span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 760;
  text-transform: uppercase;
}

.assignment-progress {
  width: 100%;
  height: 7px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 3px;
  background: #d7dfe3;
}

.assignment-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: #48b968;
  transition: width 200ms ease;
}

.assignment-status p {
  margin-top: 9px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

.audit-counts {
  display: grid;
  gap: 12px;
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
}

.audit-counts > div {
  display: grid;
  grid-template-columns: 9px 1fr auto;
  align-items: center;
  gap: 9px;
  color: #46545d;
  font-size: 0.76rem;
}

.audit-counts strong {
  color: var(--ink);
}

.audit-swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.main-roof-swatch {
  background: #3cb366;
}

.additional-roof-swatch {
  background: #4b90e1;
}

.siding-swatch {
  background: #b25d9c;
}

.other-trades-swatch {
  background: #dc922d;
}

.total-line-count {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 15px;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.total-line-count strong {
  color: var(--ink);
  font-size: 1rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 24, 29, 0.58);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  display: grid;
  gap: 14px;
  width: min(560px, 100%);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow);
}

.estimate-type-card {
  width: min(620px, 100%);
}

.estimate-type-card h2 {
  margin-top: 4px;
  font-size: 1.15rem;
}

.estimate-type-options {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.estimate-type-option {
  display: grid;
  grid-template-columns: 20px 16px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
}

.estimate-type-option:hover {
  border-color: #8d9aa2;
  background: #f8fafb;
}

.estimate-type-option:has(input:checked) {
  border-color: var(--green);
  background: var(--green-soft);
  box-shadow: inset 4px 0 0 var(--green);
}

.estimate-type-option:has(input:disabled) {
  opacity: 0.5;
  cursor: not-allowed;
}

.estimate-type-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.estimate-type-bubble {
  grid-column: 2;
  width: 15px;
  height: 15px;
  border: 2px solid #89969e;
  border-radius: 50%;
  background: #fff;
}

.estimate-type-option input:checked + .estimate-type-bubble {
  border: 4px solid var(--green);
}

.estimate-type-option > span:last-child {
  grid-column: 3;
}

.estimate-type-option strong,
.estimate-type-option small {
  display: block;
}

.estimate-type-option strong {
  color: var(--ink);
  font-size: 0.87rem;
}

.estimate-type-option small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.rename-area-card {
  width: min(460px, 100%);
}

.modal-input-error {
  margin: -5px 0 0;
  color: #b42318;
  font-size: 0.78rem;
  font-weight: 680;
}

.rename-area-actions {
  flex-wrap: wrap;
}

.rename-area-actions #resetAreaNameButton {
  margin-right: auto;
}

.modal-decision {
  color: var(--green);
  font-weight: 760;
}

.rule-preview {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-soft);
  font-family: "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  font-size: 0.8rem;
  line-height: 1.45;
}

.modal-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.modal-actions {
  display: flex;
  justify-content: end;
  gap: 10px;
}

.modal-actions button {
  min-width: 124px;
}

@media (max-width: 1220px) {
  .command-header {
    grid-template-columns: 220px minmax(180px, 1fr);
  }

  .header-actions {
    grid-column: 1 / -1;
    justify-content: start;
    padding-top: 10px;
    border-top: 1px solid var(--shell-line);
  }

  .command-layout {
    grid-template-columns: 176px minmax(0, 1fr);
  }

  .reconciliation-panel {
    position: static;
    grid-column: 2;
    display: grid;
    grid-template-columns: minmax(160px, 0.8fr) minmax(240px, 1fr) minmax(260px, 1.2fr);
    gap: 18px;
    min-height: 0;
    margin: 0 14px 28px;
    border: 1px solid var(--line-strong);
    border-radius: 5px;
  }

  .reconciliation-heading {
    grid-column: 1 / -1;
  }

  .reconciliation-values,
  .assignment-status,
  .audit-counts {
    border: 0;
  }

  .total-line-count {
    grid-column: 1 / -1;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 920px) {
  .command-header {
    grid-template-columns: 1fr;
  }

  .brand-lockup {
    padding: 0 0 10px;
    border-right: 0;
    border-bottom: 1px solid var(--shell-line);
  }

  .claimstar-logo {
    width: 205px;
    height: 64px;
  }

  .header-actions {
    grid-column: auto;
  }

  .project-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-estimates {
    grid-template-columns: 1fr;
  }

  .customer-cell {
    grid-column: 1 / -1;
  }

  .command-layout {
    grid-template-columns: 1fr;
  }

  .side-navigation {
    position: static;
    display: flex;
    min-height: auto;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line-strong);
  }

  .navigation-heading,
  .sidebar-rule-summary {
    display: none;
  }

  .navigation-link {
    grid-template-columns: 1fr;
    min-width: max-content;
    min-height: 46px;
    padding: 10px 16px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .navigation-marker {
    display: none;
  }

  .reconciliation-panel {
    grid-column: 1;
  }

  .estimate-tools-grid {
    grid-template-columns: 1fr;
  }

  .tool-section + .tool-section {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 760px) {
  .command-header {
    padding: 12px 14px;
  }

  .header-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .header-actions button,
  .header-actions .action-button {
    min-width: 0;
  }

  .primary-workspace {
    padding-right: 10px;
    padding-left: 10px;
  }

  .workspace-tabs {
    margin-right: -10px;
    margin-left: -10px;
    padding: 0 10px;
  }

  .roof-summary-section,
  .siding-summary-section,
  .roof-area-banner {
    grid-template-columns: 1fr;
  }

  .roof-summary-heading,
  .roof-area-banner-heading {
    min-height: 62px;
  }

  .metric-strip,
  .roof-area-metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-estimates {
    padding: 10px 14px;
  }

  .summary-banner-row {
    grid-template-columns: 1fr;
  }

  .move-to-other-trades-button {
    min-height: 40px;
    border-top: 1px solid #e0b979;
    border-left: 0;
  }

  .other-trades-metric {
    grid-template-columns: 1fr auto;
  }

  .other-trades-metric .metric-subvalue {
    grid-column: 1 / -1;
    text-align: left;
  }

  .reconciliation-panel {
    grid-template-columns: 1fr;
    margin: 0 10px 24px;
  }

  .reconciliation-values,
  .assignment-status,
  .audit-counts,
  .total-line-count {
    grid-column: 1;
  }

  .field-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  input[type="number"] {
    text-align: left;
  }
}

@media (max-width: 520px) {
  .project-summary {
    grid-template-columns: 1fr;
  }

  .customer-cell {
    grid-column: auto;
  }

  .workspace-tab {
    padding: 0 14px;
  }

  .metric-strip,
  .roof-area-metric-strip {
    grid-template-columns: 1fr;
  }

  .metric {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .metric:first-child {
    border-top: 0;
  }

  .tool-section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .tool-section-heading span {
    text-align: left;
  }

  .button-row {
    grid-template-columns: 1fr;
  }
}
