:root {
  --bg: #0f1720;
  --panel: #16212e;
  --me: #2b6cb0;
  --hedo: #1f2d3a;
  --text: #e7edf3;
  --muted: #8aa0b3;
  --accent: #ff8a5b;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--panel);
  border-bottom: 1px solid #223140;
  padding-top: calc(12px + env(safe-area-inset-top));
}
.logo { font-weight: 700; font-size: 18px; }
.who button {
  background: transparent;
  color: var(--muted);
  border: 1px solid #2c3d4e;
  padding: 5px 12px;
  border-radius: 999px;
  margin-left: 6px;
  cursor: pointer;
  font-size: 14px;
}
.who button.active { background: var(--accent); color: #1a1206; border-color: var(--accent); font-weight: 600; }
.who-pill {
  color: var(--muted);
  border: 1px solid #2c3d4e;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 14px;
}
.logout { color: var(--muted); font-size: 13px; margin-left: 10px; text-decoration: none; }
.logout:hover { color: var(--text); }
.logo-link { color: inherit; text-decoration: none; }

/* Notes d'Hedo (/notes) */
.notes-main { max-width: 760px; width: 100%; margin: 0 auto; }
.notes-intro { color: var(--muted); font-size: 14px; }
.back-link { color: var(--muted); font-size: 14px; text-decoration: none; }
.back-link:hover { color: var(--text); }
.note-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--panel);
  border: 1px solid #223140;
  border-radius: 12px;
  padding: 12px 14px;
  text-decoration: none;
  color: var(--text);
}
.note-card:hover { border-color: var(--accent); }
.note-title { font-weight: 600; }
.note-meta { color: var(--muted); font-size: 13px; }
.note-body { line-height: 1.65; }
.note-body h1 { font-size: 24px; line-height: 1.3; }
.note-body h2 { font-size: 19px; margin-top: 28px; border-bottom: 1px solid #223140; padding-bottom: 6px; }
.note-body a { color: var(--accent); }
.note-body blockquote {
  margin: 12px 0;
  padding: 8px 14px;
  border-left: 3px solid var(--accent);
  background: var(--panel);
  border-radius: 0 8px 8px 0;
  color: var(--muted);
}
.note-body hr { border: none; border-top: 1px solid #223140; margin: 24px 0; }
.note-body table { border-collapse: collapse; display: block; overflow-x: auto; font-size: 14px; }
.note-body th, .note-body td { border: 1px solid #2c3d4e; padding: 6px 10px; text-align: left; }
.note-body th { background: var(--panel); }
.note-body code { background: #0c141d; padding: 1px 5px; border-radius: 5px; font-size: 14px; }

.login-body {
  background: radial-gradient(ellipse at top, #1a2735 0%, var(--bg) 65%);
}
.login-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: 100%;
  max-width: 560px;
  background: var(--panel);
  border: 1px solid #223140;
  border-radius: 24px;
  padding: 40px 28px;
  box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
}
.login-logo { font-size: 24px; }
.login-sub { color: var(--muted); font-size: 14px; margin: 0; text-align: center; min-height: 1.2em; }
.login-error { color: var(--accent); font-size: 14px; margin: 0; text-align: center; }

/* Trois portraits homogènes, ronds, même taille — le point focal de la page */
.portrait-row {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
}
.portrait {
  background: transparent;
  border: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.portrait-frame {
  display: block;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid #2c3d4e;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 22%;
  display: block;
}
.portrait:hover .portrait-frame { transform: translateY(-3px); border-color: #3d5266; }
.portrait.active .portrait-frame { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(255, 138, 91, 0.18); }
.portrait.active .portrait-name { color: var(--text); font-weight: 600; }

.login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 320px;
}
/* [hidden] doit gagner sur le display:flex ci-dessus (même spécificité sinon) */
.login-form[hidden] { display: none; }
.login-form input[type="password"] {
  background: #0c141d;
  color: var(--text);
  border: 1px solid #2c3d4e;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
}
.login-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}
.login-form button {
  background: var(--accent);
  color: #1a1206;
  border: none;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* Mon CV (/cv, Mateo) */
.cv-main { max-width: 760px; width: 100%; margin: 0 auto; padding-bottom: 40px; }
.cv-identity { display: flex; align-items: center; gap: 18px; margin-bottom: 8px; }
.cv-photo { width: 84px; height: 84px; border-radius: 14px; object-fit: cover; }
.cv-identity h1 { margin: 0; font-size: 22px; }
.cv-title { margin: 2px 0 0; color: var(--accent); font-size: 14px; }
.cv-subtitle { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.cv-flash { color: #7ee787; font-size: 14px; }
.cv-section { margin-top: 22px; }
.cv-section h2 { font-size: 16px; border-bottom: 1px solid #223140; padding-bottom: 6px; }
.cv-item {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 0;
  border-bottom: 1px solid #1a2530;
  font-size: 14px;
}
.cv-field:not(:first-child) { color: var(--muted); }
.cv-form { display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.cv-form label { color: var(--muted); font-size: 13px; margin-top: 4px; }
.cv-form select, .cv-form input[type="text"] {
  background: #0c141d;
  color: var(--text);
  border: 1px solid #2c3d4e;
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
}
.cv-form button {
  align-self: flex-start;
  margin-top: 8px;
  background: var(--accent);
  color: #1a1206;
  border: none;
  border-radius: 10px;
  padding: 8px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

main {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg { display: flex; flex-direction: column; max-width: 88%; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.hedo { align-self: flex-start; }
.bubble {
  padding: 10px 14px;
  border-radius: 16px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg.me .bubble { background: var(--me); border-bottom-right-radius: 4px; }
.msg.hedo .bubble { background: var(--hedo); border-bottom-left-radius: 4px; }
.bubble.typing::after { content: "▋"; animation: blink 1s steps(2) infinite; color: var(--muted); }
@keyframes blink { 50% { opacity: 0; } }
.sources { font-size: 12px; color: var(--muted); margin-top: 4px; padding: 0 6px; }

form {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: var(--panel);
  border-top: 1px solid #223140;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
textarea {
  flex: 1;
  resize: none;
  background: #0c141d;
  color: var(--text);
  border: 1px solid #2c3d4e;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  max-height: 160px;
}
#send {
  background: var(--accent);
  color: #1a1206;
  border: none;
  border-radius: 12px;
  width: 46px;
  font-size: 20px;
  cursor: pointer;
}
#send:active { transform: scale(0.96); }
