@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* ─── TOKENS ──────────────────────────────────────────────── */
:root {
  /* Layout */
  --sidebar-bg:        #0F1923;
  --sidebar-elevated:  #182130;
  --sidebar-border:    rgba(255,255,255,0.07);
  --sidebar-text:      #C8D4DF;
  --sidebar-muted:     #566878;
  --sidebar-active-bg: rgba(255,70,85,0.14);
  --sidebar-active:    #FF4655;

  /* Main */
  --bg:          #F2F4F7;
  --panel:       #FFFFFF;
  --panel-raised:#F8F9FB;
  --border:      #E4E8EE;
  --border-strong:#CBD3DC;

  /* Text */
  --text:        #0F1923;
  --text-secondary:#3D5060;
  --text-muted:  #7A8FA0;

  /* Brand */
  --accent:      #FF4655;
  --accent-hover:#E03040;
  --accent-dim:  rgba(255,70,85,0.10);
  --accent-text: #FFFFFF;

  /* Semantic */
  --success:     #22C55E;
  --warn:        #F59E0B;
  --danger:      #EF4444;

  /* Win/Loss */
  --win:         #16A34A;
  --loss:        #DC2626;

  /* Role */
  --role-duelist:    #FF5757;
  --role-initiator:  #F59E0B;
  --role-controller: #A78BFA;
  --role-sentinel:   #34D399;
  --role-igl:        #60A5FA;

  /* Misc */
  --radius:  8px;
  --radius-sm: 5px;
  --radius-pill: 999px;
  --shadow:       0 1px 3px rgba(15,25,35,0.07), 0 4px 16px rgba(15,25,35,0.05);
  --shadow-md:    0 4px 16px rgba(15,25,35,0.10), 0 8px 32px rgba(15,25,35,0.06);
  --shadow-sm:    0 1px 4px rgba(15,25,35,0.08);

  /* Fonts */
  --font-display: 'Chakra Petch', sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;
}

/* ─── RESET ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ─── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  padding: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--sidebar-border);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.sidebar-brand .dot {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent), 0 0 20px rgba(255,70,85,0.4);
  flex-shrink: 0;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 16px 12px 8px;
}
.nav-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  padding: 0 8px;
  margin-bottom: 6px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
}
.nav-link:hover {
  background: var(--sidebar-elevated);
  color: #FFFFFF;
  text-decoration: none;
}
.nav-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active);
}

.roster-mini { display: flex; flex-direction: column; gap: 1px; }
.roster-mini-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; border-radius: var(--radius-sm);
  font-size: 12.5px; color: var(--sidebar-text);
}
.roster-mini-item:hover {
  background: var(--sidebar-elevated);
  color: #FFFFFF;
  text-decoration: none;
}

.role-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.07);
  color: var(--sidebar-muted);
  letter-spacing: 0.05em;
}

/* ─── MAIN ────────────────────────────────────────────────── */
.main {
  padding: 32px 40px 60px;
  max-width: 1360px;
  min-width: 0;
}

/* ─── PAGE HEADER ─────────────────────────────────────────── */
.page-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.page-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: 0.02em;
  color: var(--text);
}
.page-sub {
  color: var(--text-muted);
  margin: 0 0 28px;
  font-size: 13.5px;
}

/* ─── GRID ────────────────────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.grid-cols-2 { grid-template-columns: 1fr 1fr; }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ─── CARD ────────────────────────────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ─── KPI TILES ───────────────────────────────────────────── */
.kpi-tile {
  padding: 18px 20px;
  border-top: 3px solid var(--border);
  transition: border-color 0.15s;
}
.kpi-tile:hover { border-top-color: var(--accent); }
.kpi-value {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.kpi-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 6px;
  font-family: var(--font-mono);
}
.kpi-delta { font-family: var(--font-mono); font-size: 12px; margin-left: 8px; }
.delta-up   { color: var(--success); }
.delta-down { color: var(--danger); }
.delta-flat { color: var(--text-muted); }

/* ─── TABLE ───────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
  padding: 9px 12px;
  border-bottom: 1.5px solid var(--border);
  background: var(--panel-raised);
}
th:first-child { border-radius: var(--radius-sm) 0 0 0; }
th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(242,244,247,0.7); }
.mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-muted); }

/* ─── BADGES ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.03em;
}
.badge-win    { background: rgba(22,163,74,0.10);  color: var(--win); }
.badge-loss   { background: rgba(220,38,38,0.10);  color: var(--loss); }
.badge-warn   { background: rgba(245,158,11,0.12); color: var(--warn); }
.badge-info   { background: var(--accent-dim);     color: var(--accent); }
.badge-muted  { background: var(--panel-raised);   color: var(--text-muted); border: 1px solid var(--border); }

/* ─── BUTTONS ─────────────────────────────────────────────── */
button, .btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--panel);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s, box-shadow 0.12s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
button:hover, .btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(255,70,85,0.25);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-text);
  box-shadow: 0 4px 14px rgba(255,70,85,0.35);
}
.btn-danger { color: var(--danger); border-color: var(--border); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); background: rgba(239,68,68,0.06); box-shadow: none; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: var(--radius-sm); }

/* ─── FORMS ───────────────────────────────────────────────── */
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  font-family: var(--font-body);
  background: var(--panel);
  border: 1.5px solid var(--border);
  color: var(--text);
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  width: 100%;
  transition: border-color 0.12s, box-shadow 0.12s;
  -webkit-appearance: none;
}
input[type="checkbox"], input[type="radio"] {
  width: auto;
  accent-color: var(--accent);
  cursor: pointer;
}
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 5px;
}
.field { margin-bottom: 14px; }
textarea { resize: vertical; min-height: 72px; }

select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237A8FA0' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }

/* ─── MODAL ───────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,25,35,0.5);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 28px;
  width: 500px;
  max-width: 92vw;
  max-height: 86vh;
  overflow-y: auto;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 18px;
  color: var(--text);
}
.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px;
  padding-top: 16px; border-top: 1px solid var(--border);
}
.hidden { display: none !important; }

/* ─── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  font-size: 13px;
}

/* ─── TOAST ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--text);
  color: #FFFFFF;
  border: none;
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 500;
  z-index: 100;
  box-shadow: var(--shadow-md);
  animation: toastSlide 0.2s ease-out;
}
@keyframes toastSlide { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ─── MISC ────────────────────────────────────────────────── */
.action-item-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.action-item-row:last-child { border-bottom: none; }

.priority-Haute   { color: var(--danger); font-weight: 600; }
.priority-High    { color: var(--danger); font-weight: 600; }
.priority-Moyenne { color: var(--warn); font-weight: 600; }
.priority-Medium  { color: var(--warn); font-weight: 600; }
.priority-Basse   { color: var(--text-muted); }
.priority-Low     { color: var(--text-muted); }

.flex-row     { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

.radar-wrap { display: flex; justify-content: center; }

.disabled-note {
  font-size: 12px;
  color: var(--text-secondary);
  background: #FFFBEB;
  border-left: 3px solid var(--warn);
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 10px;
}

/* ─── LOGIN PAGE ──────────────────────────────────────────── */
body.login-page {
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}
.login-brand .dot {
  width: 10px; height: 10px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent);
  display: inline-block;
  margin-right: 10px;
  vertical-align: middle;
}
