
@keyframes spin {
  to { transform: rotate(360deg); }
}

:root {
  --font-sans: 'Outfit', sans-serif;
  
  /* Color Palette */
  --bg-base: #0a0814;
  --bg-surface: rgba(20, 18, 33, 0.55);
  --bg-surface-solid: #141221;
  --bg-card: rgba(30, 27, 50, 0.45);
  --bg-card-hover: rgba(40, 36, 66, 0.65);
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.6);
  
  --text-primary: #ffffff;
  --text-secondary: #a19fb5;
  --text-muted: #6b697e;
  
  /* Accents */
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --primary-hover: #4f46e5;
  
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  
  /* Section Colors */
  --color-owner-gestion: #6366f1;
  --color-animation: #ec4899;
  --color-gaming: #3b82f6;
  --color-coins: #f59e0b;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  
  --sidebar-width: 260px;
}

/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-sans);
}

/* overflow-x sur html ET body : fix iOS Safari qui ignore overflow sur body seul */
html {
  overflow-x: hidden;
}

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(236, 72, 153, 0.04) 0%, transparent 40%);
  background-attachment: fixed;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Typography & Layout */
h1, h2, h3, h4, h5 {
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* App Wrapper */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Navigation Menu */
.navbar {
  width: var(--sidebar-width);
  background: rgba(14, 11, 26, 0.85);
  border-right: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 3rem;
  padding-left: 0.5rem;
}

.brand-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), #ec4899);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
}

.brand-text {
  font-size: 1.3rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.8rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 10px;
  font-weight: 500;
  transition: var(--transition-normal);
}

.nav-item a:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.nav-item.active a {
  background: var(--primary-glow);
  color: var(--text-primary);
  border: 1px solid rgba(99, 102, 241, 0.25);
  box-shadow: 0 4px 20px var(--primary-glow);
}

.nav-item a svg {
  width: 20px;
  height: 20px;
  opacity: 0.7;
  transition: var(--transition-normal);
}

.nav-item.active a svg {
  opacity: 1;
  color: var(--primary);
}

.nav-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.8rem 0.5rem;
  border-top: 1px solid var(--border-color);
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: #312e81;
  color: #c7d2fe;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-role {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
}

/* Main Content Area */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 2.5rem;
}

.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.header-title h1 {
  font-size: 2.2rem;
  margin-bottom: 0.25rem;
}

.header-title p {
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Glassmorphism Panel */
.glass-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-normal);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover), #4338ca);
  box-shadow: 0 6px 20px 0 rgba(99, 102, 241, 0.45);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
  background: var(--danger);
  color: white;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  border-radius: 6px;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(20, 18, 33, 0.75);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: var(--transition-normal);
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  background: rgba(30, 27, 50, 0.9);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23a19fb5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.2em;
}

/* Login Page Styling */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow-x: hidden;
  background: radial-gradient(circle at center, #13102d 0%, #06050b 100%);
}

