:root {
  /* Paleta Maxiseguridad (maxiseguridad.com.ar) */
  --primario: #c4161c;
  --primario-oscuro: #9e1216;
  --primario-claro: #f6dcdd;
  --secundario: #636466;
  --azul: #c4161c;       /* alias retrocompatible: mismas referencias, nuevo color de marca */
  --azul-claro: #f6dcdd; /* idem */
  --verde: #2e7d32;
  --rojo: #a01c22;
  --gris: #f4f6f8;
  --borde: #d7dce1;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  margin: 0;
  background: var(--gris);
  color: #1c1c1c;
}

h1, h2, h3, .card h2 {
  font-family: Roboto, -apple-system, "Segoe UI", Arial, sans-serif;
}

header {
  background: var(--primario);
  color: white;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

header .brand img {
  height: 34px;
  display: block;
  background: white;
  border-radius: 4px;
  padding: 3px 8px;
}

header h1 {
  font-size: 18px;
  margin: 0;
  font-weight: 700;
}

nav.main-tabs {
  display: flex;
  gap: 4px;
  background: white;
  padding: 0 24px;
  border-bottom: 1px solid var(--borde);
}

nav.main-tabs button {
  border: none;
  background: none;
  padding: 12px 18px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  color: #555;
}

nav.main-tabs button.active {
  color: var(--azul);
  border-bottom-color: var(--azul);
  font-weight: 600;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px 80px;
}

.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.subtabs button {
  border: 1px solid var(--borde);
  background: white;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  color: #444;
}

.subtabs button.active {
  background: var(--azul);
  color: white;
  border-color: var(--azul);
}

.card {
  background: white;
  border-radius: 8px;
  border: 1px solid var(--borde);
  padding: 20px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 15px;
  margin: 0 0 14px;
  color: var(--azul);
  text-transform: uppercase;
  letter-spacing: .03em;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label {
  font-size: 12px;
  color: #667;
  font-weight: 600;
}

.field input, .field select {
  padding: 8px 10px;
  border: 1px solid var(--borde);
  border-radius: 6px;
  font-size: 14px;
  background: white;
}

.field.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.summary-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--azul);
  color: white;
  padding: 12px 24px;
  display: flex;
  gap: 28px;
  align-items: center;
  font-size: 14px;
  z-index: 20;
}

.summary-bar b { font-size: 16px; }

.summary-bar .spacer { flex: 1; }

.summary-bar button {
  background: white;
  color: var(--azul);
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
}

.summary-bar button.secondary {
  background: transparent;
  color: white;
  border: 1px solid rgba(255,255,255,.5);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table th, table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--borde);
  text-align: right;
}

table th:first-child, table td:first-child { text-align: left; }

table thead th {
  background: var(--azul-claro);
  color: #333;
  font-weight: 600;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.badge.borrador { background: #eee; color: #555; }
.badge.enviada { background: #fff3cd; color: #8a6d00; }
.badge.aprobada { background: #d4edda; color: #1e7e34; }
.badge.rechazada { background: #f8d7da; color: #a01c22; }

.totales {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.totales .item {
  background: white;
  border: 1px solid var(--borde);
  border-radius: 8px;
  padding: 14px;
}

.totales .item .label { font-size: 12px; color: #667; }
.totales .item .value { font-size: 20px; font-weight: 700; color: var(--azul); margin-top: 4px; }

.hint {
  font-size: 12px;
  color: #778;
  margin-top: -8px;
  margin-bottom: 12px;
}

.row-actions button {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--azul);
  font-size: 13px;
  margin-right: 8px;
}

.row-actions button.danger { color: var(--rojo); }

button.danger {
  border: 1px solid var(--rojo);
  background: white;
  color: var(--rojo);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

.secondary-btn {
  border: 1px solid var(--azul);
  background: white;
  color: var(--azul);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
}

table td.center, table th.center { text-align: center; }
#tabla-sucursales-extintores td, #tabla-bienes-items td { text-align: left; }
#tabla-sucursales-extintores input, #tabla-bienes-items input { width: 100%; padding: 6px 8px; border: 1px solid var(--borde); border-radius: 4px; }
#tabla-sucursales-extintores input[type="checkbox"], #tabla-bienes-items input[type="checkbox"] { width: auto; }

.summary-bar-bienes {
  display: flex;
  align-items: center;
  gap: 20px;
  justify-content: flex-end;
  margin-bottom: 16px;
  font-size: 14px;
}

.summary-bar-bienes .spacer { flex: 1; }
.summary-bar-bienes b { font-size: 16px; color: var(--azul); }

.summary-bar-bienes button {
  padding: 10px 18px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
}

.summary-bar-bienes button.secondary {
  background: white;
  color: var(--azul);
  border: 1px solid var(--azul);
}

.summary-bar-bienes button:not(.secondary) {
  background: var(--azul);
  color: white;
  border: none;
}

.toast {
  position: fixed;
  top: 16px;
  right: 16px;
  background: #1c1c1c;
  color: white;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 13px;
  z-index: 50;
  opacity: 0;
  transition: opacity .2s;
}

.toast.show { opacity: 1; }

/* ---------------- Login ---------------- */

.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--azul);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.login-box {
  background: white;
  border-radius: 10px;
  padding: 32px 30px;
  width: 320px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

.login-logo {
  display: block;
  height: 44px;
  margin: 0 auto 18px;
}

.login-box h1 {
  font-size: 18px;
  color: var(--azul);
  margin: 0 0 20px;
  text-align: center;
}

.login-box .field { margin-bottom: 14px; }

.login-box button {
  width: 100%;
  padding: 10px;
  background: var(--azul);
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
}

.login-error {
  color: var(--rojo);
  font-size: 13px;
  margin-bottom: 10px;
  min-height: 16px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.user-badge button {
  background: transparent;
  border: 1px solid rgba(255,255,255,.5);
  color: white;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}
