/* Doctor Subs - Admin surface styles (v2)
   Depends on tokens.css.
   Scoped to .ds-root so nothing leaks into WP admin or other plugins.
*/

/* ===========================================================
   Shared: kicker, hero, plugin header
   =========================================================== */

.ds-root .kicker {
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ds-root .plugin-header {
  padding: 28px 44px 0;
  border-bottom: 1px solid var(--line-0);
  background: var(--bg-0);
}
.ds-root .plugin-header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  max-width: 1200px;
  margin-inline: auto;
}
.ds-root .plugin-brand { display: flex; align-items: center; gap: 14px; }
.ds-root .plugin-brand .name {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1;
  color: var(--ink-0);
}
.ds-root .plugin-brand .tagline {
  font-size: 12.5px;
  color: var(--ink-2);
  margin-top: 4px;
  letter-spacing: -0.003em;
}
.ds-root .plugin-meta {
  font-size: 12.5px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 8px;
}
.ds-root .plugin-meta.stale { color: var(--risk-ink); }
.ds-root .plugin-meta .sep { color: var(--line-1); }
.ds-root .plugin-meta .refresh {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent-ink);
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.ds-root .plugin-meta .refresh:hover { text-decoration-color: var(--accent-ink); }

/* Subtle keyboard-shortcut hint - shown next to the action so returning
   merchants discover the shortcut without needing a help overlay. */
.ds-root .kbd-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  border: 1px solid var(--line-1);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--bg-1);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ds-root .refresh:hover .kbd-hint,
.ds-root .refresh:focus-visible .kbd-hint { color: var(--ink-0); border-color: var(--ink-2); }

/* Button that styles itself as an inline link (used inside banners, the
   scanning-meta, anywhere we need a trigger that reads as "link" but
   must be a <button> for correct semantics). */
.ds-root .linklike {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: inherit;
  font-family: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: currentColor;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  font-weight: 500;
}
.ds-root .linklike:hover { text-decoration-color: currentColor; }

.ds-root .tabs {
  display: flex;
  gap: 28px;
  margin-top: 24px;
  max-width: 1200px;
  margin-inline: auto;
}
.ds-root .tab {
  font-size: 13.5px;
  padding: 10px 0;
  color: var(--ink-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  cursor: pointer;
  font-weight: 400;
  text-decoration: none;
}
.ds-root .tab:hover { color: var(--ink-1); text-decoration: none; }
.ds-root .tab.active { color: var(--ink-0); border-bottom-color: var(--accent); font-weight: 500; text-decoration: none; }

/* ===========================================================
   Surface 1 - First-run
   =========================================================== */

.ds-root .firstrun {
  padding: 84px 96px 72px;
  max-width: 880px;
}
.ds-root .firstrun .hero {
  font-family: var(--font-display);
  font-size: var(--t-hero);
  line-height: 1.05;
  letter-spacing: -0.02em;
  max-width: 720px;
  color: var(--ink-0);
  font-weight: 400;
}
.ds-root .firstrun .hero .accent { color: var(--accent-ink); font-style: italic; }
.ds-root .firstrun .hero--zero { font-size: 44px; }
.ds-root .firstrun .hero-accent { color: var(--accent-ink); }
.ds-root .firstrun .hero .accent--muted { color: var(--ink-2); font-style: italic; }
.ds-root .firstrun .lede {
  margin-top: 22px;
  font-size: 16px;
  color: var(--ink-1);
  max-width: 560px;
  line-height: 1.6;
}
.ds-root .firstrun .actions {
  margin-top: 36px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.ds-root .firstrun .actions .btn { padding: 12px 20px; font-size: 14px; }
.ds-root .firstrun .actions .secondary {
  font-size: 13.5px;
  color: var(--ink-1);
}
.ds-root .firstrun .actions .secondary em {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
}

.ds-root .detects {
  margin-top: 72px;
  border-top: 1px solid var(--line-0);
  padding-top: 40px;
}
.ds-root .detects-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 24px;
}
.ds-root .detects-head .count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}
.ds-root .detects-head h2 {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-1);
}
.ds-root .detect-row {
  display: grid;
  grid-template-columns: 48px 220px 1fr;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line-0);
  align-items: baseline;
}
.ds-root .detect-row:last-child { border-bottom: none; }
.ds-root .detect-row .n {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}
.ds-root .detect-row .name {
  font-size: 15.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.ds-root .detect-row .desc {
  font-size: 14px;
  color: var(--ink-1);
  line-height: 1.55;
  max-width: 560px;
}

/* Scanning block */
.ds-root .scanning-bar {
  margin-top: 34px;
  max-width: 520px;
}
.ds-root .progress {
  height: 2px;
  background: var(--line-0);
  position: relative;
  border-radius: 2px;
}
.ds-root .progress .thumb {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--accent);
  border-radius: 2px;
  transition: width var(--t-slow) var(--ease);
}
.ds-root .scanning-meta {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-2);
}

