/* Brand tokens and the bot mark match showmethebots.com. */
@font-face {
  font-family: "Inter Display";
  src: url("fonts/inter-display-black.woff2") format("woff2");
  font-weight: 900;
  font-display: swap;
}

:root {
  --night: #0d0d12;
  --night-2: #1a1a24;
  --night-3: #2a2a38;
  --hot: #ff4d1c;
  --hot-text: #b5330c;
  --volt: #c8f135;
  --ink: #0d0d12;
  --muted: #555362;
  --line: #ded6c4;
  --paper: #ffffff;
  --paper-2: #fbf8f1;
  --paper-3: #f2ecdf;
  --accent: var(--hot-text);
  --good: #1f7a4d;
  --good-bg: #e8f5ee;
  --warn: #8a5a00;
  --warn-bg: #fff6e0;
  --bad: #a23131;
  --bad-bg: #fdecec;
  --radius: 12px;
  --display: "Inter Display", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper-2);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
input, textarea { font: inherit; color: inherit; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--night); color: #fff; padding: 12px 20px; border-bottom: 1px solid var(--night-3);
}
.brand { display: flex; align-items: center; gap: 12px; }
.wordmark { font-family: var(--display); font-weight: 900; font-size: 1.1rem; letter-spacing: -0.01em; text-transform: uppercase; white-space: nowrap; }
.divider { opacity: .4; font-weight: 400; }
.demo-name { font-weight: 500; opacity: .9; }

/* The Missouri-shaped bot: the body is an SVG background, the antenna stem
   and light are the pseudo-elements, set on the state's northern border. */
