/* =========================================================================
   Hoodscape Feature Map
   Same palette and pixel type as the game HUD: dark stone chrome around
   parchment wells, one gold accent, clean sans type.
   ========================================================================= */

:root {
  --bg: #12160f;
  --panel: #1c221a;
  --panel-2: #232b20;
  --panel-edge: #2f3a2b;
  --ink: #dfe7ef;
  --muted: #8a9686;
  --accent: #ffd166;
  --warn: #ff8f6b;
  --good: #8bd450;

  --parch-bg: #efe7d4;
  --parch-ink: #3a2f22;
  --parch-muted: #7d6c50;
  --parch-border: rgba(58, 47, 34, 0.35);
  --parch-surface: rgba(58, 47, 34, 0.08);

  --gold-deep: #b8862a;
  --gold-dark: #6b4f16;

  --font-sans: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  --radius: 6px;

  font-family: var(--font-sans);
  font-size: 18px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

/* Author `display` rules would otherwise beat the UA rule for [hidden]. */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: 1rem;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ------------------------------------------------------------------ buttons */

.btn {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--panel-edge);
  border-radius: 4px;
  background: #2a3325;
  color: var(--ink);
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: transform 0.06s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:hover {
  box-shadow: 0 0 0 1px rgba(255, 214, 122, 0.38), 0 0 12px rgba(255, 214, 122, 0.16);
}
.btn:active {
  transform: translateY(1px);
}
.btn-gold {
  background: linear-gradient(#e7b84a, #c08a23);
  border-color: var(--gold-dark);
  color: #2a1d06;
  text-shadow: 0 1px 0 rgba(255, 245, 210, 0.35);
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
}
.btn-ghost:hover {
  color: var(--ink);
}
.btn-danger {
  color: var(--warn);
  border-color: #5a3128;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* -------------------------------------------------------------------- inputs */

.input {
  width: 100%;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--parch-border);
  border-radius: 4px;
  background: rgba(255, 250, 235, 0.9);
  color: var(--parch-ink);
  outline: none;
}
.input::placeholder {
  color: var(--parch-muted);
}
.input:focus {
  border-color: var(--gold-deep);
  box-shadow: 0 0 0 2px rgba(184, 134, 42, 0.25);
}
.topbar .input {
  background: #151b13;
  border-color: var(--panel-edge);
  color: var(--ink);
}
.topbar .input::placeholder {
  color: #5f6b5b;
}
select.input {
  cursor: pointer;
}

/* --------------------------------------------------------------------- gate */

.gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(255, 209, 102, 0.06), transparent 60%),
    linear-gradient(160deg, #161c12, #0c0f0a 70%);
  z-index: 40;
}
.gate-card {
  width: min(380px, 90vw);
  padding: 2rem 1.8rem;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.gate-crest {
  font-size: 3rem;
  color: var(--accent);
  line-height: 1;
}
.gate-card h1 {
  font-size: 2.4rem;
  color: var(--accent);
  text-shadow: 0 2px 0 var(--gold-dark);
  margin-top: 0.3rem;
}
.gate-sub {
  color: var(--muted);
  margin: 0.1rem 0 1.4rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.8rem;
}
.gate-card input {
  width: 100%;
  padding: 0.6rem 0.7rem;
  margin-bottom: 0.8rem;
  background: #141a12;
  border: 1px solid var(--panel-edge);
  border-radius: 4px;
  color: var(--ink);
  text-align: center;
  letter-spacing: 0.2em;
}
.gate-card .btn {
  width: 100%;
  padding: 0.6rem;
}
.gate-error {
  color: var(--warn);
  margin: 0.8rem 0 0;
}
.shake {
  animation: shake 0.35s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}

/* ------------------------------------------------------------------- app */

.app {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.5rem 0.9rem;
  background: linear-gradient(#20281c, #171d14);
  border-bottom: 2px solid var(--panel-edge);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  z-index: 10;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding-right: 0.7rem;
  border-right: 1px solid var(--panel-edge);
}
.brand-mark {
  font-size: 1.9rem;
  color: var(--accent);
  text-shadow: 0 2px 0 var(--gold-dark);
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 0.95;
}
.brand-text strong {
  color: var(--accent);
  letter-spacing: 0.16em;
  font-size: 1.15rem;
}
.brand-text span {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.stats {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--panel-edge);
  border-radius: 999px;
  background: #151b13;
  font-size: 0.82rem;
  color: var(--muted);
}
.chip b {
  color: var(--ink);
  font-weight: 400;
}
.chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c, var(--muted));
}

.filters {
  display: flex;
  gap: 0.35rem;
  margin-left: auto;
  align-items: center;
  flex-wrap: wrap;
}
.filters .input {
  width: auto;
  min-width: 120px;
  padding: 0.32rem 0.5rem;
}
#filter-q {
  min-width: 190px;
}
.actions {
  display: flex;
  gap: 0.35rem;
}

/* ------------------------------------------------------------------ board */

.board {
  position: relative;
  flex: 1 0 auto;
  min-height: 68vh;
  display: grid;
  grid-template-columns: 1fr 1.12fr 0.95fr 0.85fr;
  gap: 0.9rem;
  padding: 0.9rem;
  overflow: hidden;
  background:
    radial-gradient(900px 500px at 20% 0%, rgba(255, 209, 102, 0.05), transparent 60%),
    radial-gradient(900px 600px at 90% 100%, rgba(139, 212, 80, 0.05), transparent 60%),
    #10140e;
}
.board-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(139, 212, 80, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 212, 80, 0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 50% 40%, #000 55%, transparent 100%);
}

.lane {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: rgba(28, 34, 26, 0.72);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4), var(--shadow);
  overflow: hidden;
}
.lane-pipeline {
  border-color: rgba(184, 134, 42, 0.55);
  background: rgba(32, 38, 28, 0.8);
}
.lane-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem 0.45rem;
  border-bottom: 1px solid var(--panel-edge);
  background: linear-gradient(rgba(255, 255, 255, 0.02), transparent);
}
.lane-head h2 {
  font-size: 1.15rem;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.lane-done .lane-head h2 {
  color: var(--good);
}
.lane-review {
  border-color: rgba(111, 179, 224, 0.5);
  background: rgba(28, 37, 44, 0.8);
}
.lane-review .lane-head h2 {
  color: #6fb3e0;
}
.lane-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 8px var(--c);
}
.lane-count {
  color: var(--muted);
  font-size: 0.85rem;
}
.lane-hint {
  margin-left: auto;
  color: #5f6b5b;
  font-size: 0.78rem;
  font-style: italic;
}
.lane-sort {
  font: inherit;
  font-size: 0.74rem;
  padding: 0.08rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--panel-edge);
  background: #151b13;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.12s ease, box-shadow 0.12s ease;
}
.lane-sort:hover {
  color: var(--accent);
  box-shadow: 0 0 0 1px rgba(255, 214, 122, 0.35);
}
.lane-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  scrollbar-width: thin;
  scrollbar-color: #3a452f transparent;
}
.lane-list::-webkit-scrollbar {
  width: 9px;
}
.lane-list::-webkit-scrollbar-thumb {
  background: #3a452f;
  border-radius: 6px;
}
.lane-empty {
  display: none;
  padding: 1rem;
  color: #5f6b5b;
  text-align: center;
  font-style: italic;
  font-size: 0.9rem;
}
.lane.is-empty .lane-empty {
  display: block;
}

/* sortable ghosts */
.sortable-ghost {
  opacity: 0.35;
  outline: 2px dashed var(--accent);
}
.sortable-chosen {
  box-shadow: 0 0 0 2px var(--accent), var(--shadow);
}
/* the pointer-fallback clone that follows the cursor */
.sortable-fallback,
.sortable-drag {
  opacity: 0.95;
  transform: rotate(1.5deg) scale(1.02);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6), 0 0 0 2px var(--accent) !important;
  cursor: grabbing;
}
.lane-list.drag-over {
  background: rgba(255, 209, 102, 0.06);
}
.board.frozen .lane-list {
  opacity: 0.85;
}
.board.frozen .grip {
  display: none;
}
.freeze-note {
  position: absolute;
  top: 0.4rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  padding: 0.2rem 0.7rem;
  background: #2a1d06;
  border: 1px solid var(--gold-dark);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.8rem;
}

/* ------------------------------------------------------------------- card */

