/* ========================================================
   GUARDIÃO CGM - DESIGN SYSTEM & ESTILOS GERAIS
   ======================================================== */

:root {
  --bg-primary: #080d1a;
  --bg-secondary: #0f172a;
  --bg-surface: rgba(17, 26, 47, 0.75);
  --bg-card: rgba(15, 23, 42, 0.85);
  --bg-card-hover: rgba(23, 37, 84, 0.5);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(56, 189, 248, 0.3);
  --border-focus: #06b6d4;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-emerald: #10b981;
  --accent-purple: #8b5cf6;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --gradient-brand: linear-gradient(135deg, #06b6d4 0%, #3b82f6 50%, #8b5cf6 100%);
  --gradient-card: linear-gradient(145deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.8) 100%);
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 35px rgba(6, 182, 212, 0.25);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  overflow-x: hidden;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 70px;
}

/* Background Glowing Orbs */
.glow-bg {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
}

.glow-bg.top-left {
  top: -150px;
  left: -150px;
  background: radial-gradient(circle, #06b6d4, transparent 70%);
}

.glow-bg.bottom-right {
  top: 600px;
  right: -200px;
  background: radial-gradient(circle, #6366f1, transparent 70%);
}

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ========================================================
   NAVBAR
   ======================================================== */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(8, 13, 26, 0.85);
  border-bottom: 1px solid var(--border-subtle);
  padding: 16px 0;
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
  flex-shrink: 0;
  white-space: nowrap;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: var(--gradient-brand);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
  flex-shrink: 0;
}

.brand-icon svg {
  width: 24px;
  height: 24px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  white-space: nowrap;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand-title strong {
  color: var(--accent-cyan);
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-shrink: 0;
  white-space: nowrap;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: color 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-link:hover {
  color: var(--text-main);
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #34d399;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-status.offline {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.3);
  color: #fb7185;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: currentColor;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

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

/* ========================================================
   HERO SECTION
   ======================================================== */

.hero {
  padding: 80px 0 50px 0;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-accent);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.1);
}

.pulse-icon {
  width: 8px;
  height: 8px;
  background: var(--accent-cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-cyan);
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 3.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 20px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.gradient-text {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 720px;
  margin: 0 auto 36px auto;
  line-height: 1.6;
}

.compat-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 850px;
  margin: 0 auto;
}

.badge {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: #cbd5e1;
  font-weight: 500;
  transition: all 0.2s ease;
}

.badge:hover {
  border-color: var(--border-accent);
  background: rgba(56, 189, 248, 0.08);
  transform: translateY(-1px);
}

/* ========================================================
   FORMULÁRIO DE CADASTRO
   ======================================================== */

.section {
  padding: 60px 0;
}

.form-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 44px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  position: relative;
  overflow: hidden;
}

.form-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-brand);
}

.form-header {
  margin-bottom: 34px;
}

.step-indicator {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
  margin-bottom: 8px;
}

.form-header h2 {
  font-family: var(--font-heading);
  font-size: 1.9rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.form-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 8px;
}

.label-with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.label-with-action label {
  margin-bottom: 0 !important;
}

.btn-text-action {
  background: none;
  border: none;
  color: var(--accent-cyan);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.btn-text-action:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.input-wrapper input,
.select-styled {
  width: 100%;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 13px 16px;
  font-size: 0.95rem;
  color: #fff;
  font-family: var(--font-body);
  transition: all 0.2s ease;
}

.input-wrapper input:focus,
.select-styled:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
  background: rgba(15, 23, 42, 1);
}

.subdomain-input-box {
  display: flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.2s ease;
}

.subdomain-input-box:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}

.subdomain-prefix,
.subdomain-suffix {
  padding: 0 14px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
  user-select: none;
  height: 50px;
  display: flex;
  align-items: center;
}

.subdomain-input-box input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 13px 8px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.subdomain-input-box input:focus {
  outline: none;
}

.subdomain-feedback {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 6px;
}

.subdomain-feedback.valid {
  color: var(--accent-emerald);
}

.subdomain-feedback.invalid {
  color: var(--accent-rose);
}

.input-hint {
  display: block;
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 6px;
}

.form-footer {
  margin-top: 32px;
}

.btn-primary {
  background: var(--gradient-brand);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 15px 32px;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-heading);
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 18px rgba(6, 182, 212, 0.35);
  transition: all 0.25s ease;
  text-decoration: none;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(6, 182, 212, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 15px 28px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}

