:root {
  --fog: #e7ecea; --paper: #fbfcfb; --ink: #101a1c; --ink-2: #44575a; --line: #c6d1ce; --steel: #8a9a98;
  --cobalt: #2342f5; --cobalt-dark: #1832c4; --amber: #8a5a00; --amber-bg: #fff0cf; --green: #0b7a50; --red: #b3261e;
  --display: "Unbounded", "Onest", system-ui, sans-serif; --body: "Onest", system-ui, sans-serif; --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --tag-cut: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--fog); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body { margin: 0; min-height: 100vh; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.wordmark { font-family: var(--display); font-weight: 700; font-size: 1.05rem; letter-spacing: -0.02em; margin: 0; }
.wordmark span { font-weight: 500; color: var(--cobalt); margin-left: 0.35em; }
.wordmark.small { font-size: 0.95rem; }

/* ---------- Shelf tag (the signature shape) ---------- */
.tag {
  position: relative; display: flex; align-items: center; gap: 14px; padding: 12px 18px 12px 34px;
  background: var(--paper); border: 1px solid var(--line);
  clip-path: polygon(var(--tag-cut) 0, 100% 0, 100% 100%, var(--tag-cut) 100%, 0 50%);
}
.tag::before { content: ""; position: absolute; left: 14px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--fog); box-shadow: inset 0 0 0 1px var(--line); }
.tag.own { background: var(--cobalt); color: #fff; border-color: var(--cobalt); }
.tag.own::before { background: var(--cobalt-dark); box-shadow: inset 0 0 0 1px rgba(255,255,255,.5); }

/* ---------- Auth ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 7fr) minmax(360px, 5fr); min-height: 100vh; }
.stage { padding: clamp(28px, 5vw, 64px); display: flex; flex-direction: column; gap: 22px; max-width: 760px; }
.stage h1 { font-family: var(--display); font-weight: 700; font-size: clamp(1.7rem, 3.2vw, 2.6rem); line-height: 1.12; letter-spacing: -0.03em; margin: 12px 0 0; max-width: 17em; text-wrap: balance; }
.lede { margin: 0; max-width: 34em; color: var(--ink-2); font-size: 1.05rem; }
.ladder { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; max-width: 620px; }
.ladder .tag { justify-content: space-between; padding-top: 16px; padding-bottom: 16px; font-size: 1.05rem; }
.ladder .own { transform-origin: left center; }
.ladder .rank { font-family: var(--mono); font-size: 0.8rem; color: var(--steel); width: 2.2em; }
.ladder .own .rank { color: rgba(255,255,255,.75); }
.ladder .who { flex: 1; font-size: 0.85rem; color: var(--ink-2); }
.ladder .own .who { color: #fff; font-weight: 600; }
.ladder .price { font-family: var(--mono); font-weight: 700; font-variant-numeric: tabular-nums; }
.ladder .gap { text-align: center; color: var(--steel); font-family: var(--mono); letter-spacing: 0.4em; line-height: 1; padding: 2px 0; }
.ladder-note { margin: 0; font-size: 0.85rem; color: var(--ink-2); }

.panel { background: var(--paper); border-left: 1px solid var(--line); padding: clamp(28px, 4vw, 56px); display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--fog); border-radius: 10px; align-self: flex-start; }
.tabs button { border: 0; background: transparent; padding: 8px 16px; border-radius: 7px; font-weight: 500; color: var(--ink-2); }
.tabs button[aria-selected="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 0 var(--line), 0 0 0 1px var(--line); }
.panel-title { font-family: var(--display); font-weight: 500; font-size: 1.25rem; letter-spacing: -0.02em; margin: 0; }
.form { display: grid; gap: 4px; max-width: 420px; }
.form label { display: grid; gap: 6px; font-weight: 500; font-size: 0.92rem; margin-top: 10px; }
.form input { padding: 12px 14px; border: 1px solid var(--steel); border-radius: 8px; background: #fff; }
.form input:focus { border-color: var(--cobalt); outline-offset: 0; }
.err { margin: 0; min-height: 1.2em; font-size: 0.85rem; color: var(--red); }
.fineprint { margin: 10px 0 0; font-size: 0.82rem; color: var(--ink-2); }

.btn { border: 1px solid var(--ink); background: transparent; padding: 11px 18px; border-radius: 8px; font-weight: 600; transition: transform .12s ease, background .12s ease; text-decoration: none; display: inline-block; }
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }
.btn.primary:hover { background: var(--cobalt-dark); }
.btn.quiet { border-color: var(--line); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.link { border: 0; background: none; padding: 0; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.rail { background: var(--ink); color: #e9efed; padding: 26px 18px; display: flex; flex-direction: column; gap: 28px; position: sticky; top: 0; height: 100vh; }
.rail .wordmark span { color: #8fa2ff; }
.rail nav { display: grid; gap: 4px; }
.nav { display: flex; justify-content: space-between; align-items: center; text-align: left; border: 0; background: transparent; color: #b9c7c4; padding: 10px 12px; border-radius: 8px; font-weight: 500; }
.nav:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav[aria-current="page"] { background: #fff; color: var(--ink); }
.badge { font-family: var(--mono); font-size: 0.75rem; background: var(--cobalt); color: #fff; border-radius: 99px; padding: 1px 8px; }
.rail-foot { margin-top: auto; display: grid; gap: 6px; font-size: 0.85rem; }
.rail-foot .who { margin: 0; color: #b9c7c4; overflow-wrap: anywhere; }
.rail-foot .link { color: #fff; justify-self: start; }

.content { padding: clamp(20px, 3vw, 40px); max-width: 1040px; width: 100%; }
.status { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.chip { font-size: 0.82rem; padding: 5px 11px; border-radius: 99px; background: var(--paper); border: 1px solid var(--line); color: var(--ink-2); }
.chip.warn { background: var(--amber-bg); border-color: #e6c985; color: var(--amber); }
.view-title { font-family: var(--display); font-weight: 700; font-size: clamp(1.3rem, 2.4vw, 1.8rem); letter-spacing: -0.03em; margin: 0 0 6px; }
.view-sub { margin: 0 0 22px; color: var(--ink-2); max-width: 42em; }
.section-h { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); margin: 30px 0 10px; }

/* ---------- Proposal cards ---------- */
.cards { display: grid; gap: 12px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; display: grid; gap: 14px; animation: rise .4s ease both; animation-delay: calc(var(--i, 0) * 60ms); }
.card h3 { margin: 0; font-size: 1.02rem; font-weight: 600; }
.card .meta { margin: 2px 0 0; font-size: 0.82rem; color: var(--ink-2); }
.move { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.move .old { font-family: var(--mono); font-size: 1.05rem; color: var(--steel); text-decoration: line-through; }
.move .arrow { color: var(--steel); }
.move .new.tag { font-family: var(--mono); font-weight: 700; font-size: 1.25rem; padding-top: 8px; padding-bottom: 8px; }
.move .rank { font-size: 0.9rem; color: var(--ink-2); }
.why { margin: 0; color: var(--ink-2); font-size: 0.92rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions input { flex: 1; min-width: 200px; padding: 10px 12px; border: 1px solid var(--steel); border-radius: 8px; background: #fff; }
.pill { font-size: 0.78rem; padding: 3px 10px; border-radius: 99px; background: var(--fog); color: var(--ink-2); }
.pill.ok { background: #d9f2e6; color: var(--green); }
.pill.bad { background: #fbe0dd; color: var(--red); }
.empty { background: var(--paper); border: 1px dashed var(--steel); border-radius: 12px; padding: 28px; color: var(--ink-2); }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.history li { background: var(--paper); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 11px 16px; font-size: 0.9rem; }
.history .grow { flex: 1; min-width: 180px; }

/* ---------- Products + price axis ---------- */
.axis { position: relative; height: 46px; margin: 4px 6px 0; }
.axis .rail-line { position: absolute; left: 0; right: 0; top: 22px; height: 2px; background: var(--line); }
.axis .band { position: absolute; top: 14px; height: 18px; left: var(--from); width: calc(var(--to) - var(--from)); background: rgba(35, 66, 245, .1); border: 1px dashed rgba(35, 66, 245, .55); border-radius: 4px; }
.axis .dot { position: absolute; top: 17px; left: var(--x); width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--steel); }
.axis .dot.me { top: 13px; width: 18px; height: 18px; margin-left: -9px; background: var(--cobalt); box-shadow: 0 0 0 3px rgba(35, 66, 245, .2); }
.axis .dot.next { top: 13px; width: 18px; height: 18px; margin-left: -9px; background: transparent; border: 2px solid var(--cobalt); }
.axis-labels { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 0.75rem; color: var(--ink-2); margin: 0 0 0; }
.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; padding-top: 6px; border-top: 1px solid var(--line); }
.rules label { display: grid; gap: 5px; font-size: 0.85rem; font-weight: 500; }
.rules input, .rules select { padding: 9px 11px; border: 1px solid var(--steel); border-radius: 8px; background: #fff; }
.switch { display: flex; gap: 8px; align-items: center; font-size: 0.9rem; }
.head-row { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }

.set { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 20px; display: grid; gap: 10px; max-width: 620px; margin-bottom: 14px; }
.set h3 { margin: 0; font-size: 1rem; }
.set p { margin: 0; color: var(--ink-2); font-size: 0.92rem; }
.set .row { display: flex; gap: 8px; flex-wrap: wrap; }
.card textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--steel); border-radius: 8px; background: #fff; font-family: var(--mono); font-size: 0.85rem; resize: vertical; }
.set input { flex: 1; min-width: 220px; padding: 10px 12px; border: 1px solid var(--steel); border-radius: 8px; background: #fff; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 0.92rem; z-index: 10; animation: rise .25s ease both; }
.toast.error { background: var(--red); }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  .app { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 12px; padding: 12px 14px; }
  .rail nav { display: flex; flex: 1; gap: 2px; }
  .rail-foot { margin: 0; }
}

