@property --skin {
  syntax: '<color>';
  inherits: true;
  initial-value: #C6F24E;
}

:root {
  --ink: #17102B;
  --ink-0: #0E0920;
  --ink-2: #221A3D;
  --ink-3: #32285A;
  --paper: #F6F3FF;
  --paper-dim: #B9B1DA;
  --skin: #C6F24E;
  --good: #7CF0B2;
  --warn: #FFB14A;
  --display: 'Funnel Display', 'Avenir Next', 'Segoe UI', sans-serif;
  --body: 'Funnel Sans', 'Avenir Next', 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  transition: --skin 0.7s ease;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ink-0);
  color: var(--paper);
  font-family: var(--body);
  font-size: 16.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { font-family: var(--display); margin: 0; letter-spacing: -0.025em; }
p { margin: 0; color: var(--paper-dim); }

:focus-visible { outline: 3px solid var(--skin); outline-offset: 3px; border-radius: 6px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }

/* ---------- rail ---------- */

.rail {
  flex: 1 1 250px;
  max-width: 280px;
  background: var(--ink);
  border-right: 1px solid var(--ink-3);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  text-decoration: none;
  color: var(--paper);
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--ink-2);
  display: grid;
  place-items: center;
}

.brand-mark::before {
  content: '';
  width: 24px;
  height: 24px;
  background: var(--skin);
  -webkit-mask: url('../assets/brand/mark-white.svg') center / contain no-repeat;
  mask: url('../assets/brand/mark-white.svg') center / contain no-repeat;
}

.rail-nav { display: grid; gap: 4px; }

.rail-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 12px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--paper-dim);
  font-weight: 600;
}

.rail-nav a:hover { background: var(--ink-2); color: var(--paper); }

.rail-nav a.is-active { background: var(--skin); color: var(--ink); }

.rail-foot { margin-top: auto; display: grid; gap: 12px; }

.parker-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  align-items: center;
  background: var(--ink-2);
  border-radius: 16px;
  padding: 10px 12px 10px 8px;
}

.parker-card img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  transition: filter 0.7s ease, transform 0.4s ease;
}

.parker-card b { display: block; font-family: var(--display); font-size: 17px; }
.parker-card span { display: block; font-size: 13.5px; line-height: 1.3; color: var(--paper-dim); }

.rail-back {
  text-align: center;
  padding: 11px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--paper-dim);
  border: 1.5px solid var(--ink-3);
  font-weight: 600;
  font-size: 15px;
}

.rail-back:hover { color: var(--paper); border-color: var(--paper-dim); }

/* ---------- main ---------- */

.main {
  flex: 999 1 560px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.preview-bar {
  background: repeating-linear-gradient(-45deg, #2B2140 0 14px, #251B39 14px 28px);
  color: var(--paper);
  font-size: 14.5px;
  padding: 9px 26px;
  border-bottom: 1px solid var(--ink-3);
}

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 26px 6px;
}

.bar h1 { font-size: 34px; font-weight: 800; }

.bar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.pill {
  display: grid;
  background: var(--ink);
  border: 1.5px solid var(--ink-3);
  border-radius: 14px;
  padding: 6px 14px;
  line-height: 1.2;
}

.pill span { font-size: 12.5px; color: var(--paper-dim); }
.pill b { font-family: var(--mono); font-size: 15px; font-weight: 500; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 13px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 16px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
}

.btn:active { transform: translateY(2px); }
.btn-solid { background: var(--skin); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--paper); border-color: var(--paper-dim); }
.btn-ghost:hover { border-color: var(--paper); }
.btn-quiet { background: var(--ink-2); color: var(--paper-dim); }
.btn-quiet:hover { color: var(--paper); }
.btn-wide { width: 100%; }

.link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--skin);
  text-decoration: underline;
  cursor: pointer;
}

.view { display: none; padding: 16px 26px 40px; gap: 16px; }
.view.is-active { display: grid; }

/* ---------- chat ---------- */

.chat { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }

.chat-main {
  flex: 999 1 420px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--ink);
  border: 1px solid var(--ink-3);
  border-radius: 22px;
  padding: 16px;
  min-height: 560px;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  font-size: 13.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 9px;
  border: 1.5px solid;
}

