/* penso-harness — "technical manual" identity.
   Cool-paper surfaces, slate ink, cobalt accent; IBM Plex Serif for display,
   Plex Sans for body, Plex Mono for the product's own material (paths, shas,
   crons, ranks). Section labels read as markdown headings — the same headings
   the indexer chunks by. */

@font-face {
  font-family: 'IBM Plex Serif';
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/ibm-plex-serif-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
}

:root {
  color-scheme: light dark;
  --paper: light-dark(#f2f4f6, #10161e);
  --card: light-dark(#fcfdfe, #161e28);
  --ink: light-dark(#17212e, #e4e9ef);
  --ink-2: light-dark(#5a6b7e, #93a1b1);
  --line: light-dark(#d5dce4, #2a3542);
  --cobalt: light-dark(#1f4fd8, #7ea2ff);
  --cobalt-soft: light-dark(#e6ecfb, #1c2a4a);
  --on-cobalt: light-dark(#ffffff, #0d1320);
  --amber: light-dark(#b26e00, #e0a44c);
  --green: light-dark(#1e7a4d, #57b884);
  --red: light-dark(#b3352b, #e06c5f);
  --code-bg: light-dark(#e9edf2, #0c1117);
  --shadow: 0 1px 2px light-dark(rgba(23, 33, 46, 0.06), transparent),
    0 4px 14px light-dark(rgba(23, 33, 46, 0.05), transparent);
  --control-h: 2.4rem; /* form-row controls: inputs, selects, buttons */
  --control-h-sm: 2rem; /* compact contexts: card heads, table actions */
  --serif: 'IBM Plex Serif', 'Iowan Old Style', Georgia, serif;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}
/* Explicit user choice pins the scheme; unset data-theme follows the OS. */
:root[data-theme='light'] { color-scheme: light; }
:root[data-theme='dark'] { color-scheme: dark; }

/* .icon-btn is defined later with equal specificity: the compound
   selector keeps the size from being overridden by source order. */
.icon-btn.theme-toggle { font-size: 1.7rem; padding: 0.1rem 0.5rem; line-height: 1; display: inline-flex; align-items: center; }
.theme-toggle::before { content: '◐'; }
:root[data-theme='light'] .theme-toggle::before { content: '☀'; }
:root[data-theme='dark'] .theme-toggle::before { content: '☾'; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  background: var(--paper);
  color: var(--ink);
}
a { color: var(--cobalt); text-decoration-thickness: 1px; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; border-radius: 2px; }

/* ---- chrome ------------------------------------------------------------ */

.demo-banner {
  font-family: var(--mono);
  font-size: 0.8rem;
  text-align: center;
  padding: 0.4rem 1rem;
  background: color-mix(in srgb, var(--amber) 14%, var(--paper));
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.8rem 1.4rem;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.topbar nav { display: flex; gap: 1.1rem; align-items: center; }
.topbar nav a { color: var(--ink-2); text-decoration: none; font-size: 0.95rem; }
.topbar nav a:hover { color: var(--cobalt); }
.brand {
  font-family: var(--mono);
  font-size: 1.02rem;
  font-weight: 400;
  text-decoration: none;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.brand { display: inline-flex; align-items: center; gap: 0.45rem; }
.brand img { display: block; }

.crumbs { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.crumb-sep { color: var(--ink-2); }
.crumbs .crumb {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crumbs a.crumb:hover { color: var(--cobalt); }
.crumbs .crumb.current { color: var(--ink); }

.user-menu { position: relative; }
.user-menu summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.9rem 0.3rem 0.35rem;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { border-color: var(--cobalt); }
.user-menu .avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.user-menu .avatar.initial {
  background: var(--cobalt);
  color: var(--on-cobalt);
  font-size: 0.9rem;
  font-weight: 600;
}
.user-menu .user-name { font-size: 0.95rem; }
.user-menu .menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 11rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 0.35rem;
  z-index: 50;
}
.user-menu .menu form { margin: 0; }
.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font-family: var(--sans);
  font-size: 0.92rem;
  color: var(--ink);
  text-decoration: none;
  padding: 0.45rem 0.7rem;
  border-radius: 7px;
  cursor: pointer;
}
.menu-item:hover { background: var(--cobalt-soft); color: var(--cobalt); }

.container { max-width: 1400px; margin: 0 auto; padding: 1.6rem 1.25rem 3rem; }
.container-narrow { max-width: 980px; margin: 0 auto; }

/* Overview: usage and repositories side by side with pseudo-fixed heights.
   minmax(0, …) is mandatory — tables otherwise blow the grid tracks. */
.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 1.1rem;
  align-items: start;
}
.overview-grid > .card { margin: 0.9rem 0 0; display: flex; flex-direction: column; }
.overview-grid > .card > .card-body-scroll { overflow-y: auto; max-height: 30rem; }
@media (max-width: 1000px) {
  .overview-grid { grid-template-columns: minmax(0, 1fr); }
}

footer.site {
  margin-top: 2.5rem;
  padding: 1rem 1.4rem 1.6rem;
  font-size: 0.78rem;
  color: var(--ink-2);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  opacity: 0.75;
}
footer.site a { color: var(--ink-2); }
footer.site a:hover { color: var(--cobalt); }

/* ---- type -------------------------------------------------------------- */

h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.9rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0.2rem 0 0.8rem;
}
.muted { color: var(--ink-2); }
.eyebrow {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink-2);
  margin: 0 0 0.4rem;
}
.eyebrow::before { content: '# '; color: var(--cobalt); }

/* Section labels read as markdown headings — the app's signature. */
.card h3 {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  color: var(--ink-2);
  text-transform: lowercase;
  margin: 0 0 0.9rem;
}
.card h3::before { content: '# '; color: var(--cobalt); }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}
.card-head h3 { margin: 0; }
.card-actions { display: inline-flex; align-items: center; gap: 0.4rem; }
.card-actions a.icon-btn { text-decoration: none; font-size: 1.45rem; line-height: 1; }
.add-repo { margin-top: 0.9rem; }
.settings-sub { font-family: var(--mono); font-size: 0.85rem; color: var(--ink-2); text-transform: lowercase; margin: 1.1rem 0 0.4rem; }
/* Settings rows: label + hint left, control right, divider between rows. */
.setting {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 5fr);
  gap: 1.2rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}
.setting:first-of-type { margin-top: 0.8rem; }
.setting-info h4 { margin: 0 0 0.25rem; font-size: 0.95rem; }
.setting-info p { margin: 0; font-size: 0.86rem; }
.setting-control { min-width: 0; }
.setting-control .schedule-form,
.setting-control .filter-form { margin: 0; }
@media (max-width: 760px) {
  .setting { grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
}

.identity-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
/* One aligned block: presets on top, then label | control rows sharing a
   fixed label column so the two selects line up. */
.sharing-stack { display: flex; flex-direction: column; gap: 0.65rem; }
.sharing-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.sharing-label {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-2);
  width: 6.5rem;
  flex-shrink: 0;
}
.setting-steps {
  margin: 0.2rem 0 0.4rem;
  padding-left: 1.1rem;
  font-size: 0.85rem;
}
.setting-steps li { margin-bottom: 0.3rem; }

.seg-desc {
  flex-basis: 100%;
  margin-left: 7rem; /* aligns under the pills, past the 6.5rem label */
  font-size: 0.82rem;
}
@media (max-width: 760px) { .setting-steps {
  margin: 0.2rem 0 0.4rem;
  padding-left: 1.1rem;
  font-size: 0.85rem;
}
.setting-steps li { margin-bottom: 0.3rem; }

.seg-desc { margin-left: 0; } }
.org-select { display: flex; flex-direction: column; gap: 0.55rem; }
/* Multi-select chips in the same visual language as the segmented pills. */
.org-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.org-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.32rem 0.85rem;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink-2);
  background: var(--card);
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.org-chip:hover { border-color: var(--cobalt); color: var(--cobalt); }
.org-chip input { position: absolute; opacity: 0; pointer-events: none; }
.org-chip .provider-icon { width: 14px; height: 14px; }
.org-chip:has(input:checked) {
  background: var(--cobalt);
  border-color: var(--cobalt);
  color: var(--on-cobalt);
  font-weight: 600;
}
.org-chip:has(input:checked) .provider-icon,
.org-chip:has(input:checked) .provider-icon.bitbucket { fill: var(--on-cobalt); }
.org-chip:has(input:focus-visible) { outline: 2px solid var(--cobalt); outline-offset: 2px; }
.org-manual { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.members-table .owner-row td { background: color-mix(in srgb, var(--cobalt) 5%, transparent); }
.shared-heading { font-size: 1.1rem; margin: 1.6rem 0 0.5rem; }
.shared-list { list-style: none; padding: 0; margin: 0; }
.shared-list li { display: flex; align-items: center; gap: 0.6rem; padding: 0.35rem 0; }
.members-table select { font-size: 0.82rem; height: var(--control-h-sm); padding: 0 0.4rem; }
.disclosure {
  background: none;
  border: none;
  color: var(--ink-2);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
}
.disclosure:hover { color: var(--cobalt); }

.sharing-seg { margin-top: 0; background: var(--card); }
.sharing-seg span { transition: background 120ms ease, color 120ms ease; }
.sharing-seg span:hover { color: var(--cobalt); }
.sharing-seg input:checked + span {
  background: var(--cobalt);
  color: var(--on-cobalt);
  font-weight: 600;
}

/* Sync filter editor: chips with origin hues over the raw fallback. */
.filter-editor { display: flex; flex-direction: column; gap: 0.55rem; min-width: 0; }
.fe-status { margin: 0; }
.fe-hint { margin: 0; font-size: 0.82rem; }
.fe-side-title {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-2);
  margin-top: 0.3rem;
}
.fe-side-title::first-letter { color: var(--cobalt); }
.filter-chip.fe-include { border-left-color: var(--green); }
/* One pattern per row so the list reads clearly. */
.fe-chips { display: flex; flex-direction: column; gap: 0.3rem; align-items: stretch; max-width: 26rem; }
.filter-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.24rem 0.3rem 0.24rem 0.55rem;
  font-size: 0.82rem;
  background: var(--card);
}
.filter-chip code { background: none; padding: 0; }
.filter-chip.origin-system { border-left: 3px solid var(--ink-2); }
.filter-chip.origin-user { border-left: 3px solid var(--green); }
.filter-chip.origin-harness { border-left: 3px solid var(--cobalt); }
.filter-chip.origin-repo, .filter-chip.origin-override { border-left: 3px solid var(--amber); }
.chip-tail { display: inline-flex; align-items: center; gap: 0.35rem; }
.origin-badge {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  white-space: nowrap;
}
.origin-badge.origin-system { color: var(--ink-2); }
.origin-badge.origin-user { color: var(--green); border-color: color-mix(in srgb, var(--green) 45%, var(--line)); }
.origin-badge.origin-harness { color: var(--cobalt); border-color: color-mix(in srgb, var(--cobalt) 45%, var(--line)); }
.origin-badge.origin-repo { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, var(--line)); }

.fe-remove {
  background: none;
  border: none;
  color: var(--ink-2);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0 0.2rem;
}
.fe-remove:hover { color: var(--red); }
.fe-row { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.fe-input { width: 15rem; }
.fe-preset { font-size: 0.78rem; padding: 0 0.5rem; min-height: 1.7rem; }
.fe-preset code { background: none; padding: 0; font-size: inherit; }
.fe-none { display: flex; align-items: center; gap: 0.45rem; font-size: 0.85rem; color: var(--ink-2); }
.fe-raw { flex: 1; min-width: 14rem; font-family: var(--mono); font-size: 0.82rem;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line);
  border-radius: 7px; padding: 0.4rem 0.6rem; }
.fe-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.2rem; }
.fe-actions .primary[disabled], .fe-actions .btn[disabled] { opacity: 0.45; cursor: default; }
.fe-raw-wrap { display: block; }
/* Test-a-path: its own bordered box, apart from the editing surface. */
.fe-test {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin-top: 0.4rem;
  max-width: 34rem;
}
.fe-test-title {
  display: block;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-2);
  margin-bottom: 0.4rem;
}
.fe-test-title::first-letter { color: var(--cobalt); }
.fe-verdict { font-size: 0.85rem; }
.fe-verdict .ok { color: var(--green); }
.fe-verdict .no { color: var(--red); }

.filter-form { display: flex; align-items: flex-start; gap: 0.5rem; flex-wrap: wrap; }
.filter-form textarea {
  font-family: var(--mono);
  font-size: 0.82rem;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.5rem 0.65rem;
  min-width: min(28rem, 100%);
}
.filter-form textarea:focus { border-color: var(--cobalt); outline: none; }

.card.featured {
  border-color: color-mix(in srgb, var(--cobalt) 45%, var(--line));
  box-shadow: 0 0 0 3px var(--cobalt-soft), var(--shadow);
}

.search-pill {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 1.1rem;
  height: 3rem;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.search-pill:focus-within {
  border-color: var(--cobalt);
  box-shadow: 0 0 0 3px var(--cobalt-soft);
}
.search-pill .search-icon { width: 18px; height: 18px; color: var(--ink-2); flex: none; }
.search-pill input {
  flex: 1;
  border: none;
  background: none;
  font-family: var(--sans);
  font-size: 1.02rem;
  color: var(--ink);
  height: 100%;
}
.search-pill input:focus { outline: none; }

.mode-seg {
  display: inline-flex;
  margin-top: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.mode-seg label { display: contents; }
.mode-seg input { position: absolute; opacity: 0; pointer-events: none; }
.mode-seg span {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-2);
  padding: 0.35rem 0.95rem;
  cursor: pointer;
  border-right: 1px solid var(--line);
}
.mode-seg label:last-child span { border-right: none; }
.mode-seg input:checked + span { background: var(--cobalt-soft); color: var(--cobalt); }
.mode-seg input:focus-visible + span { outline: 2px solid var(--cobalt); outline-offset: -2px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.card.danger { border-color: color-mix(in srgb, var(--red) 45%, var(--line)); }
.card.danger h3::before { color: var(--red); }
.danger-link { text-align: right; }
.danger-link a { color: var(--ink-2); font-size: 0.85rem; }
.danger-link a:hover { color: var(--red); }
.button.danger-btn { background: var(--red); color: #fff; }

/* ---- surfaces ---------------------------------------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.15rem 1.35rem;
  margin: 0.9rem 0;
  box-shadow: var(--shadow);
}
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
@media (max-width: 900px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
}
.grid .card {
  margin: 0;
  position: relative;
  transition: border-color 120ms ease;
  display: flex;
  flex-direction: column;
  min-height: 22rem;
  padding: 1.7rem 2rem;
}
.card-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; }
.card-title-row h3 { margin: 0; }
.card-title-row .badge { flex-shrink: 0; }
.card-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 3.2em;
}
.card-created { font-size: 0.8rem; margin: 0.3rem 0 0; }
.grid .card .card-created { margin-top: auto; }
.grid .card:has(.card-link):hover { border-color: var(--cobalt); }
/* Stretched link: the whole card is the click target… */
.card-link::after { content: ''; position: absolute; inset: 0; }
/* …while real controls stay above it. */
.grid .card .copy-btn, .grid .card .endpoint-row code { position: relative; z-index: 1; }
.grid .card h3 { font-family: var(--sans); font-size: 1.05rem; font-weight: 600; color: var(--ink); text-transform: none; }
.grid .card h3::before { content: none; }
.grid .card h3 a { color: var(--ink); text-decoration: none; }
.grid .card h3 a:hover { color: var(--cobalt); }

.card-new {
  border-style: dashed;
  background: transparent;
  box-shadow: none;
}
.card-new summary {
  cursor: pointer;
  font-family: var(--mono);
  color: var(--cobalt);
  list-style: none;
}
.card-new summary::-webkit-details-marker { display: none; }
.card-new summary::before { content: '+ '; }
.card-new[open] summary { margin-bottom: 0.8rem; }
.endpoint-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-2);
  margin: 0 0 0.3rem;
}
.endpoint-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.6rem;
  min-width: 0;
}
/* Inline variant: the label sits on the same row as the URL. */
.endpoint-row .endpoint-label { margin: 0; flex-shrink: 0; }
.endpoint-row code {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
}
.copy-btn {
  font-family: var(--mono);
  font-size: 0.72rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink-2);
  padding: 0.14rem 0.5rem;
  cursor: pointer;
  white-space: nowrap;
}
.copy-btn:hover { border-color: var(--cobalt); color: var(--cobalt); }

table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.75rem;
  text-transform: lowercase;
  color: var(--ink-2);
}
th, td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; }

/* ---- controls ---------------------------------------------------------- */

.button, button.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-weight: 600;
  background: var(--cobalt);
  color: var(--on-cobalt);
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 1.15rem;
  min-height: var(--control-h);
  box-sizing: border-box;
  font-size: 0.98rem;
  text-decoration: none;
  cursor: pointer;
  transition: filter 120ms ease;
}
.button:hover, button.primary:hover { filter: brightness(1.08); }
.button.ghost {
  background: transparent;
  color: var(--cobalt);
  border-color: var(--line);
}
.button.ghost:hover { border-color: var(--cobalt); filter: none; }
.button.provider {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  min-width: 16.5rem;
  justify-content: center;
}
.button.provider:hover { border-color: var(--cobalt); color: var(--cobalt); filter: none; }
.button.provider svg { width: 18px; height: 18px; fill: currentColor; }

