/* Signed-in app pages. Built on the site's base stylesheet (site-base.css from packages/brand/ui): same tokens,
   type, nav, footer, buttons, chips, forms and collapsibles. This file only adds what the app screens need.
   Colours only through the base tokens. Light only, like the site. */
:root { color-scheme: light; }
[hidden] { display: none !important; }
body { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; }

/* nav: the site's shell, signed-in variant */
.brand { display: inline-flex; align-items: center; gap: 10px; font: 700 21px/1 var(--sans); letter-spacing: -0.04em; text-decoration: none; color: var(--ink); flex: none; }
.brand svg { width: 26px; height: 26px; display: block; flex: none; }
.crumb { color: var(--line); font-size: 22px; font-weight: 400; margin: 0 -14px; }
.acct { position: relative; }
.acct summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 999px; font: 600 14.5px/1 var(--sans); color: var(--ink); background: var(--paper); max-width: 46vw; }
.acct summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.acct summary img { width: 20px; height: 20px; border-radius: 50%; flex: none; }
.acct summary::after { content: ""; flex: none; width: 7px; height: 7px; margin: -3px 2px 0 2px; border-right: 2px solid var(--mute); border-bottom: 2px solid var(--mute); transform: rotate(45deg); }
.acct summary::-webkit-details-marker { display: none; }
.acct[open] summary { border-color: var(--ink); }
.acct .menu-panel { left: 0; right: auto; min-width: 230px; }
.menu-panel .sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-panel .who { padding: 9px 12px 4px; font: 500 12.5px/1.3 var(--mono); color: var(--mute); }
.menu-panel button { all: unset; box-sizing: border-box; padding: 11px 12px; border-radius: 8px; color: var(--ink); font-size: 15.5px; cursor: pointer; }
.menu-panel button:hover { background: var(--paper2); }
.menu-panel button:focus-visible { outline: 2.5px solid var(--flag); outline-offset: 2px; }
.menu-panel a[aria-current="page"] { font-weight: 600; }
.links a[aria-current="page"] { color: var(--ink); font-weight: 600; }
nav.top .acct-wrap { display: flex; align-items: center; gap: 28px; min-width: 0; }
@media (max-width: 1020px) { nav.top .acct-wrap { gap: 12px; } .crumb { margin: 0 -6px; } }

/* page frame: the site's section padding (96px desktop, 56px mobile) */
.page { width: 100%; max-width: 1600px; margin: 0 auto; padding: var(--sp) var(--gut); display: grid; gap: 40px; align-content: start; min-width: 0; }
.page.narrow > * { max-width: 720px; }
.page > * { min-width: 0; }
.phead { display: grid; gap: 14px; }
.phead h1 { font-size: clamp(36px, 3.6vw, 60px); letter-spacing: -0.045em; line-height: 1.02; overflow-wrap: anywhere; }
.phead h1 a { text-decoration: none; }
.phead h1 a:hover { text-decoration: underline; text-decoration-color: var(--flag); text-underline-offset: 6px; }
.lede { font-size: clamp(17px, 1.1vw, 20px); color: var(--ink2); max-width: 40em; }
.small, .muted { color: var(--mute); font-size: 14px; }
.sec { display: grid; gap: 16px; }
.sec > h2 { font-size: clamp(24px, 2vw, 34px); letter-spacing: -0.035em; line-height: 1.1; }
.sec > p { color: var(--ink2); max-width: 46em; }
.slot:empty { display: none; }
rr-button-row { margin-top: 4px; }

/* key facts row, like the site's report pages */
.facts { display: flex; flex-wrap: wrap; gap: 16px 48px; margin: 6px 0 0; padding-top: 16px; border-top: 1.5px solid var(--ink); }
.facts div { min-width: 0; }
.facts dt { font: 500 12.5px/1.2 var(--mono); color: var(--mute); }
.facts dd { margin: 6px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; overflow-wrap: anywhere; }
.facts dd a { text-decoration: none; }
.facts dd a:hover { text-decoration: underline; text-decoration-color: var(--flag); text-underline-offset: 4px; }

