/* Hunger Media · sitio de clientes
   Layout: login partido (marca a la izquierda, formulario a la derecha); panel de una columna con fichas. */
:root {
  --bg: #f3f3f2;
  --surface: #ffffff;
  --fg: #111111;
  --muted: #5f5f5f;
  --line: #dedede;
  --brand: #111111;
  --brand-fg: #f5f5f5;
  --accent: #111111;
  --accent-fg: #ffffff;
  --ok: #111111;
  --warn: #5f5f5f;
  --bad: #b3261e;
  --focus: #111111;
  --radius: 10px;
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0f;
    --surface: #1a1a1a;
    --fg: #ececec;
    --muted: #a3a3a3;
    --line: #2e2e2e;
    --brand: #000000;
    --brand-fg: #ececec;
    --accent: #ececec;
    --accent-fg: #111111;
    --ok: #ececec;
    --warn: #a3a3a3;
    --bad: #f0857d;
    --focus: #ececec;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Marca ---------- */
.wordmark { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; font-size: 20px; display: inline-flex; align-items: baseline; gap: 2px; text-decoration: none; }
.wordmark span { color: inherit; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-brand {
  background: var(--brand);
  color: var(--brand-fg);
  padding: 48px max(32px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; justify-content: space-between; gap: 48px;
  position: relative; overflow: hidden;
}
.auth-brand::after {
  /* Plato visto desde arriba: el círculo que se "come" la esquina. */
  content: ""; position: absolute; right: -18vmin; bottom: -18vmin; width: 62vmin; height: 62vmin; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--brand-fg) 25%, transparent);
  box-shadow: inset 0 0 0 7vmin color-mix(in srgb, var(--brand-fg) 4%, transparent);
  pointer-events: none;
}
.auth-brand .wordmark { font-size: 22px; color: var(--brand-fg); }
.auth-claim { font-family: var(--font-display); font-weight: 600; font-size: clamp(32px, 4.2vw, 56px); line-height: 1.02; letter-spacing: -0.03em; margin: 0; max-width: 12ch; text-wrap: balance; position: relative; z-index: 1; }
.auth-claim em { font-style: normal; color: color-mix(in srgb, var(--brand-fg) 60%, transparent); }
.auth-note { margin: 0; max-width: 40ch; color: color-mix(in srgb, var(--brand-fg) 75%, transparent); position: relative; z-index: 1; }

.auth-main { display: flex; align-items: center; justify-content: center; padding: 48px max(24px, env(safe-area-inset-right, 0px)) 48px 24px; }
.auth-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 24px; }
.auth-section { display: flex; flex-direction: column; gap: 24px; align-items: stretch; }
.auth-section > .linkish { align-self: flex-start; }
.auth-card h1 { font-family: var(--font-display); font-size: 28px; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
.auth-card .lead { margin: 6px 0 0; color: var(--muted); }

.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; }
.field input {
  font: inherit; padding: 11px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--fg); width: 100%;
}
.field input:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.field-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.linkish { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linkish:hover { color: var(--fg); }

.btn {
  font: inherit; font-weight: 600; padding: 12px 16px; border-radius: 8px; border: 1px solid transparent; cursor: pointer;
  background: var(--accent); color: var(--accent-fg); display: inline-flex; justify-content: center; align-items: center; gap: 8px;
}
.btn:hover { filter: brightness(0.96); }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--line); font-weight: 500; padding: 8px 12px; font-size: 14px; }

.msg { font-size: 14px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); margin: 0; }
.msg-error { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: color-mix(in srgb, var(--bad) 7%, transparent); }
.msg-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 7%, transparent); }
.fineprint { font-size: 13px; color: var(--muted); margin: 0; }

@media (max-width: 820px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 28px 20px 32px; gap: 20px; }
  .auth-brand::after { width: 46vmin; height: 46vmin; right: -14vmin; bottom: -20vmin; }
  .auth-claim { font-size: 32px; }
  .auth-note { display: none; }
  .auth-main { align-items: flex-start; padding: 32px max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px)); }
}