.copied { color: var(--green) !important; }
button.link {
  background: none;
  border: none;
  color: var(--cobalt);
  cursor: pointer;
  font-size: 0.93rem;
  font-family: var(--sans);
  padding: 0;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
/* Compact real buttons for row/table actions; .link stays navigation-only. */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 0.65rem;
  min-height: var(--control-h-sm);
  box-sizing: border-box;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 120ms ease, color 120ms ease;
}
/* Buttons sitting in form rows rise to the full control height so every
   row reads as one line. Icon buttons in tables stay compact. */
.schedule-form .btn,
.filter-form .btn,
.member-add .btn,
.picker-toolbar .primary,
.sharing-form .primary,
.member-add .primary {
  height: var(--control-h);
}
.btn:hover { border-color: var(--cobalt); color: var(--cobalt); }
.btn.icon { padding: 0.32rem 0.42rem; }
.btn.icon svg { width: 16px; height: 16px; display: block; }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); background: color-mix(in srgb, var(--red) 8%, transparent); }
form.inline { display: inline; }
label { font-size: 0.93rem; color: var(--ink-2); }
input[type='text'], input[type='search'], select {
  font-family: var(--mono);
  font-size: 0.9rem;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 0.65rem;
  height: var(--control-h);
  box-sizing: border-box;
}
/* The Google-style search pill sizes its own input. */
.search-pill input[type='search'] { height: 100%; padding: 0; }
input:focus, select:focus { border-color: var(--cobalt); outline: none; }

