:root { --bg: #fff; --fg: #1a1a2e; --accent: #16a34a; --muted: #6b7280; }
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, sans-serif; color: var(--fg); background: var(--bg); }
.site-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 2rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.brand { font-weight: 700; font-size: 1.25rem; text-decoration: none; color: var(--fg); }
nav a { margin-left: 1.5rem; text-decoration: none; color: var(--fg); }
.hero { max-width: 720px; margin: 4rem auto; text-align: center; padding: 0 1rem; }
.hero h1 { font-size: 2.5rem; font-weight: 700; }
.report-form { display: flex; gap: .5rem; margin-top: 2rem; }
.report-form input { flex: 1; padding: .75rem 1rem; font-size: 1rem; border: 1px solid #d1d5db; border-radius: .5rem; }
.report-form button { padding: .75rem 1.5rem; font-size: 1rem; background: var(--accent); color: #fff; border: 0; border-radius: .5rem; cursor: pointer; }
.site-footer { text-align: center; color: var(--muted); padding: 2rem; margin-top: 4rem; }

/* --- pages --- */
.page { max-width: 46rem; margin: 3rem auto; padding: 0 1rem; display: flex; flex-direction: column; gap: 1.25rem; }
.page h1 { font-size: 2rem; margin: 0; }
.page h2 { font-size: 1.1rem; margin: 1rem 0 0; }
.muted { color: var(--muted); }
.crumb { margin: 0; font-size: .9rem; }
.crumb a { color: var(--accent); text-decoration: none; }

.tool-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.tool-grid li { border: 1px solid #e5e7eb; border-radius: .4rem; padding: .7rem .9rem; }
.tool-grid a { color: var(--fg); text-decoration: none; font-weight: 500; }
.tool-grid a:hover { color: var(--accent); }
.tool-grid em { font-style: normal; font-size: .8rem; color: var(--muted); display: block; }

.tool-form { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-size: .9rem; font-weight: 500; }
.field input, .field select, .field textarea {
  padding: .6rem .75rem; font-size: 1rem; font-family: inherit;
  border: 1px solid #d1d5db; border-radius: .4rem; background: #fff; color: var(--fg);
}
.field textarea { font-family: ui-monospace, monospace; font-size: .9rem; resize: vertical; }
.tool-form button {
  align-self: flex-start; padding: .6rem 1.5rem; font-size: 1rem;
  background: var(--accent); color: #fff; border: 0; border-radius: .4rem; cursor: pointer;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.result { display: flex; flex-direction: column; gap: .75rem; }
.result pre {
  background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: .4rem;
  padding: 1rem; overflow-x: auto; white-space: pre-wrap; word-break: break-word; margin: 0;
}
.result .error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; padding: .75rem 1rem; border-radius: .4rem; margin: 0; }
.result .render { display: flex; justify-content: center; padding: 1rem; }
.result .render svg { max-width: 100%; height: auto; }
.scroller { overflow-x: auto; }
.result table { border-collapse: collapse; width: 100%; }
.result th, .result td { text-align: left; padding: .5rem .75rem; border-bottom: 1px solid #e5e7eb; }
.result th { font-weight: 500; color: var(--muted); width: 40%; }

/* --- report --- */
.report { max-width: 54rem; }
.report-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }
.report-head h1 { font-size: 1.5rem; word-break: break-all; margin: 0; }
.score { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 5.5rem; height: 5.5rem; border-radius: 50%; border: 3px solid; flex: none; }
.score-value { font-size: 2rem; font-weight: 700; line-height: 1; }
.score-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.score-good { border-color: #16a34a; color: #16a34a; }
.score-fair { border-color: #d97706; color: #d97706; }
.score-poor { border-color: #dc2626; color: #dc2626; }

.tally { list-style: none; display: flex; gap: 1.5rem; padding: 0; margin: 0; color: var(--muted); font-size: .95rem; }
.tally b { color: var(--fg); font-size: 1.1rem; }

.report-section h2 { font-size: 1.15rem; margin: 1.5rem 0 .75rem; }
.checks { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .6rem; }
.check { border: 1px solid #e5e7eb; border-left: 3px solid #d1d5db; border-radius: .4rem; padding: .85rem 1rem; }
.check-pass { border-left-color: #16a34a; }
.check-warn { border-left-color: #d97706; }
.check-fail { border-left-color: #dc2626; }
.check-info { border-left-color: #9ca3af; }
.check-head { display: flex; align-items: center; gap: .6rem; }
.check-head h3 { font-size: 1rem; margin: 0; font-weight: 600; }
.pill { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; padding: .15rem .5rem; border-radius: .25rem; font-weight: 600; }
.pill-pass { background: #dcfce7; color: #166534; }
.pill-warn { background: #fef3c7; color: #92400e; }
.pill-fail { background: #fee2e2; color: #991b1b; }
.pill-info { background: #f3f4f6; color: #4b5563; }
.check-summary { margin: .4rem 0 0; color: var(--muted); }
.check details { margin-top: .5rem; }
.check details summary { cursor: pointer; font-size: .85rem; color: var(--accent); }
.check table { width: 100%; border-collapse: collapse; margin-top: .5rem; font-size: .9rem; }
.check th, .check td { text-align: left; padding: .35rem .6rem; border-bottom: 1px solid #f3f4f6; word-break: break-word; }
.check th { color: var(--muted); font-weight: 500; width: 35%; }

.narrow { max-width: 26rem; }
.dev-note { border: 1px dashed #d97706; background: #fffbeb; border-radius: .4rem; padding: .85rem 1rem; margin: 1rem 0; font-size: .9rem; }
.dev-note p { margin: 0 0 .5rem; }
.dev-note a { word-break: break-all; }

.qr-box { display: flex; justify-content: center; padding: 1rem; background: #fff; border: 1px solid #e5e7eb; border-radius: .4rem; }
.qr-box svg { width: 240px; height: 240px; }
.secret { font-family: ui-monospace, monospace; letter-spacing: .1em; background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: .4rem; padding: .75rem; word-break: break-all; margin: 0; }
.codes { list-style: none; padding: 1rem; margin: 1rem 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: .4rem; font-family: ui-monospace, monospace; }

.plans { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.plan { border: 1px solid #e5e7eb; border-radius: .5rem; padding: 1.25rem; display: flex; flex-direction: column; gap: .6rem; }
.plan h2 { font-size: 1.2rem; margin: 0; }
.plan-prices { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .25rem; }
.plan-prices b { font-size: 1.3rem; }
.button { align-self: flex-start; padding: .55rem 1.2rem; background: var(--accent); color: #fff; border-radius: .4rem; text-decoration: none; }
.totals { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.totals th, .totals td { text-align: left; padding: .5rem .75rem; border-bottom: 1px solid #e5e7eb; }
.totals th { font-weight: 500; color: var(--muted); }
.totals td { text-align: right; font-variant-numeric: tabular-nums; }
.totals .grand th, .totals .grand td { font-weight: 700; color: var(--fg); border-bottom: 0; font-size: 1.1rem; }
.pay-buttons { display: flex; gap: .75rem; flex-wrap: wrap; }
.pay-buttons button { padding: .6rem 1.5rem; font-size: 1rem; background: var(--accent); color: #fff; border: 0; border-radius: .4rem; cursor: pointer; }

.admin-nav { display: flex; gap: 1rem; flex-wrap: wrap; padding-bottom: .75rem; border-bottom: 1px solid #e5e7eb; margin-bottom: .5rem; }
.admin-nav a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.admin-nav a:hover { color: var(--accent); }
.metrics { display: grid; gap: 1px; background: #e5e7eb; border: 1px solid #e5e7eb; border-radius: .5rem; overflow: hidden; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
.metric { background: #fff; padding: 1rem; display: flex; flex-direction: column; gap: .2rem; }
.metric .n { font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.metric .l { font-size: .8rem; color: var(--muted); }
.notice { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; padding: .6rem .9rem; border-radius: .4rem; margin: 0; }
.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: .5rem 0 1rem; }
.inline-form input, .inline-form select { padding: .45rem .6rem; border: 1px solid #d1d5db; border-radius: .35rem; font-family: inherit; }
.inline-form button, .actions button { padding: .4rem .8rem; border: 1px solid #d1d5db; background: #fff; border-radius: .35rem; cursor: pointer; font-family: inherit; font-size: .9rem; }
.inline-form button:hover, .actions button:hover { border-color: var(--accent); color: var(--accent); }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.tag { display: inline-block; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; padding: .12rem .4rem; border-radius: .25rem; background: #f3f4f6; color: #4b5563; margin-right: .25rem; }
.tag-admin { background: #ede9fe; color: #5b21b6; }
.tag-banned, .tag-failed { background: #fee2e2; color: #991b1b; }
.tag-warn, .tag-pending { background: #fef3c7; color: #92400e; }
.tag-completed { background: #dcfce7; color: #166534; }

.share-box { border: 1px solid #e5e7eb; border-radius: .4rem; padding: 1rem; display: flex; flex-direction: column; gap: .6rem; }
.share-box form { display: inline; }
.share-box code { word-break: break-all; background: #f3f4f6; padding: .3rem .5rem; border-radius: .25rem; }
.share-box button { padding: .4rem .9rem; border: 1px solid #d1d5db; background: #fff; border-radius: .35rem; cursor: pointer; font-family: inherit; }
.pill-good { background: #dcfce7; color: #166534; }
.pill-fair { background: #fef3c7; color: #92400e; }
.pill-poor { background: #fee2e2; color: #991b1b; }