/* ===========================================================
   Surface 2 - Dashboard
   =========================================================== */

.ds-root .dashboard {
  padding: 28px 44px 60px;
  max-width: 1200px;
  margin-inline: auto;
}

/* Scan summary stat line. Sits above the counters row, replaces the
   "healthy" counter card so the action cards (broken/at-risk) don't
   visually peer-with a non-clickable card. */
.ds-root .scan-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-2);
  margin-bottom: 12px;
  letter-spacing: 0.01em;
}

/* Counters row. Keeps the border-left selection affordance - precedent
   in Linear/Notion for tab-like selection. NOT the banned pattern
   because it signals selection, not decoration. */
.ds-root .counters {
  display: flex;
  border: 1px solid var(--line-0);
  background: var(--bg-0);
  transition: opacity var(--t-med) var(--ease);
}
.ds-root .counters.refreshing { opacity: 0.55; }

.ds-root .is-busy {
  opacity: 0.7;
  cursor: progress;
  pointer-events: none;
}
.ds-root .is-busy::after {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 8px;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -1px;
  animation: ds-spin 0.7s linear infinite;
}
@keyframes ds-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .ds-root .is-busy::after { animation: none; }
}
.ds-root .counters .divider { width: 1px; background: var(--line-0); }

.ds-root .counter {
  text-align: left;
  padding: 22px 24px 22px 26px;
  border-left: 2px solid var(--line-1);
  background: transparent;
  flex: 1;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
  cursor: pointer;
  min-width: 0;
  border-top: 0; border-right: 0; border-bottom: 0;
  border-radius: 0;
}
.ds-root .counter.active { background: var(--bg-1); }
.ds-root .counter.active[data-state="healthy"] { border-left-color: var(--healthy); }
.ds-root .counter.active[data-state="risk"] { border-left-color: var(--risk); }
.ds-root .counter.active[data-state="broken"] { border-left-color: var(--broken); }
.ds-root .counter:hover:not(.active) { background: var(--bg-1); }
/* Informational counter (no data-dr-subs-filter): not clickable. */
.ds-root .counter:not([data-dr-subs-filter]) { cursor: default; }
.ds-root .counter:not([data-dr-subs-filter]):hover { background: transparent; }

.ds-root .counter-label {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.ds-root .counter-label span {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 500;
}
.ds-root .counter-n {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.ds-root .counter-n .num {
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-size: 32px;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--ink-0);
  font-weight: 500;
}
.ds-root .counter-n.zero .num { color: var(--ink-3); }
.ds-root .counter-n .hint { font-size: 12px; color: var(--ink-2); }

/* Table region */
.ds-root .table-region { margin-top: 44px; }

/* Search + rule chips row, sits between table-head and table-wrap. */
.ds-root .table-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  flex-wrap: wrap;
}
.ds-root .ds-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 1 320px;
  min-width: 220px;
}
.ds-root .ds-search .search-icon {
  position: absolute;
  left: 10px;
  color: var(--ink-2);
  pointer-events: none;
}
.ds-root .ds-search input[type="search"] {
  width: 100%;
  padding: 8px 30px 8px 32px;
  border: 1px solid var(--line-1);
  background: var(--bg-0);
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--ink-0);
  outline: 0;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.ds-root .ds-search input[type="search"]:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}
.ds-root .ds-search input[type="search"]::-webkit-search-cancel-button { display: none; }
.ds-root .ds-search .clear-search {
  position: absolute;
  right: 4px;
  background: transparent;
  border: 0;
  font-size: 18px;
  line-height: 1;
  color: var(--ink-2);
  padding: 4px 8px;
  cursor: pointer;
  border-radius: var(--r-sm);
}
.ds-root .ds-search .clear-search:hover { color: var(--ink-0); background: var(--bg-1); }