.page-head { margin-bottom: 0.2rem; }
.page-head h1 { margin-bottom: 0.1rem; display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.page-head .connect-btn { margin-left: auto; }
.page-head .desc { margin: 0; }
.icon-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--ink-2);
  font-size: 0.85em;
  cursor: pointer;
  padding: 0.05rem 0.35rem;
  vertical-align: middle;
}
.icon-btn:hover { color: var(--cobalt); border-color: var(--line); }
/* Edit pencils stay invisible until their context is hovered (or focused
   via keyboard); pointer-less devices keep them always visible. */
.icon-btn.pencil { opacity: 0; transition: opacity 120ms ease; }
h1:hover .pencil,
.desc:hover .pencil,
tr:hover .pencil,
.icon-btn.pencil:focus-visible { opacity: 1; }
@media (hover: none) {
  .icon-btn.pencil { opacity: 1; }
}
.icon-btn.warn:hover { color: var(--red); }
.desc form[data-inline-edit] { display: inline-flex; align-items: center; gap: 0.35rem; }
.edit-input {
  font: inherit;
  color: inherit;
  background: var(--paper);
  border: 1px solid var(--cobalt);
  border-radius: 6px;
  padding: 0.15rem 0.5rem;
  min-width: min(24rem, 70vw);
}

