/* ══════════════════════════════════════════════════════════════════════════
   GESTÃO HOSPITALAR — Design System v2.0 (Premium)
   Palette: Medical Dark + Teal Accents + Glassmorphism
   Typography: Inter (Google Fonts)
   ══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=Sora:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

/* ─── DESIGN TOKENS ─────────────────────────────────────────────────────── */
:root {
  --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-display: "Sora", "Trebuchet MS", sans-serif;
  /* Core Palette */
  --color-bg-primary:    #f2f4f7;
  --color-bg-secondary:  #e7ebf0;
  --color-bg-card:       #ffffff;
  --color-bg-card-hover: #f6f8fb;
  --color-bg-elevated:   #edf1f5;
  --color-bg-input:      #ffffff;
  --color-bg-glass:      rgba(255, 255, 255, 0.9);

  /* Accent */
  --color-accent:        #1f8a70;
  --color-accent-dim:    #176b59;
  --color-accent-glow:   rgba(31, 138, 112, 0.16);
  --color-accent-text:   #155a49;
  --color-accent-vivid:  #2aa787;

  /* Semantic */
  --color-success:       #30dd8a;
  --color-warning:       #ffab40;
  --color-danger:        #ff6670;
  --color-info:          #49c9ff;
  --color-purple:        #b388ff;

  /* Text */
  --color-text-primary:  #1f2937;
  --color-text-secondary:#4b5e70;
  --color-text-muted:    #74879a;
  --color-text-inverse:  #ffffff;

  /* Borders */
  --color-border:        rgba(15, 23, 42, 0.12);
  --color-border-bright: rgba(15, 23, 42, 0.2);
  --color-border-accent: rgba(31, 138, 112, 0.36);

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-md:   0 8px 22px rgba(15, 23, 42, 0.1);
  --shadow-lg:   0 18px 40px rgba(15, 23, 42, 0.14);
  --shadow-glow: 0 0 24px rgba(31, 138, 112, 0.16);
  --shadow-glow-lg: 0 0 60px rgba(31, 138, 112, 0.12), 0 0 120px rgba(31, 138, 112, 0.05);

  /* Radius */
  --radius-xs:  4px;
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-2xl: 32px;
  --radius-full:9999px;

  /* Sidebar */
  --sidebar-width:      264px;
  --sidebar-collapsed:  72px;

  /* Transitions */
  --transition-fast:  0.15s cubic-bezier(0.4,0,0.2,1);
  --transition-base:  0.25s cubic-bezier(0.4,0,0.2,1);
  --transition-slow:  0.4s  cubic-bezier(0.16,1,0.3,1);
  --transition-spring:0.5s cubic-bezier(0.34,1.56,0.64,1);
}

