:root {
  color-scheme: light;
  --ink: #2e3d34;
  --muted: #887e73;
  --line: #e6dcd0;
  --paper: #fffdf9;
  --cream: #f3eee6;
  --cream-deep: #e9e1d6;
  --green: #294b3d;
  --green-2: #3d6656;
  --green-soft: #edf4ef;
  --terra: #c47755;
  --terra-soft: #f3e1d6;
  --danger: #a9473c;
  --shadow: 0 18px 46px rgba(67, 55, 42, 0.13);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  background: var(--cream);
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 92% 0%, rgba(220, 196, 166, 0.5), transparent 27rem),
    var(--cream);
}

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

button {
  cursor: pointer;
}

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

#app {
  min-height: 100vh;
}

.app-shell {
  max-width: 1500px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px;
}

.top-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--green);
  font-weight: 850;
  letter-spacing: 0.08em;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: var(--green);
  color: #fff8ee;
  font-size: 15px;
  letter-spacing: 0;
  box-shadow: 0 8px 18px rgba(41, 75, 61, 0.2);
}

.surface {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 253, 249, 0.94);
  box-shadow: var(--shadow);
}

.page-title {
  margin: 0;
  font-family: "STSong", "Songti SC", serif;
  font-size: clamp(26px, 4vw, 42px);
  color: var(--green);
}

.muted {
  color: var(--muted);
}

.primary-button,
.secondary-button,
.danger-button,
.text-button,
.icon-button {
  border-radius: 8px;
  border: 0;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.primary-button {
  padding: 10px 16px;
  background: var(--green);
  color: #fffaf1;
  font-weight: 750;
  box-shadow: 0 7px 16px rgba(41, 75, 61, 0.18);
}

.secondary-button {
  padding: 9px 13px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: #665b51;
}

.danger-button {
  padding: 9px 13px;
  background: #f8e6e2;
  color: var(--danger);
}

.text-button {
  background: transparent;
  color: var(--green);
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  background: var(--paper);
  color: #76695d;
  border: 1px solid var(--line);
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.danger-button:focus-visible,
.text-button:focus-visible,
.icon-button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[contenteditable="true"]:focus-visible {
  outline: 3px solid rgba(196, 119, 85, 0.34);
  outline-offset: 2px;
}

.empty-state {
  display: grid;
  min-height: 240px;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.global-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 34px;
}

.top-brand {
  text-decoration: none;
}

.global-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.global-nav a {
  padding: 8px 11px;
  color: #6f645a;
  text-decoration: none;
  border-radius: 7px;
  font-size: 13px;
}

.global-nav a:hover {
  background: rgba(255, 253, 249, 0.75);
  color: var(--green);
}

.install-app-button {
  border: 1px solid #cbb8a5;
  border-radius: 7px;
  padding: 7px 10px;
  background: #f7ece2;
  color: #8a5138;
  font-size: 11px;
  font-weight: 750;
}

.install-app-button[hidden] {
  display: none;
}

.projects-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 0 4px 22px;
}

.projects-hero p {
  margin: 6px 0 0;
}

.eyebrow {
  margin: 0;
  color: var(--terra);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.project-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 249, 0.94);
  box-shadow: 0 10px 26px rgba(67, 55, 42, 0.07);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.project-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 34px rgba(67, 55, 42, 0.12);
}

.project-open {
  display: flex;
  width: 100%;
  min-height: 105px;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 0;
  background: transparent;
  text-align: left;
}

.project-card-icon {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 16px;
}

.project-card-copy {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.project-card-copy strong {
  overflow: hidden;
  color: #304139;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-card-copy small {
  color: #9b9085;
  font-size: 11px;
}

.project-card-arrow {
  margin-left: auto;
  color: #a1836f;
  font-size: 24px;
}

.project-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  padding: 10px 16px;
  border-top: 1px solid #eee7df;
  color: #7c7166;
  font-size: 11px;
}

.project-card-stats b {
  color: var(--green);
  font-size: 14px;
}