.chip-good { color: var(--good); border-color: #2c6b52; background: #12261f; }
.chip-warn { color: var(--warn); border-color: #7a5320; background: #2a1e10; }

.msgs {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 2px;
  overflow-y: auto;
  max-height: 52vh;
}

.msg { max-width: 82%; display: grid; gap: 5px; }

.msg p {
  padding: 12px 16px;
  border-radius: 18px;
  color: var(--paper);
  background: var(--ink-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg small { font-family: var(--mono); font-size: 12px; color: var(--paper-dim); padding: 0 6px; }

.msg.me { align-self: flex-end; }
.msg.me p { background: var(--c, var(--skin)); color: var(--ink); border-bottom-right-radius: 6px; font-weight: 500; }
.msg.me small { text-align: right; }
.msg.ai p { border-bottom-left-radius: 6px; }

.msgs-empty {
  margin: auto;
  text-align: center;
  display: grid;
  gap: 6px;
  justify-items: center;
  max-width: 340px;
}

.msgs-empty img { width: 132px; height: 132px; object-fit: contain; }
.msgs-empty b { font-family: var(--display); font-size: 22px; letter-spacing: -0.02em; }

.composer {
  background: var(--ink-0);
  border: 1.5px solid var(--ink-3);
  border-radius: 18px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.composer:focus-within { border-color: var(--skin); }

.composer textarea {
  width: 100%;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--paper);
  font: inherit;
  padding: 8px;
  min-height: 46px;
  max-height: 160px;
}

.composer textarea::placeholder { color: #8a82ad; }

.composer-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

.select select {
  appearance: none;
  background: var(--ink-2);
  color: var(--paper);
  border: 0;
  border-radius: 11px;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  min-height: 44px;
  padding: 0 16px;
  cursor: pointer;
}

.chat-side { flex: 1 1 290px; min-width: 0; display: grid; gap: 12px; }

.receipt {
  font-family: var(--mono);
  font-size: 13.5px;
  background: var(--ink);
  border: 1.5px solid var(--ink-3);
  border-radius: 14px;
  overflow: hidden;
}

.receipt-head { padding: 9px 14px; font-size: 12.5px; font-weight: 700; color: var(--ink); background: var(--skin); }
.receipt-warn .receipt-head { background: var(--warn); }

.receipt-row {
  display: grid;
  grid-template-columns: 84px 1fr;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-top: 1px dashed var(--ink-3);
}

.receipt-row span { color: var(--paper-dim); }
.receipt-row b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.redact {
  display: block;
  height: 14px;
  border-radius: 3px;
  background: repeating-linear-gradient(90deg, var(--paper) 0 9px, transparent 9px 11px);
  opacity: 0.9;
}

.hint { font-size: 14px; }

/* ---------- cards ---------- */

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }

.card {
  background: var(--ink);
  border: 1px solid var(--ink-3);
  border-radius: 22px;
  padding: 22px;
  display: grid;
  gap: 14px;
  align-content: start;
}

.card h2 { font-size: 24px; font-weight: 700; }

.sizes { display: flex; flex-wrap: wrap; gap: 8px; }

.size {
  min-height: 46px;
  padding: 0 16px;
  border-radius: 12px;
  border: 2px solid var(--ink-3);
  background: transparent;
  color: var(--paper);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.size.is-on { border-color: var(--skin); background: var(--skin); color: var(--ink); }

.ticket {
  display: grid;
  grid-template-columns: 1fr auto;
  background: var(--paper);
  color: var(--ink);
  border-radius: 16px;
  overflow: hidden;
}

.ticket-main { padding: 16px 18px; display: grid; gap: 2px; }
.ticket-main b { font-family: var(--display); font-weight: 800; font-size: 23px; letter-spacing: -0.02em; }
.ticket-main span { font-size: 15px; color: #4a4266; }
.ticket-main strong { font-family: var(--mono); font-weight: 700; color: var(--ink); }

.ticket-stub {
  border-left: 3px dashed var(--ink);
  padding: 16px 18px;
  display: grid;
  place-items: center;
  background: var(--skin);
  font-family: var(--display);
  font-weight: 800;
  font-size: 16px;
  text-align: center;
  line-height: 1.1;
}

.lines { margin: 0; display: grid; }

.lines div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ink-3);
}

.lines div:last-child { border-bottom: 0; }
.lines dt { color: var(--paper-dim); }
.lines dd { margin: 0; font-weight: 600; text-align: right; }
.lines.mono dd { font-family: var(--mono); font-weight: 400; font-size: 14.5px; overflow-wrap: anywhere; }
.lines.mono a { color: var(--skin); }

.field { display: grid; gap: 6px; }
.field span { font-size: 14.5px; font-weight: 600; }

.field input {
  min-height: 48px;
  border-radius: 12px;
  border: 1.5px solid var(--ink-3);
  background: var(--ink-0);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 15px;
  padding: 0 14px;
}

.field input:focus { outline: 0; border-color: var(--skin); }

.empty {
  border: 1.5px dashed var(--ink-3);
  border-radius: 16px;
  padding: 26px;
  display: grid;
  gap: 4px;
  text-align: center;
}

.empty b { font-family: var(--display); font-size: 19px; }
.empty span { color: var(--paper-dim); font-size: 15px; }

/* ---------- burn ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }

.stat {
  background: var(--ink);
  border: 1px solid var(--ink-3);
  border-radius: 18px;
  padding: 16px 18px;
  display: grid;
  gap: 2px;
}

.stat span { font-size: 14px; color: var(--paper-dim); }
.stat b { font-family: var(--display); font-weight: 800; font-size: 38px; letter-spacing: -0.03em; line-height: 1.05; }

.flow {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  counter-reset: flow;
}

.flow li {
  counter-increment: flow;
  background: var(--ink-2);
  border-radius: 14px;
  padding: 14px;
  font-size: 15px;
  line-height: 1.3;
  display: grid;
  gap: 8px;
  align-content: start;
}

.flow li::before {
  content: counter(flow);
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--skin);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 800;
  font-size: 15px;
}

.flow li:last-child { background: var(--skin); color: var(--ink); font-weight: 600; }
.flow li:last-child::before { background: var(--ink); color: var(--skin); }

.burns { list-style: none; margin: 0; padding: 0; display: grid; }

.burns li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--ink-3);
}

.burns li:last-child { border-bottom: 0; }
.burns b { font-family: var(--mono); font-weight: 500; font-size: 15px; }
.burns span { display: block; font-size: 13.5px; color: var(--paper-dim); }
.burns a { font-family: var(--mono); font-size: 13.5px; color: var(--skin); padding: 10px 0; }

/* ---------- exposure ---------- */

.toggle {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--ink-3);
  cursor: pointer;
}

.toggle:last-child { border-bottom: 0; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.track {
  width: 50px;
  height: 30px;
  border-radius: 999px;
  background: var(--ink-3);
  position: relative;
  transition: background 0.2s ease;
  margin-top: 2px;
}

.track::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--paper);
  transition: transform 0.2s ease;
}

.toggle input:checked + .track { background: var(--skin); }
.toggle input:checked + .track::after { transform: translateX(20px); background: var(--ink); }
.toggle input:focus-visible + .track { outline: 3px solid var(--skin); outline-offset: 3px; }
.toggle.is-soon { cursor: not-allowed; opacity: 0.6; }

.toggle-text b { display: block; font-weight: 600; }
.toggle-text small { display: block; font-size: 14px; color: var(--paper-dim); line-height: 1.4; }

.meter { height: 14px; border-radius: 999px; background: var(--ink-3); overflow: hidden; }
.meter i { display: block; height: 100%; width: 50%; background: var(--good); border-radius: 999px; transition: width 0.4s ease; }
.meter-label { font-family: var(--display); font-weight: 700; font-size: 19px; color: var(--paper); }

.seen { list-style: none; margin: 0; padding: 0; display: grid; }

.seen li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--ink-3);
  font-size: 15.5px;
}

.seen li:last-child { border-bottom: 0; }
.seen em { font-style: normal; font-size: 13.5px; font-weight: 600; padding: 4px 10px; border-radius: 8px; white-space: nowrap; }
.seen .hid em { color: var(--good); background: #12261f; }
.seen .vis em { color: var(--warn); background: #2a1e10; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 30px);
  background: var(--paper);
  color: var(--ink);
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: calc(100vw - 32px);
  z-index: 30;
}

.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
  .rail { max-width: none; flex-basis: 100%; padding: 14px 16px; gap: 12px; border-right: 0; border-bottom: 1px solid var(--ink-3); }
  .rail-nav { display: flex; overflow-x: auto; gap: 6px; }
  .rail-nav a { white-space: nowrap; }
  .rail-foot { display: none; }
  .bar, .view, .preview-bar { padding-left: 16px; padding-right: 16px; }
  .msg { max-width: 94%; }
}

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