/* Tokens, radii, type roles and control specs follow DocsGPT/frontend/DESIGN.md (values from src/index.css). */

@font-face { font-family: "Inter"; src: url("/fonts/Inter-Variable.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "IBMPlexMono-Medium"; src: url("/fonts/IBMPlexMono-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }

:root {
  --background: #ffffff;
  --foreground: #171717;
  --card: #ffffff;
  --muted: #f6f6f6;
  --muted-foreground: #6b6b6b;
  --accent: #ececec;
  --border: #d9d9d9;
  --input: var(--border);
  --ring: #7d54d1;
  --primary: #7d54d1;
  --primary-foreground: #ffffff;
  --secondary: #7d54d11a;
  --secondary-foreground: var(--primary);
  --link: var(--primary);
  --destructive: #ef4444;
  --success: #079455;
  --warning: #ca8a04;
  --info: #2563eb;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-2xl: 18px;
  --font-sans: "Inter", sans-serif;
  --font-mono: "IBMPlexMono-Medium", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #222327;
    --foreground: #fafafa;
    --card: #2b2c31;
    --muted: #35363b;
    --muted-foreground: #a1a1a1;
    --accent: #3e3f45;
    --border: #44454c;
    --ring: #976af3;
    --primary: #8855f1;
    --secondary: #976af326;
    --secondary-foreground: #b89cf8;
    --link: var(--secondary-foreground);
    --destructive: #dc2626;
    --success: #4ade80;
    --warning: #fbbf24;
    --info: #60a5fa;
    color-scheme: dark;
  }
}

/* The helpdesk widget renders in this DOM (no shadow root): element rules are scoped to the page's own regions. */
:where(.top, main, .foot), :where(.top, main, .foot) * { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font: 400 16px/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

:where(.top, main, .foot) a { color: var(--link); text-decoration: none; }
:where(.top, main, .foot) a:hover { text-decoration: underline; }
:where(.top, main, .foot) :is(a, button, summary):focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 50%, transparent); border-radius: var(--radius-sm); }

:where(.top, main, .foot) code { font-family: var(--font-mono); font-size: 12px; background: var(--muted); padding: 2px 6px; border-radius: var(--radius-sm); }