dialog.modal {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
  max-width: 32rem;
  box-shadow: var(--shadow);
}
dialog.modal::backdrop { background: rgb(0 0 0 / 0.45); }
/* Dialog titles carry their own literal '# ' — kill the card's ::before
   so a dialog nested in a card doesn't get a doubled marker. */
dialog.modal h3::before { content: none; }
dialog.modal h3 {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--ink-2);
  margin: 0 0 0.7rem;
}
dialog.modal.modal-wide { max-width: min(46rem, 92vw); width: 100%; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.modal-head h3 { margin: 0; }
dialog.modal form { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
dialog.modal input[type='text'] { flex: 1; min-width: 12rem; }

.inline-edit {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 0.5rem 0;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}
.inline-edit.warn { border-color: color-mix(in srgb, var(--red) 45%, var(--line)); }
.inline-edit .warn-note { flex-basis: 100%; margin: 0; font-size: 0.85rem; }

/* ---- data & status ----------------------------------------------------- */

.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.74rem;
  border-radius: 5px;
  padding: 0.08rem 0.5rem;
  border: 1px solid var(--line);
  color: var(--ink-2);
  background: var(--paper);
}
.badge.success { color: var(--green); border-color: color-mix(in srgb, var(--green) 45%, var(--line)); }
.badge.error { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, var(--line)); }
.badge.skipped { color: var(--ink-2); }
.badge.warn { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, var(--line)); }
.badge.running {
  color: var(--amber);
  border-color: color-mix(in srgb, var(--amber) 45%, var(--line));
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.45; } }

