:root {
  --paper: #f8f4ee;
  --paper-2: #efe6da;
  --surface: #fffdf9;
  --surface-2: #f7f1e9;
  --ink: #26221f;
  --muted: #786f68;
  --line: #ddd3c8;
  --terracotta: #b86548;
  --terracotta-dark: #8f4b36;
  --sage: #74826b;
  --sage-soft: #e7ece3;
  --gold: #b89458;
  --rose-soft: #f1dfd5;
  --danger: #a73f36;
  --danger-soft: #fae8e5;
  --success: #4f765c;
  --success-soft: #e6f0e8;
  --shadow: 0 20px 54px rgba(71, 52, 36, 0.10);
  --shadow-soft: 0 10px 26px rgba(71, 52, 36, 0.07);
  --radius: 22px;
  --radius-sm: 13px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(184, 148, 88, .11), transparent 28rem),
    radial-gradient(circle at 92% 12%, rgba(184, 101, 72, .08), transparent 24rem),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

.setup-banner {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 10px 18px;
  background: #fff1c8;
  color: #6f541d;
  text-align: center;
  font-size: 13px;
  border-bottom: 1px solid #ecd58e;
}
.setup-banner code { font-weight: 800; }

.eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--terracotta);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .15em;
}
.eyebrow.light { color: #f5d7c5; }

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(430px, .85fr);
}
.auth-story {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(55, 42, 34, .88), rgba(114, 76, 54, .88)),
    linear-gradient(135deg, #6b5241, #a47256);
  color: white;
}
.auth-story::before,
.auth-story::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
}
.auth-story::before { width: 620px; height: 620px; left: -330px; top: -230px; }
.auth-story::after { width: 460px; height: 460px; right: -260px; bottom: -180px; }
.auth-story-inner {
  position: relative;
  z-index: 1;
  width: min(720px, calc(100% - 80px));
  margin: 0 auto;
  min-height: 100vh;
  padding: 10vh 0 50px;
  display: flex;
  flex-direction: column;
}
.auth-story h1 {
  max-width: 680px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 6vw, 76px);
  line-height: .98;
  letter-spacing: -.045em;
  font-weight: 500;
}
.auth-story p {
  max-width: 600px;
  margin: 24px 0 0;
  color: rgba(255,255,255,.76);
  font-size: 17px;
  line-height: 1.75;
}
.mini-plan-stack {
  position: relative;
  flex: 1;
  min-height: 380px;
  margin-top: 28px;
}
.mini-plan {
  position: absolute;
  margin: 0;
  width: 225px;
  padding: 9px;
  border-radius: 18px;
  background: rgba(255,253,249,.95);
  box-shadow: 0 24px 60px rgba(20, 12, 7, .28);
}
.mini-plan img { display: block; width: 100%; border-radius: 11px; }
.mini-plan-one { left: 9%; bottom: 6%; transform: rotate(-5deg); }
.mini-plan-two { left: 35%; bottom: 1%; transform: rotate(5deg); }

