/* Parrainage SAMP - theme sombre */
:root {
  --bg: #0b0d12;
  --bg-2: #12151d;
  --panel: #161a24;
  --panel-2: #1c2130;
  --border: #262c3b;
  --border-soft: #1e2430;
  --text: #e7ebf3;
  --text-dim: #98a2b8;
  --text-mut: #6b7488;
  --accent: #7c5cff;
  --accent-2: #4da3ff;
  --accent-soft: rgba(124, 92, 255, .16);
  --green: #35c58a;
  --green-soft: rgba(53, 197, 138, .14);
  --amber: #f0a83c;
  --amber-soft: rgba(240, 168, 60, .14);
  --red: #f2555a;
  --red-soft: rgba(242, 85, 90, .14);
  --pink: #e46cc8;
  --radius: 12px;
  --shadow: 0 12px 34px -12px rgba(0, 0, 0, .55);
  font-synthesis-weight: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #171a2b 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; letter-spacing: .2px; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
small { color: var(--text-mut); }
hr { border: 0; border-top: 1px solid var(--border-soft); margin: 1.4rem 0; }

/* ---------- Layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  padding: 0 22px; height: 58px;
  background: rgba(11, 13, 18, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-logo {
  width: 36px; height: 36px; object-fit: contain; flex: none;
  background: #fff; border-radius: 50%; padding: 2px;
  box-shadow: 0 0 0 1px var(--border), 0 2px 6px rgba(0, 0, 0, .35);
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand-txt b { font-weight: 800; letter-spacing: .4px; font-size: .98rem; }
.brand-txt span { font-size: .7rem; color: var(--text-mut); }
.brand .logo {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 14px; font-weight: 800;
}
@media (max-width: 620px) { .brand-txt span { display: none; } }
.nav { display: flex; align-items: center; gap: 2px; flex: 1; flex-wrap: wrap; }
.nav a {
  color: var(--text-dim); padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: .92rem;
}
.nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.nav a.active { color: #fff; background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(124, 92, 255, .35); }
.usermenu { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.usermenu .who { text-align: right; line-height: 1.2; }
.usermenu .who b { display: block; font-size: .9rem; }
.usermenu .who span { font-size: .74rem; color: var(--text-mut); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 26px 22px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { color: var(--text-dim); font-size: .92rem; margin-top: 2px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Cards ---------- */
.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.card + .card { margin-top: 16px; }
.card h2 { display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } .nav { display: none; } }