.status-line { display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ink-2);
  flex-shrink: 0;
}
.status-dot.success { background: var(--green); }
.status-dot.error { background: var(--red); }
.status-dot.running { background: var(--amber); animation: pulse 1.6s ease-in-out infinite; }
.status-error { font-size: 0.8rem; max-width: 22rem; overflow-wrap: anywhere; }

.callout {
  border: 1px solid var(--line);
  border-left: 3px solid var(--cobalt);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  margin: 0.8rem 0;
}
.callout.warn { border-left-color: var(--amber); }
.callout p { margin: 0.25rem 0; }

.pager { display: flex; align-items: center; gap: 0.7rem; margin: 0.7rem 0 0; }
.pager button[disabled] { opacity: 0.45; cursor: default; }

.stats-toolbar {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin: 0.4rem 0 0.2rem;
  flex-wrap: wrap;
}
.stats-toolbar label { display: inline-flex; align-items: center; gap: 0.5rem; }

.usage-headline { margin: 0 0 0.5rem; font-size: 1.02rem; }
.usage-headline strong { font-size: 1.35rem; }
.usage-methods td:first-child { width: 60%; }
.never-returned { columns: 2; font-size: 0.85rem; margin: 0.4rem 0 0; }
@media (max-width: 800px) { .never-returned { columns: 1; } }

