/* Updates de MindChat.
   Misma familia visual que el panel —morado de marca, verde lima— pero en
   claro: esto lo abre un cliente desde su correo, no un operador que pasa el
   día dentro. El panel es un puesto de trabajo; esto es una vitrina. */

:root {
  --ground: #f7f5fa;
  --surface: #ffffff;
  --surface-2: #f1eef7;
  --line: #e3ddee;
  --line-soft: #ece7f3;
  --ink: #1c1528;
  --ink-2: #574c68;
  --ink-3: #857a97;
  --brand: #2e1f42;
  --lime: #5f9424;
  --lime-soft: #e9f4db;
  --amber: #9a6708;
  --amber-soft: #faefda;
  --slate: #6c6280;
  --slate-soft: #edeaf3;
  --red: #a33232;
  --red-soft: #fbeaea;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(28, 21, 40, 0.05), 0 8px 24px rgba(28, 21, 40, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #15101d;
    --surface: #1d1728;
    --surface-2: #241d32;
    --line: #322745;
    --line-soft: #271f36;
    --ink: #f2eef8;
    --ink-2: #b8aecb;
    --ink-3: #8b809f;
    --brand: #e9e3f4;
    --lime: #a4d95e;
    --lime-soft: #24311a;
    --amber: #e7b45a;
    --amber-soft: #352914;
    --slate: #9d93b3;
    --slate-soft: #292139;
    --red: #f08a8a;
    --red-soft: #3a1e1e;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.32);
  }
}

* { box-sizing: border-box; }

/* `hidden` gana siempre.
   El navegador lo aplica como `display: none` desde su propia hoja, y cualquier
   clase nuestra con `display` la pisa: `.gate`, `.app` y `.sheet` traen display
   propio, así que se veían las tres capas amontonadas encima del acceso. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, strong { letter-spacing: -0.015em; }

/* ---------- Controles ---------- */

input, select, textarea {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 11px;
}
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--lime);
  box-shadow: 0 0 0 3px var(--lime-soft);
}
input[type="file"] { padding: 8px; background: var(--surface-2); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.hint { font-size: 12.5px; color: var(--ink-3); line-height: 1.45; }

.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 9px;
  padding: 9px 15px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.14s, background 0.14s;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--ground);
}
.btn.primary:hover { filter: brightness(1.14); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn.block { width: 100%; }
.btn.tiny { padding: 6px 12px; font-size: 13px; }
.btn.icon { padding: 6px 10px; }
.btn:disabled { opacity: 0.55; cursor: default; }

.linkish {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--lime);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- Entrar ---------- */

.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.gate-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 30px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.gate-brand { display: flex; align-items: center; gap: 12px; }
.gate-brand strong { display: block; font-size: 19px; }
.gate-brand small { color: var(--ink-3); font-size: 12.5px; }
.gate-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 19px;
  background: var(--brand);
  flex: 0 0 auto;
}
.gate-mark.small { width: 34px; height: 34px; font-size: 16px; border-radius: 9px; }
.gate-lede { margin: 0; color: var(--ink-2); font-size: 14.5px; }

.gate form { display: flex; flex-direction: column; gap: 14px; }
.gate-swap { margin: 0; text-align: center; font-size: 13.5px; color: var(--ink-3); }

.gate-msg {
  margin: 0;
  font-size: 13.5px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--slate-soft);
  color: var(--ink-2);
}
.gate-msg.error { background: var(--red-soft); color: var(--red); }
.gate-msg.ok { background: var(--lime-soft); color: var(--lime); }

/* ---------- Estructura ---------- */

.app { min-height: 100dvh; display: flex; flex-direction: column; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.top-brand { display: flex; align-items: center; gap: 11px; }
.top-brand strong { display: block; font-size: 16px; line-height: 1.2; }
.top-brand small { color: var(--ink-3); font-size: 12px; }
.top-right { display: flex; align-items: center; gap: 12px; }
.who { font-size: 13.5px; color: var(--ink-2); }

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  overflow-x: auto;
}
.tab {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--ink-3);
  padding: 12px 14px;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--lime); }
.pill {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  background: var(--amber-soft);
  color: var(--amber);
  padding: 1px 7px;
  border-radius: 999px;
}

.stage { flex: 1; padding: 30px 24px 72px; }
.view { display: none; max-width: 780px; margin: 0 auto; }
.view.active { display: flex; flex-direction: column; gap: 22px; }

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.view-head h1 {
  font-family: "Bricolage Grotesque", "IBM Plex Sans", sans-serif;
  font-weight: 800;
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.1;
  margin: 0;
}
.sub { margin: 5px 0 0; color: var(--ink-2); font-size: 14.5px; max-width: 54ch; }

.list { display: flex; flex-direction: column; gap: 12px; }
.empty {
  margin: 0;
  padding: 34px 20px;
  text-align: center;
  color: var(--ink-3);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  font-size: 14.5px;
}

/* ---------- Tarjetas ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.card-title { margin: 0; font-size: 16.5px; font-weight: 600; line-height: 1.35; }
.card-body { margin: 0; color: var(--ink-2); font-size: 14.5px; max-width: 62ch; white-space: pre-wrap; }

.stamp {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
  padding-top: 3px;
  font-variant-numeric: tabular-nums;
}

.chip {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--slate-soft);
  color: var(--slate);
}
.chip.listo { background: var(--lime-soft); color: var(--lime); }
.chip.camino, .chip.aceptada { background: var(--amber-soft); color: var(--amber); }
.chip.descartada { background: var(--red-soft); color: var(--red); }

.card-meta { display: flex; flex-wrap: wrap; gap: 7px; }
.tag {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink-2);
}
.tag.soft { color: var(--ink-3); }

.shot-link { font-size: 13.5px; color: var(--lime); align-self: flex-start; }

.note {
  background: var(--surface-2);
  border-left: 3px solid var(--lime);
  border-radius: 4px 9px 9px 4px;
  padding: 11px 14px;
}
.note-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
  margin-bottom: 3px;
}
.note p { margin: 0; font-size: 14px; color: var(--ink-2); }

.card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px solid var(--line-soft);
  margin-top: 2px;
}
.mini { width: auto; font-size: 13.5px; padding: 7px 10px; }
.mini.grow { flex: 1 1 200px; }

/* ---------- Diálogos ---------- */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(28, 21, 40, 0.5);
  z-index: 40;
}
.sheet {
  position: fixed;
  z-index: 50;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px));
  max-height: min(86dvh, 760px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(28, 21, 40, 0.28);
  overflow: hidden;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.sheet-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  overflow-y: auto;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sheet-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.msg { font-size: 13.5px; color: var(--ink-3); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 60;
  background: var(--brand);
  color: var(--ground);
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: 0 12px 34px rgba(28, 21, 40, 0.3);
}
.toast.error { background: var(--red); color: #fff; }

@media (max-width: 560px) {
  .stage { padding: 22px 16px 56px; }
  .top { padding: 12px 16px; }
  .who { display: none; }
  .row { grid-template-columns: 1fr; }
}