.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========================================================
   ÁREA DE RESULTADOS & ENDPOINTS
   ======================================================== */

.result-card {
  background: var(--bg-card);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-xl);
  padding: 44px;
  box-shadow: 0 0 40px rgba(16, 185, 129, 0.15);
  text-align: center;
}

.result-status-icon {
  width: 68px;
  height: 68px;
  background: rgba(16, 185, 129, 0.15);
  border: 2px solid var(--accent-emerald);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px auto;
  color: var(--accent-emerald);
}

.result-status-icon svg {
  width: 34px;
  height: 34px;
}

.result-title {
  font-family: var(--font-heading);
  font-size: 2.1rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.result-desc {
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 36px auto;
  font-size: 1rem;
}

.endpoints-board {
  background: rgba(10, 16, 31, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 30px;
  text-align: left;
}

.board-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: #f1f5f9;
}

.board-header p {
  font-size: 0.88rem;
  color: var(--text-dim);
  margin-bottom: 24px;
}

.endpoint-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.endpoint-item {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.endpoint-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.endpoint-tag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 4px;
}

.tag-primary {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.tag-secondary {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.tag-accent {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.endpoint-label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.copy-box {
  display: flex;
  align-items: center;
  background: #020617;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 6px 8px 6px 14px;
  gap: 10px;
}

.copy-box code {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: #38bdf8;
  word-break: break-all;
}

.btn-copy {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-copy:hover {
  background: var(--accent-cyan);
  color: #000;
  border-color: var(--accent-cyan);
}

.result-actions {
  display: flex;
  gap: 14px;
  margin-top: 28px;
}

/* ========================================================
   GUIA DE APLICATIVOS
   ======================================================== */

.section-title-wrap {
  text-align: center;
  margin-bottom: 36px;
}

.section-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-cyan);
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.section-title-wrap h2 {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.section-title-wrap p {
  color: var(--text-muted);
  font-size: 1rem;
}

.guide-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.tab-btn {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active,
.tab-btn:hover {
  color: #fff;
  background: rgba(30, 41, 59, 0.9);
  border-color: var(--border-accent);
}

.tab-btn.active {
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.2);
  border-color: var(--accent-cyan);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.guide-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 34px;
}

.guide-card h3 {
  font-size: 1.35rem;
  margin-bottom: 20px;
  color: #e2e8f0;
}

.guide-steps {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: #cbd5e1;
}

.code-preview {
  background: #020617;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-cyan);
  margin-top: 6px;
  word-break: break-all;
}

/* ========================================================
   INSTÂNCIAS ATIVAS
   ======================================================== */

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

.instance-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all 0.25s ease;
}

.instance-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.patient-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f8fafc;
}

.patient-sub {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent-cyan);
}

.instance-status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  display: inline-block;
  white-space: nowrap;
  text-align: center;
}

.status-online {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-offline {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.status-paused {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.card-details {
  font-size: 0.82rem;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.btn-open {
  flex: 1;
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius-sm);
  padding: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-open:hover {
  background: var(--accent-cyan);
  color: #000;
  border-color: var(--accent-cyan);
}

/* ========================================================
   RODAPÉ
   ======================================================== */

.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1000;
  border-top: 1px solid var(--border-subtle);
  padding: 14px 0;
  margin-top: 0;
  background: rgba(8, 13, 26, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.45);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-dim);
  gap: 12px;
}

.footer-content code {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

/* ========================================================
   AUTENTICAÇÃO & PAINÉIS (PACIENTE E SUPERADMIN)
   ======================================================== */

.nav-auth-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  white-space: nowrap;
}

.btn-pwa-install {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-pwa-install:hover {
  background: #38bdf8;
  color: #000;
}

.btn-login-trigger {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-accent);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-login-trigger:hover {
  background: var(--accent-cyan);
  color: #000;
}

.auth-user-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.user-greeting {
  font-size: 0.85rem;
  color: #cbd5e1;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-panel-action {
  background: var(--gradient-brand);
  border: none;
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-logout {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fb7185;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-logout:hover {
  background: #f43f5e;
  color: #fff;
}

/* Painéis */
.panel-view {
  padding: 40px 0 60px 0;
  animation: fadeIn 0.3s ease;
}

.panel-header-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
  box-shadow: var(--shadow-sm);
}

.panel-header-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.patient-avatar {
  width: 56px;
  height: 56px;
  background: var(--gradient-brand);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.4);
}

.panel-header-box h1 {
  font-family: var(--font-heading);
  font-size: 1.7rem;
  font-weight: 700;
}

.patient-sub-url {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent-cyan);
}

.panel-header-actions {
  display: flex;
  gap: 12px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 30px;
}

.dash-card-header {
  margin-bottom: 22px;
}

.dash-card-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #f1f5f9;
}

.dash-card-header p {
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* Superadmin */
.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.admin-topbar h2 {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
}

.admin-topbar p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

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

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
}

.metric-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.metric-val {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  margin-top: 4px;
}

.metric-val.metric-small {
  font-size: 1.1rem;
  margin-top: 10px;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.text-green { color: #34d399; }
.text-cyan { color: #38bdf8; }

.admin-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-sm);
}

.table-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.table-header-bar h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.search-box input {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.88rem;
  color: #fff;
  width: 280px;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive::-webkit-scrollbar {
  height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.3);
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.5);
}

.admin-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  font-size: 0.88rem;
  table-layout: auto;
}

.admin-table th {
  text-align: left;
  padding: 12px 14px;
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.admin-table th.th-patient,
.admin-table td.col-patient {
  width: 27%;
  min-width: 180px;
}

.admin-table th.th-subdomain,
.admin-table td.col-subdomain {
  width: 23%;
  min-width: 160px;
}

.admin-table th.th-email,
.admin-table td.col-email {
  width: 18%;
}

.admin-table th.th-port,
.admin-table td.col-port {
  width: 80px;
  text-align: center;
}

.admin-table th.th-dbsize,
.admin-table td.col-dbsize {
  width: 110px;
  text-align: center;
}

.admin-table th.th-status,
.admin-table td.col-status {
  width: 90px;
  text-align: center;
}

.admin-table th.th-actions,
.admin-table td.col-actions {
  width: 135px;
  text-align: center;
}

.db-size-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.22);
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.admin-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  vertical-align: middle;
  white-space: nowrap;
}

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

