:root{
  --bg:#0b1020;
  --card:#121a33;
  --muted:#a8b1d1;
  --text:#eef2ff;
  --primary:#7c5cff;
  --ok:#22c55e;
  --warn:#f59e0b;
  --bad:#ef4444;
  --border:rgba(255,255,255,.08);
}

*{box-sizing:border-box}
body{
  margin:0; font-family:system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: radial-gradient(1200px 600px at 10% 10%, rgba(124,92,255,.22), transparent 60%),
              radial-gradient(900px 500px at 90% 20%, rgba(34,197,94,.18), transparent 55%),
              var(--bg);
  color:var(--text);
}

.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 20px; border-bottom:1px solid var(--border);
  backdrop-filter: blur(10px);
  position:sticky; top:0; background: rgba(11,16,32,.75);
}

.brand{display:flex; gap:12px; align-items:center}
.logo{
  width:44px; height:44px; display:grid; place-items:center;
  background: rgba(124,92,255,.18);
  border:1px solid var(--border); border-radius:14px;
  font-size:22px;
}
.title{font-weight:800; letter-spacing:.2px}
.subtitle{font-size:12px; color:var(--muted)}
.right{display:flex; align-items:center; gap:10px; flex-wrap:wrap; justify-content: end;}
.chip{
  padding:8px 10px; border:1px solid var(--border);
  border-radius:999px; color:var(--muted); background:rgba(255,255,255,.03);
}

.container{max-width:1100px; margin:0 auto; padding:18px; height:100vh;}

.hero{
  padding:18px; border:1px solid var(--border); border-radius:18px;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
}

h1{margin:0 0 8px 0}
.muted{margin:0; color:var(--muted)}

.grid{
  display:grid; gap:14px; margin-top:14px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.card{
  border:1px solid var(--border);
  border-radius:18px;
  background: rgba(18,26,51,.72);
  box-shadow: 0 10px 40px rgba(0,0,0,.35);
}

.session{padding:14px; transition: transform .12s ease, border-color .12s ease}
.session:hover{transform: translateY(-2px); border-color: rgba(124,92,255,.35)}

.session-top{display:flex; justify-content:space-between; gap:10px; align-items:baseline}
.day{font-weight:800}
.time{color:var(--muted); font-size:13px}

.meter{
  margin:12px 0 10px;
  height:10px; border-radius:999px;
  background: rgba(255,255,255,.06);
  overflow:hidden; border:1px solid var(--border);
}
.bar{height:100%; border-radius:999px; background: linear-gradient(90deg, var(--primary), rgba(34,197,94,.9));}

.meta{display:flex; flex-wrap:wrap; gap:8px; margin-bottom:12px}
.pill{
  font-size:12px; padding:6px 10px; border-radius:999px;
  border:1px solid var(--border); background: rgba(255,255,255,.03);
  color:var(--muted);
}
.pill.ok{color: rgba(34,197,94,.95); border-color: rgba(34,197,94,.35)}
.pill.warn{color: rgba(245,158,11,.95); border-color: rgba(245,158,11,.35)}
.pill.danger{color: rgba(239,68,68,.95); border-color: rgba(239,68,68,.35)}

.actions{display:flex; gap:10px; align-items:center; flex-wrap:wrap}
.btn{
  cursor:pointer; border:none; border-radius:14px; padding:10px 12px;
  font-weight:700; color:var(--text); background: rgba(255,255,255,.06);
  border:1px solid var(--border);
  text-decoration:none;
}
.btn-primary{
  background: linear-gradient(135deg, rgba(124,92,255,.95), rgba(124,92,255,.55));
  border-color: rgba(124,92,255,.45);
}
.btn-ghost{background: rgba(255,255,255,.03)}
.btn-disabled{opacity:.55; cursor:not-allowed}

.toast{
  position: fixed; right: 16px; bottom: 16px;
  padding: 12px 14px; border-radius: 14px;
  border:1px solid var(--border);
  background: rgba(18,26,51,.85);
  opacity:0; transition: opacity .2s ease;
  max-width: 320px;
}
.toast.ok{border-color: rgba(34,197,94,.35)}
.toast.bad{border-color: rgba(239,68,68,.35)}
.alert{
  margin:10px 0; padding:10px 12px; border-radius:14px;
  border:1px solid rgba(239,68,68,.35);
  background: rgba(239,68,68,.08);
}
.auth{padding:18px; max-width:440px; margin:40px auto}
.form{display:flex; flex-direction:column; gap:8px}
input, select{
  padding:10px 12px; border-radius:14px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03); color:var(--text);
}
label{font-size:12px; color:var(--muted); margin-top:8px}

/* Week view */
.week-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap:14px;
  margin-top:14px;
}
.week-col{display:flex; flex-direction:column; gap:10px;}
.week-col-head{
  padding:12px 14px;
  border:1px solid var(--border);
  border-radius:18px;
  background: rgba(255,255,255,.03);
  font-weight:800;
}
.week-col-body{display:flex; flex-direction:column; gap:12px;}
@media (max-width: 900px){ .week-grid{grid-template-columns: 1fr;} }

/* Switch: Tir contrôlé */
.switch{
  display:flex; align-items:center; gap:10px;
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius:14px;
  background: rgba(255,255,255,.03);
  color: var(--muted);
  user-select:none;
}
.switch input{display:none}
.slider{
  width:44px; height:24px; border-radius:999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.06);
  position:relative;
}
.slider::after{
  content:"";
  width:18px; height:18px;
  border-radius:999px;
  position:absolute; top:50%; left:3px;
  transform: translateY(-50%);
  background: rgba(255,255,255,.75);
  transition: left .15s ease;
}
.switch input:checked + .slider{
  border-color: rgba(124,92,255,.45);
  background: rgba(124,92,255,.18);
}
.switch input:checked + .slider::after{ left:23px; background: rgba(255,255,255,.95); }
.switch-label{font-size:12px}

/* Modal */
.modal{
  position:fixed; inset:0;
  background: rgba(0,0,0,.55);
  display:grid; place-items:center;
  z-index:999;
}
.modal-card{
  width:min(520px, calc(100% - 24px));
  border:1px solid var(--border);
  border-radius:18px;
  background: rgba(18,26,51,.95);
  box-shadow: 0 30px 80px rgba(0,0,0,.55);
  padding:16px;
}
.burger{
  display:none;
  width:44px;height:40px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.08);
  border-radius:14px;
  cursor:pointer;
  padding:10px;
}
.burger span{
    display: block;
    height: 3px;
    width: 15px;
    background: var(--text);
    margin-bottom: 2px;
    border-radius: 2px;
}
.menu{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}

/* Mobile */
@media (max-width: 820px){
  .burger{ display:flex; align-items:center; justify-content:center; 
        flex-direction: column;}
  .menu{
    display:none;
    width:100%;
    margin-top:10px;
    padding-top:10px;
    border-top:1px solid var(--border);
  }
  .menu.open{ display:flex; }
}