:root {
  --ink: #15383d;
  --muted: #61757a;
  --teal: #0b5964;
  --teal-deep: #073f48;
  --orange: #e4662d;
  --paper: #f7f4ec;
  --white: #fffefa;
  --line: #d9e1df;
  --danger: #9e2f2f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "DM Sans", sans-serif;
}

button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem max(1.25rem, calc((100vw - 1180px) / 2));
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 0.8rem; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; color: white; background: var(--teal); border-radius: 10px; font-family: "Newsreader", serif; font-size: 1.5rem; }
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); }
.privacy-badge { padding: 0.55rem 0.8rem; color: var(--teal-deep); background: #e7f0ef; border-radius: 999px; font-size: 0.82rem; font-weight: 700; }

main { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding-bottom: 4rem; }
.hero { padding: clamp(4rem, 9vw, 7rem) 0 clamp(2.5rem, 5vw, 4rem); }
.hero h1, h2 { margin: 0; font-family: "Newsreader", serif; line-height: 0.98; }
.hero h1 { max-width: 850px; font-size: clamp(3.4rem, 8vw, 6.7rem); }
.hero > p:last-child { max-width: 720px; margin: 1.5rem 0 0; color: var(--muted); font-size: 1.1rem; line-height: 1.65; }
.eyebrow { margin: 0 0 0.65rem; color: var(--orange); font-size: 0.76rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }

.workspace { display: grid; gap: 1.5rem; }
.panel { padding: clamp(1.5rem, 4vw, 2.5rem); background: var(--white); border: 1px solid var(--line); border-top: 4px solid var(--teal); box-shadow: 0 18px 45px rgba(20, 52, 57, 0.07); }
.panel-heading { display: flex; justify-content: space-between; align-items: end; gap: 1.5rem; margin-bottom: 1.5rem; }
.panel h2 { font-size: clamp(2rem, 4vw, 3rem); }

label, legend { color: var(--ink); font-weight: 700; }
input, select, textarea { width: 100%; margin-top: 0.45rem; padding: 0.85rem 0.95rem; color: var(--ink); background: white; border: 1px solid #aebdbb; border-radius: 6px; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(228, 102, 45, 0.24); border-color: var(--orange); }
textarea { resize: vertical; }
.input-action { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.75rem; }
.input-action button { margin-top: 0.45rem; }
.field-help { margin: 0.65rem 0 0; color: var(--muted); font-size: 0.87rem; }

fieldset { margin: 0 0 1.5rem; padding: 0; border: 0; }
.mode-picker { display: flex; flex-wrap: wrap; gap: 0.8rem 1.5rem; }
.mode-picker legend { width: 100%; margin-bottom: 0.6rem; }
.mode-picker label { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.mode-picker input { width: auto; margin: 0; }
.form-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr) minmax(180px, 1fr); gap: 1rem; align-items: end; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.4rem; }

button { padding: 0.8rem 1.15rem; color: white; background: var(--orange); border: 1px solid var(--orange); border-radius: 6px; font-weight: 700; }
button:hover { filter: brightness(0.95); }
button.secondary { color: var(--teal); background: white; border-color: var(--teal); }

.status { margin-bottom: 1.5rem; padding: 1rem 1.1rem; color: var(--teal-deep); background: #e7f0ef; border-left: 4px solid var(--teal); }
.status.error { color: var(--danger); background: #fff1ef; border-left-color: var(--danger); }

.results { scroll-margin-top: 1rem; }
.result-count { margin: 0; color: var(--muted); font-weight: 700; }
.table-wrap { overflow: auto; border: 1px solid var(--line); }
table { width: 100%; min-width: 980px; border-collapse: collapse; }
th { padding: 0.8rem; color: white; background: var(--teal-deep); text-align: left; font-size: 0.83rem; }
td { padding: 0.75rem 0.8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:nth-child(even) { background: #f5f8f7; }
td a { color: var(--teal); overflow-wrap: anywhere; }

.privacy-note { display: flex; gap: 0.5rem 1rem; flex-wrap: wrap; padding: 1rem 1.15rem; color: #6f5319; background: #fff5d9; border: 1px solid #e8d49b; }
.privacy-note span { color: #725f36; }

[hidden] { display: none !important; }

@media (max-width: 820px) {
  .form-grid { grid-template-columns: 1fr; }
  .input-action { grid-template-columns: 1fr; }
  .input-action button { margin-top: 0; }
  .site-header { align-items: flex-start; }
  .privacy-badge { max-width: 190px; text-align: center; }
}