/* Page chrome */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 960px; margin: 0 auto; padding: 16px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--foreground); }
/* Wordmark, divider and label as in the docs-site navbar (DocsGPT/docs/app/brand.css). */
.brand-logo { display: block; height: 24px; width: auto; color: #4a00e0; }
.brand-divider { height: 20px; border-left: 1px solid #e6e4ee; }
.brand-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: #61607a; }
@media (prefers-color-scheme: dark) {
  .brand-logo { color: #fff; }
  .brand-divider { border-color: #44454c; }
  .brand-label { color: #a3a1b8; }
}
.brand:hover { text-decoration: none; }
.account { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted-foreground); flex-wrap: wrap; justify-content: flex-end; }
.account img { width: 28px; height: 28px; border-radius: 9999px; }

main { max-width: 720px; margin: 0 auto; padding: 0 16px 64px; display: flex; flex-direction: column; gap: 32px; }
/* Flex children default to min-width:auto; let long PR titles and tokens shrink instead of widening the page. */
main > *, .stack > *, .done > * { min-width: 0; max-width: 100%; }
main { overflow-wrap: break-word; }

/* Hero */
.hero { padding-top: 32px; display: flex; flex-direction: column; gap: 12px; }
.eyebrow { margin: 0; color: var(--muted-foreground); font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
/* The one oversized title: a landing hero has no SectionPageHeader equivalent. */
main h1 { margin: 0; font-size: 30px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
main h1 .accent { color: var(--link); }
.lede { margin: 0; font-size: 16px; color: var(--muted-foreground); }

/* Card (outline, padding lg) */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-2xl); padding: 24px; }
.card.sm { padding: 12px 16px; }

.note { display: flex; gap: 12px; align-items: flex-start; }
.note p { margin: 0; font-size: 14px; color: var(--muted-foreground); }
.note strong { color: var(--foreground); font-weight: 600; }
.icon-square { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--radius-md); background: var(--secondary); color: var(--secondary-foreground); }
.icon-square svg { width: 16px; height: 16px; }

.muted { color: var(--muted-foreground); }
.panel-title { margin: 0; font-size: 20px; line-height: 1.25; font-weight: 600; }
.section-title { margin: 0 0 12px; font-size: 18px; font-weight: 600; }
.desc { margin: 4px 0 0; font-size: 14px; color: var(--muted-foreground); }
.stack { display: flex; flex-direction: column; gap: 24px; }

/* Button: default h-9 px-4 text-sm medium rounded-md; lg h-10 px-6 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex-shrink: 0; white-space: nowrap;
  height: 36px; padding: 0 16px; border-radius: var(--radius-md); border: 1px solid transparent; cursor: pointer;
  font: 500 14px var(--font-sans); background: var(--primary); color: var(--primary-foreground);
  transition: background-color 150ms, color 150ms, border-color 150ms;
}
.btn:hover { background: color-mix(in srgb, var(--primary) 90%, transparent); text-decoration: none; }
.btn:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 50%, transparent); border-radius: var(--radius-md); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.lg { height: 40px; padding: 0 24px; }
.btn.sm { height: 32px; padding: 0 12px; }
.btn.outline { background: var(--background); color: var(--foreground); border-color: var(--border); box-shadow: var(--shadow-xs); }
.btn.outline:hover { background: var(--accent); }
.btn svg { width: 16px; height: 16px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Alert */
.alert { border: 1px solid; border-radius: var(--radius-xl); padding: 12px 16px; font-size: 14px; margin: 0; }
.alert.success { color: var(--success); border-color: color-mix(in srgb, var(--success) 50%, transparent); background: color-mix(in srgb, var(--success) 10%, transparent); }
.alert.warning { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 50%, transparent); background: color-mix(in srgb, var(--warning) 10%, transparent); }
.alert.destructive { color: var(--destructive); border-color: color-mix(in srgb, var(--destructive) 50%, transparent); background: color-mix(in srgb, var(--destructive) 10%, transparent); }

/* Contributor header */
.welcome { display: flex; gap: 16px; align-items: center; }
.welcome img { width: 56px; height: 56px; border-radius: 9999px; flex: none; }
.welcome > div { min-width: 0; }

.prs { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.prs li { display: flex; gap: 12px; align-items: baseline; min-width: 0; font-size: 14px; padding: 8px 12px; background: var(--muted); border-radius: var(--radius-md); }
.prs .repo { font-family: var(--font-mono); font-size: 12px; color: var(--muted-foreground); flex: none; }
.prs a { color: var(--foreground); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Form: FormField rhythm (20px between fields, 2-up grid gap-x-4 gap-y-5) */
main form { display: flex; flex-direction: column; gap: 24px; }
main fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
main legend { padding: 0; margin-bottom: 12px; font-size: 14px; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr; column-gap: 16px; row-gap: 20px; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > .label { font-size: 14px; font-weight: 500; }
.opt { color: var(--muted-foreground); font-weight: 400; }
.hint { margin: 6px 0 0; font-size: 12px; color: var(--muted-foreground); }
.field-error { font-size: 12px; color: var(--destructive); }
.field-error:empty { display: none; }

main :is(input[type="text"], input[type="email"], input[type="tel"], input:not([type]), select, textarea) {
  width: 100%; min-width: 0; background: transparent; color: var(--foreground);
  border: 1px solid var(--input); border-radius: var(--radius-md); box-shadow: var(--shadow-xs);
  height: 38px; padding: 6px 12px; font: 16px var(--font-sans); outline: none;
  transition: color 150ms, box-shadow 150ms;
}
@media (min-width: 768px) { main :is(input, select, textarea) { font-size: 14px !important; } }
main select { appearance: auto; background: var(--background); }
main textarea { height: auto; min-height: 80px; resize: vertical; padding: 8px 12px; }
main :is(input, textarea)::placeholder { color: var(--muted-foreground); }
main :is(input, select, textarea):focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 50%, transparent); }
main [aria-invalid="true"] { border-color: var(--destructive) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--destructive) 25%, transparent) !important; }

/* ToggleGroup: one value of several; the on item is an outline with no hue */
.toggle-group { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--muted); border-radius: var(--radius-xl); width: fit-content; max-width: 100%; }
.toggle-group label { position: relative; }
.toggle-group input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.toggle-group span {
  display: inline-flex; align-items: center; justify-content: center; height: 32px; min-width: 48px; padding: 0 14px;
  border: 1px solid transparent; border-radius: 9999px; color: var(--muted-foreground); font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background-color 150ms, color 150ms, border-color 150ms;
}
.toggle-group span:hover { color: var(--foreground); background: var(--accent); }
.toggle-group input:checked + span { border-color: var(--muted-foreground); background: var(--background); color: var(--foreground); box-shadow: var(--shadow-xs); }
.toggle-group input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 50%, transparent); }

