:root {
  --bg: #e7f3fc;
  --surface: #f8fbff;
  --ink: #16324f;
  --muted: #5a7086;
  --line: #c5daf0;
  --navy: #2f6ec6;
  --navy-2: #3c82dc;
  --brass: #1a6bb8;
  --brass-soft: #d6ebfa;
  --bad: #9b2c3a;
  --ok: #176b42;
}
html[data-theme="verde"] {
  --bg: #e8f6ee;
  --surface: #f7fcf8;
  --ink: #143528;
  --muted: #5a7368;
  --line: #c3e4d2;
  --navy: #1f7a4d;
  --navy-2: #2d9460;
  --brass: #176b42;
  --brass-soft: #d4f0e2;
  --ok: #145c38;
}
html[data-theme="beige"] {
  --bg: #f3efe6;
  --surface: #fffcf8;
  --ink: #2a241c;
  --muted: #6d6458;
  --line: #e4dccf;
  --navy: #6b5438;
  --navy-2: #846848;
  --brass: #8d6a32;
  --brass-soft: #f6e6c8;
  --ok: #5c4a28;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "Source Sans 3", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}
button, a, label, select, summary { cursor: pointer; }
a { color: var(--brass); }
img { max-width: 100%; height: auto; }
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.nav {
  background: var(--navy);
  color: white;
  padding: 1rem 0.8rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.brand { display: flex; gap: 0.65rem; align-items: center; padding: 0.2rem 0.4rem 0.6rem; }
.brand img { width: 46px; height: 46px; object-fit: contain; background: white; border-radius: 12px; }
.brand .org { margin: 0; font-size: 0.68rem; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.85; }
.brand .site { margin: 0; font-weight: 700; }
.nav nav { display: flex; flex-direction: column; gap: 0.15rem; }
.nav a { color: white; text-decoration: none; padding: 0.38rem 0.6rem; border-radius: 8px; font-size: 0.92rem; }
.nav a.active, .nav a:hover { background: rgba(255, 255, 255, 0.16); }
.who { margin-top: auto; padding: 0.7rem 0.5rem 0; display: grid; gap: 0.15rem; font-size: 0.86rem; }
.who span, .who a { opacity: 0.9; }
.main { min-width: 0; }
.top { padding: 0.7rem 1.4rem; color: var(--muted); font-size: 0.9rem; }
main { padding: 0.2rem 1.4rem 2rem; }
h1 { font-size: 1.6rem; margin: 0 0 0.8rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.35rem; }
.lead { color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.7rem; margin-bottom: 1rem; }
.cards article, .panel, .sheet {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem 1rem;
}
.cards span { display: block; color: var(--muted); font-size: 0.85rem; }
.cards strong { font-size: 1.6rem; }
.panel { margin: 0 0 1rem; display: grid; gap: 0.55rem; }
.panel label, .login-form label, form label { display: grid; gap: 0.25rem; font-size: 0.9rem; }
label.check { display: flex; align-items: center; gap: 0.4rem; }
input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  width: 100%;
}
textarea { min-height: 6rem; resize: vertical; }
button, a.primary {
  font: inherit;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 0.5rem;
  padding: 0.5rem 0.9rem;
  text-decoration: none;
  display: inline-block;
  width: fit-content;
}
button.primary, a.primary { background: var(--navy); color: white; border-color: transparent; }
button.primary:hover, a.primary:hover { background: var(--navy-2); }
.login-form .primary { width: 100%; min-height: 2.75rem; }
.flash { padding: 0.65rem 0.8rem; border-radius: 12px; background: var(--brass-soft); }
.flash.bad { background: #fde8ea; color: var(--bad); }
.flash.ok { background: var(--brass-soft); color: var(--ok); }
fieldset { border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 14px; overflow: hidden; margin: 0.5rem 0 1.2rem; }
th, td { text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--brass-soft); background: color-mix(in srgb, var(--navy) 12%, white); font-weight: 600; }
tr:nth-child(even) td { background: var(--brass-soft); background: color-mix(in srgb, var(--brass-soft) 55%, white); }
.hint { color: var(--muted); font-size: 0.86rem; }
.html p { margin: 0.3rem 0; }
.editor {
  min-height: 7rem;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
}
.editor-bar { display: flex; gap: 0.35rem; }
.file input { padding: 0.35rem 0; border: 0; background: transparent; }
.sheet { max-width: 760px; }
.inline { margin-bottom: 0.8rem; max-width: 280px; }
.nav a { display: flex; align-items: center; gap: 0.6rem; }
.nav svg, .who svg, .restore svg, .quick svg {
  width: 1rem;
  height: 1rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.who a { display: flex; align-items: center; gap: 0.4rem; }
.top { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border-bottom: 1px solid var(--line); }
.restore { display: inline-flex; align-items: center; gap: 0.4rem; background: transparent; border: 0; color: var(--muted); padding: 0; }
.restore:hover { color: var(--ink); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem; }
.stats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 0.8rem; }
.stat, a.stat {
  display: block;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.95rem 1rem;
  text-align: left;
  text-decoration: none;
  color: inherit;
}
.stat span { display: block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.stat strong { display: block; margin-top: 0.35rem; font-family: Georgia, "Times New Roman", serif; font-size: 2.15rem; font-weight: 500; color: var(--navy); line-height: 1; }
.stat.bad strong { color: var(--bad); }
.dash-grid { display: grid; grid-template-columns: 1.4fr 0.95fr; gap: 1rem; margin-top: 1.1rem; }
.dash-grid .panel { display: block; }
.dash-grid h2, h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
.dash-grid h2.next { margin-top: 1.3rem; }
.chart { display: grid; grid-template-columns: 1.6rem 1fr; gap: 0.4rem; margin-top: 0.6rem; padding-bottom: 1.6rem; }
.chart-scale { display: flex; flex-direction: column; justify-content: space-between; height: 200px; color: var(--muted); font-size: 0.72rem; }
.bars { display: flex; align-items: flex-end; gap: 0.75rem; height: 200px; border-bottom: 1px solid var(--line); }
.bar { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bar i { display: block; width: min(76px, 78%); background: #1b4d57; border-radius: 6px 6px 0 0; }
.bar em { position: absolute; top: calc(100% + 0.35rem); font-style: normal; font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.rowline { display: flex; justify-content: space-between; gap: 0.8rem; align-items: center; border-bottom: 1px solid var(--line); padding: 0.65rem 0; }
.rowline .hint { display: block; }
.rowline b { color: var(--brass); font-size: 0.75rem; }
.quick { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.quick a { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.6rem; }
.menu-btn {
  display: none;
  position: fixed;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 5;
  background: var(--navy);
  color: white;
  border-color: transparent;
}
.login-body { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 0.9fr; }
.login-hero, .login-form { padding: 2.5rem; display: flex; flex-direction: column; justify-content: center; }
.login-hero { background: var(--bg); }
.login-hero img { width: min(420px, 100%); background: white; border-radius: 18px; padding: 0.6rem; }
.login-form { background: var(--surface); gap: 0.7rem; }
.login-form form { display: grid; gap: 0.75rem; max-width: 420px; }
.primary svg, .shortcuts svg { width: 1rem; height: 1rem; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.primary { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; }
.entrar { margin: 0.6rem 0 0; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.shortcuts button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  width: 100%;
  min-height: 2.75rem;
  border-radius: 0.5rem;
  text-align: left;
  color: var(--ink);
  font-weight: 600;
  background: var(--surface);
}
.shortcuts button:hover { border-color: var(--navy); }
.shortcuts svg { color: var(--navy); flex: none; }
.install { max-width: 560px; margin: 3rem auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1.4rem; }
.install form { display: grid; gap: 0.7rem; }
@media (max-width: 860px) {
  .login-body { grid-template-columns: 1fr; }
  .login-hero { padding: 1.4rem 1.2rem 0.4rem; }
  .login-form { padding: 1.2rem; }
  .stats, .stats.three, .dash-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .menu-btn { display: inline-block; }
  .shell { display: block; }
  .nav {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.18s ease;
    z-index: 4;
  }
  .nav.open { transform: none; }
  .main { padding-top: 2.6rem; }
  main { padding: 0.2rem 0.9rem 2rem; }
  table { display: block; overflow-x: auto; }
}
@media print {
  .nav, .top, .menu-btn, form, .flash { display: none !important; }
  .shell { display: block; }
  body { background: white; }
}
