:root {
  --brand-ink: #172129;
  --brand-gold: #e8a838;
  --brand-blue: #2d5f8b;
  --brand-slate: #7b858b;
  --bg: #f6f7f8;
  --surface: #ffffff;
  --surface-2: #eef3f6;
  --ink: var(--brand-ink);
  --muted: #66737c;
  --line: #dce3e8;
  --green: var(--brand-blue);
  --green-2: var(--brand-ink);
  --gold: var(--brand-gold);
  --red: #b94b3f;
  --blue: var(--brand-blue);
  --shadow: 0 18px 45px rgba(23, 33, 41, 0.08);
}

/* Quotation workflow */
.metrics-grid.quotation-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.quotation-row {
  align-items: center;
}

.quotation-row-total,
.quotation-head-total {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .55rem;
  min-width: 180px;
}

.quotation-row-total > strong,
.quotation-head-total > strong {
  color: var(--ink);
  font-size: clamp(1.4rem, 2.5vw, 2rem);
}

.quotation-workflow-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
  margin: 1rem 0 1.5rem;
}

.quotation-workflow-strip > div {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: var(--surface);
}

.quotation-workflow-strip span {
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--surface-strong, #ece8df);
  font-weight: 800;
}

.quotation-workflow-strip .active {
  border-color: var(--green);
  color: var(--ink);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--green) 15%, transparent);
}

.quotation-workflow-strip .active span,
.quotation-workflow-strip .done span {
  background: var(--green);
  color: #fff;
}

.quotation-workflow-strip .done {
  color: var(--ink);
}

.quotation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, .75fr);
  gap: 1.25rem;
  align-items: start;
}

.quotation-side-column {
  display: grid;
  gap: 1rem;
  position: sticky;
  top: 1rem;
}

.quotation-line-list,
.quotation-add-tools {
  display: grid;
  gap: .85rem;
}

.quotation-line-card {
  border: 1px solid var(--line);
  border-left: 4px solid #278157;
  border-radius: 14px;
  padding: 1rem;
  background: var(--surface);
}

.quotation-line-card.needs-review {
  border-left-color: #c97a13;
}

.quotation-line-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
}

.quotation-line-summary h3 {
  margin: .3rem 0;
}

.quotation-line-summary p,
.quotation-line-summary small {
  display: block;
  margin: .2rem 0 0;
  color: var(--muted);
}

.quotation-line-amount {
  display: grid;
  gap: .55rem;
  justify-items: end;
  white-space: nowrap;
}

.quotation-line-amount strong {
  font-size: 1.2rem;
}

.quotation-line-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  align-items: center;
  margin-top: .85rem;
  padding-top: .8rem;
  border-top: 1px dashed var(--line);
}

.quotation-line-edit {
  flex: 1 1 100%;
}

.quotation-add-tools {
  margin-top: 1rem;
}

.quotation-total-list {
  display: grid;
  gap: .6rem;
}

.quotation-total-list > div,
.quotation-preview-total > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: .55rem;
  border-bottom: 1px solid var(--line);
}

.quotation-total-list .grand,
.quotation-preview-total .grand {
  padding-top: .55rem;
  border-bottom: 0;
  color: var(--ink);
  font-size: 1.25rem;
}

.quotation-action-panel form,
.quotation-action-panel details,
.quotation-note-panel p {
  margin-top: .8rem;
}

.status.in_review,
.status.needs_review {
  color: #86500a;
  background: #fff2d9;
}

.status.sent {
  color: #195c83;
  background: #e5f4fc;
}

.status.accepted,
.status.reviewed {
  color: #176840;
  background: #e1f5e9;
}

.quotation-preview-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  max-width: 1080px;
  margin: 0 auto 1rem;
}

.quotation-preview-toolbar > div {
  display: flex;
  gap: .75rem;
  align-items: center;
}

.quotation-preview-sheet {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 3.25rem);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: #1f2520;
  box-shadow: 0 20px 60px rgb(25 39 29 / 10%);
}

.quotation-watermark {
  position: absolute;
  inset: 42% auto auto 50%;
  z-index: 0;
  transform: translate(-50%, -50%) rotate(-24deg);
  color: rgb(165 45 45 / 10%);
  font-size: clamp(4rem, 12vw, 8rem);
  font-weight: 900;
  white-space: nowrap;
  pointer-events: none;
}

.quotation-preview-sheet > *:not(.quotation-watermark) {
  position: relative;
  z-index: 1;
}

.quotation-preview-header,
.quotation-preview-brand,
.quotation-preview-footer {
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
  align-items: center;
}

.quotation-preview-brand img {
  width: 62px;
  height: 62px;
  object-fit: contain;
}

.quotation-preview-brand div,
.quotation-preview-number {
  display: grid;
  gap: .2rem;
}

.quotation-preview-brand strong,
.quotation-preview-number strong {
  font-size: 1.35rem;
}

.quotation-preview-number {
  text-align: right;
}

.quotation-preview-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .7rem 1.5rem;
  margin: 2rem 0;
  padding: 1.2rem;
  border-radius: 12px;
  background: #f6f5f0;
}

.quotation-preview-meta > div {
  display: grid;
  gap: .2rem;
}

.quotation-preview-meta span,
.quotation-preview-number span,
.quotation-preview-number small,
.quotation-preview-footer span {
  color: #687069;
  font-size: .85rem;
}

.quotation-preview-lines {
  margin-top: 1rem;
  border: 1px solid #dcded9;
  border-radius: 12px;
  overflow: hidden;
}

.quotation-preview-line {
  display: grid;
  grid-template-columns: .45fr minmax(260px, 3fr) .7fr .7fr 1.15fr 1.15fr;
  gap: .75rem;
  align-items: start;
  padding: .8rem 1rem;
  border-bottom: 1px solid #e5e6e2;
}

.quotation-preview-line:last-child {
  border-bottom: 0;
}

.quotation-preview-line.heading {
  background: #27382e;
  color: #fff;
  font-weight: 700;
}

.quotation-preview-line > span:nth-last-child(-n+2) {
  text-align: right;
}

.quotation-preview-line small {
  display: block;
  margin-top: .2rem;
  color: #687069;
}

.quotation-preview-total {
  display: grid;
  gap: .55rem;
  max-width: 460px;
  margin: 1.5rem 0 1.5rem auto;
}

.quotation-preview-note {
  margin-top: 1.5rem;
  padding: 1.2rem;
  border: 1px solid #dcded9;
  border-radius: 12px;
  white-space: pre-line;
}

.quotation-preview-note h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

.quotation-preview-footer {
  align-items: stretch;
  margin-top: 3rem;
}

.quotation-preview-footer > div {
  display: grid;
  flex: 1;
  gap: 2rem;
  min-height: 110px;
  padding: 1rem;
  border-top: 1px solid #bfc4bd;
}

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

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

  .quotation-side-column {
    position: static;
  }

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

@media (max-width: 620px) {
  .metrics-grid.quotation-metrics {
    grid-template-columns: 1fr;
  }

  .quotation-row,
  .quotation-line-summary,
  .quotation-preview-meta {
    grid-template-columns: 1fr;
  }

  .quotation-row-total,
  .quotation-head-total,
  .quotation-line-amount {
    align-items: stretch;
    justify-items: start;
    min-width: 0;
  }

  .quotation-workflow-strip {
    grid-template-columns: 1fr;
  }

  .quotation-preview-toolbar,
  .quotation-preview-header,
  .quotation-preview-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .quotation-preview-number {
    text-align: left;
  }

  .quotation-preview-line.heading {
    display: none;
  }

  .quotation-preview-line {
    grid-template-columns: 1fr 1fr;
  }

  .quotation-preview-line > span::before {
    content: attr(data-label);
    display: block;
    margin-bottom: .15rem;
    color: #687069;
    font-size: .75rem;
  }

  .quotation-preview-line > span:nth-child(2) {
    grid-column: 1 / -1;
  }
}

@media print {
  body {
    background: #fff !important;
  }

  .topbar,
  .no-print {
    display: none !important;
  }

  main {
    max-width: none !important;
    padding: 0 !important;
  }

  .quotation-preview-sheet {
    max-width: none;
    min-height: 100vh;
    margin: 0;
    padding: 12mm;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .quotation-preview-line {
    break-inside: avoid;
  }
}

/* Role-scoped field workspace */
.field-work-head { padding-bottom: 1rem; }

.field-flow-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .65rem;
  margin: 0 0 1.25rem;
}

.field-flow-strip span {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .7rem .85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: .86rem;
}

.field-flow-strip strong {
  display: grid;
  width: 1.65rem;
  height: 1.65rem;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
}

