/* ==========================================================================
   J.A.R.V.I.S — interface HUD : fond sombre, panneaux de verre, accents cyan
   ========================================================================== */

:root {
  --bg: #05080f;
  --bg-2: #08101c;
  --surface: rgba(13, 22, 37, .72);
  --surface-solid: #0d1625;
  --surface-2: rgba(32, 52, 82, .38);
  --surface-3: rgba(46, 74, 112, .45);
  --border: rgba(120, 200, 255, .13);
  --border-strong: rgba(94, 231, 255, .38);
  --text: #e4f1ff;
  --text-soft: #b9cce4;
  --muted: #7f95b3;
  --accent: #5ee7ff;
  --accent-2: #4d7cff;
  --accent-soft: rgba(94, 231, 255, .1);
  --accent-text: #021018;
  --glow: 0 0 0 1px rgba(94, 231, 255, .35), 0 0 24px rgba(94, 231, 255, .18);
  --ok: #4ff0a8;
  --ok-soft: rgba(79, 240, 168, .1);
  --warn: #ffc65c;
  --warn-soft: rgba(255, 198, 92, .1);
  --danger: #ff6b81;
  --danger-soft: rgba(255, 107, 129, .1);
  --radius: 14px;
  --radius-sm: 9px;
  --font: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 12px 40px -18px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  font: 15px/1.6 var(--font);
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 85% -10%, rgba(77, 124, 255, .16), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(94, 231, 255, .09), transparent 55%),
    linear-gradient(rgba(94, 231, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(94, 231, 255, .035) 1px, transparent 1px);
  background-size: auto, auto, 48px 48px, 48px 48px;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(94, 231, 255, .3); color: #fff; }

a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: #a8f3ff; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1em; }

code, pre { font-family: var(--mono); font-size: .84em; }
code { background: var(--accent-soft); color: #bff6ff; padding: .12em .4em; border-radius: 6px; border: 1px solid rgba(94, 231, 255, .12); }
pre {
  background: rgba(2, 8, 16, .75); border: 1px solid var(--border); padding: 1em 1.1em;
  border-radius: var(--radius-sm); overflow-x: auto; margin: 0 0 1em; color: var(--text-soft);
}
pre code { background: none; padding: 0; border: 0; color: inherit; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Libellé « HUD » : petites capitales espacées */
.hud-label {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--accent);
  display: inline-flex; align-items: center; gap: .5rem;
}
.hud-label::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 10px var(--accent); animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Layout ------------------------------------------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(5, 8, 15, .72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(94, 231, 255, .55), transparent);
  opacity: .6;
}
.topbar .inner { display: flex; align-items: center; gap: 1rem; min-height: 62px; flex-wrap: wrap; }

.brand { display: flex; align-items: center; gap: .65rem; color: var(--text); font-weight: 600; }
.brand:hover { color: var(--text); }
.brand-name { font-family: var(--mono); letter-spacing: .28em; font-size: .9rem; font-weight: 500; }
.reactor { width: 30px; height: 30px; color: var(--accent); filter: drop-shadow(0 0 6px rgba(94, 231, 255, .55)); flex-shrink: 0; }
.reactor-ring { transform-origin: 24px 24px; animation: spin 18s linear infinite; }

.nav { display: flex; gap: .2rem; margin-left: auto; align-items: center; flex-wrap: wrap; }
.nav a, .nav button.link {
  color: var(--muted); padding: .45rem .8rem; border-radius: 999px; font-weight: 500; font-size: .9rem;
  border: 1px solid transparent; transition: all .15s;
}
.nav a:hover, .nav button.link:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.active { color: var(--accent); background: var(--accent-soft); border-color: rgba(94, 231, 255, .25); }
.nav form { margin: 0; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
main.container { padding-top: 2.25rem; padding-bottom: 4rem; animation: rise .35s ease-out; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.75rem; }
.page-head h1 { margin: .15rem 0 0; }
.page-head p { margin: .35rem 0 0; }
.page-head p.muted.small a { color: var(--muted); }
.page-head p.muted.small a:hover { color: var(--accent); }

.badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 1.4em; height: 1.4em; padding: 0 .4em;
  border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: .7rem; font-weight: 700;
  margin-left: .35rem; box-shadow: 0 0 12px rgba(94, 231, 255, .6);
}

/* Cards ------------------------------------------------------------------ */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  margin-bottom: 1rem;
}
.card > :last-child { margin-bottom: 0; }
.card h2 { font-size: 1.05rem; }

