:root {
  --primary: #1e3a5f;
  --primary-dark: #142849;
  --accent: #c8a45c;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1d2230;
  --muted: #6b7280;
  --border: #e5e7eb;
  --success: #22c55e;
  --danger: #dc2626;
  --warning: #f59e0b;
  --info: #2563eb;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --sidebar-w: 280px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif; color: var(--text); background: var(--bg); }
.hidden { display: none !important; }
.screen { min-height: 100vh; min-height: 100dvh; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ===== LOGIN ===== */
#login-screen { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e3a5f 0%, #2d5a8d 100%); padding: 1rem; }
.login-box { background: var(--surface); padding: 1.75rem 1.5rem 1.5rem; border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,0.2); width: 100%; max-width: 420px; }
.logo { text-align: center; margin-bottom: 1.25rem; }
.logo-img { width: 92px; height: 92px; }
.logo h1 { margin: 0.75rem 0 0.25rem; color: var(--primary); font-size: 1.3rem; line-height: 1.2; }
.subtitle { color: var(--muted); margin: 0; font-size: 0.9rem; }
#login-form label { display: block; font-size: 0.85rem; font-weight: 600; margin: 1rem 0 0.35rem; color: var(--primary); }
#login-form input, #login-form select { width: 100%; padding: 0.75rem; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; background: white; }
#login-form button { width: 100%; padding: 0.85rem; margin-top: 1.5rem; background: var(--primary); color: white; border: none; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; min-height: 48px; }
#login-form button:hover { background: var(--primary-dark); }
.error-msg { color: var(--danger); margin-top: 0.75rem; font-size: 0.9rem; min-height: 1.2em; }
.hint { font-size: 0.8rem; color: var(--muted); text-align: center; margin-top: 1.25rem; }

/* ===== TOPBAR ===== */
.topbar { background: var(--primary); color: white; padding: 0.75rem 1.25rem; display: flex; align-items: center; justify-content: space-between; box-shadow: var(--shadow); position: sticky; top: 0; z-index: 50; }
.brand { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.brand-icon { width: 38px; height: 38px; flex-shrink: 0; border-radius: 6px; background: rgba(255,255,255,0.08); padding: 2px; }
.brand-text strong { display: block; font-size: 0.95rem; line-height: 1.1; }
.brand-text small { display: block; opacity: 0.75; font-size: 0.72rem; margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 0.65rem; }
#user-label { color: rgba(255,255,255,0.85); font-size: 0.85rem; }
.btn-ghost { background: transparent; border: 1px solid rgba(255,255,255,0.3); color: white; padding: 0.45rem 0.8rem; border-radius: 8px; cursor: pointer; font-size: 0.9rem; min-height: 36px; }
.btn-ghost:hover { background: rgba(255,255,255,0.1); }
.menu-toggle { display: none; font-size: 1.2rem; padding: 0.3rem 0.7rem; }

/* ===== LAYOUT (sidebar izquierdo + contenido) ===== */
.layout { display: flex; align-items: stretch; min-height: calc(100vh - 64px); min-height: calc(100dvh - 64px); }
.sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1rem 0.75rem 1.5rem;
  box-shadow: 2px 0 10px rgba(0,0,0,0.03);
  position: sticky;
  top: 64px;
  align-self: flex-start;
  height: calc(100vh - 64px);
  height: calc(100dvh - 64px);
  overflow-y: auto;
  z-index: 5;
}
.main-content {
  flex: 1 1 auto;
  min-width: 0;
  padding: 1.5rem;
  overflow-x: hidden;
}
.menu { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.menu-item {
  display: block; width: 100%; text-align: left;
  background: transparent; border: none;
  padding: 0.7rem 0.85rem; border-radius: 8px;
  cursor: pointer; font-size: 0.9rem; font-weight: 500; color: var(--text);
  transition: background 0.15s ease, color 0.15s ease;
  line-height: 1.35;
}
.menu-item:hover { background: var(--bg); }
.menu-item.active { background: linear-gradient(135deg, var(--primary) 0%, #2c4f7a 100%); color: white; font-weight: 600; box-shadow: 0 2px 6px rgba(30,58,95,0.25); }
.menu-group { margin-top: 0.85rem; }
.menu-group-title { font-size: 0.7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; padding: 0.45rem 0.85rem 0.25rem; border-top: 1px solid var(--border); margin-top: 0.4rem; }
.menu > li:first-child.menu-group { margin-top: 0; }
.menu > li:first-child.menu-group .menu-group-title { border-top: none; margin-top: 0; padding-top: 0.1rem; }
.submenu { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.submenu .menu-item { padding-left: 1.5rem; font-size: 0.85rem; }
.menu-divider { height: 1px; background: var(--border); margin: 0.6rem 0.5rem; list-style: none; }
.menu-item-prom { background: linear-gradient(135deg, rgba(200,164,92,0.18), rgba(200,164,92,0.08)); border-left: 3px solid var(--accent); padding-left: 0.6rem; font-weight: 600; }
.menu-item-prom:hover { background: linear-gradient(135deg, rgba(200,164,92,0.28), rgba(200,164,92,0.16)); }
.menu-item-prom.active { background: linear-gradient(135deg, #c8a45c 0%, #a37e3a 100%); color: white; border-left-color: #fff; }
.sidebar-foot { margin-top: 1.5rem; padding: 1rem 0.85rem 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.72rem; line-height: 1.4; text-align: center; }

/* ===== VIEWS ===== */
.view { display: none; }
.view.active { display: block; animation: fadeUp 0.3s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.view-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.view-header h2 { color: var(--primary); margin: 0; font-size: 1.35rem; }
.view-header p { color: var(--muted); margin: 0.2rem 0 0; font-size: 0.92rem; }
.view-header-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.section-h { color: var(--primary); margin: 1.75rem 0 0.8rem; font-size: 1rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--border); }

/* ===== KPIs ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 0.5rem; }
.kpi { background: linear-gradient(135deg, #fff 0%, #fafbfc 100%); padding: 1rem 1.15rem; border-radius: 14px; border: 1px solid rgba(20,40,73,0.06); box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(20,40,73,0.06); display: flex; align-items: flex-start; gap: 0.85rem; position: relative; overflow: hidden; transition: transform 0.18s ease, box-shadow 0.18s ease; }
.kpi::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--kpi-color, var(--accent)) 0%, transparent 70%); }
.kpi[data-drill] { cursor: pointer; }
.kpi[data-drill]:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.06), 0 14px 32px rgba(20,40,73,0.14); }
.kpi-icon { flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--kpi-bg, rgba(30,58,95,0.08)); font-size: 1.2rem; }
.kpi-content { min-width: 0; flex: 1; }
.kpi-label { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; line-height: 1.25; }
.kpi-value { font-size: 1.75rem; font-weight: 700; color: var(--primary); line-height: 1.05; margin-top: 0.3rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-trend { font-size: 0.7rem; margin-top: 0.3rem; color: var(--muted); line-height: 1.25; }
.kpi-primary    { --kpi-color: #1e3a5f; --kpi-bg: rgba(30,58,95,0.10); }
.kpi-accent     { --kpi-color: #c8a45c; --kpi-bg: rgba(200,164,92,0.16); }
.kpi-success    { --kpi-color: #16a34a; --kpi-bg: rgba(34,197,94,0.13); }
.kpi-info       { --kpi-color: #2563eb; --kpi-bg: rgba(37,99,235,0.11); }
.kpi-temple     { --kpi-color: #7c3aed; --kpi-bg: rgba(124,58,237,0.11); }
.kpi-warm       { --kpi-color: #db2777; --kpi-bg: rgba(219,39,119,0.11); }
.kpi-purple     { --kpi-color: #5340b5; --kpi-bg: rgba(83,64,181,0.11); }
.kpi-recent     { --kpi-color: #0891b2; --kpi-bg: rgba(8,145,178,0.11); }
.kpi-priesthood { --kpi-color: #1e3a5f; --kpi-bg: rgba(30,58,95,0.10); }
.kpi-alert      { --kpi-color: #dc2626; --kpi-bg: rgba(220,38,38,0.12); background: linear-gradient(135deg, #fff 0%, #fef5f5 100%); border-color: rgba(220,38,38,0.18); }
.kpi-alert .kpi-value { color: #dc2626; }
.kpi-index      { background: linear-gradient(135deg, #1e3a5f 0%, #2d5a8d 100%); color: #fff; border-color: rgba(255,255,255,0.18); }
.kpi-index .kpi-label { color: rgba(255,255,255,0.85); }
.kpi-index .kpi-value { color: #fff; }
.kpi-index .kpi-trend { color: rgba(255,255,255,0.7); }
.kpi-index .kpi-icon { background: rgba(255,255,255,0.18); color: #ffd9a3; }

/* ===== FREQUENCIA TABLE (Info Hub: 3 checkboxes por barrio) ===== */
.freq-table { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.5rem; }
.freq-row {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 0.4rem;
  align-items: center;
  padding: 0.5rem 0.65rem;
  background: var(--bg);
  border-radius: 8px;
  font-size: 0.9rem;
}
.freq-row.freq-head {
  background: transparent;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-bottom: 0.25rem;
}
.freq-row.freq-head > span { text-align: center; }
.freq-row.freq-head > span:first-child { text-align: left; }
.freq-row.freq-head + .freq-row { border-top: 1px solid var(--border); }
/* Primera columna (Barrio) en formato regular */
.freq-row .freq-barrio { font-weight: 600; color: var(--text); }
.freq-row .freq-cb { display: flex; justify-content: center; align-items: center; cursor: pointer; }
.freq-row .freq-cb input { transform: scale(1.2); cursor: pointer; }

/* Variante "Primera Tema" con 2 columnas (Sí/No) */
.freq-table.cols-2 .freq-row,
.info-card #info-primer-tema-table .freq-row { grid-template-columns: 1.5fr repeat(2, 1fr); }

/* ===== LISTA INFORME ÁREA ===== */
.ia-list {
  list-style: none;
  padding: 0;
  margin: 0;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid rgba(20,40,73,0.06);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(20,40,73,0.06);
  overflow: hidden;
}
.ia-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s ease, padding-left 0.15s ease;
  counter-increment: ia-counter;
}
.ia-list { counter-reset: ia-counter; }
.ia-list-item::before {
  content: counter(ia-counter);
  background: var(--primary);
  color: white;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700;
  flex-shrink: 0;
  margin-right: 0.4rem;
}
.ia-list-item:last-child { border-bottom: none; }
.ia-list-item:hover { background: linear-gradient(90deg, rgba(200,164,92,0.10), transparent); padding-left: 1.4rem; }
.ia-list-item.ia-item-admin {
  background: linear-gradient(90deg, rgba(124,58,237,0.06) 0%, transparent 100%);
  border-left: 3px solid #7c3aed;
}
.ia-list-item.ia-item-admin::before { background: #7c3aed; }
.ia-list-label { flex: 1; font-size: 0.92rem; color: var(--text); line-height: 1.4; }
.ia-list-value {
  background: var(--primary);
  color: white;
  padding: 0.35rem 0.85rem;
  border-radius: 100px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 50px;
  text-align: center;
}

@media (max-width: 640px) {
  .freq-row { grid-template-columns: 1.3fr repeat(3, 1fr); font-size: 0.8rem; gap: 0.3rem; padding: 0.4rem 0.5rem; }
  .info-card #info-primer-tema-table .freq-row { grid-template-columns: 1.3fr repeat(2, 1fr); }
  .ia-list-item { padding: 0.7rem 0.85rem; gap: 0.55rem; flex-wrap: wrap; }
  .ia-list-label { font-size: 0.85rem; flex: 1 1 60%; min-width: 0; }
  .ia-list-value { font-size: 0.92rem; }
}

/* ===== HUB (Información Consejo de Barrio) ===== */
.hub-card {
  background: var(--surface);
  padding: 1.15rem 1.4rem 1.25rem;
  border-radius: 14px;
  border: 1px solid rgba(20,40,73,0.06);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(20,40,73,0.06);
  margin-bottom: 1rem;
}
.hub-title {
  color: var(--primary);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}
.hub-clickable {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.18s ease, border-color 0.15s ease;
}
.hub-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.06), 0 16px 36px rgba(20,40,73,0.14);
  border-color: rgba(30,58,95,0.18);
}
.hub-clickable::after {
  content: '→ Abrir';
  position: absolute;
  top: 1rem; right: 1.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  opacity: 0.6;
  transition: opacity 0.15s ease, transform 0.15s ease, color 0.15s ease;
}
.hub-clickable { position: relative; }
.hub-clickable:hover::after { opacity: 1; color: var(--primary); transform: translateX(3px); }
.hub-separator { border: none; border-top: 1px dashed var(--border); margin: 1.5rem 0; }

/* ===== INFO BANNER ===== */
.info-banner { background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%); border: 1px solid #93c5fd; border-left: 4px solid #2563eb; padding: 0.85rem 1.15rem; border-radius: 10px; font-size: 0.92rem; line-height: 1.5; color: #1e3a8a; }

/* ===== INFO CARDS (Información Consejo de Barrio) ===== */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.info-card { background: var(--surface); padding: 1.15rem 1.25rem; border-radius: 12px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.info-card h3 { color: var(--primary); font-size: 1rem; margin: 0 0 0.4rem; }
.info-card .checkbox-list { margin-top: 0.6rem; display: flex; flex-direction: column; gap: 0.45rem; }
.info-card .checkbox-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0.55rem; border-radius: 8px; background: var(--bg); cursor: pointer; }
.info-card .checkbox-row:hover { background: #eef2f7; }
.info-card .checkbox-row input[type="checkbox"] { transform: scale(1.15); cursor: pointer; }
.info-card .checkbox-row.checked { background: #d1fae5; }
.info-card .checkbox-row span { font-size: 0.92rem; }

/* ===== IFRAME EMBED ===== */
.embedded-form { width: 100%; height: calc(100vh - 200px); min-height: 500px; border: 1px solid var(--border); border-radius: 12px; background: white; box-shadow: var(--shadow); }

/* ===== CHARTS ===== */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.chart-card { background: #ffffff; padding: 1.15rem 1.25rem 1rem; border-radius: 14px; border: 1px solid rgba(20,40,73,0.06); box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(20,40,73,0.06); }
.chart-card:hover { box-shadow: 0 4px 10px rgba(0,0,0,0.06), 0 14px 32px rgba(20,40,73,0.10); }
.chart-head { margin-bottom: 0.7rem; }
.chart-head h3 { color: var(--primary); margin: 0; font-size: 0.95rem; }
.chart-box { position: relative; width: 100%; height: 260px; }
.toolbar-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
@media (max-width: 640px) {
  .chart-grid { grid-template-columns: 1fr; }
  .chart-box { height: 220px; }
}

/* ===== FILTER SELECT ===== */
.filter-select { padding: 0.55rem 2rem 0.55rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; background: white; min-height: 42px; font-size: 0.9rem; color: var(--text); appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='%231e3a5f' d='M2 4l4 4 4-4z'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; min-width: 180px; cursor: pointer; }

/* ===== BUTTONS ===== */
.btn-primary, .btn-secondary, .btn-danger { padding: 0.65rem 1.2rem; border-radius: 8px; border: none; font-size: 0.92rem; font-weight: 600; cursor: pointer; min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; text-decoration: none; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: white; color: var(--primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-small { padding: 0.4rem 0.85rem; font-size: 0.82rem; min-height: 36px; }

/* ===== FORM (Admin Users) ===== */
.record-form { background: var(--surface); padding: 1.25rem; border-radius: 12px; box-shadow: var(--shadow); border: 1px solid rgba(20,40,73,0.06); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.form-grid label { display: flex; flex-direction: column; font-size: 0.85rem; font-weight: 600; color: var(--primary); gap: 0.35rem; }
.form-grid input, .form-grid select { padding: 0.65rem; border: 1px solid var(--border); border-radius: 8px; font-size: 0.95rem; font-weight: normal; color: var(--text); min-height: 44px; background: white; }
.form-grid input:focus, .form-grid select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.form-actions { margin-top: 1.5rem; display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

/* ===== TABLE ===== */
.table-wrap { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); overflow-x: auto; border: 1px solid rgba(20,40,73,0.06); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.7rem 0.9rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: #fafbfc; color: var(--primary); font-weight: 600; }
tbody tr:hover { background: #f9fafb; }
td code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-family: 'Menlo','Consolas',monospace; font-size: 0.85em; }
.tbl-actions { white-space: nowrap; }
.tbl-actions button { background: transparent; border: 1px solid var(--border); padding: 0.4rem 0.6rem; border-radius: 6px; cursor: pointer; margin-right: 0.25rem; }
.tbl-actions .del { color: var(--danger); border-color: #fecaca; }

/* ===== CONFIG SECTION ===== */
.config-section { background: var(--surface); padding: 1.15rem 1.4rem; border-radius: 12px; box-shadow: var(--shadow); border: 1px solid rgba(20,40,73,0.06); margin-bottom: 1.2rem; }
.config-section h3 { margin-top: 0; color: var(--primary); font-size: 1rem; }
.config-chips { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.55rem; }
.config-chip { background: var(--bg); border: 1px solid var(--border); padding: 0.35rem 0.75rem; border-radius: 100px; font-size: 0.88rem; font-weight: 600; color: var(--primary); }

/* ===== CARGAS GRID ===== */
.cargas-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.1rem; }
.carga-card { background: var(--surface); padding: 1.2rem 1.3rem; border-radius: 12px; box-shadow: var(--shadow); border: 1px solid rgba(20,40,73,0.06); }
.carga-card h3 { color: var(--primary); margin: 0 0 0.5rem; font-size: 1rem; }
.sync-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.85rem; }
.file-btn { display: inline-flex; align-items: center; cursor: pointer; }

/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 900px) {
  .layout { display: block; }
  .sidebar {
    position: fixed;
    top: 64px; left: -100%;
    width: 280px;
    height: calc(100vh - 64px);
    height: calc(100dvh - 64px);
    z-index: 100;
    transition: left 0.25s ease;
    box-shadow: 8px 0 24px rgba(0,0,0,0.15);
    flex: none;
  }
  .sidebar.open { left: 0; }
  .main-content { width: 100%; }
  .menu-toggle { display: inline-flex; }
}
@media (max-width: 640px) {
  .topbar { padding: 0.7rem 0.9rem; }
  .main-content { padding: 1rem 0.85rem 1.5rem; }
  .view-header { gap: 0.65rem; }
  .view-header h2 { font-size: 1.2rem; }
  .view-header-actions { width: 100%; }
  .view-header-actions .filter-select { flex: 1; min-width: 0; }
  .view-header-actions .btn-primary { width: 100%; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 0.65rem; }
  .kpi { padding: 0.8rem 0.85rem; gap: 0.55rem; }
  .kpi-icon { width: 34px; height: 34px; font-size: 1rem; }
  .kpi-value { font-size: 1.4rem; }
  .kpi-label { font-size: 0.66rem; }
  .embedded-form { height: calc(100vh - 180px); }
  #user-label { display: none; }
}
@media (max-width: 400px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .brand-text strong { font-size: 0.85rem; }
}