.admin-table td.col-patient {
  white-space: nowrap;
}

.admin-table td.col-patient strong {
  display: block;
  line-height: 1.3;
}

.admin-table td.col-actions {
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.actions-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  vertical-align: middle;
}

.btn-action-edit,
.btn-action-pause,
.btn-action-restart,
.btn-action-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  margin: 0;
  background: none;
  border: 1px solid transparent;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  white-space: nowrap;
  vertical-align: middle;
  line-height: 1;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-action-edit {
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.25);
}
.btn-action-edit:hover {
  background: var(--accent-cyan);
  color: #000;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.4);
}

.btn-action-pause {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.25);
}
.btn-action-pause:hover {
  background: #f59e0b;
  color: #000;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.btn-action-pause.btn-paused {
  color: #34d399;
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.25);
}
.btn-action-pause.btn-paused:hover {
  background: #10b981;
  color: #000;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.btn-action-restart {
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.25);
}
.btn-action-restart:hover {
  background: var(--accent-blue);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.btn-action-del {
  color: #fb7185;
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.25);
}
.btn-action-del:hover {
  background: #f43f5e;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(244, 63, 94, 0.4);
}

/* Modais */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: #0b1329;
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), var(--shadow-glow);
  animation: fadeIn 0.25s ease;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover { color: #fff; }

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 10px;
}

.form-alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
}

.form-alert.error {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fb7185;
}

.form-alert.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}

/* Modal de Verificação de E-mail (Ativação) */
.modal-card-verify {
  max-width: 440px;
}

.modal-header-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  flex-shrink: 0;
  margin-right: 12px;
}

.modal-subtitle {
  font-size: 0.75rem;
  color: var(--text-dim);
  display: block;
}

.verify-info-box {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.verify-info-box p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.verify-info-box strong {
  font-size: 1.05rem;
  color: #fff;
  font-family: var(--font-mono);
  word-break: break-all;
}

.verify-timer-hint {
  font-size: 0.74rem;
  color: var(--accent-cyan);
}

.code-input-wrapper {
  margin-top: 6px;
}

.input-code-styled {
  font-family: var(--font-mono) !important;
  font-size: 2rem !important;
  font-weight: 800 !important;
  letter-spacing: 8px !important;
  text-align: center !important;
  color: #38bdf8 !important;
  padding: 12px !important;
  background: rgba(2, 6, 23, 0.9) !important;
  border: 2px solid rgba(56, 189, 248, 0.35) !important;
  border-radius: var(--radius-md) !important;
}

.input-code-styled:focus {
  border-color: var(--accent-cyan) !important;
  box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.25) !important;
}