.review-badge {
  padding: 2px 6px;
  border-radius: 8px;
  background: #fff1df;
  color: #986043;
}

.project-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  padding: 0 10px 9px;
}

.project-card-actions button {
  padding: 5px 8px;
  font-size: 11px;
}

.project-create-card {
  display: grid;
  min-height: 168px;
  place-items: center;
  align-content: center;
  gap: 5px;
  border: 1px dashed #c8b8a6;
  border-radius: 14px;
  background: rgba(255, 253, 249, 0.38);
  color: #8e7d6d;
}

.project-create-card span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--terra-soft);
  color: var(--terra);
  font-size: 22px;
}

.project-create-card strong {
  font-size: 14px;
}

.project-create-card small {
  color: #a09386;
  font-size: 11px;
}

.project-shell {
  max-width: 1560px;
}

.project-surface {
  overflow: hidden;
}

.project-header {
  position: relative;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.97);
}

.back-link {
  color: #76695e;
  text-decoration: none;
  font-size: 13px;
}

.project-name-wrap {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.project-title-button {
  padding: 7px 25px 7px 9px;
  border: 1px dashed transparent;
  border-radius: 7px;
  background: transparent;
  color: #314239;
  font-size: 15px;
  font-weight: 800;
}

.project-title-button::after {
  content: "✎";
  margin-left: 7px;
  color: #a48163;
  font-size: 12px;
  font-weight: 400;
}

.project-title-button:hover {
  border-color: #cbb7a1;
  background: #fbf4e9;
}

.project-title-button:focus {
  border-color: #cbb7a1;
  background: #fbf4e9;
  outline: 0;
}

.project-name-wrap small {
  display: block;
  margin-top: -2px;
  color: #aaa096;
  font-size: 9px;
}

.project-save-state {
  color: #9b9084;
  font-size: 11px;
}

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

.rule-update-button {
  padding: 7px 9px;
  border: 1px solid #e2b995;
  border-radius: 7px;
  background: #fff1df;
  color: #935739;
  font-size: 10px;
  font-weight: 750;
}

.project-tabs {
  display: flex;
  min-height: 48px;
  align-items: stretch;
  gap: 30px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: #faf6f0;
}

.project-tabs a {
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  color: #84776b;
  text-decoration: none;
  font-size: 13px;
}

.project-tabs a.active {
  border-bottom-color: var(--green);
  color: var(--green);
  font-weight: 800;
}

.project-placeholder,
.settings-placeholder {
  min-height: 65vh;
  padding: 28px;
}

.settings-placeholder {
  min-height: 420px;
}

.form-field {
  display: grid;
  gap: 7px;
}

.form-field span {
  color: #6f6358;
  font-size: 13px;
  font-weight: 700;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #dcd1c4;
  border-radius: 8px;
  background: #fffdf9;
  color: var(--ink);
}

.form-hint {
  margin: 9px 0 0;
  color: #968b80;
  font-size: 12px;
}

.dialog-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.rooms-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  min-height: 640px;
  background: var(--cream);
}

.room-list-panel {
  min-width: 0;
  padding: 16px 11px;
  border-right: 1px solid var(--line);
  background: #faf7f2;
}

.room-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 5px 11px;
  color: #665c52;
  font-size: 13px;
}

.room-list-head span {
  color: #9b9085;
  font-size: 11px;
}

.add-room-button {
  width: 100%;
  min-height: 38px;
  border: 1px dashed #c8b7a3;
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.58);
  color: #92583d;
  font-size: 12px;
}

.room-list {
  display: grid;
  gap: 5px;
  margin-top: 10px;
}

.room-list-item {
  display: block;
  width: 100%;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #5f554c;
  text-align: left;
}

.room-list-item:hover {
  background: rgba(255, 253, 249, 0.78);
}

.room-list-item.active {
  background: var(--green);
  color: #fff9ef;
  box-shadow: 0 7px 17px rgba(41, 75, 61, 0.15);
}

.room-list-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.room-list-top strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-list-top em {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 8px;
  background: #e8f0e9;
  color: #416b57;
  font-size: 9px;
  font-style: normal;
}

