/* ═══════════════════════════════════════════════════════════
   HUB DOMÉSTICO — DESIGN SYSTEM
   Premium dark-mode-first with glassmorphism & micro-animations
   ═══════════════════════════════════════════════════════════ */

/* ─── Custom Properties ─────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-surface: #1a2332;
  --bg-surface-hover: #243044;
  --glass-bg: rgba(26, 35, 50, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);

  /* Brand Colors */
  --primary: #f59e0b;
  --primary-hover: #d97706;
  --primary-glow: rgba(245, 158, 11, 0.15);
  --accent-green: #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.15);
  --accent-coral: #f97316;

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);

  /* Semantic Colors */
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow-primary: 0 0 20px rgba(245, 158, 11, 0.2);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;

  /* Layout */
  --sidebar-width: 260px;
}

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

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

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

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

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ─── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.2);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.35);
}

/* ═══════════════════════════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════════════════════════ */
.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  z-index: 1000;
  overflow: hidden;
}

/* Animated background orbs */
.login-bg-orbs {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: orbFloat 20s ease-in-out infinite;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: var(--primary-glow);
  background: radial-gradient(circle, rgba(245, 158, 11, 0.18) 0%, transparent 70%);
  top: -100px;
  left: -100px;
  animation-delay: 0s;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.12) 0%, transparent 70%);
  bottom: -150px;
  right: -150px;
  animation-delay: -7s;
  animation-duration: 25s;
}

.orb-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.1) 0%, transparent 70%);
  top: 50%;
  left: 60%;
  animation-delay: -14s;
  animation-duration: 22s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25%      { transform: translate(60px, -40px) scale(1.1); }
  50%      { transform: translate(-30px, 60px) scale(0.95); }
  75%      { transform: translate(40px, 20px) scale(1.05); }
}

/* Login Card */
.login-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 1rem;
  padding: 2.5rem;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: cardEntrance 0.6s ease-out;
}

@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Login Brand */
.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-brand-icon {
  font-size: 2.75rem;
  display: block;
  margin-bottom: 0.5rem;
  animation: brandPulse 3s ease-in-out infinite;
}

@keyframes brandPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}

.login-brand-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  text-shadow: 0 0 30px rgba(245, 158, 11, 0.15);
}

.login-brand-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  font-weight: 400;
}

/* ─── Forms ──────────────────────────────────────────────── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-field {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color var(--transition-normal),
              box-shadow var(--transition-normal),
              background var(--transition-normal);
  outline: none;
}

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

.input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow), var(--shadow-sm);
  background: rgba(15, 23, 42, 0.8);
}

.input-field:hover:not(:focus) {
  border-color: rgba(255, 255, 255, 0.12);
}

/* Form Errors */
.form-error {
  font-size: 0.82rem;
  color: var(--danger);
  min-height: 0;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.form-error:empty {
  display: none;
}

.form-error:not(:empty) {
  padding: 0.5rem 0.75rem;
  background: rgba(239, 68, 68, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  border: none;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #0a0e17;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  box-shadow: var(--shadow-glow-primary), var(--shadow-md);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.12);
}

.btn-block {
  width: 100%;
}

.btn[disabled],
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Button loader */
.btn-loader {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(10, 14, 23, 0.3);
  border-top-color: #0a0e17;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.btn.loading .btn-text {
  visibility: hidden;
}

.btn.loading .btn-loader {
  display: block;
  position: absolute;
}

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

/* Auth Switch */
.auth-switch {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-link {
  color: var(--primary);
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.auth-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════
   HUB LAYOUT
   ═══════════════════════════════════════════════════════════ */
.hub-layout {
  min-height: 100vh;
  background: var(--bg-primary);
}

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  z-index: 100;
  animation: sidebarSlideIn 0.4s ease-out;
  overflow-y: auto;
  overflow-x: hidden;
}

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

.sidebar-inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 0;
}

/* Sidebar Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 1.25rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-brand-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.sidebar-brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  text-shadow: 0 0 24px rgba(245, 158, 11, 0.12);
  line-height: 1.2;
}

.sidebar-brand-badge {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  margin-left: 0.25rem;
  letter-spacing: 0.03em;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.75rem 1.25rem 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1.25rem;
  margin: 0.15rem 0.5rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 450;
  transition: all var(--transition-normal);
  cursor: pointer;
  border-left: 3px solid transparent;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--primary-glow);
  color: var(--primary);
  font-weight: 600;
  border-left-color: var(--primary);
}

.nav-item.active .nav-icon {
  transform: scale(1.1);
}

.nav-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  transition: transform var(--transition-normal);
  width: 1.5rem;
  text-align: center;
}

.nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar User */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent-coral) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #0a0e17;
  flex-shrink: 0;
}

.user-details {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.user-email {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
  flex-shrink: 0;
}

.btn-logout:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

/* ─── Hamburger (Mobile) ─────────────────────────────────── */
.hamburger {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 200;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: all var(--transition-normal);
}

.hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
  backdrop-filter: blur(4px);
}

/* ─── Main Content ───────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  padding: 2rem 2.5rem;
  min-height: 100vh;
  transition: margin-left var(--transition-normal);
}

.page-transition-wrapper {
  animation: pageEnter 0.35s ease-out;
}

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

/* Page Header */
.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.page-header .subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
  font-weight: 400;
}