.verify-footer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.82rem;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent-cyan);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-link:disabled {
  color: var(--text-dim);
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-link-dim {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0;
}

.btn-link:hover:not(:disabled),
.btn-link-dim:hover {
  text-decoration: underline;
}

/* ========================================================
   RESPONSIVIDADE - TABLETS (iPad, Tablets Android, Telas <= 1024px)
   ======================================================== */
@media (max-width: 1024px) {
  .container {
    max-width: 100%;
    padding: 0 20px;
  }

  .nav-links {
    gap: 16px;
  }
  .nav-link {
    font-size: 0.86rem;
  }

  .hero {
    padding: 55px 0 35px 0;
  }
  .hero-title {
    font-size: 2.5rem;
  }
  .hero-subtitle {
    font-size: 1.05rem;
    margin-bottom: 28px;
  }

  /* Grid de métricas do Superadmin em 2x2 no Tablet */
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 24px;
  }

  /* Dashboard do Paciente */
  .dashboard-grid {
    gap: 20px;
  }

  .panel-header-box {
    padding: 22px 24px;
  }

  /* Tabela Administrativa no Tablet */
  .admin-table-card {
    padding: 22px 18px;
  }
  .table-header-bar {
    gap: 14px;
  }
}

/* ========================================================
   RESPONSIVIDADE - SMARTPHONES E TELAS MENORES (<= 768px)
   ======================================================== */
