:root {
  --bg: #f6f1e7;
  --ink: #171717;
  --muted: #6b6358;
  --card: #fffaf0;
  --line: rgba(23,23,23,.13);
  --brand: #111827;
  --accent: #8b5e34;
  --accent-soft: #e7decc;
  --danger: #8b1e1e;
  --shadow: 0 18px 55px rgba(17,24,39,.12);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fff7e6 0, var(--bg) 38%, #eee3d1 100%);
}
.hero {
  max-width: 1180px;
  margin: 24px auto 14px;
  padding: 28px;
  border-radius: 28px;
  background: linear-gradient(135deg, #101827 0%, #2f2418 62%, #7a512e 100%);
  color: white;
  box-shadow: var(--shadow);
}
.brand-row { display: flex; gap: 16px; align-items: center; }
.mark {
  width: 58px; height: 58px; border-radius: 18px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: #111827;
  font-weight: 900; letter-spacing: -.06em;
}
.eyebrow { margin: 0 0 3px; color: #e7decc; text-transform: uppercase; font-size: 12px; letter-spacing: .16em; }
h1 { margin: 0; font-size: clamp(32px, 5vw, 54px); letter-spacing: -.05em; }
.subtitle { max-width: 790px; color: #f5ead8; font-size: 17px; line-height: 1.55; }
.hero-actions, .result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
button, .file-label {
  border: 0; border-radius: 999px; padding: 11px 16px;
  font-weight: 800; cursor: pointer; transition: transform .15s ease, opacity .15s ease;
}
button:hover, .file-label:hover { transform: translateY(-1px); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.primary { background: #e7decc; color: #111827; }
.secondary, .file-label { background: #171717; color: white; display: inline-block; }
.ghost { background: rgba(255,255,255,.14); color: inherit; border: 1px solid rgba(255,255,255,.25); }
.app-shell {
  max-width: 1180px;
  margin: 0 auto 20px;
  padding: 0 14px;
  display: grid;
  grid-template-columns: minmax(310px, .85fr) minmax(340px, 1.15fr);
  gap: 16px;
}
.panel {
  background: rgba(255,250,240,.92);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 10px 35px rgba(17,24,39,.08);
}
.full-width { grid-column: 1 / -1; }
.panel-head { display:flex; align-items:center; justify-content:space-between; gap: 12px; margin-bottom: 12px; }
h2 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.pill { border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; color: var(--muted); font-size: 12px; background: #fff; }
label { display:block; font-weight: 800; margin: 12px 0 7px; }
textarea {
  width: 100%; min-height: 130px; resize: vertical;
  border: 1px solid var(--line); border-radius: 18px;
  padding: 14px; background: #fffdf8; color: var(--ink);
  font: 14px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  outline: none;
}
textarea:focus { border-color: rgba(139,94,52,.65); box-shadow: 0 0 0 4px rgba(139,94,52,.09); }
#sourceText { min-height: 364px; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.4; margin: 7px 0 0; }
code { background: #efe5d3; padding: 1px 5px; border-radius: 6px; }
.options-grid { display: grid; gap: 8px; margin-top: 12px; }
.check { margin: 0; font-weight: 650; color: #332a20; }
.check input { margin-right: 8px; }
.file-row { display:flex; align-items:center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
#fileInput { display:none; }
.metrics { display:grid; grid-template-columns: repeat(4, minmax(130px,1fr)); gap: 10px; }
.metrics div { background: #fffdf8; border:1px solid var(--line); border-radius: 20px; padding: 16px; }
.metrics strong { display:block; font-size: 30px; line-height:1; }
.metrics span { color: var(--muted); font-size: 13px; }
.warnings { margin: 14px 0; padding: 12px 14px; border-radius: 16px; color: var(--danger); background: #fff1ec; border:1px solid rgba(139,30,30,.18); white-space: pre-wrap; }
.tabs { display:flex; gap: 8px; border-bottom: 1px solid var(--line); margin-top: 18px; }
.tab { border-radius: 14px 14px 0 0; background: transparent; color: var(--muted); }
.tab.active { background: #171717; color: white; }
.tab-panel { display:none; padding-top: 14px; }
.tab-panel.active { display:block; }
.preview-box, .report-box {
  min-height: 220px; background: #fffdf8; border: 1px solid var(--line); border-radius: 18px;
  padding: 16px; white-space: pre-wrap; overflow:auto; line-height: 1.65;
}
.preview-box.empty { color: var(--muted); }
mark {
  padding: 2px 4px; border-radius: 6px; color: #111;
  background: #ffe083; box-shadow: inset 0 -2px 0 rgba(139,94,52,.25);
}
mark.regex { background: #bfe7ff; }
mark.exact { background: #ffe083; }
.table-wrap { overflow:auto; border:1px solid var(--line); border-radius:18px; background:#fffdf8; }
table { width:100%; border-collapse: collapse; min-width: 780px; }
th, td { text-align:left; padding: 11px 12px; border-bottom:1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing:.08em; color: var(--muted); background:#f7efdf; }
td { font-size: 14px; }
.report-box { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
footer { max-width:1180px; margin: 22px auto 36px; padding: 0 16px; color: var(--muted); font-size: 13px; }
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, minmax(130px,1fr)); }
  .hero { margin: 12px; }
}