/* messages */
.alert { border-left: 3px solid var(--flag-ink); background: var(--flag-soft); color: var(--flag-ink); border-radius: 0 var(--r) var(--r) 0; padding: 14px 16px; font-weight: 500; overflow-wrap: anywhere; }
.notice { border-left: 3px solid var(--flag); background: var(--paper2); color: var(--ink); border-radius: 0 var(--r) var(--r) 0; padding: 14px 16px; overflow-wrap: anywhere; }
.notice.ok { border-left-color: var(--ok); }
.reason { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font: 400 13px/1.4 var(--mono); color: var(--mute); }
.reason code { font: inherit; color: var(--ink2); overflow-wrap: anywhere; }
.reason button { font: 500 12.5px/1 var(--mono); color: var(--ink); background: none; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; cursor: pointer; }
.reason button:hover { border-color: var(--ink); }

/* plan strip on the repos page */
.plan-strip { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; padding: 16px 20px; background: var(--paper2); border-radius: var(--r); color: var(--ink2); font-size: 15px; }
.plan-strip p { flex: 1 1 320px; }
.plan-strip.warn { box-shadow: inset 3px 0 0 var(--flag); }

/* repo list: search and sort above, its own scroll area, one action per row */
.tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; }
.tools .field { margin-top: 0; }
.tools .search { flex: 1 1 320px; }
.tools .sort { flex: 0 0 170px; }
.tools .btn { height: 48px; }
.listbox { border-top: 1.5px solid var(--ink); }
.repo-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; overscroll-behavior: contain; border-bottom: 1px solid var(--line); }
.repo-list:focus-visible { outline: 2.5px solid var(--flag); outline-offset: 2px; }
.repo { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 20px; padding: 16px 4px 16px 0; border-bottom: 1px solid var(--line); }
.repo:last-child { border-bottom: 0; }
.repo-main { display: grid; gap: 6px; min-width: 0; }
.repo-name { font: 500 16px/1.3 var(--mono); overflow-wrap: anywhere; }
.repo-name .owner { color: var(--mute); }
.repo-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 14px; color: var(--mute); }
.repo-meta .lang { display: inline-flex; align-items: center; gap: 6px; color: var(--ink2); }
.repo-meta .lang::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--mute); }
.repo-meta .state { color: var(--ink2); }
.repo-meta .state.ready { color: var(--ok-ink); font-weight: 600; }
.repo-meta .state.locked { color: var(--flag-ink); }
.repo .btn { min-width: 132px; }
.out.priv { color: var(--ink); background: var(--paper2); }
.out.pub { color: var(--ink2); background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.list-note { padding: 14px 0 0; font-size: 14px; color: var(--mute); }
.empty { padding: 28px 0; display: grid; gap: 8px; }
.empty h2 { font-size: 24px; letter-spacing: -0.03em; }
.empty p { color: var(--ink2); }

/* progress */
.bar { display: block; height: 12px; border-radius: 6px; background: var(--paper2); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--flag); border-radius: inherit; transition: width .6s ease; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; border-top: 1.5px solid var(--ink); }
.steps .step { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); color: var(--mute); }
.steps .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); flex: none; }
.steps .step.done { color: var(--ink2); }
.steps .step.done .dot { background: var(--ok); }
.steps .step.now { color: var(--ink); font-weight: 600; }
.steps .step.now .dot { background: var(--flag); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--flag) 25%, transparent); } }

#report { display: grid; gap: 32px; min-width: 0; }

