:root {
  --bg: #f3f5f8;
  --card: #ffffff;
  --ink: #1c2430;
  --muted: #5d6b7c;
  --line: #d7dee7;
  --brand: #1f4e79;
  --brand-dark: #163a5a;
  --ok: #1f7a4d;
  --danger: #b42318;
  --shadow: 0 10px 30px rgba(28, 36, 48, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  text-decoration: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav a, .nav button, .nav span {
  color: #fff;
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
}

.nav form { margin: 0; }

.wrap {
  max-width: 1180px;
  margin: 28px auto;
  padding: 0 20px 40px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 24px;
}

h1 {
  margin: 0 0 18px;
  font-size: 1.6rem;
}

.flash {
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: 8px;
}

.flash-ok { background: #e8f6ee; color: var(--ok); }
.flash-error { background: #fdecec; color: var(--danger); }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field-wide { grid-column: 1 / -1; }
.field-check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}
.field-check label { margin: 0; }
.field label { font-size: 0.9rem; color: var(--muted); }
.input, input[type="text"], input[type="password"], input[type="number"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}

.input.is-disabled {
  background: #eef3f8;
  color: var(--muted);
}

.total-display {
  background: #eef3f8;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
}

.btn {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn-secondary { background: #5d6b7c; }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card { width: min(420px, 100%); }

.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  background: #eef3f8;
  border-radius: 10px;
  padding: 12px;
}

.stat b { display: block; font-size: 1.1rem; }
.stat span { color: var(--muted); font-size: 0.85rem; }

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.is-anulado td { color: var(--muted); text-decoration: line-through; }
.check { width: 18px; height: 18px; accent-color: var(--brand); }
.btn-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--brand);
  cursor: pointer;
}
.btn-link:hover { text-decoration: underline; }
.empty { color: var(--muted); padding: 24px 0; }

.errorlist {
  margin: 0 0 12px;
  padding-left: 18px;
  color: var(--danger);
}

@media (max-width: 800px) {
  .grid, .stats { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .grid, .stats { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
}
