/* ==========================================================================
   Centinela Normativo — Dashboard estático (maqueta visual)
   ========================================================================== */

:root {
  --sidebar-bg: #1a202c;
  --sidebar-bg-hover: #232b3b;
  --sidebar-text: #a0aec0;
  --sidebar-text-active: #ffffff;
  --sidebar-border: #2d3748;

  --bg-main: #f4f6f9;
  --bg-card: #ffffff;
  --bg-card-alt: #f9fafb;

  --text-primary: #1a202c;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  --border-light: #e5e9f0;

  --accent-blue: #2563eb;
  --accent-blue-dark: #1e3a8a;
  --accent-yellow: #f59e0b;
  --accent-green: #22c55e;
  --accent-red: #ef4444;

  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 999px;

  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-float: 0 10px 25px rgba(37, 99, 235, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
}

html {
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  width: 100%;
  overscroll-behavior-y: none;
}

body.no-scroll {
  overflow: hidden;
  height: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ==========================================================================
   Layout
   ========================================================================== */

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

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content {
  flex: 1;
  padding: 24px 32px 100px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  z-index: 60;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-backdrop {
  display: none;
}

.hamburger-btn {
  display: none;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent-blue), #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

.sidebar-logo-text {
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.2px;
}

.sidebar-logo-sub {
  display: block;
  color: var(--sidebar-text);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.4px;
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px 24px;
}

.nav-section {
  margin-bottom: 20px;
}

.nav-section-title {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #4a5568;
  padding: 0 12px;
  margin-bottom: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--sidebar-text);
  position: relative;
  margin-bottom: 2px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.nav-item:hover {
  background: var(--sidebar-bg-hover);
  color: #fff;
}

.nav-item.active {
  background: var(--accent-blue);
  color: #fff;
}

.nav-item .icon {
  width: 17px;
  height: 17px;
  opacity: 0.9;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent-red);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.sidebar-footer {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-footer-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 12.5px;
  flex-shrink: 0;
}

.sidebar-footer-name {
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
}

.sidebar-footer-role {
  color: var(--sidebar-text);
  font-size: 11px;
}

/* ==========================================================================
   Topbar
   ========================================================================== */

.topbar {
  height: 68px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.search-box {
  flex: 1;
  min-width: 0;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 9px 14px;
  color: var(--text-muted);
}

.search-box .icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.search-box input {
  border: none;
  background: none;
  outline: none;
  font-size: 13px;
  color: var(--text-primary);
  width: 100%;
  min-width: 0;
  font-family: inherit;
  text-overflow: ellipsis;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.topbar-datetime {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 16px;
  border-left: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  margin-left: auto;
}

.topbar-time {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.topbar-date {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s ease, transform 0.1s ease;
}

.icon-btn:hover {
  background: var(--bg-card-alt);
}

.icon-btn:active,
.nav-item:active,
.chip:active,
.fab:active,
.btn-primary:active {
  transform: scale(0.96);
}

.hamburger-btn {
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  touch-action: manipulation;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.hamburger-btn:hover {
  background: var(--bg-card-alt);
}

.hamburger-btn .icon {
  width: 21px;
  height: 21px;
}

.icon-btn .dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--accent-red);
  border: 2px solid var(--bg-card);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 8px;
  margin-left: 4px;
  border-left: 1px solid var(--border-light);
}

.topbar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #60a5fa, var(--accent-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

.topbar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
}

.topbar-user-role {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ==========================================================================
   Section headings
   ========================================================================== */

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 28px 0 14px;
}

.content > .section-title:first-child {
  margin-top: 4px;
}

/* ==========================================================================
   Summary cards (yellow border)
   ========================================================================== */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--accent-yellow);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow-card);
}

.summary-card .card-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: #fffbeb;
  color: var(--accent-yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.summary-card.is-status .card-icon {
  background: #ecfdf5;
  color: var(--accent-green);
}

.summary-card-label {
  font-size: 11.5px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 4px;
}

.summary-card-value {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-green);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

/* ==========================================================================
   Alerts section (dark blue border)
   ========================================================================== */

.alert-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.alert-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--accent-blue-dark);
  border-radius: var(--radius-lg);
  padding: 15px 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow-card);
}

.alert-card.is-urgent {
  border-left-color: var(--accent-red);
  background: #fff8f8;
}