.room-list-item.active em {
  background: #517764;
  color: #f9f4ea;
}

.room-list-item > small {
  display: block;
  margin-top: 5px;
  color: #9c9185;
  font-size: 10px;
}

.room-list-item.active > small {
  color: #bccbc3;
}

.room-list-area {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  color: #81766b;
  font-size: 10px;
}

.room-list-area b {
  color: #a25f40;
}

.room-list-item.active .room-list-area {
  color: #c2cec8;
}

.room-list-item.active .room-list-area b {
  color: #f8ddcd;
}

.room-main-panel {
  min-width: 0;
  width: 100%;
  overflow: hidden;
  padding: 18px;
}

.room-editor {
  min-width: 0;
}

.room-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.room-name-input {
  width: min(340px, 100%);
  padding: 2px 4px;
  border: 1px solid transparent;
  background: transparent;
  color: #34463d;
  font-family: "STSong", "Songti SC", serif;
  font-size: 25px;
  font-weight: 700;
}

.room-name-input:hover,
.room-name-input:focus {
  border-color: #d8c8b7;
  background: #fffaf3;
}

.room-editor-head p {
  margin: 7px 0 0;
  color: #9b9085;
  font-size: 11px;
}

.room-head-actions {
  display: flex;
  gap: 4px;
}

.danger-text {
  color: var(--danger);
}

.editor-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 2px 8px;
  color: #6b6056;
  font-size: 12px;
}

.editor-section-title span {
  color: #a3988c;
  font-size: 10px;
}

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

.dimension-field {
  display: block;
  padding: 10px;
  border: 1px solid #e5d8c9;
  border-radius: 9px;
  background: #fff3d7;
}

.dimension-field > span {
  display: block;
  margin-bottom: 5px;
  color: #918578;
  font-size: 10px;
}

.dimension-field > div {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.dimension-field input,
.dimension-field select {
  min-width: 0;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #34463e;
  font-size: 20px;
  font-weight: 750;
}

.dimension-field select {
  font-size: 15px;
}

.dimension-field em {
  color: #9b8e81;
  font-size: 11px;
  font-style: normal;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-top: 9px;
}

.metric-card {
  padding: 10px 12px;
  border: 1px solid #dbe7df;
  border-radius: 9px;
  background: var(--green-soft);
}

.metric-card span {
  display: block;
  color: #7e9085;
  font-size: 10px;
}

.metric-card b {
  color: var(--green);
  font-size: 20px;
}

.metric-card small {
  margin-left: 3px;
  color: #7d8e84;
  font-size: 10px;
}

.opening-table {
  overflow: hidden;
  border: 1px solid #e5dcd0;
  border-radius: 9px;
  background: rgba(255, 253, 249, 0.88);
}

.opening-row {
  display: grid;
  grid-template-columns: minmax(110px, 1.3fr) minmax(100px, 1fr) minmax(100px, 1fr) 72px 30px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-top: 1px solid #ece4dc;
  color: #5f574f;
  font-size: 12px;
}

.opening-row:first-child {
  border-top: 0;
}

.opening-head {
  background: #faf7f1;
  color: #8e8378;
  font-size: 10px;
}

.opening-row input {
  min-width: 0;
  width: 100%;
  height: 32px;
  padding: 5px 7px;
  border: 1px solid #e3d8cc;
  border-radius: 6px;
  background: #fffdf9;
}

.opening-row label {
  display: flex;
  align-items: center;
  gap: 4px;
}

.opening-row label span {
  color: #9c9084;
  font-size: 10px;
}

.opening-area {
  color: #6d746e;
  text-align: right;
}

.icon-button.compact {
  width: 28px;
  height: 28px;
}

.opening-empty {
  padding: 20px;
  color: #9b9084;
  text-align: center;
  font-size: 12px;
}

.add-opening-button {
  width: 100%;
  padding: 10px;
  border: 0;
  border-top: 1px solid #ece4dc;
  background: transparent;
  color: var(--terra);
  font-size: 12px;
  text-align: left;
}

.room-notes {
  display: grid;
  gap: 6px;
  margin-top: 15px;
}

.room-notes > span {
  color: #786c61;
  font-size: 12px;
  font-weight: 700;
}

.room-notes textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #e2d7ca;
  border-radius: 8px;
  background: #fffdf9;
  resize: vertical;
}

