/* Property Motion: app pages (studio, account, legal). Tokens match index.html. */
:root {
  --bg: #F2F3F0; --surface: #FFFFFF; --ink: #1D2530; --muted: #58616C; --line: #D6D9D4;
  --green: #2F4A44; --green-ink: #F2F3F0; --brass: #B08D57; --brass-text: #7E6234; --frame: #1D2530;
  --danger: #9A3B2E; --ok: #2F6B4F; --tint: #E7EBE6;
  --serif: "Bodoni Moda", "Bodoni 72", Didot, "Libre Bodoni", Georgia, serif;
  --sans: "Jost", Futura, "Century Gothic", "Avenir Next", system-ui, sans-serif;
  --gutter: clamp(1rem, 3vw, 2rem);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141A20; --surface: #1B232B; --ink: #E9E7E2; --muted: #A3ABB3; --line: #2C3640;
    --green: #8FB3A8; --green-ink: #141A20; --brass: #C9A66E; --brass-text: #D2B27C; --frame: #0E1318;
    --danger: #E08B7C; --ok: #8FCBA8; --tint: #202A33; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141A20; --surface: #1B232B; --ink: #E9E7E2; --muted: #A3ABB3; --line: #2C3640;
  --green: #8FB3A8; --green-ink: #141A20; --brass: #C9A66E; --brass-text: #D2B27C; --frame: #0E1318;
  --danger: #E08B7C; --ok: #8FCBA8; --tint: #202A33; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 300 1rem/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
img, svg, canvas { max-width: 100%; display: block; }
a { color: inherit; }
p { margin: 0 0 .8em; }
strong, b { font-weight: 500; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.1; margin: 0; letter-spacing: -0.01em; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: 400 1rem/1 var(--sans); letter-spacing: .02em; text-decoration: none; white-space: nowrap;
  padding: .9rem 1.4rem; border: 1px solid var(--green); border-radius: 2px; cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s, opacity .2s;
}
.btn-solid { background: var(--green); color: var(--green-ink); }
.btn-solid:hover:not(:disabled) { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-line { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-line:hover:not(:disabled) { border-color: var(--ink); }
.btn-quiet { background: none; border-color: transparent; color: var(--muted); padding: .6rem .4rem; text-decoration: underline; text-underline-offset: 3px; }
.btn-quiet:hover { color: var(--ink); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn-wide { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* Header */
.app-header { background: var(--bg); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.app-header .in { display: flex; align-items: center; gap: 1.5rem; height: 68px; padding: 0 var(--gutter); max-width: 1440px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; margin-right: auto; }
.brand svg { width: 28px; height: 28px; }
.brand span { font-family: var(--serif); font-size: 1.25rem; }
.app-nav { display: flex; gap: 1.4rem; align-items: center; }
.app-nav a { text-decoration: none; color: var(--muted); }
.app-nav a:hover, .app-nav a[aria-current="page"] { color: var(--ink); }
.app-nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--brass); text-underline-offset: 6px; }
.meter { display: flex; align-items: center; gap: .7rem; font-size: .92rem; color: var(--muted); }
.meter b { color: var(--ink); font-weight: 500; }
.meter .bar { width: 64px; height: 3px; background: var(--line); position: relative; }
.meter .bar i { position: absolute; inset: 0 auto 0 0; background: var(--brass); }
@media (max-width: 720px) {
  .app-header { position: static; }
  .app-header .in { gap: .9rem; height: auto; min-height: 60px; flex-wrap: wrap; padding-top: .6rem; padding-bottom: .6rem; }
  .meter { order: 3; width: 100%; }
  .brand span { font-size: 1.1rem; }
}

.demo-note { background: var(--tint); border-bottom: 1px solid var(--line); font-size: .9rem; color: var(--muted); }
.demo-note .in { max-width: 1440px; margin: 0 auto; padding: .55rem var(--gutter); display: flex; gap: .6rem; align-items: baseline; }
.demo-note b { color: var(--brass-text); font-weight: 500; }

/* Messages */
.msg { padding: .8rem 1rem; border-left: 2px solid var(--brass); background: var(--surface); font-size: .95rem; margin: 0 0 1rem; }
.msg.err { border-left-color: var(--danger); }
.msg.ok { border-left-color: var(--ok); }
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--bg); padding: .8rem 1.2rem; border-radius: 2px; font-size: .95rem;
  max-width: min(92vw, 34rem); box-shadow: 0 20px 40px -20px rgba(0,0,0,.5);
}

/* Forms */
.field { display: grid; gap: .35rem; margin-bottom: 1rem; }
.field label, .label { font-size: .88rem; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=url], select {
  width: 100%; font: 400 1rem/1.3 var(--sans); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 2px; padding: .75rem .85rem;
}
input:focus, select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent); }
.row { display: grid; grid-template-columns: repeat(var(--cols, 2), 1fr); gap: 0 1rem; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }
.check { display: flex; gap: .7rem; align-items: flex-start; font-size: .95rem; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: .2rem 0 0; accent-color: var(--green); flex: none; }

