/* Runtend components. CSS-first: plain class names, no framework required.
   Load after tokens.css. Every value comes from a token; nothing here is a raw brand color. */

.rt { font-family: var(--font-sans); color: var(--text); -webkit-font-smoothing: antialiased; }
.rt *, .rt *::before, .rt *::after { box-sizing: border-box; }
.rt-num { font-variant-numeric: tabular-nums; }
.rt-muted { color: var(--text-muted); }
.rt-on-dark { display: none; }
[data-theme="dark"] .rt-on-dark { display: inline-block; }
[data-theme="dark"] .rt-on-light { display: none; }

/* ---------- The person marker: always a square, never rounded ---------- */
.rt-square { display: inline-block; width: 8px; height: 8px; background: var(--decision); flex: none; }

/* ---------- Button ---------- */
.rt-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; padding: 0 var(--space-5); border-radius: var(--radius-md);
  border: 1px solid transparent; font-family: var(--font-sans); font-size: 15px; font-weight: 600; line-height: 1;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color 120ms ease-out, border-color 120ms ease-out, color 120ms ease-out;
}
.rt-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.rt-btn svg { width: 18px; height: 18px; flex: none; }
.rt-btn--primary { background: var(--inverse-bg); color: var(--inverse-text); }
.rt-btn--primary:hover { background: var(--text-2); }
.rt-btn--approve { background: var(--record); color: var(--on-record); }
.rt-btn--approve:hover { background: var(--record-hover); }
.rt-btn--secondary { background: transparent; color: var(--text); border-color: var(--line-control); }
.rt-btn--secondary:hover { background: var(--surface); border-color: var(--text); }
.rt-btn--ghost { background: transparent; color: var(--text); padding: 0 var(--space-3); }
.rt-btn--ghost:hover { background: var(--line-soft); }
.rt-btn--danger { background: transparent; color: var(--stop); border-color: var(--stop); }
.rt-btn--danger:hover { background: var(--stop-tint); }
.rt-btn--sm { min-height: 36px; padding: 0 var(--space-4); font-size: 14px; }
.rt-btn--lg { min-height: 52px; padding: 0 var(--space-6); font-size: 16px; }
.rt-btn[disabled], .rt-btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.rt-link { color: var(--record); font-weight: 500; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.rt-link:hover { color: var(--record-hover); }

/* ---------- Badge (status) ---------- */
.rt-badge {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px 0 9px;
  border-radius: var(--radius-pill); font-family: var(--font-sans); font-size: 13px; font-weight: 600; line-height: 1; white-space: nowrap;
}
.rt-badge::before { content: ""; flex: none; width: 10px; height: 10px; background: currentColor; }
.rt-badge--done { background: var(--record-tint); color: var(--record); }
.rt-badge--done::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1.5 5.2 4 7.6 8.6 2.4' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1.5 5.2 4 7.6 8.6 2.4' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.rt-badge--decision { background: var(--decision-tint); color: var(--decision-text); }
.rt-badge--decision::before { width: 8px; height: 8px; }
.rt-badge--running { background: var(--line-soft); color: var(--text-2); }
.rt-badge--running::before { background: transparent; border: 2px solid currentColor; border-radius: 50%; width: 9px; height: 9px; }
.rt-badge--stopped { background: var(--stop-tint); color: var(--stop); }
.rt-badge--stopped::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 2 8 8M8 2 2 8' stroke='%23000' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 2 8 8M8 2 2 8' stroke='%23000' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- Record list: the signature element ---------- */
.rt-record { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-strong); font-family: var(--font-sans); }
.rt-record__row {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: var(--space-4);
  padding: var(--space-3) var(--space-2) var(--space-3) 0; border-bottom: 1px solid var(--line-soft); font-size: 15px; line-height: 22px; color: var(--text);
}
.rt-record__time { font-size: 14px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.rt-record__action { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-record__meta { color: var(--text-muted); }
.rt-record__sign { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.rt-record__sign svg { width: 18px; height: 18px; }
.rt-record__sign--done { color: var(--record); }
.rt-record__sign--decision { color: var(--decision-text); }
.rt-record__row--decision { background: var(--decision-row); padding-left: var(--space-3); margin-left: calc(-1 * var(--space-3)); box-shadow: inset 3px 0 0 var(--decision); }
.rt-record--inverse { border-top-color: var(--inverse-text); }

/* ---------- Ledger table ---------- */
.rt-table { width: 100%; border-collapse: collapse; font-family: var(--font-sans); font-size: 15px; line-height: 22px; color: var(--text); background: var(--surface-strong); }
.rt-table thead th {
  text-align: left; font-size: 13px; font-weight: 500; color: var(--text-muted); padding: 10px 12px;
  border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line);
}
.rt-table td { padding: 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.rt-table .rt-num, .rt-table td.rt-num, .rt-table th.rt-num { text-align: right; font-variant-numeric: tabular-nums; }
.rt-table tbody tr:hover td { background: var(--surface); }
.rt-table tr.rt-row--decision td { background: var(--decision-row); }
.rt-table tr.rt-row--decision td:first-child { box-shadow: inset 3px 0 0 var(--decision); }
.rt-table caption { text-align: left; caption-side: top; padding: 0 0 var(--space-3); font-size: 13px; color: var(--text-muted); }

/* ---------- Card ---------- */
.rt-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); }
.rt-card__kicker { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin: 0; }
.rt-card__title { font-size: 24px; line-height: 30px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.rt-card__body { font-size: 16px; line-height: 24px; color: var(--text-2); margin: 0; }
.rt-card__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--line-soft); }
.rt-card--inverse { background: var(--inverse-bg); color: var(--inverse-text); border-color: var(--inverse-bg); }
.rt-card--inverse .rt-card__body, .rt-card--inverse .rt-card__kicker { color: var(--inverse-text); opacity: 0.82; }
.rt-card--inverse .rt-card__foot { border-top-color: var(--text-muted); }

