/* ── Page toolbar ─────────────────────────────────────────────────────────── */
.page-toolbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 8px 8px 0 0;
    padding: 10px 0;
    margin: 0 0 0 0;
}
.actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
    align-items: center;
    margin: 0;
}
.actions-bar > * {
    align-self: center;
}
.page-toolbar .action-btn,
.page-toolbar .action-btn-tool {
    padding: 6px 12px;
    font-size: 0.95em;
}
.page-toolbar .action-btn-util {
    padding: 6px 12px;
    font-size: 0.95em;
    box-sizing: border-box;
}
.actions-sep {
    width: 1px;
    background: #cbd5e1;
    align-self: stretch;
    margin: 0 4px;
}
.page-header-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  margin: -20px -32px 24px;
  padding: 14px 32px;
}

/* ── Sidebar live section ────────────────────────────────────────────────── */
.sidebar-live {
  border-top: 1px solid #1a3a62;
  flex-shrink: 0;
}
.sidebar-live-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  cursor: pointer;
  user-select: none;
  font-size: 0.80em;
  font-weight: 600;
  color: #94a3b8;
  transition: background 0.13s;
}
.sidebar-live-header:hover { background: #0d2d54; }
.sidebar-live-dot {
  font-size: 0.65em;
  color: #475569;
  line-height: 1;
  flex-shrink: 0;
}
.sidebar-live-dot.active { color: #86efac; }
.sidebar-live-chevron {
  margin-left: auto;
  font-size: 0.75em;
  color: #475569;
  flex-shrink: 0;
}
.sidebar-live-body {
  padding: 0 8px 8px;
  max-height: 220px;
  overflow-y: auto;
  background: #0f3460;
  border-radius: 0 0 4px 4px;
}
.live-row {
  padding: 4px 0;
  border-bottom: 1px solid #1e4a7a;
  line-height: 1.35;
  color: #ffffff;
}
.sidebar-live .live-meta { display: none; }
.live-row:last-child { border-bottom: none; }
.live-active  { color: #4ade80; }
.live-free    { color: #7dd3fc; }
.live-meta    { color: #64748b; font-size: 0.85em; margin-left: 4px; }
.live-empty   { color: #94a3b8; font-style: italic; padding: 4px 0; }
.live-link    { display: block; text-decoration: none; border-radius: 4px; margin: 0 -6px; padding: 2px 6px; }
.live-link:hover { background: rgba(255,255,255,0.08); }

/* ── App Layout (Sidebar) ─────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #0a2342;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 500;
  overflow-y: auto;
  overflow-x: hidden;
}
.app-main {
  flex: 1;
  margin-left: 220px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  padding: 14px 12px;
  border-bottom: 1px solid #1a3a62;
  gap: 8px;
  flex-shrink: 0;
}
.sidebar-brand-link {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  text-decoration: none; flex: 1; min-width: 0;
}
.sidebar-brand-logo {
  height: 50px; max-width: 140px;
  object-fit: contain; border-radius: 3px; flex-shrink: 0;
}
.sidebar-brand-icon { font-size: 1.3em; line-height: 1; flex-shrink: 0; }
.sidebar-brand-name {
  color: #f1f5f9; font-weight: 700; font-size: 0.92em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-close-btn {
  display: none;
  background: none; border: none; color: #64748b;
  font-size: 1.1em; cursor: pointer; padding: 4px 6px;
  flex-shrink: 0; line-height: 1;
}
.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.sidebar-section-label {
  font-size: 0.67em; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: #475569;
  padding: 10px 16px 4px;
}
.sidebar-nav-item {
  display: block; padding: 7px 12px;
  color: #94a3b8; text-decoration: none;
  font-size: 0.88em; border-radius: 6px; margin: 1px 6px;
  transition: background 0.13s, color 0.13s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-nav-item:hover { background: #0d2d54; color: #e2e8f0; }
.sidebar-nav-item.active { background: #ffb400; color: #0a2342; font-weight: 700; }
.sidebar-nav-subitem {
  display: block; padding: 5px 12px 5px 28px;
  color: #5c8ab0; text-decoration: none;
  font-size: 0.82em; border-radius: 5px; margin: 1px 6px;
  transition: background 0.13s, color 0.13s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-nav-subitem:hover { background: #0d2d54; color: #94a3b8; }
.sidebar-nav-subitem.active { color: #e2e8f0; background: #163260; font-weight: 600; }
.sidebar-nav-group { position: relative; }
.sidebar-nav-item-row {
  display: flex; align-items: center; margin: 1px 6px;
}
.sidebar-nav-item-row .sidebar-nav-item { flex: 1; margin: 0; }
.sidebar-nav-toggle {
  background: none; border: none; color: #5c8ab0;
  cursor: pointer; padding: 4px 6px; font-size: 0.75em; line-height: 1;
  flex-shrink: 0; transition: transform 0.2s; border-radius: 4px;
}
.sidebar-nav-toggle:hover { color: #94a3b8; background: #0d2d54; }
.sidebar-nav-group.open .sidebar-nav-toggle { transform: rotate(180deg); }
.sidebar-nav-children { display: none; }
.sidebar-nav-group.open .sidebar-nav-children { display: block; }
.sidebar-footer {
  border-top: 1px solid #1a3a62; padding: 6px 0;
  margin-top: auto; flex-shrink: 0;
}
.sidebar-footer-item {
  display: block; padding: 7px 16px;
  color: #5c8ab0; text-decoration: none;
  font-size: 0.82em; transition: color 0.13s, background 0.13s;
  border-radius: 5px; margin: 1px 6px;
}
.sidebar-footer-item:hover { color: #94a3b8; background: #0d2d54; }
.sidebar-footer-user {
  display: block; padding: 6px 16px;
  color: #3d6a9a; font-size: 0.78em; font-style: italic;
}
.sidebar-footer-logout { color: #f87171 !important; }
.sidebar-footer-logout:hover { color: #fca5a5 !important; background: #2d1015 !important; }
.sidebar-footer-admin { background: #0d2d54 !important; color: #94a3b8 !important; }
.sidebar-footer-admin:hover { background: #1a3a62 !important; color: #e2e8f0 !important; }
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 499;
}
.sidebar-overlay.open { display: block; }

/* ── Mobile top bar ──────────────────────────────────────────────────────── */
.app-topbar {
  display: none; align-items: center; gap: 10px;
  background: #0a2342; color: #fff;
  padding: 0 14px; height: 48px;
  flex-shrink: 0; position: sticky; top: 0; z-index: 200;
}
.app-topbar-burger {
  background: none; border: none; color: #fff;
  font-size: 1.2em; cursor: pointer; padding: 6px; line-height: 1;
}
.app-topbar-title {
  flex: 1; font-weight: 600; font-size: 0.9em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── App tab bar ─────────────────────────────────────────────────────────── */
.app-tabbar {
  display: flex; align-items: center;
  background: #fff; border-bottom: 2px solid #f1f5f9;
  padding: 0 12px; flex-shrink: 0;
  box-shadow: 0 1px 0 #e2e8f0;
}
.app-tabbar-link {
  color: #6b7280; text-decoration: none;
  padding: 11px 12px; font-size: 0.86em;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color 0.13s, border-color 0.13s;
  white-space: nowrap; font-weight: 500;
}
.app-tabbar-link:hover { color: #374151; border-bottom-color: #d1d5db; }
.app-tabbar-link.active { color: #1e293b; border-bottom-color: #ffb400; font-weight: 700; }

/* ── Tableau page layout ───────────────────────────────────────────────────── */
.tableau-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  align-items: start;
  margin-top: 16px;
}

@media (max-width: 767px) {
  /* Sidebar → drawer slide-in */
  .sidebar { transform: translateX(-220px); transition: transform 0.25s; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close-btn { display: block; }
  .app-main { margin-left: 0; }
  .app-topbar { display: flex; }
  /* page-toolbar décalée sous la topbar */
  .page-toolbar { top: 48px; }
  /* Toolbar des pages planning / finales : ne garder que .mob-keep */
  .page-toolbar { padding: 8px 12px; border-radius: 0; position: sticky; top: 0; z-index: 200; }
  .page-toolbar .actions-sep,
  .page-toolbar .action-btn:not(.mob-keep),
  .page-toolbar .action-btn-tool,
  .page-toolbar .action-btn-util,
  .page-toolbar .toolbar-btn:not(.mob-keep) { display: none !important; }
  .page-toolbar .actions-bar { flex-direction: row; flex-wrap: wrap; }
  .view-toggle-group { display: none !important; }
  .page-toolbar .mob-keep {
    display: inline-flex !important;
    padding: 8px 14px;
    font-size: 0.9em;
    font-weight: 600;
    min-height: 40px;
    align-items: center;
  }

  /* Page d'accueil tournoi : barre simplifiée sur mobile */
  .page-header-bar {
    margin: -12px -12px 16px !important;
    padding: 10px 12px !important;
    gap: 8px;
  }
  .page-header-bar .toolbar-btn:not(.mob-keep),
  .page-header-bar .split-btn-main,
  .page-header-bar .split-btn-disabled,
  .page-header-bar .split-btn-seg { display: none !important; }
  .page-header-bar h1 { font-size: 1.1em !important; }

  /* Tableau page layout : une colonne sur mobile */
  .tableau-layout { grid-template-columns: 1fr !important; }
}