.card {
  position: relative;
  border: 1px solid var(--parch-border);
  border-left: 5px solid var(--pc, var(--parch-muted));
  border-radius: 5px;
  padding: 0.5rem 0.6rem 0.45rem;
  background:
    linear-gradient(180deg, rgba(255, 252, 242, 0.9), rgba(233, 224, 203, 0.92));
  color: var(--parch-ink);
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25), 0 6px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.08s ease, box-shadow 0.12s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.25), 0 10px 22px rgba(0, 0, 0, 0.4),
    0 0 0 1px var(--gold-deep);
}
.card-top {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}
.card-name {
  font-size: 1.05rem;
  line-height: 1.1;
  margin: 0.28rem 0 0.2rem;
  color: #2a2116;
}
.card-desc {
  margin: 0;
  font-size: 0.86rem;
  color: var(--parch-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-foot {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.4rem;
  padding-top: 0.35rem;
  border-top: 1px dashed var(--parch-border);
  color: var(--parch-muted);
  font-size: 0.78rem;
}
.card-foot .spacer {
  margin-left: auto;
}
.card-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0.55;
  transition: opacity 0.12s ease;
}
.card:hover .card-actions {
  opacity: 1;
}
.icon-btn {
  border: 1px solid var(--parch-border);
  background: rgba(255, 250, 235, 0.6);
  color: var(--parch-ink);
  border-radius: 4px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
}
.icon-btn:hover {
  background: var(--good);
  border-color: var(--good);
}
.icon-btn.del:hover {
  background: var(--warn);
  border-color: var(--warn);
}
.card-img {
  width: 100%;
  max-height: 96px;
  object-fit: cover;
  border-radius: 3px;
  margin-top: 0.35rem;
  border: 1px solid var(--parch-border);
}
.card-badges {
  display: inline-flex;
  gap: 0.3rem;
  margin-left: auto;
  color: var(--parch-muted);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.05rem 0.42rem;
  border-radius: 999px;
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  background: color-mix(in srgb, var(--c) 26%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 65%, transparent);
  color: color-mix(in srgb, var(--c) 75%, #241c10);
  white-space: nowrap;
}
.tag::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c);
}
.tag.bare::before {
  display: none;
}
.tag-model {
  background: color-mix(in srgb, var(--c) 22%, transparent);
  border-color: color-mix(in srgb, var(--c) 55%, transparent);
}

.grip {
  cursor: grab;
  color: var(--parch-muted);
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.15rem;
  touch-action: none;
  user-select: none;
}
.grip:active {
  cursor: grabbing;
}

/* pipeline ranks */
.lane-pipeline .card {
  margin-left: 1.4rem;
}
.lane-pipeline .card::before {
  content: attr(data-rank);
  position: absolute;
  left: -1.4rem;
  top: 0.55rem;
  width: 1.9rem;
  height: 1.9rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(#f2cc66, #b8862a);
  border: 1px solid var(--gold-dark);
  color: #2a1d06;
  font-size: 0.8rem;
}
.lane-pipeline .card[data-rank="1"] {
  box-shadow: 0 0 0 2px var(--accent), 0 0 24px rgba(255, 209, 102, 0.25),
    0 6px 14px rgba(0, 0, 0, 0.35);
}
.lane-pipeline .card[data-rank="1"]::after {
  content: "NEXT";
  position: absolute;
  top: -0.55rem;
  right: 0.5rem;
  padding: 0 0.35rem;
  background: var(--accent);
  color: #2a1d06;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  border-radius: 3px;
}

/* done cards */
.lane-done .card {
  border-left-color: var(--good);
  filter: saturate(0.85);
}
.lane-done .card .card-name {
  text-decoration: line-through;
  text-decoration-color: rgba(58, 47, 34, 0.4);
}
.stamp {
  color: var(--parch-muted);
  font-size: 0.76rem;
}

/* ------------------------------------------------------- review lane */
.lane-review .card {
  border-left-color: #6fb3e0;
}
.review-bar {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.55rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--parch-border);
}
.review-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.review-status {
  font-size: 0.82rem;
  color: var(--c, #6fb3e0);
}
.review-note {
  font-size: 0.82rem;
  color: var(--parch-ink);
  background: rgba(58, 47, 34, 0.07);
  border-left: 3px solid var(--c, #6fb3e0);
  padding: 0.25rem 0.45rem;
}
.artifact-list {
  display: grid;
  gap: 0.25rem;
}
.artifact-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  text-align: left;
  padding: 0.3rem 0.45rem;
  background: rgba(255, 250, 235, 0.42);
  border: 1px solid var(--parch-border);
  border-radius: 4px;
  color: var(--parch-ink);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}
.artifact-row:hover {
  background: rgba(255, 250, 235, 0.75);
}
.artifact-icon {
  flex: none;
  width: 1.1rem;
  text-align: center;
}
.artifact-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.review-actions .btn {
  flex: 1;
  min-width: 6rem;
}
.merge-warn {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: #7a2f16;
  background: rgba(255, 143, 107, 0.16);
  border: 1px solid rgba(163, 58, 32, 0.4);
  border-radius: 4px;
  padding: 0.35rem 0.45rem;
}
.review-done {
  font-size: 0.82rem;
  color: var(--parch-good);
}

/* --------------------------------------------------------------- inspector */

.pop {
  position: fixed;
  z-index: 30;
  width: 340px;
  max-width: 92vw;
  padding: 0.7rem 0.8rem;
  background: var(--panel);
  border: 1px solid var(--gold-deep);
  border-radius: 8px;
  box-shadow: var(--shadow);
  pointer-events: none;
  animation: popin 0.12s ease;
}
@keyframes popin {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.pop h3 {
  color: var(--accent);
  font-size: 1.15rem;
  line-height: 1.1;
}
.pop-tags {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin: 0.35rem 0;
}
.pop-section {
  margin-top: 0.45rem;
}
.pop-label {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.pop p {
  margin: 0.1rem 0 0;
  font-size: 0.9rem;
  color: var(--ink);
  white-space: pre-wrap;
  max-height: 8rem;
  overflow: hidden;
}
.pop .mono {
  font-family: var(--font-mono);
  background: #12160f;
  border: 1px solid var(--panel-edge);
  border-radius: 4px;
  padding: 0.4rem 0.5rem;
  color: #b9c9a6;
  font-size: 0.85rem;
  max-height: 6.5rem;
  overflow: hidden;
  white-space: pre-wrap;
}
.pop-img {
  width: 100%;
  max-height: 120px;
  object-fit: cover;
  border-radius: 4px;
  margin-top: 0.4rem;
  border: 1px solid var(--panel-edge);
}
.pop-files {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.25rem;
}
.file-pill {
  padding: 0.05rem 0.4rem;
  border: 1px solid var(--panel-edge);
  border-radius: 999px;
  font-size: 0.78rem;
  color: #b9c9a6;
}

/* ------------------------------------------------------------------ drawer */

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 94vw);
  z-index: 25;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 2px solid var(--gold-dark);
  box-shadow: -20px 0 40px rgba(0, 0, 0, 0.5);
  animation: slidein 0.16s ease;
}
@keyframes slidein {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--panel-edge);
}
.drawer-head h2 {
  color: var(--accent);
  font-size: 1.3rem;
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem 1rem 2rem;
}
.next-block {
  margin-bottom: 1rem;
}
.next-block h3 {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}
.next-hero {
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--gold-deep);
  border-radius: 6px;
  background: linear-gradient(160deg, rgba(255, 209, 102, 0.1), rgba(28, 34, 26, 0.6));
}
.next-hero .card-name {
  font-size: 1.25rem;
  color: var(--accent);
  margin: 0.2rem 0;
}
.next-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0;
  border-bottom: 1px dashed var(--panel-edge);
  cursor: pointer;
}
.next-row:hover {
  background: rgba(255, 209, 102, 0.06);
}
.next-row .card-name {
  font-size: 0.98rem;
  margin: 0;
  flex: 1;
  color: var(--ink);
  -webkit-line-clamp: 1;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.82rem;
}

/* ------------------------------------------------------------------- modal */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 5, 0.72);
  backdrop-filter: blur(2px);
}
.modal-card {
  position: relative;
  width: min(1000px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--gold-deep);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: popin 0.14s ease;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--panel-edge);
  background: linear-gradient(rgba(255, 209, 102, 0.05), transparent);
}
.modal-head h2 {
  color: var(--accent);
  font-size: 1.35rem;
}
.modal-body {
  padding: 1rem;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1.1rem;
}
.modal-foot {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  border-top: 1px solid var(--panel-edge);
  background: #171d14;
}
.modal-buttons {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
}
.form-status {
  color: var(--warn);
  font-size: 0.88rem;
}

.field {
  display: block;
  margin-bottom: 0.75rem;
}
.field > span {
  display: block;
  margin-bottom: 0.22rem;
  color: var(--muted);
  font-size: 0.86rem;
  letter-spacing: 0.03em;
}
.field > span b {
  color: var(--warn);
  font-weight: 400;
}
.field > span em {
  color: #5f6b5b;
  font-style: italic;
}
.field textarea.input {
  resize: vertical;
}
.field .mono {
  font-size: 0.92rem;
}
.field small {
  display: block;
  margin-top: 0.2rem;
  color: #5f6b5b;
  font-size: 0.76rem;
}
.grid-3,
.grid-2 {
  display: grid;
  gap: 0.6rem;
}
.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}
.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}
.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
}
.check input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

/* colour the three selectors to match their chosen value */
select[data-tint] {
  border-color: color-mix(in srgb, var(--c) 60%, var(--parch-border));
  color: var(--parch-ink);
  background-image: none;
  box-shadow: inset 3px 0 0 var(--c);
}

.form-side {
  border-left: 1px solid var(--panel-edge);
  padding-left: 1rem;
}
.preview-title {
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}
.preview-card {
  transform: scale(0.98);
  transform-origin: top left;
}
.form-note {
  margin-top: 1rem;
  color: #5f6b5b;
  font-size: 0.84rem;
  font-style: italic;
}