.field-project-block,
.field-agreement-section {
  margin: 0 0 1.25rem;
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.field-project-head,
.field-project-actions,
.field-task-card > header,
.field-submission > div:first-child,
.settlement-review-card > div:first-child {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .8rem;
}

.field-project-head h2,
.field-task-card h3,
.field-agreement-list h3 { margin: .18rem 0 .35rem; }

.field-project-head p,
.field-task-card p,
.field-agreement-list p { margin: 0; color: var(--muted); }

.field-mini-metrics { display: flex; gap: .7rem; margin: .9rem 0; }
.field-mini-metrics span { padding: .55rem .75rem; border-radius: 12px; background: var(--surface-2); }

.field-task-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .9rem;
  margin-top: 1rem;
}

.field-task-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 18px;
  background: #fff;
}

.field-task-card.status-ready_for_review { border-left-color: #c97a13; }
.field-task-card.status-done { border-left-color: #278157; }

.field-task-meta { display: flex; flex-wrap: wrap; gap: .45rem; margin: .75rem 0; }
.field-task-meta span {
  padding: .38rem .55rem;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .82rem;
}

.field-alert { margin: .65rem 0; padding: .65rem .75rem; border-radius: 10px; background: #fff4d9; color: #744b08; }
.field-alert.danger { background: #fff0ed; color: #922f25; }

.field-checklist {
  display: grid;
  gap: .45rem;
  margin: .8rem 0;
  padding: .75rem;
  border-radius: 13px;
  background: var(--surface-2);
}

.field-checklist label { display: flex; align-items: center; gap: .55rem; }

.field-camera-button,
.photo-tray {
  display: grid;
  gap: .25rem;
  padding: .9rem;
  border: 1px dashed var(--green);
  border-radius: 14px;
  background: #f5fbf8;
  cursor: pointer;
}

.field-camera-button input { margin-top: .5rem; }

.photo-tray {
  gap: .75rem;
  cursor: default;
}

.photo-tray-copy {
  display: grid;
  gap: .2rem;
}

.photo-tray-copy span {
  color: var(--muted);
  font-size: .88rem;
}

.photo-tray-native {
  width: 100%;
  margin-top: .15rem;
}

.photo-tray.is-enhanced .photo-tray-native {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.photo-tray-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
}

.photo-tray-controls[hidden],
.photo-tray-previews[hidden],
.photo-tray-error[hidden] {
  display: none;
}

.photo-tray-add {
  min-height: 44px;
}

.photo-tray-count {
  padding: .45rem .65rem;
  border-radius: 999px;
  background: #fff4d9;
  color: #744b08;
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
}

.photo-tray-count.is-complete {
  background: #eaf7f0;
  color: #226c4b;
}

.photo-tray-previews {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .55rem;
}

.photo-tray-item {
  position: relative;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.photo-tray-item img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.photo-tray-remove {
  position: absolute;
  top: .35rem;
  right: .35rem;
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .75);
  border-radius: 999px;
  background: rgba(23, 33, 41, .86);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.photo-tray-error {
  margin: 0;
  color: var(--red);
  font-size: .85rem;
  font-weight: 600;
}

[data-photo-submit]:disabled {
  cursor: not-allowed;
  opacity: .55;
}
.field-submit-form,
.field-review-actions,
.field-blocker-drawer form,
.settlement-review-card form { display: grid; gap: .65rem; }

.field-action-note {
  margin: .65rem 0 0 !important;
  padding: .65rem;
  border-radius: 10px;
  background: var(--surface-2);
  text-align: center;
}

.field-action-note.success { background: #eaf7f0; color: #226c4b; }

.field-submission,
.settlement-review-card {
  display: grid;
  gap: .65rem;
  margin: .8rem 0;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbfcfb;
}

.field-submission.compact { margin-bottom: .7rem; }
.field-evidence-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem; }
.field-evidence-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.field-agreement-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; margin-top: 1rem; }
.field-agreement-list article { padding: .9rem; border: 1px solid var(--line); border-radius: 14px; }
.field-agreement-list article > div { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .7rem; }
.field-agreement-list article > div span { padding: .4rem .55rem; border-radius: 9px; background: var(--surface-2); }

.project-role-guide { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .55rem; margin: .8rem 0; }
.project-role-guide > div { display: grid; gap: .2rem; padding: .7rem; border-radius: 12px; background: var(--surface-2); }
.project-role-guide span,
.project-member-row small { color: var(--muted); font-size: .82rem; }
.project-member-row,
.project-member-row > span { display: flex; align-items: center; justify-content: space-between; gap: .7rem; }
.project-member-row > span { flex: 1; }

.team-role-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .7rem;
  margin: 0 0 1.25rem;
}

.team-role-grid article,
.team-safety-note {
  padding: .9rem;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
}

.team-role-grid article { display: grid; gap: .28rem; }
.team-role-grid span { color: var(--brand-blue); font-size: .8rem; font-weight: 800; text-transform: uppercase; }
.team-role-grid p,
.team-user-card p,
.team-safety-note p { margin: 0; color: var(--muted); }
.team-workspace { align-items: start; }
.team-user-list { display: grid; gap: .75rem; }

.team-user-card {
  display: grid;
  gap: .75rem;
  padding: .9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.team-user-card.is-inactive { opacity: .72; background: var(--surface-2); }
.team-user-main,
.team-user-actions { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.team-user-main { justify-content: flex-start; }
.team-user-main h3 { margin: 0 0 .2rem; }
.team-avatar {
  display: grid;
  flex: 0 0 2.7rem;
  width: 2.7rem;
  height: 2.7rem;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-ink);
  color: #fff;
  font-weight: 800;
}
.team-user-actions { justify-content: flex-end; }
.team-user-actions details { min-width: 13rem; }
.team-user-actions form { margin: 0; }
.team-safety-note { margin-top: .9rem; }

@media (max-width: 760px) {
  .field-flow-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-task-list,
  .field-agreement-list,
  .project-role-guide,
  .team-role-grid { grid-template-columns: 1fr; }
  .field-project-head,
  .field-task-card > header { align-items: stretch; flex-direction: column; }
  .field-project-actions { width: 100%; }
  .field-project-actions .button { flex: 1; }
  .team-user-actions { align-items: stretch; flex-direction: column; }
  .team-user-actions details,
  .team-user-actions form,
  .team-user-actions .button { width: 100%; }
  .photo-tray-controls { align-items: stretch; flex-direction: column; }
  .photo-tray-add,
  .photo-tray-count { width: 100%; text-align: center; }
}

@media (max-width: 420px) {
  .photo-tray-previews { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Lean project cost control */
.spending-page-head {
  margin-bottom: 18px;
}

.spending-feedback {
  position: sticky;
  top: 82px;
  z-index: 12;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.cost-position-summary > div {
  position: relative;
  overflow: hidden;
}

.cost-position-summary > div::after {
  position: absolute;
  right: -18px;
  bottom: -28px;
  width: 78px;
  height: 78px;
  border-radius: 999px;
  background: rgba(45, 95, 139, 0.08);
  content: "";
}

.money-reserved {
  border-color: rgba(232, 168, 56, 0.5) !important;
  background: #fffaf0 !important;
}

.money-actual {
  border-color: rgba(45, 95, 139, 0.35) !important;
  background: #f3f8fc !important;
}

.cash-context-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin: 12px 0 22px;
  padding: 12px 16px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.cash-context-bar strong {
  color: var(--ink);
}

.cash-context-bar small {
  color: var(--red);
}

.available-budget-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 12px 0 20px;
  padding: 16px 20px;
  color: #173a2d;
  border: 1px solid #b9d8c7;
  border-radius: 14px;
  background: #eff8f3;
}

.available-budget-bar > div {
  display: grid;
  gap: 2px;
}

.available-budget-bar strong {
  font-size: 24px;
}

.available-budget-bar p {
  margin: 0;
  color: #48675b;
  font-size: 13px;
}

.available-budget-bar.over-budget,
.budget-category-row.over-budget {
  color: #7d2d25;
  border-color: #e4b8b3;
  background: #fff3f1;
}

.spending-section {
  margin: 0 0 20px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 8px 28px rgba(23, 33, 41, 0.045);
}

.spending-section h2,
.spending-section h3,
.spending-section p {
  margin-top: 0;
}

.section-heading-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.budget-category-list {
  display: grid;
  gap: 8px;
}

.budget-category-row {
  display: grid;
  grid-template-columns: minmax(130px, 1.2fr) repeat(4, minmax(100px, 1fr));
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfd;
  font-size: 13px;
}

.budget-category-row span {
  color: var(--muted);
}

.budget-editor {
  margin-top: 14px;
}

.form-help {
  color: var(--muted);
  font-size: 13px;
}

.spend-type-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
  padding: 0;
  border: 0;
}

.spend-type-picker legend {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.spend-type-picker label {
  cursor: pointer;
}

.spend-type-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.spend-type-picker span {
  display: grid;
  gap: 2px;
  min-height: 74px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfd;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.spend-type-picker small {
  color: var(--muted);
}

.spend-type-picker input:checked + span {
  border-color: var(--brand-blue);
  background: #f1f7fc;
  box-shadow: 0 0 0 2px rgba(45, 95, 139, 0.12);
}

.request-essential-fields {
  grid-template-columns: minmax(220px, 2fr) minmax(150px, 0.8fr) auto;
}

.spend-request-list {
  display: grid;
  gap: 14px;
}

.spend-request-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand-slate);
  border-radius: 14px;
  background: #fff;
  scroll-margin-top: 110px;
}

.spend-request-card.status-pending {
  border-left-color: var(--brand-gold);
}

.spend-request-card.status-approved {
  border-left-color: var(--brand-blue);
}

.spend-request-card.status-rejected,
.spend-request-card.status-cancelled {
  border-left-color: #b8c0c5;
  background: #fafafa;
}

.spend-request-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.spend-request-card h3 {
  margin: 3px 0 4px;
  font-size: 19px;
}

.spend-request-card header p {
  margin: 0;
  color: var(--muted);
}

.workflow-badge {
  flex: 0 0 auto;
  padding: 7px 10px;
  color: #27485f;
  border-radius: 999px;
  background: #eaf2f8;
  font-size: 12px;
  font-weight: 700;
}

.request-money-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 8px;
}

.request-money-strip span {
  display: grid;
  gap: 1px;
  min-width: 130px;
  padding: 8px 11px;
  color: var(--muted);
  border-radius: 9px;
  background: var(--surface-2);
  font-size: 12px;
}

.request-money-strip strong {
  color: var(--ink);
  font-size: 15px;
}

.request-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--muted);
  font-size: 12px;
}

.request-meta-line a {
  color: var(--brand-blue);
  font-weight: 600;
}

.decision-note {
  margin: 10px 0 0 !important;
  padding: 9px 11px;
  border-radius: 8px;
  background: #fff8e9;
  font-size: 13px;
}

.request-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.inline-approval-form {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(180px, 1.3fr) auto;
  gap: 10px;
  align-items: end;
}

.compact-action-form {
  display: grid;
  gap: 10px;
  padding-top: 12px;
}

.check-label {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 9px;
}

.check-label input {
  width: 20px;
  height: 20px;
}

.actual-history,
.cancel-request-drawer {
  margin-top: 12px;
}

.settlement-result {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 14px;
  padding: 12px 14px;
  color: #315c49;
  border: 1px solid #c9dfd3;
  border-radius: 10px;
  background: #f1f8f4;
}

@media (max-width: 760px) {
  .spending-feedback {
    top: 70px;
  }

  .available-budget-bar,
  .section-heading-inline,
  .spend-request-card > header {
    align-items: stretch;
    flex-direction: column;
  }

  .spending-section {
    padding: 16px;
    border-radius: 14px;
  }

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

  .budget-category-row > :first-child,
  .budget-category-row > :last-child {
    grid-column: 1 / -1;
  }

  .spend-type-picker,
  .request-essential-fields,
  .inline-approval-form,
  .request-action-grid {
    grid-template-columns: 1fr;
  }

  .spend-type-picker span {
    min-height: 0;
  }

  .request-money-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .request-money-strip span {
    min-width: 0;
  }

  .operational-actions .button,
  .inline-approval-form .button {
    width: 100%;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Kanit", "Noto Sans Thai", system-ui, sans-serif;
  letter-spacing: 0;
}

@font-face {
  font-family: "Kanit";
  src: url("/assets/fonts/Kanit-Regular.ttf") format("truetype");
  font-weight: 400;
}

@font-face {
  font-family: "Kanit";
  src: url("/assets/fonts/Kanit-SemiBold.ttf") format("truetype");
  font-weight: 600;
}

@font-face {
  font-family: "Kanit";
  src: url("/assets/fonts/Kanit-Bold.ttf") format("truetype");
  font-weight: 700;
}

a {
  color: inherit;
  text-decoration: none;
}

main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
  padding: 12px 28px;
  background: rgba(246, 247, 248, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand img {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  max-width: 44px;
  max-height: 44px;
  object-fit: contain;
  border-radius: 8px;
  background: white;
  border: 1px solid var(--line);
}

.brand span {
  display: grid;
  line-height: 1.05;
}

.brand strong {
  font-size: 17px;
}

.brand small,
.eyebrow,
.code {
  color: var(--brand-slate);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.nav {
  display: flex;
  gap: 8px;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.nav a,
.nav-form button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid rgba(45, 95, 139, 0.35);
  outline-offset: 2px;
}

.nav-form {
  margin: 0;
}

.nav-form button {
  color: var(--muted);
}

.nav a.active,
.button.primary {
  border-color: var(--brand-ink);
  background: var(--brand-ink);
  color: white;
}

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

.button.full-width {
  width: 100%;
  margin-top: 14px;
}

.button.disabled,
.button[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
}

.button.light {
  border-color: rgba(255, 255, 255, 0.46);
  background: rgba(255, 255, 255, 0.14);
  color: white;
}

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

.login-shell {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 150px);
  padding: 32px 0;
}

.login-panel {
  width: min(460px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin: 6px 0 10px;
  font-size: 30px;
  line-height: 1.18;
}

.login-panel p {
  color: var(--muted);
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.alert {
  display: grid;
  gap: 4px;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

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

.alert.error {
  border-color: rgba(185, 75, 63, 0.35);
  background: #fff3f1;
}

.customer-home {
  margin: -28px;
  background: #f7f8f5;
}

.customer-home-hero {
  position: relative;
  display: grid;
  align-items: end;
  min-height: min(640px, calc(100vh - 112px));
  padding: 78px 28px 46px;
  overflow: hidden;
  background-image: var(--hero-image);
  background-size: cover;
  background-position: center;
  color: white;
}

.customer-home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(10, 17, 13, 0.78) 0%, rgba(10, 17, 13, 0.56) 46%, rgba(10, 17, 13, 0.34) 100%),
    linear-gradient(0deg, rgba(10, 17, 13, 0.58) 0%, rgba(10, 17, 13, 0.1) 56%);
}

.home-hero-content {
  position: relative;
  width: min(1120px, 100%);
  margin: 0 auto;
}

.home-hero-content .eyebrow,
.home-hero-content .lead {
  color: rgba(255, 255, 255, 0.84);
}

.home-kicker {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
  text-transform: none;
}

.home-title {
  max-width: 980px;
  margin: 0 0 18px;
  font-size: clamp(48px, 6vw, 78px);
  line-height: 1.04;
}

.home-title span {
  display: block;
}

.home-hero-content .lead {
  max-width: 720px;
  margin-bottom: 18px;
}

.hero-service-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  max-width: 780px;
  margin: 0 0 24px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 15px;
  font-weight: 600;
}

.hero-service-list span {
  position: relative;
}

.hero-service-list span + span::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 0.45em;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
}

.hero-proof-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  width: min(880px, 100%);
  margin-top: 34px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.28);
}

.hero-proof-row div {
  display: grid;
  gap: 4px;
}

.hero-proof-row strong {
  font-size: 16px;
}

.hero-proof-row span {
  color: rgba(255, 255, 255, 0.74);
  font-size: 14px;
  line-height: 1.45;
}

.home-section {
  width: min(1180px, calc(100% - 56px));
  margin: 0 auto;
  padding: 48px 0;
}

.estimate-band {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.estimate-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(440px, 1.05fr);
  gap: 34px;
  width: min(1180px, calc(100% - 56px));
  margin: 0 auto;
  padding: 46px 0;
  align-items: start;
}

.estimate-copy {
  display: grid;
  align-content: start;
  gap: 16px;
  position: sticky;
  top: 96px;
}

.estimate-copy h2,
.assurance-section h2 {
  max-width: 720px;
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.12;
}

.estimate-copy p,
.assurance-section p {
  color: var(--muted);
  line-height: 1.65;
}

.estimate-flow {
  display: grid;
  gap: 10px;
}

.estimate-flow div {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  column-gap: 12px;
  row-gap: 3px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.estimate-flow span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #e4efe6;
  color: var(--green);
  font-weight: 700;
}

.estimate-flow small {
  color: var(--muted);
  line-height: 1.5;
}

.estimate-warning {
  margin: 0;
  padding: 12px 14px;
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  background: #fff8e8;
  color: #705018;
}

.service-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding-top: 24px;
}