.ds-root .rule-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ds-root .rule-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid var(--line-1);
  background: var(--bg-0);
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-1);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.ds-root .rule-chip:hover { background: var(--bg-1); color: var(--ink-0); }
.ds-root .rule-chip.active {
  background: var(--ink-0);
  border-color: var(--ink-0);
  color: var(--bg-0);
}
.ds-root .rule-chip.active .dot { display: none; }
.ds-root .rule-chip .dot { width: 6px; height: 6px; }

/* Bulk-fix button: appears at the right of the toolbar when a rule chip
   is active and the rule supports bulk apply. Sized to match chips. */
.ds-root .bulk-fix-btn {
  margin-left: auto;
  font-size: 12px;
  padding: 6px 14px;
}
.ds-root .table-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.ds-root .table-head .left { display: flex; align-items: baseline; gap: 14px; }
.ds-root .table-head h2 { font-size: 15px; font-weight: 500; }
.ds-root .table-head .meta { font-size: 12px; color: var(--ink-2); }
.ds-root .table-head .clear { font-size: 12px; color: var(--ink-2); background: transparent; }
.ds-root .table-head .clear:hover { color: var(--ink-0); }

.ds-root .table-wrap {
  border: 1px solid var(--line-0);
  background: var(--bg-0);
}
.ds-root .ds-table .sub-id {
  font-family: var(--font-mono);
  color: var(--ink-1);
  text-decoration: none;
}
.ds-root .ds-table a.sub-id {
  color: var(--accent-ink);
  text-decoration: none;
}
.ds-root .ds-table a.sub-id .num {
  text-decoration: underline;
  text-decoration-color: var(--line-1);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.ds-root .ds-table a.sub-id:hover .num {
  text-decoration-color: var(--accent-ink);
}

/* External-link indicator icon. Used on any anchor that opens a new tab.
   Small, quiet, sits at the x-height baseline. */
.ds-root a.has-ext .ext-icon {
  display: inline-block;
  vertical-align: middle;
  margin-left: 3px;
  margin-top: -2px;
  opacity: 0.5;
  transition: opacity var(--t-fast) var(--ease);
}
.ds-root a.has-ext:hover .ext-icon,
.ds-root a.has-ext:focus-visible .ext-icon {
  opacity: 0.9;
}
.ds-root .ds-table .amount {
  color: var(--ink-3);
  margin-left: 10px;
  font-size: 12px;
}
.ds-root .ds-table .reason {
  color: var(--ink-1);
  max-width: 340px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ds-root .ds-table .action-cell { text-align: right; }
.ds-root .ds-table td.customer { font-weight: 500; }
.ds-root .ds-table .table-empty {
  text-align: center;
  color: var(--ink-2);
  padding: 32px;
}

/* All-healthy empty state */
.ds-root .all-clear {
  margin-top: 80px;
  text-align: left;
  max-width: 520px;
}
.ds-root .all-clear h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 40px;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.ds-root .all-clear p {
  margin-top: 14px;
  font-size: 14.5px;
  color: var(--ink-1);
}

/* ===========================================================
   Surface 3 - Fix preview modal
   =========================================================== */

.ds-root .modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: 99;
  animation: ds-fade-in var(--t-med) var(--ease) both;
}
.ds-root .modal {
  position: fixed;
  top: 10vh;
  left: 0;
  right: 0;
  margin-left: auto;
  margin-right: auto;
  width: 560px;
  max-width: calc(100vw - 48px);
  max-height: 80vh;
  overflow-y: auto;
  background: var(--bg-0);
  box-shadow: var(--sh-modal);
  border: 1px solid var(--line-0);
  border-radius: var(--r-lg);
  z-index: 100;
  animation: ds-fade-in var(--t-med) var(--ease) both;
}
.ds-root .modal-head {
  padding: 20px 28px 14px;
  border-bottom: 1px solid var(--line-0);
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}
.ds-root .modal-head .sub-id {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-2);
  text-decoration: none;
}
.ds-root .modal-head a.sub-id {
  color: var(--accent-ink);
  text-decoration: none;
}
.ds-root .modal-head a.sub-id .num {
  text-decoration: underline;
  text-decoration-color: var(--line-1);
  text-underline-offset: 3px;
}
.ds-root .modal-head a.sub-id:hover .num { text-decoration-color: var(--accent-ink); }
.ds-root .modal-head .customer {
  font-size: 15.5px;
  font-weight: 500;
  color: var(--ink-0);
}
.ds-root .modal-head .rule { margin-left: auto; }
.ds-root .modal-body { padding: 24px 28px; }
.ds-root .modal-body .narrative {
  font-size: 14.5px;
  color: var(--ink-0);
  line-height: 1.6;
  margin: 0 0 28px;
  max-width: 500px;
}
.ds-root .modal-body .narrative em {
  color: var(--accent-ink);
  font-style: italic;
  font-family: var(--font-display);
  font-size: 15.5px;
}

