/* masa booking simulator — internal dev tool.
   Follows the flask skin's tokens (gray ground, single mango accent, flat surfaces,
   NO card shadows per the Jul 11 FLAT ruling) but stays system-font: this never
   ships to a customer, so it doesn't earn the self-hosted font payload.
   Zero blur layers — see the blur-budget rule in masa/CLAUDE.md. */

:root {
  --ground: #191919;
  --layer-1: #1f1f1f;
  --layer-2: #262626;
  --ink: #f2f0ed;
  --ink-dim: #a3a09b;
  --line: rgba(255, 255, 255, 0.10);
  --mango: #ff8c42;
  --them: #2c2c2e;
  --us: #2a5bd7;
  --r: 12px;
  --pad: 1rem;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--ground);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* ── chrome ─────────────────────────────────────────────── */

.bar {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem var(--pad);
  border-bottom: 1px solid var(--line);
}
.mark { font-weight: 600; letter-spacing: -0.01em; }
.what { color: var(--ink-dim); font-size: 0.85rem; }
.ghost {
  margin-left: auto;
  background: transparent; color: var(--ink-dim);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.35rem 0.8rem; font: inherit; font-size: 0.8rem; cursor: pointer;
}
.ghost:hover { color: var(--ink); border-color: var(--ink-dim); }

/* ── layout ─────────────────────────────────────────────── */

.wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--pad);
  padding: var(--pad);
  max-width: 60rem;
  margin: 0 auto;
}
@media (min-width: 56rem) {
  .wrap { grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); align-items: start; }
}

/* ── the phone ──────────────────────────────────────────── */

.phone {
  background: var(--layer-1);
  border: 1px solid var(--line);
  border-radius: var(--r);
  display: flex; flex-direction: column;
  min-height: 26rem;
  max-height: 78vh;
  overflow: hidden;
}

.thread {
  list-style: none; margin: 0; padding: var(--pad);
  display: flex; flex-direction: column; gap: 0.4rem;
  overflow-y: auto; flex: 1;
}

.thread .note,
.thread .sys {
  align-self: center; text-align: center;
  color: var(--ink-dim); font-size: 0.78rem;
  max-width: 24rem; padding: 0.35rem 0;
}

.msg {
  max-width: 78%;
  padding: 0.5rem 0.8rem;
  border-radius: 18px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg.them { align-self: flex-start; background: var(--them); border-bottom-left-radius: 5px; }
.msg.us   { align-self: flex-end;  background: var(--us);   border-bottom-right-radius: 5px; }
.msg a { color: inherit; }

.msg.pending { opacity: 0.55; }

.composer {
  display: flex; gap: 0.5rem;
  padding: 0.7rem var(--pad);
  border-top: 1px solid var(--line);
}
/* Container-scoped + type-agnostic so any future field inherits this
   automatically — the phone-field lesson from Jul 8. */
.composer .composer__field {
  resize: none;
  overflow-y: auto;
  max-height: 8.5em;
  font-family: inherit;
  flex: 1; min-width: 0;
  background: var(--layer-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.55rem 0.9rem; font: inherit;
}
.composer .composer__field::placeholder { color: var(--ink-dim); }
.composer .composer__field:focus-visible { outline: 2px solid var(--mango); outline-offset: 1px; }

.composer .composer__send {
  background: var(--mango); color: #1a1a1a;
  border: 0; border-radius: 999px;
  padding: 0.55rem 1.1rem; font: inherit; font-weight: 600; cursor: pointer;
}
.composer .composer__send[disabled] { opacity: 0.5; cursor: default; }

/* ── the trace ──────────────────────────────────────────── */

.trace {
  background: var(--layer-1);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: var(--pad);
}
.trace h2 { margin: 0 0 0.6rem; font-size: 0.8rem; text-transform: lowercase; color: var(--ink-dim); font-weight: 600; }

.events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.events .empty { color: var(--ink-dim); font-size: 0.85rem; }

.ev {
  display: flex; gap: 0.6rem; align-items: baseline;
  font-size: 0.82rem;
  padding: 0.45rem 0.6rem;
  background: var(--layer-2);
  border-radius: 8px;
  border-left: 3px solid var(--line);
  /* single-sided border → square corners on that edge (house rule) */
  border-top-left-radius: 0; border-bottom-left-radius: 0;
}
.ev.hold     { border-left-color: var(--mango); }
.ev.pay      { border-left-color: #57b894; }
.ev.handoff  { border-left-color: #d9534f; }
.ev.err      { border-left-color: #d9534f; }

.ev code { font: 500 0.78rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink); }
.ev .detail { color: var(--ink-dim); }

@media (prefers-reduced-motion: no-preference) {
  .msg { animation: rise 160ms ease-out; }
  @keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}