.login-card {
  width: 100%;
  /* min() garantit que la carte ne dépasse jamais le viewport, même sur iOS */
  max-width: min(440px, calc(100vw - 3rem));
  min-width: 0;
  background: rgba(20, 18, 33, 0.65);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 3rem 2.5rem;
  backdrop-filter: blur(24px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  text-align: center;
  word-break: break-word;
  overflow-wrap: break-word;
  transform: translateY(0);
  animation: floatUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes floatUp {
  0% { transform: translateY(30px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.login-card .brand {
  justify-content: center;
  margin-bottom: 2rem;
}

.login-card h2 {
  font-size: 1.7rem;
  margin-bottom: 0.5rem;
}

.login-card p {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

/* Calendar planning dashboard grid */
.calendar-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  gap: 15px;
  flex-wrap: wrap;
}

.server-selector-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.server-select-input {
  width: clamp(160px, 30vw, 250px);
}

.week-actions-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.week-navigator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-color);
  padding: 0.4rem;
  border-radius: 12px;
}

.current-week-label {
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0 1rem;
  min-width: 200px;
  text-align: center;
}

.lock-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}
.lock-status-badge.unlocked {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.lock-status-badge.locked {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.calendar-wrapper {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.calendar-banner-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  z-index: 0;
  opacity: 0.18;
}

.calendar-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  padding: 1.2rem;
  z-index: 1;
  background: rgba(10, 8, 20, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  min-height: 550px;
}

.calendar-col {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 0.8rem;
  min-height: 500px;
  transition: var(--transition-normal);
}

.calendar-col:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.09);
  transform: translateY(-2px);
}

.col-header {
  text-align: center;
  padding-bottom: 0.8rem;
  margin-bottom: 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.col-header-day {
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  color: var(--text-primary);
}

.col-header-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.col-events-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

/* Event Item Card */
.event-item {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 0.65rem;
  position: relative;
  transition: var(--transition-normal);
  cursor: pointer;
  overflow: hidden;
}

.event-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

/* Event categories color-coding */
.event-item.section-owner_gestion::before { background-color: var(--color-owner-gestion); }
.event-item.section-animation::before { background-color: var(--color-animation); }
.event-item.section-gaming::before { background-color: var(--color-gaming); }
.event-item.section-coins::before { background-color: var(--color-coins); }

.event-item:hover {
  background: rgba(0, 0, 0, 0.6);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.event-time-badge {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.event-time {
  font-size: 0.75rem;
  font-weight: 700;
  color: #a5f3fc;
}

.event-status-icon {
  font-size: 0.75rem;
}
.event-status-icon.validated { color: var(--success); }
.event-status-icon.pending { color: var(--warning); }

.event-title {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-channel-tag {
  font-size: 0.7rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.add-event-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition-normal);
  margin-top: auto;
}
.add-event-placeholder:hover {
  border-color: var(--primary);
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.05);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 4, 10, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-card {
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 100%;
  max-width: 580px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  transform: scale(0.95);
  transition: var(--transition-normal);
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition-fast);
}
.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1.2rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: rgba(0, 0, 0, 0.15);
}

/* 2FA Prompt Modal Specifics */
.totp-input-grid {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 1.5rem 0;
}
.totp-digit {
  width: 45px;
  height: 55px;
  font-size: 1.5rem;
  text-align: center;
  border-radius: 8px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-color);
  color: white;
}
.totp-digit:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

/* Config grid cards layout */
.config-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 25px;
}

.bot-tokens-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 1rem;
}

.token-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  padding: 1rem;
  border-radius: 12px;
  transition: var(--transition-fast);
}

.token-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.token-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}
.token-badge.primary {
  background: rgba(99, 102, 241, 0.15);
  color: #a5f3fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}
.token-badge.worker {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
}

/* Accounts page details table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.data-table th, .data-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-transform: uppercase;
}

.data-table tbody tr {
  transition: var(--transition-fast);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-owner {
  background: rgba(99, 102, 241, 0.15);
  color: #a5f3fc;
}
.badge-staff {
  background: rgba(236, 72, 153, 0.15);
  color: #fbcfe8;
}
.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: #a7f3d0;
}
.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

/* Pagination */
.pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
}

.pagination-info {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.pagination-controls {
  display: flex;
  gap: 8px;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  color: white;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  transform: translateX(120%);
  transition: var(--transition-normal);
}

.toast.active {
  transform: translateX(0);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--info); }
.toast.warning { border-left-color: var(--warning); }

/* ══════════════════════════════════════════════════
   RESPONSIVE DESIGN — Multi-plateforme
   Breakpoints : 1200 → 1024 → 900 → 768 → 600 → 480 → 375
   ══════════════════════════════════════════════════ */

/* ── 1200px : grands écrans ── */
@media (max-width: 1200px) {
  .calendar-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .calendar-col {
    min-height: 400px;
  }
}

/* ── 1024px : tablette paysage ── */
@media (max-width: 1024px) {
  .calendar-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .calendar-col {
    min-height: 350px;
  }
  .main-content {
    padding: 1.5rem;
  }
}

