:root {
  --bg-base: #0c1222;
  --bg-surface: #111a2e;
  --bg-card: #182238;
  --bg-card-hover: #1f2c47;
  --border-color: #2b3954;
  --border-glow: rgba(56, 189, 248, 0.4);
  
  --text-primary: #ffffff;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --color-emerald: #10b981;
  --color-emerald-glow: rgba(16, 185, 129, 0.25);
  --color-rose: #f43f5e;
  --color-rose-glow: rgba(244, 63, 94, 0.25);
  --color-amber: #f59e0b;
  --color-amber-glow: rgba(245, 158, 11, 0.25);
  --color-cyan: #0ea5e9;
  --color-cyan-glow: rgba(14, 165, 233, 0.25);

  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

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

body {
  background: radial-gradient(circle at 50% 0%, #152038 0%, var(--bg-base) 100%);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Background Ambient Glow (suave y sutil para no deslumbrar) */
.glow-sphere {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.15;
}
.glow-sphere-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #0284c7 0%, transparent 70%);
  top: -80px;
  left: 20%;
}
.glow-sphere-2 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #059669 0%, transparent 70%);
  bottom: -80px;
  right: 15%;
}

.app-container {
  position: relative;
  z-index: 1;
  max-width: 1300px;
  margin: 0 auto;
  padding: 1.5rem;
  padding-top: max(1.25rem, env(safe-area-inset-top));
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* HEADER */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.2rem 1.75rem;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.logo-box {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  box-shadow: 0 0 15px var(--color-cyan-glow);
}

.app-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 40%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: block;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 1.1rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all 0.3s ease;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.status-operational {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}
.status-operational .status-dot {
  background: var(--color-emerald);
  box-shadow: 0 0 10px var(--color-emerald);
  animation: pulse-dot 2s infinite;
}

.status-degraded {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}
.status-degraded .status-dot {
  background: var(--color-amber);
  box-shadow: 0 0 10px var(--color-amber);
  animation: pulse-dot 1.5s infinite;
}

.status-critical {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fb7185;
}
.status-critical .status-dot {
  background: var(--color-rose);
  box-shadow: 0 0 12px var(--color-rose);
  animation: pulse-dot 1s infinite;
}

.status-loading {
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.3);
  color: #38bdf8;
}
.status-loading .status-dot {
  background: var(--color-cyan);
  box-shadow: 0 0 8px var(--color-cyan);
  animation: pulse-dot 1s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.time-box {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.time-tz {
  color: var(--text-muted);
  font-size: 0.72rem;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}
.btn-secondary.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.btn-outline {
  background: transparent;
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}
.btn-outline:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.6);
}

.btn-icon-only {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-icon-only:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.12);
}
.btn-icon-only svg {
  width: 18px;
  height: 18px;
}
.btn-icon {
  width: 16px;
  height: 16px;
}

/* CARDS COMMON */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

/* STATS OVERVIEW SECTION */
.stats-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.9rem;
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.stat-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.stat-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
}
.stat-footer strong {
  color: var(--text-secondary);
}

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge-emerald {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
}
.badge-rose {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fb7185;
}
.badge-amber {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}
.badge-cyan {
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(14, 165, 233, 0.4);
  color: #38bdf8;
}

/* OPENVPN CLIENTS SECTION */
.section-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.section-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.5rem;
}

.section-title-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-title-left h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.section-icon {
  width: 22px;
  height: 22px;
  color: #38bdf8;
}

.counter-badge {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
}

.clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

/* INDIVIDUAL CLIENT CARD */
.client-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: transform 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
}
.client-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-2px);
}
.client-card.is-offline {
  opacity: 0.6;
  filter: grayscale(40%);
}

.client-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.client-name-box {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.client-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(59, 130, 246, 0.2));
  border: 1px solid rgba(56, 189, 248, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  font-weight: 700;
  font-size: 0.95rem;
}

.client-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.client-ips {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.ip-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}
.ip-label {
  color: var(--text-muted);
}
.ip-val {
  font-family: var(--font-mono);
  color: var(--text-secondary);
}
.ip-val-virtual {
  color: #38bdf8;
  font-weight: 600;
}

.client-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  font-size: 0.8rem;
}

.metric-box {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.metric-box-title {
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}
.metric-box-val {
  font-weight: 600;
  color: var(--text-primary);
}

.client-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
  font-size: 0.78rem;
}

.latency-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.75rem;
}
.latency-fast {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.latency-medium {
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.35);
}
.latency-slow {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.latency-down {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.35);
}

/* TWO COLUMNS DETAIL */
.two-columns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.25rem;
}