.service-strip article,
.process-grid article {
  min-height: 160px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.service-strip span,
.process-grid span {
  color: var(--gold);
  font-weight: 700;
}

.service-strip h2,
.process-grid h3 {
  margin-top: 12px;
}

.service-strip p,
.process-grid p,
.lead-form p {
  color: var(--muted);
  line-height: 1.65;
}

.assurance-section {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(360px, 1fr);
  gap: 32px;
  align-items: start;
}

.process-section h2 {
  max-width: 760px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.12;
}

.home-checklist {
  display: grid;
  gap: 12px;
}

.home-checklist div,
.estimate-notes span,
.success-note {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.home-checklist span,
.estimate-notes span {
  color: var(--muted);
  line-height: 1.5;
}

.home-portfolio-grid {
  margin-top: 18px;
}

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

.lead-form {
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.estimate-form {
  background: #fbfcfa;
}

.success-note {
  border-color: #b8d8c5;
  background: #e8f5ed;
  color: #21533a;
  font-weight: 600;
}

.error-note,
.field-error {
  padding: 12px 14px;
  border: 1px solid #e5b6b0;
  border-radius: 8px;
  background: #fff1ef;
  color: #8a2f27;
  line-height: 1.5;
  font-weight: 600;
}

.success-note[role="status"],
.error-note {
  margin: 0 0 16px;
}

.field-error {
  margin: 0;
  font-size: 14px;
}

.field-error[hidden],
[data-income-only][hidden] {
  display: none !important;
}

.honeypot-field {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.form-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.lead-row {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.6fr) auto;
}

.lead-attachments {
  min-width: 260px;
}

.lead-assessment {
  display: grid;
  gap: 5px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #d7e5da;
  border-radius: 8px;
  background: #f1f8f3;
}

.lead-assessment span {
  color: var(--muted);
  line-height: 1.45;
}

.lead-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.lead-action-row .lean-create-drawer > form {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.customer-decision-card {
  display: grid;
  gap: 10px;
  padding: 14px !important;
  border: 1px solid rgba(232, 168, 56, 0.42) !important;
  border-radius: 8px;
  background: #fffaf0;
}

.customer-decision-card > form,
.customer-decision-card details form {
  display: grid;
  gap: 10px;
  margin: 0;
}

.customer-decision-card details > summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.customer-decision-card .button {
  width: 100%;
}

.workspace-hero,
.project-header,
.customer-hero,
.page-head,
.portfolio-hero,
.portfolio-detail-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
}

.workspace-hero {
  min-height: calc(100vh - 128px);
  align-items: center;
}

.portfolio-hero {
  min-height: 420px;
  align-items: center;
}

.portfolio-detail-hero {
  align-items: center;
}

.portfolio-detail-hero > img {
  width: min(520px, 100%);
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

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

h1 {
  max-width: 880px;
  margin-bottom: 14px;
  font-size: clamp(34px, 5vw, 68px);
  line-height: 1.02;
}

h2 {
  margin-bottom: 16px;
  font-size: 22px;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.lead {
  max-width: 760px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.actions,
.header-actions,
.form-actions,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.snapshot-panel,
.panel,
.metric,
.project-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.snapshot-panel {
  width: min(420px, 100%);
  padding: 22px;
}

.key-values {
  display: grid;
  gap: 12px;
  margin: 22px 0 0;
}

.key-values div,
.status-strip div {
  display: grid;
  gap: 4px;
}

dt,
.status-strip span,
.metric span,
.compact-list span,
.phase-list small {
  color: var(--muted);
  font-size: 13px;
}

dd {
  margin: 0;
  font-weight: 600;
}

.metrics-grid,
.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metric,
.status-strip div {
  min-height: 96px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric strong,
.status-strip strong {
  font-size: 26px;
}

.project-list {
  display: grid;
  gap: 12px;
}

.workflow-lane {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.workflow-lane div {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  column-gap: 12px;
  row-gap: 4px;
  align-items: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.workflow-lane span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--green);
  color: white;
  font-weight: 700;
}

.workflow-lane small {
  color: var(--muted);
  line-height: 1.45;
}

.project-workspace {
  grid-template-columns: minmax(440px, 0.78fr) minmax(0, 1fr);
}

.project-dashboard {
  grid-template-columns: minmax(0, 1fr) 420px;
  align-items: start;
}

.project-index-head h1 {
  max-width: 980px;
}

.active-project-panel,
.project-shortcut-panel {
  display: grid;
  gap: 16px;
}

.project-list-main {
  gap: 14px;
}

.project-row-main {
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
}

.project-row-main h2 {
  max-width: none;
  font-size: 24px;
  line-height: 1.2;
}

.project-actions-main {
  grid-template-columns: 1fr;
  min-width: 190px;
}

.project-shortcut-panel .compact-list a {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.workflow-lane-compact {
  grid-template-columns: 1fr;
  margin: 0;
  padding: 0 14px 14px;
}

.workflow-lane-compact div {
  box-shadow: none;
}

.project-create-drawer .form-grid,
.project-create-drawer .form-grid.three {
  grid-template-columns: 1fr;
}

.pm-project-shell {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.pm-project-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 18px;
  align-items: stretch;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.pm-title-copy {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.pm-title-copy h1 {
  max-width: 920px;
  margin: 0;
  font-size: 34px;
  line-height: 1.2;
}

.pm-breadcrumb,
.pm-project-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.pm-breadcrumb {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.pm-breadcrumb a {
  color: var(--brand-blue);
}

.pm-project-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfcfd;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.pm-project-meta span.on_track {
  border-color: rgba(45, 95, 139, 0.26);
  background: #eef6fa;
  color: var(--brand-blue);
}

.pm-project-meta span.watch {
  border-color: rgba(232, 168, 56, 0.38);
  background: #fff8e9;
  color: #7b5513;
}

.pm-project-meta span.blocked {
  border-color: rgba(185, 75, 63, 0.28);
  background: #fff1ef;
  color: var(--red);
}

.pm-action-dock {
  display: grid;
  gap: 10px;
  align-content: start;
}

.pm-action-dock .button {
  justify-content: flex-start;
  min-height: 46px;
}

.pm-status-form {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.pm-status-form label {
  color: var(--ink);
}

.pm-status-form select {
  min-height: 40px;
}

.pm-status-form .button {
  justify-content: center;
}

.pm-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.pm-kpi-row div {
  display: grid;
  gap: 4px;
  min-height: 78px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.pm-kpi-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.pm-kpi-row strong {
  font-size: 24px;
  line-height: 1.1;
}

.project-workspace-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.project-workspace-nav {
  position: sticky;
  top: 88px;
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.project-workspace-nav-title,
.project-workspace-nav button {
  border-radius: 8px;
}

.project-workspace-nav-title {
  display: grid;
  gap: 3px;
  padding: 8px 10px 10px;
}

.project-workspace-nav-title span,
.project-workspace-nav button small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.project-workspace-nav-title strong {
  font-size: 17px;
  line-height: 1.25;
}

.project-workspace-nav button {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fbfcfd;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.project-workspace-nav button:hover,
.project-workspace-nav button.active {
  border-color: rgba(45, 95, 139, 0.34);
  background: #f4f8fb;
}

.project-workspace-nav button.active {
  box-shadow: inset 4px 0 0 var(--brand-gold);
}

.project-workspace-nav button strong {
  font-size: 15px;
  line-height: 1.3;
}

.project-workspace-main,
.project-workspace-panel {
  min-width: 0;
}

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

.project-workspace-panel.active {
  display: grid;
  gap: 16px;
}

.project-workspace-panel > .pm-focus-grid {
  margin-bottom: 0;
}

.project-workspace-panel.pm-records-stack {
  gap: 12px;
}

.project-workspace-panel .section-title {
  flex-wrap: wrap;
}

.project-workspace-panel .task-board {
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  max-width: 100%;
}

.project-workspace-panel .task-column {
  min-width: 220px;
}

.pm-command-grid,
.pm-focus-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 16px;
}

.pm-command-panel,
.pm-now-panel,
.pm-attention-panel,
.pm-room-workbench {
  display: grid;
  gap: 16px;
}

.pm-start-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border: 1px solid rgba(45, 95, 139, 0.26);
  border-radius: 8px;
  background: #f4f8fb;
  box-shadow: inset 5px 0 0 var(--brand-gold);
}

.pm-start-card > div {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  column-gap: 12px;
  row-gap: 4px;
  min-width: 0;
}

.pm-start-card strong,
.pm-start-card small {
  min-width: 0;
}

.pm-start-card strong {
  font-size: 21px;
  line-height: 1.3;
}

.pm-start-card small {
  color: var(--muted);
  line-height: 1.45;
}

.pm-start-number {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--brand-ink);
  color: white;
  font-weight: 800;
}

.pm-route-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.pm-route-list a {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  column-gap: 10px;
  row-gap: 3px;
  align-items: start;
  min-height: 96px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.pm-route-list span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--brand-gold);
  color: var(--brand-ink);
  font-weight: 800;
}

.pm-route-list small {
  color: var(--muted);
  line-height: 1.45;
}

.section-title.compact {
  margin-bottom: 0;
}

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

.pm-action-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  column-gap: 12px;
  row-gap: 3px;
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.pm-action-card.primary {
  border-color: rgba(45, 95, 139, 0.34);
  background: #f4f8fb;
  box-shadow: inset 4px 0 0 var(--brand-gold);
}

.pm-action-card span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--brand-gold);
  color: var(--brand-ink);
  font-weight: 800;
}

.pm-action-card strong,
.pm-action-card small {
  min-width: 0;
}

.pm-action-card strong {
  font-size: 16px;
  line-height: 1.3;
}

.pm-action-card small {
  color: var(--muted);
  line-height: 1.45;
}

.pm-attention-list {
  display: grid;
  gap: 8px;
}

.pm-attention-item,
.pm-empty-state,
.pm-plan-card,
.pm-room-row,
.pm-drawer {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.pm-attention-item {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.pm-attention-item.blocked,
.pm-attention-item.critical,
.pm-room-row.blocked {
  border-color: rgba(185, 75, 63, 0.34);
  background: #fff8f6;
}

.pm-attention-item.watch,
.pm-attention-item.high {
  border-color: rgba(232, 168, 56, 0.42);
  background: #fffaf0;
}

.pm-attention-item span,
.pm-attention-item small {
  color: var(--muted);
  font-size: 12px;
}

.pm-attention-item strong {
  line-height: 1.35;
}

.pm-empty-state {
  display: grid;
  gap: 6px;
  padding: 16px;
  color: var(--muted);
  background: #fbfcfd;
}

.pm-empty-state strong {
  color: var(--ink);
}

.pm-empty-state.strong {
  justify-items: start;
  padding: 22px;
}

.pm-plan-stack {
  display: grid;
  gap: 14px;
}

.pm-plan-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #fbfcfd;
}

.pm-plan-card > header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.pm-plan-card h3 {
  margin: 2px 0 0;
}

.pm-plan-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.pm-room-table {
  display: grid;
  gap: 8px;
}

.pm-room-row {
  display: grid;
  grid-template-columns: minmax(190px, 0.75fr) minmax(240px, 1fr) minmax(260px, 1.05fr) minmax(140px, auto);
  gap: 12px;
  align-items: center;
  min-height: 88px;
  padding: 12px;
}

.pm-room-row.ready {
  border-color: rgba(45, 95, 139, 0.28);
  background: #f7fbfd;
}

.pm-room-row.needs-setup {
  background: var(--surface);
}

.pm-room-row > div:first-child,
.pm-room-main {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  column-gap: 10px;
  row-gap: 2px;
  align-items: center;
}

.pm-room-row > div:first-child small,
.pm-room-main small {
  grid-column: 2;
}

.room-state-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #cbd5dc;
}

.pm-room-row.ready .room-state-dot {
  background: var(--brand-blue);
}

.pm-room-row.blocked .room-state-dot {
  background: var(--red);
}

.pm-room-readiness {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pm-room-readiness span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #eef3f6;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.pm-room-readiness span.done {
  border-color: rgba(45, 95, 139, 0.24);
  background: #e8f2f7;
  color: var(--brand-blue);
}

.pm-room-next {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.pm-room-next span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.pm-room-next strong,
.pm-room-next small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-room-next small {
  color: var(--muted);
}

.pm-room-latest {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.pm-room-latest strong,
.pm-room-latest small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-room-latest small,
.pm-plan-actions span {
  color: var(--muted);
}

.pm-room-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  min-width: 132px;
}

.pm-drawer {
  overflow: hidden;
  margin-bottom: 14px;
  background: #fbfcfd;
}

.pm-drawer > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: center;
  min-height: 58px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.pm-drawer > summary::-webkit-details-marker {
  display: none;
}

.pm-drawer > summary::after {
  content: "+";
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--brand-gold);
  color: var(--brand-ink);
  font-weight: 800;
}

.pm-drawer > summary span {
  grid-column: 1;
  color: var(--muted);
  line-height: 1.45;
}

.pm-drawer[open] > summary {
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.pm-drawer[open] > summary::after {
  content: "-";
}

.pm-drawer form {
  padding: 0 14px 14px;
}

.pm-shortcut-panel .compact-list a {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.project-create-form {
  display: grid;
  gap: 14px;
}

.compact-project-list {
  gap: 14px;
}

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

.project-actions {
  display: grid;
  gap: 8px;
  min-width: 170px;
}

.compact-project-list .project-row {
  align-items: stretch;
}

.compact-project-list .project-row h2 {
  max-width: none;
  font-size: 20px;
  line-height: 1.25;
}

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

.portfolio-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.portfolio-card a {
  display: grid;
}

.portfolio-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.portfolio-card div {
  padding: 16px;
}

.portfolio-card h2 {
  margin: 8px 0;
  font-size: 20px;
}

.portfolio-card p,
.case-study-grid p {
  color: var(--muted);
  line-height: 1.6;
}

.portfolio-facts {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
}

.portfolio-facts div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px;
  padding: 0;
}

.project-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  padding: 18px;
}

.project-row h2 {
  margin-bottom: 6px;
}

.project-row p {
  margin-bottom: 0;
  color: var(--muted);
}

.project-row.project-row-workflow {
  grid-template-columns: 1fr;
  align-items: stretch;
}

.compact-project-list .project-row h2 {
  max-width: none;
  font-size: 20px;
  line-height: 1.25;
}

.row-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.portfolio-ops-row {
  grid-template-columns: minmax(0, 1fr) minmax(280px, auto) auto;
}

.case-study-grid,
.before-after-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}

.before-after-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.portfolio-media {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.testimonial-panel {
  margin-top: 20px;
  padding: 24px;
  border-radius: 8px;
  background: var(--green);
  color: white;
}

.testimonial-panel blockquote {
  margin: 0 0 12px;
  font-size: 24px;
  line-height: 1.5;
}

.testimonial-panel p {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.82);
}

.import-summary,
.candidate-list {
  display: grid;
  gap: 14px;
}

.json-preview {
  max-height: 320px;
  overflow: auto;
  margin: 12px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111713;
  color: #dfeee2;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.candidate-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.candidate-card h3 {
  margin-top: 10px;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  align-items: start;
}

.pm-lower-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
  margin-top: 16px;
}

.main-column,
.side-column,
.pm-records-stack {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.pm-records-stack {
  gap: 12px;
}

.pm-record-drawer {
  margin-bottom: 0;
  box-shadow: var(--shadow);
}

.pm-record-drawer .phase-list,
.pm-record-drawer .compact-list {
  padding: 0 14px 14px;
}

.pm-record-drawer .compact-list {
  display: grid;
  gap: 10px;
}

.pm-portfolio-form {
  margin: 14px 0 0;
}

.panel {
  padding: 20px;
}

.section-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.pm-lower-workspace .section-title {
  flex-wrap: wrap;
}

.pm-lower-workspace .section-title form {
  max-width: 100%;
}

.pm-lower-workspace .panel {
  min-width: 0;
}

.pm-lower-workspace .task-board {
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  max-width: 100%;
}

.pm-lower-workspace .task-column {
  min-width: 220px;
}

.update-form {
  display: grid;
  gap: 14px;
  margin-bottom: 22px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

label input[type="checkbox"] {
  width: auto;
  min-height: 0;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #ccd8cc;
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
  font: inherit;
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(185, 75, 63, 0.12);
}

textarea {
  resize: vertical;
}

.timeline {
  display: grid;
  gap: 14px;
}

.task-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e1e8e1;
}

.progress-track span {
  display: block;
  height: 100%;
  background: var(--green-2);
}

.task-create-form {
  margin-bottom: 18px;
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toggle-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.issue-strip {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.issue-strip article {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #f0d2b3;
  border-radius: 8px;
  background: #fff8ee;
}

.issue-strip small {
  color: var(--muted);
}

.task-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.task-column {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 260px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9faf7;
}

.task-column > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
}

.task-column > header span {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #e5ebe4;
  color: var(--muted);
  font-weight: 700;
}

.task-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid #c8d2c8;
  border-radius: 8px;
  background: white;
  box-shadow: 0 8px 20px rgba(25, 39, 28, 0.06);
}

.task-card.priority-high {
  border-left-color: var(--gold);
}

.task-card.priority-urgent {
  border-left-color: var(--red);
}

.task-card h3,
.task-card p {
  margin-bottom: 0;
}

.task-card p {
  color: var(--muted);
  line-height: 1.5;
}

.task-card-head,
.requirement-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.task-type,
.priority,
.requirement-row span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef3ee;
  color: #3f4d45;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.priority {
  background: #f5ead4;
  color: #765418;
}

.task-meta {
  display: grid;
  gap: 6px;
  margin: 0;
}

.task-meta div {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
}

.task-meta dd {
  overflow-wrap: anywhere;
}

.checklist {
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: 8px;
  background: #f4f6f3;
}

.checklist label {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 500;
}

.checklist input:checked + span {
  color: var(--muted);
  text-decoration: line-through;
}

.status-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.lean-quick-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.lean-quick-row .button {
  min-height: 42px;
}

.lean-advanced {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.lean-advanced > summary,
.task-state-drawer > summary,
.task-reject-drawer > summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.lean-advanced-body,
.task-handoff-actions,
.task-submit-review,
.task-state-drawer form,
.task-reject-drawer form {
  display: grid;
  gap: 10px;
}

.lean-advanced-body,
.task-state-drawer form,
.task-reject-drawer form {
  padding-top: 10px;
}

.portal-token-rotate-form {
  max-width: 420px;
}

.portal-token-rotate-form label strong {
  color: var(--ink);
}

.task-handoff-actions {
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.task-submit-review input[type="file"] {
  min-height: 48px;
  padding: 8px;
  background: #f7faf7;
}

.task-submit-review small {
  color: var(--muted);
  font-weight: 500;
}

.task-handoff-note {
  padding: 10px 12px;
  border-radius: 8px;
  background: #f5ead4;
  color: #765418 !important;
  font-weight: 700;
  text-align: center;
}

.task-handoff-note.success {
  background: #e6f1e8;
  color: var(--green-2) !important;
}

.task-reject-drawer,
.task-state-drawer {
  padding: 4px 0;
}

.update-item {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.update-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.internal-note,
.decision,
.next-action {
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.55;
}

.internal-note {
  background: #f2f3f4;
  color: #4a5350;
}

.decision {
  background: #fff4dc;
  color: #755016;
}

.next-action {
  background: #e8f3ee;
  color: #255a3b;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

figure {
  margin: 0;
}

figure img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

figure video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #111;
}

figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.upload-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.7fr);
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px dashed #b8c5bd;
  border-radius: 8px;
  background: #f6faf7;
}

.upload-box strong,
.upload-box span {
  display: block;
}

.upload-box span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.upload-box input[type="file"] {
  width: 100%;
  min-height: 42px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.file-card {
  display: grid;
  align-content: center;
  gap: 6px;
  min-height: 170px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f6f0;
  color: var(--ink);
  text-decoration: none;
}

.file-card span {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.phase-list,
.compact-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.phase-list li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  list-style: none;
}

.phase-list li > span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #e6ece6;
  color: var(--muted);
  font-weight: 700;
}

.phase-list li.completed > span {
  background: var(--green-2);
  color: white;
}

.phase-list li.active > span {
  background: var(--gold);
  color: white;
}

.phase-list li.blocked > span {
  background: var(--red);
  color: white;
}

.compact-list div {
  display: grid;
  gap: 3px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.compact-list a {
  display: grid;
  gap: 3px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  color: inherit;
}

.compact-list div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.compact-list a:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.muted {
  color: var(--muted);
  line-height: 1.55;
}

.magic-editor-header {
  margin-bottom: 18px;
}

.magic-editor-header h1 {
  margin-bottom: 8px;
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.05;
}

.magic-editor-header .lead {
  max-width: 900px;
}

.magic-workflow-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}

.magic-workflow-strip div {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  column-gap: 10px;
  row-gap: 3px;
  min-height: 74px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(23, 33, 41, 0.04);
}

.magic-workflow-strip span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--brand-gold);
  color: var(--brand-ink);
  font-weight: 700;
}

.magic-workflow-strip small {
  color: var(--muted);
  line-height: 1.45;
}

.magic-plan-workbench {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 312px;
  gap: 14px;
  align-items: start;
}

.magic-layer-panel,
.magic-inspector-panel {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 14px;
}

.magic-canvas-panel {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.magic-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.magic-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.magic-toolbar-actions .button {
  min-width: 42px;
}

.zoom-pill {
  display: inline-grid;
  place-items: center;
  min-width: 66px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f1f5f0;
  color: var(--muted);
  font-weight: 700;
}

.magic-canvas-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.magic-canvas-wrap {
  position: relative;
  height: clamp(520px, 68vh, 760px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--brand-ink);
}

.magic-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: default;
}

.magic-canvas-wrap[data-mode="magic"] canvas {
  cursor: cell;
}

.magic-canvas-wrap[data-mode="draw"] canvas {
  cursor: crosshair;
}

.magic-canvas-wrap[data-mode="pan"] canvas {
  cursor: grab;
}

.magic-canvas-toast {
  position: absolute;
  left: 14px;
  bottom: 14px;
  max-width: min(520px, calc(100% - 28px));
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  background: rgba(17, 23, 19, 0.9);
  color: white;
  font-size: 14px;
  line-height: 1.45;
}

.magic-layer-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.magic-layer-list {
  display: grid;
  gap: 8px;
}

.magic-area-row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.magic-area-row.active {
  border-color: var(--brand-blue);
  background: #f8fbf7;
  box-shadow: inset 4px 0 0 var(--brand-gold), 0 0 0 2px rgba(45, 95, 139, 0.14);
}

.magic-area-row strong,
.magic-area-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.magic-area-row small {
  color: var(--muted);
  font-size: 12px;
}

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

.magic-inspector-meta div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.magic-inspector-meta span {
  color: var(--muted);
  font-size: 12px;
}

.magic-inspector-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.magic-room-actions {
  display: grid;
  gap: 8px;
}

.button.danger {
  color: var(--red);
}

.site-area-form[aria-disabled] {
  opacity: 0.58;
  pointer-events: none;
}

.site-plan-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}

.site-plan-main {
  display: grid;
  gap: 14px;
}

.site-plan-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.segmented {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.segmented button {
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--green);
  color: white;
}

.site-plan-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 160px;
}

.site-plan-toolbar input[type="range"] {
  min-height: 0;
  padding: 0;
}

.site-plan-canvas-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #202722;
}

.site-plan-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
}

.site-plan-side {
  display: grid;
  gap: 20px;
  position: sticky;
  top: 92px;
}

.site-area-form {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.area-list,
.area-media-list,
.area-surface-list,
.area-update-list {
  display: grid;
  gap: 8px;
}

.area-row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.area-row.active {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(49, 91, 59, 0.14);
}

.area-color {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--blue);
}

.area-row strong,
.area-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.area-row small {
  color: var(--muted);
}

.compact-upload-form[aria-disabled="true"] {
  opacity: 0.62;
  pointer-events: none;
}

.panel-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.panel-title-row h2 {
  margin-top: 0;
}

.selection-pill {
  display: inline-flex;
  align-items: center;
  max-width: 150px;
  min-height: 28px;
  padding: 0 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.measurement-form {
  display: grid;
  gap: 12px;
}

.magic-box-actions {
  display: grid;
  gap: 8px;
}

.magic-box-dialog {
  width: min(760px, calc(100vw - 28px));
  max-height: min(840px, calc(100vh - 28px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.magic-box-dialog::backdrop {
  background: rgba(15, 22, 18, 0.46);
}

.magic-box-dialog.open {
  display: block;
  position: fixed;
  inset: 24px;
  margin: auto;
  z-index: 80;
}

.magic-box-dialog-inner {
  display: grid;
  gap: 16px;
  max-height: inherit;
  padding: 18px;
  overflow: auto;
}

.magic-box-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.magic-box-head h2 {
  margin: 2px 0 4px;
}

.magic-box-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.magic-box-tabs button {
  min-height: 42px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.magic-box-tabs button:last-child {
  border-right: 0;
}

.magic-box-tabs button.active {
  background: var(--green);
  color: white;
}

.magic-box-tab-panel {
  display: none;
  gap: 14px;
}

.magic-box-tab-panel.active {
  display: grid;
}

.magic-box-tab-panel h3,
.magic-box-tab-panel h2 {
  margin: 0;
}

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

.surface-type-picker button {
  display: grid;
  gap: 2px;
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.surface-type-picker button.active {
  border-color: var(--green);
  background: var(--surface-2);
  box-shadow: 0 0 0 2px rgba(49, 91, 59, 0.12);
}

.surface-type-picker strong {
  font-size: 15px;
}

.surface-type-picker span {
  color: var(--muted);
  font-size: 12px;
}

.measurement-label {
  display: grid;
  gap: 6px;
}

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

.measurement-fields label {
  display: grid;
  gap: 6px;
}

.measurement-fields label.is-hidden {
  display: none;
}

.area-media-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.area-media-item img,
.area-media-item video {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  background: #e8ece8;
}

.area-media-item strong,
.area-media-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.measurement-preview,
.surface-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.measurement-preview div,
.surface-summary div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.measurement-preview span,
.surface-summary span {
  color: var(--muted);
  font-size: 12px;
}

.measurement-preview strong,
.surface-summary strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.surface-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.surface-row strong,
.surface-row small,
.surface-result span {
  display: block;
}

.surface-row small,
.surface-result span {
  color: var(--muted);
  font-size: 12px;
}

.surface-result {
  min-width: 92px;
  text-align: right;
}

.surface-row form {
  margin: 0;
}

.area-update-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.area-update-item strong {
  display: block;
  margin-top: 3px;
}

.area-update-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.workflow-panel,
.production-panel {
  position: relative;
  display: grid;
  gap: 16px;
}

.workflow-step {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--green);
  color: white;
  font-weight: 700;
}

.workflow-panel > p,
.production-panel > p,
.workflow-panel p,
.production-panel p {
  color: var(--muted);
  line-height: 1.6;
}

.room-work-list,
.daily-log-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.room-work-list article,
.daily-log-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.daily-log-list article {
  grid-template-columns: 1fr;
}

.room-work-list strong,
.daily-log-list strong {
  display: block;
  margin: 3px 0;
}

.room-work-list p,
.daily-log-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.room-command-header h1 {
  margin-bottom: 8px;
  font-size: clamp(36px, 5vw, 58px);
  line-height: 1.06;
}

.room-command-header .lead {
  max-width: 940px;
}

.room-command-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.room-command-overview article {
  display: grid;
  gap: 4px;
  min-height: 98px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(23, 33, 41, 0.04);
}

.room-command-overview span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.room-command-overview strong {
  font-size: 30px;
  line-height: 1;
}

.room-command-overview small {
  color: var(--muted);
  line-height: 1.45;
}

.room-command-overview .needs-attention {
  border-color: rgba(185, 75, 63, 0.34);
  background: #fff8f6;
}

.room-command-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.room-action-rail,
.room-summary-panel {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 16px;
}

.room-action-list {
  display: grid;
  gap: 8px;
}

.room-action-list button {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: 10px;
  row-gap: 2px;
  width: 100%;
  min-height: 70px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.room-action-list button span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  min-width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--brand-blue);
  font-size: 13px;
  font-weight: 700;
}

.room-action-list button strong,
.room-action-list button small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-action-list button small {
  color: var(--muted);
  font-size: 12px;
}

.room-action-list button.active {
  border-color: var(--brand-blue);
  box-shadow: inset 4px 0 0 var(--brand-gold), 0 0 0 2px rgba(45, 95, 139, 0.12);
}

.room-action-list button.active span {
  background: var(--brand-gold);
  color: var(--brand-ink);
}

.room-command-main {
  display: grid;
  min-width: 0;
}

.room-step-panel {
  display: none;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.room-step-panel.active {
  display: grid;
}

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

.room-step-head h2,
.room-step-head p {
  margin-bottom: 0;
}

.room-step-head p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.6;
}

.room-focused-form {
  display: grid;
  gap: 14px;
  margin: 0;
}

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

.room-form-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.room-optional-box {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.room-optional-box summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 0 14px;
  color: var(--brand-blue);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.room-optional-box summary::-webkit-details-marker {
  display: none;
}

.room-optional-box summary::after {
  content: "+";
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--brand-ink);
  font-weight: 800;
}

.room-optional-box[open] summary {
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.room-optional-box[open] summary::after {
  content: "-";
}

.room-optional-body {
  display: grid;
  gap: 14px;
  padding: 0 14px 14px;
}

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

.room-history-grid section {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.room-history-grid h3,
.room-summary-panel h3 {
  margin: 0;
  font-size: 17px;
}

.room-readiness-list {
  display: grid;
  gap: 8px;
}

.room-readiness-list div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.room-readiness-list div::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #cbd5dc;
}

.room-readiness-list div.is-done::before {
  background: var(--brand-gold);
}

.room-readiness-list strong {
  grid-column: 1;
  grid-row: 1;
  padding-left: 18px;
}

.room-readiness-list span {
  grid-column: 2;
  grid-row: 1;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.room-summary-panel > section {
  display: grid;
  gap: 10px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.daily-report-layout .panel {
  display: grid;
  gap: 14px;
}

.daily-report-textarea {
  min-height: 430px;
  font-family: "Kanit", "Noto Sans Thai", system-ui, sans-serif;
  line-height: 1.55;
}

.blocker-text {
  color: var(--red) !important;
}

.area-update-media {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.area-update-media img,
.area-update-media video {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  background: #e8ece8;
}

.room-timeline-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.room-selector {
  display: grid;
  gap: 8px;
}

.room-selector button {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.room-selector button.active {
  border-color: var(--green);
  background: var(--surface-2);
  box-shadow: 0 0 0 2px rgba(49, 91, 59, 0.12);
}

.room-selector span {
  color: var(--muted);
  font-size: 12px;
}

.room-panel {
  display: none;
}

.room-panel.active {
  display: grid;
  gap: 14px;
}

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

.room-panel-head h3 {
  margin: 2px 0 0;
}

.timeline.compact {
  gap: 12px;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e8ece8;
  color: #34413a;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.status.on_track,
.status.published,
.status.approved {
  background: #dcefe5;
  color: #17603f;
}

.status.watch,
.status.review {
  background: #fff0cf;
  color: #7b5513;
}

.status.draft {
  background: #e8ecef;
  color: #56616a;
}

.status.blocked,
.status.rejected {
  background: #fae0de;
  color: #8a2f27;
}

.lean-finance-body,
.agreement-list,
.money-entry-list,
.accounting-detail-grid {
  display: grid;
  gap: 12px;
}

.lean-finance-body {
  padding: 0 14px 14px;
}

.money-summary-grid {
  display: grid;
  gap: 10px;
}

.money-summary-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.money-summary-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.money-summary-grid > div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand-blue);
  border-radius: 8px;
  background: #fbfcfd;
}

.money-summary-grid > div.money-income {
  border-left-color: var(--green-2);
}

.money-summary-grid > div.money-expense {
  border-left-color: var(--red);
}

.money-summary-grid span,
.agreement-card span,
.money-entry-row span {
  color: var(--muted);
  font-size: 13px;
}

.money-summary-grid strong {
  overflow-wrap: anywhere;
  font-size: 20px;
}

.accounting-summary {
  margin-bottom: 18px;
}

.agreement-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.agreement-card.compact {
  background: #fbfcfd;
}

.agreement-card-head,
.agreement-payment-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.agreement-card-head h3,
.agreement-card-head p {
  margin: 2px 0 0;
}

.agreement-card-head > strong,
.agreement-payment-line > strong {
  text-align: right;
  white-space: nowrap;
}

.agreement-payment-line {
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.lean-payment-form {
  display: grid;
  gap: 10px;
  padding: 0 !important;
}

.lean-create-drawer {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.lean-create-drawer > summary {
  min-height: 48px;
  padding: 13px 14px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 750;
}

.lean-create-drawer[open] > summary {
  border-bottom: 1px solid var(--line);
}

.lean-create-drawer > .update-form,
.lean-finance-body > .update-form {
  margin: 12px;
  padding: 14px;
}

.lean-money-quick {
  display: grid;
  grid-template-columns: minmax(130px, 0.55fr) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.lean-money-quick .button {
  min-height: 42px;
}

.money-entry-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand-blue);
  border-radius: 8px;
  background: white;
}

.money-entry-row.money-income {
  border-left-color: var(--green-2);
}

.money-entry-row.money-expense {
  border-left-color: var(--red);
}

.money-entry-row > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.money-entry-row > strong {
  white-space: nowrap;
}

.money-void-action {
  grid-column: 1 / -1;
  justify-self: end;
}

.money-void-action > summary,
.voided-money-drawer > summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.money-void-action form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  padding: 8px 0 0 !important;
}

.voided-money-drawer {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.voided-money-drawer > .money-entry-list {
  padding-top: 10px;
}

.money-entry-row.is-void {
  opacity: 0.68;
  border-left-color: var(--muted);
  background: #f3f4f3;
}

.money-entry-row.is-void > strong {
  text-decoration: line-through;
}

.span-all {
  grid-column: 1 / -1;
}

.lean-accounting-row {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}

.money-summary-grid.compact strong {
  font-size: 17px;
}

.accounting-inner-list {
  padding: 12px;
}

.accounting-action-queue {
  margin: 1rem 0 1.25rem;
}

.accounting-action-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.7rem;
}

.accounting-action-item {
  display: grid;
  align-content: start;
  gap: 0.25rem;
  padding: 0.85rem;
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}

.accounting-action-item:hover {
  border-color: var(--brand-blue);
}

.accounting-action-item.action-refund,
.accounting-action-item.action-missing {
  border-left: 4px solid var(--brand-gold);
}

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

@media (max-width: 980px) {
  main {
    padding: 20px;
  }

  .staff-topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .staff-topbar .nav-toggle {
    display: inline-flex;
  }

  .staff-topbar .nav {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .staff-topbar .nav[data-collapsed="true"] {
    display: none;
  }

  .staff-topbar .nav a,
  .staff-topbar .nav-form,
  .staff-topbar .nav-form button {
    width: 100%;
  }

  .staff-topbar .nav a,
  .staff-topbar .nav-form button {
    white-space: normal;
    text-align: center;
  }

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

  .customer-home {
    margin: -20px;
  }

  .customer-home-hero {
    min-height: 560px;
    padding: 58px 20px 36px;
  }

  .home-title {
    max-width: 680px;
    font-size: 46px;
  }

  .hero-proof-row {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 24px;
    padding-top: 16px;
  }

  .home-section {
    width: min(760px, calc(100% - 40px));
    padding: 42px 0;
  }

  .estimate-layout {
    grid-template-columns: 1fr;
    width: min(760px, calc(100% - 40px));
    gap: 24px;
    padding: 40px 0;
  }

  .estimate-copy {
    position: static;
  }

  .service-strip,
  .workflow-lane,
  .magic-workflow-strip,
  .process-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .assurance-section {
    grid-template-columns: 1fr;
  }

  .workspace-hero,
  .project-header,
  .customer-hero,
  .page-head,
  .portfolio-hero,
  .portfolio-detail-hero {
    display: grid;
  }

	  .two-column,
	  .project-workspace,
	  .project-workspace-layout,
	  .pm-project-top,
	  .pm-kpi-row,
	  .pm-focus-grid,
	  .pm-command-grid,
	  .pm-action-grid,
	  .pm-route-list,
	  .pm-lower-workspace,
	  .magic-plan-workbench,
	  .room-command-shell,
	  .site-plan-workspace,
  .room-timeline-shell,
  .metrics-grid,
  .status-strip,
  .room-command-overview,
  .portfolio-grid,
  .case-study-grid,
  .before-after-grid {
    grid-template-columns: 1fr;
  }

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

	  .project-row-main {
	    grid-template-columns: 1fr !important;
	  }

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

	  .pm-room-row {
	    grid-template-columns: 1fr;
	    align-items: stretch;
	  }

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

	  .project-workspace-nav {
	    position: static;
	    grid-template-columns: repeat(5, minmax(170px, 1fr));
	    overflow-x: auto;
	  }

	  .project-workspace-nav-title {
	    grid-column: 1 / -1;
	  }

	  .pm-start-card {
	    grid-template-columns: 1fr;
	    align-items: stretch;
	  }

	  .pm-start-card .button {
	    justify-content: center;
	  }

	  .pm-plan-card > header,
	  .pm-plan-actions {
	    display: grid;
	    justify-content: stretch;
	    text-align: left;
	  }

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

  .row-meta {
    flex-wrap: wrap;
  }

  .site-plan-side {
    position: static;
  }

  .magic-layer-panel,
  .magic-inspector-panel,
  .room-action-rail,
  .room-summary-panel {
    position: static;
  }

  .magic-plan-workbench {
    grid-template-columns: 1fr;
  }

  .room-action-rail {
    order: 1;
  }

  .room-command-main {
    order: 2;
  }

  .room-summary-panel {
    order: 3;
  }

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

  .magic-layer-panel {
    order: 2;
  }

  .magic-canvas-panel {
    order: 1;
  }

  .magic-inspector-panel {
    order: 3;
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 18px;
  }

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

  .staff-topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding: 10px 14px;
  }

  .staff-topbar .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .staff-topbar .brand small {
    display: none;
  }

  .lead-form {
    padding: 16px;
  }

  .estimate-form > .button {
    width: 100%;
    min-height: 48px;
  }

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

  .lean-quick-row,
  .lean-money-quick,
  .money-summary-grid.three,
  .money-summary-grid.four,
  .money-entry-row {
    grid-template-columns: 1fr;
  }

  .agreement-card-head,
  .agreement-payment-line {
    display: grid;
  }

  .agreement-card-head > strong,
  .agreement-payment-line > strong {
    text-align: left;
  }

  .task-handoff-actions .button,
  .lean-finance-body .button,
  .accounting-detail-grid .button {
    min-height: 44px;
    width: 100%;
  }

  .money-void-action {
    justify-self: stretch;
  }

  .money-void-action form {
    grid-template-columns: 1fr;
  }

	  .form-grid,
	  .form-grid.three,
	  .room-form-grid,
  .room-form-grid-3,
  .room-history-grid,
  .surface-type-picker,
  .measurement-fields,
  .measurement-preview,
  .surface-summary,
  .media-grid,
  .portfolio-media,
  .before-after-images,
  .upload-box {
    grid-template-columns: 1fr;
  }

		  .service-strip,
		  .workflow-lane,
		  .pm-action-grid,
		  .pm-route-list,
		  .magic-workflow-strip,
		  .process-grid {
		    grid-template-columns: 1fr;
		  }

	  .project-workspace-nav {
	    display: grid;
	    grid-template-columns: repeat(2, minmax(0, 1fr));
	    align-items: stretch;
	    gap: 8px;
	    overflow: visible;
	    padding: 8px;
	  }

	  .project-workspace-nav-title {
	    grid-column: 1 / -1;
	    min-width: 0;
	    padding-bottom: 4px;
	  }

	  .project-workspace-nav button {
	    min-width: 0;
	    min-height: 54px;
	    padding: 9px 10px;
	  }

	  .project-workspace-nav button small {
	    display: none;
	  }

	  .project-workspace-nav button:last-of-type {
	    grid-column: 1 / -1;
	  }

	  .project-workspace-panel .task-board {
	    grid-template-columns: 1fr;
	    overflow-x: visible;
	  }

	  .project-workspace-panel .task-column {
	    min-width: 0;
	  }

	  .pm-room-actions {
	    grid-template-columns: 1fr;
	  }

	  .pm-action-card {
	    min-height: 92px;
	  }

	  .task-board {
	    grid-template-columns: 1fr;
	    overflow-x: visible;
	  }

	  .task-column {
	    min-width: 0;
	  }

	  .issue-strip article {
	    grid-template-columns: 1fr;
	  }

  .workflow-lane div {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .magic-workflow-strip div {
    grid-template-columns: 30px minmax(0, 1fr);
  }

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

  .magic-editor-toolbar,
  .magic-toolbar-actions,
  .magic-tool-group {
    width: 100%;
  }

  .magic-tool-group {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .magic-tool-group button {
    min-width: 0;
    padding: 0 6px;
    font-size: 12px;
    white-space: normal;
  }

  .magic-toolbar-actions {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .magic-toolbar-actions .button,
  .zoom-pill {
    min-width: 0;
    padding: 0 6px;
    font-size: 12px;
  }

  .magic-canvas-wrap {
    height: 420px;
  }

  .magic-layer-tools,
  .magic-inspector-meta,
  .room-command-overview,
  .room-action-list {
    grid-template-columns: 1fr;
  }

  .room-step-panel {
    padding: 16px;
  }

  .room-step-head {
    display: grid;
  }

  .room-action-list button strong,
  .room-action-list button small {
    white-space: normal;
  }

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

  .surface-result {
    min-width: 0;
    text-align: left;
  }

  .magic-box-dialog {
    width: calc(100vw - 18px);
    max-height: calc(100vh - 18px);
  }

  .magic-box-dialog-inner {
    padding: 14px;
  }

  .magic-box-head {
    display: grid;
  }

  .service-strip article,
  .process-grid article {
    min-height: 0;
  }

  h1,
  .home-title {
    font-size: 34px;
  }
}