.ds-root .section-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 12px;
}

.ds-root .diff {
  border: 1px solid var(--line-0);
  border-radius: var(--r-md);
  background: var(--bg-0);
  overflow: hidden;
}
.ds-root .diff-row {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
  gap: 6px 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-0);
  font-size: 13.5px;
  align-items: start;
}
.ds-root .diff-row .field { grid-row: 1 / span 2; align-self: center; }
.ds-root .diff-row .before { grid-column: 2; grid-row: 1; }
.ds-root .diff-row .arrow { display: none; }
.ds-root .diff-row .after  { grid-column: 2; grid-row: 2; }
.ds-root .diff-row:last-child { border-bottom: 0; }
.ds-root .diff-row:nth-child(even) { background: var(--bg-1); }
.ds-root .diff-row .field {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 500;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Before - struck, clearly "old" but still readable */
.ds-root .diff-row .before {
  min-width: 0;
  color: var(--ink-1);
  text-decoration: line-through;
  text-decoration-color: var(--ink-strike);
  text-decoration-thickness: 1.5px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  opacity: 0.85;
  word-break: break-all;
  overflow-wrap: break-word;
}

.ds-root .diff-row .arrow {
  color: var(--accent);
  text-align: center;
  font-size: 14px;
  line-height: 1;
  font-weight: 600;
}

/* After - pops. Pill-like chip in the accent color. Fills the grid column
   (min-width: 0 + block flow), breaks long tokens at character boundaries
   so things like `woocommerce_scheduled_subscription_payment` wrap cleanly
   instead of collapsing to 1ch wide. */
.ds-root .diff-row .after {
  display: block;
  min-width: 0;
  color: var(--accent-ink);
  background: var(--accent-weak);
  border: 1px solid var(--accent-line);
  padding: 4px 10px;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  word-break: break-all;
  overflow-wrap: break-word;
}
/* emph = materially improved state (e.g., broken -> active) */
.ds-root .diff-row .after.emph {
  color: var(--healthy-ink);
  background: var(--healthy-weak);
  border-color: var(--healthy-line);
}
.ds-root .diff-row .after .unchanged {
  color: var(--ink-2);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 400;
  margin-left: 8px;
  letter-spacing: 0.02em;
}
/* When the "after" just says "unchanged", dim the pill so the eye skips it. */
.ds-root .diff-row .after:has(.unchanged) {
  background: transparent;
  border-style: dashed;
  border-color: var(--line-1);
  color: var(--ink-2);
}

.ds-root .revert-note {
  margin-top: 18px;
  font-size: 12.5px;
  color: var(--ink-2);
  padding-left: 16px;
  border-left: 1px solid var(--line-1);
}

/* Executed-payment warning - for the revert UX concern resolution */
.ds-root .executed-warning {
  margin: 18px 0 0;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--risk-weak);
  color: var(--risk-ink);
  border: 1px solid var(--risk-line);
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.ds-root .executed-warning .icon { flex: 0 0 auto; margin-top: 2px; }
.ds-root .executed-warning .body { flex: 1; line-height: 1.5; }
.ds-root .executed-warning strong { font-weight: 500; }
.ds-root .executed-warning a { color: inherit; font-weight: 500; text-decoration-color: currentColor; }

.ds-root .modal-foot {
  padding: 18px 28px;
  background: var(--bg-1);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--line-0);
  position: sticky;
  bottom: 0;
}

/* ===========================================================
   Surface 4 - Fix history
   =========================================================== */

.ds-root .history {
  padding: 28px 44px 60px;
  max-width: 1200px;
  margin-inline: auto;
}
.ds-root .history-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}
.ds-root .history-head h1 {
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: -0.015em;
  font-weight: 400;
  margin: 0;
}
.ds-root .history-head .meta { font-size: 12px; color: var(--ink-2); }