th[data-sort-col] { cursor: pointer; user-select: none; white-space: nowrap; }
td code { white-space: nowrap; }
th[data-sort-col]:hover { color: var(--cobalt); }
th[data-dir='asc']::after { content: ' ▲'; font-size: 0.7em; }
th[data-dir='desc']::after { content: ' ▼'; font-size: 0.7em; }
.table-search { width: 100%; max-width: 26rem; }
/* Header variant: narrow at rest, expands while focused (or non-empty). */
.head-search {
  width: 9rem;
  max-width: 40vw;
  height: var(--control-h-sm);
  padding: 0 0.6rem;
  font-size: 0.82rem;
  transition: width 180ms ease;
}
.head-search:focus,
.head-search:not(:placeholder-shown) {
  width: 22rem;
}
.explorer-bar { display: flex; align-items: center; gap: 1rem; margin: 0.3rem 0 0.6rem; }
/* Right-anchored: the expanding search eats the middle space instead of
   pushing the sync info around. */
.explorer-bar p { margin: 0 0 0 auto; }
.picker-toolbar { display: flex; gap: 0.7rem; align-items: center; margin: 0.4rem 0 0.7rem; }
.picker-check { width: 2rem; }
.picker-check input { width: 1.05rem; height: 1.05rem; }
.picker label { cursor: pointer; display: block; }
.picker label .provider-icon { margin-right: 0.35rem; }
tr.no-matches td { padding: 0.9rem 0.5rem; }

.doc-view-seg { display: inline-flex; gap: 0.25rem; }