.detail-card {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.detail-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.header-icon-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.header-icon-title h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.header-icon {
  width: 26px;
  height: 26px;
}
.icon-emerald { color: #10b981; }
.icon-cyan { color: #0ea5e9; }
.icon-rose { color: #f43f5e; }

.detail-metrics-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}
.metric-label {
  color: var(--text-secondary);
}
.metric-value {
  color: var(--text-primary);
  font-weight: 500;
}

/* SYSTEM GAUGES */
.system-gauges {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.gauge-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.gauge-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #0ea5e9, #38bdf8);
  transition: width 0.4s ease;
}

/* INCIDENTS TABLE */
.incidents-section {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.incidents-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.85rem;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.incidents-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}

.incidents-table th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
}

.incidents-table td {
  padding: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}

.incidents-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* FOOTER */
.app-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0.5rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  border-top: 1px solid var(--border-color);
}

/* TOASTS */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.2rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  font-size: 0.85rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slide-toast 0.3s ease-out;
}

@keyframes slide-toast {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* HELPER CLASSES */
.mono-text { font-family: var(--font-mono); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.text-center { text-align: center; }

/* USER PROFILE & LOGOUT */
.user-profile-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.25rem 0.5rem 0.25rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}
.user-badge {
  font-size: 0.82rem;
  font-weight: 600;
  color: #38bdf8;
}
.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}
.btn-logout:hover {
  color: #fb7185;
  background: rgba(244, 63, 94, 0.12);
}
.btn-logout svg {
  width: 16px;
  height: 16px;
}

/* LOGIN OVERLAY (Django-style aesthetic) */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 20, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.login-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(14, 165, 233, 0.15);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: login-pop 0.3s ease-out;
}

@keyframes login-pop {
  from { transform: scale(0.95) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.login-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.login-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  box-shadow: 0 0 20px var(--color-cyan-glow);
  margin-bottom: 0.25rem;
}
.login-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.form-input {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.login-error {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fb7185;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  text-align: center;
}

.btn-login {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.btn-login:hover {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(14, 165, 233, 0.5);
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.login-footer {
  text-align: center;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

/* ==================== RESPONSIVE DESIGN (MOBILE & TABLET WEBAPP) ==================== */

@media (max-width: 900px) {
  .app-container {
    padding: 1rem;
    padding-top: max(1rem, env(safe-area-inset-top));
    padding-bottom: max(1.75rem, env(safe-area-inset-bottom));
    gap: 1.25rem;
  }

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

@media (max-width: 768px) {
  .glow-sphere {
    display: none; /* Elimina reflejos molestos en pantallas táctiles pequeñas */
  }

  /* HEADER MOBILE APP STYLE */
  .app-header {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem 1.1rem;
    gap: 0.85rem;
    border-radius: var(--radius-md);
  }

  .header-left {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }

  .header-center {
    width: 100%;
  }

  .header-center .status-pill {
    width: 100%;
    justify-content: center;
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }

  .header-right {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.5rem;
    flex-wrap: wrap;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 0.75rem;
  }

  /* STATS OVERVIEW: 2x2 Clean Dashboard Grid on Mobile */
  .stats-overview {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .stat-card {
    padding: 0.95rem;
    gap: 0.65rem;
  }

  .stat-title {
    font-size: 0.72rem;
  }

  .stat-value {
    font-size: 1.35rem;
  }

  .stat-desc {
    font-size: 0.72rem;
  }

  .stat-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    font-size: 0.72rem;
    padding-top: 0.5rem;
  }

  /* CLIENTS & DETAILS */
  .clients-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .client-card {
    padding: 1rem;
    gap: 0.85rem;
  }

  .detail-card {
    padding: 1rem;
  }

  .incidents-section {
    padding: 1rem;
  }

  .incidents-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
}

@media (max-width: 580px) {
  /* Botones ultra compactos tipo App Bar */
  .btn-text {
    display: none; /* Ocultar texto largo en móvil para evitar saltos de línea */
  }

  .btn {
    padding: 0.5rem;
    justify-content: center;
    min-width: 38px;
    min-height: 38px;
  }

  .header-right {
    gap: 0.4rem;
  }

  .time-box {
    padding: 0.35rem 0.6rem;
    font-size: 0.78rem;
  }

  .logo-img {
    width: 38px;
    height: 38px;
  }

  .app-title {
    font-size: 1.18rem;
  }

  .stats-overview {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }

  .stat-card {
    padding: 0.8rem;
  }

  .stat-value {
    font-size: 1.22rem;
  }

  .toast-container {
    left: 16px;
    right: 16px;
    bottom: max(16px, env(safe-area-inset-bottom));
  }

  .toast {
    font-size: 0.8rem;
    padding: 0.65rem 0.9rem;
    justify-content: center;
  }

  .login-card {
    padding: 1.5rem;
    margin: 1rem;
  }
}

@media (max-width: 360px) {
  .stats-overview {
    grid-template-columns: 1fr;
  }
}