/* ─── RESET & BASE ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 14px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  line-height: 1.6;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 82% 52% at 50% -25%, rgba(31,138,112,0.08), transparent),
    radial-gradient(ellipse 60% 45% at 100% 100%, rgba(17,85,204,0.05), transparent);
}

a { color: var(--color-accent-text); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--color-accent-vivid); }
img { max-width: 100%; display: block; }

::selection {
  background: rgba(31,138,112,0.24);
  color: var(--color-text-primary);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(15,23,42,0.16); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(15,23,42,0.28); }

/* ─── TYPOGRAPHY ────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text-primary);
}
h1 { font-size: 1.75rem; letter-spacing: -0.03em; font-weight: 700; }
h2 { font-size: 1.4rem;  letter-spacing: -0.02em; }
h3 { font-size: 1.15rem; letter-spacing: -0.01em; }
h4 { font-size: 1rem; }

.text-muted    { color: var(--color-text-muted) !important; }
.text-secondary{ color: var(--color-text-secondary) !important; }
.text-accent   { color: var(--color-accent-text) !important; }
.text-success  { color: var(--color-success) !important; }
.text-warning  { color: var(--color-warning) !important; }
.text-danger   { color: var(--color-danger) !important; }
.text-info     { color: var(--color-info) !important; }
.text-right    { text-align: right; }
.text-center   { text-align: center; }
.fw-500        { font-weight: 500; }
.fw-600        { font-weight: 600; }
.fw-700        { font-weight: 700; }
.fw-800        { font-weight: 800; }
.fs-sm         { font-size: 0.8rem; }
.fs-xs         { font-size: 0.72rem; }
.fs-lg         { font-size: 1.15rem; }
.fs-xl         { font-size: 1.5rem; }
.fs-2xl        { font-size: 2rem; }
.fs-3xl        { font-size: 2.5rem; }
.font-mono     { font-family: 'JetBrains Mono', monospace; }

/* ─── APP LAYOUT ────────────────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ─── SIDEBAR (Glassmorphism) ───────────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0; top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--color-bg-glass);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: all var(--transition-base);
  overflow-x: hidden;
}

.sidebar-brand {
  padding: 20px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--color-border);
  min-height: 68px;
}

.sidebar-brand .brand-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, #2ec8a6, #0d5fb8);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(18, 133, 209, 0.35);
}

.brand-logo {
  width: 100%;
  height: 100%;
  border-radius: calc(var(--radius-md) - 2px);
  object-fit: cover;
}

.sidebar-brand .brand-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.sidebar-brand .brand-text small {
  font-family: var(--font-body);
  display: block;
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(15,23,42,0.14) transparent;
}

.nav-section-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
  padding: 18px 12px 6px;
  white-space: nowrap;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 0.84rem;
  font-weight: 400;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
  margin-bottom: 1px;
}
.nav-item:hover {
  background: rgba(15,23,42,0.06);
  color: var(--color-text-primary);
  transform: translateX(2px);
}
.nav-item.active {
  background: linear-gradient(90deg, var(--color-accent-glow), transparent);
  color: var(--color-accent-text);
  font-weight: 500;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  background: linear-gradient(180deg, var(--color-accent), var(--color-accent-dim));
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 8px rgba(0,212,170,0.5);
}
.nav-item .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}
.nav-item:hover .nav-icon {
  transform: scale(1.15);
}
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--color-danger);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,82,82,0.4); }
  50% { box-shadow: 0 0 0 4px rgba(255,82,82,0); }
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-footer .avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-accent-dim), var(--color-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,212,170,0.2);
}
.sidebar-footer .user-info { white-space: nowrap; overflow: hidden; }
.sidebar-footer .user-name { font-size: 0.82rem; font-weight: 600; }
.sidebar-footer .user-role { font-size: 0.68rem; color: var(--color-text-muted); }

/* ─── MAIN CONTENT ──────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-base);
}

/* Top Bar (Glassmorphism) */
.topbar {
  height: 60px;
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--color-text-muted);
}
.topbar-breadcrumb span { color: var(--color-text-primary); font-weight: 600; }
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-btn {
  width: 38px; height: 38px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 1rem;
  position: relative;
}
.topbar-btn:hover {
  background: rgba(15,23,42,0.06);
  color: var(--color-text-primary);
  border-color: var(--color-border-bright);
  transform: translateY(-1px);
}
.topbar-btn .notif-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--color-danger);
  animation: pulseGlow 2s ease-in-out infinite;
}

/* Page Content */
.page-content {
  padding: 28px;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--color-text-primary), var(--color-text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.page-subtitle {
  font-size: 0.84rem;
  color: var(--color-text-muted);
  margin-top: 4px;
  font-weight: 400;
}

/* ─── CARDS (Premium) ───────────────────────────────────────────────────── */
.card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
  position: relative;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  padding: 1px;
  background: linear-gradient(135deg, transparent 40%, rgba(15,23,42,0.05) 50%, transparent 60%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-base);
}
.card:hover::before { opacity: 1; }
.card:hover {
  border-color: var(--color-border-bright);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.card-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
}
.card-body {
  padding: 22px;
}
.card-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* Stat Cards (Animated) */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition-spring);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--stat-accent, var(--color-accent)), transparent);
  opacity: 0;
  transition: opacity var(--transition-base);
}
.stat-card:hover::after { opacity: 1; }
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(15,23,42,0.14);
  border-color: var(--color-border-bright);
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  transition: transform var(--transition-spring);
}
.stat-card:hover .stat-icon { transform: scale(1.1) rotate(-3deg); }
.stat-icon.teal    { background: rgba(0,212,170,0.1); color: var(--color-accent); }
.stat-icon.blue    { background: rgba(64,196,255,0.1); color: var(--color-info); }
.stat-icon.orange  { background: rgba(255,171,64,0.1); color: var(--color-warning); }
.stat-icon.red     { background: rgba(255,82,82,0.1);  color: var(--color-danger); }
.stat-icon.green   { background: rgba(0,230,118,0.1);  color: var(--color-success); }
.stat-icon.purple  { background: rgba(179,136,255,0.1);color: var(--color-purple); }

