@font-face {
  font-family: "Raleway";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/raleway-400.woff2") format("woff2");
}
@font-face {
  font-family: "Raleway";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/raleway-500.woff2") format("woff2");
}
@font-face {
  font-family: "Raleway";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/raleway-600.woff2") format("woff2");
}
@font-face {
  font-family: "Raleway";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/raleway-700.woff2") format("woff2");
}
@font-face {
  font-family: "Raleway";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/static/fonts/raleway-800.woff2") format("woff2");
}

/* Paleta de marca CID Gallup */
:root {
  --navy: #1d2944;
  --navy-light: #2a3a5c;
  --blue: #164194;
  --teal: #2f7782;
  --gray: #737578;
  --accent: #164194;
  --accent-light: #e7edf7;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #202020;
  --text-muted: #737578;
  --border: #e1e4e9;
  --danger: #c0392b;
  --success: #1e824c;
  --warning: #b7791f;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(29, 41, 68, 0.06), 0 1px 1px rgba(29, 41, 68, 0.04);
  --shadow-md: 0 4px 16px rgba(29, 41, 68, 0.08), 0 2px 4px rgba(29, 41, 68, 0.06);
}

:root[data-theme="dark"] {
  --navy-light: #33456c;
  --bg: #10151f;
  --surface: #1a2334;
  --text: #e7eaf0;
  --text-muted: #9aa4b8;
  --border: #2c3850;
  --accent-light: #223255;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Raleway", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: "Raleway", sans-serif; font-weight: 700; letter-spacing: -0.01em; }

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

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: linear-gradient(180deg, var(--navy) 0%, #16203a 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.1rem;
  flex-shrink: 0;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.75rem;
  padding: 0 0.35rem;
}

.sidebar .brand img { height: 28px; width: auto; display: block; }

.sidebar .brand .product-name {
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.15;
  color: #fff;
}

.sidebar .brand .product-tag {
  font-size: 0.66rem;
  color: #9fb2d6;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
}

.sidebar nav a {
  color: #c3cee3;
  text-decoration: none;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar nav a.active {
  background: rgba(22, 65, 148, 0.35);
  color: #fff;
  border-left-color: var(--teal);
}

.sidebar .user-box {
  font-size: 0.8rem;
  color: #a9b7d1;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 0.9rem;
  margin-top: 0.9rem;
}

.sidebar .user-box a { color: #c3cee3; text-decoration: none; }
.sidebar .user-box a:hover { color: #fff; }

.main {
  flex: 1;
  padding: 1.85rem 2.25rem;
  max-width: 100%;
  overflow-x: auto;
}

.main h2:first-child, .main .toolbar:first-child { margin-top: 0; }

.topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  color: var(--text);
  font-size: 0.85rem;
  box-shadow: var(--shadow-sm);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.4rem;
  box-shadow: var(--shadow-sm);
}

.card h2 {
  margin-top: 0;
  font-size: 1.05rem;
  color: var(--navy);
}
:root[data-theme="dark"] .card h2 { color: #9fc0f0; }

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

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
}

.stat .value {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.2;
}
:root[data-theme="dark"] .stat .value { color: #9fc0f0; }

.stat .label {
  color: var(--text-muted);
  font-size: 0.84rem;
  margin-top: 0.15rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--navy);
  font-weight: 700;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border);
}
:root[data-theme="dark"] th { color: #9fc0f0; }

tr:hover td { background: var(--accent-light); }

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 600;
  background: var(--accent-light);
  color: var(--blue);
}
:root[data-theme="dark"] .badge { color: #cfe0fb; }

.badge.inactivo { background: #f6dcda; color: var(--danger); }
:root[data-theme="dark"] .badge.inactivo { background: #4a2523; color: #f2a9a1; }

.btn {
  display: inline-block;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: "Raleway", sans-serif;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}

.btn:hover { background: var(--navy); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: transparent; color: var(--blue); border: 1px solid var(--blue); box-shadow: none; }
.btn.secondary:hover { background: var(--accent-light); }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.1rem; flex-wrap: wrap; gap: 0.75rem; }

form.stacked { display: flex; flex-direction: column; gap: 0.9rem; max-width: 480px; }

label { font-size: 0.83rem; color: var(--text-muted); font-weight: 600; display: block; margin-bottom: 0.3rem; }

input[type=text], input[type=password], input[type=number], input[type=date],
input[type=time], input[type=email], input[type=file], select, textarea {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
  font-family: "Raleway", sans-serif;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.checkbox-row { display: flex; align-items: center; gap: 0.5rem; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; font-weight: 500; }

.error-box {
  background: #f8d7d3;
  color: var(--danger);
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  font-size: 0.88rem;
  margin-bottom: 1rem;
}
:root[data-theme="dark"] .error-box { background: #3a2422; color: #f2a9a1; }

/* Login page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 20%, var(--navy-light), var(--navy) 60%);
}

.login-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 2.5rem 2.25rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.login-card img.login-logo { height: 42px; width: auto; margin-bottom: 1.4rem; }

.login-card h1 { color: var(--navy); font-size: 1.25rem; margin: 0 0 0.25rem 0; }
:root[data-theme="dark"] .login-card h1 { color: #9fc0f0; }
.login-card p.subtitle { color: var(--text-muted); font-size: 0.85rem; margin: 0 0 1.6rem 0; }
.login-card form { text-align: left; }