/* report: groups as the site's collapsibles, rules as the site's report lists */
.groups { border-top: 1.5px solid var(--ink); }
.collapse { border-bottom: 1px solid var(--line); }
.collapse-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 0; background: none; border: 0; color: var(--ink); cursor: pointer; text-align: left; font: 600 20px/1.3 var(--sans); letter-spacing: -0.02em; }
.collapse-head:hover { color: var(--ink2); }
.collapse-head .count { font: 500 13px/1 var(--mono); color: var(--mute); margin-left: 10px; letter-spacing: 0; }
.chev { flex: none; width: 8px; height: 8px; margin: -4px 4px 0 0; border-right: 2px solid var(--mute); border-bottom: 2px solid var(--mute); transform: rotate(45deg); transition: transform .2s ease; }
.collapse.open .chev { transform: rotate(-135deg); margin-top: 4px; border-color: var(--flag); }
.collapse-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .2s ease; }
.collapse.open .collapse-body { grid-template-rows: 1fr; }
.collapse-inner { overflow: hidden; min-height: 0; }
.rules { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 12px; }
.rule { padding: 20px 22px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; display: grid; gap: 8px; min-width: 0; }
.rule h3 { font-size: 17px; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.rule p { color: var(--ink2); font-size: 15.5px; }
.examples { display: grid; gap: 6px; font-size: 14.5px; }
.examples span { font: 500 12.5px/1.2 var(--mono); color: var(--mute); }
.examples ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.examples a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; overflow-wrap: anywhere; }
.examples a:hover { text-decoration-color: var(--flag); }
.examples .num { font: 500 13.5px/1.3 var(--mono); color: var(--ink2); margin-right: 6px; }
.risk h2 { font-size: clamp(22px, 1.8vw, 28px); letter-spacing: -0.03em; margin-bottom: 14px; }
.rule .tally { color: var(--ink); font-weight: 500; }
.pairs { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 15px; color: var(--ink2); }
.pairs .num, .rule .num { font: 500 13.5px/1.3 var(--mono); color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.pairs a.num:hover, .rule a.num:hover { text-decoration-color: var(--flag); }
.ptitle { overflow-wrap: anywhere; }
.rule .next-pr { font-size: 14.5px; }
.more { font-size: 14.5px; color: var(--ink2); }
.more summary { cursor: pointer; font: 500 13px/1.4 var(--mono); color: var(--ink2); }
.more p { margin-top: 8px; font-size: 14px; overflow-wrap: anywhere; }
.plan-note { display: grid; gap: 4px; margin-top: 14px; font-size: 15px; color: var(--ink2); }
.plan-note a { color: var(--ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.plan-note a:hover { text-decoration-color: var(--flag); }
.notice a { color: var(--ink); text-underline-offset: 3px; }
.next { max-width: 1000px; padding: 28px; background: var(--paper2); border-radius: 14px; display: grid; gap: 14px; }
.next h2 { font-size: clamp(22px, 1.8vw, 28px); letter-spacing: -0.03em; }
.next p { color: var(--ink2); max-width: 46em; }

/* plan cards: the site's pricing cards */
.plan-stage { margin: 0; max-width: 1000px; }
.plan-stage.one { grid-template-columns: minmax(0, 1fr); max-width: 560px; }
.plan .cur { font: 500 12.5px/1 var(--mono); color: var(--mute); }
.plan.feat .cur { color: var(--pmute); }
.price { display: flex; align-items: baseline; gap: 10px; }
.price b { font-size: 40px; font-weight: 600; letter-spacing: -0.045em; line-height: 1; }
.price span { color: var(--pmute); font-size: 13.5px; line-height: 1.3; }

/* settings */
.kv { max-width: 960px; list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--ink); }
.kv li { display: grid; grid-template-columns: minmax(0, 14em) minmax(0, 1fr) auto; align-items: center; gap: 6px 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.kv b { font-weight: 600; }
.kv span { color: var(--ink2); overflow-wrap: anywhere; }
.kv a.lnk { font-size: 15px; white-space: nowrap; }

/* placeholders in the page shell until the first render (apps/web/build.ts skeleton()) */
.sk { display: block; background: var(--paper2); border-radius: 8px; animation: sk-pulse 1.4s ease-in-out infinite; }
.sk-h1 { height: clamp(36px, 3.6vw, 60px); width: min(520px, 80%); border-radius: 10px; }
.sk-lede { height: 20px; width: min(640px, 90%); }
.sk-line { height: 16px; width: min(560px, 85%); }
.sk-line + .sk-line { margin-top: 12px; }
.sk-line:last-of-type { width: min(380px, 60%); }
.sk-btn { height: 48px; width: 200px; border-radius: 999px; }
.sk-strip { height: 56px; border-radius: var(--r); }
.sk-card { height: 120px; border-radius: 14px; }
.sk-card + .sk-card { margin-top: 12px; }
.sk-acct { width: 140px; height: 38px; border-radius: 999px; }
.sk-row .sk-name { height: 18px; width: min(320px, 70%); }
.sk-row .sk-meta { height: 14px; width: min(240px, 50%); }
.sk-row .sk-btn { height: 40px; width: 132px; }
.sk-list { max-height: none; overflow: hidden; }
.solo .sk-btn { margin-top: 4px; }
@keyframes sk-pulse { 50% { opacity: .55; } }

/* hero card for sign in, install and errors */
.solo { max-width: 680px; }
.solo .phead h1 { font-size: clamp(38px, 4.4vw, 64px); line-height: 1; }

@media (max-width: 760px) {
  .page { gap: 28px; }
  .repo { grid-template-columns: minmax(0, 1fr); padding-right: 0; }
  .repo .btn { width: 100%; }
  .tools .search { flex: 1 1 100%; }
  .tools .sort { flex: 1 1 0; }
  .tools .btn { flex: 1 1 0; }
  .kv li { grid-template-columns: minmax(0, 1fr); }
  .next { padding: 22px 18px; }
  .rule { padding: 18px 16px; }
  .facts { gap: 14px 32px; }
  .facts dd { font-size: 19px; }
  .acct summary { max-width: 52vw; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* comment settings (account defaults page and repo page) */
.cpanel { max-width: 960px; }
.ctls { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--ink); }
.ctl { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px 20px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.ctl-main { display: grid; gap: 4px; min-width: 0; }
.ctl-title { font-weight: 600; font-size: 17px; color: var(--ink); }
.ctl-text { color: var(--ink2); font-size: 15px; margin: 0; max-width: 46em; }
.ctl.locked .ctl-title, .ctl.locked .ctl-text { color: var(--mute); }
.dials { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.dial { display: grid; gap: 6px; align-content: start; }
.dial select { height: 48px; }
.src { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 4px; }
.chip { font: 500 12.5px/1.2 var(--mono); padding: 4px 9px; border-radius: 999px; color: var(--ink2); box-shadow: inset 0 0 0 1px var(--line); }
.chip.custom { color: var(--ink); background: var(--paper2); box-shadow: none; }
.chip.file { color: var(--flag-ink); background: var(--flag-soft); box-shadow: none; }
.lnk-btn { all: unset; cursor: pointer; font-size: 14px; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.lnk-btn:focus-visible { outline: 2.5px solid var(--flag); outline-offset: 2px; }
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 46px; height: 28px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; margin: 2px 0 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--paper); transition: transform .15s; }
.switch:checked { background: var(--ink); }
.switch:checked::after { transform: translateX(18px); }
.switch:disabled { opacity: .45; cursor: not-allowed; }
.switch:focus-visible { outline: 2.5px solid var(--flag); outline-offset: 2px; }
.preview { font-weight: 600; color: var(--ink); min-height: 1.5em; margin: 0; }
.preview-detail { max-width: 46em; }
.repo-meta .lnk { font-size: 14px; }
@media (max-width: 640px) { .dials { grid-template-columns: minmax(0, 1fr); } }

/* comment settings, second pass: UI-font chips, segmented controls, back link, preview under the controls */
.chip { font: 500 12px/1.2 var(--sans); letter-spacing: 0; padding: 4px 10px; color: var(--mute); background: var(--paper2); box-shadow: none; }
.chip.custom { color: var(--ink); }
.chip.file { color: var(--flag-ink); background: var(--flag-soft); }
.chip code { font: 500 12px/1.2 var(--mono); }
.backlink { justify-self: start; font-size: 15px; color: var(--ink2); text-decoration: none; }
.backlink:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.backlink:focus-visible { outline: 2.5px solid var(--flag); outline-offset: 3px; border-radius: 4px; }
.seg { display: flex; width: 100%; max-width: 420px; padding: 4px; gap: 4px; background: var(--paper2); border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); }
.seg-opt { all: unset; box-sizing: border-box; flex: 1 1 0; min-width: 0; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; font: 600 15px/1 var(--sans); color: var(--ink2); cursor: pointer; text-align: center; white-space: nowrap; transition: background .15s, color .15s; }
.seg-opt:hover { color: var(--ink); }
.seg-opt[aria-checked="true"] { background: var(--ink); color: var(--paper); }
.seg-opt:focus-visible { outline: 2.5px solid var(--flag); outline-offset: 2px; }
.seg-opt:disabled { opacity: .45; cursor: not-allowed; }
.preview { font-weight: 500; font-size: 15px; color: var(--ink2); margin: -8px 0 0; }