.ds-root .history-filters {
  display: flex;
  gap: 18px;
  font-size: 12.5px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-0);
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.ds-root .history-filters .filter {
  color: var(--ink-2);
  padding: 4px 0;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  border-left: 0;
  border-right: 0;
  border-top: 0;
}
.ds-root .history-filters .filter:hover { color: var(--ink-1); }
.ds-root .history-filters .filter.active {
  color: var(--ink-0);
  border-bottom-color: var(--accent);
  font-weight: 500;
}
.ds-root .history-filters .count {
  color: var(--ink-3);
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}

.ds-root .entry {
  display: grid;
  grid-template-columns: 140px 1fr 120px auto;
  gap: 24px;
  align-items: baseline;
  padding: 18px 4px;
  border-bottom: 1px solid var(--line-0);
}
.ds-root .entry .when {
  color: var(--ink-2);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.ds-root .entry .who { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ds-root .entry .who .name { font-size: 14.5px; font-weight: 500; }
.ds-root .entry .who .sub {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
  text-decoration: none;
}
.ds-root .entry .who a.sub {
  color: var(--accent-ink);
  text-decoration: none;
}
.ds-root .entry .who a.sub .num {
  text-decoration: underline;
  text-decoration-color: var(--line-1);
  text-underline-offset: 3px;
}
.ds-root .entry .who a.sub:hover .num { text-decoration-color: var(--accent-ink); }
.ds-root .entry .summary {
  color: var(--ink-1);
  font-size: 13.5px;
  margin-top: 6px;
  grid-column: 2 / 3;
  line-height: 1.5;
  max-width: 560px;
}
.ds-root .entry.reverted .when,
.ds-root .entry.reverted .who .name,
.ds-root .entry.reverted .summary { color: var(--ink-2); }
.ds-root .entry .status { font-size: 11.5px; color: var(--ink-2); }
.ds-root .entry .action { justify-self: end; }

.ds-root .entry.batch {
  background: var(--bg-1);
  padding: 18px 16px;
  border-radius: var(--r-sm);
  grid-template-columns: 140px 1fr auto;
}
.ds-root .entry.batch .batch-head { font-size: 14px; font-weight: 500; }
.ds-root .entry.batch .batch-meta {
  font-size: 12.5px;
  color: var(--ink-2);
  margin-top: 4px;
}
.ds-root .entry.batch .batch-item-id {
  font-family: var(--font-mono);
  color: var(--ink-2);
  font-size: 12px;
}
.ds-root .entry.batch .batch-id-value {
  font-family: var(--font-mono);
  font-size: 12px;
}
.ds-root .entry .status.status--muted { color: var(--ink-3); }

.ds-root .history-empty { padding: 80px 0; max-width: 480px; }
.ds-root .history-empty h2 {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: -0.015em;
  font-weight: 400;
  margin: 0 0 10px;
}
.ds-root .history-empty p {
  color: var(--ink-1);
  font-size: 14px;
  line-height: 1.55;
}

/* ===========================================================
   Surface 5 - Settings
   =========================================================== */

.ds-root .settings {
  padding: 28px 44px 60px;
  max-width: 1200px;
  margin-inline: auto;
}
/* Form content stays narrow (720px reads better) but the surface itself
   matches dashboard/history width so its left edge aligns with theirs. */
.ds-root .settings > h1,
.ds-root .settings > .settings-group,
.ds-root .settings > .settings-foot {
  max-width: 720px;
}

/* Detection-rules cards on the settings page. One card per rule with a
   toggle + 2-line description (Detects / Fix). */
.ds-root .rules-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ds-root .rule-card {
  border: 1px solid var(--line-0);
  border-radius: var(--r-md);
  background: var(--bg-0);
  padding: 14px 16px;
}
.ds-root .rule-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}
.ds-root .rule-card-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ds-root .rule-card-title .name {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-0);
}
.ds-root .rule-card-title .bucket-tag {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-left: 4px;
}
.ds-root .rule-card-detects,
.ds-root .rule-card-fixes {
  font-size: 13px;
  color: var(--ink-1);
  line-height: 1.5;
  margin: 4px 0 0;
  max-width: 65ch;
}
.ds-root .rule-card-detects strong,
.ds-root .rule-card-fixes strong {
  color: var(--ink-0);
  font-weight: 500;
  margin-right: 4px;
}
.ds-root .settings h1 {
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: -0.015em;
  font-weight: 400;
  margin: 0 0 36px;
}

