:root {
  --bg: #0b1020;
  --bg2: #101830;
  --bg3: #17203c;
  --line: #263253;
  --txt: #dbe4ff;
  --muted: #8b98c4;
  --accent: #6c8cff;
  --accent2: #8aa2ff;
  --ok: #2dd4a7;
  --warn: #f0b429;
  --err: #ff5d6b;
  --info: #4cc3ff;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background:
    radial-gradient(1100px 500px at 80% -10%, rgba(108,140,255,.12), transparent 60%),
    var(--bg);
  color: var(--txt);
  font-size: 14px;
}
a { color: var(--accent2); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- login / setup ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 16px; padding: 34px 32px; box-shadow: var(--shadow);
}
.auth-card .logo { text-align: center; margin-bottom: 22px; }
.auth-card .logo .mono {
  width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #5a3cff);
  display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 800;
}
.brand-t { font-size: 17px; font-weight: 700; letter-spacing: .3px; }
.brand-s { color: var(--muted); font-size: 12px; margin-top: 3px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .6px; }
input, textarea, select {
  width: 100%; background: var(--bg); color: var(--txt); border: 1px solid var(--line);
  border-radius: 9px; padding: 10px 12px; font-size: 14px; outline: none;
}
textarea { min-height: 90px; resize: vertical; font-family: ui-monospace, "Consolas", monospace; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
small.hint { color: var(--muted); font-size: 12px; }
.login-error { color: var(--err); font-size: 13px; margin-top: 4px; min-height: 18px; }
.center { text-align: center; }

/* ---------- layout ---------- */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; background: linear-gradient(180deg, var(--bg2), #0d1330);
  border-right: 1px solid var(--line); padding: 18px 12px; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.sidebar .mono { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg,var(--accent),#5a3cff); display:flex; align-items:center; justify-content:center; font-weight:800; flex-shrink:0;}
.sidebar .brand b { font-size: 14px; }
.sidebar .brand small { display:block; color: var(--muted); font-size: 10.5px; }
.menu { display: flex; flex-direction: column; gap: 2px; }
.menu .item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 9px;
  color: var(--muted); font-size: 13.5px; cursor: pointer; border: 0; background: none; width: 100%; text-align: left;
  transition: .15s;
}
.menu .item:hover { color: var(--txt); background: rgba(108,140,255,.08); }
.menu .item.active { color: #fff; background: linear-gradient(90deg, rgba(108,140,255,.22), rgba(108,140,255,.06)); border: 1px solid rgba(108,140,255,.3); }
.menu .item .ic { width: 18px; text-align: center; font-size: 15px; }
.sidebar .foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.sidebar .foot .user { padding: 8px 10px; font-size: 13px; }
.sidebar .foot .user .role { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  gap: 14px; padding: 0 24px; background: rgba(11,16,32,.6); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.topbar .crumb { font-weight: 700; font-size: 15px; }
.topbar .sp { flex: 1; }
.pill { padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing:.4px; }
.pill.ok { background: rgba(45,212,167,.15); color: var(--ok); }
.pill.warn { background: rgba(240,180,41,.15); color: var(--warn); }
.pill.err { background: rgba(255,93,107,.16); color: var(--err); }
.pill.info { background: rgba(76,195,255,.14); color: var(--info); }
.pill.mut { background: var(--bg3); color: var(--muted); }
.content { padding: 24px; flex: 1; }
.page-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }

/* ---------- cards / grids ---------- */
.grid { display: grid; gap: 16px; }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.card {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.card.hover:hover { border-color: rgba(108,140,255,.45); transform: translateY(-1px); transition:.15s; }
.kpi .k-title { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing:.7px; }
.kpi .k-num { font-size: 30px; font-weight: 800; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 12px; color: var(--muted); }
.kpi .k-ic { float: right; font-size: 22px; opacity: .7; }
.section { margin-top: 22px; }
.section h3 { font-size: 14px; margin-bottom: 12px; color: var(--txt); display:flex; align-items:center; gap:8px;}
.hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing:.7px; padding: 9px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid rgba(38,50,83,.5); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.rowlink { cursor: pointer; }
tr.rowlink:hover td { background: rgba(108,140,255,.06); }
.mono { font-family: ui-monospace, "Consolas", monospace; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.err { background: var(--err); box-shadow: 0 0 8px var(--err); }
.dot.warn { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.dot.mut { background: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line);
  background: var(--bg3); color: var(--txt); border-radius: 9px; padding: 8px 14px; font-size: 13px; font-weight: 600;
  transition: .15s;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #5a3cff); border: 0; color:#fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { border-color: rgba(255,93,107,.5); color: var(--err); background: rgba(255,93,107,.08); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btnrow { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }

/* ---------- modal ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(5,8,18,.7); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 16px;
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow);
  padding: 24px;
}
.modal.wide { max-width: 760px; }
.modal h3 { margin-bottom: 16px; font-size: 16px; }

/* ---------- toast ---------- */
.toasts { position: fixed; top: 68px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.toast {
  background: var(--bg3); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); font-size: 13px;
  animation: slidein .25s ease;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
.toast.warn { border-left-color: var(--warn); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }

/* ---------- editor ---------- */
.editor-wrap { display: flex; gap: 14px; }
.editor-nav { width: 280px; flex-shrink: 0; max-height: 78vh; overflow-y: auto; background: var(--bg2); border:1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.editor-main { flex: 1; min-width: 0; }
.file-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; border-radius: 7px; cursor: pointer; }
.file-row:hover { background: rgba(108,140,255,.08); }
.file-row .nm { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
textarea.code { min-height: 60vh; font-size: 13px; line-height: 1.55; background: #0a0e20; }

/* ---------- misc ---------- */
.crumbs { font-size: 12px; color: var(--muted); }
.flex { display: flex; gap: 10px; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 6px; background: var(--bg3); color: var(--muted); border: 1px solid var(--line); }
.chip { display:inline-flex; align-items:center; gap:6px; font-size:12px; padding:4px 10px; border-radius:999px; background:var(--bg3); border:1px solid var(--line); }
.empty { color: var(--muted); text-align: center; padding: 40px 10px; font-size: 13px; }
.issue { font-size: 12.5px; padding: 6px 10px; border-radius: 8px; margin-bottom: 6px; background: rgba(255,93,107,.08); border: 1px solid rgba(255,93,107,.3); }
.issue.good { background: rgba(45,212,167,.08); border-color: rgba(45,212,167,.3); }
.qr-box svg { width: 190px; height: 190px; }
.secret-box { background: var(--bg); border: 1px dashed var(--line); border-radius: 9px; padding: 10px 12px; font-family: ui-monospace, monospace; font-size: 12px; word-break: break-all; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display:inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.nowrap { white-space: nowrap; }
@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 60; transform: translateX(-101%); transition:.2s; }
  .sidebar.open { transform: none; }
  .editor-wrap { flex-direction: column; }
  .editor-nav { width: 100%; max-height: 220px; }
}/* --- Tabs serveur Windows --- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs .tab {
  background: var(--panel2, #181c2c); color: var(--mut, #8b98c4);
  border: 1px solid var(--line, #232942); border-radius: 10px;
  padding: 8px 14px; cursor: pointer; font-size: 13px;
}
.tabs .tab:hover { border-color: var(--acc, #6c8cff); color: var(--fg, #dfe6ff); }
.tabs .tab.active { background: var(--acc, #6c8cff); color: #0b0e1a; border-color: var(--acc, #6c8cff); font-weight: 700; }
.btn.tiny { padding: 3px 8px; font-size: 11px; border-radius: 6px; }
.btn.tiny.err { background: var(--err, #ff5d5d); color: #fff; }
td.mono a { color: var(--acc, #6c8cff); text-decoration: none; }
td.mono a:hover { text-decoration: underline; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--acc, #6c8cff); }
