:root {
  --bg: #fafaf7;
  --surface: #ffffff;
  --text: #1b1f23;
  --muted: #5f6b76;
  --line: #e3e5e0;
  --accent: #0f6e5c;
  --accent-ink: #ffffff;
  --ok-bg: #e4f4ec;
  --ok: #17663f;
  --warn-bg: #fdf0d8;
  --warn: #8a5a00;
  --bad-bg: #fbe5e2;
  --bad: #a12a1e;
  --code-bg: #f1f2ee;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 4px 16px rgba(20, 30, 25, .05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161a;
    --surface: #1a2025;
    --text: #e8ebe9;
    --muted: #9aa6af;
    --line: #2b343b;
    --accent: #3fb59b;
    --accent-ink: #08201a;
    --ok-bg: #12301f;
    --ok: #6fd39c;
    --warn-bg: #3a2c0e;
    --warn: #f0c260;
    --bad-bg: #3b1713;
    --bad: #f19a90;
    --code-bg: #20272d;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

header.site { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
header.site .wrap { display: flex; align-items: center; gap: 24px; min-height: 60px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.brand span { color: var(--accent); }
nav.site { display: flex; gap: 20px; margin-left: auto; align-items: center; flex-wrap: wrap; }
nav.site a { color: var(--muted); text-decoration: none; font-size: 15px; }
nav.site a:hover, nav.site a[aria-current="page"] { color: var(--text); }

.btn {
  display: inline-block; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.small { padding: 6px 12px; font-size: 14px; }
nav.site .btn { color: var(--accent-ink); }

.hero { padding: 72px 0 56px; }
.hero h1 { font-size: clamp(32px, 6vw, 52px); line-height: 1.1; letter-spacing: -.02em; margin: 0 0 16px; max-width: 14em; }
.hero p.lead { font-size: 19px; color: var(--muted); max-width: 36em; margin: 0 0 28px; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; }

section.block { padding: 48px 0; border-top: 1px solid var(--line); }
section.block h2 { font-size: 26px; letter-spacing: -.01em; margin: 0 0 8px; }
section.block > .wrap > p.sub { color: var(--muted); margin: 0 0 28px; max-width: 40em; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 6px; font-size: 17px; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.step { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px; }
.limits li { margin-bottom: 8px; }
ul.plain { padding-left: 20px; margin: 0; }

footer.site { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: 14px; }

/* app */
.app { display: grid; gap: 20px; padding: 28px 0 56px; grid-template-columns: 340px 1fr; align-items: start; }
.app > * { min-width: 0; }
@media (max-width: 860px) { .app { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.panel h2 { font-size: 16px; margin: 0 0 12px; }
label.field { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 14px 0 4px; }
input[type="password"], input[type="text"], textarea {
  width: 100%; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 15px;
}
textarea { min-height: 180px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; resize: vertical; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.tabs { display: flex; gap: 4px; margin: 14px 0 10px; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: none; padding: 8px 12px; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.drop {
  display: block; border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px 14px; text-align: center;
  color: var(--muted); cursor: pointer; background: var(--bg); line-height: 1.5;
}
.drop:hover, .drop.over { border-color: var(--accent); color: var(--text); }
.drop strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 2px; }
.drop small { display: block; font-size: 13px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.files { list-style: none; padding: 0; margin: 10px 0 0; font-size: 14px; max-height: 260px; overflow-y: auto; }
.files li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.files img { width: 34px; height: 44px; object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: 3px; background: #fff; flex: none; }
.files .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files .name small { display: block; color: var(--muted); font-size: 12px; }
.files button { background: none; border: none; color: var(--bad); cursor: pointer; font-size: 13px; flex: none; }
.files-head { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 13px; color: var(--muted); }
.row-actions { display: grid; gap: 8px; margin-top: 16px; }
.row-actions .btn { width: 100%; text-align: center; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.status-line.busy::before {
  content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px;
  border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .status-line.busy::before { animation: none; } }
.app > .panel:first-child { position: sticky; top: 76px; }
@media (max-width: 860px) { .app > .panel:first-child { position: static; } }
#out { min-height: 260px; }
.linkish { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; font-size: 14px; padding: 0; text-decoration: underline; }

.status-line { font-size: 14px; color: var(--muted); min-height: 22px; margin: 10px 0 0; }
.status-line.error { color: var(--bad); }
.empty { color: var(--muted); padding: 48px 12px; text-align: center; }
.summary { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin-bottom: 18px; }
.stat { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--bg); }
.stat .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat .v { font-size: 20px; font-weight: 700; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 14px; font-weight: 700; }
.badge.pass { background: var(--ok-bg); color: var(--ok); }
.badge.review { background: var(--bad-bg); color: var(--bad); }
.flags { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.flags li { border-radius: 8px; padding: 9px 12px; font-size: 14px; border: 1px solid var(--line); }
.flags li.error { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.flags li.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.flags code { font-weight: 700; margin-right: 6px; }
.flags button { margin-left: 8px; }
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 4px 16px; font-size: 14px; margin-bottom: 14px; }
.meta b { color: var(--muted); font-weight: 600; margin-right: 4px; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
td.desc { white-space: normal; }
th { background: var(--bg); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.hit td { background: var(--bad-bg); color: var(--bad); }
tr.warnrow td { background: var(--warn-bg); color: var(--warn); }
tr:last-child td { border-bottom: none; }
details { margin-top: 14px; }
pre, code.block { background: var(--code-bg); border-radius: 8px; padding: 12px 14px; overflow-x: auto; font: 13px/1.5 ui-monospace, Consolas, monospace; }
pre { margin: 0 0 16px; }
.result-actions { display: flex; gap: 8px; margin: 14px 0 0; flex-wrap: wrap; }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 10px 14px; font-size: 14px; margin-bottom: 16px; }

/* docs */
.docs { display: grid; grid-template-columns: 200px 1fr; gap: 32px; padding: 32px 0 64px; }
@media (max-width: 760px) { .docs { grid-template-columns: 1fr; } }
.docs aside { position: sticky; top: 76px; align-self: start; font-size: 14px; }
@media (max-width: 760px) { .docs aside { position: static; } }
.docs aside a { display: block; padding: 4px 0; color: var(--muted); text-decoration: none; }
.docs aside a:hover { color: var(--text); }
.docs article { min-width: 0; }
.docs table code { overflow-wrap: anywhere; }
.docs h2 { margin: 36px 0 8px; font-size: 22px; }
.docs h2:first-child { margin-top: 0; }
.docs h3 { margin: 22px 0 6px; font-size: 16px; }
.docs table td, .docs table th { white-space: normal; }
.docs :not(pre) > code { background: var(--code-bg); padding: 1px 6px; border-radius: 4px; font-size: .9em; }