/* Document header: provider mark, owner/repo, clickable path, subtle sha. */
.doc-head { border-bottom: 1px solid var(--line); padding-bottom: 0.7rem; }
.doc-head h3.doc-file {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 400;
  text-transform: none;
  color: var(--ink);
  min-width: 0;
}
.doc-head h3.doc-file::before { content: none; }
.doc-file .doc-repo { color: var(--ink-2); }
.doc-file a {
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.doc-file a:hover { color: var(--cobalt); text-decoration: underline; }
.page-repo-title { display: flex; align-items: center; gap: 0.6rem; }
.page-repo-title .provider-icon { width: 24px; height: 24px; fill: var(--ink); }
.page-repo-title .provider-icon.bitbucket { fill: #2684ff; }
.page-repo-title a { color: var(--ink); text-decoration: none; }
.page-repo-title a:hover { color: var(--cobalt); }

.doc-sha {
  font-size: 0.72rem;
  color: var(--ink-2);
  opacity: 0.55;
  background: none;
}
.btn.active { border-color: var(--cobalt); color: var(--cobalt); }

/* Sanitized markdown rendering, technical-manual typography. */
.doc-rendered { max-width: 60rem; line-height: 1.65; }
.doc-rendered h1, .doc-rendered h2, .doc-rendered h3,
.doc-rendered h4, .doc-rendered h5, .doc-rendered h6 { font-family: var(--serif); line-height: 1.25; }
.doc-rendered h1 { font-size: 1.5rem; }
.doc-rendered h2 { font-size: 1.25rem; border-bottom: 1px solid var(--line); padding-bottom: 0.25rem; }
.doc-rendered h3 { font-size: 1.05rem; }
.doc-rendered pre {
  font-family: var(--mono);
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.55;
}
.doc-rendered code {
  font-family: var(--mono);
  background: var(--code-bg);
  border-radius: 4px;
  padding: 0.1em 0.3em;
  font-size: 0.86em;
}
.doc-rendered pre code { background: none; padding: 0; font-size: inherit; }
.doc-rendered blockquote {
  border-left: 3px solid var(--line);
  margin-left: 0;
  padding-left: 1rem;
  color: var(--ink-2);
}
.doc-rendered table { border-collapse: collapse; display: block; overflow-x: auto; }
.doc-rendered th, .doc-rendered td { border: 1px solid var(--line); padding: 0.3rem 0.65rem; }
.doc-rendered th { background: var(--code-bg); }
.doc-rendered img { max-width: 100%; }
.doc-rendered a { color: var(--cobalt); }
.doc-rendered hr { border: none; border-top: 1px solid var(--line); }

pre.log {
  font-family: var(--mono);
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.55;
  max-height: 24rem;
}
code, code.endpoint {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.12rem 0.4rem;
  word-break: break-all;
}

.flash { border-left: 3px solid var(--cobalt); padding: 0.55rem 1rem; margin: 0.75rem 0; background: var(--cobalt-soft); border-radius: 0 7px 7px 0; }
.flash.error { border-color: var(--red); background: color-mix(in srgb, var(--red) 8%, var(--card)); }

.docs-table .dir-row td {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink);
  background: var(--code-bg);
  border-bottom: 1px solid var(--line);
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  user-select: none;
}
.dir-line { display: flex; align-items: center; gap: 0.45rem; }
.dir-chev::before { content: '▾'; color: var(--ink-2); font-size: 0.7rem; }
.dir-row[data-collapsed] .dir-chev::before { content: '▸'; }
.dir-icon { width: 15px; height: 15px; color: var(--cobalt); flex-shrink: 0; }
.dir-name { font-weight: 600; }
.dir-count { margin-left: auto; font-size: 0.75rem; }
.docs-table .dir-row:hover .dir-name { color: var(--cobalt); }
.file-reads { white-space: nowrap; text-align: right; }
.file-reads-none { opacity: 0.45; }
tr[data-href] { cursor: pointer; }
tr[data-href]:hover td { background: color-mix(in srgb, var(--cobalt) 6%, transparent); }
.doc-title { font-family: var(--mono); font-size: 1.2rem; word-break: break-all; }
pre.doc-content {
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: none;
  background: var(--paper);
  border: none;
  padding: 0;
}
.provider-cell { width: 2rem; }
.provider-icon { width: 16px; height: 16px; fill: var(--ink-2); vertical-align: middle; }
.origin-link .provider-icon { width: 13px; height: 13px; vertical-align: -2px; }
.provider-icon.bitbucket { fill: #2684ff; }

.picker-desc { font-size: 0.83rem; }
.picker-meta { font-family: var(--mono); font-size: 0.75rem; white-space: nowrap; }
.picker-add { display: flex; gap: 0.4rem; align-items: center; }

/* ---- search results: catalog cards ------------------------------------- */

.search-result { margin-bottom: 0.9rem; }
.search-result .path {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-2);
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 0.5rem;
}
.search-result .path .repo-name { color: var(--ink); }
.search-result .path a { color: var(--cobalt); text-decoration: none; }
.search-result .path a:hover { text-decoration: underline; }

.snippet-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  margin: 0.45rem 0;
  background: var(--paper);
}
.snippet-box .crumb-line {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--cobalt);
  margin-bottom: 0.3rem;
}
.snippet-body {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.snippet-body code {
  font-size: 0.85em;
  padding: 0.05rem 0.3rem;
}
mark {
  background: color-mix(in srgb, var(--cobalt) 22%, transparent);
  color: inherit;
  font-weight: 600;
  border-radius: 3px;
  padding: 0 0.1em;
}

.connect-item {
  border-top: 1px solid var(--line);
  padding: 0.55rem 0;
}
.connect-item summary {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--ink);
  list-style: none;
}
.connect-item summary::-webkit-details-marker { display: none; }
.connect-item summary::before { content: '› '; color: var(--cobalt); }
.connect-item[open] summary::before { content: '▾ '; }
.connect-item[open] summary { margin-bottom: 0.5rem; }
.snippet-row { display: flex; gap: 0.5rem; align-items: flex-start; }
.snippet-row pre.log { flex: 1; margin: 0; }