.ds-root .settings-group {
  padding: 28px 0;
  border-top: 1px solid var(--line-0);
}
.ds-root .settings-group:first-of-type { border-top: 0; padding-top: 0; }
.ds-root .settings-group h2 {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-1);
  margin: 0 0 10px;
}
.ds-root .settings-group .blurb,
.ds-root .settings-group .helper {
  max-width: 65ch;
}
.ds-root .settings-group .blurb {
  color: var(--ink-1);
  font-size: 14px;
  max-width: 520px;
  margin-bottom: 22px;
  line-height: 1.55;
}

.ds-root .field {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  padding: 14px 0;
  align-items: baseline;
}
.ds-root .field .label { font-size: 13.5px; font-weight: 500; }
.ds-root .field .label-with-help {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ds-root .help-btn-wrap { position: relative; display: inline-flex; }
.ds-root .help-btn {
  background: transparent;
  border: 1px solid var(--line-1);
  border-radius: 50%;
  width: 17px;
  height: 17px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  color: var(--ink-2);
  cursor: help;
  font-weight: 500;
  line-height: 1;
  font-family: var(--font-body);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.ds-root .help-btn:hover,
.ds-root .help-btn:focus-visible {
  background: var(--bg-2);
  color: var(--ink-0);
  border-color: var(--ink-2);
}
.ds-root .help-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-2px);
  padding: 12px 14px;
  background: var(--ink-0);
  color: var(--bg-0);
  font-size: 12.5px;
  line-height: 1.5;
  border-radius: var(--r-md);
  width: 280px;
  max-width: 80vw;
  box-shadow: var(--sh-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  z-index: 50;
  font-weight: 400;
  font-family: var(--font-body);
  text-align: left;
}
.ds-root .help-btn-wrap:hover .help-popover,
.ds-root .help-btn-wrap:focus-within .help-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.ds-root .field .helper {
  font-size: 12.5px;
  color: var(--ink-2);
  margin-top: 6px;
  max-width: 420px;
  line-height: 1.5;
}
.ds-root .field input[type="email"],
.ds-root .field input[type="text"],
.ds-root .field select {
  font-family: var(--font-body);
  font-size: 14px;
  padding: 9px 12px;
  border: 1px solid var(--line-1);
  border-radius: var(--r-md);
  background: var(--bg-0);
  color: var(--ink-0);
  width: 280px;
  max-width: 100%;
}
.ds-root .field input:focus-visible,
.ds-root .field select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: transparent;
}
.ds-root .field .error-msg {
  margin-top: 6px;
  font-size: 12px;
  color: var(--broken-ink);
}

/* Toggle switch */
.ds-root .toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 13.5px;
}
.ds-root .toggle input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
}
.ds-root .toggle .track {
  width: 34px;
  height: 20px;
  border-radius: 12px;
  background: var(--line-1);
  position: relative;
  transition: background var(--t-fast) var(--ease);
  flex-shrink: 0;
}
.ds-root .toggle .track::after {
  content: '';
  position: absolute;
  left: 2px; top: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--bg-0);
  transition: transform var(--t-fast) var(--ease);
  box-shadow: 0 1px 2px oklch(18% 0.015 210 / 0.15);
}
.ds-root .toggle input:checked + .track { background: var(--accent); }
.ds-root .toggle input:checked + .track::after { transform: translateX(14px); }

.ds-root .settings-foot {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line-0);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.ds-root .settings-foot .status {
  color: var(--ink-2);
  font-size: 12.5px;
  margin-left: 10px;
}
.ds-root .settings-foot .saved-flash {
  color: var(--healthy-ink);
  font-size: 13px;
  animation: ds-fade-in var(--t-med) var(--ease) both;
}

/* ===========================================================
   Icons - inline SVG helpers
   =========================================================== */

.ds-root .icon { display: inline-flex; align-items: center; justify-content: center; }

/* ===========================================================
   Utility: hide on small screens (used with responsive.css)
   =========================================================== */

.ds-root .hide-mobile { display: initial; }
.ds-root .mobile-only { display: none; }