.stat-info { flex: 1; }
.stat-label {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.stat-value {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.2;
  margin: 4px 0;
  letter-spacing: -0.02em;
}
.stat-change {
  font-size: 0.7rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.stat-change.up   { color: var(--color-success); }
.stat-change.down { color: var(--color-danger); }

/* ─── BUTTONS (Premium) ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.55), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.btn:hover::after { opacity: 1; }
.btn:active { transform: scale(0.96); }

.btn-primary {
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dim));
  color: var(--color-text-inverse);
  border-color: var(--color-accent);
}
.btn-primary:hover {
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(15,23,42,0.03);
  border-color: var(--color-border-bright);
  color: var(--color-text-secondary);
}
.btn-secondary:hover {
  background: rgba(15,23,42,0.07);
  border-color: var(--color-border-accent);
  color: var(--color-text-primary);
}

.btn-danger {
  background: rgba(255,82,82,0.1);
  border-color: rgba(255,82,82,0.3);
  color: var(--color-danger);
}
.btn-danger:hover {
  background: rgba(255,82,82,0.18);
  box-shadow: 0 0 16px rgba(255,82,82,0.15);
}

.btn-sm { padding: 6px 14px; font-size: 0.75rem; }
.btn-lg { padding: 13px 28px; font-size: 0.9rem; }
.btn-icon { width: 36px; height: 36px; padding: 0; }

/* ─── FORMS ─────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-control {
  width: 100%;
  padding: 11px 16px;
  background: var(--color-bg-input);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--color-text-primary);
  transition: all var(--transition-fast);
}
.form-control:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-glow), 0 0 14px rgba(31,138,112,0.1);
  background: #ffffff;
}
.form-control::placeholder { color: var(--color-text-muted); }
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b93a8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* ─── TABLE (Premium) ───────────────────────────────────────────────────── */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
  padding: 14px 18px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  background: rgba(15,23,42,0.05);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 14px 18px;
  font-size: 0.84rem;
  border-bottom: 1px solid rgba(15,23,42,0.08);
  vertical-align: middle;
}
.data-table tbody tr {
  transition: all var(--transition-fast);
}
.data-table tbody tr:hover {
  background: rgba(31,138,112,0.05);
}
.data-table tbody tr:last-child td { border-bottom: none; }

/* ─── BADGES (Premium) ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-success { background: rgba(0,230,118,0.1); color: var(--color-success); border: 1px solid rgba(0,230,118,0.15); }
.badge-warning { background: rgba(255,171,64,0.1); color: var(--color-warning); border: 1px solid rgba(255,171,64,0.15); }
.badge-danger  { background: rgba(255,82,82,0.1);  color: var(--color-danger);  border: 1px solid rgba(255,82,82,0.15); }
.badge-info    { background: rgba(64,196,255,0.1);  color: var(--color-info);    border: 1px solid rgba(64,196,255,0.15); }
.badge-purple  { background: rgba(179,136,255,0.1); color: var(--color-purple);  border: 1px solid rgba(179,136,255,0.15); }
.badge-neutral { background: rgba(15,23,42,0.05);color: var(--color-text-secondary); border: 1px solid var(--color-border); }
.badge-teal    { background: rgba(0,212,170,0.1);  color: var(--color-accent);   border: 1px solid rgba(0,212,170,0.15); }

/* ─── PROGRESS BAR ──────────────────────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
  position: relative;
}
.progress-bar .fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shimmer 2s ease-in-out infinite;
}
.progress-bar .fill.teal   { background: linear-gradient(90deg, var(--color-accent-dim), var(--color-accent)); }
.progress-bar .fill.green  { background: linear-gradient(90deg, #00c853, var(--color-success)); }
.progress-bar .fill.orange { background: linear-gradient(90deg, #ff8f00, var(--color-warning)); }
.progress-bar .fill.red    { background: linear-gradient(90deg, #d32f2f, var(--color-danger)); }

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ─── MODAL (Premium Glassmorphism) ─────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.24);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-bright);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  animation: modalEnter 0.35s var(--transition-spring);
  box-shadow: var(--shadow-lg);
}
@keyframes modalEnter {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-close {
  background: rgba(15,23,42,0.05);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.modal-close:hover { color: var(--color-text-primary); background: rgba(15,23,42,0.1); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ─── TABS ──────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 24px;
}
.tab {
  padding: 10px 20px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
}
.tab:hover { color: var(--color-text-secondary); }
.tab.active {
  color: var(--color-accent-text);
  border-bottom-color: var(--color-accent);
  font-weight: 600;
}

/* ─── ALERTS ────────────────────────────────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-success { background: rgba(0,230,118,0.06); border-color: rgba(0,230,118,0.15); color: var(--color-success); }
.alert-warning { background: rgba(255,171,64,0.06); border-color: rgba(255,171,64,0.15); color: var(--color-warning); }
.alert-danger  { background: rgba(255,82,82,0.06);  border-color: rgba(255,82,82,0.15);  color: var(--color-danger); }
.alert-info    { background: rgba(64,196,255,0.06);  border-color: rgba(64,196,255,0.15);  color: var(--color-info); }

/* ─── EMPTY / PILL / SEARCH / GRID ──────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--color-text-muted); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.3; }
.empty-state h4 { color: var(--color-text-secondary); margin-bottom: 6px; }

.pill-group { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 500;
  background: rgba(255,255,255,0.03);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.search-bar { position: relative; max-width: 320px; }
.search-bar .search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 0.9rem;
}
.search-bar input { padding-left: 38px; }

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

/* ─── BED MAP (Leitos) ──────────────────────────────────────────────────── */
.bed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}
.bed-slot {
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: all var(--transition-spring);
}
.bed-slot:hover { transform: scale(1.08); box-shadow: var(--shadow-md); }
.bed-slot.livre     { background: rgba(0,230,118,0.06); border-color: rgba(0,230,118,0.2); color: var(--color-success); }
.bed-slot.ocupado   { background: rgba(255,82,82,0.06);  border-color: rgba(255,82,82,0.2);  color: var(--color-danger); }
.bed-slot.reservado { background: rgba(255,171,64,0.06); border-color: rgba(255,171,64,0.2); color: var(--color-warning); }
.bed-slot.manutencao{ background: rgba(179,136,255,0.06);border-color: rgba(179,136,255,0.2);color: var(--color-purple); }
.bed-slot .bed-icon { font-size: 1.4rem; }

