/*
 * The pieces every page is built from (docs/web-plan.md, Components), after Kiln/UI/Components.swift: panels, chips,
 * the small labels over groups, messages at the top of a page, tables that stack into cards on a phone, tabs, the
 * guide line under a page's header, and the dialog that asks first.
 */

/* A card on the page (Card, .panel(...)). */
.panel {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  min-width: 0;
}
.panel--flush { padding: 0; }
.panel--quiet { box-shadow: none; }
.panel-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.signed-out .panel > * + * { margin-top: 12px; }

/* Nothing here yet: calm, centred, with a line on what will be. */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 36px 24px; text-align: center;
  border: 1.5px dashed color-mix(in srgb, var(--ink-faint) 55%, transparent);
  border-radius: var(--radius);
  color: var(--ink-soft);
}
/* A single line of nothing-here inside a panel is just a quiet line. */
p.empty { display: block; padding: 0; border: 0; text-align: left; font-size: 14px; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--ink); }
.empty p { max-width: 440px; font-size: 14px; }
.empty svg { width: 28px; height: 28px; color: var(--accent); }
.empty .button { margin-top: 6px; }

/* A small label over a group: "HOW IT WORKS", "QUESTION" (SectionLabel). */
.section-label {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.11em; text-transform: uppercase;
  color: var(--ink-soft);
}
.section-label--accent { color: var(--accent-text); }
/* The small label over a page's heading, as some pages call it. */
.eyebrow { margin: 0; font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.11em; text-transform: uppercase; color: var(--accent-text); }
.section-label--wait { color: var(--wait-text); }
.section-label--pass { color: var(--pass); }
.section-label--alert { color: var(--alert); }

/* A word or two in a tinted capsule (Pill). */
.chip {
  --tint: var(--ink-soft);
  --tint-text: var(--tint);
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  padding: 2px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--tint) 13%, transparent);
  color: var(--tint-text);
  font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.chip svg { width: 11px; height: 11px; }
.chip--good { --tint: var(--pass); }
.chip--waiting { --tint: var(--wait); --tint-text: var(--wait-text); }
.chip--warn { --tint: var(--wait); --tint-text: var(--wait-text); }
.chip--bad { --tint: var(--alert); }
.chip--info { --tint: var(--info); }
.chip--accent { --tint: var(--accent); --tint-text: var(--accent-text); }

/* A rule's or a known rule's id, in small type: "R3", "CAT-12" (IDChip). */
.id-chip { display: inline-block; flex: none; padding: 1px 6px; border-radius: 4px; background: var(--inset); color: var(--ink-soft); font-family: var(--font-mono); font-size: 11px; font-weight: 600; text-transform: uppercase; }

/* A coloured dot with a few words beside it (ReadinessLabel, MapCounts). */
.status { --tint: var(--ink-faint); display: inline-flex; align-items: center; gap: 7px; color: var(--ink-soft); font-size: 13px; font-weight: 500; }
.status::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--tint); }
.status--good { --tint: var(--pass); }
.status--waiting { --tint: var(--wait); }
.status--bad { --tint: var(--alert); }
.status--info { --tint: var(--info); }
.status--accent { --tint: var(--accent); }

/* Messages at the top of a page. */
.notice, .alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius);
  border: 1px solid var(--rule); border-left: 4px solid var(--pass);
  background: var(--card); color: var(--ink); font-size: 14px;
}
.alert { border-left-color: var(--alert); }
.notice svg, .alert svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.notice svg { color: var(--pass); }
.alert svg { color: var(--alert); }

/* A calm line across the top for something about Kiln itself, such as the analyst taking a break. */
.banner {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--info) 10%, var(--card));
  border: 1px solid color-mix(in srgb, var(--info) 30%, transparent);
  color: var(--ink); font-size: 14px;
}
.banner svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--info); }
.banner strong { font-weight: 600; }

/* A table, which stacks into cards on a phone: each cell says what it is with data-label. */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-soft); padding: 8px 12px; border-bottom: 1px solid var(--rule); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
@media (max-width: 599px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 10px 0; border-bottom: 1px solid var(--rule); }
  .table tr:last-child { border-bottom: 0; }
  .table td { border: 0; padding: 3px 12px; }
  .table td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 600; color: var(--ink-soft); }
}

/* Tabs (ViewSwitcher): a quiet switch in a capsule, with a count beside an item when there's one. */
.tabs {
  display: inline-flex; gap: 2px; padding: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
@media (max-width: 599px) {
  .tab { padding: 5px 10px; font-size: 13px; }
}
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 13px; border: 0; border-radius: 999px;
  background: none; color: var(--ink-soft);
  font: inherit; font-size: 13px; font-weight: 500; text-decoration: none; cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--ink); text-decoration: none; }
.tab[aria-selected="true"] { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }
.tab-count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--wait-text); color: var(--on-wait); font-size: 11px; font-weight: 700; line-height: 17px; text-align: center; }
.tab-panel:focus-visible { outline-offset: -3px; }

/* One line under a page's header on what's happening and what to do now (StageGuide, ProductGuide). */
.guide {
  --tint: var(--accent);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 28px;
  background: color-mix(in srgb, var(--tint) 8%, transparent);
  font-size: 14px;
}
.guide-icon { display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: color-mix(in srgb, var(--tint) 16%, transparent); color: var(--tint); }
.guide-icon svg { width: 14px; height: 14px; }
.guide-text { flex: 1 1 280px; min-width: 0; }
.guide-text strong { font-weight: 650; margin-right: 6px; }
.guide--waiting { --tint: var(--wait); }
.guide--good { --tint: var(--pass); }
.guide--info { --tint: var(--info); }
.guide--bad { --tint: var(--alert); }
@media (max-width: 599px) {
  .guide { padding: 10px 16px; }
}

/* Asks first, inside the page (never the browser's own confirm). */
.dialog {
  width: min(480px, calc(100vw - 32px));
  padding: 0; border: 1px solid var(--rule); border-radius: 16px;
  background: var(--card); color: var(--ink);
  box-shadow: 0 24px 64px rgb(0 0 0 / 0.28);
}
.dialog::backdrop { background: rgb(7 12 22 / 0.45); }
.dialog-body { padding: 22px 22px 18px; display: flex; flex-direction: column; gap: 10px; }
.dialog-title { font-size: 18px; font-weight: 600; }
.dialog-text { color: var(--ink-soft); font-size: 14px; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 0 22px 20px; }
.dialog-actions form { margin: 0; }

/* A thin bar that fills from the left (ProgressTrack). */
.track { height: 5px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 8%, transparent); overflow: hidden; }
.track-fill { height: 100%; border-radius: inherit; background: var(--info); }

/*
 * Parts shown only to people who describe (owners and product owners), or only to everyone else. Live updates render
 * the same thing for everyone looking, so the page itself says which this person is, with data-can-describe.
 */
[data-can-describe="false"] .for-describers { display: none !important; }
[data-can-describe="true"] .for-readers { display: none !important; }
.for-readers.option { cursor: default; }

/* A list of facts: a label and its value. */
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: 14px; }
.facts dt { color: var(--ink-soft); }
.facts dd { margin: 0; min-width: 0; }
