:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --text: #1d1f21;
  --muted: #62666b;
  --line: #e2e2de;
  --accent: #1f5f8b;
  --accent-text: #ffffff;
  --ok: #1e7b45;
  --ok-bg: #e3f3e9;
  --info: #1f5f8b;
  --info-bg: #e3eef6;
  --warn: #8a5a00;
  --warn-bg: #fbf0d9;
  --bad: #a1271e;
  --bad-bg: #fbe4e1;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17191b;
    --surface: #212427;
    --text: #e8e8e6;
    --muted: #a0a4a8;
    --line: #34383c;
    --accent: #6aa9d6;
    --accent-text: #0e1a24;
    --ok: #7fd3a0;
    --ok-bg: #1c3527;
    --info: #8cc0e6;
    --info-bg: #1b2d3b;
    --warn: #f0c46a;
    --warn-bg: #3a2f17;
    --bad: #f19a90;
    --bad-bg: #40211e;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }

header.top {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

header.top .inner, main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

header.top .inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  flex-wrap: wrap;
}

.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.brand span { color: var(--muted); font-weight: 400; }

nav.main { display: flex; gap: 14px; align-items: center; margin-left: auto; flex-wrap: wrap; }
nav.main form { margin: 0; }

main { padding-top: 20px; padding-bottom: 48px; }

h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 28px 0 10px; }
h3 { font-size: 1rem; margin: 0 0 6px; }

.sub { color: var(--muted); margin: 0 0 16px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.card.superseded { opacity: .75; }

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }

.btn, button {
  display: inline-block;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 6px;
  padding: 7px 14px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn.secondary, button.secondary { background: transparent; color: var(--accent); }
.btn.small, button.small { padding: 3px 9px; font-size: .85rem; }
button.link { background: none; border: 0; color: var(--accent); padding: 0; font-weight: 400; text-decoration: underline; }
.btn.whatsapp { background: #1f8f4e; border-color: #1f8f4e; color: #fff; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }

.badge {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }

.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 8px; background: var(--info-bg); color: var(--info); }
.messages li.success { background: var(--ok-bg); color: var(--ok); }
.messages li.error { background: var(--bad-bg); color: var(--bad); }
.messages li.warning { background: var(--warn-bg); color: var(--warn); }

.note { white-space: pre-wrap; margin: 6px 0; }
.note-lang { font-size: .75rem; font-weight: 700; color: var(--muted); }
.file-note { color: var(--muted); font-style: italic; white-space: normal; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error-text { color: var(--bad); }
.warn-text { color: var(--warn); }

form.stack p { margin: 0 0 12px; }
form.stack label { display: block; font-weight: 600; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], select, textarea {
  width: 100%;
  max-width: 520px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
input.rev { width: 72px; }
textarea { max-width: 100%; }
.helptext { display: block; color: var(--muted); font-size: .85rem; }
ul.errorlist { color: var(--bad); margin: 4px 0; padding-left: 18px; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }

.login-box { max-width: 420px; margin: 40px auto; }
.lang-switch { display: flex; gap: 10px; justify-content: center; margin-top: 12px; font-size: .9rem; }

.comment { border-top: 1px solid var(--line); padding: 10px 0; }
.comment:first-child { border-top: 0; }
.comment .meta { font-size: .85rem; color: var(--muted); }

code.path { background: var(--bg); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--line); }

@media (max-width: 640px) {
  header.top .inner { padding-top: 8px; padding-bottom: 8px; }
  nav.main { margin-left: 0; }
  th.hide-sm, td.hide-sm { display: none; }
}