/* ─── TIMELINE ──────────────────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 8px; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--color-accent), var(--color-border), transparent);
}
.timeline-item { position: relative; padding-bottom: 22px; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -23px; top: 4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 2px solid var(--color-bg-card);
  box-shadow: 0 0 6px rgba(0,212,170,0.4);
}
.timeline-item .timeline-date { font-size: 0.7rem; color: var(--color-text-muted); margin-bottom: 4px; }
.timeline-item .timeline-content { font-size: 0.84rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   CALL PANEL — TV DISPLAY MODE (Full Screen)
   ═══════════════════════════════════════════════════════════════════════════ */
.call-operator-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.call-operator-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  min-width: 220px;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.72);
  box-shadow: var(--shadow-sm);
}

.call-operator-chip .chip-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
}

.call-operator-chip .chip-value {
  font-size: 0.84rem;
  color: var(--color-text-primary);
  font-weight: 600;
}

.call-metrics-grid .stat-card {
  border-color: rgba(15,23,42,0.1);
}

#chamada-local-group.is-locked .form-control {
  border-color: var(--color-border-accent);
  background: rgba(31,138,112,0.08);
  color: var(--color-accent-text);
  font-weight: 600;
}

.call-tv-model {
  --bg-dark: #05152d;
  --bg-deep: #09224a;
  --line: rgba(255, 255, 255, 0.16);
  --surface: rgba(8, 24, 49, 0.78);
  --text-high: #f5f8ff;
  --text-med: #a8bfd7;
  --accent: #ffba38;
  --accent-soft: #ffe6b0;
  border-radius: 26px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    radial-gradient(circle at 15% 20%, rgba(31, 114, 168, 0.35), transparent 36%),
    radial-gradient(circle at 85% 10%, rgba(255, 186, 56, 0.18), transparent 35%),
    linear-gradient(125deg, var(--bg-dark) 0%, var(--bg-deep) 52%, #102f56 100%);
  box-shadow: 0 20px 44px rgba(4, 12, 18, 0.36);
  position: relative;
  font-family: "Sora", "Inter", "Segoe UI", sans-serif;
}

.call-tv-model::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.14;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.2) 1px, transparent 1px);
  background-size: 62px 62px;
  mask-image: radial-gradient(circle at 50% 50%, black 34%, transparent 84%);
}