/* dossier */
.detail-card {
  width: min(860px, 96vw);
}
.detail-body {
  display: block;
}
.detail-meta {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.detail-section {
  margin-top: 0.9rem;
}
.detail-section .pop-label {
  display: block;
  margin-bottom: 0.2rem;
}
.detail-desc {
  color: var(--ink);
  white-space: pre-wrap;
  line-height: 1.35;
}
.prompt-well {
  background: #0f130d;
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  padding: 0.6rem 0.7rem;
  color: #c4d3b0;
  white-space: pre-wrap;
  font-size: 0.95rem;
  max-height: 16rem;
  overflow: auto;
}
.detail-img {
  max-width: 100%;
  border-radius: 6px;
  border: 1px solid var(--panel-edge);
  cursor: zoom-in;
}
.attach-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--panel-edge);
  border-radius: 5px;
  margin-bottom: 0.35rem;
  cursor: pointer;
}
.attach-row:hover {
  border-color: var(--gold-deep);
  background: rgba(255, 209, 102, 0.05);
}
.attach-row .spacer {
  margin-left: auto;
}
.detail-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--panel-edge);
  flex-wrap: wrap;
}
.kv {
  display: flex;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.86rem;
}
.kv b {
  color: var(--ink);
  font-weight: 400;
}

/* markdown viewer */
.md-card {
  width: min(820px, 96vw);
}
#md-copy {
  margin-left: auto;
  margin-right: 0.4rem;
}
.md-body {
  padding: 1.1rem 1.4rem 2rem;
  overflow-y: auto;
  background: var(--parch-bg);
  color: var(--parch-ink);
  line-height: 1.45;
}
.md-body h1,
.md-body h2,
.md-body h3 {
  color: var(--gold-dark);
  margin: 1rem 0 0.4rem;
}
.md-body h1 { font-size: 1.7rem; }
.md-body h2 { font-size: 1.4rem; }
.md-body h3 { font-size: 1.15rem; }
.md-body a { color: var(--parch-name, #a05a1e); }
.md-body code {
  background: rgba(58, 47, 34, 0.12);
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
}
.md-body pre {
  background: #241f16;
  color: #e8dcc0;
  padding: 0.7rem 0.9rem;
  border-radius: 5px;
  overflow-x: auto;
}
.md-body pre code {
  background: none;
  padding: 0;
}
.md-body blockquote {
  margin: 0.6rem 0;
  padding-left: 0.8rem;
  border-left: 3px solid var(--gold-deep);
  color: var(--parch-muted);
}
.md-body table {
  border-collapse: collapse;
}
.md-body th,
.md-body td {
  border: 1px solid var(--parch-border);
  padding: 0.25rem 0.5rem;
}
.md-body img {
  max-width: 100%;
}

/* ------------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  transform: translateX(-50%);
  z-index: 80;
  padding: 0.5rem 1rem;
  background: #20281c;
  border: 1px solid var(--gold-deep);
  border-radius: 999px;
  color: var(--accent);
  box-shadow: var(--shadow);
  animation: popin 0.14s ease;
}
.toast.err {
  border-color: var(--warn);
  color: var(--warn);
}

/* ------------------------------------------------------------- agent bar */

.agentbar {
  display: flex;
  align-items: stretch;
  gap: 0.7rem;
  padding: 0.55rem 0.9rem 0.6rem;
  background: linear-gradient(#1a2016, #141a12);
  border-bottom: 2px solid var(--panel-edge);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.4);
}
.agentbar-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-right: 0.7rem;
  border-right: 1px solid var(--panel-edge);
  white-space: nowrap;
}
.agentbar-label > div {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}
#agentbar-toggle {
  flex: none;
  width: 1.6rem;
  height: 1.6rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--panel-edge);
  border-radius: 4px;
  background: #151b13;
  color: var(--muted);
  cursor: pointer;
}
#agentbar-toggle:hover { color: var(--accent); border-color: var(--gold-deep); }
.agentbar.collapsed { padding-bottom: 0.35rem; }
.agentbar.collapsed .slots { display: none; }
.agentbar-label span {
  color: var(--accent);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.85rem;
}
.agentbar-label small {
  color: var(--muted);
  font-size: 0.74rem;
}
.slots {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.55rem;
  min-width: 0;
  /* Keep a large pile of agents from pushing the board off-screen; the page
     itself scrolls, and the bar scrolls internally if it still gets tall. */
  max-height: 34vh;
  overflow-y: auto;
}

.slot {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 260px;
  max-width: 340px;
  gap: 0.18rem;
  min-height: 60px;
  padding: 0.35rem 0.5rem;
  font-size: 0.92rem;
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  background: rgba(16, 20, 14, 0.7);
  overflow: hidden;
}
.slot.free {
  border-style: dashed;
  border-color: #3a452f;
  align-items: center;
  justify-content: center;
}
.slot.busy {
  border-color: color-mix(in srgb, var(--sc, var(--accent)) 55%, var(--panel-edge));
  background:
    radial-gradient(120% 100% at 0% 0%, color-mix(in srgb, var(--sc) 16%, transparent), transparent 70%),
    rgba(22, 28, 20, 0.85);
}
.slot-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.slot-no {
  color: #5f6b5b;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
}
.agent-name {
  color: var(--ink);
  font-size: 1rem;
  letter-spacing: 0.03em;
}
.slot-status {
  margin-left: auto;
  padding: 0.02rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  background: color-mix(in srgb, var(--c) 25%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 60%, transparent);
  color: color-mix(in srgb, var(--c) 80%, #dfe7ef);
}
.slot-status.idle {
  color: #5f6b5b;
  border-color: #2f3a2b;
  background: transparent;
}
.slot-feature {
  display: block;
  color: var(--accent);
  font-size: 1.02rem;
  line-height: 1.1;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slot-feature:hover {
  text-decoration: underline;
}
.slot-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.78rem;
}
.timer {
  color: var(--good);
  font-variant-numeric: tabular-nums;
}
.slot-note {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slot-actions {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.mini {
  padding: 0.16rem 0.5rem;
  font-size: 0.84rem;
}
.slot.expanded { min-height: 0; }
.slot-more { display: none; }
.slot.expanded .slot-more { display: flex; }
.slot-empty {
  border: 1px dashed #3a452f;
  background: transparent;
  color: var(--muted);
  border-radius: 5px;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
}
.slot-empty:hover {
  color: var(--accent);
  border-color: var(--gold-deep);
}

/* ------------------------------------------------------- subagent cards */

.subslots {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  margin: 0.12rem 0 0.05rem 0.5rem;
  padding-left: 0.4rem;
  border-left: 2px solid color-mix(in srgb, var(--sc, var(--accent)) 40%, var(--panel-edge));
}
.subslot {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.18rem 0.4rem;
  border: 1px solid var(--panel-edge);
  border-radius: 5px;
  background: rgba(14, 18, 12, 0.6);
}
.subslot-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.subslot-name {
  color: var(--ink);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}
.subslot-model {
  color: var(--muted);
  font-size: 0.72rem;
}
.subslot .slot-status {
  margin-left: auto;
  font-size: 0.66rem;
}
.subslot-note {
  color: var(--muted);
  font-size: 0.74rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.subslot .subslots { margin-left: 0.3rem; }

/* ------------------------------------------------------------ test slots */

.testbar {
  display: flex;
  align-items: stretch;
  gap: 0.7rem;
  padding: 0.5rem 0.9rem 0.55rem;
  background: linear-gradient(#171d14, #121810);
  border-bottom: 2px solid var(--panel-edge);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.4);
}
.testslots {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.5rem;
  min-width: 0;
}
.testslot {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-height: 54px;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  background: rgba(16, 20, 14, 0.7);
}
.testslot.held {
  border-color: color-mix(in srgb, var(--c, var(--accent)) 55%, var(--panel-edge));
  background:
    radial-gradient(120% 100% at 0% 0%, color-mix(in srgb, var(--c) 14%, transparent), transparent 70%),
    rgba(22, 28, 20, 0.85);
}
.testslot.deploying { border-color: var(--accent); }
.testslot-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.testslot-key {
  color: #5f6b5b;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.testslot-feature {
  display: block;
  color: var(--accent);
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.testslot-feature:hover { text-decoration: underline; }
.testslot-note { font-size: 0.78rem; }
.testslot-actions {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-top: auto;
}

/* --------------------------------------------------- working / blocked cards */

.card {
  padding: 0.5rem 1.7rem 0.45rem 0.6rem;
}
.card.working {
  border-left-color: var(--good);
  animation: work-glow 2.8s ease-in-out infinite;
}
@keyframes work-glow {
  0%, 100% {
    box-shadow: 0 0 0 2px rgba(139, 212, 80, 0.35), 0 0 12px rgba(139, 212, 80, 0.18),
      0 6px 14px rgba(0, 0, 0, 0.3);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(139, 212, 80, 0.8), 0 0 30px rgba(139, 212, 80, 0.45),
      0 6px 14px rgba(0, 0, 0, 0.3);
  }
}
.work-sheen {
  position: absolute;
  inset: 0;
  border-radius: 5px;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 32%, rgba(139, 212, 80, 0.22) 50%, transparent 68%);
  background-size: 260% 100%;
  animation: sweep 2.4s linear infinite;
}
@keyframes sweep {
  from { background-position: 140% 0; }
  to { background-position: -140% 0; }
}
.work-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: rgba(20, 32, 14, 0.85);
  border: 1px solid rgba(139, 212, 80, 0.55);
  color: #cfe9b0;
  font-size: 0.78rem;
}
.work-dots {
  display: inline-flex;
  gap: 3px;
}
.work-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--good);
  animation: dotpulse 1.1s ease-in-out infinite;
}
.work-dots i:nth-child(2) { animation-delay: 0.15s; }
.work-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dotpulse {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-2px); }
}
.card.waiting {
  border-left-color: #9aa7b8;
}
.wait-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.35rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: rgba(154, 167, 184, 0.16);
  border: 1px solid rgba(154, 167, 184, 0.5);
  color: #cfd8e3;
  font-size: 0.78rem;
}
.wait-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9aa7b8;
  animation: waitpulse 1.6s ease-in-out infinite;
}
@keyframes waitpulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}
.slot.busy.waiting {
  border-style: dashed;
}
.card.blocked {
  border-left-color: #8a9686;
  filter: saturate(0.55) brightness(0.92);
}
.card.blocked .card-name {
  color: #5c5445;
}
.block-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.35rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: rgba(58, 47, 34, 0.12);
  border: 1px dashed var(--parch-border);
  color: #6b5c44;
  font-size: 0.78rem;
}

