:root {
  color-scheme: light;
  --bg: #f8fafc; --card: #ffffff; --box: #ffffff; --line: #e2e8f0; --line-2: #cbd5e1;
  --text: #0f172a; --muted: #64748b; --faint: #94a3b8;
  --accent: #2563eb; --accent-hover: #1d4ed8; --accent-soft: #eff6ff; --on-accent: #ffffff;
  --ins: #dbeafe; --ins-edge: #93c5fd; --ok: #16a34a; --warn: #d97706; --danger: #dc2626;
  --shadow: 0 1px 2px rgb(15 23 42 / .04), 0 1px 3px rgb(15 23 42 / .06);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1120; --card: #111827; --box: #0f172a; --line: #1f2937; --line-2: #334155;
    --text: #e5e7eb; --muted: #94a3b8; --faint: #64748b;
    --accent: #3b82f6; --accent-hover: #60a5fa; --accent-soft: #172554; --on-accent: #ffffff;
    --ins: #1e3a8a; --ins-edge: #3b82f6; --ok: #4ade80; --warn: #fbbf24; --danger: #f87171;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120; --card: #111827; --box: #0f172a; --line: #1f2937; --line-2: #334155;
  --text: #e5e7eb; --muted: #94a3b8; --faint: #64748b;
  --accent: #3b82f6; --accent-hover: #60a5fa; --accent-soft: #172554; --on-accent: #ffffff;
  --ins: #1e3a8a; --ins-edge: #3b82f6; --ok: #4ade80; --warn: #fbbf24; --danger: #f87171;
  --shadow: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans); }
svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
kbd { font: 11px var(--sans); padding: 1px 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand b { display: block; font-size: 15px; }
.brand small { display: block; color: var(--muted); font-size: 11px; }
.logo { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: var(--on-accent); }
.logo svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); cursor: pointer; color: var(--muted); }
.icon-btn:hover { color: var(--text); }

.account, .acct { display: flex; align-items: center; gap: 10px; }
.acct .pill { padding: 4px 10px; font-size: 13px; }
.primary.small { margin: 0; padding: 6px 12px; font-size: 13px; }
.menu { position: relative; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 600; cursor: pointer; list-style: none; }
.avatar::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: 40px; z-index: 10; display: grid; min-width: 220px; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgb(15 23 42 / .12); }
.menu-list > * { padding: 7px 10px; border-radius: 6px; font-size: 13px; text-align: left; }
.menu-email { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.menu-plan { color: var(--accent); font-weight: 600; }
.menu-list button { border: 0; background: none; cursor: pointer; }
.menu-list button:hover { background: var(--bg); }

.modal { width: min(440px, calc(100vw - 32px)); padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text); box-shadow: 0 20px 50px rgb(15 23 42 / .25); }
.modal::backdrop { background: rgb(15 23 42 / .45); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin: 0; }
.modal-note { margin: 6px 0 14px; color: var(--muted); font-size: 13px; }
.modal-note.test { margin: 14px 0 0; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--text); }
.plans { display: grid; gap: 8px; }
.plan { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--box); text-align: left; cursor: pointer; }
.plan:hover { border-color: var(--accent); background: var(--accent-soft); }
.plan .price { grid-row: span 2; align-self: center; font-weight: 600; }
.plan small { color: var(--muted); }

.wrap { max-width: 1240px; margin: 0 auto; padding: 28px 24px 40px; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 20px; }
h1 { margin: 0; font-size: 28px; line-height: 1.2; letter-spacing: -0.02em; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); font-size: 12px; color: var(--muted); }
.badge svg { width: 13px; height: 13px; color: var(--ok); stroke-width: 2.4; }

main { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card { display: flex; flex-direction: column; gap: 14px; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; min-height: 28px; }
h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; font-weight: 600; }
h2 svg { color: var(--muted); }
.pill { padding: 1px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill.over { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.card-head > :last-child { margin-left: auto; }

.box { position: relative; display: flex; height: 360px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--box); overflow: hidden; }
.box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
textarea, .output { flex: 1; width: 100%; margin: 0; padding: 12px 14px; border: 0; outline: 0; resize: none; background: transparent; color: var(--text); font: 15px/1.7 var(--sans); white-space: pre-wrap; overflow-wrap: anywhere; overflow-y: auto; }
textarea::placeholder { color: var(--faint); }
textarea[readonly] { color: var(--muted); }
.output:empty::before { content: attr(data-empty); color: var(--faint); }
.output .ins { background: var(--ins); box-shadow: inset 0 -2px 0 var(--ins-edge); border-radius: 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.output .waiting { color: var(--faint); font-size: 13px; }
.caret { display: inline-block; width: .5em; height: 1.05em; margin-left: 1px; vertical-align: -.16em; border-radius: 2px; background: var(--accent); animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }
.dragging .box { border-color: var(--accent); border-style: dashed; }

.output .sec { border-radius: 4px; cursor: pointer; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.output .sec:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.output .sec.sel { background: color-mix(in srgb, var(--accent) 10%, transparent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 10%, transparent); }
.sec-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; min-height: 30px; margin: -6px 0 -4px; padding: 3px 4px 3px 10px; border-radius: 8px; background: var(--bg); font-size: 13px; color: var(--muted); }
.sec-label { margin-right: auto; }
.versions { display: inline-flex; align-items: center; gap: 4px; color: var(--text); font-variant-numeric: tabular-nums; }
.icon-sm { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; }
.icon-sm:hover:not(:disabled) { background: var(--line); color: var(--text); }
.icon-sm:disabled { opacity: .35; cursor: default; }
.issues li { cursor: pointer; border-radius: 4px; }
.issues li:hover .value { text-decoration: underline; }
.output .kept { box-shadow: inset 0 -2px 0 var(--ok); border-radius: 2px; }
.protect { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; font-size: 13px; color: var(--muted); }
.protect-label { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.protect-label svg { width: 14px; height: 14px; }
.terms { display: contents; }
.term { display: inline-flex; align-items: center; gap: 4px; max-width: 220px; padding: 2px 4px 2px 8px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--text); font-size: 12px; }
.term span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term.absent { color: var(--faint); border-style: dashed; }
.term button { display: grid; place-items: center; width: 16px; height: 16px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.term button:hover { background: var(--line); color: var(--text); }
#term-input { flex: 1; min-width: 160px; padding: 4px 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text); font: inherit; outline: 0; }
#term-input:focus { border-color: var(--line-2); background: var(--box); }
.upload { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 13px; cursor: pointer; }
.upload:hover { border-color: var(--line-2); color: var(--text); }
.upload-btn { margin-left: auto; padding: 3px 10px; border: 1px solid var(--line-2); border-radius: 6px; font-size: 12px; color: var(--text); }

.card-foot { display: flex; align-items: center; gap: 12px; margin-top: auto; }
.hint { color: var(--muted); font-size: 12px; }
.primary { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; padding: 9px 18px; border: 0; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-weight: 600; cursor: pointer; }
.primary svg { fill: currentColor; stroke: none; }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.primary:disabled { opacity: .45; cursor: not-allowed; }
.primary.stop { background: var(--text); color: var(--card); }
.primary.stop svg { display: none; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 13px; cursor: pointer; }
.link-btn:hover:not(:disabled) { color: var(--text); background: var(--bg); }
.link-btn:disabled { opacity: .45; cursor: default; }
.actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: -6px; }

.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; }
.track { position: relative; width: 30px; height: 18px; border-radius: 999px; background: var(--line-2); transition: background .15s; }
.track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(12px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

.progress { height: 4px; margin: -6px 0 -4px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress .bar { height: 100%; width: 0; background: var(--accent); transition: width .3s; }

.notice { padding: 9px 12px; border-radius: 8px; font-size: 13px; background: var(--bg); color: var(--muted); }
.notice.warn { background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--text); }
.notice.error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }

.report { padding-top: 14px; border-top: 1px solid var(--line); }
.stat { display: grid; gap: 2px; min-width: 0; }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 20px; font-weight: 600; }
.stat-value.ok { color: var(--ok); }
.stat-value.warn { color: var(--warn); }
.stat-note { font-size: 12px; color: var(--faint); overflow-wrap: anywhere; }
.ring {
  --p: 0; display: grid; place-content: center; text-align: center; margin-left: auto;
  width: 68px; height: 68px; flex: none; border-radius: 50%;
  background: radial-gradient(closest-side, var(--card) 80%, transparent 81%), conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line) 0);
}
.ring span { font-size: 15px; font-weight: 600; line-height: 1.1; }
.ring small { font-size: 10px; color: var(--muted); }

.issues { display: grid; gap: 4px; margin: -4px 0 0; padding: 0; list-style: none; font-size: 13px; }
.issues li { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.issues .kind { flex: none; padding: 0 6px; border-radius: 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.issues .missing .kind { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.issues .added .kind { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.issues .value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.issues .where { margin-left: auto; color: var(--faint); font-size: 12px; white-space: nowrap; }
.issues .more { color: var(--faint); font-size: 12px; }

.fine { margin: 20px 0 0; color: var(--faint); font-size: 12px; }

@media (max-width: 860px) {
  main { grid-template-columns: 1fr; }
  .box { height: 280px; }
  .wrap { padding: 20px 16px 32px; }
  .topbar { padding: 10px 16px; }
  .brand small { display: none; }
  h1 { font-size: 22px; }
}
