/* GD Portal — feuille de style du shell.
   Les modules héritent de ces variables : n'écris pas de couleurs en dur dans
   un template de module, réutilise --ink, --bg, --line, --accent. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #16181d;
  --ink-soft: #5c6270;
  --line: #e3e6ea;
  --accent: #2f5cff;
  --accent-ink: #ffffff;
  --up: #0a8f52;
  --down: #d02f3a;
  --radius: 10px;
  --sidebar-w: 232px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1c1f25;
    --ink: #e9ecf1;
    --ink-soft: #969db0;
    --line: #2b303a;
    --accent: #6d8dff;
    --accent-ink: #0f1115;
    --up: #35c07f;
    --down: #ff6b74;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

.muted { color: var(--ink-soft); }

/* ---------- Shell ---------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  font-weight: 650;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  padding: 0 10px;
}
.brand span { color: var(--accent); }
.brand-lg { font-size: 22px; text-align: center; padding: 0 0 8px; }

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
}
.nav-item:hover { background: var(--bg); color: var(--ink); }
.nav-item.is-active { background: var(--accent); color: var(--accent-ink); font-weight: 550; }
.nav-icon { width: 18px; text-align: center; opacity: 0.85; }

.user {
  margin-top: auto;
  padding: 12px 10px 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.user-name { font-size: 14px; font-weight: 550; }

.linkbtn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 13px;
  color: var(--ink-soft);
  text-align: left;
  cursor: pointer;
}
.linkbtn:hover { color: var(--down); text-decoration: underline; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.topbar h1 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.actions { display: flex; gap: 8px; }

.page { padding: 28px; flex: 1; }

/* ---------- Catalogue ---------- */

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

.tile {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.12s, transform 0.12s;
}
.tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.tile-icon { font-size: 22px; line-height: 1; margin-bottom: 4px; }
.tile-title { font-weight: 600; }
.tile-desc { font-size: 13px; color: var(--ink-soft); }

.empty {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 36px;
  text-align: center;
}
.empty p { margin: 0 0 6px; }

/* ---------- Login ---------- */

body.centered {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.card label { font-size: 13px; font-weight: 550; margin-top: 10px; }

.card input {
  font: inherit;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  color: var(--ink);
}
.card input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.btn {
  margin-top: 18px;
  padding: 10px;
  font: inherit;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }

.alert {
  margin: 8px 0 0;
  padding: 9px 11px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--down);
  background: color-mix(in srgb, var(--down) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--down) 35%, transparent);
}

/* ---------- Indicateurs partagés (repris de pbreport) ---------- */

.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--ink-soft); }

/* ---------- Mobile ---------- */

@media (max-width: 720px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex: none;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    overflow-x: auto;
  }
  .nav { flex-direction: row; }
  .nav-item { white-space: nowrap; }
  .user { margin: 0 0 0 auto; border-top: 0; padding: 0; }
  .page, .topbar { padding: 16px; }
}