/* ---------- Stat tiles ---------- */
.stat {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px;
}
.stat .n { font-size: 1.9rem; font-weight: 800; letter-spacing: .5px; }
.stat .l { color: var(--text-dim); font-size: .82rem; text-transform: uppercase; letter-spacing: .8px; }
.stat.accent { box-shadow: inset 0 0 0 1px rgba(124, 92, 255, .3); }
.stat.warn .n { color: var(--amber); }
.stat.danger .n { color: var(--red); }
.stat.ok .n { color: var(--green); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
th { background: var(--panel-2); color: var(--text-dim); font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .7px; position: sticky; top: 0; }
tbody tr:hover { background: rgba(255, 255, 255, .02); }
tbody tr:last-child td { border-bottom: 0; }
td.wrap-cell, th.wrap-cell { white-space: normal; min-width: 220px; }
.matricule { font-variant-numeric: tabular-nums; color: var(--text-dim); font-weight: 600; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; border: 1px solid transparent; white-space: nowrap;
}
.badge.grey { background: var(--panel-2); color: var(--text-dim); border-color: var(--border); }
.badge.violet { background: var(--accent-soft); color: #b7a4ff; border-color: rgba(124, 92, 255, .4); }
.badge.blue { background: rgba(77, 163, 255, .14); color: #9ccbff; border-color: rgba(77, 163, 255, .4); }
.badge.pink { background: rgba(228, 108, 200, .14); color: #f0a9df; border-color: rgba(228, 108, 200, .4); }
.badge.green { background: var(--green-soft); color: #7ce0bb; border-color: rgba(53, 197, 138, .4); }
.badge.amber { background: var(--amber-soft); color: #f4c684; border-color: rgba(240, 168, 60, .4); }
.badge.red { background: var(--red-soft); color: #f79a9d; border-color: rgba(242, 85, 90, .4); }

/* ---------- Progress ---------- */
.progress { position: relative; height: 8px; border-radius: 999px; background: var(--panel-2); overflow: hidden; min-width: 90px; }
.progress > i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.progress.full > i { background: linear-gradient(90deg, var(--green), #6ee7b7); }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .pct { font-variant-numeric: tabular-nums; font-size: .82rem; color: var(--text-dim); min-width: 38px; text-align: right; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 9px 15px; border-radius: 9px; font-size: .9rem; font-weight: 600;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  transition: transform .04s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { background: #232a3b; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #6b48ff); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--red-soft); border-color: rgba(242, 85, 90, .4); color: #f79a9d; }
.btn.danger:hover { background: rgba(242, 85, 90, .22); }
.btn.sm { padding: 6px 10px; font-size: .82rem; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.linklike { background: none; border: 0; color: var(--accent-2); cursor: pointer; font: inherit; padding: 0; }

/* ---------- Forms ---------- */
form .field { margin-bottom: 15px; }
label { display: block; font-size: .82rem; color: var(--text-dim); margin-bottom: 5px; font-weight: 600; letter-spacing: .3px; }
input[type=text], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 9px;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 84px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 18px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-2); cursor: pointer; margin-bottom: 8px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.check span { font-size: .9rem; color: var(--text); }
.hint { font-size: .8rem; color: var(--text-mut); margin-top: 4px; }

/* ---------- Flash ---------- */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; border: 1px solid var(--border); font-size: .92rem; }
.flash-success { background: var(--green-soft); border-color: rgba(53, 197, 138, .4); color: #b9f0d8; }
.flash-error { background: var(--red-soft); border-color: rgba(242, 85, 90, .4); color: #f8bcbe; }
.flash-info { background: rgba(77, 163, 255, .12); border-color: rgba(77, 163, 255, .4); color: #cfe4ff; }

/* ---------- Login ---------- */
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box { width: 100%; max-width: 380px; }
.login-logo {
  display: block; width: 116px; height: 116px; object-fit: contain; margin: 0 auto 14px;
  background: #fff; border-radius: 50%; padding: 8px;
  box-shadow: 0 0 0 1px var(--border), 0 10px 30px -8px rgba(0, 0, 0, .6);
}
.brand-title { text-align: center; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; font-size: 1.1rem; }
.login-box .tag { text-align: center; color: var(--text-mut); font-size: .85rem; margin-bottom: 22px; }
.login-box .card { padding: 24px; }

/* ---------- Misc ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: .92rem; }
.kv dt { color: var(--text-dim); }
.kv dd { margin: 0; }
.empty { text-align: center; color: var(--text-mut); padding: 34px 10px; }
.checklist-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (max-width: 640px) { .checklist-grid { grid-template-columns: 1fr; } }
.tickbox { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-2); cursor: pointer; user-select: none; }
.tickbox.done { background: var(--green-soft); border-color: rgba(53, 197, 138, .45); }
.tickbox input { width: 18px; height: 18px; accent-color: var(--green); }
.tickbox.locked { opacity: .6; cursor: not-allowed; }
.toast { position: fixed; right: 18px; bottom: 18px; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: .2s; z-index: 80; }
.toast.show { opacity: 1; transform: none; }
.toast.err { border-color: rgba(242, 85, 90, .5); color: #f8bcbe; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { padding: 7px 13px; border-radius: 999px; font-size: .85rem; color: var(--text-dim); border: 1px solid var(--border); }
.tabs a.active { background: var(--accent-soft); color: #fff; border-color: rgba(124, 92, 255, .5); }
.tabs a:hover { text-decoration: none; color: var(--text); }

.page-logo {
  width: 56px; height: 56px; object-fit: contain; flex: none;
  background: #fff; border-radius: 50%; padding: 4px;
  box-shadow: 0 0 0 1px var(--border);
}
.print-head { align-items: center; gap: 14px; margin-bottom: 18px; padding-bottom: 12px; border-bottom: 2px solid var(--border); }
.print-head img { width: 54px; height: 54px; object-fit: contain; }
.print-head b { display: block; font-size: 1.05rem; }
.print-head span { color: var(--text-dim); font-size: .85rem; }

@media print {
  .topbar, .toolbar, .no-print, .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border-color: #ccc; box-shadow: none; }
  a { color: #000; }
  .print-head { display: flex !important; border-color: #000; }
  .print-head span, .print-head b { color: #000; }
}
