:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text2: #55555a;
  --border: #dcdcd8;
  --accent: #1f6f54;
  --accent-hover: #185a44;
  --error: #b3261e;
  --warning: #9a6400;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171a;
    --surface: #202126;
    --text: #f0f0ee;
    --text2: #b7b8bd;
    --border: #34353b;
    --accent: #4fd1a5;
    --accent-hover: #6fe0b8;
    --error: #ff6b60;
    --warning: #f2c14e;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.head h1 {
  font-size: 1.9rem;
  margin: 0 0 0.4rem;
}

.tagline {
  color: var(--text2);
  margin: 0 0 0.5rem;
}

.usage-count {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
  margin: 0 0 1.5rem;
}

.trust {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.5rem;
  font-size: 0.92rem;
}

.trust p { margin: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  outline: none;
}

.dropzone .or {
  color: var(--text2);
  font-size: 0.85rem;
}

button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
  cursor: pointer;
}

#browse-btn { margin-top: 0.75rem; }

button:hover:not(:disabled) { background: var(--accent-hover); }

button:disabled { opacity: 0.5; cursor: not-allowed; }

button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

button.secondary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-color: var(--accent);
}

.filename {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--text2);
  word-break: break-all;
}

.options {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.field select,
.add-term input[type="text"],
textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
  font-size: 0.95rem;
}

.field select { width: fit-content; }

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

/* ---- anonymizer components ---- */

.card + .card { margin-top: 1.5rem; }

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 4px;
  padding: 0.05em 0.3em;
}

.paste-wrap { margin-top: 1.25rem; }

.paste-label {
  margin: 0 0 0.4rem;
  font-size: 0.9rem;
  color: var(--text2);
}

textarea {
  width: 100%;
  resize: vertical;
  font-family: inherit;
  line-height: 1.45;
}

.scan-summary {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  color: var(--text2);
}

.note {
  font-size: 0.85rem;
  color: var(--text2);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  margin: 0 0 0.75rem;
}

.empty {
  color: var(--text2);
  font-size: 0.92rem;
}

.type-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  margin: 0 0 0.9rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.type-toggles .checkbox { font-weight: 600; }

.type-toggles .count {
  color: var(--text2);
  font-weight: 400;
}

.entity-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 22rem;
  overflow-y: auto;
}

.entity-item label {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.92rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  flex-wrap: wrap;
}

.entity-item input[type="checkbox"] { align-self: center; }

.entity-item.disabled label { opacity: 0.5; }

.chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  border-radius: 4px;
  padding: 0.1em 0.4em;
  white-space: nowrap;
  color: #fff;
  background: var(--accent);
}

.chip-email { background: #2563eb; }
.chip-phone { background: #7c3aed; }
.chip-iban { background: #b45309; }
.chip-taxcode { background: #be185d; }
.chip-custom { background: #52525b; }
.chip-birthdate { background: #0e7490; }
.chip-idnum { background: #4d7c0f; }

.ent-name { font-weight: 600; }

.ent-meta {
  color: var(--text2);
  font-size: 0.8rem;
}

.badge-possible {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--warning);
  border: 1px solid var(--warning);
  border-radius: 999px;
  padding: 0.05em 0.5em;
}

.add-term {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.add-term input[type="text"] { flex: 1; }

.options-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: end;
}

.preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 0.9rem;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 24rem;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.preview mark {
  background: color-mix(in srgb, var(--accent) 25%, transparent);
  color: var(--text);
  border-radius: 3px;
  padding: 0 0.15em;
  font-weight: 600;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

body.working { cursor: progress; }
body.working .preview,
body.working .entity-list { opacity: 0.55; transition: opacity 0.15s ease; }

.result {
  color: var(--accent);
  font-weight: 500;
}

.warning {
  color: var(--warning);
  font-weight: 500;
}

.error {
  color: var(--error);
}

.foot {
  margin-top: 2.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text2);
}