.alert-card .card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: #eef2ff;
  color: var(--accent-blue-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.alert-card.is-urgent .card-icon {
  background: #fee2e2;
  color: var(--accent-red);
}

.alert-body {
  flex: 1;
  min-width: 0;
}

.alert-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.alert-title .tag-urgent {
  display: inline-block;
  background: var(--accent-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  margin-right: 8px;
  vertical-align: middle;
}

.alert-text {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.alert-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  font-weight: 500;
}

.alert-link {
  flex-shrink: 0;
  align-self: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-blue);
  white-space: nowrap;
  cursor: pointer;
}

/* ==========================================================================
   Bottom 3-column grid
   ========================================================================== */

.bottom-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 8px;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.panel.is-alerts {
  border-top: 3px solid var(--accent-red);
}

.panel.is-monitor {
  border-top: 3px solid var(--accent-green);
}

.panel.is-ranking {
  border-top: 3px solid var(--accent-blue);
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.panel-header .icon {
  width: 16px;
  height: 16px;
}

.panel-header.is-alerts { color: var(--accent-red); }
.panel-header.is-monitor { color: #16a34a; }
.panel-header.is-ranking { color: var(--accent-blue); }

/* Ranking list */

.rank-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rank-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: #eff6ff;
  color: var(--accent-blue);
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rank-info {
  flex: 1;
  min-width: 0;
}

.rank-top-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 5px;
}

.rank-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.rank-count {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent-blue);
  white-space: nowrap;
}

.progress-track {
  height: 6px;
  border-radius: var(--radius-full);
  background: #eef1f6;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, #60a5fa, var(--accent-blue));
}

/* Normas por revisar list */

.review-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.review-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.review-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  background: #fef2f2;
  color: var(--accent-red);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.review-info {
  flex: 1;
  min-width: 0;
}

.review-top-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 5px;
}

.review-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.review-pct {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent-red);
  white-space: nowrap;
}

.review-status {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 4px;
}

.review-track {
  height: 6px;
  border-radius: var(--radius-full);
  background: #eef1f6;
  overflow: hidden;
}

.review-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, #f87171, var(--accent-red));
}

/* Monitor list */

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

.monitor-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border-light);
}

.monitor-row:last-child {
  border-bottom: none;
}

.monitor-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  background: #ecfdf5;
  color: #16a34a;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.monitor-info {
  flex: 1;
  min-width: 0;
}

.monitor-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.monitor-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.monitor-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #16a34a;
  white-space: nowrap;
}

/* ==========================================================================
   View header (per-section)
   ========================================================================== */

.view-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.view-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.view-icon .icon {
  width: 21px;
  height: 21px;
}

