:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #111827;
  --accent-text: #ffffff;
  --good: #166534;
  --good-bg: #dcfce7;
  --bad: #991b1b;
  --bad-bg: #fee2e2;
  --warn: #92400e;
  --warn-bg: #fef3c7;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 18px 14px;
  background: rgba(255,255,255,.94); border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}
.topbar h1 { margin: 0; font-size: 20px; }
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.status-chip, .decision-badge {
  display: inline-flex; align-items: center; border-radius: 999px;
  padding: 6px 10px; background: var(--good-bg); color: var(--good); font-size: 13px;
}
.container { width: min(760px, 100%); margin: 0 auto; padding: 16px 14px 40px; }
.notice { padding: 14px; border: 1px solid #fde68a; background: #fffbeb; border-radius: 16px; line-height: 1.55; font-size: 14px; }
.notice span { color: var(--muted); }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 16px 0; padding: 5px; background: #e5e7eb; border-radius: 14px; }
.tab { border: 0; background: transparent; padding: 10px 6px; border-radius: 10px; color: var(--muted); }
.tab.active { background: var(--surface); color: var(--text); font-weight: 600; }
.panel { display: none; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 16px; }
.panel.active { display: block; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
h2, h3, h4 { margin: 0; }
.section-heading p, .helper { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.shortcut-notice {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  margin: 14px 0; padding: 13px; border: 1px solid #c7d2fe;
  border-radius: 14px; background: #eef2ff; color: #312e81;
}
.shortcut-notice p { margin: 5px 0 0; color: #4338ca; font-size: 14px; line-height: 1.5; }
.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 14px 0; }
.metric { border: 1px solid var(--border); border-radius: 14px; padding: 12px; }
.metric-label { color: var(--muted); font-size: 13px; }
.metric-value { margin-top: 5px; font-size: 22px; font-weight: 700; }
.stack { display: grid; gap: 10px; }
.order-card { border: 1px solid var(--border); border-radius: 14px; padding: 13px; }
.order-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.order-card p { margin: 7px 0 0; font-size: 14px; }
.small-chip { border-radius: 999px; padding: 4px 8px; background: #f3f4f6; font-size: 12px; }
.remove-btn { border: 0; background: transparent; color: var(--bad); padding: 4px; }
.editor { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.editor summary { cursor: pointer; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 14px 0; }
label { display: grid; gap: 6px; font-size: 14px; }
input, select, textarea { width: 100%; border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface); color: var(--text); }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 3px solid rgba(17,24,39,.18); outline-offset: 2px; }
.primary, .secondary, .ghost { border-radius: 12px; padding: 11px 14px; border: 1px solid transparent; }
.primary { background: var(--accent); color: var(--accent-text); }
.secondary { background: #eef2ff; color: #3730a3; width: 100%; }
.ghost { background: #f9fafb; border-color: var(--border); color: var(--text); }
.danger { color: var(--bad); }
.large { width: 100%; margin-top: 14px; padding: 14px; font-weight: 700; }
.form-error { margin: 12px 0 0; color: var(--bad); font-size: 14px; line-height: 1.5; }
.upload-label { margin-top: 12px; }
.screenshot-preview { margin-top: 10px; width: 100%; max-height: 280px; object-fit: contain; border: 1px solid var(--border); border-radius: 14px; }
.hidden { display: none !important; }
.result { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 18px; }
.result-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 13px; }
.result-reason { line-height: 1.6; }
.reason-list { padding-left: 20px; line-height: 1.55; }
.reason-list li { margin: 7px 0; }
footer { padding: 0 18px calc(22px + env(safe-area-inset-bottom)); text-align: center; color: var(--muted); font-size: 12px; }
.empty { padding: 18px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: 14px; }
.shortcut-card { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.shortcut-card > p { color: var(--muted); font-size: 14px; line-height: 1.55; }
.shortcut-url { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.shortcut-actions { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.shortcut-actions .secondary { width: auto; }
.text-link { color: #4338ca; font-size: 14px; font-weight: 600; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.setup-panel { margin-top: 16px; }
.setup-panel h2 { margin-bottom: 12px; }
.setup-panel h3 { margin: 22px 0 10px; }
.setup-panel p { line-height: 1.6; }
.setup-steps { padding-left: 22px; line-height: 1.6; }
.setup-steps li { margin: 10px 0; }
.shortcut-template { min-height: 158px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.55; }
.protocol-table { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.protocol-row { display: grid; grid-template-columns: .8fr 1.4fr 1fr; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); font-size: 13px; }
.protocol-row:first-child { border-top: 0; }
.protocol-head { background: var(--bg); color: var(--muted); font-weight: 600; }
@media (min-width: 620px) {
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .metrics { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-color-scheme: dark) {
  :root { --bg:#09090b; --surface:#18181b; --text:#fafafa; --muted:#a1a1aa; --border:#27272a; --accent:#fafafa; --accent-text:#111827; }
  .topbar { background: rgba(24,24,27,.94); }
  .tabs { background:#27272a; }
  .notice { background:#2b2110; border-color:#5c4514; }
  .ghost { background:#202024; }
  .small-chip { background:#27272a; }
  .secondary { background:#25234a; color:#c7d2fe; }
  .shortcut-notice { background:#25234a; border-color:#3730a3; color:#e0e7ff; }
  .shortcut-notice p, .text-link { color:#c7d2fe; }
}
