@font-face { font-family: "Barlow Condensed"; src: url("assets/fonts/barlow-condensed-400.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("assets/fonts/barlow-condensed-500.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("assets/fonts/barlow-condensed-600.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("assets/fonts/manrope-400.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("assets/fonts/manrope-500.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("assets/fonts/manrope-600.ttf") format("truetype"); font-weight: 600; font-display: swap; }

:root {
  --navy: #07182d;
  --navy-2: #0d223a;
  --navy-3: #17324e;
  --mineral: #f3f0e8;
  --paper: #fbfaf6;
  --ink: #111923;
  --muted: #6d706d;
  --rule: #d9d5cb;
  --coral: #ff624e;
  --coral-dark: #d84335;
  --white: #fffef9;
  --positive: #7bc9a1;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Manrope", sans-serif;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--mineral);
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.45;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 170px minmax(0, 1fr); }
.rail {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 100vh;
  display: flex;
  flex-direction: column;
  color: #dce5ec;
  background: var(--navy);
  border-right: 1px solid rgba(255,255,255,.1);
}
.wordmark {
  display: block;
  padding: 25px 20px 22px;
  font-family: var(--display);
  font-size: 31px;
  font-weight: 500;
  letter-spacing: .17em;
  color: var(--white);
}
.rail-nav { margin-top: 28px; }
.rail-nav > p {
  margin: 0 18px 10px;
  color: #8595a6;
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.nav-item {
  min-height: 49px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 18px;
  color: #c6d2dc;
  border-left: 1px solid transparent;
  transition: background .2s var(--ease-out), color .2s var(--ease-out);
}
.nav-item:hover { color: white; background: rgba(255,255,255,.05); }
.nav-item.is-active { color: #ff8a78; background: rgba(255,98,78,.12); border-left-color: var(--coral); }
.nav-item svg { width: 19px; }
.rail-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding: 14px 12px; position: relative; }
.profile-button { width: 100%; border: 0; background: transparent; color: white; display: grid; grid-template-columns: 35px 1fr 16px; gap: 9px; align-items: center; text-align: left; padding: 8px; }
.profile-button .avatar { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 50%; background: #718196; font-family: var(--display); font-size: 16px; }
.profile-button strong, .profile-button small { display: block; }
.profile-button strong { font-size: 12px; }
.profile-button small { color: #8fa0b1; font-size: 10px; margin-top: 2px; }
.profile-button svg { width: 15px; }
.profile-panel { position: absolute; left: 12px; right: 12px; bottom: 73px; padding: 12px; background: var(--navy-3); border: 1px solid rgba(255,255,255,.13); color: #cbd6df; font-size: 11px; }

main { min-width: 0; background: var(--paper); }
.topbar {
  min-height: 78px;
  display: grid;
  grid-template-columns: minmax(250px, 1fr) minmax(170px, .45fr) auto;
  align-items: stretch;
  border-bottom: 1px solid var(--rule);
  background: rgba(251,250,246,.96);
}
.project-identity, .room-select, .project-pulse { padding: 15px 25px; }
.project-identity { display: flex; align-items: baseline; gap: 12px; }
.project-identity h1 { margin: 0; font-family: var(--display); font-size: 28px; font-weight: 500; letter-spacing: -.01em; }
.project-identity span { color: var(--muted); font-size: 11px; }
.room-select { border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); }
.room-select > span { display: block; color: var(--muted); font-family: var(--display); font-size: 11px; letter-spacing: .09em; text-transform: uppercase; }
.room-select button { border: 0; background: transparent; padding: 4px 0 0; display: flex; align-items: center; gap: 14px; color: var(--ink); font-weight: 600; }
.room-select svg { width: 15px; }
.project-pulse { margin: 0; display: flex; gap: 28px; align-items: center; }
.project-pulse div { min-width: 90px; }
.project-pulse dt { color: var(--muted); font-family: var(--display); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.project-pulse dd { margin: 4px 0 0; font-family: var(--display); font-size: 18px; font-weight: 500; font-variant-numeric: tabular-nums; }

.workspace { background: var(--navy); color: white; scroll-margin-top: 58px; }
.workspace-title {
  min-height: 74px;
  padding: 14px 25px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--paper);
  color: var(--ink);
}
.workspace-title h2, .project-ledger h2 { margin: 0; font-family: var(--display); font-size: 24px; font-weight: 500; letter-spacing: -.01em; }
.workspace-title p, .project-ledger p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.source-actions { display: flex; align-items: center; gap: 18px; }
.quiet-action { border: 0; background: transparent; display: flex; gap: 8px; align-items: center; color: var(--ink); padding: 8px; }
.quiet-action svg { width: 18px; }
.geometry-state { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 999px; background: #e6eee8; color: #365a49; font-size: 10px; }
.geometry-state > span, .source-confirm span { width: 7px; height: 7px; border-radius: 50%; background: #3a9f70; }

.viewfinder { position: relative; aspect-ratio: 16 / 7.3; min-height: 400px; overflow: hidden; background: #0b1117; }
.room-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; user-select: none; }
.after-layer { position: absolute; inset: 0; overflow: hidden; clip-path: inset(0 0 0 52%); }
.after-image { transform-origin: center; }
.viewfinder.is-motion .after-image { animation: roomDrift 6s var(--ease-out) 1; }
@keyframes roomDrift { 0% { transform: scale(1); } 55% { transform: scale(1.045) translate3d(-.7%, -.4%, 0); } 100% { transform: scale(1); } }
.comparison-input { position: absolute; inset: 0; z-index: 8; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; }
.comparison-seam { position: absolute; z-index: 7; top: 0; bottom: 0; left: 52%; width: 2px; background: var(--coral); transform: translateX(-1px); pointer-events: none; box-shadow: 0 0 18px rgba(255,98,78,.28); }
.comparison-seam > span { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 43px; height: 43px; border-radius: 50%; display: grid; grid-template-columns: 1fr 1fr; place-items: center; background: var(--coral); color: var(--navy); box-shadow: 0 8px 26px rgba(0,0,0,.25); }
.comparison-seam b { font-family: var(--display); font-size: 22px; font-weight: 400; }
.photo-label { position: absolute; z-index: 6; top: 22px; padding: 7px 10px; background: var(--navy); color: white; font-family: var(--display); font-size: 13px; letter-spacing: .09em; text-transform: uppercase; }
.before-label { left: 26px; }
.after-label { right: 26px; background: var(--coral); color: var(--navy); }
.focus-corner { position: absolute; z-index: 5; width: 29px; height: 29px; opacity: .85; }
.top-left { top: 58px; left: 28px; border-top: 2px solid white; border-left: 2px solid white; }
.top-right { top: 58px; right: 28px; border-top: 2px solid white; border-right: 2px solid white; }
.bottom-left { bottom: 27px; left: 28px; border-bottom: 2px solid white; border-left: 2px solid white; }
.bottom-right { bottom: 27px; right: 28px; border-bottom: 2px solid white; border-right: 2px solid white; }
.motion-note { position: absolute; z-index: 9; left: 50%; bottom: 18px; transform: translateX(-50%); color: white; background: rgba(7,24,45,.9); padding: 6px 10px; font-size: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.motion-note.is-visible { opacity: 1; }

.workbench { display: grid; grid-template-columns: 190px minmax(400px, 1.7fr) minmax(220px, .72fr) minmax(245px, .8fr); border-top: 1px solid #27435e; border-bottom: 1px solid #27435e; background: var(--navy); }
.workbench section { min-width: 0; padding: 22px 23px; border-right: 1px solid #27435e; }
.workbench section:last-child { border-right: 0; }
.workbench h3 { margin: 0 0 15px; font-family: var(--display); font-size: 14px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: #dce7ef; }
.source-photo { width: 100%; aspect-ratio: 1.25; border: 1px dashed #486078; background: transparent; color: white; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; }
.source-photo:hover { background: rgba(255,255,255,.04); }
.source-photo svg { width: 27px; height: 27px; }
.source-photo strong { font-family: var(--display); font-size: 15px; font-weight: 500; letter-spacing: .04em; }
.source-photo span { color: #8fa3b5; font-size: 9px; }
.source-confirm { margin: 12px 0 0; display: flex; align-items: center; gap: 7px; color: #9fb2c3; font-size: 10px; }
.source-confirm span { background: var(--positive); }
.bay-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; }
.bay-heading > span { color: #8ea0b2; font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.material-grid { display: grid; grid-template-columns: repeat(4, minmax(88px, 1fr)); gap: 9px; }
.material-card { position: relative; min-width: 0; padding: 0; background: #112840; color: white; border: 1px solid #41566b; text-align: left; transition: border-color .18s, transform .18s var(--ease-out); }
.material-card:hover { transform: translateY(-2px); border-color: #8094a7; }
.material-card.is-selected { border-color: var(--coral); box-shadow: inset 0 0 0 1px var(--coral); }
.material-card img { width: 100%; aspect-ratio: 1.3; object-fit: cover; display: block; }
.material-card span { display: block; padding: 8px; }
.material-card strong, .material-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.material-card strong { font-family: var(--display); font-size: 13px; font-weight: 500; letter-spacing: .035em; }
.material-card small { color: #99aaba; font-size: 9px; margin-top: 2px; }
.add-material { margin-top: 11px; padding: 7px 0; border: 0; background: transparent; color: #ff8270; display: flex; gap: 7px; align-items: center; font-family: var(--display); font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.add-material svg { width: 16px; }
.selected-material { display: flex; gap: 10px; align-items: center; padding: 0 0 13px; border-bottom: 1px solid #2b445e; }
.selected-dot { width: 9px; height: 9px; background: var(--coral); border-radius: 50%; }
.selected-material strong, .selected-material small { display: block; }
.selected-material strong { font-family: var(--display); font-size: 16px; font-weight: 500; }
.selected-material small { color: #91a4b5; font-size: 9px; margin-top: 2px; }
.assignment-bay label { display: block; margin: 13px 0 6px; color: #91a4b5; font-size: 9px; }
.assignment-bay select { width: 100%; appearance: none; color: white; background: var(--navy-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ffffff'%3E%3Cpath d='m8 10 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 10px center; border: 1px solid #435b73; padding: 9px 29px 9px 10px; border-radius: 0; }
.lock-control { width: 100%; margin-top: 13px; border: 1px solid #3c556d; background: transparent; color: white; display: flex; gap: 9px; align-items: center; text-align: left; padding: 9px; }
.lock-control[aria-pressed="false"] { border-color: #7c5260; color: #ffae9f; }
.lock-control svg { width: 18px; }
.lock-control strong, .lock-control small { display: block; }
.lock-control strong { font-family: var(--display); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.lock-control small { color: #8499ac; font-size: 8px; margin-top: 2px; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #3c556d; }
.mode-switch button { border: 0; background: transparent; color: #9eafbe; padding: 9px; font-family: var(--display); text-transform: uppercase; letter-spacing: .08em; }
.mode-switch button.is-active { background: var(--coral); color: var(--navy); font-weight: 600; }
.impact-line { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #2b445e; font-size: 10px; color: #9db0c0; }
.impact-line strong { color: white; font-weight: 500; font-variant-numeric: tabular-nums; }
.generate-button { width: 100%; margin-top: 15px; border: 0; background: var(--coral); color: var(--navy); display: flex; align-items: center; justify-content: space-between; padding: 13px 14px; font-family: var(--display); font-size: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; transition: background .18s, transform .18s var(--ease-out); }
.generate-button:hover { background: #ff765f; transform: translateY(-1px); }
.generate-button:disabled { cursor: wait; opacity: .7; transform: none; }
.demo-note { color: #7f94a8; font-size: 8px; margin: 8px 0 0; text-align: center; }
.generation-status { min-height: 36px; padding: 10px 25px; display: flex; align-items: center; gap: 12px; background: #061425; color: #91a4b5; font-size: 9px; }
.status-bar { width: 100px; height: 2px; background: #2a4057; overflow: hidden; }
.status-bar i { display: block; width: 100%; height: 100%; background: var(--coral); clip-path: inset(0 100% 0 0); transition: clip-path .6s var(--ease-out); }
.generation-status.is-running .status-bar i { clip-path: inset(0 calc(100% - var(--progress, 20%)) 0 0); }

.project-ledger { padding: 38px 34px 55px; background: var(--paper); color: var(--ink); }
.ledger-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 25px; padding-bottom: 18px; border-bottom: 1px solid var(--rule); }
.ledger-tabs { display: flex; gap: 4px; }
.ledger-tabs button { border: 0; background: transparent; color: var(--muted); padding: 8px 10px; font-family: var(--display); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.ledger-tabs button[aria-selected="true"] { color: var(--coral-dark); border-bottom: 1px solid var(--coral); }
.ledger-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.ledger-table th { padding: 13px 10px 10px; color: var(--muted); text-align: left; font-family: var(--display); font-size: 10px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.ledger-table td { padding: 13px 10px; border-top: 1px solid var(--rule); }
.ledger-table .amount { text-align: right; font-variant-numeric: tabular-nums; }
.status-tag { display: inline-flex; align-items: center; gap: 6px; }
.status-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #3a9f70; }
.status-tag.review::before { background: var(--coral); }
.ledger-summary { display: flex; justify-content: flex-end; gap: 28px; padding: 17px 10px 0; border-top: 1px solid var(--ink); font-family: var(--display); font-size: 16px; }
.ledger-summary span { color: var(--muted); font-family: var(--body); font-size: 10px; }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 76px minmax(0,1fr); }
  .wordmark { font-size: 0; letter-spacing: 0; text-align: center; padding-inline: 0; }
  .wordmark::after { content: "M"; font-family: var(--display); font-size: 31px; color: white; }
  .rail-nav > p, .nav-item span, .profile-button > span:nth-child(2), .profile-button > svg { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .profile-button { display: block; padding: 6px; }
  .profile-button .avatar { margin: auto; }
  .workbench { grid-template-columns: 150px minmax(350px,1.5fr) minmax(210px,.8fr); }
  .control-bay { grid-column: 1 / -1; display: grid; grid-template-columns: 120px 1fr 1fr 230px; align-items: center; gap: 15px; border-top: 1px solid #27435e; }
  .control-bay h3, .control-bay .demo-note { margin: 0; }
  .generate-button { margin: 0; }
  .project-pulse div:first-child { display: none; }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .rail { position: sticky; height: 58px; width: 100%; flex-direction: row; align-items: center; }
  .wordmark { width: 70px; padding: 0; }
  .rail-nav { margin: 0; display: flex; flex: 1; height: 100%; }
  .nav-item { flex: 1; min-height: 58px; border-left: 0; border-bottom: 1px solid transparent; }
  .nav-item.is-active { border-left: 0; border-bottom-color: var(--coral); }
  .rail-foot { margin: 0; padding: 5px 10px; border-top: 0; border-left: 1px solid rgba(255,255,255,.1); }
  .profile-button .avatar { width: 32px; height: 32px; }
  .topbar { grid-template-columns: 1fr auto; }
  .project-identity { padding: 12px 16px; }
  .project-identity h1 { font-size: 24px; }
  .project-identity span, .room-select { display: none; }
  .project-pulse { padding: 8px 14px; gap: 16px; }
  .project-pulse div:nth-child(2) { display: none; }
  .workspace-title { padding: 12px 16px; }
  .source-actions .geometry-state { display: none; }
  .viewfinder { min-height: 0; aspect-ratio: 4 / 3; }
  .workbench { grid-template-columns: 1fr 1fr; }
  .workbench section { border-bottom: 1px solid #27435e; }
  .source-bay { display: none; }
  .material-bay { grid-column: 1 / -1; }
  .assignment-bay { grid-column: 1; }
  .control-bay { grid-column: 2; display: block; }
  .control-bay h3 { margin-bottom: 15px; }
  .generate-button { margin-top: 15px; }
  .project-ledger { padding: 28px 16px 40px; overflow-x: auto; }
  .ledger-head { align-items: flex-start; flex-direction: column; }
  .ledger-table { min-width: 670px; }
}

@media (max-width: 560px) {
  .rail-nav .nav-item:nth-of-type(n+4) { display: none; }
  .project-pulse { display: none; }
  .topbar { display: block; min-height: 62px; }
  .project-identity { height: 62px; align-items: center; }
  .workspace-title { align-items: flex-start; }
  .workspace-title p { max-width: 230px; }
  .quiet-action { font-size: 0; padding: 6px; }
  .quiet-action { min-width: 44px; min-height: 44px; justify-content: center; }
  .quiet-action svg { width: 21px; height: 21px; }
  .viewfinder { aspect-ratio: 1 / 1; }
  .room-image { object-position: center; }
  .photo-label { top: 12px; }
  .before-label { left: 12px; }
  .after-label { right: 12px; }
  .focus-corner { display: none; }
  .workbench { display: block; }
  .workbench section { border-right: 0; }
  .material-grid { grid-template-columns: repeat(2, 1fr); }
  .material-card img { aspect-ratio: 1.65; }
  .add-material, .mode-switch button, .assignment-bay select, .ledger-tabs button { min-height: 44px; }
  .assignment-bay, .control-bay { width: 100%; }
  .generation-status { padding-inline: 16px; }
  .ledger-tabs { width: 100%; overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