.measurement-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding: 11px 13px;
  border-radius: 9px;
  background: var(--green);
  color: #fff9ef;
}

.measurement-footer div {
  flex: 1;
}

.measurement-footer small {
  display: block;
  color: #b7c7bf;
  font-size: 9px;
}

.measurement-footer b {
  font-size: 13px;
}

.review-note {
  padding: 4px 7px;
  border-radius: 7px;
  background: #f4dfd0;
  color: #884e35;
  font-size: 10px;
}

.footer-action {
  padding: 8px 10px;
  border-radius: 7px;
  background: #f5e4d8;
  color: #7a482f;
  text-decoration: none;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.room-empty {
  min-height: 520px;
}

.small-copy {
  font-size: 12px;
}

.materials-layout {
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  min-height: 660px;
  background: var(--cream);
}

.trade-panel {
  padding: 16px 10px;
  border-right: 1px solid var(--line);
  background: #faf7f2;
}

.trade-panel-head {
  display: flex;
  justify-content: space-between;
  margin: 0 7px 10px;
  color: #6f645a;
  font-size: 12px;
}

.trade-panel-head span {
  color: #9f9387;
  font-size: 10px;
}

.trade-filters {
  display: grid;
  gap: 3px;
}

.trade-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #706559;
  text-align: left;
  font-size: 12px;
}

.trade-filter small {
  color: #a09487;
  font-size: 10px;
}

.trade-filter:hover {
  background: rgba(255, 253, 249, 0.8);
}

.trade-filter.active {
  background: var(--green);
  color: #fff9ef;
}

.trade-filter.active small {
  color: #c3d0c9;
}

.basis-settings-button {
  width: 100%;
  margin-top: 14px;
  padding: 10px;
  border: 1px solid #dfc5b2;
  border-radius: 8px;
  background: #fbefe7;
  color: #925c40;
  font-size: 11px;
  text-align: left;
}

.basis-settings-button span {
  margin-right: 4px;
  font-size: 15px;
}

.material-main-panel {
  display: flex;
  min-width: 0;
  min-height: 660px;
  flex-direction: column;
  padding: 14px 16px 67px;
  position: relative;
}

.material-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
}

.material-search {
  min-width: 0;
  flex: 1;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #e1d6ca;
  border-radius: 8px;
  background: var(--paper);
}

.material-list-area {
  flex: 1;
}

.material-group {
  margin-top: 14px;
}

.material-group > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 3px 6px;
  color: #766a5f;
  font-size: 12px;
}

.material-group > header span {
  color: #a19589;
  font-size: 10px;
}

.material-table {
  overflow: hidden;
  border: 1px solid #e3d8cc;
  border-radius: 9px;
  background: var(--paper);
}

.material-line-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto 30px;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 9px 11px;
  border-top: 1px solid #eee7df;
}

.material-line-row:first-child {
  border-top: 0;
}

.material-line-row[hidden],
.material-group[hidden] {
  display: none;
}

.material-line-main {
  min-width: 0;
}

.material-name-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.material-name-row strong {
  overflow: hidden;
  color: #334139;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-line-main > small {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: #9d9287;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calculation-note {
  margin-top: 3px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #9d5f42;
  font-size: 10px;
}

.material-detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 3px;
}

.material-detail-links .calculation-note {
  margin-top: 0;
}

.room-scope-note {
  padding: 0;
  border: 0;
  background: transparent;
  color: #7e8e83;
  font-size: 10px;
}

.room-scope-note:hover {
  color: var(--green);
  text-decoration: underline;
}

.mini-badge {
  padding: 2px 5px;
  border-radius: 7px;
  font-size: 8px;
  font-style: normal;
}