@media (max-width: 768px) {
  /* Prevenção de auto-zoom no Safari iOS em inputs */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  select {
    font-size: 16px !important;
  }

  .container {
    padding: 0 14px;
  }

  /* Topbar / Navbar no Smartphone */
  .navbar {
    padding: 12px 0;
  }
  .nav-container {
    padding: 0 10px;
  }
  .brand {
    gap: 10px;
  }
  .brand-icon {
    width: 36px;
    height: 36px;
  }
  .brand-icon svg {
    width: 20px;
    height: 20px;
  }
  .brand-title {
    font-size: 1.15rem;
  }
  .brand-badge {
    font-size: 0.58rem;
  }

  .nav-links {
    display: none !important;
  }
  #docker-pill, .nav-status {
    display: none !important; /* Oculta pílula do Docker no mobile para dar espaço aos botões de ação */
  }

  .nav-auth-wrap {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
  }

  .btn-login-trigger {
    white-space: nowrap !important;
    padding: 7px 12px !important;
    font-size: 0.82rem !important;
    line-height: 1.2 !important;
  }

  .btn-pwa-install {
    padding: 7px 10px !important;
    font-size: 0.78rem !important;
    white-space: nowrap !important;
  }
  .btn-pwa-install span {
    display: none !important; /* Exibe apenas o ícone no celular */
  }

  /* Barra de Usuário Logado no Mobile */
  .auth-user-bar {
    gap: 6px !important;
  }
  .user-greeting {
    font-size: 0.78rem !important;
    max-width: 100px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  .btn-panel-action {
    padding: 6px 10px !important;
    font-size: 0.78rem !important;
  }
  .btn-logout {
    padding: 6px 8px !important;
    font-size: 0.78rem !important;
  }

  /* Hero Section */
  .hero {
    padding: 40px 0 26px 0;
  }
  .hero-badge {
    font-size: 0.78rem;
    padding: 5px 12px;
    margin-bottom: 16px;
  }
  .hero-title {
    font-size: 1.95rem;
    line-height: 1.2;
    margin-bottom: 14px;
  }
  .hero-subtitle {
    font-size: 0.94rem;
    line-height: 1.5;
    margin-bottom: 22px;
  }
  .compat-badges {
    gap: 6px;
  }
  .badge {
    font-size: 0.74rem;
    padding: 5px 10px;
  }

  /* Formulário de Cadastro */
  .section {
    padding: 40px 0;
  }
  .form-wrapper {
    padding: 24px 16px;
    border-radius: var(--radius-lg);
  }
  .form-header {
    margin-bottom: 22px;
  }
  .form-header h2 {
    font-size: 1.5rem;
  }
  .form-header p {
    font-size: 0.88rem;
  }
  .form-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Caixa de Subdomínio no Celular */
  .subdomain-input-box {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .subdomain-prefix {
    font-size: 0.78rem !important;
    padding: 0 6px !important;
    height: 44px !important;
    white-space: nowrap !important;
  }
  .subdomain-suffix {
    font-size: 0.74rem !important;
    padding: 0 6px !important;
    height: 44px !important;
    white-space: nowrap !important;
  }
  .subdomain-input-box input {
    font-size: 16px !important;
    padding: 10px 4px !important;
    min-width: 60px !important;
  }

  .form-footer {
    margin-top: 18px;
    margin-bottom: 10px;
  }
  #btn-submit {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
  }

  /* Guia de Aplicativos / Tabs Deslizáveis */
  .section-title-wrap {
    margin-bottom: 22px;
  }
  .section-title-wrap h2 {
    font-size: 1.6rem;
  }
  .guide-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
    gap: 8px;
    padding-bottom: 8px;
    margin-bottom: 18px;
    scrollbar-width: none;
  }
  .guide-tabs::-webkit-scrollbar {
    display: none;
  }
  .tab-btn {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 9px 14px;
    font-size: 0.82rem;
  }
  .guide-card {
    padding: 22px 16px;
    border-radius: var(--radius-md);
  }
  .guide-card h3 {
    font-size: 1.15rem;
    margin-bottom: 14px;
  }
  .guide-steps {
    padding-left: 18px;
    gap: 12px;
    font-size: 0.88rem;
  }
  .code-preview {
    font-size: 0.78rem;
    padding: 8px 10px;
    word-break: break-all;
  }

  /* Painel do Paciente */
  .panel-view {
    padding: 24px 0 70px 0;
  }
  .panel-header-box {
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
    padding: 20px 16px;
    border-radius: var(--radius-md);
  }
  .panel-header-left {
    gap: 14px;
  }
  .patient-avatar {
    width: 48px;
    height: 48px;
    font-size: 1.4rem;
    flex-shrink: 0;
  }
  .panel-header-box h1 {
    font-size: 1.35rem;
  }
  .patient-sub-url {
    font-size: 0.82rem;
    word-break: break-all;
  }
  .panel-header-actions {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }
  .panel-header-actions .btn-primary,
  .panel-header-actions .btn-secondary {
    width: 100%;
    text-align: center;
    justify-content: center;
    padding: 12px;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .dash-card {
    padding: 20px 16px;
    border-radius: var(--radius-md);
  }
  .dash-card-header h3 {
    font-size: 1.15rem;
  }
  .copy-box {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
  }
  .copy-box code {
    font-size: 0.82rem;
    word-break: break-all;
  }
  .copy-box .btn-copy {
    width: 100%;
    text-align: center;
    padding: 8px 12px;
  }

  /* Painel do Superadmin */
  .admin-topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin-bottom: 20px;
  }
  .admin-topbar h2 {
    font-size: 1.5rem;
  }
  .admin-topbar p {
    font-size: 0.88rem;
  }
  #btn-admin-refresh {
    width: 100%;
    justify-content: center;
    padding: 11px;
  }
  .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
  }
  .metric-card {
    padding: 14px;
    border-radius: var(--radius-sm);
  }
  .metric-label {
    font-size: 0.68rem;
  }
  .metric-val {
    font-size: 1.6rem;
  }
  .metric-val.metric-small {
    font-size: 0.82rem;
    word-break: break-all;
  }
  .admin-table-card {
    padding: 18px 14px;
    border-radius: var(--radius-md);
  }
  .table-header-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
  }
  .table-header-bar h3 {
    font-size: 1.15rem;
  }
  .search-box {
    width: 100%;
  }
  .search-box input {
    width: 100%;
    padding: 10px 12px;
  }
  .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
  }
  .admin-table {
    min-width: 780px;
    font-size: 0.84rem;
  }
  .admin-table th {
    padding: 10px 12px;
    font-size: 0.72rem;
  }
  .admin-table td {
    padding: 10px 12px;
    font-size: 0.82rem;
  }
  .actions-wrapper {
    gap: 4px;
  }
  .actions-wrapper button {
    width: 30px;
    height: 30px;
    font-size: 0.9rem;
  }

  /* Modais no Mobile */
  .modal-backdrop {
    padding: 12px;
  }
  .modal-card {
    max-width: 100%;
    border-radius: var(--radius-md);
    max-height: 94vh;
    display: flex;
    flex-direction: column;
  }
  .modal-header {
    padding: 16px 18px;
    flex-shrink: 0;
  }
  .modal-header h3 {
    font-size: 1.15rem;
  }
  .modal-body {
    padding: 18px 16px;
    gap: 14px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .modal-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }
  .modal-actions button {
    width: 100%;
    padding: 12px;
  }

  /* Rodapé Fixo no Mobile */
  body {
    padding-bottom: 95px;
  }
  .footer {
    padding: 10px 14px;
  }
  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: 4px;
    font-size: 0.74rem;
  }
  .footer-left {
    font-size: 0.74rem;
    line-height: 1.35;
  }
}