.checkbox-row { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--muted-foreground); cursor: pointer; }
.checkbox-row input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }

/* Done */
.done { display: flex; flex-direction: column; gap: 16px; align-items: center; text-align: center; }
.card-preview { width: 100%; aspect-ratio: 1200 / 630; border-radius: var(--radius-xl); border: 1px solid var(--border); background: var(--muted); }
.summary { width: 100%; text-align: left; background: var(--muted); border-radius: var(--radius-md); padding: 12px 16px; font-size: 14px; color: var(--muted-foreground); overflow-wrap: anywhere; }
.summary strong { color: var(--foreground); font-weight: 600; }

/* Badge (default: brand soft fill) */
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 9999px; background: var(--secondary); color: var(--secondary-foreground); font-size: 12px; font-weight: 500; }

/* Sizing + FAQ */
.sizing { display: flex; flex-direction: column; gap: 24px; }
.sizing .fit-note, .sizing .examples { margin: 0; }
#size-chart { display: flex; flex-direction: column; gap: 12px; }
.sub-heading { margin: 0; font-size: 14px; font-weight: 600; }
.sizing-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.table-frame { border: 1px solid var(--border); border-radius: var(--radius-xl); overflow-x: auto; }
.size-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.size-table th, .size-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.size-table thead th { font-size: 12px; font-weight: 500; color: var(--muted-foreground); background: var(--muted); }
.size-table tbody th { font-weight: 600; }
.size-table tbody tr:last-child th, .size-table tbody tr:last-child td { border-bottom: 0; }
.specs { margin: 8px 0 0; padding-left: 20px; font-size: 14px; color: var(--muted-foreground); display: flex; flex-direction: column; gap: 4px; }

.fit-note { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 12px; font-size: 14px; }
.examples { margin: 0 0 16px; padding-left: 20px; font-size: 14px; color: var(--muted-foreground); display: flex; flex-direction: column; gap: 4px; }
.examples strong { color: var(--foreground); font-weight: 500; }
.size-guide { margin: 0; }
.size-guide img { max-width: 100%; border-radius: var(--radius-xl); border: 1px solid var(--border); }

main details { border-top: 1px solid var(--border); }
main details:last-of-type { border-bottom: 1px solid var(--border); }
main summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; cursor: pointer; list-style: none; font-size: 14px; font-weight: 500; }
main summary::-webkit-details-marker { display: none; }
main summary::after { content: ""; flex: none; width: 8px; height: 8px; border-right: 2px solid var(--muted-foreground); border-bottom: 2px solid var(--muted-foreground); transform: rotate(45deg) translateY(-2px); transition: transform 200ms; }
main details[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
main details p { margin: 0 0 12px; font-size: 14px; color: var(--muted-foreground); }

.foot { text-align: center; color: var(--muted-foreground); font-size: 12px; padding: 24px 16px 48px; display: flex; flex-direction: column; gap: 4px; }
.foot p { margin: 0; }

@media (prefers-reduced-motion: reduce) { :where(.top, main, .foot) * { transition: none !important; } }

/* Admin stats page */
main.wide { max-width: 1200px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; padding-top: 16px; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chips { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; font-size: 14px; }
.badge.neutral { background: var(--muted); color: var(--foreground); }
.badge.success { background: color-mix(in srgb, var(--success) 10%, transparent); color: var(--success); }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.data-table thead th { font-size: 12px; font-weight: 500; color: var(--muted-foreground); background: var(--muted); white-space: nowrap; }
.data-table tbody th { font-weight: 500; white-space: nowrap; }
.data-table tbody tr:last-child > * { border-bottom: 0; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .nowrap { white-space: nowrap; }
.summary-cell { min-width: 240px; }
.person { display: inline-flex; align-items: center; gap: 8px; color: var(--foreground); }
.person img { border-radius: 9999px; flex: none; }
.pr-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; min-width: 260px; max-width: 420px; }
.pr-list a { display: block; color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-list .repo { font-family: var(--font-mono); font-size: 12px; color: var(--muted-foreground); }
body.admin .top { max-width: 1200px; }
