/* compuAI · Compuverse — estilo minimalista, sin dependencias */
:root {
  --brand: #000060;
  --navy: #16204d;
  --accent: #c03030;
  --bg: #070910;
  --panel: #0e1119;
  --panel-2: #12162240;
  --line: #232838;
  --text: #e9ecf5;
  --muted: #8a91a8;
  --ok: #3ecf8e;
  --warn: #e3b341;
  --err: #ef6b6b;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 13, 22, .92);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(10px);
}
.logo { height: 30px; opacity: .95; }
.brand h1 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: .3px; }
.brand h1 span { color: var(--err); }
.brand p { margin: 1px 0 0; font-size: 10.5px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }
.providers { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; align-items: center; }
.chip {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--err); }
.chip.on { color: var(--text); }
.chip.on .dot { background: var(--ok); }

/* ---------- Layout ---------- */
main {
  display: grid; grid-template-columns: minmax(340px, 440px) 1fr;
  gap: 18px; padding: 18px; align-items: start;
  max-width: 1400px; margin: 0 auto;
}
@media (max-width: 980px) { main { grid-template-columns: 1fr; } }
.col { display: flex; flex-direction: column; gap: 14px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.panel > h2 {
  margin: 0 0 12px; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 8px; color: #ccd2e6;
}
.panel > h2 .muted { margin-left: auto; }
.panel > h2 > .muted + .ghost, .panel h2 > .ghost:last-child { margin-left: auto; }
.panel.grow { flex: 1; }

/* ---------- Controles ---------- */
button {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 14px; font: inherit; font-size: 13px; cursor: pointer;
  transition: border-color .15s, background .2s, transform .05s;
}
button:hover { border-color: #364060; background: #141a28; }
button:active { transform: translateY(1px); }
button.primary { background: var(--err); border-color: var(--err); color: #fff; font-weight: 600; }
button.primary:hover { background: #d43f3f; }
button.ghost { background: transparent; color: var(--muted); border-color: transparent; }
.chip, button.small { white-space: nowrap; }
button.small { padding: 3px 9px; font-size: 11px; }
button:disabled { opacity: .5; cursor: not-allowed; }

textarea, input[type=text], input[type=password], input[type=number], select {
  width: 100%; background: #0a0d16; color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 11px; font: inherit; resize: vertical;
}
textarea:focus, input:focus, select:focus { outline: none; border-color: #39508f; }
.row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.row.between { justify-content: space-between; }
.inline { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.inline input[type=number] { width: 62px; }
.muted { color: var(--muted); font-size: 12px; font-weight: 400; }

/* ---------- Equipo ---------- */
.team { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 520px) { .team { grid-template-columns: 1fr; } }
.agent {
  border: 1px solid var(--line); border-left: 2px solid var(--muted);
  border-radius: 10px; padding: 10px; background: #0b0e17; transition: border-color .25s, background .25s;
}
.agent .head { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; }
.agent .model { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.agent .status { font-size: 10.5px; margin-top: 4px; color: var(--muted); }
.agent .msg {
  font-size: 11.5px; color: #c7cce0; margin-top: 7px; max-height: 120px; overflow: auto;
  white-space: pre-wrap; word-break: break-word;
}
.agent.working { border-left-color: var(--warn); }
.agent.done { border-left-color: var(--ok); }
.agent.error { border-left-color: var(--err); }
.status .st-working { color: var(--warn); }
.status .st-done { color: var(--ok); }
.status .st-error { color: var(--err); }
.status .st-idle { color: var(--muted); }

/* ---------- Uso de las IAs (gráfica + límites) ---------- */
.usage-chart { display: flex; justify-content: center; margin: 2px 0 14px; }
.usage-chart svg { width: 168px; height: 170px; overflow: visible; }
.usage { display: flex; flex-direction: column; }
.u-item { padding: 10px 2px; border-top: 1px solid var(--line); }
.u-item:first-child { border-top: none; padding-top: 0; }
.usage .u-head { display: flex; align-items: baseline; justify-content: space-between; font-size: 12.5px; }
.usage .u-name { display: flex; align-items: center; gap: 7px; font-weight: 600; }
.usage .udot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.usage .u-share { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 650; }
.usage .u-meta { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.usage .u-limit { margin-top: 7px; }
.usage .u-limit.muted { font-size: 10.5px; color: var(--muted); }
.usage .u-limit-top { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-bottom: 3px; }
.usage .bar { height: 6px; border-radius: 999px; background: #161b29; overflow: hidden; }
.usage .bar > span { display: block; height: 100%; border-radius: 999px; transition: width .4s ease; }
.usage .bar > span.warn { background: var(--warn) !important; }
.usage .bar > span.over { background: var(--err) !important; }

/* ---------- Log ---------- */
.log {
  font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
  font-size: 11.5px; line-height: 1.6; height: 300px; overflow: auto;
  background: #080a11; border: 1px solid var(--line); border-radius: 10px; padding: 10px;
}
.log .line { display: flex; gap: 8px; padding: 1px 0; }
.log .t { color: #454c63; flex: 0 0 auto; }
.log .lvl-info { color: #79c0e8; }
.log .lvl-warn { color: var(--warn); }
.log .lvl-error { color: var(--err); }
.log .lvl-agent { color: #a99bf0; }
.log .lvl-tool { color: #7fd6a6; }
.log .lvl-phase { color: var(--err); font-weight: 700; }
.log .lvl-command { color: #e0c179; }

/* ---------- Asistente + avatar ---------- */
.assistant { display: flex; gap: 14px; align-items: flex-start; }
.avatar {
  flex: 0 0 auto; width: 92px; display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.avatar svg { width: 92px; height: 92px; display: block; transition: filter .3s; }
.avatar-name { font-size: 10.5px; letter-spacing: .5px; color: var(--muted); }
.avatar .eyes { transform-origin: 60px 50px; transform-box: view-box; animation: av-blink 5.2s infinite; }
.avatar .mouth { transform-origin: 60px 63px; transform-box: view-box; }
.avatar.talking svg { filter: drop-shadow(0 0 12px rgba(62, 207, 142, .35)); }
.avatar.talking .mouth { animation: av-talk .26s infinite ease-in-out; }
.avatar.talking .avatar-name { color: var(--ok); }
@keyframes av-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.08); } }
@keyframes av-talk {
  0%, 100% { transform: scaleY(.5); }
  50% { transform: scaleY(2.1); }
}

.chat {
  flex: 1; min-height: 200px; max-height: 300px; overflow: auto; display: flex; flex-direction: column; gap: 8px;
  padding: 4px;
}
.bubble { max-width: 88%; padding: 9px 12px; border-radius: 12px; font-size: 12.5px; white-space: pre-wrap; word-break: break-word; }
.bubble.me { align-self: flex-end; background: #17205a; border: 1px solid #232f6b; }
.bubble.ai { align-self: flex-start; background: #10141f; border: 1px solid var(--line); }

/* ---------- Cuadro para escribirle al asistente ---------- */
.composer {
  display: flex; align-items: center; gap: 6px; margin-top: 12px;
  background: #0a0d16; border: 1px solid var(--line); border-radius: 14px; padding: 5px;
  transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within { border-color: #39508f; box-shadow: 0 0 0 3px rgba(57, 80, 143, .18); }
.composer input {
  flex: 1; min-width: 0; background: transparent; border: none; outline: none;
  color: var(--text); font: inherit; font-size: 13px; padding: 8px 6px;
}
.composer input::placeholder { color: #6b7391; }
.composer .icon-btn {
  flex: 0 0 auto; width: 38px; height: 38px; padding: 0; font-size: 16px;
  background: transparent; border: none; border-radius: 10px; color: var(--muted); cursor: pointer;
}
.composer .icon-btn:hover { background: #141a28; color: var(--text); }
.composer .send {
  flex: 0 0 auto; width: 40px; height: 38px; padding: 0; font-size: 15px;
  background: var(--err); border: none; border-radius: 10px; color: #fff; cursor: pointer;
}
.composer .send:hover { background: #d43f3f; }

/* ---------- Workspace ---------- */
.filelist { font-family: ui-monospace, monospace; font-size: 11.5px; max-height: 200px; overflow: auto; }
.filelist .f { display: flex; justify-content: space-between; padding: 4px 6px; border-radius: 6px; }
.filelist .f:hover { background: #121622; }
.filelist .f.d { color: #8fb4ff; cursor: pointer; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(3,4,8,.72); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal.hidden, .hidden { display: none; }
.modal-card { width: min(720px, 94vw); max-height: 88vh; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.modal-head, .modal-foot { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-foot { border-bottom: none; border-top: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 15px; }
.modal-body { padding: 16px 18px; overflow: auto; display: flex; flex-direction: column; gap: 16px; }
.fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.fieldset legend { padding: 0 8px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .9px; }
.field { display: grid; grid-template-columns: 150px 1fr; gap: 10px; align-items: center; margin: 7px 0; }
.field label { font-size: 12.5px; color: #c3cdf0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.fieldset .row button { font-size: 12px; }

/* ---------- Usuario en la barra ---------- */
.userbox { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); }
.userbox .uname { font-size: 12px; color: #c3cdf0; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userbox .ghost.small { padding: 3px 9px; }

/* ---------- Proyectos ---------- */
.projects { display: flex; flex-direction: column; gap: 7px; max-height: 240px; overflow: auto; }
.proj { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #0b0f1c; }
.proj.on { border-color: #3b5bdb; box-shadow: 0 0 0 2px #3b5bdb2e; }
.proj-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.proj-name { font-size: 13px; font-weight: 600; }
.proj-runs { font-size: 10.5px; color: var(--muted); }
.proj-desc { font-size: 11.5px; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-actions { display: flex; gap: 6px; margin-top: 7px; }
.proj-actions .small { padding: 3px 9px; font-size: 11px; }
.active-project { margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.panel h2 .ghost.small { margin-left: auto; }

/* ---------- Cuentas / usuarios ---------- */
.section-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .9px; margin: 4px 0 6px; }
.users { display: flex; flex-direction: column; gap: 6px; }
.user-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; }
.user-row .small { padding: 3px 8px; font-size: 11px; }
button.danger, .ghost.danger { color: var(--err); border-color: #4a2326; }

/* ---------- Adaptación a móviles ---------- */
@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; gap: 8px 10px; padding: 10px 12px; }
  .brand h1 { font-size: 17px; }
  .brand p { display: none; }
  .logo { height: 26px; }
  .providers { order: 5; flex-basis: 100%; margin-left: 0; }
  .userbox { margin-left: auto; }
  main { gap: 12px; padding: 12px; }
  .panel { padding: 13px; }
  .panel > h2 { flex-wrap: wrap; }
  .assistant { flex-direction: column; align-items: stretch; }
  .avatar { flex-direction: row; width: auto; gap: 10px; }
  .avatar svg { width: 60px; height: 60px; }
  .chat { max-height: 260px; }
  .log { height: 240px; }
  .projects { max-height: 200px; }
  .modal-card { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; border: none; }
}

@media (max-width: 480px) {
  .settings-lbl { display: none; }
  .brand h1 { font-size: 15px; }
  .chip { font-size: 10.5px; padding: 3px 8px; }
  button { padding: 7px 11px; }
  .panel { padding: 11px; border-radius: 10px; }
  .panel > h2 { font-size: 12px; }
  .userbox .uname { max-width: 92px; }
  .field { grid-template-columns: 1fr; gap: 3px; }
  .grid2 { grid-template-columns: 1fr; }
  .modal-head h2 { font-size: 14px; }
  .modal-body { padding: 12px; gap: 12px; }
  textarea, input[type=text], input[type=password], input[type=number], select { font-size: 16px; }
  .composer input { font-size: 16px; }
  .row.between { flex-wrap: wrap; gap: 10px; }
  .row.between button.primary { width: 100%; }
}

