/* Snagline: work-order tags on a steel desk.
   Palette
     --steel   #DCE2E7  page
     --sheet   #F7F9FA  panels
     --ink     #14263B  text
     --manila  #F1DFA9  tags
     --red     #A3231B  emergency
     --amber   #F2B705  urgent / hazard tape
     --green   #2B6648  routine
*/
:root {
  --steel: #dce2e7;
  --sheet: #f7f9fa;
  --ink: #14263b;
  --ink-soft: #3d4f63;
  --manila: #f1dfa9;
  --manila-edge: #cdb36b;
  --red: #a3231b;
  --amber: #f2b705;
  --green: #2b6648;
  --line: #b8c3cd;
  --display: "Bahnschrift", "DIN Alternate", "Roboto Condensed", "Arial Narrow", "DejaVu Sans Condensed", sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { background: var(--steel); }
body {
  margin: 0;
  font: 16px/1.5 var(--body);
  color: var(--ink);
  background: var(--steel);
}
code { font-size: 0.92em; background: rgba(20, 38, 59, 0.08); padding: 0 0.25em; border-radius: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Hazard-tape strip: the demo-mode label. Deliberately loud. */
.demo-strip {
  background: repeating-linear-gradient(-45deg, var(--amber) 0 14px, var(--ink) 14px 28px);
  padding: 8px 16px;
}
.demo-strip p {
  margin: 0 auto;
  max-width: 1180px;
  background: var(--ink);
  color: #fff;
  padding: 8px 14px;
  font-size: 0.92rem;
  border-radius: 2px;
}
.demo-strip strong { color: var(--amber); }
.demo-strip code { background: #2c3f57; color: #fff; }

.top {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 12px;
  display: flex;
  gap: 24px;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
}
.brand h1 {
  font: 700 3.1rem/1 var(--display);
  font-stretch: condensed;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}
.brand p { margin: 0; max-width: 58ch; color: var(--ink-soft); }

.badge {
  margin: 0;
  font: 600 0.9rem/1 var(--display);
  padding: 9px 12px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  white-space: nowrap;
}
.badge-demo { background: var(--amber); color: var(--ink); }
.badge-live { background: var(--green); color: #fff; border-color: var(--green); }
.badge-error { background: var(--red); color: #fff; border-color: var(--red); }

.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 20px 32px;
  display: grid;
  grid-template-columns: minmax(300px, 5fr) 7fr;
  gap: 28px;
  align-items: start;
}
h2 {
  font: 700 1.25rem/1.2 var(--display);
  font-stretch: condensed;
  margin: 0 0 10px;
}

.intake {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 20px;
  position: sticky;
  top: 16px;
}
textarea {
  width: 100%;
  font: 1rem/1.5 var(--body);
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  padding: 12px;
  resize: vertical;
}
textarea:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}
.samples {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 10px 0 16px;
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.chip {
  font: 500 0.85rem/1 var(--body);
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  cursor: pointer;
}
.chip:hover { border-color: var(--ink); }
.go {
  width: 100%;
  font: 700 1.15rem/1 var(--display);
  font-stretch: condensed;
  color: #fff;
  background: var(--ink);
  border: 0;
  border-radius: 4px;
  padding: 15px;
  cursor: pointer;
}
.go:hover { background: #22395a; }
.go:disabled { opacity: 0.75; cursor: progress; }

.checks-wrap { margin-top: 22px; border-top: 1px dashed var(--line); padding-top: 16px; }
.hint { margin: -4px 0 10px; font-size: 0.85rem; color: var(--ink-soft); }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.check { display: grid; grid-template-columns: 22px 1fr; gap: 8px; font-size: 0.9rem; align-items: start; }
.check .icon {
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center;
  font: 700 0.75rem/1 var(--body);
  color: #fff; margin-top: 1px;
}
.check-pass .icon { background: var(--green); }
.check-fixed .icon { background: var(--ink); }
.check-warn .icon { background: var(--amber); color: var(--ink); }
.check-fail .icon { background: var(--red); }
.source { margin: 12px 0 0; font-size: 0.85rem; color: var(--ink-soft); }

.empty {
  border: 2px dashed var(--line);
  border-radius: 6px;
  padding: 28px;
  color: var(--ink-soft);
}
.empty p { margin: 0; max-width: 46ch; }
.error { background: #fbe9e7; color: var(--red); border-left: 4px solid var(--red); padding: 10px 14px; margin: 0 0 14px; }

/* The tags: the one memorable element. */
.tickets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.tag {
  position: relative;
  background: var(--manila);
  border: 1px solid var(--manila-edge);
  border-radius: 4px 4px 4px 4px;
  padding: 0 18px 16px;
  clip-path: polygon(16px 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%, 0 16px);
  animation: hang 380ms cubic-bezier(.2, .9, .3, 1.2) both;
  animation-delay: calc(var(--i) * 90ms);
  transform-origin: 50% 0;
}
.tag::before { /* the punched hole */
  content: "";
  position: absolute;
  top: 9px; left: 50%;
  width: 14px; height: 14px; margin-left: -7px;
  border-radius: 50%;
  background: var(--steel);
  box-shadow: inset 0 0 0 3px #e7e0c8;
}
.tag-band {
  display: flex;
  justify-content: space-between;
  margin: 32px -18px 12px;
  padding: 6px 18px;
  font: 700 0.95rem/1 var(--display);
  font-stretch: condensed;
  text-transform: capitalize;
}
.tag-emergency .tag-band { background: var(--red); color: #fff; }
.tag-urgent .tag-band { background: var(--amber); color: var(--ink); }
.tag-routine .tag-band { background: var(--green); color: #fff; }
.tag h3 { font: 700 1.35rem/1.15 var(--display); font-stretch: condensed; margin: 0 0 10px; }
.tag-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 10px; }
.tag-meta dt { font-size: 0.75rem; color: #5b4a1c; }
.tag-meta dd { margin: 0; font-weight: 600; font-size: 0.92rem; }
.tag-meta dd.missing { color: var(--red); }
.tag-desc { margin: 0 0 10px; font-size: 0.92rem; }
.tag blockquote {
  margin: 0;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.55);
  border-left: 3px solid var(--manila-edge);
  font-size: 0.86rem;
  font-style: italic;
}
.tag blockquote.ungrounded { border-left-color: var(--red); }
.advice {
  margin: 10px 0 0;
  font-size: 0.86rem;
  background: #fff;
  border: 1.5px solid var(--red);
  border-radius: 3px;
  padding: 8px 10px;
}
.advice strong { color: var(--red); }

@keyframes hang {
  from { transform: rotate(-4deg) translateY(-8px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .tag { animation: none; } }

.reply-wrap { margin-top: 28px; background: var(--sheet); border: 1px solid var(--line); border-radius: 6px; padding: 18px 20px; }
.reply-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.reply-head h2 { margin: 0; }
.actions { display: flex; gap: 8px; }
.ghost {
  font: 600 0.85rem/1 var(--body);
  color: var(--ink);
  background: transparent;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  padding: 8px 12px;
  cursor: pointer;
}
.ghost:hover { background: var(--ink); color: #fff; }
.reply {
  margin: 0;
  white-space: pre-wrap;
  font: 0.95rem/1.55 var(--body);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px 14px;
}
.raw { margin-top: 12px; }
.raw summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; }
.raw pre { overflow: auto; max-height: 320px; font-size: 0.8rem; background: #fff; border: 1px solid var(--line); padding: 10px; }

.foot { max-width: 1180px; margin: 0 auto; padding: 0 20px 32px; font-size: 0.85rem; color: var(--ink-soft); }
.foot p { max-width: 80ch; margin: 0; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .intake { position: static; }
  .brand h1 { font-size: 2.4rem; }
}