/* ── 900px : tablette portrait / mobile large ── */
@media (max-width: 900px) {
  /* Layout : navbar en haut, contenu en dessous */
  .app-container {
    flex-direction: column;
  }
  .navbar {
    width: 100%;
    height: auto;
    position: relative;
    padding: 0.75rem 1rem;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .brand {
    margin-bottom: 0;
    flex-shrink: 0;
  }
  .nav-links {
    flex-direction: row;
    flex: 1;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
    padding-bottom: 0;
    scrollbar-width: none;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-item a {
    padding: 0.6rem 0.8rem;
    white-space: nowrap;
    font-size: 0.85rem;
  }
  .nav-item a svg {
    width: 16px;
    height: 16px;
  }
  .nav-footer {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding-top: 0.5rem;
    margin-top: 0;
    border-top: 1px solid var(--border-color);
  }
  .user-profile {
    border-top: none;
    padding: 0;
    flex: 1;
  }
  .main-content {
    margin-left: 0;
    padding: 1.5rem;
  }
  /* Calendrier */
  .calendar-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .calendar-col {
    min-height: 300px;
  }
  /* Config */
  .config-grid {
    grid-template-columns: 1fr;
  }
  /* Tables horizontalement scrollables */
  .glass-panel {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .data-table {
    min-width: 520px;
  }
  /* Grille filtres audit → 2 colonnes */
  .audit-filters-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  /* Header */
  .header-bar {
    margin-bottom: 1rem;
  }
  /* Dropdown profil : s'ouvre vers le BAS en mode barre horizontale */
  #profile-dropdown {
    bottom: auto !important;
    top: calc(100% + 8px) !important;
    left: auto !important;
    right: 0 !important;
  }
}

/* ── 768px : tablette portrait étroite / mobile standard ── */
@media (max-width: 768px) {
  .main-content {
    padding: 1rem;
  }
  /* iOS : font-size 16px minimum pour désactiver le zoom automatique */
  .form-control,
  input.form-control,
  select.form-control,
  textarea.form-control {
    font-size: 16px !important;
  }
  /* Calendrier */
  .calendar-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 1rem;
  }
  .calendar-col {
    min-height: 260px;
  }
  .calendar-controls {
    gap: 8px;
  }
  /* Panels */
  .glass-panel {
    padding: 1.25rem;
    border-radius: 12px;
  }
  /* Modales */
  .modal-card {
    margin: 0.75rem;
    max-height: calc(100dvh - 1.5rem);
    border-radius: 14px;
  }
  .modal-header,
  .modal-footer {
    padding: 1rem 1.25rem;
  }
  .modal-body {
    padding: 1.25rem;
    max-height: 58vh;
  }
  /* Touch targets 44px minimum */
  .btn {
    min-height: 44px;
  }
  .btn-sm {
    min-height: 38px;
    padding: 0.45rem 0.9rem;
  }
  .nav-item a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .add-event-placeholder {
    min-height: 44px;
  }
  /* Titres */
  .header-title h1 {
    font-size: clamp(1.3rem, 5vw, 2.2rem);
  }
  /* Week navigator */
  .current-week-label {
    min-width: auto;
    font-size: 0.85rem;
    padding: 0 0.6rem;
  }
  /* Login / pages standalone */
  .login-card {
    padding: 2rem 1.75rem;
    border-radius: 16px;
  }
  /* Pagination */
  .pagination-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  /* Toast */
  .toast-container {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
  }
  .toast {
    min-width: 0;
    width: 100%;
  }
  /* Token items */
  .token-item {
    flex-wrap: wrap;
    gap: 8px;
  }
}

/* ── 600px : mobile ── */
@media (max-width: 600px) {
  /* Calendrier → 1 colonne */
  .calendar-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 0.75rem;
    min-height: auto;
  }
  .calendar-col {
    min-height: 150px;
  }
  /* Grille filtres audit → 1 colonne */
  .audit-filters-grid {
    grid-template-columns: 1fr !important;
  }
  /* Formulaire event → 1 colonne */
  .event-form-grid-2 {
    grid-template-columns: 1fr !important;
  }
  /* Panels */
  .glass-panel {
    padding: 1rem;
    border-radius: 10px;
  }
  /* Modales */
  .modal-body {
    max-height: 55vh;
  }
  /* Tables */
  .data-table {
    min-width: 460px;
  }
  /* Login */
  .login-card {
    padding: 1.75rem 1.25rem;
    border-radius: 14px;
  }
  /* Header */
  .header-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
  }
  .header-actions {
    width: 100%;
  }
  .header-actions .btn {
    width: 100%;
    justify-content: center;
  }
  /* Calendar controls : empilement vertical */
  .calendar-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .server-selector-container {
    width: 100%;
    justify-content: space-between;
  }
  .server-select-input {
    width: auto;
    flex: 1;
  }
  .week-navigator {
    justify-content: space-between;
  }
  .week-actions-bar {
    width: 100%;
    justify-content: flex-start;
  }
  /* Description header : masquée sur mobile pour réduire le scroll */
  .header-title p {
    display: none;
  }
}

