/* Agent Mourad — thème sombre inspiré de Claude Code */
:root {
  --bg: #1f1e1d;         /* fond principal (clay sombre) */
  --panel: #262523;      /* panneaux */
  --panel2: #2f2e2b;     /* surfaces */
  --line: #3a3835;       /* bordures */
  --txt: #ececec;        /* texte */
  --muted: #a0998e;      /* texte secondaire */
  --accent: #d97757;     /* coral Claude */
  --accent2: #e8956f;
  --user: #2f2e2b;       /* bulle utilisateur */
  --tool: #c9a227;       /* outils */
  --err: #e5684b;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--txt); font-family: var(--sans); }
.hidden { display: none !important; }
button { font-family: inherit; }

/* ---------- Login ---------- */
.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-box { background: var(--panel); padding: 36px 32px; border-radius: 16px; width: 340px; max-width: 100%;
  text-align: center; border: 1px solid var(--line); }
.login-box .logo { font-size: 34px; color: var(--accent); }
.login-box h1 { margin: 6px 0 2px; font-size: 22px; }
.login-box p { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.login-box input { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--txt); margin-bottom: 12px; font-size: 15px; }
.login-box button { width: 100%; padding: 12px; border: 0; border-radius: 10px; background: var(--accent);
  color: #1f1e1d; font-weight: 600; font-size: 15px; cursor: pointer; }
.err { color: var(--err); margin-top: 10px; min-height: 18px; font-size: 14px; }

/* ---------- Layout ---------- */
.app { display: flex; height: 100%; }
.sidebar { width: 280px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 14px; gap: 12px; }
.brand { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.brand .logo { color: var(--accent); font-size: 18px; }
.new-btn { background: var(--panel2); color: var(--txt); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; cursor: pointer; font-size: 14px; }
.new-btn:hover { border-color: var(--accent); }
.panel { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.panel.grow { flex: 1; overflow-y: auto; min-height: 60px; }
.panel-title { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 6px; }
.panel-val { font-size: 13px; }
.mono { font-family: var(--mono); }
.list { display: flex; flex-direction: column; gap: 4px; }
.list .s-item { font-size: 12px; color: var(--muted); padding: 5px 6px; border-radius: 6px; cursor: default;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .s-item.active { background: rgba(217,119,87,.15); color: var(--accent2); }
.mem { font-family: var(--mono); font-size: 11px; color: var(--muted); margin: 0; max-height: 120px;
  overflow-y: auto; white-space: pre-wrap; word-break: break-word; }
.sidebar-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border-top: 1px solid var(--line); padding-top: 10px; }
.badge { font-size: 10px; color: var(--muted); font-family: var(--mono); }
.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); padding: 6px 10px;
  border-radius: 8px; cursor: pointer; font-size: 12px; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: none; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.icon-btn { background: transparent; border: 0; color: var(--txt); font-size: 20px; cursor: pointer; }
.topbar-title { font-weight: 600; }

/* ---------- Chat ---------- */
.chat { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.welcome { margin: auto; text-align: center; color: var(--muted); max-width: 420px; }
.welcome .logo-big { font-size: 48px; color: var(--accent); }
.welcome h2 { color: var(--txt); margin: 10px 0 6px; }
.welcome p { font-size: 14px; line-height: 1.6; }

.row { display: flex; gap: 12px; max-width: 820px; width: 100%; margin: 0 auto; }
.row .who { flex-shrink: 0; width: 26px; height: 26px; border-radius: 6px; display: flex; align-items: center;
  justify-content: center; font-size: 13px; font-weight: 700; }
.row.user .who { background: var(--panel2); color: var(--muted); }
.row.agent .who { background: var(--accent); color: #1f1e1d; }
.bubble { flex: 1; min-width: 0; padding-top: 2px; line-height: 1.6; font-size: 14.5px;
  white-space: pre-wrap; word-wrap: break-word; }
.row.user .bubble { color: var(--txt); }

.note { max-width: 820px; width: 100%; margin: -4px auto; font-size: 12px; color: var(--muted);
  font-family: var(--mono); padding-left: 38px; }
.note.tool::before { content: "⎿ "; color: var(--tool); }
.card { max-width: 820px; width: 100%; margin: 0 auto; background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 14px; font-size: 13px; }
.card .label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--accent2); margin-bottom: 5px; }
.card.mem-card { border-left-color: var(--tool); }
.card.mem-card .label { color: var(--tool); }
.err-card { border-left-color: var(--err); color: #ffb4ad; }
.cursor::after { content: "▋"; color: var(--accent2); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Composer ---------- */
.composer { display: flex; gap: 8px; padding: 14px 18px 18px; align-items: flex-end;
  max-width: 820px; width: 100%; margin: 0 auto; }
.composer textarea { flex: 1; resize: none; max-height: 180px; padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--panel2); color: var(--txt); font-size: 15px;
  font-family: inherit; line-height: 1.5; }
.composer textarea:focus { outline: none; border-color: var(--accent); }
.mic, .send { flex-shrink: 0; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; }
.mic { background: var(--panel2); color: var(--txt); }
.mic.rec { background: var(--err); border-color: var(--err); animation: pulse 1s infinite; }
.send { background: var(--accent); color: #1f1e1d; border: 0; font-weight: 700; }
.send:disabled { opacity: .45; cursor: default; }
@keyframes pulse { 50% { opacity: .5; } }

.note.cost { color: var(--accent2); }
.attach-info { max-width: 820px; width: 100%; margin: 0 auto; padding: 4px 18px; font-size: 12px;
  color: var(--tool); cursor: pointer; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 5; }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  .topbar { display: flex; }
  .sidebar { position: fixed; z-index: 10; height: 100%; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .chat { padding: 16px; }
  .composer { padding: 10px 12px 14px; }
}
