/* Portal Codulia — usa los tokens de /styles.css (misma marca que la landing). */

.portal-main {
  min-height: calc(100vh - 68px);
  display: flex;
  flex-direction: column;
}

/* ===================== AUTH (login / registro) ===================== */
.auth-wrap {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 48px 24px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.auth-card h1 {
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.auth-card .sub {
  color: var(--text-dim);
  font-size: 0.92rem;
  margin: 0 0 22px;
}

.auth-tabs {
  display: flex;
  gap: 6px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 24px;
}

.auth-tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 9px 0;
  border-radius: 999px;
  cursor: pointer;
}

.auth-tabs button.active {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-dim);
}

.field input {
  width: 100%;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  padding: 11px 14px;
  outline: none;
  transition: border-color 0.15s ease;
}

.field input:focus {
  border-color: var(--accent);
}

.field .hint {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 5px;
}

/* Honeypot: fuera de la vista para humanos, visible para bots. */
.hp-field {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

.form-error {
  display: none;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fca5a5;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.87rem;
  margin-bottom: 16px;
}

.form-error.visible { display: block; }

.captcha-slot { margin-bottom: 16px; }
.captcha-slot:empty { display: none; }

.auth-note {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-top: 18px;
}
.auth-note a { color: var(--accent); }

/* Aviso post-registro: verificá tu email. */
.verify-notice {
  background: rgba(52, 211, 153, 0.07);
  border: 1px solid rgba(52, 211, 153, 0.4);
  border-radius: var(--radius-sm);
  padding: 18px;
}
.verify-notice p { margin: 0 0 10px; font-size: 0.9rem; line-height: 1.55; }
.verify-notice p:last-child { margin-bottom: 0; }
.verify-notice .hint-line { color: var(--text-dim); font-size: 0.82rem; }

.linklike {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}
.linklike:disabled { color: var(--text-dim); cursor: default; text-decoration: none; }

.resend-row { margin-bottom: 16px; }

.forgot-intro {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.55;
  margin: 0 0 18px;
}

/* ===================== DASHBOARD ===================== */
.dash {
  flex: 1;
  padding: 36px 0 64px;
}

.dash-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.dash-head h1 { font-size: 1.45rem; }
.dash-head .who { color: var(--text-dim); font-size: 0.9rem; margin-top: 4px; }

.plan-pill {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  vertical-align: middle;
  margin-left: 8px;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

@media (max-width: 860px) {
  .dash-grid { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.panel--full { grid-column: 1 / -1; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-head h2 { font-size: 1.05rem; }
.panel-head .desc { color: var(--text-dim); font-size: 0.83rem; margin-top: 3px; }

/* Uso */
.usage-nums {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.usage-nums .big { font-size: 1.9rem; font-weight: 800; }
.usage-nums .of { color: var(--text-dim); font-size: 0.95rem; }

.usage-bar {
  height: 8px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.usage-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  border-radius: 999px;
  transition: width 0.4s ease;
}
.usage-bar span.warn { background: #fbbf24; }
.usage-bar span.over { background: #f87171; }

.usage-meta { color: var(--text-dim); font-size: 0.8rem; margin-top: 8px; }

/* Keys */
.keys-list { display: flex; flex-direction: column; gap: 10px; }

.key-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}

.key-row code {
  font-size: 0.88rem;
  color: var(--accent);
}

.key-row .meta { flex: 1; min-width: 0; }
.key-row .label { font-weight: 600; font-size: 0.9rem; }
.key-row .dates { color: var(--text-dim); font-size: 0.76rem; margin-top: 2px; }

.key-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}
.key-badge.on { color: var(--accent); border: 1px solid var(--accent); }
.key-badge.off { color: var(--text-dim); border: 1px solid var(--border); }

.btn--danger {
  background: transparent;
  border: 1px solid rgba(248, 113, 113, 0.45);
  color: #fca5a5;
  padding: 7px 14px;
  font-size: 0.8rem;
}
.btn--danger:hover { border-color: #f87171; }

.empty-msg { color: var(--text-dim); font-size: 0.88rem; padding: 8px 0; }

/* Key nueva (texto plano una sola vez) */
.new-key-box {
  display: none;
  background: rgba(52, 211, 153, 0.07);
  border: 1px solid rgba(52, 211, 153, 0.4);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
}
.new-key-box.visible { display: block; }
.new-key-box p { margin: 0 0 10px; font-size: 0.86rem; }
.new-key-box .warn-line { color: #fbbf24; font-size: 0.8rem; margin-top: 10px; }

.key-plain {
  display: flex;
  gap: 10px;
  align-items: center;
}
.key-plain code {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.82rem;
  word-break: break-all;
}

.inline-form { display: flex; gap: 10px; }
.inline-form input {
  flex: 1;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  padding: 9px 13px;
  outline: none;
}
.inline-form input:focus { border-color: var(--accent); }

/* Billing */
.billing-body { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Playground */
.playground-bar { display: flex; gap: 10px; margin-bottom: 16px; }
.playground-bar input {
  flex: 1;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  padding: 11px 14px;
  outline: none;
}
.playground-bar input:focus { border-color: var(--accent); }

.pg-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 860px) {
  .pg-cols { grid-template-columns: 1fr; }
}

.pg-results { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow: auto; }

.pg-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.pg-item:hover { border-color: var(--accent); }
.pg-item.active { border-color: var(--accent); }
.pg-item .n { flex: 1; font-size: 0.9rem; font-weight: 600; }
.pg-item .b { color: var(--text-dim); font-size: 0.8rem; }
.pg-item .k { color: var(--accent); font-size: 0.8rem; white-space: nowrap; }

.pg-json {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 0.78rem;
  line-height: 1.55;
  overflow: auto;
  max-height: 420px;
  margin: 0;
  white-space: pre;
}

.pg-request {
  color: var(--text-dim);
  font-size: 0.78rem;
  margin: 0 0 10px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  word-break: break-all;
}
.pg-request b { color: var(--accent); font-weight: 600; }

.pg-note { color: var(--text-dim); font-size: 0.78rem; margin-top: 12px; }

/* Toast simple */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface-2);
  border: 1px solid var(--accent);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 0.86rem;
  transition: transform 0.25s ease;
  z-index: 100;
}
.toast.visible { transform: translateX(-50%) translateY(0); }