/* Coins de visée façon HUD */
.card.hud::before, .card.hud::after {
  content: ""; position: absolute; width: 14px; height: 14px; border: 1.5px solid var(--accent); opacity: .7; pointer-events: none;
}
.card.hud::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; border-top-left-radius: var(--radius); }
.card.hud::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; border-bottom-right-radius: var(--radius); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.grid .card { margin: 0; display: flex; flex-direction: column; }

.project-card { transition: border-color .2s, box-shadow .2s, transform .2s; }
.project-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow), var(--glow); transform: translateY(-2px); }
.project-card h2 { margin-bottom: .3rem; font-size: 1.15rem; }
.project-card h2 a { color: var(--text); }
.project-card h2 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.project-card .card-actions { position: relative; z-index: 1; }
.project-card .desc { color: var(--muted); flex: 1; font-size: .92rem; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: 1rem 0; }
.stats span {
  display: flex; flex-direction: column; gap: .1rem; padding: .55rem .65rem; border-radius: var(--radius-sm);
  background: rgba(2, 8, 16, .45); border: 1px solid var(--border); font-size: .72rem; color: var(--muted);
  font-family: var(--mono); letter-spacing: .04em; text-transform: uppercase;
}
.stats strong { color: var(--text); font-family: var(--font); font-size: 1.25rem; font-weight: 600; letter-spacing: 0; }

.card-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: auto; }
.empty { text-align: center; padding: 3.5rem 1rem; color: var(--muted); }
.empty h2 { color: var(--text); font-size: 1.25rem; }