.mini-badge.custom {
  background: #e6f4ec;
  color: #3d725a;
}

.mini-badge.review {
  background: #fff0dd;
  color: #9b5d3f;
}

.quantity-control {
  display: flex;
  align-items: center;
  gap: 5px;
}

.quantity-control input {
  width: 74px;
  height: 34px;
  padding: 4px 7px;
  border: 1px solid #dcd0c3;
  border-radius: 7px;
  background: #fffaf3;
  color: #35443b;
  text-align: center;
  font-weight: 750;
}

.quantity-control > span {
  min-width: 26px;
  color: #8f8377;
  font-size: 10px;
}

.quantity-plus {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--terra);
  color: #fff;
  font-size: 18px;
  box-shadow: 0 5px 10px rgba(196, 119, 85, 0.22);
}

.material-more {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #a29588;
  font-size: 18px;
}

.material-more:hover {
  background: #f8e9e3;
  color: var(--danger);
}

.materials-footer {
  position: absolute;
  right: 16px;
  bottom: 12px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 8px 10px 8px 14px;
  border-radius: 9px;
  background: var(--green);
  color: #fff9ef;
  box-shadow: 0 10px 22px rgba(41, 75, 61, 0.2);
}

.materials-footer > div {
  flex: 1;
}

.materials-footer small {
  display: block;
  color: #b7c7bf;
  font-size: 9px;
}

.materials-footer b {
  font-size: 13px;
}

.material-empty {
  min-height: 440px;
}

.picker-search-wrap {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  color: #6f6459;
  font-size: 12px;
}

.picker-search-wrap input {
  height: 40px;
  padding: 0 10px;
  border: 1px solid #ded3c6;
  border-radius: 7px;
  background: #fffdf9;
}

.picker-list {
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 3px;
}

.picker-row {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 7px;
  border: 0;
  border-top: 1px solid #eee7df;
  background: transparent;
  color: #4d574f;
  text-align: left;
}

.picker-row:first-child {
  border-top: 0;
}

.picker-row[hidden] {
  display: none;
}

.picker-row strong {
  display: block;
  font-size: 13px;
}

.picker-row small {
  display: block;
  margin-top: 3px;
  color: #988d81;
  font-size: 10px;
}

.picker-row em {
  flex: 0 0 auto;
  color: var(--terra);
  font-size: 11px;
  font-style: normal;
}

.picker-row em.selected {
  color: #4d785f;
}

.basis-dialog {
  max-height: 58vh;
  margin-top: 12px;
  overflow: auto;
}

.basis-group h3 {
  margin: 15px 0 7px;
  color: var(--green);
  font-size: 13px;
}

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

.basis-grid label {
  padding: 8px;
  border: 1px solid #e6dacd;
  border-radius: 7px;
  background: #fffdf9;
}

.basis-grid label > span {
  display: block;
  color: #70655b;
  font-size: 10px;
  font-weight: 700;
}

.basis-grid label > div {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
}

.basis-grid input {
  min-width: 0;
  width: 100%;
  height: 30px;
  padding: 4px 6px;
  border: 1px solid #dfd4c8;
  border-radius: 5px;
  background: #fff5e0;
}

.basis-grid em {
  color: #92867a;
  font-size: 10px;
  font-style: normal;
}

.basis-grid small {
  display: block;
  min-height: 27px;
  margin-top: 4px;
  color: #9e9387;
  font-size: 9px;
  line-height: 1.45;
}

.catalog-summary-line {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 2px 10px;
  color: #9a8e82;
  font-size: 10px;
}

.catalog-summary-line b {
  color: var(--green);
  font-size: 11px;
}

.catalog-summary-line i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #c7bbb0;
}

.picker-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 11px;
  padding: 9px 10px;
  border-radius: 7px;
  background: #edf4ef;
  color: #6a7c72;
  font-size: 11px;
}

.picker-summary b {
  color: var(--green);
}

.picker-row {
  display: block;
  width: 100%;
  padding: 10px 7px;
  border: 0;
  border-top: 1px solid #eee7df;
  background: transparent;
  color: #4d574f;
  text-align: left;
}

