:root {
  --ink: #111827;
  --ink-700: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e2e6ec;
  --line-strong: #cbd3dd;
  --surface: #f7f9fc;
  --surface-2: #f1f4f8;
  --paper: #ffffff;
  --blue: #1018f4;
  --blue-dark: #0b12c7;
  --blue-soft: #f1f4ff;
  --green: #11845b;
  --green-soft: #eaf7f2;
  --orange: #e98916;
  --orange-soft: #fff5e8;
  --red: #e43d48;
  --red-soft: #fff0f1;
  --cyan: #168ca6;
  --cyan-soft: #eaf7fa;
  --violet: #6c5cad;
  --violet-soft: #f1eff9;
  --font-ui: "Work Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", Consolas, monospace;
  --topbar-height: 64px;
  --tabs-height: 52px;
  --radius: 4px;
  --panel-radius: 6px;
  --shadow-modal: 0 24px 80px rgba(15, 23, 42, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  background: var(--surface);
  font-family: var(--font-ui);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body:has(dialog[open]) {
  overflow: hidden;
}

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

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(16, 24, 244, 0.22);
  outline-offset: 2px;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

[hidden] {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  background:
    linear-gradient(rgba(17, 24, 39, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 24, 39, 0.018) 1px, transparent 1px),
    var(--surface);
  background-size: 28px 28px;
}

.login-screen,
.project-hub {
  min-height: 100vh;
  background:
    linear-gradient(rgba(17, 24, 39, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 24, 39, 0.018) 1px, transparent 1px),
    var(--surface);
  background-size: 28px 28px;
}

.login-screen {
  display: grid;
  padding: 24px;
  place-items: center;
}

.login-panel {
  display: grid;
  width: min(920px, 100%);
  grid-template-columns: 1fr 420px;
  min-height: 520px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
  overflow: hidden;
}

.login-brand {
  display: flex;
  padding: 36px;
  flex-direction: column;
  justify-content: space-between;
  color: var(--paper);
  background:
    linear-gradient(rgba(17, 24, 39, 0.9), rgba(17, 24, 39, 0.86)),
    linear-gradient(135deg, #1018f4, #11845b);
}

.login-brand strong {
  font-size: 24px;
  letter-spacing: -0.03em;
}

.login-brand .brand-mark {
  width: 42px;
  height: 42px;
  color: #fff;
}

.login-brand span {
  width: fit-content;
  padding: 5px 7px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 3px;
}

.login-form {
  display: flex;
  padding: 42px;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}

.login-form header {
  margin-bottom: 12px;
}

.login-form h1 {
  margin: 6px 0 0;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.login-status {
  min-height: 18px;
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.login-status:empty {
  display: none;
}

.login-status.is-error {
  color: var(--red);
}

.login-status.is-success {
  color: var(--green);
}

.login-form label,
.modal-body label {
  display: grid;
  gap: 7px;
}

.login-form label > span,
.modal-body label > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.login-form input,
.modal-body input,
.modal-body select {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.login-form input:focus,
.modal-body input:focus,
.modal-body select:focus {
  border-color: rgba(16, 24, 244, 0.55);
}

.hub-context {
  display: flex;
  margin-left: 18px;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
}

.hub-context i {
  width: 3px;
  height: 3px;
  background: var(--line-strong);
  border-radius: 50%;
}

.hub-context strong {
  color: var(--ink);
  font-weight: 600;
}

.project-hub-main {
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto;
  padding: 44px 0;
}

.hub-heading {
  display: flex;
  margin-bottom: 24px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.hub-heading h1,
.hub-heading p {
  margin: 0;
}

.hub-heading h1 {
  margin-top: 6px;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.hub-heading p {
  margin-top: 8px;
  color: var(--muted);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.project-empty {
  display: grid;
  min-height: 180px;
  padding: 32px;
  align-content: center;
  gap: 7px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-panel);
}

.project-empty strong {
  color: var(--ink);
  font-size: 18px;
}

.project-card {
  display: grid;
  min-height: 238px;
  padding: 18px;
  align-content: space-between;
  gap: 18px;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
}

.project-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.07);
}

.project-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.project-card-code {
  padding: 4px 7px;
  color: var(--muted);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 11px;
  border-radius: 3px;
}

.project-card h2 {
  margin: 12px 0 0;
  font-size: 20px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.project-card small,
.project-card span {
  color: var(--muted);
}

.project-card-head small {
  white-space: nowrap;
}

.project-card-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.project-card-meta div {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.project-card-meta span,
.project-card-meta strong {
  display: block;
}

.project-card-meta span {
  margin-bottom: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
}

.project-card-meta strong {
  font-size: 15px;
  font-weight: 600;
}

.project-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.project-card-foot b {
  color: var(--blue);
  font-weight: 600;
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  height: var(--topbar-height);
  padding: 0 24px;
  align-items: center;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  height: 100%;
  padding-right: 28px;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  border-right: 1px solid var(--line);
}

.brand strong {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.brand-mark {
  display: block;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  color: var(--ink);
}

.brand span {
  padding: 3px 6px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.11em;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.project-switcher {
  display: flex;
  height: 40px;
  margin-left: 18px;
  padding: 0 12px;
  align-items: center;
  gap: 9px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
}

.project-switcher:hover {
  background: var(--surface);
  border-color: var(--line);
}

.project-switcher > span:not(.project-code) {
  font-weight: 600;
}

.project-switcher svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.project-code {
  padding: 3px 6px;
  color: var(--muted);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 10px;
  border-radius: 3px;
}

.topbar-spacer {
  flex: 1;
}

.save-state {
  display: flex;
  margin-right: 12px;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.save-state span {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--green-soft);
}

.save-state strong {
  font-weight: 500;
}

.text-button {
  height: 36px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  border: 0;
  border-radius: var(--radius);
}

.text-button:hover {
  color: var(--ink);
  background: var(--surface);
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  margin-left: 10px;
  place-items: center;
  color: #233148;
  background: #e9effb;
  font-size: 12px;
  font-weight: 600;
  border: 0;
  border-radius: 50%;
}

.workspace-tabs {
  position: relative;
  z-index: 19;
  display: flex;
  height: var(--tabs-height);
  padding: 0 28px;
  align-items: stretch;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid var(--line);
}

.tab-list {
  display: flex;
  height: 100%;
  gap: 28px;
}

.workspace-tab {
  position: relative;
  display: flex;
  height: 100%;
  padding: 0 2px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  border: 0;
}

.workspace-tab svg {
  width: 17px;
  height: 17px;
}

.workspace-tab::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  content: "";
  background: var(--blue);
  opacity: 0;
  transform: scaleX(0.5);
  transition: opacity 140ms ease, transform 140ms ease;
}

.workspace-tab:hover {
  color: var(--ink);
}

.workspace-tab.active {
  color: var(--blue);
  font-weight: 600;
}

.workspace-tab.active::after {
  opacity: 1;
  transform: scaleX(1);
}

.workspace-context {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 11px;
}

.workspace-context i {
  width: 3px;
  height: 3px;
  background: var(--muted-2);
  border-radius: 50%;
}

.app-main {
  min-height: calc(100vh - var(--topbar-height) - var(--tabs-height));
}

.view {
  display: none;
  height: calc(100vh - var(--topbar-height) - var(--tabs-height));
  min-height: 620px;
  padding: 20px 28px 24px;
  flex-direction: column;
  animation: view-in 180ms ease both;
}

.view.active {
  display: flex;
}

@keyframes view-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.view-heading {
  display: flex;
  min-height: 62px;
  margin-bottom: 13px;
  align-items: flex-start;
  justify-content: space-between;
}

.eyebrow,
.panel-title span,
.detail-kicker,
.card-heading span,
.price-builder header span,
.summary-total-card span,
.heading-total span,
.modal-head span,
.modal-body label > span,
.calculated-preview span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.view-heading h1 {
  margin: 3px 0 2px;
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.view-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.heading-total {
  display: flex;
  min-width: 190px;
  padding-top: 5px;
  flex-direction: column;
  align-items: flex-end;
}

.heading-total strong {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.logistics-heading-total small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 500;
}

.prototype-notice {
  display: flex;
  min-height: 44px;
  margin-bottom: 12px;
  padding: 8px 12px;
  align-items: center;
  gap: 10px;
  color: #344054;
  background: #f7f8ff;
  border: 1px solid #dfe2ff;
  border-left: 3px solid var(--blue);
  border-radius: var(--radius);
}

.prototype-notice svg {
  width: 19px;
  height: 19px;
  flex: none;
  color: var(--blue);
}

.prototype-notice div {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 9px;
}

.prototype-notice strong {
  flex: none;
  font-size: 11px;
}

.prototype-notice span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.estimate-workspace,
.recipe-workspace {
  display: grid;
  min-height: 0;
  flex: 1;
  gap: 12px;
}

.estimate-workspace {
  grid-template-columns: clamp(300px, 23vw, 340px) minmax(0, 1fr) 330px;
}

.recipe-workspace {
  grid-template-columns: 220px minmax(0, 1fr) 330px;
}

.price-mode-switch {
  display: inline-flex;
  width: max-content;
  min-height: 38px;
  margin-bottom: 12px;
  padding: 3px;
  gap: 2px;
  background: #eef1f5;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.price-mode-switch button {
  min-width: 116px;
  padding: 0 13px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  border: 0;
  border-radius: 3px;
}

.price-mode-switch button:hover {
  color: var(--ink);
}

.price-mode-switch button.active {
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.price-mode-panel {
  display: none;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.price-mode-panel.active {
  display: flex;
}

.resource-workspace {
  display: grid;
  min-height: 0;
  flex: 1;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
}

.template-explainer {
  display: flex;
  min-height: 42px;
  margin-bottom: 10px;
  padding: 8px 12px;
  align-items: center;
  gap: 10px;
  color: var(--ink-700);
  background: #f7f8ff;
  font-size: 10px;
  border: 1px solid #dfe2ff;
  border-left: 3px solid var(--blue);
  border-radius: var(--radius);
}

.template-explainer strong {
  flex: none;
  color: var(--ink);
}

.template-explainer span {
  color: var(--muted);
}

.estimate-workspace.detail-hidden {
  grid-template-columns: clamp(300px, 23vw, 340px) minmax(0, 1fr);
}

.recipe-workspace.detail-hidden {
  grid-template-columns: 220px minmax(0, 1fr);
}

.structure-card,
.table-card,
.detail-panel,
.summary-card,
.price-builder,
.summary-total-card {
  min-height: 0;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
}

.structure-card {
  display: flex;
  overflow: hidden;
  flex-direction: column;
}

.panel-title {
  display: flex;
  min-height: 63px;
  padding: 13px 14px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.panel-action {
  padding: 5px 0;
  color: var(--blue);
  background: transparent;
  border: 0;
  font-size: 9px;
  font-weight: 650;
}

.panel-action:hover {
  text-decoration: underline;
}

.panel-action:disabled {
  color: var(--muted);
  cursor: default;
  text-decoration: none;
}

.panel-title strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
  font-weight: 600;
}

.structure-search-wrap {
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--line);
}

.structure-search {
  display: flex;
  min-height: 38px;
  padding: 0 9px;
  align-items: center;
  gap: 7px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.structure-search:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(16, 24, 244, 0.12);
}

.structure-search svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-width: 1.5;
}

.structure-search input {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font: inherit;
  font-size: 11px;
}

.structure-search-wrap p {
  margin: 6px 2px 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.structure-list {
  padding: 7px 0;
  overflow: auto;
  flex: 1;
}

.heading-tree-row {
  display: grid;
  padding-left: var(--tree-indent, 0);
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: stretch;
}

.heading-tree-row[draggable="true"] {
  cursor: grab;
}

.heading-tree-row.is-dragging {
  opacity: 0.48;
}

.heading-tree-row.all {
  padding-left: 0;
}

.tree-chevron {
  display: grid;
  width: 20px;
  min-height: 42px;
  padding: 0;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
}

.tree-chevron svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
  transition: transform 120ms ease;
}

.tree-chevron[aria-expanded="false"] svg {
  transform: rotate(-90deg);
}

.tree-chevron.empty {
  pointer-events: none;
  visibility: hidden;
}

.structure-button {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 46px;
  padding: 7px 13px;
  align-items: center;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 7px;
  text-align: left;
  background: transparent;
  border: 0;
}

.structure-button.tree {
  min-width: 0;
  min-height: 42px;
  padding: 5px 8px 5px 5px;
  grid-template-columns: 17px 36px minmax(0, 1fr) auto;
  gap: 5px;
}

.heading-library .heading-tree-row {
  padding-left: min(var(--tree-indent, 0px), 30px);
}

.heading-library .structure-button.tree {
  min-height: 54px;
  padding-block: 7px;
  grid-template-areas:
    "drag ref action"
    "drag label action";
  grid-template-columns: 17px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  row-gap: 2px;
}

.heading-library .heading-drag-handle {
  grid-area: drag;
  align-self: stretch;
  height: auto;
}

.heading-library .structure-ref {
  grid-area: ref;
}

.heading-library .structure-label {
  min-width: 0;
  grid-area: label;
}

.heading-library .heading-add-button {
  grid-area: action;
  align-self: center;
}

.heading-drag-handle {
  display: grid;
  width: 17px;
  height: 28px;
  place-items: center;
  color: #94a3b8;
}

.heading-drag-handle svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.heading-add-button {
  display: inline-flex;
  min-width: 28px;
  min-height: 30px;
  padding: 0 5px;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--blue);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  font-size: 8px;
  font-weight: 650;
  white-space: nowrap;
}

.heading-add-button svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.heading-add-button:hover:not(:disabled),
.heading-add-button:focus-visible {
  background: var(--blue-soft);
  border-color: #cbd2ff;
}

.heading-add-button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.heading-add-button:disabled {
  color: var(--green);
  cursor: default;
  opacity: 1;
}

.structure-button.context {
  background: #fafbff;
}

.structure-empty {
  display: grid;
  min-height: 116px;
  padding: 18px;
  place-content: center;
  gap: 5px;
  text-align: center;
}

.structure-empty strong {
  font-size: 11px;
}

.structure-empty span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.structure-button::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  content: "";
  background: var(--blue);
  opacity: 0;
}

.structure-button:hover {
  background: var(--surface);
}

.structure-button.active {
  color: var(--blue);
  background: var(--blue-soft);
}

.structure-button.active::before {
  opacity: 1;
}

.structure-ref {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.structure-button.active .structure-ref {
  color: var(--blue);
}

.structure-label strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.structure-label small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.heading-library .structure-label strong {
  overflow: visible;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.structure-sum {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  white-space: nowrap;
}

.structure-foot {
  display: flex;
  min-height: 52px;
  padding: 10px 13px;
  flex-direction: column;
  justify-content: center;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.structure-foot span {
  color: var(--muted);
  font-size: 9px;
}

.structure-foot strong {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
}

.table-card {
  display: flex;
  overflow: hidden;
  flex-direction: column;
}

.table-toolbar {
  display: flex;
  min-height: 63px;
  padding: 10px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.estimate-card {
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.heading-drop-zone {
  display: flex;
  min-height: 38px;
  padding: 7px 11px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--muted);
  background: #fbfcff;
  border-bottom: 1px dashed var(--line-strong);
  font-size: 9px;
  font-weight: 550;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.heading-drop-zone svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.drop-mobile {
  display: none;
}

.estimate-card.drag-available {
  border-color: #aeb6ff;
}

.estimate-card.drag-available .heading-drop-zone {
  color: var(--blue);
  background: #f6f7ff;
  border-bottom-color: #aeb6ff;
}

.estimate-card.drag-over {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(16, 24, 244, 0.14);
}

.estimate-card.drag-over .heading-drop-zone {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: var(--blue);
}

.estimate-card.drag-over .heading-drop-zone .drop-desktop {
  font-size: 0;
}

.estimate-card.drag-over .heading-drop-zone .drop-desktop::after {
  content: "Släpp för att lägga till rubriken";
  font-size: 9px;
}

.toolbar-note {
  margin-left: auto;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.table-toggle {
  margin-left: auto;
  color: var(--blue);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.search-field {
  display: flex;
  width: min(360px, 100%);
  height: 40px;
  padding: 0 10px;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.search-field:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(16, 24, 244, 0.08);
}

.search-field svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
}

.search-field input {
  min-width: 0;
  height: 100%;
  padding: 0;
  flex: 1;
  background: transparent;
  font-size: 12px;
  border: 0;
  outline: 0;
}

.search-field input::placeholder {
  color: var(--muted-2);
}

.search-field kbd {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: var(--muted);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.button {
  display: inline-flex;
  min-height: 40px;
  padding: 0 14px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius);
  transition: background 130ms ease, border-color 130ms ease, transform 130ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button svg {
  width: 17px;
  height: 17px;
}

.button.primary {
  color: #fff;
  background: var(--blue);
  border: 1px solid var(--blue);
  box-shadow: 0 5px 14px rgba(16, 24, 244, 0.16);
}

.button.primary:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

.button.secondary {
  color: var(--ink-700);
  background: var(--paper);
  border: 1px solid var(--line-strong);
}

.button.secondary:hover {
  background: var(--surface);
  border-color: #aeb8c6;
}

.button.small {
  min-height: 34px;
  padding: 0 10px;
  font-size: 11px;
}

.button.full {
  width: 100%;
}

.table-scroll {
  position: relative;
  min-height: 0;
  overflow: auto;
  flex: 1;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
}

.data-table th {
  position: sticky;
  z-index: 2;
  top: 0;
  height: 39px;
  padding: 0 11px;
  color: var(--muted);
  background: #fbfcfe;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-align: left;
  white-space: nowrap;
}

.data-table .numeric {
  text-align: right;
}

.estimate-table th:nth-child(1) { width: auto; }
.estimate-table th:nth-child(2) { width: 92px; }
.estimate-table th:nth-child(3) { width: 64px; }
.estimate-table th:nth-child(4) { width: 102px; }
.estimate-table th:nth-child(5) { width: 116px; }

.resource-price-table th:nth-child(1) { width: auto; }
.resource-price-table th:nth-child(2) { width: 118px; }
.resource-price-table th:nth-child(3) { width: 74px; }
.resource-price-table th:nth-child(4) { width: 150px; }
.resource-price-table th:nth-child(5) { width: 220px; }

.resource-price-table {
  min-width: 760px;
}

.resource-price-row .description-main {
  gap: 9px;
}

.resource-price-row .description-cell small {
  margin-left: 36px;
}

.price-scope {
  display: inline-flex;
  min-height: 18px;
  padding: 0 6px;
  flex: none;
  align-items: center;
  font-size: 8px;
  font-style: normal;
  font-weight: 650;
  border: 1px solid;
  border-radius: 999px;
}

.price-scope.global {
  color: #164e63;
  background: var(--cyan-soft);
  border-color: #bce7ef;
}

.price-scope.local {
  color: #6d4a17;
  background: var(--orange-soft);
  border-color: #f2d8b5;
}

.mono-cell {
  font-family: var(--font-mono);
}

.register-price-input {
  display: flex;
  width: 120px;
  height: 34px;
  margin-left: auto;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.register-price-input:focus-within {
  background: var(--paper);
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(16, 24, 244, 0.08);
}

.register-price-input input {
  min-width: 0;
  height: 100%;
  padding: 0 7px;
  flex: 1;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-align: right;
  border: 0;
  outline: 0;
}

.register-price-input b {
  padding-right: 8px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
}

.usage-cell strong,
.usage-cell small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usage-cell strong {
  font-size: 10px;
  font-weight: 600;
}

.usage-cell small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.resource-empty-row td {
  height: 180px;
  color: var(--muted);
  text-align: center;
}

.resource-empty-row strong,
.resource-empty-row span {
  display: block;
}

.resource-empty-row strong {
  color: var(--ink);
}

.resource-empty-row span {
  margin-top: 4px;
}

.resource-empty {
  display: grid;
  gap: 4px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 4px;
  background: var(--surface);
}

.resource-empty strong {
  font-size: 13px;
}

.resource-empty span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.data-table td {
  height: 52px;
  padding: 6px 11px;
  background: var(--paper);
  font-size: 11px;
  vertical-align: middle;
}

.group-row td {
  height: 38px;
  padding: 0 11px;
  color: var(--ink-700);
  background: #f2f4f6;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.045em;
}

.heading-row {
  cursor: default;
}

.heading-row td {
  height: auto;
  padding: 0;
  background: #f8fafc;
}

.heading-row:hover td {
  background: var(--blue-soft);
}

.heading-row:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.heading-row-content {
  display: grid;
  min-height: 42px;
  padding: 6px 11px 6px calc(11px + var(--heading-indent, 0px));
  align-items: center;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  column-gap: 10px;
}

.heading-code {
  color: var(--blue);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
}

.heading-row-content > strong {
  overflow: hidden;
  color: var(--ink-700);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.heading-row-content > small {
  grid-column: 2;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.03em;
}

.heading-row-side {
  display: flex;
  grid-row: 1 / span 2;
  grid-column: 3;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.heading-row-side > b {
  color: var(--ink-700);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 550;
  white-space: nowrap;
}

.heading-add-item-button {
  display: inline-flex;
  min-height: 30px;
  padding: 0 8px;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--blue);
  background: var(--paper);
  border: 1px solid #cbd2ff;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 650;
  white-space: nowrap;
}

.heading-add-item-button:hover,
.heading-add-item-button:focus-visible {
  background: var(--blue-soft);
  border-color: var(--blue);
}

.heading-add-item-button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.heading-add-item-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.7;
}

.heading-remove-button {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  flex: none;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
}

.heading-remove-button:hover,
.heading-remove-button:focus-visible {
  color: var(--red);
  background: var(--paper);
  border-color: #f5bfc3;
}

.heading-remove-button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.heading-remove-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.6;
}

.heading-row.context-heading td {
  background: #fbfcfe;
}

.heading-row.context-heading .heading-code,
.heading-row.context-heading .heading-row-content > strong {
  color: var(--muted);
}

.heading-row.level-0 td {
  background: #edf1f6;
  border-top-color: #d4dae3;
}

.heading-row.level-0 .heading-row-content {
  min-height: 48px;
}

.heading-row.level-0 .heading-row-content > strong {
  color: var(--ink);
  font-size: 11px;
}

.heading-row.level-1 td {
  background: #f3f5f8;
}

.heading-row.level-2 td {
  background: #f7f8fa;
}

.group-row span {
  margin-left: 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0;
}

.estimate-row,
.recipe-row {
  position: relative;
  cursor: pointer;
}

.estimate-row td:first-child,
.recipe-row td:first-child {
  border-left: 3px solid transparent;
}

.estimate-row:hover td,
.recipe-row:hover td {
  background: #fafcff;
}

.estimate-row.selected td,
.recipe-row.selected td {
  background: var(--blue-soft);
  border-bottom-color: #d8defe;
}

.estimate-row.selected td:first-child,
.recipe-row.selected td:first-child {
  border-left-color: var(--blue);
}

.row-open-button {
  display: block;
  width: 100%;
  padding: 8px 0;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
}

.row-open-button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.description-cell {
  min-width: 0;
}

.description-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.prototype-ref {
  display: inline-flex;
  min-width: 62px;
  padding: 2px 5px;
  justify-content: center;
  color: var(--muted);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.description-main strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.description-cell small {
  display: block;
  margin-top: 3px;
  margin-left: 70px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.number-cell,
.money-cell {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 10px !important;
  font-variant-numeric: tabular-nums;
}

.sum-cell {
  color: var(--ink);
  background: #fbfcfd !important;
  font-weight: 600;
}

.qty-input {
  width: 78px;
  height: 30px;
  padding: 0 6px;
  text-align: right;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 10px;
  border: 1px solid transparent;
  border-radius: 3px;
  outline: 0;
}

.qty-input:hover {
  background: var(--paper);
  border-color: var(--line);
}

.qty-input:focus {
  background: var(--paper);
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(16, 24, 244, 0.08);
}

.empty-state {
  display: flex;
  min-height: 180px;
  padding: 30px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
  font-size: 13px;
}

.empty-state span {
  margin-top: 4px;
  font-size: 11px;
}

.table-footer {
  display: flex;
  min-height: 38px;
  padding: 0 11px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  background: #fbfcfe;
  font-size: 9px;
  border-top: 1px solid var(--line);
}

.table-footer strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 500;
}

.detail-panel {
  display: flex;
  overflow: hidden;
  flex-direction: column;
}

.detail-panel[hidden] {
  display: none;
}

.detail-head {
  display: flex;
  min-height: 64px;
  padding: 11px 13px;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.detail-head strong {
  display: block;
  max-width: 260px;
  margin-top: 3px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-body {
  min-height: 0;
  overflow: auto;
  flex: 1;
}

.detail-section {
  padding: 13px;
  border-bottom: 1px solid var(--line);
}

.detail-section:last-child {
  border-bottom: 0;
}

.detail-section-title {
  display: flex;
  margin-bottom: 10px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.11em;
}

.detail-section-title button {
  padding: 0;
  color: var(--blue);
  background: transparent;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0;
  border: 0;
}

.recipe-link {
  display: flex;
  width: 100%;
  min-height: 42px;
  padding: 8px 9px;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.recipe-link:hover {
  background: var(--blue-soft);
  border-color: #cfd5ff;
}

.recipe-link span {
  min-width: 0;
}

.recipe-link strong,
.recipe-link small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipe-link strong {
  font-size: 10px;
  font-weight: 600;
}

.recipe-link small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.recipe-link b {
  color: var(--blue);
  font-size: 9px;
  font-weight: 600;
}

.row-edit-grid {
  display: grid;
  grid-template-columns: 1fr 82px;
  gap: 7px;
}

.row-edit-field {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.row-edit-field.wide {
  grid-column: 1 / -1;
}

.row-edit-field span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.row-edit-field input,
.row-edit-field select {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 8px;
  background: var(--surface);
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.row-edit-field select {
  padding-right: 26px;
}

.row-edit-field input:focus,
.row-edit-field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(16, 24, 244, 0.08);
}

.quantity-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.metric-box {
  min-height: 58px;
  padding: 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metric-box span {
  display: block;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.metric-box strong {
  display: block;
  margin-top: 7px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
}

.resource-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.resource-item {
  display: grid;
  min-height: 48px;
  padding: 7px;
  align-items: center;
  grid-template-columns: 29px minmax(0, 1fr) auto;
  gap: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.resource-item.editable {
  min-height: 92px;
  padding: 6px;
  align-items: start;
  grid-template-columns: 27px repeat(3, minmax(0, 1fr)) 22px;
  grid-template-areas:
    "type copy copy copy delete"
    ". quantity unit price .";
  gap: 5px;
}

.resource-item.editable > .resource-type {
  grid-area: type;
}

.resource-type {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  font-size: 9px;
  font-weight: 700;
  border-radius: 3px;
}

.resource-type.material { color: var(--cyan); background: var(--cyan-soft); }
.resource-type.labor { color: var(--orange); background: var(--orange-soft); }
.resource-type.machine { color: var(--violet); background: var(--violet-soft); }
.resource-type.subcontract { color: var(--green); background: var(--green-soft); }

.resource-copy {
  min-width: 0;
}

.resource-copy strong,
.resource-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-copy strong {
  font-size: 9px;
  font-weight: 600;
}

.resource-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
}

.resource-edit-copy {
  display: block;
  min-width: 0;
  grid-area: copy;
}

.resource-edit-field {
  display: block;
  min-width: 0;
}

.resource-edit-field > span {
  display: block;
  height: 13px;
  overflow: hidden;
  color: var(--muted);
  font-size: 6px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-quantity-field {
  grid-area: quantity;
}

.resource-unit-field {
  grid-area: unit;
}

.resource-price-field {
  grid-area: price;
}

.resource-name-input,
.resource-meta-row select,
.resource-meta-row input,
.resource-type-select {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background: var(--surface);
  font-size: 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  outline: 0;
}

.resource-name-input {
  height: 25px;
  padding: 0 5px;
  font-weight: 600;
}

.resource-meta-row {
  display: grid;
  margin-top: 3px;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 3px;
}

.resource-meta-row select,
.resource-meta-row input {
  height: 21px;
  padding: 0 3px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.resource-type-select {
  height: 21px;
  margin-top: 3px;
  padding: 0 3px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.resource-name-input:focus,
.resource-meta-row select:focus,
.resource-meta-row input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(16, 24, 244, 0.08);
}

.resource-type-select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(16, 24, 244, 0.08);
}

.resource-item > strong {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
}

.resource-input {
  width: 100%;
  height: 29px;
  padding: 0 5px;
  text-align: right;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 9px;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.resource-unit-input {
  text-align: center;
}

.resource-item.linked input[readonly],
.resource-item.linked select:disabled {
  color: var(--muted);
  background: #f3f6fa;
  cursor: default;
}

.resource-item.linked .linked-price {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: #d9ddff;
}

.detail-section-actions {
  display: flex;
  gap: 8px;
}

.resource-add-row {
  display: grid;
  margin-bottom: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.resource-add-row select,
.resource-add-row button {
  min-width: 0;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 10px;
}

.resource-add-row select {
  padding: 0 8px;
  color: var(--ink);
  background: var(--paper);
}

.resource-add-row button {
  padding: 0 10px;
  color: var(--blue);
  background: var(--blue-soft);
  border-color: #d9ddff;
  font-weight: 600;
}

.delete-resource {
  display: grid;
  width: 22px;
  height: 25px;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 3px;
  grid-area: delete;
}

.delete-resource:hover {
  color: var(--red);
  background: var(--red-soft);
}

.delete-resource svg {
  width: 14px;
  height: 14px;
}

.cost-breakdown {
  display: grid;
  grid-template-columns: 1fr auto;
  row-gap: 7px;
  font-size: 9px;
}

.cost-breakdown span {
  color: var(--muted);
}

.cost-breakdown strong {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 500;
}

.detail-total {
  display: flex;
  margin-top: 11px;
  padding-top: 11px;
  align-items: flex-end;
  justify-content: space-between;
  border-top: 1px solid var(--line);
}

.detail-total span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.09em;
}

.detail-total strong {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
}

.assumption-box {
  padding: 9px;
  color: #6d4a17;
  background: var(--orange-soft);
  font-size: 9px;
  line-height: 1.5;
  border: 1px solid #f2d8b5;
  border-radius: var(--radius);
}

.detail-actions {
  display: flex;
  padding: 11px 13px;
  gap: 7px;
  border-top: 1px solid var(--line);
}

.detail-actions .button {
  flex: 1;
}

.icon-button {
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
}

.icon-button:hover {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.icon-button svg {
  width: 16px;
  height: 16px;
}

.open-detail {
  position: fixed;
  z-index: 10;
  right: 16px;
  bottom: 18px;
  height: 38px;
  padding: 0 13px;
  color: #fff;
  background: var(--blue);
  font-size: 11px;
  font-weight: 600;
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(16, 24, 244, 0.2);
}

.recipe-table th:nth-child(1) { width: auto; }
.recipe-table th:nth-child(2) { width: 58px; }
.recipe-table th:nth-child(n+3) { width: 96px; }

.recipe-name strong,
.recipe-name small {
  display: block;
}

.recipe-name strong {
  font-size: 10px;
  font-weight: 600;
}

.recipe-name small {
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
}

.recipe-total {
  color: var(--blue);
  font-weight: 600;
}

.summary-layout {
  display: grid;
  min-height: 0;
  flex: 1;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 12px;
}

.summary-main {
  display: grid;
  min-height: 0;
  grid-template-rows: 110px minmax(245px, 1fr) 190px;
  gap: 12px;
}

.summary-total-card {
  display: flex;
  padding: 18px 20px;
  align-items: center;
  justify-content: space-between;
  border-left: 4px solid var(--blue);
}

.summary-total-card > div:first-child {
  display: flex;
  flex-direction: column;
}

.summary-total-card > div:first-child > strong {
  margin-top: 5px;
  font-family: var(--font-mono);
  font-size: 29px;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.summary-total-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.summary-ratio {
  display: flex;
  min-width: 160px;
  min-height: 60px;
  padding-left: 24px;
  justify-content: center;
  flex-direction: column;
  border-left: 1px solid var(--line);
}

.summary-ratio strong {
  margin-top: 6px;
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 18px;
}

.summary-card {
  display: flex;
  overflow: hidden;
  flex-direction: column;
}

.card-heading {
  display: flex;
  min-height: 58px;
  padding: 11px 14px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.card-heading strong {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  font-weight: 600;
}

.summary-table-wrap {
  min-height: 0;
  overflow: auto;
  flex: 1;
}

.summary-table th:first-child { width: 31%; }
.summary-table th:not(:first-child) { width: 13.8%; }

.summary-table td {
  height: 43px;
  font-size: 10px;
}

.summary-table tbody td:first-child strong,
.summary-table tbody td:first-child small {
  display: block;
}

.summary-table tbody td:first-child strong {
  font-size: 10px;
  font-weight: 600;
}

.summary-table tbody td:first-child small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-table tfoot td {
  background: var(--surface);
  font-weight: 600;
  border-bottom: 0;
  border-top: 1px solid var(--line-strong);
}

.review-card {
  min-height: 0;
}

.review-list {
  min-height: 0;
  overflow: auto;
  flex: 1;
}

.review-list button {
  display: grid;
  width: 100%;
  min-height: 43px;
  padding: 7px 13px;
  align-items: center;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 9px;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.review-list button:last-child {
  border-bottom: 0;
}

.review-list button:hover {
  background: var(--surface);
}

.review-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.review-dot.high { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.review-dot.medium { background: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft); }

.review-list span strong,
.review-list span small {
  display: block;
}

.review-list span strong {
  font-size: 10px;
  font-weight: 600;
}

.review-list span small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.review-list b {
  color: var(--blue);
  font-size: 9px;
  font-weight: 600;
}

.price-builder {
  display: flex;
  overflow: hidden;
  flex-direction: column;
}

.price-builder > header {
  min-height: 66px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
}

.price-builder header strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  font-weight: 600;
}

.price-row,
.markup-row {
  display: grid;
  min-height: 68px;
  padding: 10px 14px;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) 76px 92px;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.price-row.base {
  min-height: 58px;
  grid-template-columns: minmax(0, 1fr) auto;
  background: var(--surface);
}

.price-row > span,
.markup-row > span:first-child strong,
.markup-row > span:first-child small {
  display: block;
}

.price-row > span,
.markup-row > span:first-child strong {
  font-size: 10px;
  font-weight: 600;
}

.markup-row > span:first-child small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
}

.price-row > strong,
.markup-row output {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
}

.percent-input,
.input-suffix {
  display: flex !important;
  height: 36px;
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.percent-input:focus-within,
.input-suffix:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(16, 24, 244, 0.08);
}

.percent-input input,
.input-suffix input {
  min-width: 0;
  height: 100%;
  padding: 0 4px 0 8px;
  flex: 1;
  text-align: right;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 10px;
  border: 0;
  outline: 0;
}

.percent-input b,
.input-suffix b {
  padding-right: 9px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
}

.bid-result {
  display: flex;
  min-height: 118px;
  padding: 15px;
  justify-content: center;
  flex-direction: column;
  color: #fff;
  background: var(--ink);
}

.bid-result span {
  color: #aeb9c8;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.bid-result strong {
  margin-top: 7px;
  font-family: var(--font-mono);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.bid-result small {
  margin-top: 3px;
  color: #aeb9c8;
  font-size: 9px;
}

.price-builder > .button {
  margin: 13px 14px 0;
}

.price-builder > p {
  margin: 9px 15px 14px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.5;
  text-align: center;
}

.modal {
  width: min(510px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  padding: 0;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-radius: var(--panel-radius);
  box-shadow: var(--shadow-modal);
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(2px);
}

.modal[open] {
  animation: modal-in 160ms ease both;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal form {
  display: flex;
  max-height: calc(100vh - 40px);
  flex-direction: column;
}

.modal-head {
  display: flex;
  min-height: 68px;
  padding: 13px 16px;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 3px 0 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.modal-body {
  padding: 16px;
  overflow: auto;
}

.modal-body > label,
.modal-body .form-grid > label {
  display: flex;
  margin-bottom: 13px;
  flex-direction: column;
}

.modal-body label > span:first-child {
  margin-bottom: 5px;
}

.modal-body input:not(.percent-input input):not(.input-suffix input),
.modal-body select {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: 0;
}

.modal-body input:focus,
.modal-body select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(16, 24, 244, 0.08);
}

.heading-picker {
  min-width: 0;
  margin: 0 0 13px;
  padding: 0;
  border: 0;
}

.heading-picker legend {
  margin: 0 0 7px;
  padding: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.heading-search-control {
  position: relative;
  display: block !important;
  margin: 0 0 7px !important;
}

.heading-search-control svg {
  position: absolute;
  top: 50%;
  left: 11px;
  z-index: 1;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
  transform: translateY(-50%);
  pointer-events: none;
}

.heading-search-control input {
  padding-left: 36px !important;
}

.heading-picker-status {
  display: block;
  min-height: 16px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.heading-picker-status.is-empty {
  color: var(--red);
}

.row-heading-picker .heading-search-control {
  margin-bottom: 3px !important;
}

.row-heading-picker .heading-picker-status {
  margin-top: 0;
  font-size: 9px;
}

.project-location-field {
  margin-bottom: 13px;
}

.project-location-field > label {
  display: flex;
  flex-direction: column;
}

.project-location-field .location-search-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: normal;
}

.location-search-control .location-search-button {
  min-height: 40px;
  padding: 0 12px;
  box-shadow: none;
}

.location-search-control .location-search-button[aria-busy="true"] {
  color: var(--muted);
  background: var(--surface);
  cursor: wait;
}

.location-search-help {
  margin: 5px 1px 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.location-search-status {
  display: flex;
  min-height: 32px;
  margin-top: 7px;
  padding: 7px 9px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  background: var(--surface);
  font-size: 9px;
  line-height: 1.4;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.location-search-status::before {
  display: grid;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  place-items: center;
  color: var(--muted);
  content: "i";
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.location-search-status.is-loading::before {
  content: "";
  border-color: var(--line-strong);
  border-top-color: var(--blue);
  animation: location-spin 650ms linear infinite;
}

.location-search-status.is-success {
  color: #0d6d4b;
  background: #f2fbf7;
  border-color: #cde9dc;
}

.location-search-status.is-success::before {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
  content: "✓";
}

.location-search-status.is-warning {
  color: #75501b;
  background: var(--orange-soft);
  border-color: #eed4ad;
}

.location-search-status.is-warning::before {
  color: #75501b;
  border-color: #d6a85f;
  content: "!";
}

.location-search-status.is-error {
  color: #9f2630;
  background: var(--red-soft);
  border-color: #f0c5c9;
}

.location-search-status.is-error::before {
  color: #9f2630;
  border-color: #df8e95;
  content: "!";
}

@keyframes location-spin {
  to { transform: rotate(360deg); }
}

.location-search-results {
  margin-top: 6px;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.location-result {
  display: grid;
  width: 100%;
  min-height: 58px;
  padding: 9px 10px;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  text-align: left;
  background: var(--paper);
  border: 0;
  border-bottom: 1px solid var(--line);
}

.location-result:last-child {
  border-bottom: 0;
}

.location-result:hover,
.location-result:focus-visible {
  background: var(--blue-soft);
}

.location-result span,
.location-result strong,
.location-result small {
  display: block;
  min-width: 0;
}

.location-result strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 10px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-result small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.35;
}

.location-result b {
  color: var(--blue);
  font-size: 9px;
  font-weight: 600;
}

.location-map-toggle {
  display: inline-flex;
  min-height: 34px;
  margin-top: 6px;
  padding: 0;
  align-items: center;
  color: var(--blue);
  background: transparent;
  font-size: 9px;
  font-weight: 600;
  border: 0;
}

.location-map-toggle:hover {
  text-decoration: underline;
}

.location-map-panel {
  margin-top: 5px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.location-picker-map {
  width: 100%;
  height: 220px;
  background: #edf1f6;
}

.location-map-panel > p {
  margin: 0;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.4;
  border-top: 1px solid var(--line);
}

.form-grid {
  display: grid;
  gap: 10px;
}

.form-grid.two {
  grid-template-columns: 1fr 1fr;
}

.input-suffix {
  height: 40px;
}

.license-note {
  padding: 11px;
  color: #353e7a;
  background: #f7f8ff;
  border: 1px solid #dfe2ff;
  border-left: 3px solid var(--blue);
  border-radius: var(--radius);
}

.license-note.neutral {
  color: var(--ink-700);
  background: var(--surface);
  border-color: var(--line);
  border-left-color: var(--muted-2);
}

.license-note strong {
  font-size: 10px;
}

.license-note p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.calculated-preview {
  display: flex;
  min-height: 52px;
  padding: 9px 11px;
  align-items: center;
  justify-content: space-between;
  background: var(--blue-soft);
  border: 1px solid #d9defd;
  border-radius: var(--radius);
}

.calculated-preview strong {
  font-family: var(--font-mono);
  font-size: 15px;
}

.modal-actions {
  display: flex;
  min-height: 64px;
  padding: 11px 16px;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  background: #fbfcfe;
  border-top: 1px solid var(--line);
}

.toast {
  position: fixed;
  z-index: 100;
  right: 20px;
  bottom: 20px;
  display: flex;
  min-width: 230px;
  min-height: 44px;
  padding: 9px 13px;
  align-items: center;
  gap: 9px;
  color: #f8fafc;
  background: var(--ink);
  font-size: 11px;
  border: 1px solid #2a3547;
  border-radius: var(--radius);
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-icon {
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  color: #a7f3d0;
  background: rgba(17, 132, 91, 0.3);
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
}

/* Project logistics */
.logistics-view {
  overflow: hidden;
}

.logistics-workspace {
  display: grid;
  min-height: 0;
  flex: 1;
  grid-template-columns: 230px minmax(0, 1fr) 360px;
  gap: 12px;
}

.logistics-filter-card,
.logistics-map-card,
.logistics-results {
  min-width: 0;
  min-height: 0;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
}

.logistics-filter-card {
  overflow-x: hidden;
  overflow-y: auto;
}

.project-location-summary {
  display: flex;
  margin: 14px;
  padding: 12px;
  align-items: center;
  gap: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.project-location-summary > div {
  min-width: 0;
}

.project-location-summary strong,
.project-location-summary small {
  display: block;
}

.project-location-summary strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-location-summary small {
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
}

.project-location-pin {
  position: relative;
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  background: var(--ink);
  border: 4px solid #fff;
  border-radius: 50% 50% 50% 6px;
  box-shadow: 0 0 0 3px rgba(16, 24, 244, 0.14);
  transform: rotate(-45deg);
}

.project-location-pin i {
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
}

.logistics-place-button {
  width: calc(100% - 28px);
  min-height: 36px;
  margin: 0 14px;
}

.filter-help {
  margin: 8px 14px 16px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.logistics-layer-filters {
  margin: 0;
  padding: 14px 0 6px;
  border: 0;
  border-top: 1px solid var(--line);
}

.logistics-layer-filters legend {
  width: 100%;
  padding: 0 14px 7px;
}

.logistics-layer-filters legend span,
.logistics-select-field > span,
.logistics-sort > span,
.logistics-results-head span,
.logistics-detail-kicker,
.logistics-scenario-field > span,
.logistics-metric span {
  display: block;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.logistics-layer-filters legend strong {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  font-weight: 600;
}

.logistics-layer-filters label {
  display: grid;
  min-height: 48px;
  padding: 6px 14px;
  cursor: pointer;
  grid-template-columns: 16px 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  transition: background 120ms ease;
}

.logistics-layer-filters label:hover {
  background: var(--surface);
}

.logistics-layer-filters input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--blue);
}

.logistics-layer-filters label span strong,
.logistics-layer-filters label span small {
  display: block;
}

.logistics-layer-filters label span strong {
  font-size: 11px;
  font-weight: 600;
}

.logistics-layer-filters label span small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.logistics-layer-filters label > b {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
}

.facility-symbol {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 9px;
  font-style: normal;
  font-weight: 700;
  border-radius: 5px;
}

.facility-symbol.concrete {
  color: #08748b;
  background: var(--cyan-soft);
}

.facility-symbol.fill {
  color: #ad5d00;
  background: var(--orange-soft);
}

.facility-symbol.landfill {
  color: #57458f;
  background: var(--violet-soft);
}

.logistics-select-field {
  display: block;
  padding: 13px 14px 15px;
  border-top: 1px solid var(--line);
}

.logistics-select-field select,
.logistics-sort select,
.logistics-scenario-field input {
  width: 100%;
  height: 36px;
  margin-top: 6px;
  padding: 0 10px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.logistics-data-note {
  margin: 0 14px 14px;
  padding: 10px 11px;
  color: #5f4a23;
  background: #fffaf0;
  border: 1px solid #f1ddba;
  border-radius: var(--radius);
}

.logistics-data-note strong,
.logistics-data-note p {
  display: block;
  margin: 0;
}

.logistics-data-note strong {
  font-size: 10px;
}

.logistics-data-note p {
  margin-top: 3px;
  font-size: 9px;
  line-height: 1.4;
}

.logistics-map-card {
  position: relative;
  display: flex;
  overflow: hidden;
  isolation: isolate;
  flex-direction: column;
}

.logistics-map-toolbar {
  position: relative;
  z-index: 5;
  display: flex;
  min-height: 54px;
  padding: 0 12px 0 15px;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid var(--line);
}

.logistics-map-toolbar strong,
.logistics-map-toolbar span {
  display: block;
}

.mobile-map-layers {
  display: none;
}

.logistics-map-toolbar strong {
  font-size: 13px;
}

.logistics-map-toolbar span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.logistics-map {
  width: 100%;
  min-height: 480px;
  flex: 1;
  background:
    linear-gradient(135deg, rgba(16, 24, 244, 0.025), rgba(17, 132, 91, 0.025)),
    var(--surface-2);
}

.logistics-map-card.placing .logistics-map {
  cursor: crosshair;
}

.map-unavailable {
  position: absolute;
  z-index: 7;
  inset: 54px 0 0;
  display: grid;
  padding: 30px;
  place-content: center;
  text-align: center;
  background: var(--surface);
}

.map-unavailable strong,
.map-unavailable span {
  display: block;
}

.map-unavailable span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.map-place-instruction {
  position: absolute;
  z-index: 600;
  top: 66px;
  left: 50%;
  padding: 9px 12px;
  color: #fff;
  background: var(--ink);
  font-size: 10px;
  font-weight: 600;
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
  transform: translateX(-50%);
}

.map-legend {
  position: absolute;
  z-index: 500;
  right: 10px;
  bottom: 10px;
  display: flex;
  padding: 7px 9px;
  align-items: center;
  gap: 10px;
  color: var(--ink-700);
  background: rgba(255, 255, 255, 0.94);
  font-size: 8px;
  font-weight: 600;
  border: 1px solid rgba(203, 211, 221, 0.9);
  border-radius: var(--radius);
  box-shadow: 0 5px 18px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(8px);
}

.map-legend span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.map-legend i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.legend-project { background: var(--ink); box-shadow: 0 0 0 2px rgba(16, 24, 244, 0.18); }
.legend-concrete { background: var(--cyan); }
.legend-fill { background: var(--orange); }
.legend-landfill { background: var(--violet); }

.logistics-map-card .leaflet-control-zoom {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 5px 18px rgba(15, 23, 42, 0.12);
}

.logistics-map-card .leaflet-control-zoom a {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--ink);
  font: 500 18px/1 var(--font-ui);
  border: 0;
}

.logistics-map-card .leaflet-control-attribution {
  padding: 2px 5px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.9);
  font-size: 8px;
}

.logistics-map-card .leaflet-control-attribution a {
  color: var(--ink-700);
}

.leaflet-div-icon.map-div-icon {
  background: transparent;
  border: 0;
}

.project-map-marker {
  position: relative;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  background: var(--ink);
  border: 4px solid #fff;
  border-radius: 50% 50% 50% 7px;
  box-shadow: 0 0 0 5px rgba(16, 24, 244, 0.2), 0 8px 18px rgba(15, 23, 42, 0.24);
  transform: rotate(-45deg);
}

.project-map-marker::after {
  width: 6px;
  height: 6px;
  content: "";
  background: #fff;
  border-radius: 50%;
}

.facility-map-marker {
  position: relative;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  border: 3px solid #fff;
  border-radius: 9px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.2);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.facility-map-marker::after {
  position: absolute;
  bottom: -6px;
  left: 50%;
  width: 8px;
  height: 8px;
  content: "";
  background: inherit;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: translateX(-50%) rotate(45deg);
}

.facility-map-marker.concrete { background: var(--cyan); }
.facility-map-marker.fill { background: var(--orange); }
.facility-map-marker.landfill { background: var(--violet); }
.facility-map-marker.active { box-shadow: 0 0 0 4px rgba(16, 24, 244, 0.22), 0 8px 20px rgba(15, 23, 42, 0.25); transform: translateY(-2px) scale(1.08); }

.leaflet-tooltip.facility-tooltip {
  padding: 6px 8px;
  color: var(--ink);
  background: #fff;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.12);
}

.logistics-results {
  display: flex;
  overflow: hidden;
  flex-direction: column;
}

.logistics-results-head {
  display: flex;
  min-height: 63px;
  padding: 12px 14px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.logistics-results-head strong {
  display: block;
  max-width: 250px;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

.logistics-results-head > b {
  display: grid;
  min-width: 27px;
  height: 24px;
  padding: 0 7px;
  place-items: center;
  color: var(--blue);
  background: var(--blue-soft);
  font-family: var(--font-mono);
  font-size: 9px;
  border-radius: 12px;
}

.logistics-sort {
  display: grid;
  min-height: 48px;
  padding: 7px 14px;
  grid-template-columns: auto 170px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.logistics-sort select {
  height: 32px;
  margin: 0;
  padding-right: 24px;
  font-size: 10px;
}

.facility-list {
  max-height: 205px;
  overflow: auto;
  border-bottom: 1px solid var(--line);
}

.facility-card {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 70px;
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.facility-card:last-child {
  border-bottom: 0;
}

.facility-card::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  content: "";
  background: var(--blue);
  opacity: 0;
}

.facility-card:hover {
  background: var(--surface);
}

.facility-card.active {
  background: var(--blue-soft);
}

.facility-card.active::before {
  opacity: 1;
}

.facility-card-copy {
  min-width: 0;
}

.facility-card-copy strong,
.facility-card-copy span,
.facility-card-copy small {
  display: block;
}

.facility-card-copy strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.facility-card-copy span {
  margin-top: 3px;
  color: var(--ink-700);
  font-family: var(--font-mono);
  font-size: 9px;
}

.facility-card-copy small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.facility-card-cost {
  text-align: right;
}

.facility-card-cost strong,
.facility-card-cost small {
  display: block;
}

.facility-card-cost strong {
  font-family: var(--font-mono);
  font-size: 10px;
}

.facility-card-cost small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.facility-empty {
  display: grid;
  min-height: 170px;
  padding: 24px;
  place-content: center;
  text-align: center;
}

.facility-empty strong,
.facility-empty span {
  display: block;
}

.facility-empty span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.logistics-detail {
  min-height: 0;
  padding: 13px 14px 14px;
  overflow: auto;
  flex: 1;
}

.logistics-detail-head {
  display: flex;
  margin-bottom: 11px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.logistics-detail-head strong,
.logistics-detail-head small {
  display: block;
}

.logistics-detail-head strong {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.25;
}

.logistics-detail-head small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.saved-logistics-badge {
  padding: 4px 7px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 8px;
  font-weight: 700;
  white-space: nowrap;
  border-radius: 10px;
}

.saved-logistics-badge.changed {
  color: #a45700;
  background: var(--orange-soft);
}

.logistics-route-summary {
  display: grid;
  margin-bottom: 11px;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.logistics-metric {
  min-width: 0;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.logistics-metric strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logistics-scenario-grid {
  display: grid;
  margin-bottom: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.logistics-scenario-field input {
  height: 34px;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
}

.logistics-roundtrip {
  display: flex;
  min-height: 34px;
  margin-bottom: 10px;
  padding: 7px 9px;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  font-size: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.logistics-roundtrip input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--blue);
}

.logistics-cost-lines {
  display: grid;
  padding: 10px 0;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 12px;
  color: var(--muted);
  font-size: 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.logistics-cost-lines strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-align: right;
}

.logistics-cost-lines .logistics-cost-total,
.logistics-cost-lines .logistics-cost-total + strong {
  padding-top: 7px;
  color: var(--ink);
  font-weight: 700;
  border-top: 1px solid var(--line);
}

.logistics-cost-lines .logistics-cost-total + strong {
  color: var(--blue);
}

.facility-source {
  display: grid;
  margin-top: 10px;
  padding: 9px;
  gap: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.facility-source span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.09em;
}

.facility-source a {
  width: fit-content;
  color: var(--blue);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
}

.facility-source a:hover {
  text-decoration: underline;
}

.facility-source small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
}

.logistics-detail-actions {
  margin-top: 11px;
}

.logistics-detail-actions p {
  margin: 7px 2px 0;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.4;
  text-align: center;
}

.transport-link-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

@media (max-width: 1270px) {
  .recipe-workspace,
  .resource-workspace {
    grid-template-columns: 198px minmax(0, 1fr) 306px;
  }

  .estimate-workspace {
    grid-template-columns: 280px minmax(0, 1fr) 306px;
  }

  .estimate-workspace.detail-hidden {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .resource-workspace {
    grid-template-columns: 198px minmax(0, 1fr);
  }

  .structure-button {
    padding-right: 9px;
    padding-left: 9px;
  }

  .description-cell small {
    margin-left: 0;
  }

  .prototype-ref {
    min-width: auto;
  }

  .logistics-workspace {
    grid-template-columns: 205px minmax(0, 1fr) 330px;
  }
}

@media (max-width: 1080px) {
  .login-panel {
    grid-template-columns: 0.82fr 1fr;
  }

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

  .recipe-workspace,
  .resource-workspace {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .estimate-workspace,
  .estimate-workspace.detail-hidden {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .detail-panel {
    position: fixed;
    z-index: 50;
    top: calc(var(--topbar-height) + var(--tabs-height) + 12px);
    right: 12px;
    bottom: 12px;
    width: 330px;
    box-shadow: -12px 12px 38px rgba(15, 23, 42, 0.17);
  }

  .recipe-table th:nth-child(3),
  .recipe-table td:nth-child(3),
  .recipe-table th:nth-child(4),
  .recipe-table td:nth-child(4),
  .recipe-table th:nth-child(5),
  .recipe-table td:nth-child(5) {
    display: none;
  }

  .logistics-view {
    height: auto;
    overflow: visible;
  }

  .logistics-workspace {
    min-height: 1040px;
    flex: none;
    grid-template-columns: 205px minmax(0, 1fr);
    grid-template-rows: 560px 560px;
  }

  .logistics-results {
    grid-column: 1 / -1;
  }

  .facility-list {
    max-height: 210px;
  }
}

@media (max-width: 900px) {
  .estimate-workspace,
  .estimate-workspace.detail-hidden {
    display: block;
  }

  .heading-library {
    width: 100%;
    max-height: clamp(360px, 55dvh, 520px);
    margin-bottom: 12px;
  }

  .heading-library .heading-tree-row {
    padding-left: min(var(--tree-indent, 0px), 24px);
  }

  .heading-drag-handle {
    overflow: hidden;
    width: 0;
    visibility: hidden;
  }

  .heading-library .structure-button.tree {
    grid-template-areas:
      "ref action"
      "label action";
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .estimate-card {
    min-height: 520px;
  }
}

@media (max-width: 760px) {
  .login-screen {
    padding: 10px;
  }

  .login-panel {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .login-brand {
    min-height: 148px;
    padding: 22px;
  }

  .login-form {
    padding: 24px 20px 22px;
  }

  .login-form h1,
  .hub-heading h1 {
    font-size: 28px;
  }

  .hub-context {
    display: none;
  }

  .project-hub-main {
    width: calc(100% - 20px);
    padding: 24px 0;
  }

  .hub-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .hub-heading .button {
    width: 100%;
    justify-content: center;
  }

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

  .project-card {
    min-height: 210px;
  }

  #backToProjectsButton {
    display: none;
  }

  .topbar {
    padding: 0 14px;
  }

  .brand {
    padding-right: 14px;
  }

  .brand span,
  .project-code,
  .save-state,
  .workspace-context,
  #resetDemoButton {
    display: none;
  }

  #hubLogoutButton {
    display: inline-flex;
    min-width: 64px;
    height: 40px;
    align-items: center;
    justify-content: center;
  }

  .project-switcher {
    min-width: 0;
    margin-left: 8px;
  }

  .project-switcher > span:not(.project-code) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .workspace-tabs {
    padding: 0 8px;
    overflow: hidden;
  }

  .tab-list {
    width: 100%;
    padding-bottom: 2px;
    overflow: visible;
    justify-content: space-between;
    gap: 0;
  }

  .workspace-tab {
    min-width: 0;
    padding: 0 5px;
    flex: 0 1 auto;
    gap: 0;
    font-size: 10px;
  }

  .workspace-tab svg {
    display: none;
  }

  .view {
    height: auto;
    min-height: calc(100vh - var(--topbar-height) - var(--tabs-height));
    padding: 16px 14px 20px;
  }

  .prototype-notice div {
    display: block;
  }

  .prototype-notice span {
    display: block;
    margin-top: 2px;
    white-space: normal;
  }

  .estimate-workspace,
  .recipe-workspace,
  .resource-workspace,
  .summary-layout {
    display: block;
  }

  .price-mode-switch {
    display: flex;
    width: 100%;
  }

  .price-mode-switch button {
    min-width: 0;
    flex: 1;
  }

  .template-explainer {
    display: block;
  }

  .template-explainer span {
    display: block;
    margin-top: 3px;
  }

  .structure-card {
    margin-bottom: 10px;
    max-height: 320px;
  }

  .heading-library {
    max-height: min(52dvh, 440px);
  }

  .structure-list {
    padding: 6px;
    overflow: auto;
  }

  .structure-search-wrap {
    padding: 8px;
  }

  .structure-search {
    min-height: 44px;
  }

  .structure-search input {
    font-size: 16px;
  }

  .panel-title {
    padding-right: 8px;
  }

  .panel-action {
    min-height: 44px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
  }

  .heading-tree-row {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .heading-tree-row[draggable="true"] {
    cursor: default;
  }

  .tree-chevron {
    width: 40px;
    min-height: 44px;
  }

  .tree-chevron svg {
    width: 15px;
    height: 15px;
  }

  .structure-button {
    min-width: 0;
  }

  .structure-button.tree {
    min-height: 48px;
  }

  .heading-drag-handle {
    overflow: hidden;
    width: 0;
    visibility: hidden;
  }

  .heading-add-button {
    min-width: 72px;
    min-height: 44px;
    padding: 0 8px;
    font-size: 10px;
  }

  .structure-foot {
    display: none;
  }

  .heading-row-content {
    padding-left: calc(8px + var(--heading-mobile-indent, 0px));
    grid-template-columns: 66px minmax(0, 1fr);
    row-gap: 5px;
  }

  .heading-row-side > b,
  .heading-row-content > small {
    display: none;
  }

  .heading-row-side {
    grid-row: 2;
    grid-column: 1 / -1;
  }

  .heading-add-item-button {
    min-height: 44px;
    padding: 0 10px;
    font-size: 10px;
  }

  .heading-remove-button {
    width: 44px;
    height: 44px;
  }

  .drop-desktop {
    display: none;
  }

  .drop-mobile {
    display: inline;
  }

  .heading-drop-zone {
    min-height: 44px;
    padding: 8px 10px;
    text-align: center;
  }

  .table-card {
    min-height: 520px;
  }

  .estimate-card .table-toolbar,
  .resource-price-card .table-toolbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .estimate-card .table-toolbar .search-field,
  .resource-price-card .table-toolbar .search-field {
    width: 100%;
    flex: 0 0 100%;
  }

  .estimate-card .table-toggle {
    display: inline-flex;
    min-height: 40px;
    margin: 0;
    padding: 0 6px;
    align-items: center;
  }

  .estimate-card .table-toolbar > .button {
    margin-left: auto;
  }

  .estimate-table th:nth-child(3),
  .estimate-table td:nth-child(3),
  .estimate-table th:nth-child(4),
  .estimate-table td:nth-child(4) {
    display: none;
  }

  .estimate-table th:nth-child(1) { width: auto; }
  .estimate-table th:nth-child(2) { width: 72px; }
  .estimate-table th:nth-child(5) { width: 88px; }

  .estimate-table th,
  .estimate-table td {
    padding-right: 8px;
    padding-left: 8px;
  }

  .estimate-table .qty-input {
    width: 58px;
  }

  .resource-price-card .toolbar-note {
    width: 100%;
    margin: -2px 2px 0;
    line-height: 1.35;
    white-space: normal;
  }

  .detail-panel {
    top: auto;
    right: 8px;
    bottom: 8px;
    left: 8px;
    width: auto;
    max-height: 74dvh;
  }

  .icon-button {
    width: 44px;
    height: 44px;
  }

  .modal-actions .button,
  .detail-actions .button {
    min-height: 44px;
  }

  .location-search-control .location-search-button,
  .location-search-control input,
  .location-map-toggle {
    min-height: 44px;
  }

  .location-result {
    min-height: 64px;
  }

  .heading-picker input,
  .heading-picker select,
  .row-heading-picker input,
  .row-heading-picker select {
    min-height: 44px;
  }

  .heading-search-control input {
    font-size: 16px;
  }

  .location-picker-map {
    height: 240px;
  }

  .resource-add-row select,
  .resource-add-row button {
    height: 44px;
    font-size: 11px;
  }

  .resource-item.editable {
    grid-template-columns: 27px repeat(3, minmax(0, 1fr)) 44px;
  }

  .resource-name-input {
    height: 40px;
    font-size: 10px;
  }

  .resource-meta-row select,
  .resource-meta-row input,
  .resource-type-select {
    height: 36px;
    font-size: 9px;
  }

  .resource-input,
  .register-price-input {
    height: 44px;
    font-size: 10px;
  }

  .delete-resource {
    width: 44px;
    height: 44px;
  }

  .open-detail {
    position: static;
    width: 100%;
    height: 44px;
    margin-top: 10px;
  }

  .resource-price-table {
    min-width: 0;
  }

  .resource-price-table th:nth-child(2),
  .resource-price-table td:nth-child(2),
  .resource-price-table th:nth-child(5),
  .resource-price-table td:nth-child(5) {
    display: none;
  }

  .resource-price-table th:nth-child(1) { width: auto; }
  .resource-price-table th:nth-child(3) { width: 42px; }
  .resource-price-table th:nth-child(4) { width: 112px; }

  .resource-price-row .description-main {
    display: grid;
    align-items: center;
    grid-template-columns: 27px minmax(0, 1fr);
    grid-template-areas:
      "type name"
      "type scope";
    column-gap: 6px;
    row-gap: 2px;
  }

  .resource-price-row .resource-type {
    grid-area: type;
  }

  .resource-price-row .description-main strong {
    min-width: 0;
    grid-area: name;
  }

  .resource-price-row .price-scope {
    width: max-content;
    grid-area: scope;
  }

  .resource-price-row .description-cell small {
    margin-left: 33px;
  }

  .price-scope {
    padding: 0 5px;
  }

  .register-price-input {
    width: 90px;
  }

  .summary-main {
    display: block;
  }

  .summary-total-card,
  .summary-card,
  .price-builder {
    margin-bottom: 10px;
  }

  .summary-card {
    min-height: 260px;
  }

  .price-builder {
    min-height: 520px;
  }

  .form-grid.two {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .logistics-view .heading-total {
    display: none;
  }

  .logistics-workspace {
    display: flex;
    min-height: 0;
    flex-direction: column;
  }

  .logistics-filter-card,
  .logistics-map-card,
  .logistics-results {
    margin-bottom: 10px;
  }

  .logistics-map-card { order: 1; }
  .logistics-filter-card { order: 2; }
  .logistics-results { order: 3; }

  .logistics-map-card {
    height: 48dvh;
    min-height: 360px;
  }

  .logistics-map-toolbar {
    display: grid;
    min-height: 92px;
    padding: 8px;
    align-items: center;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 8px;
  }

  .logistics-map-toolbar > div:first-child {
    width: auto;
    min-width: 0;
  }

  #fitLogisticsMap {
    display: inline-flex;
    height: 44px;
    padding: 0 8px;
    align-items: center;
    grid-column: 2;
    grid-row: 1;
  }

  .mobile-map-layers {
    display: flex;
    width: 100%;
    padding-bottom: 0;
    grid-column: 1 / -1;
    grid-row: 2;
    gap: 6px;
  }

  .mobile-map-layers button {
    display: flex;
    min-height: 44px;
    padding: 3px 8px;
    cursor: pointer;
    align-items: center;
    gap: 5px;
    color: var(--muted);
    background: var(--surface);
    font-size: 9px;
    font-weight: 600;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    min-width: 0;
    flex: 1;
  }

  .mobile-map-layers button[aria-pressed="true"] {
    color: var(--ink);
    background: var(--blue-soft);
    border-color: #cdd3ff;
  }

  .mobile-map-layers .facility-symbol {
    width: 22px;
    height: 22px;
  }

  .map-unavailable {
    inset: 92px 0 0;
  }

  .map-place-instruction {
    top: 104px;
  }

  .logistics-map {
    min-height: 300px;
  }

  .logistics-map-card:not(.placing) .logistics-map.leaflet-container {
    touch-action: pan-y pinch-zoom !important;
    overscroll-behavior-y: auto;
  }

  .logistics-results {
    min-height: 700px;
  }

  .map-legend {
    right: 7px;
    bottom: 7px;
    max-width: calc(100% - 14px);
    gap: 7px;
  }

  .logistics-map-card .leaflet-control-zoom a {
    width: 44px;
    height: 44px;
  }

  .facility-list {
    max-height: 280px;
  }
}

@media (max-height: 760px) and (min-width: 761px) {
  .view {
    padding-top: 14px;
    padding-bottom: 16px;
  }

  .view-heading {
    min-height: 52px;
    margin-bottom: 8px;
  }

  .view-heading h1 {
    font-size: 23px;
  }

  .prototype-notice {
    min-height: 38px;
    margin-bottom: 8px;
    padding-top: 6px;
    padding-bottom: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