/* ========================================================
   RESPONSIVIDADE - SMARTPHONES EXTRA PEQUENOS (<= 480px)
   ======================================================== */
@media (max-width: 480px) {
  .nav-container {
    padding: 0 8px;
  }
  .brand {
    gap: 8px;
  }
  .brand-icon {
    width: 32px;
    height: 32px;
  }
  .brand-icon svg {
    width: 18px;
    height: 18px;
  }
  .brand-title {
    font-size: 1.05rem;
  }
  .brand-badge {
    display: none !important;
  }
  .user-greeting {
    display: none !important;
  }
  .btn-panel-action {
    padding: 6px 9px !important;
    font-size: 0.75rem !important;
  }
  .btn-logout {
    padding: 6px 8px !important;
    font-size: 0.75rem !important;
  }
  .btn-login-trigger {
    padding: 6px 10px !important;
    font-size: 0.78rem !important;
  }

  .hero-title {
    font-size: 1.7rem;
  }
  .hero-subtitle {
    font-size: 0.88rem;
  }
  .badge {
    font-size: 0.7rem;
    padding: 4px 8px;
  }

  .subdomain-prefix {
    font-size: 0.72rem !important;
    padding: 0 4px !important;
  }
  .subdomain-suffix {
    font-size: 0.68rem !important;
    padding: 0 4px !important;
  }
  .subdomain-input-box input {
    font-size: 14px !important;
    min-width: 50px !important;
    padding: 8px 3px !important;
  }

  .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .metric-card {
    padding: 10px 8px;
  }
  .metric-label {
    font-size: 0.62rem;
  }
  .metric-val {
    font-size: 1.35rem;
  }
  .metric-val.metric-small {
    font-size: 0.74rem;
  }

  .patient-avatar {
    width: 42px;
    height: 42px;
    font-size: 1.2rem;
  }
  .panel-header-box h1 {
    font-size: 1.2rem;
  }
}

/* ========================================================
   PWA - ESTILOS DO APLICATIVO INSTALÁVEL
   ======================================================== */

.btn-pwa-install {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(59, 130, 246, 0.2));
  border: 1px solid var(--border-accent);
  color: var(--accent-cyan);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  backdrop-filter: blur(8px);
}

.btn-pwa-install:hover {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.35), rgba(59, 130, 246, 0.35));
  border-color: var(--accent-cyan);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.25);
}

/* Banner Flutuante de Instalação (Apenas Mobile) */
.pwa-install-banner {
  display: none !important;
}

@media (max-width: 768px) {
  .pwa-install-banner {
    display: none;
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 24px);
    max-width: 440px;
    z-index: 1050;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    box-shadow: 0 20px 35px -5px rgba(0, 0, 0, 0.6), 0 0 25px rgba(6, 182, 212, 0.25);
    animation: slideUpPwa 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }
}