.picker-row:first-child {
  border-top: 0;
}

.picker-main {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.picker-index {
  min-width: 23px;
  color: #b0a397;
  font-size: 10px;
  line-height: 1.8;
}

.picker-copy {
  min-width: 0;
  flex: 1;
}

.picker-name-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.picker-name-line strong {
  color: #334139;
  font-size: 13px;
}

.picker-name-line em,
.picker-name-line i {
  padding: 2px 5px;
  border-radius: 7px;
  background: #eef4ef;
  color: #4e715f;
  font-size: 9px;
  font-style: normal;
}

.picker-name-line i {
  background: #f5e6dc;
  color: #955d43;
}

.picker-copy > small {
  display: block;
  margin-top: 4px;
  color: #978c80;
  font-size: 10px;
  line-height: 1.5;
}

.detail-count {
  display: inline-block;
  margin-top: 5px;
  padding: 3px 6px;
  border-radius: 7px;
  background: #f6f0e8;
  color: #8e7965;
  font-size: 9px;
}

.picker-add-button {
  flex: 0 0 auto;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: var(--terra);
  color: #fff;
  font-size: 10px;
  font-weight: 750;
}

.picker-add-button.selected {
  background: var(--green);
}

.picker-details {
  margin: 8px 0 0 32px;
  border-top: 1px dashed #e6dccf;
}

.picker-details summary {
  padding: 8px 2px 2px;
  color: #8b6c57;
  font-size: 10px;
  cursor: pointer;
}

.picker-option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 8px;
}

.picker-option-grid label {
  display: grid;
  gap: 4px;
  color: #85796d;
  font-size: 9px;
}

.picker-option-grid select {
  height: 32px;
  padding: 0 7px;
  border: 1px solid #ded3c6;
  border-radius: 6px;
  background: #fffdf9;
  color: #465048;
  font-size: 10px;
}

.picker-facts,
.detail-facts {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 6px 9px;
  margin: 9px 0 0;
  padding: 8px 9px;
  border-radius: 7px;
  background: #faf7f1;
  font-size: 10px;
  line-height: 1.55;
}

.picker-facts dt,
.detail-facts dt {
  color: #8f8377;
}

.picker-facts dd,
.detail-facts dd {
  margin: 0;
  color: #565f58;
}

.detail-tags,
.detail-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-tags span,
.detail-chip-list span {
  padding: 4px 7px;
  border-radius: 10px;
  background: #eef4ef;
  color: #456c58;
  font-size: 10px;
}

.detail-tags span.custom {
  background: #f6e6dc;
  color: #966149;
}

.detail-block {
  margin-top: 13px;
}

.detail-block h3 {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 13px;
}

.detail-block p {
  margin: 3px 0;
  color: #59635b;
  font-size: 12px;
}

.room-scope-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  max-height: 42vh;
  overflow: auto;
  margin-top: 10px;
}

.room-scope-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px;
  border: 1px solid #e4d9cc;
  border-radius: 7px;
  background: #fffdf9;
}

.room-scope-list input {
  accent-color: var(--green);
}

.room-scope-list b,
.room-scope-list small {
  display: block;
}

.room-scope-list b {
  font-size: 12px;
}

.room-scope-list small {
  margin-top: 2px;
  color: #968a7e;
  font-size: 9px;
}

.settings-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 0 4px 22px;
}

.settings-hero p {
  margin: 6px 0 0;
}

.settings-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.settings-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  min-height: 650px;
  overflow: hidden;
  background: rgba(255, 253, 249, 0.66);
}

.settings-sidebar {
  padding: 17px 11px;
  border-right: 1px solid var(--line);
  background: #faf7f2;
}

.settings-stat {
  display: flex;
  justify-content: space-between;
  margin: 14px 8px 0;
  padding-top: 10px;
  border-top: 1px solid #e9dfd3;
  color: #877b6f;
  font-size: 11px;
}

.settings-stat b {
  color: var(--green);
}

