/* ---------- Card / Button / Chip ---------- */
.card { background: var(--white); border: 1px solid var(--sand-200); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 20px 22px; }
.card.flat { box-shadow: none; }
.card > h3:first-child { margin-block-start: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 20px; border-radius: 999px;
  border: 1px solid var(--ink-700); background: var(--white); color: var(--ink-900); font-weight: 600; text-decoration: none; line-height: 1.3;
  transition: background .15s, transform .1s;
}
.btn:hover { background: var(--sand-100); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brass-500); border-color: var(--brass-600); color: var(--ink-900); }
.btn.primary:hover { background: var(--brass-400); }
.btn.dark { background: var(--ink-900); color: var(--sand-50); border-color: var(--ink-900); }
.btn.dark:hover { background: var(--ink-700); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { padding: 5px 14px; font-size: var(--fs-small); }
.btn.large { padding: 14px 34px; font-size: 21px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 11px; border-radius: 999px; font-size: var(--fs-small); background: var(--sand-100); border: 1px solid var(--sand-300); color: var(--ink-700); line-height: 1.5; }
.chip.water { background: var(--water-soft); border-color: #a9cfe0; }
.chip.veg { background: var(--veg-soft); border-color: #b9d3ab; }
.chip.land { background: var(--land-soft); border-color: #dcc3a4; }
button.chip { cursor: pointer; }
button.chip:hover { background: var(--sand-200); }
.source-chip { background: var(--water-soft); border-color: #a9cfe0; color: #174b63; cursor: pointer; font-size: 14px; padding: 0 9px; margin-inline: 2px; vertical-align: baseline; }
.source-chip:hover { background: #c4e0ec; }
.source-chip.synthetic { border-style: dashed; }
.est-chip { background: #eceff2; border-color: #c9d0d6; color: var(--claim-est); font-size: 13px; padding: 0 8px; margin-inline: 2px; }
.para-chip { background: var(--sand-100); cursor: pointer; font-size: 13px; padding: 0 8px; }

.tag-illustrative {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 1px 10px; border-radius: 999px;
  border: 1px dashed var(--land); background: var(--land-soft); color: #6b4a22; line-height: 1.5;
}
.banner { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius: var(--radius-sm); font-size: var(--fs-small); margin-block-end: 14px; border: 1px solid; }
.banner.experimental { background: #fff4d6; border-color: var(--claim-partial); color: #6d4b05; }
.banner.replay { background: #eef1f4; border-color: #c4ccd3; color: var(--ink-700); }
.banner.synthetic { background: var(--land-soft); border-color: #dcc3a4; color: #5e3f17; }
.banner.info { background: var(--water-soft); border-color: #a9cfe0; color: #174b63; }
.banner .grow { min-inline-size: 0; }

/* ---------- Claim marks and grounding ---------- */
.claim { cursor: help; position: relative; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.claim[data-status="supported"] { text-decoration: underline dotted var(--claim-ok); }
.claim[data-status="partial"] { text-decoration: underline solid var(--claim-partial); }
.claim[data-status="unsupported"] { text-decoration: underline wavy var(--claim-bad); }
.claim[data-status="estimate"] { text-decoration: underline solid var(--claim-est); text-decoration-style: double; }
.claim[data-status="unchecked"] { text-decoration: none; background: linear-gradient(transparent 90%, var(--sand-300) 0); }
.claim-card {
  position: absolute; z-index: 40; inset-block-start: calc(100% + 6px); inset-inline-start: 0; inline-size: min(360px, 80vw);
  background: var(--ink-900); color: var(--sand-50); border-radius: var(--radius-sm); padding: 10px 14px; font-size: var(--fs-small); line-height: 1.5; box-shadow: var(--shadow-2);
  text-decoration: none; display: none; font-family: var(--font-sans);
}
.claim:hover .claim-card, .claim:focus .claim-card { display: block; }
.claim-card .st { font-weight: 700; display: block; margin-block-end: 3px; }
.claim-card q { display: block; font-family: var(--font-serif); }
.meter { display: flex; flex-direction: column; gap: 6px; }
.meter-bar { display: flex; block-size: 12px; border-radius: 999px; overflow: hidden; background: var(--sand-200); }
.meter-bar > i { display: block; block-size: 100%; transition: flex-grow .4s var(--ease); }
.meter-bar .ok { background: var(--claim-ok); } .meter-bar .partial { background: var(--claim-partial); }
.meter-bar .bad { background: var(--claim-bad); } .meter-bar .est { background: var(--claim-est); } .meter-bar .unchecked { background: var(--sand-300); }
.meter-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: var(--fs-small); color: var(--ink-700); }
.meter-legend span::before { content: ""; display: inline-block; inline-size: 10px; block-size: 10px; border-radius: 50%; margin-inline-end: 6px; background: var(--c); }
.meter-sum { font-size: var(--fs-small); color: var(--ink-500); }
ins.diff, .diff-ins { background: var(--ins-bg); text-decoration: none; }
del.diff, .diff-del { background: var(--del-bg); }

/* ---------- Stream text ---------- */
.stream h2, .stream h3 { margin-block: 1em .3em; font-size: var(--fs-h3); }
.stream p { margin-block-end: .7em; }
.stream ul { margin-block: 0 .7em; padding-inline-start: 1.4em; }
.stream .caret::after { content: ""; display: inline-block; inline-size: 8px; block-size: 1em; background: var(--brass-500); margin-inline-start: 3px; vertical-align: text-bottom; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Step list ---------- */
.steplist { display: flex; flex-direction: column; gap: 8px; font-size: var(--fs-small); }
.steplist .step { border: 1px solid var(--sand-200); border-radius: var(--radius-sm); padding: 8px 12px; background: var(--white); }
.steplist .step[data-status="working"] { border-color: var(--brass-500); background: #fffaf0; }
.steplist .step[data-status="error"] { border-color: var(--err); }
.steplist .step-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.steplist .agent { font-weight: 700; }
.steplist .verb { color: var(--ink-500); flex: 1 1 auto; }
.steplist .ms { color: var(--ink-500); font-variant-numeric: tabular-nums; }
.steplist .deps { color: var(--ink-500); font-size: var(--fs-tiny); }
.steplist .tools { display: flex; flex-wrap: wrap; gap: 6px; margin-block-start: 6px; }
.tool-chip { display: inline-flex; gap: 6px; align-items: center; padding: 1px 10px; border-radius: 6px; background: var(--sand-100); border: 1px solid var(--sand-300); font-size: 13px; }
.tool-chip.pending::before { content: ""; inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--brass-500); animation: pulse 1s infinite; }
.tool-chip.ok::before { content: "\2713"; color: var(--ok); }
.tool-chip.fail::before { content: "\00d7"; color: var(--err); }
.dot { display: inline-block; inline-size: 10px; block-size: 10px; border-radius: 50%; background: var(--idle); flex: none; }
.dot.working { background: var(--brass-500); animation: pulse 1s infinite; }
.dot.done { background: var(--ok); } .dot.error { background: var(--err); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(176,138,62,.55); } 50% { box-shadow: 0 0 0 6px rgba(176,138,62,0); } }

.timer { font-variant-numeric: tabular-nums; display: inline-flex; gap: 8px; align-items: baseline; font-size: var(--fs-small); color: var(--ink-700); }
.timer b { font-size: 18px; }

/* ---------- Toast / Modal / Drawer ---------- */
#toasts { position: fixed; inset-block-end: calc(var(--strip-h) + 16px); inset-inline-start: 50%; transform: translateX(calc(-50% * var(--dir))); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink-900); color: var(--sand-50); border-radius: 999px; padding: 9px 22px; font-size: var(--fs-small); box-shadow: var(--shadow-2); animation: toast-in .3s var(--ease); pointer-events: auto; }
.toast.out { opacity: 0; transition: opacity .4s; }
@keyframes toast-in { from { opacity: 0; translate: 0 10px; } }
.overlay { position: fixed; inset: 0; background: rgba(20,32,43,.5); z-index: 80; display: grid; place-items: center; padding: 24px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-2); max-inline-size: 720px; inline-size: 100%; max-block-size: 85vh; overflow: auto; padding: 26px 30px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-block-end: 12px; }
.modal-head h2 { margin: 0; }
.icon-btn { background: none; border: 0; padding: 6px; border-radius: 8px; color: inherit; display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--sand-100); }
.drawer-wrap { position: fixed; inset: 0; z-index: 70; background: rgba(20,32,43,.28); animation: fade .2s; }
.drawer {
  position: absolute; inset-block: 0; inset-inline-end: 0; inline-size: min(520px, 94vw); background: var(--white); box-shadow: var(--shadow-2);
  padding: 20px 24px calc(var(--strip-h) + 16px); overflow: auto; animation: drawer-in .28s var(--ease);
}
@keyframes drawer-in { from { transform: translateX(calc(40px * var(--dir))); opacity: 0; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-block-end: 12px; }
.drawer-head h2 { margin: 0; font-size: 24px; }

/* ---------- Tabs / Slider / Stamp / Approval / Skeleton ---------- */
.tabs { display: flex; gap: 4px; border-block-end: 2px solid var(--sand-200); margin-block-end: 14px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; padding: 8px 16px; border-block-end: 3px solid transparent; margin-block-end: -2px; font-weight: 600; color: var(--ink-500); }
.tabs button[aria-selected="true"] { color: var(--ink-900); border-block-end-color: var(--brass-500); }
.slider { display: grid; gap: 4px; }
.slider label { display: flex; justify-content: space-between; font-size: var(--fs-small); font-weight: 600; }
.slider input[type=range] { inline-size: 100%; accent-color: var(--brass-500); }
.stamp { display: inline-block; padding: 4px 16px; border: 3px double var(--claim-ok); color: var(--claim-ok); border-radius: 6px; font-family: var(--font-serif); font-size: 22px; font-weight: 700; transform: rotate(calc(-6deg * var(--dir))); }
.stamp.review { border-color: var(--claim-partial); color: var(--claim-partial); }
.stamp.draft { border-color: var(--ink-500); color: var(--ink-500); }
.approval { display: flex; align-items: center; gap: 0; flex-wrap: wrap; }
.approval .st { display: flex; align-items: center; gap: 8px; padding: 4px 4px; color: var(--ink-500); font-size: var(--fs-small); }
.approval .st .n { inline-size: 26px; block-size: 26px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--sand-200); font-weight: 700; }
.approval .st.done { color: var(--ok); } .approval .st.done .n { background: var(--ok); color: #fff; }
.approval .st.cur { color: var(--ink-900); font-weight: 700; } .approval .st.cur .n { background: var(--brass-500); color: var(--ink-900); }
.approval .bar { inline-size: 36px; block-size: 2px; background: var(--sand-300); margin-inline: 6px; }
.skeleton { border-radius: 6px; background: linear-gradient(90deg, var(--sand-100), var(--sand-200), var(--sand-100)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; min-block-size: 1em; }
@keyframes shimmer { to { background-position: -200% 0; } }
.langbar { display: flex; align-items: center; gap: 10px; background: var(--water-soft); border: 1px solid #a9cfe0; border-radius: var(--radius-sm); padding: 6px 14px; font-size: var(--fs-small); margin-block-end: 10px; }
.slot-btn { display: inline-grid; place-items: center; inline-size: 36px; block-size: 36px; border-radius: 50%; border: 1px solid var(--sand-300); background: var(--white); }
.tray-list { display: flex; flex-direction: column; gap: 10px; }
.tray-item { border: 1px solid var(--sand-200); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start; }
.tray-item .excerpt { font-size: var(--fs-small); color: var(--ink-500); display: block; }

/* ---------- Maestro strip ---------- */
.strip {
  position: fixed; inset-inline: 0; inset-block-end: 0; block-size: var(--strip-h); z-index: 60;
  background: var(--ink-900); color: var(--sand-50); border-block-start: 3px solid var(--brass-500);
  display: flex; align-items: stretch; gap: 0; padding-inline: 12px; cursor: pointer;
}
.strip-lane { display: flex; align-items: center; gap: 4px; min-inline-size: 0; }
.strip-sep { inline-size: 1px; margin-block: 14px; margin-inline: 8px; background: rgba(255,255,255,.18); }
.strip .spacer { flex: 1 1 auto; }
.pill { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 4px 6px; min-inline-size: 76px; max-inline-size: 118px; border-radius: 10px; transition: opacity .3s, background .3s; }
.pill .pic { display: flex; align-items: center; gap: 6px; }
.pill .pic .icon { inline-size: 20px; block-size: 20px; }
.pill .pname { font-size: 12.5px; line-height: 1.15; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-inline-size: 112px; }
.pill .pverb { font-size: 11px; line-height: 1.1; color: var(--brass-400); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-inline-size: 112px; block-size: 0; opacity: 0; transition: opacity .2s; }
.pill[data-st="working"] { background: rgba(176,138,62,.18); }
.pill[data-st="working"] .pverb { block-size: auto; opacity: 1; }
.pill[data-st="working"] .dot { background: var(--brass-400); animation: pulse 1s infinite; }
.pill[data-st="done"] .dot { background: #4cc272; }
.pill[data-st="error"] .dot { background: #e5584f; }
.pill[data-dim="1"] { opacity: .32; }
.pill.maestro { min-inline-size: 92px; }
.pill.human { min-inline-size: 70px; }
.pill.human[data-glow="1"] { background: rgba(76,194,114,.2); box-shadow: 0 0 0 2px #4cc272 inset; }
.pill.human[data-glow="1"] .dot { background: #4cc272; animation: pulse 1s infinite; }
.pill .toolpop {
  position: absolute; inset-block-end: calc(100% + 4px); inset-inline-start: 50%; transform: translateX(calc(-50% * var(--dir)));
  background: var(--brass-500); color: var(--ink-900); font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; white-space: nowrap;
  animation: toolpop 2.6s var(--ease) forwards; pointer-events: none; z-index: 3;
}
@keyframes toolpop { 0% { opacity: 0; translate: 0 6px; } 12% { opacity: 1; translate: 0 0; } 80% { opacity: 1; } 100% { opacity: 0; translate: 0 -6px; } }
.handoff-dot { position: fixed; inline-size: 12px; block-size: 12px; border-radius: 50%; background: var(--brass-400); box-shadow: 0 0 10px var(--brass-400); z-index: 65; pointer-events: none; inset-block-start: 0; inset-inline-start: 0; }
.strip-run { display: flex; flex-direction: column; justify-content: center; align-items: flex-end; font-size: 12px; color: var(--sand-200); min-inline-size: 90px; padding-inline: 6px; }
.strip-run b { font-size: 16px; color: var(--sand-50); font-variant-numeric: tabular-nums; }

@media (max-width: 1280px) {
  :root { --gutter: 24px; }
  .stepper a { padding: 5px 8px; }
  .pill { min-inline-size: 66px; padding-inline: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Stub screens ---------- */
.stub-screen { display: grid; place-items: center; min-block-size: 50vh; text-align: center; }
.stub-screen .card { max-inline-size: 560px; }
.pill[data-st="queued"] .dot { background: transparent; box-shadow: inset 0 0 0 2px var(--brass-400); }
.pill .dot { inline-size: 8px; block-size: 8px; }
.pill .pic .dot { margin-inline-start: 2px; }
