:root {
  --bg: #f6f5f1; --surface: #ffffff; --text: #1f2933; --muted: #64707d;
  --border: #d9d6cc; --accent: #2f6f5e; --accent-text: #ffffff; --chip: #e5efe9;
  --chip-text: #1d4a3d; --error: #b3261e; --focus: #1a73e8;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181a; --surface: #1e2326; --text: #e6e9eb; --muted: #9aa5ad;
    --border: #343b40; --accent: #5fb89d; --accent-text: #0f1f1a; --chip: #25382f;
    --chip-text: #bfe5d7; --error: #f2928c; --focus: #8ab4f8;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.page { max-width: 880px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 1.75rem; margin: 0 0 8px; }
h2 { font-size: 1.15rem; margin: 0 0 16px; }
.lead { margin: 0 0 8px; }
.note { margin: 0 0 24px; color: var(--muted); font-size: .95rem; }
.muted { color: var(--muted); font-weight: 400; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px 16px; margin-bottom: 20px; }
.field { margin-bottom: 14px; min-width: 0; }
label { display: block; font-weight: 600; margin-bottom: 4px; }
input[type="text"], textarea, select {
  width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px;
}
textarea { resize: vertical; }
#r-text { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 4px 0 12px; }
button, .file-btn {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 16px;
}
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button:disabled { opacity: .55; cursor: default; }
button:hover:not(:disabled), .file-btn:hover { filter: brightness(.96); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
#file { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop { border: 2px dashed var(--border); border-radius: 12px; padding: 20px 16px; text-align: center; margin-bottom: 14px; }
.drop.over { border-color: var(--accent); background: var(--chip); }
.drop p { margin: 0 0 10px; }
.drop .muted { margin: 10px 0 0; overflow-wrap: anywhere; }
.drop:focus-within .file-btn { outline: 3px solid var(--focus); outline-offset: 2px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 16px; }
.chips-group { margin: 20px 0 8px; }
.chips-group dt { font-weight: 600; margin-top: 10px; }
.chips-group dd { margin: 4px 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--chip); color: var(--chip-text); border-radius: 999px; padding: 2px 12px; font-size: .92rem; overflow-wrap: anywhere; }
.empty { color: var(--muted); font-style: italic; }
.error { color: var(--error); font-weight: 600; margin: 0 0 12px; }
.hint { font-size: .85rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; max-width: 100%; }
table { border-collapse: collapse; width: 100%; min-width: 640px; font-size: .9rem; }
th, td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { background: var(--bg); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
[hidden] { display: none !important; }