.auth-panel {
  display: grid;
  place-items: center;
  padding: 34px;
  background: var(--paper);
}
.auth-card { width: min(430px, 100%); }
.brand-lockup, .brand-button { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 15px;
  background: var(--ink); color: white;
  font-size: 27px;
  box-shadow: var(--shadow-soft);
}
.brand-mark.small { width: 39px; height: 39px; font-size: 21px; border-radius: 12px; }
.brand-lockup strong, .brand-lockup span { display: block; }
.brand-lockup strong { font-size: 19px; }
.brand-lockup span { color: var(--muted); font-size: 12px; margin-top: 2px; }
.auth-copy { margin: 64px 0 25px; }
.auth-copy h2 { margin: 0; font-size: 38px; letter-spacing: -.04em; }
.auth-copy p { margin: 9px 0 0; color: var(--muted); line-height: 1.6; }
.auth-note { margin: 18px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

.form-stack { display: grid; gap: 14px; }
.field { display: grid; gap: 7px; }
.field > span { color: var(--muted); font-size: 12px; font-weight: 800; }
.field small { font-weight: 500; }
.field input, .field select, .field textarea,
.toolbar select, .search-box {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  outline: none;
}
.field input, .field select { min-height: 46px; padding: 0 12px; }
.field textarea { padding: 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus,
.toolbar select:focus, .search-box:focus-within {
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px rgba(184,101,72,.13);
}
.form-error, .form-success {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
}
.form-error { background: var(--danger-soft); color: var(--danger); }
.form-success { background: var(--success-soft); color: var(--success); }

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(221,211,200,.85);
  background: rgba(248,244,238,.88);
  backdrop-filter: blur(18px);
}
.header-inner {
  width: min(1240px, calc(100% - 34px));
  min-height: 76px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
}
.brand-button { border: 0; padding: 0; background: transparent; text-align: left; color: var(--ink); }
.brand-text strong, .brand-text small { display: block; }
.brand-text strong { font-size: 16px; }
.brand-text small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.list-switcher {
  display: flex;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}
.list-tab {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
  font-size: 13px;
}
.list-tab span:first-child { margin-right: 5px; }
.list-tab.active { background: var(--surface); color: var(--ink); box-shadow: 0 3px 12px rgba(71,52,36,.08); }
.header-actions { display: flex; justify-content: flex-end; align-items: center; gap: 9px; }
.account-button {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 8px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink);
}
.avatar {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 10px; background: var(--rose-soft); color: var(--terracotta-dark);
  font-size: 12px; font-weight: 900;
}
.account-copy { text-align: left; min-width: 74px; }
.account-copy strong, .account-copy small { display: block; }
.account-copy strong { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.account-copy small { margin-top: 2px; color: var(--muted); font-size: 10px; }

.shell { width: min(1240px, calc(100% - 34px)); margin: 28px auto 80px; }
.milestone-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  gap: 28px;
  align-items: stretch;
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(120deg, rgba(255,253,249,.96), rgba(245,233,221,.90)),
    var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
.milestone-hero::after {
  content: "⌂";
  position: absolute;
  right: 35%; bottom: -55px;
  color: rgba(184,101,72,.055);
  font-size: 210px;
  line-height: 1;
}
.milestone-copy { position: relative; z-index: 1; }
.milestone-copy h1 {
  max-width: 760px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  font-size: clamp(38px, 5vw, 62px);
  line-height: 1.03;
  letter-spacing: -.045em;
}
.milestone-copy p { max-width: 700px; margin: 17px 0 0; color: var(--muted); line-height: 1.75; }
.milestone-copy em { color: var(--terracotta-dark); font-family: Georgia, serif; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 24px; }
.milestone-card {
  position: relative; z-index: 1;
  align-self: stretch;
  padding: 24px;
  border-radius: 20px;
  background: #40342c;
  color: white;
  box-shadow: var(--shadow-soft);
}
.milestone-card-label { color: #d8bca8; font-size: 10px; font-weight: 900; letter-spacing: .15em; }
.milestone-card > strong { display: block; margin-top: 7px; font-family: Georgia, serif; font-size: 26px; font-weight: 500; }
.big-progress-row { display: flex; align-items: center; gap: 14px; margin-top: 28px; }
.big-progress-row b, .big-progress-row small { display: block; }
.big-progress-row b { font-size: 13px; }
.big-progress-row small { margin-top: 5px; max-width: 170px; color: rgba(255,255,255,.62); font-size: 11px; line-height: 1.5; }
.progress-ring {
  --progress: 0deg;
  width: 82px; height: 82px; flex: 0 0 auto;
  display: grid; place-items: center;
  position: relative; border-radius: 50%;
  background: conic-gradient(#d79a77 var(--progress), rgba(255,255,255,.13) 0);
}
.progress-ring::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: #40342c; }
.progress-ring span { position: relative; z-index: 1; font-size: 17px; font-weight: 900; }

.floorplans-section { margin: 26px 0 22px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin: 0 0 14px; }
.section-heading h2 { margin: 0; font-size: 26px; letter-spacing: -.035em; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.floorplan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.floorplan-card, .office-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.floorplan-card { overflow: hidden; }
.floorplan-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px 12px; }
.floorplan-title > div { display: flex; align-items: center; gap: 10px; }
.floorplan-title span { color: var(--gold); font-family: Georgia, serif; font-size: 18px; }
.floorplan-title h3 { margin: 0; font-size: 18px; }
.floorplan-title small { color: var(--muted); font-size: 11px; }
.plan-image-button { position: relative; display: block; width: 100%; border: 0; padding: 0; background: var(--surface-2); overflow: hidden; }
.plan-image-button img { display: block; width: 100%; max-height: 540px; object-fit: contain; mix-blend-mode: multiply; }
.plan-image-button > span {
  position: absolute; right: 12px; bottom: 12px;
  padding: 7px 9px; border-radius: 999px;
  background: rgba(38,34,31,.76); color: white;
  font-size: 10px; opacity: 0; transform: translateY(5px); transition: .16s ease;
}
.plan-image-button:hover > span { opacity: 1; transform: translateY(0); }
.room-pills { display: flex; flex-wrap: wrap; gap: 7px; padding: 14px 16px 17px; border-top: 1px solid var(--line); }
.room-pills button {
  min-height: 30px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
  font-size: 10px; font-weight: 800;
}
.room-pills button:hover { border-color: var(--terracotta); color: var(--terracotta-dark); }
.office-card {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px;
  padding: 20px;
  background: linear-gradient(120deg, #edf1e9, var(--surface));
}
.office-icon {
  width: 58px; height: 58px; display: grid; place-items: center;
  border-radius: 18px; background: var(--sage); color: white; font-size: 26px;
}
.office-card h3 { margin: 0; font-size: 19px; }
.office-card p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin: 22px 0 30px; }
.stat-card { padding: 19px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.stat-card span, .stat-card strong, .stat-card small { display: block; }
.stat-card span { color: var(--muted); font-size: 11px; font-weight: 800; }
.stat-card strong { margin: 8px 0 4px; font-size: 25px; letter-spacing: -.04em; }
.stat-card small { color: var(--muted); font-size: 10px; }

.shopping-section { padding-top: 5px; }
.list-heading { align-items: center; }
.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) repeat(4, minmax(135px, auto));
  gap: 9px; margin: 14px 0 12px;
}
.search-box { min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 12px; color: var(--muted); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.toolbar select { min-height: 44px; padding: 0 10px; }
.room-summary { display: flex; gap: 9px; overflow-x: auto; padding: 2px 1px 10px; scrollbar-width: thin; }
.room-chip { min-width: 145px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.room-chip button { width: 100%; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; }
.room-chip strong, .room-chip span { display: block; }
.room-chip strong { font-size: 11px; }
.room-chip span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.room-chip-progress { height: 4px; margin-top: 9px; border-radius: 99px; overflow: hidden; background: var(--line); }
.room-chip-progress i { display: block; height: 100%; background: var(--terracotta); }
.results-label { margin: 5px 0 10px; color: var(--muted); font-size: 11px; }
.items-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 13px; }
.item-card {
  min-width: 0; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: 18px; background: var(--surface); overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.item-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); }
.item-topline { min-height: 47px; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 13px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.room-pill, .priority-pill, .status-pill { display: inline-flex; width: fit-content; border-radius: 999px; font-size: 10px; font-weight: 900; }
.room-pill { padding: 5px 8px; background: var(--rose-soft); color: var(--terracotta-dark); }
.priority-pill { padding: 5px 8px; }
.priority-high { background: var(--danger-soft); color: var(--danger); }
.priority-medium { background: #fff1d8; color: #8d6326; }
.priority-low { background: var(--success-soft); color: var(--success); }
.item-content { flex: 1; padding: 16px; }
.item-title-row { display: flex; justify-content: space-between; align-items: start; gap: 9px; }
.item-name { margin: 0; font-size: 17px; letter-spacing: -.02em; overflow-wrap: anywhere; }
.item-meta { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.status-pill { flex: 0 0 auto; padding: 5px 7px; border: 1px solid var(--line); color: var(--muted); background: var(--surface); }
.status-arrived { border-color: transparent; color: var(--success); background: var(--success-soft); }
.item-notes { margin: 13px 0; color: var(--muted); font-size: 12px; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.product-link { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; font-size: 11px; font-weight: 800; }
.product-link:hover { border-color: var(--terracotta); color: var(--terracotta-dark); }
.product-link.is-disabled { display: none; }
.item-footer { display: flex; justify-content: space-between; align-items: center; gap: 9px; padding: 12px 13px; border-top: 1px solid var(--line); background: var(--surface-2); }
.price-block span, .price-block strong { display: block; }
.price-block span { color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.price-block strong { margin-top: 2px; font-size: 13px; }
.card-actions { display: flex; align-items: center; gap: 5px; }
.empty-state { padding: 62px 18px; text-align: center; border: 1px dashed var(--line); border-radius: 18px; background: var(--surface); }
.empty-state > div { font-size: 42px; }
.empty-state h3 { margin: 10px 0 5px; }
.empty-state p { margin: 0 0 15px; color: var(--muted); font-size: 12px; }

.button, .icon-button { border: 0; border-radius: 11px; font-weight: 800; }
.button { min-height: 40px; padding: 0 14px; }
.button-full { width: 100%; }
.button-primary { background: var(--ink); color: white; }
.button-primary:hover { background: #3a332e; }
.button-secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.button-soft { background: var(--rose-soft); color: var(--terracotta-dark); }
.button-ghost { background: transparent; color: var(--muted); border: 1px dashed var(--line); }
.button-success { min-height: 32px; padding: 0 9px; background: var(--success-soft); color: var(--success); font-size: 10px; }
.button-danger { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(167,63,54,.14); }
.icon-button { width: 33px; height: 33px; display: grid; place-items: center; background: transparent; color: var(--muted); }
.icon-button:hover { background: var(--paper-2); color: var(--ink); }

.modal, .plan-dialog {
  width: min(720px, calc(100% - 26px)); max-height: calc(100vh - 26px);
  padding: 0; border: 1px solid var(--line); border-radius: 21px; background: var(--surface); color: var(--ink);
  box-shadow: 0 30px 90px rgba(45,33,24,.28);
}
.modal::backdrop, .plan-dialog::backdrop { background: rgba(45,33,24,.62); backdrop-filter: blur(4px); }
.modal-small { width: min(540px, calc(100% - 26px)); }
.modal form { padding: 22px; }
.modal-header { display: flex; justify-content: space-between; align-items: start; gap: 15px; margin-bottom: 19px; }
.modal-header h2 { margin: 0; font-size: 24px; letter-spacing: -.035em; }
.modal-header p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.field-wide { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--line); }
.account-modal-actions { justify-content: space-between; }
.account-modal-actions > div { display: flex; gap: 8px; }
.plan-dialog { width: min(820px, calc(100% - 26px)); padding: 18px; }
.plan-dialog-header { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 12px; }
.plan-dialog-header h2 { margin: 0; }
.plan-dialog img { display: block; width: 100%; max-height: calc(100vh - 130px); object-fit: contain; border-radius: 12px; background: var(--paper); }
.toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 120;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  padding: 10px 14px; border-radius: 999px; background: var(--ink); color: white;
  box-shadow: var(--shadow); font-size: 11px; font-weight: 800; transition: .16s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1060px) {
  .header-inner { grid-template-columns: auto 1fr auto; }
  .brand-text { display: none; }
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .toolbar { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .search-box { grid-column: 1 / -1; }
  .items-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 820px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-story { min-height: 430px; }
  .auth-story-inner { min-height: 430px; width: min(100% - 38px, 650px); padding: 55px 0 20px; }
  .auth-story h1 { font-size: 46px; }
  .auth-story p { font-size: 14px; }
  .mini-plan-stack { display: none; }
  .auth-panel { padding: 38px 20px 55px; }
  .auth-copy { margin-top: 42px; }
  .header-inner { min-height: 70px; grid-template-columns: auto 1fr auto; }
  .list-switcher { justify-self: center; }
  .list-tab { padding: 0 10px; font-size: 11px; }
  .account-copy { display: none; }
  .milestone-hero { grid-template-columns: 1fr; padding: 27px 23px; }
  .milestone-card { max-width: 440px; }
  .floorplan-grid { grid-template-columns: 1fr; }
  .office-card { grid-column: auto; }
}

@media (max-width: 620px) {
  .header-inner, .shell { width: min(100% - 22px, 1240px); }
  .header-inner { grid-template-columns: auto 1fr auto; gap: 7px; }
  .list-switcher { justify-self: stretch; }
  .list-tab { flex: 1; padding: 0 7px; }
  .header-actions .button-secondary { display: none; }
  .account-button > span:last-child { display: none; }
  .milestone-copy h1 { font-size: 38px; }
  .milestone-hero::after { display: none; }
  .floorplan-title { align-items: flex-start; }
  .floorplan-title small { display: none; }
  .office-card { grid-template-columns: auto 1fr; }
  .office-card .button { grid-column: 1 / -1; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 15px; }
  .stat-card strong { font-size: 20px; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar select:last-child { grid-column: 1 / -1; }
  .items-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: start; }
  .section-heading > .button { flex: 0 0 auto; }
  .form-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .account-modal-actions { align-items: stretch; flex-direction: column-reverse; }
  .account-modal-actions > div { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr; }
  .toolbar > *, .toolbar select:last-child { grid-column: auto; }
  .list-tab span:first-child { display: none; }
  .list-tab { font-size: 10px; }
}