.settings-main {
  min-width: 0;
  width: 100%;
  overflow: hidden;
  padding: 15px;
}

.settings-utility-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  margin-bottom: 10px;
  color: #94887c;
  font-size: 11px;
}

.settings-utility-row span {
  margin-right: auto;
}

.rule-list-area {
  margin-top: 12px;
}

.rule-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 145px 125px 18px;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid #e5dacf;
  border-radius: 9px;
  background: var(--paper);
  color: #4c564f;
  margin-bottom: 6px;
  text-align: left;
}

.rule-row:hover {
  border-color: #cdbba7;
  background: #fffaf3;
}

.rule-row[hidden] {
  display: none;
}

.rule-title {
  min-width: 0;
  overflow: hidden;
}

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

.rule-title strong {
  font-size: 13px;
}

.rule-title small {
  margin-top: 4px;
  color: #988d82;
  font-size: 10px;
}

.rule-metric {
  color: #6f6359;
  text-align: right;
}

.rule-metric b,
.rule-metric small {
  display: block;
}

.rule-metric b {
  color: var(--green);
  font-size: 12px;
}

.rule-metric small {
  margin-top: 4px;
  color: #9c9084;
  font-size: 9px;
}

.rule-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.rule-badges em {
  padding: 3px 6px;
  border-radius: 7px;
  font-size: 9px;
  font-style: normal;
}

.rule-badges .default {
  background: #e7f0e9;
  color: #466f5b;
}

.rule-badges .custom {
  background: #f5e4d8;
  color: #975b3f;
}

.rule-badges .off {
  background: #ece9e4;
  color: #81776d;
}

.checkbox-field {
  display: flex;
  align-items: center;
  flex-direction: row;
  align-self: end;
  min-height: 42px;
}

.checkbox-field input {
  width: auto;
  min-height: auto;
}

.delete-rule-button {
  width: 100%;
  margin-top: 14px;
  padding: 9px;
  border: 1px solid #e2b7af;
  border-radius: 7px;
  background: #f9e9e5;
  color: var(--danger);
  font-size: 11px;
}

.rule-change-list {
  display: grid;
  gap: 6px;
  max-height: 46vh;
  overflow: auto;
  margin-top: 12px;
}

.rule-change-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px;
  border: 1px solid #e5dacf;
  border-radius: 8px;
  background: #fffdf9;
}

.rule-change-row input {
  margin-top: 3px;
}

.rule-change-row strong,
.rule-change-row small {
  display: block;
}

.rule-change-row strong {
  font-size: 12px;
}

.rule-change-row small {
  margin-top: 3px;
  color: #94897d;
  font-size: 10px;
  line-height: 1.45;
}

.sheet-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 680px;
  background: var(--cream);
}

.sheet-options {
  display: grid;
  align-content: start;
  gap: 13px;
  padding: 20px;
  border-right: 1px solid var(--line);
  background: #faf7f2;
}

.sheet-options h2 {
  margin: 0;
  color: var(--green);
  font-family: "STSong", "Songti SC", serif;
  font-size: 22px;
}

.sheet-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #665b50;
  font-size: 12px;
}

.sheet-toggle input {
  accent-color: var(--green);
}

.sheet-summary {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 8px;
  background: var(--green-soft);
  color: #61746a;
  font-size: 11px;
}

.sheet-summary strong {
  color: var(--green);
  font-size: 16px;
}

.sheet-summary small {
  color: #8a958e;
}

.sheet-download {
  width: 100%;
}

.sheet-preview-panel {
  min-width: 0;
  padding: 16px;
  overflow: auto;
}

.sheet-preview-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 2px 10px;
  color: #6d6258;
  font-size: 12px;
}

.sheet-preview-title span {
  color: #9e9286;
  font-size: 10px;
}

.sheet-preview-wrap {
  display: flex;
  min-height: 500px;
  justify-content: center;
  overflow: auto;
  padding: 16px;
  border: 1px solid #dfd4c8;
  border-radius: 10px;
  background: #e9e2d8;
}