.view-icon.is-blue { background: #eff6ff; color: var(--accent-blue); }
.view-icon.is-navy { background: #eef2ff; color: var(--accent-blue-dark); }
.view-icon.is-yellow { background: #fffbeb; color: var(--accent-yellow); }
.view-icon.is-green { background: #ecfdf5; color: #16a34a; }
.view-icon.is-red { background: #fef2f2; color: var(--accent-red); }
.view-icon.is-slate { background: #f1f5f9; color: #475569; }

.view-title {
  font-size: 21px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.view-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ==========================================================================
   Filter chips
   ========================================================================== */

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.chip {
  padding: 7px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.chip.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
}

/* ==========================================================================
   Data table
   ========================================================================== */

.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--bg-card-alt);
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.data-table td {
  padding: 13px 18px;
  font-size: 12.5px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table td.is-muted {
  color: var(--text-secondary);
}

.data-table .link-action {
  color: var(--accent-blue);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-status.is-green { background: #ecfdf5; color: #16a34a; }
.badge-status.is-yellow { background: #fffbeb; color: #b45309; }
.badge-status.is-red { background: #fef2f2; color: #dc2626; }
.badge-status.is-blue { background: #eff6ff; color: var(--accent-blue); }

.badge-status .dot-sm {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: currentColor;
}

/* ==========================================================================
   Generic surface card
   ========================================================================== */

.surface-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
}

.surface-card + .surface-card {
  margin-top: 16px;
}

.surface-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.surface-card-title .icon {
  width: 16px;
  height: 16px;
  color: var(--accent-blue);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

/* ==========================================================================
   Form fields (Búsqueda avanzada / Configuración)
   ========================================================================== */

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

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

.field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.field select,
.field input {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-card-alt);
  outline: none;
}

.field-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.btn-primary {
  background: var(--accent-blue);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.btn-primary .icon {
  width: 15px;
  height: 15px;
}

/* Search result rows */

.result-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-row {
  padding: 14px 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.result-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.result-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.result-snippet {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 6px;
}

.result-meta {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ==========================================================================
   Stat tiles (Analítica BI)
   ========================================================================== */

.stat-tile-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.stat-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
}

.stat-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.stat-tile-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-tile-icon .icon {
  width: 15px;
  height: 15px;
}

.stat-tile-icon.is-blue { background: #eff6ff; color: var(--accent-blue); }
.stat-tile-icon.is-navy { background: #eef2ff; color: var(--accent-blue-dark); }
.stat-tile-icon.is-yellow { background: #fffbeb; color: var(--accent-yellow); }
.stat-tile-icon.is-green { background: #ecfdf5; color: #16a34a; }

.stat-tile-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.stat-tile-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
}

.stat-tile-delta {
  font-size: 11px;
  font-weight: 700;
  margin-top: 6px;
}

.stat-tile-delta.is-up { color: #16a34a; }
.stat-tile-delta.is-down { color: var(--accent-red); }

/* Bar chart mockup */

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 160px;
  padding-top: 10px;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
}

.bar-col .bar {
  width: 100%;
  max-width: 26px;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, #60a5fa, var(--accent-blue));
}

.bar-col .bar-label {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Donut chart mockup */

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 22px;
}

.donut {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  flex-shrink: 0;
  background: conic-gradient(
    var(--accent-blue) 0% 34%,
    #60a5fa 34% 55%,
    var(--accent-yellow) 55% 72%,
    var(--accent-green) 72% 87%,
    var(--accent-red) 87% 100%
  );
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 18px;
  background: var(--bg-card);
  border-radius: 50%;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.donut-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.donut-legend-row .swatch {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex-shrink: 0;
}

.donut-legend-row .swatch-name {
  color: var(--text-primary);
  font-weight: 600;
  margin-right: 4px;
}

/* ==========================================================================
   Toggle rows (Panel de Control / Configuración)
   ========================================================================== */

.toggle-list {
  display: flex;
  flex-direction: column;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--border-light);
}

.toggle-row:last-child {
  border-bottom: none;
}

.toggle-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: #eff6ff;
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toggle-icon.is-yellow { background: #fffbeb; color: var(--accent-yellow); }
.toggle-icon.is-green { background: #ecfdf5; color: #16a34a; }
.toggle-icon.is-red { background: #fef2f2; color: var(--accent-red); }
.toggle-icon.is-slate { background: #f1f5f9; color: #475569; }
.toggle-icon.is-navy { background: #eef2ff; color: var(--accent-blue-dark); }

.toggle-info {
  flex: 1;
  min-width: 0;
}

.toggle-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.toggle-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.switch {
  width: 40px;
  height: 22px;
  border-radius: var(--radius-full);
  background: #e2e8f0;
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: left 0.15s ease;
}

.switch.is-on {
  background: var(--accent-blue);
}

.switch.is-on::after {
  left: 20px;
}

/* ==========================================================================
   Report cards (Power BI)
   ========================================================================== */

.report-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.report-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.report-thumb {
  height: 92px;
  background: linear-gradient(135deg, #eef2ff, #dbeafe);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-blue);
}

.report-thumb.is-yellow { background: linear-gradient(135deg, #fffbeb, #fef3c7); color: var(--accent-yellow); }
.report-thumb.is-green { background: linear-gradient(135deg, #ecfdf5, #d1fae5); color: #16a34a; }
.report-thumb.is-navy { background: linear-gradient(135deg, #eef2ff, #e0e7ff); color: var(--accent-blue-dark); }

.report-thumb .icon {
  width: 30px;
  height: 30px;
}

.report-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.report-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
}

.report-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.report-open {
  margin-top: auto;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent-blue);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

/* ==========================================================================
   Source rows (Fuentes del Estado)
   ========================================================================== */

.source-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.source-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.source-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: #ecfdf5;
  color: #16a34a;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.source-icon .icon {
  width: 17px;
  height: 17px;
}

.source-icon.is-blue { background: #eff6ff; color: var(--accent-blue); }
.source-icon.is-navy { background: #eef2ff; color: var(--accent-blue-dark); }
.source-icon.is-yellow { background: #fffbeb; color: var(--accent-yellow); }

.source-info {
  flex: 1;
  min-width: 0;
}

.source-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.source-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* ==========================================================================
   Timeline (Historial de Cambios / Perfil)
   ========================================================================== */

.timeline {
  position: relative;
  padding-left: 22px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border-light);
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-blue);
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 0 2px var(--accent-blue);
}

.timeline-time {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 3px;
}

.timeline-text {
  font-size: 12.5px;
  color: var(--text-primary);
  line-height: 1.5;
}

.timeline-text strong {
  font-weight: 700;
}

/* ==========================================================================
   Maintenance list (Mantenimiento Continuo)
   ========================================================================== */

.maint-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border-light);
}

.maint-row:last-child {
  border-bottom: none;
}

.maint-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--bg-card-alt);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.maint-icon.is-blue { background: #eff6ff; color: var(--accent-blue); }
.maint-icon.is-green { background: #ecfdf5; color: #16a34a; }
.maint-icon.is-yellow { background: #fffbeb; color: var(--accent-yellow); }

.maint-info {
  flex: 1;
  min-width: 0;
}

.maint-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.maint-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==========================================================================
   Profile view
   ========================================================================== */

.profile-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #60a5fa, var(--accent-blue));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  flex-shrink: 0;
}

.profile-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.profile-role {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.profile-meta {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.profile-stat {
  text-align: center;
  padding: 14px;
  background: var(--bg-card-alt);
  border-radius: var(--radius-md);
}

.profile-stat-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent-blue);
}

.profile-stat-label {
  font-size: 10.5px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-top: 4px;
}

/* ==========================================================================
   Support view (FAQ / contact)
   ========================================================================== */

.faq-item {
  padding: 13px 4px;
  border-bottom: 1px solid var(--border-light);
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-q {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.faq-a {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.contact-row .toggle-icon {
  background: #eff6ff;
  color: var(--accent-blue);
}

/* ==========================================================================
   Resources view
   ========================================================================== */

.resource-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border-light);
}

.resource-row:last-child {
  border-bottom: none;
}

.resource-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: #fff7ed;
  color: var(--accent-yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.resource-info {
  flex: 1;
  min-width: 0;
}

.resource-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.resource-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.resource-action {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent-blue);
  white-space: nowrap;
  cursor: pointer;
}

/* ==========================================================================
   Floating action button
   ========================================================================== */

.fab {
  position: fixed;
  bottom: 30px;
  right: 34px;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #3b82f6, var(--accent-blue));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-float);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  z-index: 20;
}

.fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.42);
}

.fab .icon {
  width: 24px;
  height: 24px;
  stroke-width: 2.2;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1180px) {
  .summary-grid,
  .stat-tile-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .bottom-grid,
  .report-grid,
  .source-grid,
  .two-col {
    grid-template-columns: 1fr;
  }
  .field-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---- Tablet / mobile: sidebar becomes an off-canvas drawer ---- */

@media (max-width: 900px) {
  .app {
    overflow-x: hidden;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    height: 100dvh;
    transform: translateX(-100%);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }

  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: 18px 0 40px rgba(15, 23, 42, 0.35);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 55;
  }

  .sidebar-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
  }

  .hamburger-btn {
    display: flex;
  }

  .topbar {
    padding: 0 16px;
    gap: 12px;
  }

  .content {
    padding: 18px 16px 110px;
  }

  .topbar-datetime {
    display: none;
  }

  .topbar-user-name,
  .topbar-user-role {
    display: none;
  }

  .topbar-user {
    padding-left: 0;
    margin-left: 0;
    border-left: none;
  }

  .data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ---- Phones: card-ified tables, single-column layout, no accidental zoom ---- */

@media (max-width: 640px) {
  .summary-grid,
  .stat-tile-grid,
  .field-grid,
  .source-grid {
    grid-template-columns: 1fr;
  }

  .view-title {
    font-size: 18px;
  }

  .view-icon {
    width: 36px;
    height: 36px;
  }

  .profile-card {
    flex-direction: column;
    text-align: center;
  }

  .profile-stats {
    grid-template-columns: 1fr;
  }

  .donut-wrap {
    flex-direction: column;
    align-items: flex-start;
  }

  .bar-chart {
    gap: 6px;
  }

  .alert-card {
    flex-wrap: wrap;
  }

  .alert-link {
    margin-left: 46px;
  }

  /* Data table -> stacked cards */
  .table-card {
    border: none;
    background: none;
    box-shadow: none;
  }

  .data-table,
  .data-table thead,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table thead {
    display: none;
  }

  .data-table tr {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 6px 14px;
    margin-bottom: 12px;
  }

  .data-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 2px;
    border-bottom: 1px solid var(--border-light);
    text-align: right;
  }

  .data-table tr td:first-child {
    font-weight: 700;
  }

  .data-table tr td:last-child {
    border-bottom: none;
  }

  .data-table td::before {
    content: attr(data-label);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    text-align: left;
    flex-shrink: 0;
  }

  /* Larger, thumb-friendly tap targets */
  .nav-item {
    padding: 12px 12px;
    font-size: 14px;
  }

  .chip {
    padding: 9px 16px;
  }

  .icon-btn {
    width: 42px;
    height: 42px;
  }

  .fab {
    width: 52px;
    height: 52px;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    right: 20px;
  }

  /* Prevent iOS Safari auto-zoom on focus (inputs must be >=16px) */
  .field select,
  .field input,
  .search-box input {
    font-size: 16px;
  }
}

@media (max-width: 420px) {
  .content {
    padding: 14px 12px 110px;
  }

  .sidebar {
    width: 86%;
    max-width: 300px;
  }

  .topbar {
    height: 60px;
    padding: 0 12px;
  }

  .search-box {
    padding: 8px 12px;
  }

  .summary-card,
  .alert-card,
  .panel,
  .surface-card {
    padding: 14px;
  }

  .report-grid {
    grid-template-columns: 1fr;
  }
}