/* ---------- Decision panel (human in the loop) ---------- */
.rt-decision { background: var(--surface-strong); border: 1px solid var(--line); border-top: 3px solid var(--decision); border-radius: var(--radius-lg); padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-5); font-family: var(--font-sans); }
.rt-decision__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); }
.rt-decision__title { margin: 0; font-size: 20px; line-height: 26px; font-weight: 600; }
.rt-decision__why { margin: 4px 0 0; font-size: 15px; line-height: 22px; color: var(--text-2); }
.rt-decision__facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); margin: 0; }
.rt-decision__facts div { display: flex; flex-direction: column; gap: 2px; padding-top: var(--space-3); border-top: 1px solid var(--line-soft); }
.rt-decision__facts dt { font-size: 13px; color: var(--text-muted); }
.rt-decision__facts dd { margin: 0; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rt-decision__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.rt-decision__note { margin: 0; font-size: 13px; line-height: 18px; color: var(--text-muted); }

/* ---------- Field ---------- */
.rt-field { display: flex; flex-direction: column; gap: 6px; font-family: var(--font-sans); }
.rt-label { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--text); }
.rt-input {
  height: 44px; padding: 0 12px; width: 100%; border: 1px solid var(--line-control); border-radius: var(--radius-md);
  background: var(--surface-strong); color: var(--text); font-family: var(--font-sans); font-size: 15px;
}
.rt-input::placeholder { color: var(--text-muted); }
.rt-input:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--text); }
.rt-help { font-size: 13px; line-height: 18px; color: var(--text-muted); margin: 0; }
.rt-field--error .rt-input { border-color: var(--stop); }
.rt-field--error .rt-help { color: var(--stop); }
.rt-input-group { position: relative; }
.rt-input-group .rt-input { padding-left: 44px; font-variant-numeric: tabular-nums; }
.rt-input-group__prefix { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 15px; color: var(--text-muted); }

/* ---------- Stat ---------- */
.rt-stat { display: flex; flex-direction: column; gap: 6px; padding-top: var(--space-3); border-top: 1px solid var(--line-strong); font-family: var(--font-sans); }
.rt-stat__label { font-size: 13px; line-height: 18px; color: var(--text-muted); }
.rt-stat__figure { font-size: 40px; line-height: 44px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.rt-stat__delta { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; color: var(--record); }
.rt-stat__delta--decision { color: var(--decision-text); }
.rt-stat__context { font-size: 13px; color: var(--text-muted); }

/* ---------- Site header ---------- */
.rt-header { height: var(--layout-header); display: flex; align-items: center; justify-content: space-between; gap: var(--space-8); padding: 0 var(--space-8); background: var(--bg); border-bottom: 1px solid var(--line); font-family: var(--font-sans); }
.rt-header__logo { display: inline-flex; align-items: center; height: 28px; }
.rt-header__logo img { height: 28px; width: auto; }
.rt-header__nav { display: flex; gap: var(--space-6); }
.rt-header__nav a { color: var(--text); text-decoration: none; font-size: 15px; font-weight: 500; }
.rt-header__nav a:hover { color: var(--record); }
.rt-header__actions { display: flex; align-items: center; gap: var(--space-3); }
.rt-lang { font-size: 13px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.04em; }

/* ---------- Hero ---------- */
.rt-hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: var(--space-16); align-items: center; padding: var(--space-24) var(--space-16); background: var(--bg); font-family: var(--font-sans); color: var(--text); }
.rt-hero__kicker { display: inline-flex; align-items: center; gap: var(--space-2); font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 var(--space-6); }
.rt-hero__title { margin: 0; font-size: 88px; line-height: 0.98; font-weight: 600; letter-spacing: -0.035em; }
.rt-hero__lead { margin: var(--space-6) 0 var(--space-8); font-size: 20px; line-height: 30px; color: var(--text-2); max-width: 520px; }
.rt-hero__ctas { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.rt-hero__proof { background: var(--surface-strong); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: var(--space-6) var(--space-8) var(--space-8); }
.rt-hero__proof-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--space-4); font-size: 15px; font-weight: 600; }
@media (max-width: 900px) {
  .rt-hero { grid-template-columns: 1fr; padding: var(--space-12) var(--space-6); gap: var(--space-10); }
  .rt-hero__title { font-size: 48px; line-height: 1.05; letter-spacing: -0.025em; }
}