/* ------------------------------------------------------- dependency links */

.deplines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  /* Above the cards: a wire may cross another lane to reach the task it gates,
     and tucking it behind cards would hide exactly that relationship. */
  z-index: 8;
}
.dep-line {
  fill: none;
  stroke: rgba(255, 143, 107, 0.55);
  stroke-width: 2;
  stroke-dasharray: 5 5;
  transition: stroke 0.15s ease, stroke-width 0.15s ease, opacity 0.15s ease;
}
.dep-line.done {
  stroke: rgba(139, 212, 80, 0.5);
}
.dep-line.hot {
  stroke: var(--accent);
  stroke-width: 3;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 5px rgba(255, 209, 102, 0.7));
}
.dep-line.faded {
  opacity: 0.18;
}
.dep-temp {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-dasharray: 7 4;
  pointer-events: none;
}
.dep-dot {
  position: absolute;
  right: 5px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent) 0 3px, #12160f 3px);
  border: 2px solid var(--gold-deep);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  cursor: crosshair;
  opacity: 0.55;
  transition: opacity 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
  z-index: 2;
}
.card:hover .dep-dot,
.card.dep-source .dep-dot {
  opacity: 1;
  transform: scale(1.18);
  box-shadow: 0 0 9px var(--accent);
}
.dep-dot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  opacity: 1;
}
body.linking,
body.linking * {
  cursor: crosshair !important;
}
.card.dep-target {
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
}
.dep-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.2rem;
}
.dep-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--panel-edge);
  border-radius: 999px;
  background: #151b13;
  color: var(--ink);
  font-size: 0.82rem;
  cursor: default;
}
.dep-chip.done {
  border-color: rgba(139, 212, 80, 0.5);
  color: var(--good);
}
.dep-chip button {
  border: none;
  background: none;
  color: var(--warn);
  cursor: pointer;
  padding: 0;
  font-size: 0.9rem;
}

/* --------------------------------------------------------- work dialog */

.work-card {
  width: min(560px, 96vw);
}
.work-body {
  padding: 1rem;
  overflow-y: auto;
}
.work-body .field {
  margin-bottom: 0.7rem;
}
.work-note {
  color: var(--muted);
  font-size: 0.84rem;
  font-style: italic;
}

/* --------------------------------------------------------- agent terminal */

.term-card {
  width: min(1100px, 96vw);
  height: min(80vh, 760px);
  display: flex;
  flex-direction: column;
}
.term-status {
  margin-left: auto;
  margin-right: 0.5rem;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid var(--panel-edge);
  color: var(--muted);
}
.term-status.running {
  color: var(--good);
  border-color: rgba(139, 212, 80, 0.6);
  animation: statuspulse 1.6s ease-in-out infinite;
}
.term-status.exited {
  color: var(--accent);
  border-color: var(--gold-deep);
}
.term-status.failed {
  color: var(--warn);
  border-color: #5a3128;
}
@keyframes statuspulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}
.term-actions {
  display: flex;
  gap: 0.35rem;
}
.term-host {
  flex: 1;
  min-height: 0;
  padding: 0.5rem 0.4rem 0.5rem 0.6rem;
  background: #0a0c08;
  border-top: 1px solid var(--panel-edge);
  border-bottom: 1px solid var(--panel-edge);
  overflow: hidden;
}
.term-host .xterm {
  width: 100%;
  height: 100%;
}
.term-input {
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem 0.6rem;
}
.term-input .input {
  flex: 1;
  background: #0f130d;
  border-color: var(--panel-edge);
  color: #c4d3b0;
  font-family: var(--font-mono);
}
.term-input .input::placeholder {
  color: #55614f;
}
.run-chip {
  font-size: 0.72rem;
  padding: 0 0.35rem;
  border-radius: 3px;
  border: 1px solid rgba(139, 212, 80, 0.5);
  color: var(--good);
}

/* --------------------------------------------------------------- responsive */

@media (max-width: 1080px) {
  .board {
    grid-template-columns: 1fr 1fr;
    overflow-y: auto;
  }
  .lane-review,
  .lane-done {
    grid-column: auto;
  }
  .modal-body {
    grid-template-columns: 1fr;
  }
  .form-side {
    border-left: none;
    border-top: 1px solid var(--panel-edge);
    padding-left: 0;
    padding-top: 1rem;
  }
}
@media (max-width: 720px) {
  :root { font-size: 17px; }
  .board {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .lane {
    max-height: 60vh;
  }
  .filters {
    order: 5;
    width: 100%;
    margin-left: 0;
  }
  #filter-q {
    flex: 1;
    min-width: 0;
  }
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------- readable review buttons */
/* On parchment cards the ghost buttons were grey-on-cream. Force ink + a
   visible edge so "Tested", "Send back" and friends are legible. */
.card .btn-ghost,
.review-bar .btn-ghost {
  color: #2a2116;
  border-color: rgba(58, 47, 34, 0.45);
  background: rgba(255, 250, 235, 0.55);
}
.card .btn-ghost:hover,
.review-bar .btn-ghost:hover {
  color: #12100b;
  border-color: var(--gold-deep);
  background: rgba(255, 250, 235, 0.9);
}
.review-status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  font-size: 0.84rem;
  color: #2a2116;
  background: color-mix(in srgb, var(--c, #6fb3e0) 22%, #efe7d4);
  border: 1px solid color-mix(in srgb, var(--c, #6fb3e0) 60%, transparent);
}
.review-actions .btn-gold {
  flex: 1 1 100%;
}
.review-bar .btn-danger {
  background: #a33a20;
  border-color: #7a2f16;
  color: #ffe9df;
}
.review-bar .btn-danger:hover {
  background: #b8452a;
}

/* ------------------------------------------------ completed: merge bookkeeping */
.merge-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
  padding-top: 0.45rem;
  border-top: 1px dashed var(--parch-border);
}
.merge-chip {
  font-size: 0.82rem;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  color: #6b5c44;
  background: rgba(58, 47, 34, 0.1);
  border: 1px solid var(--parch-border);
}
.merge-chip.ok {
  color: #2f5a12;
  background: rgba(139, 212, 80, 0.2);
  border-color: rgba(76, 122, 31, 0.5);
}
.branch-chip {
  max-width: 46%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  color: var(--parch-muted);
}

/* =========================================================================
   Polish pass — prompt editor, review hierarchy, general readability
   ========================================================================= */

/* ------------------------------------------------------ prompt editor */

.prompts-card {
  width: min(1080px, 96vw);
  height: min(84vh, 780px);
  display: flex;
  flex-direction: column;
}
.prompts-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1rem;
  padding: 1rem;
}
.prompts-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 0.55rem;
}
.prompts-tabs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.prompts-tabs .btn-gold {
  color: #2a1d06;
}
#prompts-tab-note {
  margin-left: auto;
  font-style: italic;
}
#prompts-text {
  flex: 1;
  min-height: 0;
  resize: none;
  background: #0f130d;
  color: #c9f7c5;
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  padding: 0.7rem 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.35;
  white-space: pre;
  overflow: auto;
}
#prompts-text:focus {
  border-color: var(--gold-deep);
  box-shadow: 0 0 0 2px rgba(184, 134, 42, 0.25);
}
.prompts-side {
  border-left: 1px solid var(--panel-edge);
  padding-left: 1rem;
  overflow-y: auto;
}
.prompt-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  margin: 0.35rem 0 0.7rem;
}
.prompt-tokens code {
  background: #151b13;
  border: 1px solid var(--panel-edge);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  font-size: 0.8rem;
  color: #b9c9a6;
}
.prompts-side code {
  background: rgba(255, 250, 235, 0.12);
  padding: 0 0.25rem;
  border-radius: 3px;
}
@media (max-width: 820px) {
  .prompts-body { grid-template-columns: 1fr; }
  .prompts-side {
    border-left: none;
    border-top: 1px solid var(--panel-edge);
    padding-left: 0;
    padding-top: 0.6rem;
  }
}

/* ------------------------------------------------------ review hierarchy */

.card.review-card {
  border-left-color: #6fb3e0;
}
.review-bar {
  gap: 0.55rem;
  margin-top: 0.6rem;
  padding-top: 0.55rem;
}
.review-status {
  font-size: 0.88rem;
  padding: 0.1rem 0.6rem;
}
.review-when {
  font-size: 0.8rem;
  color: var(--parch-muted);
}
.review-label {
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--parch-muted);
}
.review-test {
  width: 100%;
  justify-content: center;
  padding: 0.4rem 0.6rem;
  font-size: 0.95rem;
}
.artifact-row {
  font-size: 0.88rem;
  padding: 0.38rem 0.5rem;
}
.review-actions {
  gap: 0.4rem;
}
.review-actions .btn {
  min-width: 0;
  padding: 0.35rem 0.5rem;
  font-size: 0.88rem;
}
.review-actions .btn-gold {
  flex: 1 1 100%;
  font-size: 1rem;
  padding: 0.5rem 0.6rem;
}
.merge-warn {
  font-size: 0.88rem;
  line-height: 1.3;
}
.review-note {
  font-size: 0.88rem;
}

