/* Metalurgista Digital — línea de diseño Atalaya Mining (ver EXTRA/interfaz.png) */
:root {
  --bg: #f7f5f1;
  --card: #ffffff;
  --border: #e7e2d9;
  --text: #1c2b3a;
  --muted: #6b7280;
  --accent: #c0762c;
  --accent-strong: #a8621f;
  --accent-soft: #f5e7d8;
  --ok: #4d7c4d;
  --radius: 12px;
  --font: "Helvetica Neue", Arial, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.55;
}

/* ── cabecera (fija arriba) ── */
header.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; background: var(--card);
  border-bottom: 1px solid var(--border);
}
.brand h1 {
  margin: 0; font-size: 19px; letter-spacing: 0.35em;
  color: var(--accent); font-weight: 700; text-transform: uppercase;
}
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 13px; letter-spacing: 0.04em; }
header.top form { margin: 0; }
.linklike {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 13px; text-decoration: underline; font-family: var(--font);
}
.linklike:hover { color: var(--text); }

/* ── login ── */
.login-wrap { min-height: calc(100vh - 70px); display: grid; place-items: center; padding: 24px; }
.login-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 36px 40px; width: 100%; max-width: 380px; text-align: center;
  box-shadow: 0 1px 3px rgba(28, 43, 58, 0.06);
}
.login-card h2 { margin: 0 0 6px; font-size: 20px; }
.login-card p.sub { margin: 0 0 24px; color: var(--muted); font-size: 13px; }
.login-card input[type="password"] {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 15px; margin-bottom: 14px; background: var(--bg);
}
.login-card input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.btn {
  display: inline-block; width: 100%; padding: 11px 18px; border: none; cursor: pointer;
  background: var(--accent); color: #fff; border-radius: 8px; font-size: 15px;
  font-weight: 600; font-family: var(--font);
}
.btn:hover { background: var(--accent-strong); }
.error { color: #b4232a; font-size: 13px; margin: 0 0 12px; }

/* ── chat ── */
.chat-shell { max-width: 880px; margin: 0 auto; padding: 24px 16px 140px; }
.notice {
  text-align: center; color: var(--muted); font-size: 13px; margin: 18px 0 26px;
}
.msg { display: flex; margin: 14px 0; }
.msg .bubble {
  max-width: 82%; padding: 12px 16px; border-radius: var(--radius);
  white-space: normal; overflow-wrap: break-word;
}
.msg.user { justify-content: flex-end; }
.msg.user .bubble {
  background: var(--accent-soft); border: 1px solid #ecd9c2;
  border-bottom-right-radius: 4px;
}
.msg.diego .bubble {
  background: var(--card); border: 1px solid var(--border);
  border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(28,43,58,.05);
}
.msg.diego .who {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; margin-bottom: 4px;
}
.bubble p:first-child { margin-top: 0; }
.bubble p:last-child { margin-bottom: 0; }
.bubble table { border-collapse: collapse; margin: 10px 0; font-size: 13.5px; display: block; overflow-x: auto; }
.bubble th, .bubble td { border: 1px solid var(--border); padding: 5px 10px; text-align: left; }
.bubble th { background: var(--bg); }
.bubble code { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 13px; }
.bubble pre { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px; overflow-x: auto; }
.bubble pre code { border: none; background: none; padding: 0; }
.cursor { display: inline-block; width: 8px; height: 16px; background: var(--accent); animation: blink 1s steps(1) infinite; vertical-align: text-bottom; }
@keyframes blink { 50% { opacity: 0; } }

/* ── chips de origen del dato (bajo la respuesta) ── */
.chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border);
}
.chip-src {
  font-size: 11.5px; line-height: 1; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.chip-src.biblio      { background: #eaf1f9; border-color: #cddcee; }
.chip-src.experiencia { background: #eaf3ea; border-color: #cfe2cf; }
.chip-src.atalaya     { background: var(--accent-soft); border-color: #ecd9c2; }
.chip-src.capa2       { background: #efedf5; border-color: #d9d4e6; }
.chip-src.curso       { background: #f5f0e4; border-color: #e5dcc2; }
.chip-src.metodo      { background: #f0f0ef; border-color: #dcdcda; }
.chip-src.propia      { background: #fdf0e4; border-color: #f0d5b4; font-style: italic; }
.chip-src.model       { background: var(--card); color: var(--muted); }

/* ── gráficas de elaboración propia ── */
.chart-wrap { margin: 12px 0; }
.chart-plot { position: relative; height: 230px; background: var(--card);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px; }
.chart-cap { font-size: 11.5px; color: var(--muted); margin-top: 5px; font-style: italic; }

/* ── ventana de créditos ── */
dialog { border: 1px solid var(--border); border-radius: var(--radius);
  max-width: 520px; width: 92%; padding: 0; color: var(--text); }
dialog::backdrop { background: rgba(28, 43, 58, .35); }
.dlg-head { display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--border); }
.dlg-body { padding: 6px 20px 16px; font-size: 14px; }

/* ── barra de entrada ── */
.composer-wrap {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, var(--bg) 30%); padding: 18px 16px 22px;
}
.composer {
  max-width: 880px; margin: 0 auto; display: flex; gap: 10px; align-items: flex-end;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px; box-shadow: 0 4px 16px rgba(28,43,58,.08);
}
.composer textarea {
  flex: 1; border: none; resize: none; font: inherit; background: none;
  max-height: 160px; padding: 6px 4px; color: var(--text);
}
.composer textarea:focus { outline: none; }
.composer button.send {
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 9px 18px; font-weight: 600; cursor: pointer; font-family: var(--font);
}
.composer button.send:disabled { opacity: .45; cursor: default; }
.composer-foot {
  max-width: 880px; margin: 8px auto 0; display: flex; justify-content: space-between;
  color: var(--muted); font-size: 12px; padding: 0 4px;
}
.composer-foot button { padding: 0; }