.sheet-canvas {
  display: block;
  width: min(100%, 860px);
  height: auto;
  background: var(--paper);
  box-shadow: 0 14px 36px rgba(54, 45, 36, 0.18);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(28, 35, 30, 0.4);
  backdrop-filter: blur(4px);
}

.modal-card {
  width: min(460px, 100%);
  overflow: hidden;
  border-radius: 15px;
  background: var(--paper);
  box-shadow: 0 28px 80px rgba(29, 35, 30, 0.28);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 18px 12px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  color: var(--green);
  font-size: 18px;
}

.modal-body {
  padding: 17px 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 18px 17px;
}

.install-steps {
  margin: 10px 0;
  padding-left: 24px;
  color: #596159;
  font-size: 13px;
  line-height: 1.8;
}

@media (max-width: 980px) {
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .room-list-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .room-list {
    display: flex;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .room-list-item {
    min-width: 170px;
  }

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

  .trade-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .trade-filters {
    display: flex;
    overflow-x: auto;
  }

  .trade-filter {
    width: auto;
    min-width: 110px;
  }

  .basis-settings-button {
    width: auto;
    margin-top: 8px;
  }

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

  .settings-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .settings-stat {
    display: none;
  }

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

  .sheet-options {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 700px) {
  .global-head {
    margin-bottom: 22px;
  }

  .projects-hero {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .project-create-card {
    min-height: 110px;
  }

  .project-header {
    min-height: 62px;
    padding: 0 12px;
  }

  .project-name-wrap {
    max-width: 48vw;
  }

  .project-title-button {
    overflow: hidden;
    max-width: 48vw;
    padding-right: 18px;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .project-name-wrap small,
  .project-save-state {
    display: none;
  }

  .project-tabs {
    justify-content: space-around;
    gap: 4px;
    padding: 0 8px;
  }

  .project-placeholder,
  .settings-placeholder {
    padding: 18px;
  }

  .room-main-panel {
    padding: 12px;
  }

  .room-editor-head {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .room-head-actions {
    justify-content: flex-end;
  }

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

  .opening-row {
    grid-template-columns: 1.2fr 1fr 1fr 30px;
    gap: 5px;
    padding: 7px;
  }

  .opening-head span:nth-child(4),
  .opening-row .opening-area {
    display: none;
  }

  .measurement-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .footer-action {
    text-align: center;
  }

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

  .material-main-panel {
    min-height: 560px;
    padding: 10px 10px 68px;
  }

  .material-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .material-search {
    grid-column: 1 / -1;
  }

  .material-line-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
  }

  .quantity-control {
    grid-column: 1 / 2;
    margin-top: -2px;
  }

  .material-more {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
  }

  .materials-footer {
    right: 10px;
    bottom: 9px;
    left: 10px;
    flex-wrap: wrap;
  }

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

  .room-scope-list {
    grid-template-columns: 1fr;
  }

  .settings-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .settings-actions {
    justify-content: flex-start;
  }

  .rule-row {
    grid-template-columns: minmax(0, 1fr) minmax(82px, auto);
  }

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

  .rule-badges {
    grid-column: 1 / 2;
    min-width: 0;
  }

  .rule-row .project-card-arrow {
    display: none;
  }

  .rule-title strong {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .project-header-actions {
    align-items: flex-end;
    flex-direction: column;
  }

  .rule-update-button {
    max-width: 38vw;
    overflow: hidden;
    padding: 5px 6px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sheet-preview-panel {
    padding: 10px;
  }

  .sheet-preview-wrap {
    min-height: 360px;
    padding: 8px;
  }
}

#toast-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(360px, calc(100vw - 40px));
  padding: 11px 14px;
  border-radius: 9px;
  background: var(--green);
  color: #fffaf1;
  box-shadow: var(--shadow);
  font-size: 14px;
}

.toast button {
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: #ffd8be;
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 700px) {
  .app-shell {
    padding: 12px;
  }

  #toast-root {
    right: 12px;
    bottom: 12px;
  }
}