/* ── 480px : petits mobiles ── */
@media (max-width: 480px) {
  .main-content {
    padding: 0.75rem;
  }
  /* Calendrier */
  .calendar-grid {
    gap: 6px;
    padding: 0.6rem;
  }
  .calendar-col {
    padding: 0.5rem;
    min-height: 120px;
  }
  .col-header-day {
    font-size: 0.75rem;
  }
  .col-header-date {
    font-size: 0.7rem;
  }
  .event-title {
    font-size: 0.75rem;
  }
  .event-channel-tag {
    font-size: 0.65rem;
  }
  /* Titres */
  .header-title h1 {
    font-size: 1.3rem;
  }
  /* Panels */
  .glass-panel {
    padding: 0.875rem;
  }
  /* Modales */
  .modal-card {
    margin: 0.5rem;
    border-radius: 12px;
  }
  .modal-body {
    max-height: 52vh;
  }
  /* Login */
  .login-card {
    padding: 1.5rem 1.125rem;
    border-radius: 12px;
  }
  /* Toast : pleine largeur */
  .toast-container {
    bottom: 0.5rem;
    right: 0.5rem;
    left: 0.5rem;
  }
  /* Day toggles */
  .day-toggle-group {
    gap: 4px;
  }
  .day-toggle-group .day-btn {
    min-width: 38px;
    height: 36px;
    font-size: 0.8rem;
  }
  /* Nav : icônes seules (pas de texte) sur petits mobiles */
  .nav-label {
    display: none;
  }
  .nav-item a {
    gap: 0;
    padding: 0.55rem 0.65rem;
  }
  /* Main content : moins de padding en haut car navbar est au-dessus */
  .main-content {
    padding-top: 0.75rem;
  }
  /* Table réduite */
  .data-table th,
  .data-table td {
    padding: 0.75rem 0.625rem;
    font-size: 0.85rem;
  }
}

/* ── 375px : très petits écrans (iPhone SE, Galaxy A) ── */
@media (max-width: 375px) {
  .main-content {
    padding: 0.5rem;
  }
  .glass-panel {
    padding: 0.75rem;
    border-radius: 8px;
  }
  /* Calendrier */
  .calendar-grid {
    gap: 5px;
    padding: 0.5rem;
  }
  .calendar-col {
    padding: 0.4rem;
    min-height: 100px;
  }
  /* Contrôles semaine */
  .calendar-controls {
    gap: 6px;
  }
  .current-week-label {
    font-size: 0.78rem;
    padding: 0 0.4rem;
  }
  /* Modales */
  .modal-card {
    margin: 0.375rem;
    border-radius: 10px;
  }
  .modal-header,
  .modal-footer {
    padding: 0.875rem 1rem;
  }
  .modal-body {
    padding: 1rem;
    max-height: 48vh;
  }
  /* Login */
  .login-card {
    padding: 1.25rem 0.875rem;
    border-radius: 12px;
  }
  /* Boutons */
  .btn-sm {
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
  }
  /* Tables */
  .data-table th,
  .data-table td {
    padding: 0.625rem 0.5rem;
    font-size: 0.8rem;
  }
}

/* Custom Styled File Input */
input[type="file"].form-control {
  padding: 8px 12px;
  background: rgba(20, 18, 33, 0.75);
  border: 1px dashed var(--border-color);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  height: auto;
}

input[type="file"].form-control:focus {
  border-style: solid;
  border-color: var(--border-focus);
}

input[type="file"].form-control::file-selector-button {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  border: none;
  color: white;
  padding: 6px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-fast);
  margin-right: 15px;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
}