/* ─── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal),
              box-shadow var(--transition-normal),
              border-color var(--transition-normal);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(255, 255, 255, 0.12);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.card-flat {
  background: var(--bg-surface);
  backdrop-filter: none;
}

/* ─── Stats Grid ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform var(--transition-normal),
              box-shadow var(--transition-normal);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.stat-icon.amber {
  background: var(--primary-glow);
}

.stat-icon.green {
  background: var(--accent-green-glow);
}

.stat-icon.coral {
  background: rgba(249, 115, 22, 0.15);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

/* ─── Empty State ────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 2rem;
  min-height: 200px;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.empty-state-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 360px;
}

/* ─── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge-amber {
  background: var(--primary-glow);
  color: var(--primary);
}

.badge-green {
  background: var(--accent-green-glow);
  color: var(--accent-green);
}

.badge-coral {
  background: rgba(249, 115, 22, 0.15);
  color: var(--accent-coral);
}

.badge-muted {
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-muted);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

/* ─── Filter Bar ─────────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.filter-btn {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--transition-normal);
}

.filter-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--primary-glow);
  color: var(--primary);
  border-color: rgba(245, 158, 11, 0.2);
}

/* ─── Inline Form ────────────────────────────────────────── */
.inline-form {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.inline-form .form-group {
  flex: 1;
  min-width: 180px;
}

.inline-form .btn {
  flex-shrink: 0;
  height: fit-content;
}

/* ─── Checklist ──────────────────────────────────────────── */
.checklist {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--transition-normal);
}

.checklist-item:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(255, 255, 255, 0.1);
}

.checklist-item.checked {
  opacity: 0.5;
}

.checklist-item.checked .checklist-label {
  text-decoration: line-through;
}

.checklist-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--text-muted);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  flex-shrink: 0;
  appearance: none;
  -webkit-appearance: none;
}

.checklist-checkbox:checked {
  background: var(--accent-green);
  border-color: var(--accent-green);
}

.checklist-checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #0a0e17;
  font-size: 0.7rem;
  font-weight: 700;
}

.checklist-label {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.checklist-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-icon:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

/* ─── Toggle Switch ──────────────────────────────────────── */
.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.toggle {
  width: 40px;
  height: 22px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-normal);
  appearance: none;
  -webkit-appearance: none;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--transition-normal);
}

.toggle:checked {
  background: var(--accent-green);
  border-color: var(--accent-green);
}

.toggle:checked::after {
  transform: translateX(18px);
  background: #0a0e17;
}

.toggle-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
}

/* ─── Collapsible Section ────────────────────────────────── */
.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-normal);
}

.collapsible-header:hover {
  background: var(--bg-surface-hover);
}

.collapsible-chevron {
  transition: transform var(--transition-normal);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.collapsible.open .collapsible-chevron {
  transform: rotate(180deg);
}

.collapsible-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow);
}

.collapsible.open .collapsible-body {
  max-height: 500px;
}

.collapsible-body-inner {
  padding: 0 1.25rem 1.25rem;
}

/* ─── Info Card (Nutrição) ───────────────────────────────── */
.info-card {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.info-card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.info-card-content {
  flex: 1;
}

.info-card-content h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.info-card-content p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

/* ─── Search Input ───────────────────────────────────────── */
.search-wrapper {
  position: relative;
  max-width: 500px;
}

.search-wrapper .input-field {
  padding-left: 2.75rem;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

/* ─── Select ─────────────────────────────────────────────── */
.select-field {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color var(--transition-normal),
              box-shadow var(--transition-normal);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

.select-field option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.select-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ─── Toast Notifications ────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 420px;
  pointer-events: auto;
  animation: toastIn 0.35s ease-out;
  backdrop-filter: blur(12px);
}

.toast.removing {
  animation: toastOut 0.25s ease-in forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
  }
}

.toast-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
}

.toast-message {
  font-size: 0.85rem;
  color: var(--text-primary);
  flex: 1;
}

.toast.toast-success {
  border-left: 3px solid var(--success);
}

.toast.toast-error {
  border-left: 3px solid var(--danger);
}

.toast.toast-warning {
  border-left: 3px solid var(--warning);
}

.toast.toast-info {
  border-left: 3px solid var(--primary);
}

/* ─── Cardápio Grid ──────────────────────────────────────── */
.cardapio-grid {
  display: grid;
  grid-template-columns: 100px repeat(7, 1fr);
  gap: 0.5rem;
  overflow-x: auto;
}

.cardapio-grid .day-header {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  padding: 0.75rem 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cardapio-grid .meal-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.75rem 0.5rem;
  display: flex;
  align-items: center;
}

.cardapio-cell {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  min-height: 60px;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: all var(--transition-normal);
  cursor: default;
}

.cardapio-cell:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(255, 255, 255, 0.1);
}

/* ─── Tooltip ────────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  padding: 0.4rem 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-fast);
  z-index: 50;
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* ─── Misc Utilities ─────────────────────────────────────── */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.font-medium { font-weight: 500; }

.section-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Loading Pulse */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

.loading-pulse {
  animation: pulse 1.8s ease-in-out infinite;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

/* Tablet */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 220px;
  }

  .main-content {
    padding: 1.5rem;
  }

  .cardapio-grid {
    grid-template-columns: 80px repeat(7, 1fr);
  }
}

/* Mobile */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    width: 280px;
    animation: none;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .main-content {
    margin-left: 0;
    padding: 4rem 1rem 1.5rem;
  }

  .login-card {
    padding: 1.75rem;
  }

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

  .cardapio-grid {
    grid-template-columns: 70px repeat(7, 100px);
  }

  .inline-form {
    flex-direction: column;
  }

  .inline-form .form-group {
    min-width: 100%;
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  .login-card {
    margin: 0 0.5rem;
    padding: 1.5rem;
  }

  .page-header h1 {
    font-size: 1.35rem;
  }

  .toast-container {
    top: 0.75rem;
    right: 0.75rem;
    left: 0.75rem;
  }

  .toast {
    min-width: 0;
    max-width: 100%;
  }
}