/* Auth */
.auth { max-width: 1100px; margin: 0 auto; padding: clamp(2.5rem, 7vw, 5.5rem) var(--gutter); display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(2rem, 6vw, 6rem); align-items: start; }
.auth h1 { font-size: clamp(2.3rem, 5vw, 3.8rem); margin-bottom: 1.2rem; }
.auth .lede { color: var(--muted); font-size: 1.1rem; max-width: 30em; }
.auth ul { list-style: none; padding: 0; margin: 1.8rem 0 0; }
.auth li { padding: .6rem 0 .6rem 1.4rem; border-top: 1px solid var(--line); position: relative; }
.auth li::before { content: ""; position: absolute; left: 0; top: 1.25rem; width: .7rem; height: 1px; background: var(--brass); }
.card { background: var(--surface); border: 1px solid var(--line); padding: clamp(1.4rem, 3vw, 2.2rem); }
.tabs { display: flex; border-bottom: 1px solid var(--line); margin: -.4rem 0 1.5rem; }
.tabs button { flex: 1; background: none; border: 0; border-bottom: 2px solid transparent; padding: .8rem; font: 400 1rem var(--sans); color: var(--muted); cursor: pointer; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brass); }
@media (max-width: 820px) { .auth { grid-template-columns: 1fr; } }

/* Studio */
.studio { max-width: 1440px; margin: 0 auto; padding: 1.5rem var(--gutter) 4rem; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 42%); gap: clamp(1.5rem, 3vw, 3rem); align-items: start; }
@media (max-width: 980px) { .studio { grid-template-columns: 1fr; } }
.stages { list-style: none; margin: 0; padding: 0; counter-reset: stage; }
.stage { counter-increment: stage; padding: 1.6rem 0 2rem; border-top: 1px solid var(--line); }
.stage:first-child { border-top: 0; padding-top: .6rem; }
.stage-head { display: flex; align-items: baseline; gap: .9rem; margin-bottom: .4rem; }
.stage-head::before { content: counter(stage); font-family: var(--serif); font-size: 2rem; line-height: 1; color: var(--brass-text); min-width: 1.2rem; }
.stage-head h2 { font-size: 1.6rem; }
.stage-head .aside { margin-left: auto; font-size: .9rem; color: var(--muted); }
.stage > .hint { color: var(--muted); margin: 0 0 1.1rem 2.1rem; max-width: 40em; }
.stage-body { margin-left: 2.1rem; }
@media (max-width: 560px) { .stage > .hint, .stage-body { margin-left: 0; } }