input[type="file"].form-control::file-selector-button:hover {
  background: linear-gradient(135deg, var(--primary-hover), #4338ca);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

/* Day Toggles Row */
.day-toggle-group {
  display: flex;
  gap: 8px;
  margin-top: 5px;
  flex-wrap: wrap;
  width: 100%;
}

.day-toggle-group .day-btn {
  flex: 1;
  min-width: 45px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: 600;
  transition: var(--transition-fast);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.day-toggle-group .day-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

.day-toggle-group .day-btn.active {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  color: white;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.25);
  border-color: transparent;
}

/* ═══════════════════════════════════════
   Custom Select Component (shared)
═══════════════════════════════════════ */
.cs-wrapper { position: relative; width: 100%; }

.cs-trigger {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 0 0.875rem; height: 42px;
  background: var(--bg-surface); border: 1px solid var(--border-color);
  border-radius: 8px; cursor: pointer; user-select: none; outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.cs-trigger:hover, .cs-trigger:focus-visible { border-color: rgba(99,102,241,0.45); }
.cs-trigger.open {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow);
  border-bottom-left-radius: 0; border-bottom-right-radius: 0;
}
.cs-disp { display: flex; align-items: center; gap: 5px; flex: 1; min-width: 0; }
.cs-disp-hash { color: var(--primary); font-weight: 700; font-size: 1rem; flex-shrink: 0; line-height: 1; }
.cs-disp-name { color: var(--text-primary); font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-placeholder { color: var(--text-muted); font-size: 0.875rem; flex: 1; }
.cs-role-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.cs-arrow { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; transition: transform var(--transition-fast); }
.cs-trigger.open .cs-arrow { transform: rotate(180deg); }

.cs-dropdown {
  display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 200;
  background: #16132a; border: 1px solid var(--primary); border-top: none;
  border-bottom-left-radius: 8px; border-bottom-right-radius: 8px;
  max-height: 260px; overflow-y: auto; box-shadow: 0 12px 32px rgba(0,0,0,0.5);
}
.cs-dropdown.open { display: block; }
.cs-group-header {
  padding: 6px 12px 3px; font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted);
  background: rgba(0,0,0,0.25); position: sticky; top: 0;
}
.cs-opt { display: flex; align-items: center; gap: 6px; padding: 7px 14px; cursor: pointer; transition: background var(--transition-fast); }
.cs-opt:hover { background: rgba(99,102,241,0.12); }
.cs-opt.active { background: rgba(99,102,241,0.22); }
.cs-opt-none { color: var(--text-muted); font-size: 0.875rem; border-bottom: 1px solid var(--border-color); }
.cs-opt-hash { color: var(--primary); font-weight: 700; font-size: 0.95rem; flex-shrink: 0; }
.cs-opt-label { color: var(--text-primary); font-size: 0.875rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-opt-category {
  color: var(--text-muted); font-size: 0.72rem; white-space: nowrap; flex-shrink: 0;
  background: rgba(255,255,255,0.05); padding: 1px 7px; border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.07);
}

/* ═══════════════════════════════════════
   Section Pills
═══════════════════════════════════════ */
.section-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.section-pill {
  padding: 6px 14px; border-radius: 6px; border: 1.5px solid;
  background: transparent; font-size: 0.8rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition-fast); white-space: nowrap;
}

/* ═══════════════════════════════════════
   Location Type Tabs
═══════════════════════════════════════ */
.loc-type-tabs {
  display: flex; margin-bottom: 8px; border-radius: 8px;
  overflow: hidden; border: 1px solid var(--border-color); width: fit-content;
}
.loc-tab {
  padding: 7px 16px; background: transparent; border: none;
  color: var(--text-muted); font-size: 0.82rem; font-weight: 500; cursor: pointer;
  transition: all var(--transition-fast);
}
.loc-tab:not(:last-child) { border-right: 1px solid var(--border-color); }
.loc-tab.active { background: var(--primary); color: white; }
.loc-tab:hover:not(.active) { background: var(--bg-card-hover); color: var(--text-primary); }

/* ═══════════════════════════════════════
   btn-success (validate events)
═══════════════════════════════════════ */
.btn-success {
  background: rgba(16,185,129,0.12); color: var(--success); border-color: rgba(16,185,129,0.3);
}
.btn-success:hover { background: var(--success); color: white; }

/* Custom Confirm Modal specific button overrides */
#global-confirm-modal .btn-primary {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.3);
}
#global-confirm-modal .btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover), #4338ca);
  box-shadow: 0 4px 18px 0 rgba(99, 102, 241, 0.45);
}
#global-confirm-modal .btn-danger-confirm {
  background: linear-gradient(135deg, var(--danger), #dc2626) !important;
  box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.3) !important;
}
#global-confirm-modal .btn-danger-confirm:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c) !important;
  box-shadow: 0 4px 18px 0 rgba(239, 68, 68, 0.45) !important;
}

