:root {
  --bg: #f7f8f7;
  --surface: #ffffff;
  --text: #1a1f1c;
  --muted: #5b655e;
  --border: #dde3de;
  --accent: #0f766e;
  --accent-dark: #0b5750;
  --ok: #1a7f37;
  --fail: #b3261e;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --surface: #1c2023;
    --text: #e9ecec;
    --muted: #9aa6a0;
    --border: #2c3236;
    --accent: #2dd4bf;
    --accent-dark: #5eead4;
    --ok: #4ade80;
    --fail: #f87171;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
}

code {
  background: var(--border);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

a { color: var(--accent-dark); }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--text);
}
.brand span { color: var(--accent); }

.site-header nav a {
  text-decoration: none;
  font-weight: 600;
  color: var(--accent-dark);
}

.layout {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
}

.sidebar {
  width: 140px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding-top: 2.5rem;
  position: sticky;
  top: 1.5rem;
}
.sidebar a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
}
.sidebar a:hover { color: var(--accent-dark); }
.sidebar a.active { color: var(--accent-dark); }

.container {
  max-width: 760px;
  padding: 2.5rem 0 4rem;
  min-width: 0;
  flex: 1;
}

/* Wide variant for pages whose content (e.g. a data table) benefits from
   using the full browser width instead of the site's usual narrow column --
   opt in per-page via {% block layout_class %}layout-wide{% endblock %} and
   {% block container_class %}container-wide{% endblock %} in base.html. */
.layout-wide { max-width: none; }
.container-wide {
  max-width: none;
  padding: 2.5rem 1.5rem 4rem 0;
  min-width: 0;
  flex: 1;
}

@media (max-width: 680px) {
  .layout { flex-direction: column; gap: 0.5rem; }
  .sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    position: static;
    padding-top: 1.5rem;
  }
  .container { padding-top: 1.5rem; }
}

.hero { text-align: center; margin-bottom: 2.5rem; }
.hero h1 { font-size: 2rem; margin-bottom: 0.75rem; }
.lede { color: var(--muted); font-size: 1.05rem; margin-bottom: 1.75rem; }

.cta {
  display: inline-block;
  background: var(--accent);
  color: #06231f;
  font-weight: 700;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 1rem;
}
.cta:hover { background: var(--accent-dark); }
.cta:disabled {
  background: var(--border);
  color: var(--muted);
  cursor: not-allowed;
}

#cooldown-indicator {
  display: inline-block;
  margin-left: 0.75rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

.signature { color: var(--muted); font-style: italic; margin-top: 1.5rem; }

.badge {
  display: inline-block;
  background: var(--accent);
  color: #06231f;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  vertical-align: middle;
}

.limitations ul { margin: 0.5rem 0 0; padding-left: 1.25rem; }
.limitations li { margin-bottom: 0.4rem; }

.form-card h1, .result-card h1 { margin-top: 0; }

fieldset {
  border: none;
  padding: 0;
  margin: 0 0 1.25rem;
}
legend { font-weight: 700; margin-bottom: 0.5rem; padding: 0; }

.radio {
  display: block;
  margin-bottom: 0.4rem;
  cursor: pointer;
}

.file-label { display: block; font-weight: 700; margin-bottom: 0.4rem; }

input[type="file"] {
  display: block;
  width: 100%;
  margin-bottom: 1.25rem;
  padding: 0.5rem 0;
}

.checkbox {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  cursor: pointer;
}
.checkbox input { margin-top: 0.3rem; }

.privacy-note, .muted {
  color: var(--muted);
  font-size: 0.9rem;
}
.small { font-size: 0.82rem; }

form button.cta { margin-top: 0.5rem; }

.ok { color: var(--ok); }
.fail { color: var(--fail); }

.ticket {
  background: var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
}

.feedback {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.thumb {
  font-size: 1.4rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  margin-right: 0.5rem;
}
.thumb:hover { border-color: var(--accent); }

textarea {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.6rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  resize: vertical;
}

.site-footer {
  text-align: center;
  padding: 2rem 1.5rem 3rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer a { color: var(--accent-dark); }

.table-scroll { overflow-x: auto; }
.admin-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.85rem;
  white-space: nowrap;
}
.admin-table th, .admin-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.4rem 0.6rem;
  text-align: left;
}
.admin-table th { color: var(--muted); font-weight: 600; }
.admin-table pre, .log-details pre {
  white-space: pre-wrap;
  max-width: 480px;
  max-height: 320px;
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem;
  font-size: 0.78rem;
}
.admin-table summary, .log-details summary { cursor: pointer; color: var(--accent-dark); }

.log-details { margin-top: 1.5rem; }
.log-details summary { font-weight: 600; }
.log-details pre { margin-top: 0.5rem; max-width: 100%; }

.btn-danger {
  display: inline-block;
  margin-top: 1rem;
  background: var(--fail);
  color: #fff;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  padding: 0.6rem 1.25rem;
  cursor: pointer;
  font-size: 0.95rem;
}
.btn-danger:hover { opacity: 0.85; }