/* Bandeau d'accueil du tableau de bord */
.greeting { margin-bottom: 2rem; }
.greeting h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: .4rem 0 .3rem; }
.greeting h1 .name { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.status-line { font-family: var(--mono); font-size: .8rem; color: var(--muted); display: flex; gap: .3rem 1.25rem; flex-wrap: wrap; }
.status-line b { color: var(--text-soft); font-weight: 500; }

/* Tabs -------------------------------------------------------------------- */
.tabs {
  display: flex; gap: .25rem; margin-bottom: 1.5rem; overflow-x: auto; padding: .3rem;
  background: rgba(2, 8, 16, .5); border: 1px solid var(--border); border-radius: 999px; width: fit-content; max-width: 100%;
}
.tabs a { padding: .45rem 1rem; color: var(--muted); font-weight: 500; border-radius: 999px; white-space: nowrap; font-size: .9rem; transition: all .15s; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent-text); background: linear-gradient(135deg, var(--accent), #7fb2ff); box-shadow: 0 0 18px rgba(94, 231, 255, .35); }
.tabs .count { font-size: .7rem; background: rgba(255, 255, 255, .08); padding: .05rem .45rem; border-radius: 999px; margin-left: .35rem; font-family: var(--mono); }
.tabs a.active .count { background: rgba(2, 16, 24, .18); }

.filters { display: flex; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filters a {
  padding: .3rem .85rem; border-radius: 999px; border: 1px solid var(--border); color: var(--muted);
  font-size: .82rem; background: rgba(2, 8, 16, .4);
}
.filters a.active { background: var(--accent-soft); color: var(--accent); border-color: rgba(94, 231, 255, .35); }
.filters a:hover { text-decoration: none; color: var(--text); }

/* Forms ----------------------------------------------------------------- */
label { display: block; font-weight: 500; font-size: .85rem; margin-bottom: .4rem; color: var(--text-soft); }
.field { margin-bottom: 1.1rem; }
.hint { font-weight: 400; color: var(--muted); font-size: .8rem; margin-top: .3rem; }

input[type=text], input[type=email], input[type=password], input[type=search], textarea, select {
  width: 100%; padding: .65rem .8rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: rgba(2, 8, 16, .6); color: var(--text); font: inherit; transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #566a86; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--border-strong); box-shadow: 0 0 0 3px rgba(94, 231, 255, .14);
}
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
textarea { min-height: 96px; resize: vertical; }
input[type=file] { font: inherit; max-width: 100%; color: var(--muted); }
input[type=file]::file-selector-button {
  font: inherit; font-size: .85rem; margin-right: .75rem; padding: .45rem .9rem; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--accent-soft); color: var(--accent); cursor: pointer;
}
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.checkbox { display: flex; gap: .55rem; align-items: center; font-weight: 400; margin-bottom: .45rem; color: var(--text); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 720px) { .row { grid-template-columns: 1fr !important; } }

.btn, button {
  display: inline-flex; align-items: center; gap: .45rem; justify-content: center;
  padding: .55rem 1.05rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; font-weight: 500; font-size: .88rem;
  cursor: pointer; white-space: nowrap; transition: all .15s;
}
.btn:hover, button:hover { background: var(--surface-3); border-color: var(--border-strong); color: var(--text); text-decoration: none; }
.btn.primary, button.primary {
  background: linear-gradient(135deg, var(--accent), #7fb2ff); border-color: transparent; color: var(--accent-text); font-weight: 600;
  box-shadow: 0 0 0 1px rgba(94, 231, 255, .25), 0 6px 22px -6px rgba(94, 231, 255, .55);
}
.btn.primary:hover, button.primary:hover { filter: brightness(1.08); box-shadow: 0 0 0 1px rgba(94, 231, 255, .4), 0 8px 28px -6px rgba(94, 231, 255, .75); color: var(--accent-text); }
.btn.danger, button.danger { color: var(--danger); border-color: rgba(255, 107, 129, .25); background: var(--danger-soft); }
.btn.danger:hover, button.danger:hover { border-color: var(--danger); color: #ffd0d8; }
.btn.small, button.small { padding: .3rem .7rem; font-size: .78rem; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 500; }
button.link:hover { background: none; text-decoration: none; color: #a8f3ff; }
button:disabled { opacity: .5; cursor: default; }
form.inline { display: inline; margin: 0; }

.alert { padding: .8rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border: 1px solid; font-size: .92rem; }
.alert.error { background: var(--danger-soft); color: #ffc2cc; border-color: rgba(255, 107, 129, .35); }
.alert.ok { background: var(--ok-soft); color: #c6ffe5; border-color: rgba(79, 240, 168, .3); }
.alert.info { background: var(--accent-soft); color: var(--text); border-color: rgba(94, 231, 255, .3); }
.alert p { margin-bottom: .5rem; }

/* Pills ------------------------------------------------------------------ */
.pill {
  display: inline-flex; align-items: center; gap: .35rem; padding: .12rem .6rem; border-radius: 999px;
  font-family: var(--mono); font-size: .68rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase;
  background: rgba(255, 255, 255, .05); color: var(--muted); border: 1px solid rgba(255, 255, 255, .08);
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill.success, .pill.done, .pill.used { background: var(--ok-soft); color: var(--ok); border-color: rgba(79, 240, 168, .25); }
.pill.failed, .pill.rejected { background: var(--danger-soft); color: var(--danger); border-color: rgba(255, 107, 129, .25); }
.pill.building, .pill.queued, .pill.in_progress, .pill.planned { background: var(--warn-soft); color: var(--warn); border-color: rgba(255, 198, 92, .25); }
.pill.building::before, .pill.queued::before { animation: pulse 1s ease-in-out infinite; }
.pill.open, .pill.new { background: var(--accent-soft); color: var(--accent); border-color: rgba(94, 231, 255, .25); }

/* Tables ------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .7rem .55rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; font-family: var(--mono); }
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(94, 231, 255, .03); }
tr:last-child td { border-bottom: 0; }

/* Feedback items ---------------------------------------------------------- */
.item { display: flex; gap: 1rem; }
.item + .item { border-top: 1px solid var(--border); padding-top: 1.1rem; margin-top: 1.1rem; }
.item .main { flex: 1; min-width: 0; }
.item .meta { font-size: .8rem; color: var(--muted); display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .45rem; }
.item .meta strong { color: var(--text-soft); }
.item .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.item .actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-top: .7rem; }
.item img.thumb { max-width: 240px; max-height: 170px; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; margin-top: .6rem; }
.replies { margin-top: .8rem; border-left: 2px solid rgba(94, 231, 255, .3); padding-left: .9rem; }
.reply { margin-bottom: .6rem; font-size: .92rem; }
.reply .who { font-weight: 600; color: var(--text-soft); }
.reply-form { display: flex; gap: .5rem; margin-top: .6rem; }
.reply-form input { flex: 1; }
.vote { display: flex; flex-direction: column; align-items: center; min-width: 56px; }
.vote button { flex-direction: column; gap: 0; padding: .45rem .7rem; line-height: 1.2; border-radius: var(--radius-sm); font-family: var(--mono); }
.vote button.voted { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); box-shadow: 0 0 14px rgba(94, 231, 255, .25); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }
.gallery .card { padding: 0; overflow: hidden; margin: 0; display: flex; flex-direction: column; transition: border-color .2s; }
.gallery .card:hover { border-color: var(--border-strong); }
.gallery .img {
  aspect-ratio: 4/3; background: rgba(2, 8, 16, .6) center/contain no-repeat; display: block;
  border-bottom: 1px solid var(--border);
}
.gallery .info { padding: .8rem; font-size: .84rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.gallery .info .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery .card.used { opacity: .55; }

/* Messages ------------------------------------------------------------------ */
.chat { display: flex; flex-direction: column; height: calc(100vh - 250px); min-height: 400px; padding: 0; overflow: hidden; }
.chat .messages { flex: 1; overflow-y: auto; padding: 1.4rem; display: flex; flex-direction: column; gap: .65rem; }
.msg { max-width: min(75%, 560px); padding: .6rem .95rem; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.mine { align-self: flex-end; background: linear-gradient(135deg, rgba(94, 231, 255, .9), rgba(127, 178, 255, .9)); color: var(--accent-text); border-color: transparent; border-bottom-right-radius: 4px; }
.msg.theirs { align-self: flex-start; border-bottom-left-radius: 4px; }
.msg .time { display: block; font-size: .68rem; opacity: .65; margin-top: .2rem; font-family: var(--mono); }
.chat form { display: flex; gap: .5rem; padding: .8rem; border-top: 1px solid var(--border); background: rgba(2, 8, 16, .5); }
.chat textarea { min-height: 46px; height: 46px; flex: 1; }
.inbox { padding: .4rem; }
.inbox a { display: flex; gap: 1rem; padding: .85rem; border-radius: var(--radius-sm); color: var(--text); align-items: center; transition: background .15s; }
.inbox a + a { margin-top: .15rem; }
.inbox a:hover { text-decoration: none; background: var(--surface-2); color: var(--text); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; flex-shrink: 0;
  background: radial-gradient(circle at 30% 30%, rgba(94, 231, 255, .35), rgba(77, 124, 255, .15)); color: var(--accent);
  border: 1px solid rgba(94, 231, 255, .35);
}
.inbox .preview { color: var(--muted); font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox .grow { flex: 1; min-width: 0; }

/* Auth pages ---------------------------------------------------------------- */
.auth { min-height: calc(100vh - 4rem); display: grid; place-items: center; padding: 16px; }
.auth .card { width: 100%; max-width: 420px; padding: 2.2rem 2rem; }
.brand-hero { flex-direction: column; gap: .5rem; margin-bottom: 1.8rem; text-align: center; }
.brand-hero .reactor { width: 76px; height: 76px; margin-bottom: .4rem; filter: drop-shadow(0 0 18px rgba(94, 231, 255, .6)); }
.brand-hero .brand-name { font-size: 1.15rem; letter-spacing: .4em; margin-right: -.4em; }
.brand-sub { font-family: var(--mono); font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.auth h2 { text-align: center; }

.copy { display: flex; gap: .5rem; }
.copy input { font-family: var(--mono); font-size: .82rem; }
.log { max-height: 70vh; white-space: pre-wrap; font-size: .8rem; color: #9fe9c9; }
.danger-zone { border-color: rgba(255, 107, 129, .25); }
.danger-zone h2 { color: var(--danger); }

.site-footer {
  color: var(--muted); font-size: .72rem; padding-bottom: 2rem; text-align: center;
  font-family: var(--mono); letter-spacing: .16em; text-transform: uppercase; opacity: .7;
}

ol, ul { padding-left: 1.25rem; }
li { margin-bottom: .3rem; }
li::marker { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 640px) {
  .topbar .inner { padding-top: .5rem; padding-bottom: .5rem; }
  .brand-name { display: none; }
  .topbar .inner { flex-wrap: nowrap; gap: .5rem; }
  .nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: 0; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a, .nav button.link { padding: .4rem .65rem; font-size: .85rem; }
  h1 { font-size: 1.5rem; }
  .card { padding: 1.1rem; }
}
