/* Potioneer — iPad first. Targets ≥ 44pt; no hover-only affordances. */
:root {
  --bg: #faf7f2; --ink: #1d1a16; --muted: #6b645b; --line: #e3ddd3;
  --accent: #6b3fa0; --ok: #2f7d4f; --bad: #b3261e; --card: #ffffff;
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #16131a; --ink: #eee8f5; --muted: #a59cb0; --line: #2d2735; --card: #1f1a25; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
a { color: var(--accent); }
button, input { font: inherit; min-height: 44px; }
button { padding: 0 18px; border-radius: 10px; border: 1px solid var(--accent); background: var(--accent); color: #fff; }
button.quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.muted { color: var(--muted); }
.door { max-width: 420px; margin: 8vh auto; padding: 0 16px; }
.door form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field input { padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); }
.flash { padding: 10px 14px; border-radius: 10px; margin: 0 0 12px; }
.flash.info { background: color-mix(in srgb, var(--ok) 15%, transparent); }
.flash.error { background: color-mix(in srgb, var(--bad) 15%, transparent); }
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 18px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.topbar nav { display: flex; gap: 16px; flex: 1; }
.topbar a, .topbar nav a { min-height: 44px; display: inline-flex; align-items: center; }
.brand { font-weight: 700; text-decoration: none; }
.body { flex: 1; display: flex; min-height: 0; }
main { flex: 1; padding: 16px 20px; }
.chat-rail { width: 360px; flex: none; border-left: 1px solid var(--line); background: var(--card);
  position: sticky; top: 0; height: 100vh; }
.chat-rail > div, .chat { height: 100%; }
.chat { display: flex; flex-direction: column; }
.chat-toggle { display: none; }
.chat-body { display: flex; flex-direction: column; height: 100%; padding: 16px; gap: 10px; min-height: 0; }
.chat-body h2 { margin: 0; }
.msgs { list-style: none; margin: 0; padding: 0; flex: 1; overflow-y: auto; display: grid; gap: 8px; align-content: start; }
.msg { padding: 10px 12px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 92%; }
.msg.person { background: var(--accent); color: #fff; justify-self: end; border-bottom-right-radius: 4px; }
.msg.crew { background: var(--chip); justify-self: start; border-bottom-left-radius: 4px; }
.msg.pending { opacity: .8; }
.chat-error { margin: 0; color: var(--bad); font-size: 15px; }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.chat-form textarea { font: inherit; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); resize: none; min-height: 48px; }
.chat-form button { pointer-events: auto; opacity: 1; }
.chat-form button:disabled { opacity: .45; }
@media (orientation: portrait), (max-width: 900px) {
  .chat-rail { width: 44px; }
  .chat-toggle { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 44px; height: 100%;
    padding: 12px 0; border: 0; border-radius: 0; background: transparent; color: var(--ink); }
  .chat-toggle span:first-child { writing-mode: vertical-rl; font-size: 15px; font-weight: 700; }
  .chat-toggle .badge { writing-mode: horizontal-tb; min-width: 22px; height: 22px; border-radius: 11px;
    background: var(--bad); color: #fff; font-size: 13px; display: grid; place-items: center; }
  .chat-body { display: none; }
  .chat.open .chat-body { display: flex; position: fixed; top: 0; right: 44px; bottom: 0; width: min(380px, calc(100vw - 60px));
    background: var(--card); border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(0,0,0,.25); z-index: 10; }
}
.devices { list-style: none; padding: 0; display: grid; gap: 10px; }
.devices li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.devices li.revoked { opacity: .55; }
.devices li button { margin-left: auto; }
.tag { font-size: 13px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }

/* --- The Pass (M1) ------------------------------------------------------- */
:root { --tee: #1f2a44; --tee-ink: #f2ebdd; --tee-accent: #e2b04a; --chip: #efe9f7; }
@media (prefers-color-scheme: dark) { :root { --chip: #2b2335; } }
.pass-head h1 { margin: 0 0 4px; }
.pass-head p { margin: 0 0 14px; }
.segments, .views { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.segment { display: grid; min-height: 56px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--ink); text-decoration: none; }
.segment small { color: var(--muted); font-size: 13px; }
.segment.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.view { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; border-radius: 999px;
  color: var(--ink); text-decoration: none; border: 1px solid var(--line); }
.view.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.view .n { font-size: 13px; opacity: .75; }
.undo-strip { display: grid; gap: 8px; margin: 0 0 12px; }
.undo { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--ok) 14%, var(--card)); }
.undo span:first-child { flex: 1; }
.countdown { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 2.5em; text-align: right; }
.note { padding: 10px 14px; border-radius: 10px; background: var(--chip); }
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: grid; gap: 10px; align-content: start; }
.tee { margin: 0; padding: 22px 18px; border-radius: 12px; background: var(--tee); color: var(--tee-ink);
  text-align: center; display: grid; gap: 6px; min-height: 210px; align-content: center; }
.tee .kicker { color: var(--tee-accent); text-transform: uppercase; letter-spacing: .14em; font-size: 13px; font-weight: 700; }
.tee .label { text-transform: uppercase; letter-spacing: .08em; font-size: 14px; opacity: .8; }
.tee .entry { font-size: 22px; font-weight: 700; }
.tee .warning { text-transform: uppercase; font-weight: 800; font-size: 16px; border: 2px solid var(--tee-accent);
  border-radius: 6px; padding: 4px 8px; justify-self: center; }
.tee .warning::before { content: "⚠ "; color: var(--tee-accent); }
.tee .punchline { color: var(--tee-accent); font-style: italic; font-size: 19px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rating { font-weight: 800; min-width: 44px; text-align: center; padding: 4px 10px; border-radius: 999px; background: var(--chip); }
.rating.high { background: color-mix(in srgb, var(--ok) 25%, var(--card)); }
.rating.low { background: color-mix(in srgb, var(--bad) 18%, var(--card)); }
.voice { color: var(--muted); text-transform: capitalize; }
.verdict-ship { border-color: var(--ok); color: var(--ok); }
.why summary { min-height: 44px; display: flex; align-items: center; color: var(--accent); cursor: pointer; }
.rationale { white-space: pre-line; margin: 4px 0 8px; }
.scores { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 12px; margin: 0; font-size: 14px; }
.scores div { display: flex; justify-content: space-between; }
.scores dt { color: var(--muted); } .scores dd { margin: 0; font-weight: 700; }
.verbs { display: flex; flex-wrap: wrap; gap: 8px; }
.verb.approve { background: var(--ok); border-color: var(--ok); }
button.danger { background: var(--bad); border-color: var(--bad); }
/* Verbs work only on a live, freshly loaded socket (SPEC §8.1). */
.verb { pointer-events: none; opacity: .45; }
.phx-connected .verb { pointer-events: auto; opacity: 1; }
.sheet { display: grid; gap: 10px; padding: 12px; border-radius: 12px; background: var(--chip); }
.sheet-title { margin: 0; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked), .chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.sheet textarea { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); min-height: 88px; }
.sheet-actions { display: flex; gap: 8px; }
.decided { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.decided .notes { flex-basis: 100%; margin: 0; font-style: italic; }
.empty { padding: 24px 0; }

/* Pictures on the Pass */
.shot { margin: 0; display: grid; gap: 8px; }
.shot > a img { width: 100%; height: auto; max-height: 52vh; object-fit: contain; border-radius: 12px; display: block; background: #111; }
.thumbs { display: flex; gap: 8px; }
.thumb { display: grid; gap: 2px; justify-items: center; padding: 4px; min-height: 44px; background: transparent;
  color: var(--ink); border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.thumb img { width: 56px; height: 67px; object-fit: cover; border-radius: 6px; }
.also { color: var(--muted); font-size: 15px; text-align: center; }
.tag.warn { border-color: var(--bad); color: var(--bad); }

/* Concept cards, house style (white shirts) */
.tee { background: #fff; color: #1b1b1b; border: 1px solid var(--line); min-height: 260px; gap: 14px; padding: 26px 20px; }
.tee .statement { font-weight: 900; font-size: 26px; line-height: 1.1; text-transform: uppercase; letter-spacing: .01em; }
.tee .punchline { color: #8c3b12; font-style: normal; font-weight: 700; font-size: 20px; }
.tee .brief { display: grid; gap: 6px; border: 2px dashed #c9bfb2; border-radius: 12px; padding: 12px 14px;
  font-size: 15px; line-height: 1.4; color: #3b352e; text-align: left; }
.tee .brief.unfit { border-color: var(--bad); }
.tee .brief-label { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: #8c3b12; font-weight: 700; }
.tee .brief-warn { color: var(--bad); font-size: 13px; }
.tag.budget { font-variant-numeric: tabular-nums; }
.character { margin: 0 0 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 14px; }
.character summary { min-height: 44px; display: flex; align-items: center; font-weight: 700; cursor: pointer; }
.character img { width: 100%; height: auto; max-height: 300px; object-fit: contain; background: #fff; border-radius: 10px; }

/* Ideas */
.ideas { max-width: 760px; }
.idea-form { display: grid; gap: 14px; padding: 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); margin-bottom: 24px; }
.idea-form textarea, .idea-form input[name=breed] { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.photos { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.photo-pick { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px dashed var(--line); cursor: pointer; }
.photo-pick input[type=file] { max-width: 200px; }
.photo-entry { display: grid; gap: 6px; width: 120px; }
.photo-entry img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; }
.idea-list { list-style: none; padding: 0; display: grid; gap: 12px; }
.idea { padding: 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); display: grid; gap: 8px; }
.idea-head { display: flex; gap: 10px; align-items: center; }
.idea-body { margin: 0; white-space: pre-wrap; }
.state-delivered { border-color: var(--ok); color: var(--ok); }
.yours { border-color: var(--accent); color: var(--accent); }

/* The connection banner (root layout; shown by app.js when the socket is down). */
.connection { position: fixed; top: 0; left: 0; right: 0; z-index: 50; display: flex; gap: 12px;
  align-items: center; justify-content: center; padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top)); background: var(--bad); color: #fff; font-weight: 600; }
.connection[hidden] { display: none; }
.connection button { background: #fff; color: var(--bad); border-color: #fff; }

/* Production (M3): each chosen shirt as it will sell. */
.production h1 { margin: 8px 0 4px; }
.production .lede { color: var(--muted); margin: 0 0 16px; }
.prod { display: flex; gap: 16px; padding: 14px; margin: 0 0 14px; border: 1px solid var(--line);
  border-radius: 14px; background: var(--card); }
.prod-pics { flex: none; width: 240px; }
.prod-pics img { width: 100%; height: auto; border-radius: 10px; background: #fff; display: block; }
.prod-body { flex: 1; min-width: 0; }
.prod-body h2 { margin: 0 0 4px; font-size: 1.2rem; }
.prod-body .words { margin: 0 0 6px; }
.prod-body .garment { color: var(--muted); margin: 0 0 6px; }
.prod .prices table { border-collapse: collapse; margin-top: 6px; }
.prod .prices td { padding: 2px 12px 2px 0; }
.prod-status { margin: 10px 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.badge { padding: 4px 10px; border-radius: 999px; font-size: .85rem; border: 1px solid var(--line); }
.b-in_store { background: color-mix(in srgb, var(--ok) 18%, transparent); border-color: var(--ok); }
.b-failed, .b-unknown { background: color-mix(in srgb, var(--bad) 15%, transparent); border-color: var(--bad); }
.b-to_decide { border-color: var(--accent); }
.prod .sheet textarea { width: 100%; font: inherit; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
@media (max-width: 700px) { .prod { flex-direction: column; } .prod-pics { width: 100%; } }

/* Marketing and Sales (M4). */
.marketing h2, .sales h2 { margin: 22px 0 8px; }
.post { display: flex; gap: 14px; padding: 12px; margin: 0 0 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.post-pic { flex: none; width: 160px; }
.post-pic img { width: 100%; border-radius: 10px; background: #fff; }
.post-body { flex: 1; min-width: 0; }
.post-body h3 { margin: 0 0 6px; }
.post-text { white-space: pre-wrap; font: inherit; margin: 0 0 8px; padding: 10px; border-radius: 10px; background: var(--bg); }
.post .ready { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.post .posted { display: flex; gap: 6px; flex: 1 1 260px; }
.post .posted input { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.groups, .sales-table { width: 100%; border-collapse: collapse; }
.groups td, .groups th, .sales-table td, .sales-table th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.num { text-align: right !important; }
.small { font-size: .85rem; }
.muted { color: var(--muted); }
.s-approved, .s-posting { border-color: var(--ok); }
.s-declined { border-color: var(--bad); }
.group-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.group-form label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; }
.group-form input, .group-form select, .group-form textarea { font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.tiles { display: flex; gap: 12px; flex-wrap: wrap; }
.tile { flex: 1 1 120px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); display: flex; flex-direction: column; }
.tile .n { font-size: 1.6rem; font-weight: 700; }
.tile .l { color: var(--muted); }
@media (max-width: 700px) { .post { flex-direction: column; } .post-pic { width: 100%; } }

.door button.password-toggle { background: transparent; color: #673ca0; border: 1px solid currentColor; }