.drop {
  display: grid; place-items: center; text-align: center; gap: .3rem; padding: 1.8rem 1rem;
  border: 1px dashed color-mix(in srgb, var(--ink) 30%, transparent); background: var(--surface); cursor: pointer;
  transition: border-color .2s, background-color .2s;
}
.drop:hover, .drop.over { border-color: var(--green); background: color-mix(in srgb, var(--green) 6%, var(--surface)); }
.drop b { font-family: var(--serif); font-weight: 400; font-size: 1.25rem; }
.drop span { color: var(--muted); font-size: .92rem; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-actions { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: .6rem 0 1rem; flex-wrap: wrap; font-size: .92rem; color: var(--muted); }

.tiles { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
.tile { background: var(--surface); border: 1px solid var(--line); position: relative; cursor: grab; }
.tile.dragging { opacity: .4; }
.tile.drop-before { box-shadow: -4px 0 0 var(--brass); }
.tile.drop-after { box-shadow: 4px 0 0 var(--brass); }
.tile .ph { aspect-ratio: 3 / 2; background: var(--tint); overflow: hidden; position: relative; }
.tile .ph img { width: 100%; height: 100%; object-fit: cover; }
.tile .num { position: absolute; left: .4rem; top: .4rem; background: rgba(16,21,26,.72); color: #F4F2EC; font-size: .78rem; padding: .05rem .45rem; border-radius: 2px; }
.tile .x { position: absolute; right: .3rem; top: .3rem; width: 28px; height: 28px; border: 0; border-radius: 2px; background: rgba(16,21,26,.72); color: #F4F2EC; cursor: pointer; font-size: 1rem; line-height: 1; }
.tile .x:hover { background: var(--danger); }
.tile input { border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: .5rem .6rem; font-size: .9rem; }
.tile .warn { font-size: .78rem; color: var(--brass-text); padding: .35rem .6rem 0; line-height: 1.35; }
.tile .moves { display: none; position: absolute; left: .3rem; bottom: .3rem; gap: .25rem; }
.tile .moves button { width: 30px; height: 28px; border: 0; background: rgba(16,21,26,.72); color: #F4F2EC; border-radius: 2px; cursor: pointer; }
.tile:focus-within .moves, .tile:hover .moves { display: flex; }
@media (pointer: coarse) { .tile .moves { display: flex; } }

.choices { display: grid; grid-template-columns: repeat(var(--cols, 3), 1fr); gap: .6rem; margin-bottom: 1.2rem; }
@media (max-width: 560px) { .choices { grid-template-columns: 1fr 1fr; } }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span { display: block; height: 100%; padding: .75rem .9rem; border: 1px solid var(--line); background: var(--surface); transition: border-color .2s, box-shadow .2s; }
.choice b { display: block; font-weight: 400; font-family: var(--serif); font-size: 1.1rem; }
.choice small { display: block; color: var(--muted); font-size: .84rem; line-height: 1.35; margin-top: .15rem; }
.choice input:checked + span { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.choice input:focus-visible + span { outline: 2px solid var(--brass); outline-offset: 2px; }
.choice input:disabled + span { opacity: .5; }
.group-label { font-size: .88rem; color: var(--muted); margin: 0 0 .45rem; }

/* Preview column */
.monitor { position: sticky; top: 90px; }
@media (max-width: 980px) { .monitor { position: static; } }
.screen { background: var(--frame); display: grid; place-items: center; padding: clamp(.6rem, 2vw, 1.2rem); border-radius: 3px; box-shadow: 0 40px 80px -50px rgba(20,30,36,.6); }
.screen canvas { width: auto; height: auto; max-width: 100%; max-height: min(62vh, 640px); background: #10151A; }
.screen .empty { color: #A3ABB3; text-align: center; padding: 4rem 1rem; font-size: .95rem; }
.screen .empty b { display: block; font-family: var(--serif); font-weight: 400; color: #E9E7E2; font-size: 1.4rem; margin-bottom: .4rem; }
.transport { display: flex; align-items: center; gap: .8rem; margin: .8rem 0 .4rem; }
.transport .play { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.transport .play:hover { border-color: var(--ink); }
.transport .play svg { width: 16px; height: 16px; }
.transport input[type=range] { flex: 1; accent-color: var(--brass); }
.transport time { font-size: .9rem; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 6.5rem; text-align: right; }
.monitor-note { font-size: .88rem; color: var(--muted); margin: 0 0 1rem; }
.notes { margin: 0 0 1rem; padding: 0; list-style: none; }
.notes li { font-size: .9rem; padding: .5rem .8rem; border-left: 2px solid var(--brass); background: var(--surface); margin-bottom: .4rem; }

.make { border-top: 1px solid var(--line); padding-top: 1.2rem; }
.make .cost { font-size: .9rem; color: var(--muted); margin: .6rem 0 0; }
.progress { margin-top: .2rem; }
.progress .track { height: 3px; background: var(--line); position: relative; overflow: hidden; }
.progress .track i { position: absolute; inset: 0 auto 0 0; background: var(--brass); width: 0; transition: width .25s linear; }
.progress .status { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin: .6rem 0; font-size: .95rem; }
.progress .status b { font-weight: 400; }
.result { background: var(--surface); border: 1px solid var(--line); padding: 1.2rem; margin-top: 1rem; }
.result h3 { font-size: 1.35rem; margin-bottom: .3rem; }
.result .actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .9rem; }

/* Plans dialog */
dialog { border: 0; padding: 0; background: transparent; max-width: min(1040px, 94vw); width: 100%; color: var(--ink); }
dialog::backdrop { background: rgba(14,19,24,.62); }
.dlg { background: var(--bg); border: 1px solid var(--line); padding: clamp(1.4rem, 3.5vw, 2.6rem); max-height: 90vh; overflow: auto; }
.dlg-head { display: flex; justify-content: space-between; gap: 1rem; align-items: start; margin-bottom: 1.4rem; }
.dlg-head h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
.dlg-close { background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); padding: .2rem .4rem; }
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); background: var(--surface); }
.plan-grid article { padding: 1.4rem; display: flex; flex-direction: column; }
.plan-grid article + article { border-left: 1px solid var(--line); }
.plan-grid h3 { font-size: 1.45rem; }
.plan-grid .price { display: flex; gap: .35rem; align-items: baseline; margin: .6rem 0 1rem; }
.plan-grid .price b { font-family: var(--serif); font-weight: 400; font-size: 2.4rem; line-height: 1; }
.plan-grid ul { list-style: none; padding: 0; margin: 0 0 1.2rem; flex: 1; font-size: .94rem; }
.plan-grid li { padding: .4rem 0; border-top: 1px solid var(--line); }
.plan-grid .current { font-size: .85rem; color: var(--brass-text); margin-bottom: .6rem; }
.plan-grid article.on { box-shadow: inset 0 0 0 1px var(--green); }
@media (max-width: 760px) { .plan-grid { grid-template-columns: 1fr; } .plan-grid article + article { border-left: 0; border-top: 1px solid var(--line); } }
.pay { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: start; }
.pay .fake { border: 1px dashed var(--line); padding: 1rem; background: var(--surface); }
.pay .fake input { background: var(--tint); color: var(--muted); }
@media (max-width: 760px) { .pay { grid-template-columns: 1fr; } }

/* Account */
.page { max-width: 1100px; margin: 0 auto; padding: clamp(2rem, 5vw, 4rem) var(--gutter) 5rem; }
.page > h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); margin-bottom: .6rem; }
.page > .lede { color: var(--muted); margin-bottom: 2.5rem; }
.acct { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.2rem; margin-bottom: 3rem; }
@media (max-width: 820px) { .acct { grid-template-columns: 1fr; } }
.stat { font-family: var(--serif); font-size: 3rem; line-height: 1; }
.kv { display: grid; grid-template-columns: 9rem 1fr; gap: .5rem 1rem; margin: 1.2rem 0; font-size: .96rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.acct .actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.section-title { font-size: 1.7rem; margin: 0 0 1rem; }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; min-width: 560px; }
th, td { text-align: left; padding: .8rem .8rem .8rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 500; color: var(--muted); font-size: .88rem; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.num.plus { color: var(--ok); }
.danger-zone { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
@media (max-width: 760px) { .danger-zone { grid-template-columns: 1fr; } }

/* Legal */
.legal { max-width: 46rem; margin: 0 auto; padding: clamp(2.5rem, 6vw, 5rem) var(--gutter) 5rem; }
.legal h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); margin-bottom: .5rem; }
.legal h2 { font-size: 1.5rem; margin: 2.2rem 0 .6rem; }
.legal p, .legal li { color: var(--ink); }
.legal .todo { background: color-mix(in srgb, var(--brass) 22%, transparent); padding: 0 .25rem; }
.site-foot { border-top: 1px solid var(--line); padding: 2rem var(--gutter); font-size: .9rem; color: var(--muted); }
.site-foot .in { max-width: 1440px; margin: 0 auto; display: flex; gap: 1.4rem; flex-wrap: wrap; }
.site-foot a { text-decoration: none; }
.site-foot a:hover { color: var(--ink); text-decoration: underline; }
.site-foot .in > :first-child { margin-right: auto; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