/* ------------------------------------------------------ general polish */

.lane-head h2 {
  font-size: 1.22rem;
}
.lane-hint {
  font-size: 0.8rem;
}
.card-name {
  font-size: 1.08rem;
  letter-spacing: 0.01em;
}
.card-desc {
  font-size: 0.9rem;
}
.card .tag {
  font-size: 0.78rem;
}
.chip {
  font-size: 0.86rem;
}
.btn.mini,
.card .btn.mini {
  font-size: 0.86rem;
  padding: 0.2rem 0.55rem;
}
.stats .chip b {
  color: var(--ink);
}

/* Review: the two primary actions sit side by side and read big. */
.review-primary {
  gap: 0.5rem;
}
.review-primary .btn,
.review-primary .btn-gold {
  flex: 1 1 0;
  justify-content: center;
  padding: 0.55rem 0.6rem;
  font-size: 1rem;
}
.review-actions.review-primary + .review-actions {
  margin-top: 0.4rem;
}

/* Terminal + follow-up double view */
.term-body {
  flex: 1;
  min-height: 0;
  display: flex;
}
.term-body .term-host {
  flex: 1;
  min-width: 0;
}
.term-side {
  width: 340px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.7rem 0.8rem;
  border-left: 1px solid var(--panel-edge);
  background: #0f130d;
  overflow-y: auto;
}
.term-side .input {
  background: #0a0c08;
  border-color: var(--panel-edge);
  color: #c9f7c5;
  font-family: var(--font-mono);
  resize: vertical;
}
.term-side .btn { align-self: flex-start; }
.term-side .pop-label { color: var(--accent); }
.term-side b { color: #b9c9a6; }
@media (max-width: 820px) {
  .term-body { flex-direction: column; }
  .term-side {
    width: auto;
    border-left: none;
    border-top: 1px solid var(--panel-edge);
  }
}

/* Branch / commit / pushed / merged strip */
.vcs-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--parch-muted);
}
.vcs-branch {
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 400;
}
.vcs-chip {
  padding: 0.02rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--parch-border);
  background: rgba(58, 47, 34, 0.08);
}
.vcs-chip.ok {
  color: #2f5a12;
  border-color: rgba(76, 122, 31, 0.5);
  background: rgba(139, 212, 80, 0.18);
}
.vcs-commit {
  flex: 1 1 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: italic;
}

.slot-warn {
  font-size: 0.72rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  color: #ffd9c9;
  background: rgba(255, 92, 92, 0.18);
  border: 1px solid rgba(255, 92, 92, 0.5);
}
.slot-warn.ext {
  color: #cfd8e3;
  background: rgba(154, 167, 184, 0.16);
  border-color: rgba(154, 167, 184, 0.45);
}

/* Agent question alert */
.question-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.45rem 0 0.1rem;
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  background: rgba(199, 146, 234, 0.16);
  border: 1px solid rgba(199, 146, 234, 0.55);
  box-shadow: 0 0 0 0 rgba(199, 146, 234, 0.5);
  animation: qpulse 2s ease-in-out infinite;
}
@keyframes qpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(199, 146, 234, 0.35); }
  50% { box-shadow: 0 0 0 4px rgba(199, 146, 234, 0.12); }
}
.q-mark { font-size: 1rem; }
.q-text {
  flex: 1;
  min-width: 0;
  font-size: 0.88rem;
  color: #2a2116;
  overflow-wrap: anywhere;
}
.chip.q {
  color: #e6c8ff;
  border-color: rgba(199, 146, 234, 0.7);
  background: rgba(199, 146, 234, 0.16);
}

/* Dependency wires: thicker, softly glowing, meeting the nearest edge. */
.dep-line {
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 1 7;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}
.dep-line.done {
  stroke-dasharray: none;
  stroke-width: 2.75;
}
.dep-line.hot {
  stroke-dasharray: none;
  stroke-width: 3.5;
}

/* Question banner in a narrow slot: stack, don't squeeze into one word per line */
.slot .question-banner {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
}
.slot .question-banner .q-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.slot .question-banner .btn {
  align-self: flex-end;
}

/* ---------------------------------------------------- git flow + scope */

.asked-line {
  font-size: 0.84rem;
  color: var(--parch-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.git-flow {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--parch-border);
}
.git-step {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.git-step.locked {
  opacity: 0.45;
}
.base-picker {
  width: auto;
  min-width: 8rem;
  padding: 0.2rem 0.4rem;
  font-size: 0.86rem;
}
.q-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.3rem 0 0.2rem;
}
.q-options .pop-label {
  flex-basis: 100%;
}
.scope-head {
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--parch-muted);
  margin: 0.7rem 0 0.2rem;
}
.scope-text {
  white-space: pre-wrap;
  color: var(--parch-ink);
}
.scope-text.big {
  font-size: 1.02rem;
}
.scope-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.6rem;
}
.scope-kind {
  font-size: 0.72rem;
  padding: 0.02rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--parch-border);
  background: rgba(58, 47, 34, 0.08);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.scope-kind.k-dispatch { background: rgba(255, 209, 102, 0.25); }
.scope-kind.k-followup { background: rgba(111, 179, 224, 0.25); }
.scope-kind.k-answer { background: rgba(139, 212, 80, 0.25); }
.scope-kind.k-question, .scope-kind.k-question-closed { background: rgba(199, 146, 234, 0.28); }
.scope-kind.k-commit, .scope-kind.k-pr, .scope-kind.k-merge { background: rgba(58, 47, 34, 0.16); }
.scope-time { font-size: 0.78rem; color: var(--parch-muted); }

/* --------------------------------------------------- keyboard & motion */

/* A visible ring for keyboard users on every control the board is driven by. */
:where(.btn, .icon-btn, a, .card, .dep-dot):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The dashes drift toward the task a wire gates, so the direction of the wait
   is legible without a legend. Off for anyone who asked for less motion. */
@keyframes dep-flow {
  to {
    stroke-dashoffset: -16;
  }
}
.dep-line {
  animation: dep-flow 1.1s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .dep-line {
    animation: none;
  }
}

/* ------------------------------------------------------ voice prompting */

.voice-host {
  position: relative;
  display: flex;
  flex-direction: column;
}
.voice-host > textarea,
.voice-host > input {
  display: block;
}
.voice-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.3rem;
}
.voice-chip:empty {
  display: none;
}
.voice-chip button {
  font: inherit;
  font-size: 0.76rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, currentColor 45%, transparent);
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: 0.85;
}
.voice-chip button:hover {
  background: color-mix(in srgb, currentColor 14%, transparent);
  opacity: 1;
}
.voice-note {
  font-size: 0.72rem;
  opacity: 0.7;
}
.voice-note.busy {
  animation: voice-pulse 1.1s ease-in-out infinite;
}
@keyframes voice-pulse {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 0.95;
  }
}

.voice-mic {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--gold-deep);
  background: #1b2318;
  color: var(--accent);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  z-index: 3;
  transition: background 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}
.voice-mic:hover {
  background: #2a3325;
  transform: scale(1.06);
}
.voice-mic.recording {
  background: #b83a3a;
  border-color: #ff8f6b;
  color: #fff;
  animation: voice-mic-pulse 1.1s ease-in-out infinite;
}
@keyframes voice-mic-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 92, 92, 0.55);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(255, 92, 92, 0);
  }
}
.voice-timer {
  position: absolute;
  right: 38px;
  bottom: 9px;
  padding: 0 0.35rem;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.55);
  color: #ffd9c9;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  z-index: 3;
}
.voice-recording {
  outline: 1px solid rgba(255, 92, 92, 0.6);
  outline-offset: -1px;
}

/* ------------------------------------------------------------- usage bar */