.bot {
  position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  width: 36px; height: 32px; padding-bottom: 6px; margin-top: 6px;
  background: url("smtb-body.svg") center / contain no-repeat;
}
.bot::before {
  content: ""; position: absolute; left: 44.6%; top: -7px; width: 2px; height: 7px;
  background: var(--hot); transform: translateX(-50%);
}
.bot::after {
  content: ""; position: absolute; left: 44.6%; top: -12px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--volt); transform: translateX(-50%); animation: ping 2.4s ease-in-out infinite;
}
.bot i { display: block; width: 4px; height: 8px; border-radius: 2px; background: var(--ink); animation: blink 5s infinite; }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.1); } }
@keyframes ping { 0%, 100% { box-shadow: 0 0 0 0 rgba(200, 241, 53, 0.7); } 50% { box-shadow: 0 0 0 6px rgba(200, 241, 53, 0); } }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.price-book-link {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 12px; border-radius: 999px;
  background: var(--night-2); color: #fff; text-decoration: none; border: 1px solid var(--night-3);
}
.price-book-link:hover { border-color: var(--volt); }
.price-book-link[hidden] { display: none; }
.price-book-link .dot { width: 8px; height: 8px; border-radius: 50%; }
.price-book-link.sheet .dot { background: #4ade80; }
.price-book-link.saved .dot { background: #f5b14c; }
.mode { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 12px; border-radius: 999px; background: var(--night-2); cursor: help; }
.mode .dot { width: 8px; height: 8px; border-radius: 50%; background: #9aa3b5; }
.mode.live .dot { background: #4ade80; box-shadow: 0 0 8px #4ade80; }
.mode.offline .dot { background: var(--volt); }

.intro {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  max-width: 1500px; margin: 0 auto; padding: 16px 20px 4px; color: var(--muted);
}
.intro strong { color: var(--ink); }
.steps { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: step; font-size: 13px; }
.steps li { counter-increment: step; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px 3px 4px; }
.steps li::before {
  content: counter(step); display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 6px;
  border-radius: 50%; background: var(--night); color: var(--volt); font-weight: 700; font-size: 12px;
}

.layout {
  display: grid; grid-template-columns: minmax(240px, 300px) minmax(280px, 1fr) minmax(420px, 1.5fr);
  gap: 16px; max-width: 1500px; margin: 0 auto; padding: 16px 20px; align-items: start;
}
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.meta { font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); padding: 40px 20px; text-align: center; }

.email-list { list-style: none; margin: 0; padding: 6px; }
.email-item {
  display: grid; gap: 2px; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px;
  padding: 10px; color: inherit;
}
.email-item:hover { background: var(--paper-2); }
.email-item.selected { background: var(--paper-3); box-shadow: inset 3px 0 0 var(--hot); }
.email-item .row { display: flex; justify-content: space-between; gap: 8px; }
.email-item .from { font-weight: 600; }
.email-item .date { font-size: 12px; color: var(--muted); white-space: nowrap; }
.email-item .subject { font-size: 14px; }
.email-item .preview { font-size: 13px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.badge { justify-self: start; margin-top: 4px; font-size: 12px; padding: 1px 8px; border-radius: 999px; }
.badge.done { background: var(--good-bg); color: var(--good); }

.email-view { padding: 16px; }
.email-headers { display: grid; gap: 4px; font-size: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.email-headers span { display: inline-block; width: 64px; color: var(--muted); }
.email-body { white-space: pre-wrap; font: 14px/1.6 ui-monospace, "SF Mono", Menlo, monospace; margin: 14px 0 18px; overflow-wrap: anywhere; }

.primary {
  background: var(--hot); color: var(--ink); border: 2px solid var(--ink); border-radius: 8px; padding: 9px 18px; font-weight: 800;
  box-shadow: 3px 3px 0 var(--ink); transition: transform .12s ease, box-shadow .12s ease;
}
.primary:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.primary:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.primary:disabled { opacity: .45; box-shadow: none; }
.primary:focus-visible, .link-btn:focus-visible { outline: 3px solid var(--night); outline-offset: 3px; }
.link-btn { justify-self: start; background: none; border: 0; color: var(--accent); font-weight: 600; padding: 4px 0; }
.icon-btn { background: none; border: 0; color: var(--muted); font-size: 18px; line-height: 1; padding: 4px 6px; border-radius: 6px; }
.icon-btn:hover { background: var(--bad-bg); color: var(--bad); }

.paste { display: grid; gap: 10px; }
.paste textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px; resize: vertical; }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; font-size: 14px; }

.draft-view { padding: 16px; display: grid; gap: 14px; }
.draft-view.empty { display: block; }
.working { display: inline-flex; align-items: center; gap: 10px; }
.spinner { width: 18px; height: 18px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.flags { background: var(--warn-bg); border-radius: 8px; padding: 10px 14px; color: #5c3d00; font-size: 14px; }
.flags-title { font-weight: 700; margin-bottom: 2px; }
.flags ul { margin: 0; padding-left: 18px; }
.flags.clear { background: var(--good-bg); color: var(--good); }
.summary { font-weight: 600; }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.field { display: grid; gap: 2px; font-size: 12px; color: var(--muted); }
.field.wide { grid-column: 1 / -1; }
.field input, .field textarea, .lines input {
  width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-size: 14px; background: var(--paper); min-width: 0;
}
.field input:focus, .field textarea:focus, .lines input:focus { outline: 2px solid #ffc9b8; border-color: var(--accent); }

.table-wrap { overflow-x: auto; }
.lines { width: 100%; border-collapse: collapse; font-size: 14px; }
.lines th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.lines td { padding: 8px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.lines .num { text-align: right; }
.lines input.desc { min-width: 180px; }
.lines input.qty { width: 64px; text-align: right; }
.lines input.price { width: 92px; text-align: right; }
.lines .unit { display: block; font-size: 12px; color: var(--muted); }
.lines .amount { padding-top: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lines tr.missing input.price { border-color: #e0a100; background: var(--warn-bg); }
.chip { display: inline-block; margin-top: 4px; font-size: 11px; padding: 1px 8px; border-radius: 999px; }
.chip-book { background: var(--paper-3); color: var(--accent); }
a.chip { text-decoration: none; }
a.chip-book:hover { text-decoration: underline; }
.chip-email { background: #efe9fb; color: #5b3aa6; }
.chip-unknown { background: var(--warn-bg); color: var(--warn); font-weight: 700; }
.chip-owner { background: var(--good-bg); color: var(--good); }

.totals { justify-self: end; width: min(100%, 280px); font-variant-numeric: tabular-nums; }
.totals div { display: flex; justify-content: space-between; padding: 2px 0; }
.totals .grand { border-top: 2px solid var(--ink); margin-top: 4px; padding-top: 6px; font-weight: 700; font-size: 18px; }
.totals .pending { color: var(--warn); font-size: 13px; }

.approve-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.blockers { color: var(--warn); font-size: 14px; }
.success { background: var(--good-bg); color: var(--good); border-radius: 8px; padding: 12px 14px; }
.success a { font-weight: 700; margin-left: 6px; }
.error { background: var(--bad-bg); color: var(--bad); border-radius: 8px; padding: 10px 12px; margin: 0; }

.foot { text-align: center; color: #b7b7c6; font-size: 12px; padding: 20px; margin-top: 12px; background: var(--night); }
.foot p { margin: 0; }
.foot .slogan { margin-bottom: 6px; font-family: var(--display); font-weight: 900; font-size: 1rem; color: var(--volt); }

@media (max-width: 1200px) {
  .layout { grid-template-columns: minmax(220px, 280px) 1fr; }
  .draft { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .wordmark { font-size: .95rem; }
  .layout { grid-template-columns: 1fr; padding: 12px 16px; }
  .intro { padding: 12px 16px 0; }
  .fields { grid-template-columns: 1fr; }
  .steps { flex-wrap: wrap; }
}

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