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

:root {
  --bg:       #f5f5f3;
  --surface:  #ffffff;
  --border:   #e2e2de;
  --border2:  #d0d0cb;
  --text:     #1a1a1a;
  --text2:    #6b6b6b;
  --text3:    #9b9b9b;
  --accent:   #2563eb;
  --accent-l: #eff4ff;
  --success:  #16a34a;
  --success-l:#f0fdf4;
  --danger:   #dc2626;
  --danger-l: #fef2f2;
  --warn:     #d97706;
  --warn-l:   #fffbeb;
  --am:       #d97706;
  --am-l:     #fef3c7;
  --pm:       #7c3aed;
  --pm-l:     #ede9fe;
  --radius:   8px;
  --radius-lg:12px;
  --shadow:   0 1px 3px rgba(0,0,0,.08);
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ── Layout ── */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 20px 16px 14px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo h1 { font-size: 15px; font-weight: 600; }
.sidebar-logo p  { font-size: 12px; color: var(--text2); margin-top: 2px; }

.sidebar-section { padding: 12px 8px 4px; }
.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 0 8px;
  margin-bottom: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text2);
  font-size: 13px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background .12s, color .12s;
}
.nav-item:hover  { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--accent-l); color: var(--accent); font-weight: 500; }
.nav-item .icon  { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  background: var(--border);
  color: var(--text2);
  padding: 1px 6px;
  border-radius: 99px;
}
.nav-badge.am { background: var(--am-l);  color: var(--am); }
.nav-badge.pm { background: var(--pm-l);  color: var(--pm); }

/* ── Main ── */
.main { display: flex; flex-direction: column; }
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-meta  { font-size: 12px; color: var(--text2); margin-top: 1px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.content { padding: 24px; flex: 1; max-width: 900px; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 12px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.card-title { font-size: 13px; font-weight: 600; color: var(--text); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.btn:hover    { background: var(--bg); border-color: var(--border2); }
.btn:active   { transform: scale(.98); }
.btn-primary  { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-danger   { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover  { background: #b91c1c; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 5px 7px; }

/* ── Forms ── */
.form-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
input[type=text], input[type=number], input[type=time],
input[type=date], select, textarea {
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .15s;
  width: 100%;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
label { font-size: 12px; font-weight: 500; color: var(--text2); display: block; margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.field-inline { display: flex; align-items: center; gap: 12px; }
.field-inline label { margin: 0; white-space: nowrap; }
.field-inline input { width: 80px; }
.unit { font-size: 12px; color: var(--text2); white-space: nowrap; }

/* ── Table ── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th.center, td.center { text-align: center; }
td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }
.rank-1 td:first-child { font-weight: 600; }

/* ── Badges & pills ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 99px;
}
.badge-am      { background: var(--am-l);      color: var(--am); }
.badge-pm      { background: var(--pm-l);      color: var(--pm); }
.badge-ok      { background: var(--success-l); color: var(--success); }
.badge-warn    { background: var(--warn-l);    color: var(--warn); }
.badge-danger  { background: var(--danger-l);  color: var(--danger); }
.badge-neutral { background: var(--bg);        color: var(--text2); border: 1px solid var(--border); }

.terrain-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 99px;
}
.t1 { background: #dbeafe; color: #1e40af; }
.t2 { background: #d1fae5; color: #065f46; }
.t3 { background: #fef3c7; color: #92400e; }
.t4 { background: #ede9fe; color: #5b21b6; }

/* ── Match rows ── */
.match-block { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.match-block-header {
  background: var(--bg);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}
.match-row {
  display: grid;
  grid-template-columns: 52px 1fr 90px 1fr 44px;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.match-row:last-child { border-bottom: none; }
.match-time  { font-size: 12px; font-weight: 600; color: var(--text2); }
.match-team  { font-size: 13px; color: var(--text); }
.match-team.right { text-align: right; }
.match-team.winner { font-weight: 600; }
.score-cell  { display: flex; align-items: center; justify-content: center; gap: 4px; }
.score-inp   {
  width: 34px; text-align: center; padding: 4px 2px;
  font-size: 14px; font-weight: 600;
  border: 1px solid var(--border2);
  border-radius: 6px;
}
.score-sep   { font-size: 13px; color: var(--text3); }

/* ── Statut ── */
.statut-dot {
  width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0;
}
.statut-planifie  .statut-dot { background: var(--text3); }
.statut-en_cours  .statut-dot { background: var(--warn); }
.statut-termine   .statut-dot { background: var(--success); }

/* ── Poule card ── */
.poule-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}
.poule-card-header {
  background: var(--bg);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}
.poule-teams { font-size: 12px; color: var(--text2); font-weight: 400; }

/* ── Stats cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-card  {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.stat-label { font-size: 11px; color: var(--text2); margin-bottom: 4px; }
.stat-val   { font-size: 22px; font-weight: 600; }

/* ── Toast ── */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--text);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: slideIn .2s ease;
  max-width: 320px;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
@keyframes slideIn { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform: none; } }

/* ── Empty state ── */
.empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text3);
  font-size: 13px;
}
.empty-icon { font-size: 28px; margin-bottom: 8px; }

/* ── Settings grid ── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-info .setting-label { font-size: 14px; font-weight: 500; color: var(--text); }
.setting-info .setting-sub   { font-size: 12px; color: var(--text2); margin-top: 1px; }
.setting-ctrl { display: flex; align-items: center; gap: 6px; }
.setting-ctrl input { width: 64px; text-align: center; }
.setting-ctrl input[type=time] { width: 96px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-grid { grid-template-columns: 1fr; }
}