@keyframes slideUpPwa {
  from {
    opacity: 0;
    transform: translate(-50%, 40px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pwa-banner-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border-accent);
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.pwa-banner-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pwa-banner-text strong {
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: var(--font-heading);
}

.pwa-banner-text span {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.25;
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-pwa-action {
  background: var(--gradient-brand);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-pwa-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(6, 182, 212, 0.4);
}

.btn-pwa-dismiss {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-pwa-dismiss:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

/* Modal de Ajuda iOS */
.modal-card-pwa {
  max-width: 420px;
  text-align: center;
}

.modal-pwa-icon img {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border-accent);
  box-shadow: 0 8px 20px rgba(6, 182, 212, 0.25);
}

.ios-install-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 20px 0 24px;
  text-align: left;
}

.ios-step {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.ios-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient-brand);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.95rem;
}

.ios-step-text {
  color: var(--text-main);
  font-size: 0.88rem;
  line-height: 1.4;
}

.ios-icon {
  display: inline-block;
  font-size: 1.1rem;
  vertical-align: middle;
}

/* ========================================================
   BOTÃO FLUTUANTE DO WHATSAPP
   ======================================================== */

.whatsapp-float-btn {
  position: fixed;
  right: 24px;
  bottom: 75px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4), 0 4px 12px rgba(0, 0, 0, 0.5);
  z-index: 1040;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

.whatsapp-float-btn:hover {
  transform: scale(1.1) translateY(-3px);
  box-shadow: 0 14px 28px rgba(37, 211, 102, 0.55), 0 6px 14px rgba(0, 0, 0, 0.6);
  color: #ffffff;
}

.whatsapp-pulse {
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 2px solid #25D366;
  opacity: 0.8;
  animation: waPulse 2s infinite ease-out;
  pointer-events: none;
}

@keyframes waPulse {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
  }
  70% {
    transform: scale(1.35);
    opacity: 0;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

.whatsapp-icon {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  transition: transform 0.3s ease;
}

.whatsapp-float-btn:hover .whatsapp-icon {
  transform: rotate(-8deg) scale(1.05);
}

.whatsapp-tooltip {
  position: absolute;
  right: 70px;
  background: rgba(15, 23, 42, 0.95);
  color: #f8fafc;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  border: 1px solid rgba(37, 211, 102, 0.3);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateX(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.whatsapp-float-btn:hover .whatsapp-tooltip {
  opacity: 1;
  transform: translateX(0);
}

@media (max-width: 768px) {
  .whatsapp-float-btn {
    right: 18px;
    bottom: 75px;
    width: 52px;
    height: 52px;
  }
  .whatsapp-icon {
    width: 28px;
    height: 28px;
  }
  .whatsapp-tooltip {
    display: none;
  }
}

/* ========================================================
   CARDS DE MONITORAMENTO EM TEMPO REAL (PACIENTE E ADMIN)
   ======================================================== */

.patient-metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .patient-metrics-row {
    grid-template-columns: 1fr;
  }
}

.patient-metric-box {
  background: var(--gradient-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.patient-metric-box:hover {
  transform: translateY(-2px);
  border-color: var(--border-accent);
}

.p-metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.p-metric-tag {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.p-metric-icon {
  font-size: 1.1rem;
}

.p-metric-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.p-glucose-val {
  font-family: var(--font-heading);
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
  color: #f8fafc;
}

.p-glucose-unit {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.p-glucose-arrow {
  font-size: 1.6rem;
  font-weight: 900;
  margin-left: 2px;
}

.p-time-val {
  font-family: var(--font-heading);
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1;
  color: #38bdf8;
}

.p-metric-sub {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Indicadores de Glicemia */
.glucose-green {
  color: #10b981 !important;
}

.glucose-yellow {
  color: #f59e0b !important;
}

.glucose-red {
  color: #ef4444 !important;
}

/* Badges de Glicemia para Tabelas */
.badge-glucose-table {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.badge-glucose-normal {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.badge-glucose-warn {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

.badge-glucose-alert {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.badge-glucose-none {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
  border-color: rgba(100, 116, 139, 0.25);
}

/* Badges PM2 */
.pm2-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.pm2-status-pill.online {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.pm2-status-pill.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.pm2-status-pill.offline {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.pm2-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
  box-shadow: 0 0 8px currentColor;
}

/* ========================================================
   INTEGRAÇÃO SIBIONICS CGM
   ======================================================== */

.dash-card-sibionics {
  border: 1px solid rgba(56, 189, 248, 0.25);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.sib-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.sib-title-tag {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #38bdf8;
  margin-bottom: 4px;
}

.sib-badge-wrapper {
  margin-top: 4px;
}

.sib-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sib-badge-active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.15);
}

.sib-badge-paused {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.sib-badge-none {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.25);
}

.sib-status-summary-box {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  margin-bottom: 24px;
}

.sib-summary-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.sib-summary-label {
  color: var(--text-dim);
}

.sib-summary-val {
  font-weight: 700;
  color: #f1f5f9;
}

/* Badges Sibionics na Tabela Superadmin */
.badge-sib-table {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 16px;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-sib-table.active {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-sib-table.paused {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-sib-table.none {
  background: rgba(148, 163, 184, 0.1);
  color: #64748b;
  border: 1px solid rgba(148, 163, 184, 0.2);
}