.usagebar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.28rem 0.9rem;
  background: linear-gradient(#161c13, #121711);
  border-bottom: 1px solid var(--panel-edge);
  min-height: 2.05rem;
}
.usagebar-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex: none;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.usagebar-toggle:hover { color: var(--accent); }
.usagebar-caret { font-size: 0.7rem; }
.usagebar-name { color: var(--accent); }
.usagebar-toggle small {
  text-transform: none;
  letter-spacing: 0;
  color: #5f6b5b;
  font-size: 0.7rem;
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.usagebar-compact {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
  overflow: hidden;
}
.usagebar-refresh {
  flex: none;
  border: 1px solid var(--panel-edge);
  border-radius: 4px;
  background: #151b13;
  color: var(--muted);
  cursor: pointer;
  width: 1.5rem;
  height: 1.5rem;
  display: grid;
  place-items: center;
}
.usagebar-refresh:hover { color: var(--accent); border-color: var(--gold-deep); }

.usage-mini {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  padding: 0.05rem 0.5rem;
  border: 1px solid var(--panel-edge);
  border-radius: 999px;
  background: #141a12;
}
.usage-mini-label {
  font-size: 0.74rem;
  color: var(--muted);
  white-space: nowrap;
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.usage-mini-bars { display: flex; align-items: center; gap: 0.25rem; }
.usage-mini-bar {
  width: 42px;
  height: 8px;
  border-radius: 999px;
  background: #0d1109;
  border: 1px solid var(--panel-edge);
  overflow: hidden;
}
.usage-mini-bar > span { display: block; height: 100%; border-radius: 999px; }
.usage-mini-off { font-size: 0.7rem; color: #5f6b5b; }

.usage-tone-ok > span { background: linear-gradient(90deg, #6fbf3f, #8bd450); }
.usage-tone-warn > span { background: linear-gradient(90deg, #d9a13a, #ffd166); }
.usage-tone-bad > span { background: linear-gradient(90deg, #c0503a, #ff8f6b); }
.usage-tone-muted > span { background: #3a452f; }

.usagebar-panel {
  padding: 0.6rem 0.9rem 0.7rem;
  background: #121711;
  border-bottom: 1px solid var(--panel-edge);
}
.usagebar-grid {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.6rem;
  overflow-x: auto;
}
.usage-card {
  flex: 0 0 auto;
  min-width: 280px;
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  background: #161c13;
  padding: 0.5rem 0.6rem;
}
.usage-card { cursor: grab; }
.usage-card.usage-sortable-ghost,
.usage-mini.usage-sortable-ghost { opacity: 0.4; }
.usage-card.usage-sortable-chosen,
.usage-mini.usage-sortable-chosen { cursor: grabbing; box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45); }
.usage-card-head { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.35rem; }
.usage-card-head b { color: var(--ink); font-weight: 400; }
.usage-card-head .usage-plan { font-size: 0.72rem; color: var(--muted); margin-left: auto; text-transform: capitalize; }
.usage-card .usage-remove {
  border: 0;
  background: none;
  color: #5f6b5b;
  cursor: pointer;
  margin-left: 0.4rem;
}
.usage-card .usage-remove:hover { color: var(--warn); }
.usage-row { margin-top: 0.4rem; }
.usage-row-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.usage-row-head b { color: var(--ink); font-weight: 400; }
.usage-track {
  height: 10px;
  border-radius: 999px;
  background: #0d1109;
  border: 1px solid var(--panel-edge);
  overflow: hidden;
  margin-top: 0.2rem;
}
.usage-track > span { display: block; height: 100%; border-radius: 999px; }
.usage-reset { font-size: 0.72rem; color: #5f6b5b; margin-top: 0.15rem; }
.usage-err { color: var(--warn); font-size: 0.78rem; }
.usage-empty { font-size: 0.78rem; color: var(--muted); }
.usagebar-add { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; align-items: center; }
.usagebar-add .input { width: auto; min-width: 11rem; padding: 0.28rem 0.5rem; }

/* ------------------------------------------------------------ names editor */

.names-card {
  width: min(720px, 96vw);
  max-height: min(84vh, 720px);
  display: flex;
  flex-direction: column;
}
.names-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 1rem;
}
.names-section h3 {
  margin: 0 0 0.25rem;
  color: var(--accent);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.names-section > .small {
  margin: 0 0 0.5rem;
}
.names-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.names-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 0.6rem;
}
.names-base {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  min-width: 0;
}
.names-base b {
  color: var(--ink);
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.names-base em {
  color: #5f6b5b;
  font-style: normal;
  font-size: 0.72rem;
}
.names-row .input {
  width: 100%;
  padding: 0.28rem 0.5rem;
}
@media (max-width: 560px) {
  .names-row {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------- accounts & dispatch */

.field .inline-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.3rem;
  font-size: 0.86rem;
  color: var(--ink);
}
.inline-check input {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}
.slot-account {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: auto;
}
.slot-account-pick {
  background: transparent;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 0.74rem;
  cursor: pointer;
  max-width: 9rem;
}
.slot-account-pick:hover {
  color: var(--accent);
}
.slot-account-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5f6b5b;
  flex: none;
}
.slot-account-dot.usage-dot-on {
  background: var(--good);
  box-shadow: 0 0 6px var(--good);
}

/* Compact 5h / weekly cue under the account picker in the dispatch dialog. */
.acct-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--muted);
}
.acct-preview .acct-name {
  color: var(--ink);
}
.acct-preview .acct-name.muted {
  color: var(--muted);
}
.acct-win {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}
.acct-win b {
  color: var(--muted);
  font-weight: 600;
}
.acct-bar {
  font-family: var(--font-mono);
  letter-spacing: -1px;
}
.acct-num {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.acct-na {
  color: var(--muted);
}
.acct-err {
  color: var(--warn);
}

/* ------------------------------------------- account → agent pulse flow */

.app {
  position: relative;
}
.usagebar {
  margin-bottom: 0.55rem; /* room for the curved wires to arc */
}
.accountflow {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 340px;
  overflow: visible;
  pointer-events: none;
  z-index: 7;
}
.account-flow-line {
  fill: none;
  stroke: rgba(255, 209, 102, 0.68);
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-dasharray: 2 7;
  animation: account-flow 1.2s linear infinite;
}
@keyframes account-flow {
  to {
    stroke-dashoffset: -9;
  }
}
.account-flow-dot {
  fill: var(--accent);
  filter: drop-shadow(0 0 4px var(--accent));
}
.usage-mini.usage-glowing .usage-mini-bar {
  border-color: rgba(255, 209, 102, 0.75);
  box-shadow: 0 0 9px rgba(255, 209, 102, 0.45);
}
.usage-card.usage-glowing {
  border-color: rgba(255, 209, 102, 0.7);
  box-shadow: 0 0 0 1px rgba(255, 209, 102, 0.35), 0 0 20px rgba(255, 209, 102, 0.16);
  animation: usage-breathe 2.4s ease-in-out infinite;
}
@keyframes usage-breathe {
  0%,
  100% {
    box-shadow: 0 0 0 1px rgba(255, 209, 102, 0.28), 0 0 14px rgba(255, 209, 102, 0.12);
  }
  50% {
    box-shadow: 0 0 0 1px rgba(255, 209, 102, 0.5), 0 0 24px rgba(255, 209, 102, 0.22);
  }
}
@media (prefers-reduced-motion: reduce) {
  .account-flow-line,
  .usage-card.usage-glowing {
    animation: none;
  }
}

.account-flow-port {
  fill: var(--accent);
  stroke: #12160f;
  stroke-width: 1;
}

/* ------------------------------------------------- board cards: dark, not parchment
   The task cards used to be cream/parchment. They now read as dark slate-green
   wells so they sit with the stone chrome. Everything is scoped to .card so the
   modals keep their paper. */
.card {
  --parch-bg: #1e2719;
  --parch-ink: #d9e4cd;
  --parch-heading: #eef4e4;
  --parch-muted: #95a688;
  --parch-border: rgba(255, 255, 255, 0.12);
  --parch-surface: rgba(255, 255, 255, 0.05);
  --parch-tint: rgba(255, 255, 255, 0.03);
  background: linear-gradient(180deg, #222c1d, #1a2214);
  border: 1px solid #35422c;
  border-left: 5px solid var(--pc, #6f7f63);
  color: var(--parch-ink);
}
.card .card-name { color: var(--parch-heading); }
.card .card-desc { color: var(--parch-muted); }
.card .card-foot { color: var(--parch-muted); border-top-color: var(--parch-border); }
.card .card-img { border-color: var(--parch-border); }
.card .stamp { color: var(--parch-muted); }
.card .icon-btn { background: rgba(255, 255, 255, 0.07); border-color: var(--parch-border); color: var(--parch-ink); }
.card .icon-btn:hover { background: var(--good); border-color: var(--good); color: #12160f; }
.card .icon-btn.del:hover { background: var(--warn); border-color: var(--warn); color: #12160f; }
.card .tag { background: color-mix(in srgb, var(--c) 20%, transparent); border-color: color-mix(in srgb, var(--c) 55%, transparent); color: color-mix(in srgb, var(--c) 74%, #ffffff); }
.card .grip { color: var(--parch-muted); }
.card .block-badge { background: rgba(255, 255, 255, 0.06); border-color: var(--parch-border); color: var(--parch-muted); }
.card .review-note { color: var(--parch-ink); background: rgba(255, 255, 255, 0.05); }
.card .artifact-row { background: rgba(255, 255, 255, 0.05); border-color: var(--parch-border); color: var(--parch-ink); }
.card .artifact-row:hover { background: rgba(255, 255, 255, 0.1); }
.card .vcs-strip, .card .vcs-branch, .card .vcs-commit { color: var(--parch-muted); }
.card .vcs-chip { background: rgba(255, 255, 255, 0.06); border-color: var(--parch-border); color: var(--parch-muted); }
.card .vcs-chip.ok { color: #b9f0a0; border-color: rgba(139, 212, 80, 0.5); background: rgba(139, 212, 80, 0.15); }
.card .scope-head, .card .scope-time { color: var(--parch-muted); }
.card .scope-text { color: var(--parch-ink); }
.card .scope-kind { background: rgba(255, 255, 255, 0.06); border-color: var(--parch-border); }
.card .asked-line { color: var(--parch-muted); }
.card .git-flow { border-top-color: var(--parch-border); }
.lane-done .card .card-name { text-decoration-color: rgba(255, 255, 255, 0.22); }

/* ------------------------------------------------------------ dark mode
   Off by default; the moon in the topbar dims everything further for night. */
:root[data-theme="dark"] {
  --bg: #080b07;
  --panel: #10160d;
  --panel-2: #151d12;
  --panel-edge: #202b1c;
  --ink: #e8eef4;
  --muted: #7c8974;
}
:root[data-theme="dark"] .board {
  background:
    radial-gradient(900px 500px at 20% 0%, rgba(255, 209, 102, 0.03), transparent 60%),
    radial-gradient(900px 600px at 90% 100%, rgba(139, 212, 80, 0.03), transparent 60%),
    #070a06;
}
:root[data-theme="dark"] .topbar { background: linear-gradient(#12180e, #0b1008); }
:root[data-theme="dark"] .agentbar { background: linear-gradient(#10160d, #0a0f08); }
:root[data-theme="dark"] .usagebar { background: linear-gradient(#0e130b, #0a0e08); }
:root[data-theme="dark"] .usagebar-panel { background: #0a0e08; }
:root[data-theme="dark"] .usage-card { background: #11160d; }
:root[data-theme="dark"] .lane { background: rgba(13, 18, 10, 0.85); }
:root[data-theme="dark"] .lane-pipeline { background: rgba(16, 21, 12, 0.9); }
:root[data-theme="dark"] .lane-review { background: rgba(14, 20, 24, 0.9); }
:root[data-theme="dark"] .card { background: linear-gradient(180deg, #181f13, #11160d); border-color: #26311f; }
:root[data-theme="dark"] .chip { background: #0c1108; }
:root[data-theme="dark"] .topbar .input { background: #0b1008; }

/* dark mode, second pass: actually darker */
:root[data-theme="dark"] .board { background: #050703; }
:root[data-theme="dark"] .topbar { background: linear-gradient(#0c1108, #070a05); }
:root[data-theme="dark"] .agentbar { background: linear-gradient(#0a0f08, #070a05); }
:root[data-theme="dark"] .usagebar { background: linear-gradient(#090d07, #070a05); }
:root[data-theme="dark"] .lane { background: rgba(9, 12, 7, 0.92); }
:root[data-theme="dark"] .lane-pipeline { background: rgba(12, 16, 9, 0.94); }
:root[data-theme="dark"] .lane-review { background: rgba(10, 15, 18, 0.94); }
:root[data-theme="dark"] .card { background: linear-gradient(180deg, #131910, #0e130a); border-color: #1f2a19; }
:root[data-theme="dark"] .chip { background: #080b06; }
:root[data-theme="dark"] .usage-card { background: #0d1209; }

/* Questions: readable on the dark cards, and expandable when long. */
.question-banner {
  background: rgba(199, 146, 234, 0.14);
  border-color: rgba(199, 146, 234, 0.5);
  cursor: pointer;
}
.q-text {
  color: #f0ddff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.question-banner.expanded .q-text {
  -webkit-line-clamp: unset;
  display: block;
  overflow: visible;
}
.q-toggle {
  flex: none;
  color: #c9a4e6;
  font-size: 0.72rem;
  transition: transform 0.15s ease;
}
.question-banner.expanded .q-toggle {
  transform: rotate(180deg);
}

/* ------------------------------------------------- markdown reader polish */

/* The reader should own the screen: near-full width and height. */
.md-card {
  width: min(1400px, 97vw);
  height: min(94vh, 1100px);
  max-height: 94vh;
  display: flex;
  flex-direction: column;
}
.md-body {
  flex: 1;
  min-height: 0;
  font-size: 1.05rem;
  line-height: 1.65;
  scroll-behavior: smooth;
  padding: 1.4rem clamp(1.5rem, 5vw, 4rem) 3rem;
}
/* Keep lines readable on a wide screen; the rest of the width is margin. */
.md-body > * {
  max-width: 84ch;
}
.md-body > pre,
.md-body > table {
  max-width: 100%;
}
.md-body h1,
.md-body h2,
.md-body h3,
.md-body h4 {
  line-height: 1.25;
}
.md-body h1 {
  border-bottom: 1px solid var(--parch-border);
  padding-bottom: 0.35rem;
}
.md-body h2 {
  border-bottom: 1px solid var(--parch-border);
  padding-bottom: 0.25rem;
  margin-top: 1.5rem;
}
.md-body h3 {
  margin-top: 1.2rem;
}
.md-body p {
  margin: 0.65rem 0;
}
.md-body ul,
.md-body ol {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
}
.md-body li {
  margin: 0.2rem 0;
}
.md-body li > input[type="checkbox"] {
  margin-right: 0.4rem;
  accent-color: var(--gold-deep);
}
.md-body hr {
  border: 0;
  border-top: 1px solid var(--parch-border);
  margin: 1.1rem 0;
}
.md-body table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
  border-collapse: collapse;
  margin: 0.6rem 0;
}
.md-body th {
  background: rgba(58, 47, 34, 0.06);
  text-align: left;
}
.md-body a {
  color: var(--gold-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.md-body img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--parch-border);
  border-radius: 5px;
  margin: 0.4rem 0;
}
.md-body pre {
  font-size: 0.86rem;
  line-height: 1.45;
}
.md-body strong {
  color: var(--gold-dark);
}
.md-body .attach-row + .attach-row {
  margin-top: 0.25rem;
}

/* ---------------------------------------------- terminal: bigger and nicer */

.term-card {
  width: min(1520px, 98vw);
  height: min(94vh, 1200px);
}
.term-body {
  background: #0a0e09;
}
.term-host {
  padding: 0.85rem 1rem;
  background:
    radial-gradient(120% 80% at 50% -20%, rgba(139, 212, 80, 0.05), transparent 60%),
    #0a0e09;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), inset 0 -1px 0 rgba(0, 0, 0, 0.5);
}
.term-host .xterm-viewport {
  background: transparent !important;
  scrollbar-width: thin;
  scrollbar-color: #3a452f transparent;
}
.term-host .xterm-viewport::-webkit-scrollbar {
  width: 10px;
}
.term-host .xterm-viewport::-webkit-scrollbar-thumb {
  background: #3a452f;
  border-radius: 6px;
}
.term-side {
  width: 380px;
}
.term-card .modal-head {
  background: linear-gradient(#1a2016, #141a12);
}
.term-card .modal-head h2 {
  font-size: 1.05rem;
}

/* Live terminal status strip */
.term-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.32rem 0.85rem;
  font-size: 0.78rem;
  color: var(--muted);
  background: #0d1209;
  border-bottom: 1px solid var(--panel-edge);
  white-space: nowrap;
  overflow: hidden;
  transition: background 0.2s ease, color 0.2s ease;
}
.term-meta.bump {
  background: #16210f;
  color: var(--ink);
}
.term-meta .tm-text {
  overflow: hidden;
  text-overflow: ellipsis;
}
.tm-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5f6b5b;
  flex: none;
}
.tm-dot.active {
  background: var(--good);
  box-shadow: 0 0 8px var(--good);
  animation: tmpulse 1.4s ease-in-out infinite;
}
@keyframes tmpulse {
  0%,
  100% { opacity: 0.45; }
  50% { opacity: 1; }
}

/* Answering a question: a wider card and a tall, readable answer box. */
.work-card.work-wide { width: min(1000px, 97vw); }
.work-wide .question-banner { padding: 0.75rem 0.9rem; align-items: flex-start; }
.work-wide .question-banner .q-text { display: block; -webkit-line-clamp: unset; overflow: visible; font-size: 1.02rem; line-height: 1.55; }
.work-wide .q-mark { font-size: 1.3rem; }
.work-wide .q-options .btn { font-size: 0.98rem; padding: 0.55rem 0.85rem; }
.work-wide .q-answer { min-height: 12vh; font-size: 1.02rem; line-height: 1.55; resize: vertical; }

/* A compact queue banner: the count plus a one-line peek at the first question. */
.question-banner.multi .q-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Multi-question answer blocks: stack with spacing, never overflow. */
.q-block {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0.6rem 0;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  min-width: 0;
  background: rgba(199, 146, 234, 0.12);
  border: 1px solid rgba(199, 146, 234, 0.45);
}
.q-block .q-block-head {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.q-block .q-text {
  flex: 1;
  min-width: 0;
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
  font-size: 1.02rem;
  line-height: 1.5;
}
.q-block .q-options { margin: 0; }
.q-block textarea,
.q-block .q-answer {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-size: 0.98rem;
  line-height: 1.5;
  resize: vertical;
}

/* An interactive agent that has gone quiet may be waiting for the human. */
.slot-warn.idle { color: #c792ea; border-color: #c792ea55; }

/* A finished task queued because every test slot is busy. */
.slot-warn.wait { color: #6fb3e0; border-color: #6fb3e055; }
.review-note.wait { color: #6fb3e0; }

/* A built test slot whose branch has newer commits. */
.review-note.stale { color: #ffd166; }
.testslot-stale {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.2rem 0.4rem;
  border: 1px dashed #ffd16688;
  border-radius: 4px;
  background: #2a2410;
  color: #ffd166;
  font-size: 0.78rem;
  cursor: pointer;
}
.testslot-stale:hover { border-color: #ffd166; }

/* ---------------------------------------------------------- companion bot
   A small helper that floats in the bottom-right. The FAB is a little stone
   face that bobs and blinks; it pulses while a turn is running. The panel
   slides up from the corner. Motion is opt-out via prefers-reduced-motion. */

.companion {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.6rem;
  pointer-events: none;
}
.companion > * {
  pointer-events: auto;
}

.companion-fab {
  position: relative;
  width: 58px;
  height: 58px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--gold-dark);
  background:
    radial-gradient(120% 120% at 30% 22%, #3a462f, #1b2215 70%);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 245, 210, 0.12);
  cursor: pointer;
  color: var(--accent);
  animation: companion-bob 3.4s ease-in-out infinite;
  transition: box-shadow 0.15s ease, transform 0.1s ease;
}
.companion-fab:hover {
  box-shadow: 0 0 0 1px rgba(255, 214, 122, 0.5), 0 0 20px rgba(255, 214, 122, 0.25);
}
.companion-fab:active {
  transform: translateY(1px);
}

.companion-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}
.cf-eye {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px rgba(255, 209, 102, 0.8);
  animation: companion-blink 4.6s ease-in-out infinite;
}
.cf-mouth {
  position: absolute;
  left: 50%;
  top: 60%;
  width: 16px;
  height: 8px;
  margin-left: -8px;
  border-bottom: 2px solid rgba(255, 209, 102, 0.85);
  border-radius: 0 0 10px 10px;
  transition: height 0.2s ease, width 0.2s ease;
}

/* Thinking: the whole face breathes and a soft gold ring pulses out. */
.companion-fab.running {
  animation: none;
}
.companion-fab.running .cf-eye {
  animation: companion-eye-think 1.1s ease-in-out infinite;
}
.companion-fab.running .cf-mouth {
  width: 9px;
  height: 9px;
  margin-left: -4.5px;
  border-bottom: 0;
  border: 2px solid rgba(255, 209, 102, 0.9);
  border-radius: 50%;
}
.companion-fab.running::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(255, 209, 102, 0.55);
  animation: companion-pulse 1.6s ease-out infinite;
}

@keyframes companion-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}
@keyframes companion-blink {
  0%,
  92%,
  100% {
    transform: scaleY(1);
  }
  95% {
    transform: scaleY(0.1);
  }
}
@keyframes companion-eye-think {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}
@keyframes companion-pulse {
  0% {
    transform: scale(0.9);
    opacity: 0.7;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

.companion-panel {
  width: min(420px, calc(100vw - 2.2rem));
  height: min(560px, calc(100vh - 6.5rem));
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #20281c, #171d13);
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  box-shadow: var(--shadow), 0 0 0 1px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  transform-origin: bottom right;
  animation: companion-open 0.18s ease-out;
}
@keyframes companion-open {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.companion-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  background: linear-gradient(#1a2016, #141a12);
  border-bottom: 1px solid var(--panel-edge);
}
.companion-title {
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  color: var(--accent);
  white-space: nowrap;
}
.companion-head-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: auto;
}
.companion-model {
  width: 130px;
  padding: 0.25rem 0.4rem;
  font-size: 0.78rem;
  background: #151b13;
  border-color: var(--panel-edge);
  color: var(--ink);
}
.companion .mini {
  padding: 0.28rem 0.5rem;
  font-size: 0.76rem;
}

/* Segmented Chat / Work toggle. */
.companion-mode {
  display: inline-flex;
  border: 1px solid var(--panel-edge);
  border-radius: 999px;
  overflow: hidden;
  background: #12170f;
}
.companion-mode button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.24rem 0.6rem;
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.companion-mode button.active[data-mode="chat"] {
  background: rgba(139, 212, 80, 0.18);
  color: var(--good);
}
.companion-mode button.active[data-mode="work"] {
  background: rgba(255, 209, 102, 0.2);
  color: var(--accent);
}

.companion-mode-note {
  padding: 0.24rem 0.7rem;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--panel-edge);
}
.companion-mode-note.chat {
  color: var(--good);
  background: rgba(139, 212, 80, 0.07);
}
.companion-mode-note.work {
  color: var(--accent);
  background: rgba(255, 209, 102, 0.09);
}

.companion-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: #3a452f transparent;
}
.companion-messages::-webkit-scrollbar {
  width: 9px;
}
.companion-messages::-webkit-scrollbar-thumb {
  background: #3a452f;
  border-radius: 6px;
}

.companion-msg {
  max-width: 88%;
  padding: 0.45rem 0.65rem;
  border-radius: 9px;
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.companion-msg.user {
  align-self: flex-end;
  background: rgba(255, 209, 102, 0.14);
  border: 1px solid rgba(255, 209, 102, 0.3);
  color: #f4e9cd;
}
.companion-msg.assistant {
  align-self: flex-start;
  background: #232b20;
  border: 1px solid var(--panel-edge);
  color: var(--ink);
}
.companion-msg.system {
  align-self: center;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  font-style: italic;
  padding: 0.1rem 0;
}
.companion-msg.assistant:empty::after {
  content: "…";
  color: var(--muted);
}
.companion-msg.assistant.error {
  border-color: var(--warn);
  color: var(--warn);
}
.companion-msg .companion-msg-mode {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.companion-progress {
  align-self: flex-start;
  max-width: 88%;
  color: var(--muted);
  font-size: 0.76rem;
  font-family: var(--font-mono);
  line-height: 1.35;
  padding: 0 0.15rem;
  overflow-wrap: anywhere;
}
.companion-progress::before {
  content: "· ";
  color: var(--gold-deep);
}

.companion-term {
  max-height: 38%;
  margin: 0;
  padding: 0.55rem 0.7rem;
  overflow: auto;
  background: #0a0e09;
  border-top: 1px solid var(--panel-edge);
  color: #9fb08d;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.companion-composer {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  padding: 0.55rem 0.6rem;
  border-top: 1px solid var(--panel-edge);
  background: #141a12;
}
.companion-composer textarea {
  flex: 1;
  resize: none;
  max-height: 7rem;
  min-height: 2.2rem;
  padding: 0.45rem 0.55rem;
  font-size: 0.88rem;
  line-height: 1.4;
  background: #151b13;
  border-color: var(--panel-edge);
  color: var(--ink);
}
.companion-composer textarea::placeholder {
  color: #5f6b5b;
}
.companion-composer .btn {
  flex: none;
}

@media (max-width: 520px) {
  .companion-model {
    display: none;
  }
  .companion-panel {
    width: calc(100vw - 1.4rem);
    height: min(72vh, 560px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .companion-fab,
  .companion-fab.running .cf-eye,
  .companion-fab.running::after,
  .cf-eye,
  .companion-panel {
    animation: none;
  }
}

/* ------------------------------------------------------------ her (Live2D)
   The Live2D companion, switched on from the hidden settings. She is the first
   item in the companion column, so she perches on top of the chat box in the
   bottom-right; the Hide chip tucks her away without touching the button. While
   she is shown the panel is capped so the whole stack still fits on screen. */

.live2d-on {
  --her-h: clamp(420px, 62vh, 720px);
}
/* When the chat is open she only scales in height — her width is kept, so she
   stays put instead of sliding right — and the stack still fits. */
.live2d-on.companion-open {
  --her-h: clamp(210px, 30vh, 350px);
}
.live2d {
  position: relative;
  width: clamp(450px, 48vw, 720px);
  height: var(--her-h, clamp(420px, 62vh, 720px));
  pointer-events: none;
}
.live2d-stage {
  position: absolute;
  inset: 0;
}
.live2d-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  cursor: pointer;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.45));
}
.live2d-hide {
  position: absolute;
  top: 0.1rem;
  right: 0.1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.5rem;
  font: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: rgba(20, 24, 16, 0.72);
  border: 1px solid var(--panel-edge);
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.55;
  pointer-events: auto;
  transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.live2d:hover .live2d-hide,
.live2d-hide:hover,
.live2d-hide:focus-visible {
  opacity: 1;
}
.live2d-hide:hover {
  color: var(--accent);
  border-color: var(--gold-dark);
}

/* A small, always-visible quick-hide button at her lower-right. */
.live2d-hide-quick {
  position: absolute;
  right: 0.45rem;
  bottom: 0.45rem;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--panel-edge);
  background: rgba(20, 24, 16, 0.8);
  color: var(--muted);
  cursor: pointer;
  pointer-events: auto;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.live2d-hide-quick:hover,
.live2d-hide-quick:focus-visible {
  color: var(--accent);
  border-color: var(--gold-dark);
  background: rgba(20, 24, 16, 0.95);
}

/* Once she is the companion, the FAB drops the stone face for a chat glyph. */
.companion-glyph {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.live2d-on .companion-face {
  display: none;
}
.live2d-on .companion-glyph {
  display: flex;
}

/* While she is actually shown, shrink the chat panel so the whole column
   (her + button + panel) stays inside the viewport. */
.live2d-visible .companion-panel {
  height: min(560px, calc(100vh - 7rem - var(--her-h)));
}

/* The hidden settings card */
.hidden-card {
  max-width: 470px;
}
.hidden-card .modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.hidden-card .check {
  align-items: flex-start;
}
.hidden-card kbd {
  padding: 0.05rem 0.35rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--panel-edge);
  border-radius: 4px;
  font-size: 0.75rem;
}

@media (max-width: 720px) {
  .live2d-on {
    --her-h: clamp(240px, 37vh, 350px);
  }
  .live2d {
    width: clamp(225px, 61vw, 350px);
    opacity: 0.94;
  }
}

@media (prefers-reduced-motion: reduce) {
  .live2d-hide {
    transition: none;
  }
}

/* Full agent report (captured test list) in the reader. */
.report-md {
  margin: 0.4rem 0 0;
  padding: 0.75rem 0.9rem;
  background: var(--panel, #14140f);
  border: 1px solid var(--line, #2c2c22);
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "VT323", ui-monospace, monospace;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--ink, #e8e2cf);
}
