/* ============================================================
   SC Hub - feuille de style unique
   Palette sombre : l'outil est consulte en second ecran pendant
   une session de jeu, un fond clair y est agressif.
   ============================================================ */

:root {
  --bg:          #0b0f14;
  --bg-panel:    #121821;
  --bg-raised:   #18202b;
  --bg-hover:    #1e2835;
  --border:      #232e3d;
  --border-soft: #1a222e;

  --text:        #e6edf5;
  --text-dim:    #92a2b6;
  --text-faint:  #62748c;

  --accent:      #4ea8ff;
  --accent-dim:  #1d4f7f;
  --good:        #46d39a;
  --warn:        #f2b544;
  --bad:         #ff6b6b;
  --illegal:     #c678dd;

  --radius:      8px;
  --radius-sm:   5px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted  { color: var(--text-dim); }
.faint  { color: var(--text-faint); }
.mono   { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.good   { color: var(--good); }
.warn   { color: var(--warn); }
.bad    { color: var(--bad); }
.right  { text-align: right; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Ecran de chargement et connexion ---------- */

.boot {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  color: var(--text-dim);
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-card h1 { margin: 12px 0 0; font-size: 24px; text-align: center; }
.login-card > .muted { text-align: center; margin: 0 0 18px; }
.login-card label { margin-top: 12px; font-size: 12px; color: var(--text-dim); }
.login-card .btn { margin-top: 20px; }

.brand-mark {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  position: relative;
  flex: none;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .55;
}
.brand-mark-lg { width: 34px; height: 34px; margin: 0 auto; }

/* ---------- Barre superieure ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 0 20px;
  height: 52px;
  background: rgba(11, 15, 20, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex; align-items: center; gap: 9px;
  color: var(--text); font-weight: 600; letter-spacing: .02em;
}
.brand:hover { text-decoration: none; }

.nav { display: flex; gap: 2px; flex: 1; }
.nav a {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-weight: 500;
}
.nav a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-dim); color: #fff; }

.topbar-end { display: flex; align-items: center; gap: 14px; }

.sync-chip {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--text-dim);
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 20px;
}
.sync-chip:hover { text-decoration: none; background: var(--bg-hover); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); flex: none; }
.dot.ok    { background: var(--good); }
.dot.stale { background: var(--warn); }
.dot.error { background: var(--bad); }

.user-chip { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-dim); }

/* ---------- Mise en page ---------- */

.view { padding: 22px 20px 60px; max-width: 1500px; margin: 0 auto; }

.page-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-head h1 { margin: 0; font-size: 20px; font-weight: 600; }
.page-head p  { margin: 4px 0 0; }

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.panel h2 { margin: 0 0 12px; font-size: 14px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* ---------- Formulaires ---------- */

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }

input, select, textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 7px 10px;
  font: inherit;
  min-width: 0;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(78, 168, 255, .18);
}
input[type="checkbox"] { min-width: auto; accent-color: var(--accent); }

.check { display: flex; align-items: center; gap: 7px; font-size: 13px; padding-bottom: 7px; }

.btn {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 7px 14px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); border-color: #2e3d50; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent-dim); border-color: var(--accent-dim); color: #fff; }
.btn-primary:hover { background: #2a659d; border-color: #2a659d; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-danger:hover { border-color: var(--bad); color: var(--bad); }

/* ---------- Tableaux ---------- */

.table-wrap { overflow-x: auto; border-radius: var(--radius); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  position: sticky; top: 52px;
  background: var(--bg-raised);
  text-align: left;
  padding: 9px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--text); }
tbody td { padding: 9px 12px; border-bottom: 1px solid var(--border-soft); }
tbody tr:hover { background: var(--bg-hover); }
tbody tr.clickable { cursor: pointer; }

/* ---------- Indicateurs ---------- */

.stat {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 15px;
}
.stat-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 21px; font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat-sub   { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 11px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.tag-illegal { color: var(--illegal); border-color: var(--illegal); }
.tag-good    { color: var(--good); border-color: var(--good); }
.tag-warn    { color: var(--warn); border-color: var(--warn); }

.bar { height: 4px; background: var(--bg); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.bar > span.good { background: var(--good); }
.bar > span.bad  { background: var(--bad); }

/* ---------- Messages ---------- */

.empty  { padding: 44px 20px; text-align: center; color: var(--text-dim); }
.error  { color: var(--bad); font-size: 13px; }
.notice {
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--warn);
  background: rgba(242, 181, 68, .08);
  color: var(--warn);
  font-size: 13px;
  margin-bottom: 12px;
}
.notice-bad { border-color: var(--bad); background: rgba(255, 107, 107, .08); color: var(--bad); }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 18px;
  z-index: 100;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .5);
}
.toast.bad { border-color: var(--bad); color: var(--bad); }

/* ---------- Editeur de loadout ---------- */

.loadout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .loadout { grid-template-columns: 1fr; } }

.hardpoint {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(180px, 1.4fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-soft);
}
.hardpoint:last-child { border-bottom: none; }
.hardpoint-name { font-size: 13px; }
.hardpoint-meta { font-size: 11px; color: var(--text-faint); }
.hardpoint select { width: 100%; }

.summary { position: sticky; top: 68px; }
.summary-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.summary-row:last-child { border-bottom: none; }
.summary-row .mono { font-weight: 600; }

@media (max-width: 720px) {
  .topbar { gap: 12px; padding: 0 12px; }
  .brand-text { display: none; }
  .nav { overflow-x: auto; }
  .user-chip span { display: none; }
  .view { padding: 16px 12px 48px; }
  thead th { top: 0; }
}