/* ---- usage charts ------------------------------------------------------ */

.usage-chart svg { width: 100%; height: auto; display: block; }
.usage-chart .bar { fill: var(--cobalt); }
.usage-chart .bar:hover { fill: color-mix(in srgb, var(--cobalt) 80%, var(--ink)); }
.usage-chart .grid { stroke: var(--line); stroke-dasharray: 3 3; stroke-width: 1; }
.usage-chart .axis { stroke: var(--line); stroke-width: 1; }
.usage-chart .chart-label,
.usage-chart .chart-tick {
  font-family: var(--mono);
  font-size: 9px;
  fill: var(--ink-2);
}
.usage-total { font-size: 0.82rem; margin: 0.4rem 0 0; }

.usage-sub {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--ink-2);
  margin: 1.1rem 0 0.3rem;
}
.usage-repos td { border-bottom: none; padding: 0.25rem 0.6rem 0.25rem 0; font-size: 0.88rem; }
.usage-repos .spark-cell { width: 110px; }
.usage-repos .spark-cell svg { display: block; }
.usage-repos .top-docs-row td { padding-top: 0; padding-bottom: 0.5rem; }
.top-doc {
  font-family: var(--mono);
  font-size: 0.76rem;
  margin-right: 0.7rem;
  white-space: nowrap;
}

.sparkline-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.sparkline-row .muted { font-family: var(--mono); font-size: 0.75rem; }
.sparkline path { fill: none; stroke: var(--cobalt); stroke-width: 1.5; }

/* ---- hero & landing ---------------------------------------------------- */

.hero { text-align: center; padding: 3.2rem 0 2rem; }
.hero h1 { font-size: 2.2rem; }
.hero p { color: var(--ink-2); max-width: 40rem; margin: 0.8rem auto; }

.landing-hero { text-align: center; padding: 3.4rem 0 1.6rem; animation: rise 500ms ease both; }
.landing-hero h1 { font-size: 2.6rem; max-width: 46rem; margin-inline: auto; }
.landing-hero .lede { color: var(--ink-2); max-width: 42rem; margin: 1rem auto 1.6rem; font-size: 1.06rem; }
.landing-hero .cta { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }

.specimen {
  max-width: 40rem;
  margin: 2rem auto;
  text-align: left;
  animation: rise 500ms ease 120ms both;
}
.specimen-query { font-family: var(--mono); font-size: 0.88rem; color: var(--ink-2); }
.specimen-query::before { content: '❯ '; color: var(--cobalt); }
.specimen-result {
  border-top: 1px solid var(--line);
  margin-top: 0.8rem;
  padding-top: 0.8rem;
}
.specimen-result .path {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-2);
  margin-bottom: 0.35rem;
}
.specimen-result .path .crumb { color: var(--cobalt); }
.specimen-result p { margin: 0.3rem 0 0.6rem; }
.specimen-caption {
  font-size: 0.85rem;
  color: var(--ink-2);
  border-top: 1px solid var(--line);
  margin-top: 0.9rem;
  padding-top: 0.7rem;
}

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin: 1.6rem 0; }
.features .card { margin: 0; }
.features .card p { font-size: 0.92rem; color: var(--ink-2); margin: 0; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .landing-hero, .specimen { animation: none; }
  .badge.running, .status-dot.running { animation: none; }
}

@media (max-width: 640px) {
  .landing-hero h1 { font-size: 2rem; }
  .hero h1 { font-size: 1.8rem; }
  .container { padding-top: 1rem; }
}
