:root {
  --background: #ffffff;
  --surface: #fafafa;
  --sidebar: #fafafa;
  --foreground: #171717;
  --muted: #71717a;
  --border: #e4e4e7;
  --border-soft: rgba(228, 228, 231, .7);
  --accent: #f59e0b;
  --accent-soft: rgba(245, 158, 11, .12);
  --emerald: #10b981;
  --sky: #0ea5e9;
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, .13);
  --emerald-soft: rgba(16, 185, 129, .16);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --background: #0a0a0a;
    --surface: #141414;
    --sidebar: #111111;
    --foreground: #ededed;
    --muted: #a1a1aa;
    --border: #27272a;
    --border-soft: rgba(39, 39, 42, .8);
    --accent-soft: rgba(245, 158, 11, .14);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, .15);
    --emerald-soft: rgba(16, 185, 129, .18);
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { color-scheme: light dark; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: "Geist", ui-sans-serif, system-ui, Arial, sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
.mono { font-family: "Geist Mono", ui-monospace, SFMono-Regular, monospace; }
[hidden] { display: none !important; }

.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 22px;
  padding: 16px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
@media (max-width: 767px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 60;
    max-width: 82vw; transform: translateX(-100%);
    transition: transform .18s ease;
  }
  .sidebar.open { transform: translateX(0); }
}
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 8px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.brand-name { font-family: "Geist Mono", monospace; font-size: 12.5px; line-height: 1.35; }
.brand-name b { font-weight: 600; display: block; }
.brand-name span { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 7px;
  font-family: "Geist Mono", monospace; font-size: 12.5px;
  color: var(--muted); border: 0; background: none; text-decoration: none;
  width: 100%; text-align: left; cursor: pointer;
}
.nav-item i { width: 16px; text-align: center; font-size: 13px; }
.nav-item:hover { background: var(--border-soft); color: var(--foreground); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item.active:hover { color: var(--accent); }
.hamburger {
  display: none; position: fixed; top: 12px; left: 12px; z-index: 40;
  width: 36px; height: 36px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  align-items: center; justify-content: center;
}
@media (max-width: 767px) { .hamburger { display: flex; } }
.backdrop { display: none; position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.4); }
.backdrop.open { display: block; }

.main { min-width: 0; flex: 1; }
.content { padding: 24px 28px 56px; }
@media (max-width: 767px) { .content { padding: 72px 16px 40px; } }
.page-head { margin-bottom: 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-family: "Geist Mono", monospace; font-size: 17px; margin: 0 0 3px; font-weight: 600; }
.page-head p { font-size: 12.5px; color: var(--muted); margin: 0; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
@media (max-width: 720px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi {
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); padding: 14px 16px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 6px;
}
.kpi .top { display: flex; align-items: center; justify-content: space-between; }
.kpi .label { font-family: "Geist Mono", monospace; font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.kpi .top i { color: var(--accent); font-size: 13px; }
.kpi .value { font-family: "Geist Mono", monospace; font-size: 24px; font-variant-numeric: tabular-nums; }
.kpi .foot { font-size: 11px; color: var(--muted); }

.panel { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); margin-bottom: 18px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border-soft); flex-wrap: wrap; }
.panel-head h2 { font-family: "Geist Mono", monospace; font-size: 12.5px; margin: 0; font-weight: 600; }
.panel-head .hint { font-size: 11px; color: var(--muted); }
.panel-body { padding: 14px 16px; }
.grid2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; align-items: start; margin-bottom: 18px; }
@media (max-width: 980px) { .grid2 { grid-template-columns: 1fr; } }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-family: "Geist Mono", monospace; font-size: 12px; }
th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 500; padding: 0 10px 8px; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td { padding: 8px 10px; border-top: 1px solid var(--border-soft); }
tr:first-child td { border-top: 0; }
tr.late td { background: var(--danger-soft); }
.empty-row td { text-align: center; padding: 24px 10px; color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-family: "Geist Mono", monospace; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  background: var(--border-soft); color: var(--muted); white-space: nowrap;
}
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.success { background: var(--emerald-soft); color: var(--emerald); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); border-radius: 7px;
  padding: 6px 11px; font-family: "Geist Mono", monospace; font-size: 11.5px;
  background: none; color: var(--foreground); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--border-soft); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.success { border-color: var(--emerald); color: var(--emerald); }
.btn.success:hover { background: var(--emerald-soft); }
.btn.accent { border-color: var(--accent); color: var(--accent); }
.btn.accent:hover { background: var(--accent-soft); }
.btn.small { padding: 4px 9px; font-size: 11px; }
.btn:disabled { opacity: .4; cursor: default; }

.field {
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--background); padding: 7px 10px;
  font-family: "Geist Mono", monospace; font-size: 12px; color: var(--foreground);
  outline: none;
}
.field:focus { border-color: var(--accent); }
select.field { cursor: pointer; }

.toolbar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar .field { flex: 1; max-width: 320px; min-width: 180px; }
.alert {
  padding: 8px 12px; border-radius: 7px; margin-bottom: 12px;
  font-family: "Geist Mono", monospace; font-size: 12px;
  border: 1px solid var(--border);
}
.alert.danger { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.alert.success { border-color: var(--emerald); color: var(--emerald); background: var(--emerald-soft); }

.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; font-family: "Geist Mono", monospace; font-size: 11.5px; }
.pagination .info { color: var(--muted); }

.modal-backdrop {
  display: none; position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,.4); align-items: flex-start; justify-content: center;
  overflow-y: auto; padding: 8vh 16px 16px;
}
.modal-backdrop.open { display: flex; }
.modal { width: 100%; max-width: 480px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border-soft); }
.modal-head h2 { font-family: "Geist Mono", monospace; font-size: 12.5px; margin: 0; font-weight: 600; }
.modal-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.modal-body label { font-family: "Geist Mono", monospace; font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); display: flex; flex-direction: column; gap: 5px; }
.icon-btn { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 7px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--border-soft); color: var(--danger); }

/* Vue connexion */
.login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  width: 100%; max-width: 360px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); padding: 24px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 18px;
}
.login-brand { display: flex; align-items: center; gap: 10px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form label { font-family: "Geist Mono", monospace; font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); display: flex; flex-direction: column; gap: 5px; }
.login-hint { font-size: 11px; color: var(--muted); margin: 0; text-align: center; font-family: "Geist Mono", monospace; }
.btn.block { width: 100%; justify-content: center; }

.sidebar-user {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 8px; margin-top: auto;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.sidebar-user .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0;
}
.sidebar-user .user-meta { flex: 1; min-width: 0; line-height: 1.3; }
.sidebar-user .user-meta b { display: block; font-family: "Geist Mono", monospace; font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-meta span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }

/* Toasts (bonus) */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 10px 14px; border-radius: 8px; font-family: "Geist Mono", monospace; font-size: 12px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(0,0,0,.15);
  animation: toast-in .18s ease;
}
.toast.success { border-color: var(--emerald); color: var(--emerald); }
.toast.danger { border-color: var(--danger); color: var(--danger); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