.call-tv-model .panel-screen {
  height: min(78vh, 820px);
  min-height: 600px;
  padding: 1rem;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0.9rem;
  position: relative;
  z-index: 1;
}

.call-tv-model .panel-top {
  min-height: 90px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  border-radius: 22px;
  padding: 0.85rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  backdrop-filter: blur(8px);
}

.call-tv-model .brand-block {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  min-width: 0;
}

.call-tv-model .brand-logo {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
  padding: 8px;
}

.call-tv-model .brand-title {
  color: var(--text-high);
  font-size: clamp(0.9rem, 1.5vw, 1.2rem);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-wrap: balance;
}

.call-tv-model .brand-sub {
  margin-top: 0.2rem;
  color: var(--text-med);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 600;
}

.call-tv-model .clock-box {
  text-align: right;
  line-height: 1;
  flex-shrink: 0;
}

.call-tv-model .clock-time {
  color: var(--accent);
  font-size: clamp(1.8rem, 4.2vw, 2.9rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  font-family: 'JetBrains Mono', monospace;
}

.call-tv-model .clock-date {
  color: var(--accent-soft);
  font-size: 0.8rem;
  margin-top: 0.12rem;
  text-transform: capitalize;
}

.call-tv-model .panel-content {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 330px;
  gap: 0.9rem;
}

.call-tv-model .stage {
  position: relative;
  min-height: 0;
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 86% 10%, rgba(255, 186, 56, 0.14), transparent 32%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  display: grid;
  place-items: center;
  padding: clamp(1.1rem, 2.6vw, 2rem);
  overflow: hidden;
}

.call-tv-model .priority-tag {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 3;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: linear-gradient(120deg, #ffe39f, #ffb83f);
  color: #4f2a00;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
}

.call-tv-model .is-hidden {
  display: none;
}

.call-tv-model .call-card {
  width: min(90%, 860px);
  border-radius: 28px;
  background: linear-gradient(162deg, #ffffff 0%, #eff5ff 100%);
  color: #112644;
  border: 1px solid rgba(9, 30, 57, 0.08);
  box-shadow: 0 28px 54px rgba(2, 13, 26, 0.42);
  padding: clamp(1.6rem, 4vw, 3rem) clamp(1.4rem, 4vw, 3rem);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.call-tv-model .call-card::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 7px;
  background: linear-gradient(90deg, #1d537e, #ffba38, #1d537e);
}

.call-tv-model .call-card.has-new {
  animation: popCard 0.7s ease;
}

@keyframes popCard {
  0% {
    transform: scale(0.95);
    filter: brightness(0.95);
  }
  55% {
    transform: scale(1.03);
    filter: brightness(1.07);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

.call-tv-model .call-label {
  color: #4f6b8d;
  font-size: clamp(0.82rem, 1.9vw, 1.12rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 600;
}

.call-tv-model .desk-label {
  margin-top: 1rem;
  color: #6b86a6;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.74rem;
  font-weight: 700;
}

.call-tv-model .desk-value {
  margin-top: 0.3rem;
  color: #164368;
  font-size: clamp(1.8rem, 5.8vw, 3.7rem);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-family: "Space Grotesk", "JetBrains Mono", sans-serif;
}

.call-tv-model .card-divider {
  margin: 1.1rem auto 1rem;
  width: min(88%, 460px);
  height: 2px;
  background: linear-gradient(90deg, transparent, #bfd0e5, transparent);
}

.call-tv-model .name-display {
  font-size: clamp(1.55rem, 4.9vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  text-wrap: balance;
  word-break: break-word;
}

.call-tv-model .doc-display {
  margin-top: 0.72rem;
  min-height: 1.2em;
  color: #547296;
  font-size: clamp(0.82rem, 2vw, 1.08rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
}

.call-tv-model .waiting .desk-value {
  color: #7e95b0;
}

.call-tv-model .waiting .name-display {
  color: #91a6c0;
}

.call-tv-model .history-panel {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 0.9rem;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
}

.call-tv-model .history-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.22);
}

.call-tv-model .history-title strong {
  color: #e8f2ff;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.74rem;
}

.call-tv-model .history-list {
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.2rem;
}

.call-tv-model .history-item {
  margin-bottom: 0.7rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: var(--surface);
  padding: 0.82rem 0.78rem;
  transition: 0.25s ease;
}

.call-tv-model .history-item:last-child {
  margin-bottom: 0;
}

.call-tv-model .history-item.priority {
  border-color: rgba(255, 186, 56, 0.56);
  background: linear-gradient(130deg, rgba(255, 186, 56, 0.2), rgba(12, 37, 70, 0.82));
}

.call-tv-model .history-main {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.call-tv-model .history-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #eff6ff;
  letter-spacing: 0.01em;
  word-break: break-word;
}

.call-tv-model .history-senha {
  color: #9ec4e6;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.call-tv-model .history-meta {
  margin-top: 0.42rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.42rem 0.52rem;
  color: #9bc0df;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.call-tv-model .history-badge {
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 186, 56, 0.24);
  color: #ffe3ac;
  border: 1px solid rgba(255, 186, 56, 0.5);
  font-weight: 700;
}

.call-tv-model .panel-footer {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  backdrop-filter: blur(6px);
  min-height: 40px;
  padding: 0.42rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: #d6e5f7;
  font-size: 0.74rem;
  letter-spacing: 0.02em;
}

.call-tv-model .panel-footer span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.call-panel-tv {
  background: linear-gradient(160deg, #f7fafc 0%, #edf2f7 45%, #e5ecf4 100%);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  position: relative;
  overflow: hidden;
  min-height: 280px;
}
.call-panel-tv::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,212,170,0.08) 0%, transparent 70%);
  top: -250px; right: -100px;
  pointer-events: none;
}
.call-panel-tv::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(64,196,255,0.05) 0%, transparent 70%);
  bottom: -150px; left: -50px;
  pointer-events: none;
}

.call-panel-header {
  padding: 24px 32px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}
.call-panel-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 0.85rem;
}
.call-panel-brand .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  animation: pulseGlow 2s ease-in-out infinite;
}
.call-panel-clock {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.call-panel-main {
  padding: 32px;
  text-align: center;
  position: relative;
  z-index: 1;
}
.call-panel-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--color-accent-dim);
  margin-bottom: 8px;
}
.call-panel-ticket {
  font-family: 'JetBrains Mono', monospace;
  font-size: 5.5rem;
  font-weight: 900;
  line-height: 1;
  margin: 8px 0 16px;
  background: linear-gradient(135deg, var(--color-accent-vivid), var(--color-accent), #0088cc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 30px rgba(0,212,170,0.3));
  animation: ticketPulse 3s ease-in-out infinite;
}
@keyframes ticketPulse {
  0%, 100% { filter: drop-shadow(0 0 30px rgba(0,212,170,0.3)); }
  50% { filter: drop-shadow(0 0 50px rgba(0,212,170,0.5)); }
}
.call-panel-location {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 6px;
}
.call-panel-patient {
  font-size: 1rem;
  color: var(--color-text-secondary);
  font-weight: 400;
}

.call-panel-queue {
  padding: 0 32px 24px;
  position: relative;
  z-index: 1;
}
.call-panel-queue-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
  margin-bottom: 12px;
  padding-top: 16px;
  border-top: 1px solid rgba(15,23,42,0.08);
}
.call-queue-items {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.call-queue-item {
  flex: 0 0 auto;
  padding: 10px 20px;
  background: rgba(15,23,42,0.04);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  text-align: center;
  min-width: 120px;
  transition: all var(--transition-fast);
}
.call-queue-item:first-child {
  border-color: var(--color-border-accent);
  background: var(--color-accent-glow);
}
.call-queue-item .queue-ticket {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--color-text-primary);
}
.call-queue-item .queue-dest {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* Recent calls strip */
.call-recent-strip {
  display: flex;
  gap: 8px;
  padding: 16px 32px;
  background: rgba(15,23,42,0.05);
  border-top: 1px solid rgba(15,23,42,0.08);
  overflow-x: auto;
  position: relative;
  z-index: 1;
}
.call-recent-item {
  flex: 0 0 auto;
  padding: 6px 14px;
  background: rgba(15,23,42,0.04);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.call-recent-item .recent-ticket {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--color-text-secondary);
}

@media (max-width: 1200px) {
  .call-tv-model .panel-content {
    grid-template-columns: 1fr;
  }

  .call-tv-model .history-panel {
    min-height: 240px;
  }
}

@media (max-width: 900px) {
  .call-tv-model .panel-screen {
    min-height: 520px;
    height: auto;
  }

  .call-tv-model .panel-top {
    flex-wrap: wrap;
  }

  .call-tv-model .clock-box {
    width: 100%;
    text-align: left;
  }

  .call-tv-model .call-card {
    width: 100%;
    border-radius: 22px;
    padding-inline: 1.2rem;
  }

  .call-tv-model .panel-footer {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.3rem;
  }
}

/* ─── ANIMATIONS ────────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.animate-fade { animation: fadeIn var(--transition-base); }
.animate-slide { animation: slideUp 0.4s ease; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-breathe { animation: breathe 4s ease-in-out infinite; }
.animate-float { animation: float 3s ease-in-out infinite; }

/* Stagger children animation */
.stagger-children > * {
  animation: slideUp 0.4s ease both;
}
.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }

/* ─── LOGIN PAGE ────────────────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-primary);
  position: relative;
  overflow: hidden;
}
.login-wrapper::before {
  content: '';
  position: absolute;
  width: 700px; height: 700px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(31,138,112,0.12), transparent 65%);
  top: -300px; right: -200px;
  animation: breathe 8s ease-in-out infinite;
}
.login-wrapper::after {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(17,85,204,0.08), transparent 65%);
  bottom: -200px; left: -150px;
  animation: breathe 10s ease-in-out infinite;
}
.login-card {
  width: 440px;
  background: var(--color-bg-glass);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--color-border-bright);
  border-radius: var(--radius-2xl);
  padding: 44px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
  animation: slideUp 0.6s ease;
}
.login-brand { text-align: center; margin-bottom: 36px; }
.login-brand .login-icon {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, #2ec8a6, #0d5fb8);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  margin: 0 auto 16px;
  box-shadow: 0 10px 28px rgba(18, 133, 209, 0.34);
  animation: float 3s ease-in-out infinite;
}

/* Desktop: sidebar compacta por padrao, expandindo ao hover/focus */
@media (min-width: 769px) {
  #menu-toggle { display: none; }

  .sidebar {
    width: var(--sidebar-collapsed);
  }

  .sidebar:hover,
  .sidebar:focus-within {
    width: var(--sidebar-width);
  }

  .sidebar-brand {
    justify-content: center;
    padding-left: 10px;
    padding-right: 10px;
  }

  .sidebar-nav {
    padding-left: 8px;
    padding-right: 8px;
  }

  .sidebar .sidebar-brand .brand-text,
  .sidebar .sidebar-footer .user-info {
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    pointer-events: none;
    transform: translateX(-8px);
    transition: opacity var(--transition-fast), max-width var(--transition-fast), transform var(--transition-fast);
  }

  .sidebar .nav-section-label {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin: 0;
    overflow: hidden;
    pointer-events: none;
    transform: translateX(-8px);
    transition: opacity var(--transition-fast), max-height var(--transition-fast), padding var(--transition-fast), transform var(--transition-fast);
  }

  .sidebar .nav-item {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    gap: 0;
    font-size: 0;
  }

  .sidebar .nav-item:hover {
    transform: none;
  }

  .sidebar .nav-item .nav-badge {
    display: none;
  }

  .sidebar .sidebar-footer {
    justify-content: center;
    padding-left: 8px;
    padding-right: 8px;
  }

  .main-content {
    margin-left: var(--sidebar-collapsed);
  }

  .sidebar:hover ~ .main-content,
  .sidebar:focus-within ~ .main-content,
  .sidebar.open ~ .main-content {
    margin-left: var(--sidebar-width);
  }

  .sidebar:hover .sidebar-brand,
  .sidebar:focus-within .sidebar-brand {
    justify-content: flex-start;
    padding-left: 18px;
    padding-right: 18px;
  }

  .sidebar:hover .sidebar-brand .brand-text,
  .sidebar:hover .sidebar-footer .user-info,
  .sidebar:focus-within .sidebar-brand .brand-text,
  .sidebar:focus-within .sidebar-footer .user-info {
    opacity: 1;
    max-width: 220px;
    pointer-events: auto;
    transform: translateX(0);
  }

  .sidebar:hover .nav-section-label,
  .sidebar:focus-within .nav-section-label {
    opacity: 1;
    max-height: 40px;
    padding: 18px 12px 6px;
    pointer-events: auto;
    transform: translateX(0);
  }

  .sidebar:hover .sidebar-nav,
  .sidebar:focus-within .sidebar-nav {
    padding-left: 10px;
    padding-right: 10px;
  }

  .sidebar:hover .nav-item,
  .sidebar:focus-within .nav-item {
    justify-content: flex-start;
    padding-left: 12px;
    padding-right: 12px;
    gap: 10px;
    font-size: 0.84rem;
  }

  .sidebar:hover .nav-item:hover,
  .sidebar:focus-within .nav-item:hover {
    transform: translateX(2px);
  }

  .sidebar:hover .nav-item .nav-badge,
  .sidebar:focus-within .nav-item .nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar:hover .sidebar-footer,
  .sidebar:focus-within .sidebar-footer {
    justify-content: flex-start;
    padding-left: 16px;
    padding-right: 16px;
  }
}
.login-logo {
  width: 100%;
  height: 100%;
  border-radius: calc(var(--radius-lg) - 3px);
  object-fit: cover;
}
.login-brand h1 { font-size: 1.4rem; font-weight: 800; font-family: var(--font-display); }
.login-brand p { font-size: 0.82rem; color: var(--color-text-muted); margin-top: 4px; }

/* ─── RESPONSIVE ────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .call-panel-ticket { font-size: 3.5rem; }
  .call-operator-chip { width: 100%; }
}

/* ─── UTILITY ───────────────────────────────────────────────────────────── */
.d-flex        { display: flex; }
.align-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8         { gap: 8px; }
.gap-12        { gap: 12px; }
.gap-16        { gap: 16px; }
.gap-20        { gap: 20px; }
.mt-8          { margin-top: 8px; }
.mt-16         { margin-top: 16px; }
.mt-24         { margin-top: 24px; }
.mb-8          { margin-bottom: 8px; }
.mb-16         { margin-bottom: 16px; }
.mb-24         { margin-bottom: 24px; }
.p-16          { padding: 16px; }
.p-20          { padding: 20px; }
.w-full        { width: 100%; }
.flex-1        { flex: 1; }
.overflow-hidden { overflow: hidden; }
.truncate      { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