/* ---------- Panel ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; background: var(--brand); color: var(--brand-fg);
  padding: 14px max(16px, env(safe-area-inset-right, 0px)) 14px max(16px, env(safe-area-inset-left, 0px));
}
.topbar-inner { max-width: 1048px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar .wordmark { color: var(--brand-fg); }
.user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.user-email { font-size: 14px; color: color-mix(in srgb, var(--brand-fg) 75%, transparent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .btn-ghost { white-space: nowrap; color: var(--brand-fg); border-color: color-mix(in srgb, var(--brand-fg) 30%, transparent); }

.page { max-width: 1080px; margin: 0 auto; padding: 32px max(16px, env(safe-area-inset-right, 0px)) 64px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 28px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.eyebrow { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0; }
.page h1 { font-family: var(--font-display); font-size: clamp(26px, 3vw, 34px); letter-spacing: -0.02em; margin: 4px 0 0; text-wrap: balance; }
.page-lead { margin: 6px 0 0; color: var(--muted); max-width: 62ch; }
.btn-link { text-decoration: none; }

.stats { display: flex; flex-wrap: wrap; gap: 8px; }
.stat { font-size: 13px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-variant-numeric: tabular-nums; }
.stat b { font-weight: 600; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card h2, .card h3 { font-family: var(--font-display); font-size: 19px; letter-spacing: -0.01em; margin: 0; }
.card .rubro { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid currentColor; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-activo { color: var(--ok); }
.chip-pausado { color: var(--warn); }
.chip-prospecto { color: var(--muted); }
.chip-baja { color: var(--bad); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; padding: 3px 8px; border-radius: 6px; background: color-mix(in srgb, var(--fg) 8%, transparent); color: var(--fg); }
.empty { color: var(--muted); font-size: 14px; }

.hero-card { padding: 28px; gap: 18px; }
.hero-card h2 { font-size: 26px; }
.note { border: 1px dashed var(--line); border-radius: var(--radius); padding: 16px 18px; color: var(--muted); font-size: 14px; margin: 0; }

.state { padding: 48px 0; text-align: center; color: var(--muted); }
.state h2 { font-family: var(--font-display); color: var(--fg); font-size: 22px; margin: 0 0 6px; }

.skeleton { border-radius: var(--radius); background: linear-gradient(90deg, var(--line), color-mix(in srgb, var(--line) 50%, var(--bg)), var(--line)); background-size: 200% 100%; height: 180px; }
@media (prefers-reduced-motion: no-preference) {
  .skeleton { animation: shimmer 1.4s ease-in-out infinite; }
  @keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
}
@media (max-width: 520px) {
  .user-email { display: none; }
  .grid { grid-template-columns: 1fr; }
}

/* ---------- Navegación y administración ---------- */
.toplink { color: color-mix(in srgb, var(--brand-fg) 80%, transparent); text-decoration: none; font-size: 14px; white-space: nowrap; padding: 4px 2px; border-bottom: 2px solid transparent; }
.toplink:hover { color: var(--brand-fg); }
.toplink[aria-current="page"] { color: var(--brand-fg); border-bottom-color: var(--brand-fg); }

.admin-layout { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 20px; align-items: start; }
.admin-layout .card h2 { font-size: 19px; }
.select { font: inherit; padding: 11px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); width: 100%; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 14px; }

.creada { border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 7%, transparent); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.creada-titulo { margin: 0; font-weight: 600; color: var(--ok); }
.creada-datos { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
.creada-acciones { display: flex; align-items: center; gap: 10px; }

.tabla-wrap { overflow-x: auto; margin: 0 -4px; }
.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 4px; border-bottom: 1px solid var(--line); }
.tabla td { padding: 12px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla .persona { font-weight: 600; }
.tabla .sub { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.tabla .num { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--muted); }
.tabla .aviso { color: var(--warn); }
.tabla .acciones { text-align: right; white-space: nowrap; }
.btn-peligro { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); padding: 6px 10px; font-size: 13px; }

@media (max-width: 860px) {
  .admin-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .toplink-extra { display: none; }
  .topbar .user { gap: 10px; }
  .topbar .btn-ghost { padding: 7px 10px; font-size: 13px; }
  .tabla th:nth-child(3), .tabla td:nth-child(3) { display: none; }
}

.btn-metricas { align-self: flex-start; margin-top: auto; }
@media (max-width: 480px) {
  .topbar-inner { flex-wrap: wrap; row-gap: 10px; }
  .topbar .user { width: 100%; justify-content: space-between; }
}
