/* Customer portal — same brand tokens as the marketing site (kirastream.cloud)
   so site -> signup -> dashboard feels like one product. Variable NAMES kept
   backward compatible with the rest of the portal templates (--primary-500
   etc.) even though the brand itself is navy+orange now, not blue — only
   the values changed, not what they're called. */
:root {
  --primary-300: #ffab6b;
  --primary-400: #ff8c3d;
  --primary-500: #f2741f;
  --primary-600: #d4620f;
  --primary-700: #a84f0c;

  --dark-900: #071426;
  --dark-800: #0e1f36;
  --dark-700: #172b47;
  --dark-600: #253d5e;

  --text-hi: #f7f9fc;
  --text-mid: #b4bfcd;
  --text-low: #7c8aa0;

  --radius: 16px;
  --green: #4fd695;
  --yellow: #f5a623;
  --red: #ef4444;

  --font-display: "Manrope", "Segoe UI", Helvetica, Arial, sans-serif;
  --font-body: "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--dark-900);
  background-image:
    radial-gradient(ellipse 900px 500px at 12% -10%, rgba(242, 116, 31, 0.14), transparent 60%),
    linear-gradient(180deg, var(--dark-900), #040b16 70%);
  background-attachment: fixed;
  color: var(--text-mid);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-500); text-decoration: none; }
a:hover { color: var(--primary-400); }

.p-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(180, 191, 205, 0.1);
  background: rgba(4, 11, 22, 0.6);
  backdrop-filter: blur(10px);
  flex-wrap: wrap;
}

.p-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.12rem;
  color: var(--text-hi) !important;
}
.p-brand img { height: 30px; width: auto; }
.p-brand span { color: var(--primary-500); }

.p-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 0.9rem;
}
.p-nav a { color: var(--text-mid); }
.p-nav a:hover { color: var(--text-hi); }

.p-langswitch a {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-low);
}
.p-langswitch a.active { color: var(--primary-400); background: rgba(242, 116, 31, 0.12); }

.p-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 44px 20px 60px;
}

h1, h2, h3, h4 { font-family: var(--font-display); color: var(--text-hi); font-weight: 800; }
h1 { font-size: 1.7rem; margin: 0 0 8px; letter-spacing: -0.01em; }
h3 { font-size: 1.02rem; margin: 0 0 8px; }

.p-sub { color: var(--text-low); margin: 0 0 28px; }

.p-card {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
  background-color: var(--dark-800);
  border: 1px solid rgba(180, 191, 205, 0.12);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: 0 20px 50px -30px rgba(0, 0, 0, 0.6);
}
.p-card-narrow { max-width: 420px; margin-left: auto; margin-right: auto; }

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-low);
  margin: 16px 0 6px;
  font-weight: 500;
}
label:first-of-type { margin-top: 0; }

input, select {
  width: 100%;
  padding: 12px 13px;
  border-radius: 10px;
  border: 1px solid var(--dark-600);
  background: #050d1a;
  color: var(--text-hi);
  font-family: var(--font-body);
  font-size: 0.95rem;
}
input:focus, select:focus { outline: none; border-color: var(--primary-500); box-shadow: 0 0 0 3px rgba(242, 116, 31, 0.15); }

.p-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 11px;
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.p-btn:active { transform: scale(0.98); }
.p-btn-primary {
  background: linear-gradient(135deg, var(--primary-400), var(--primary-600));
  color: #fff;
  box-shadow: 0 10px 26px -10px rgba(242, 116, 31, 0.7);
}
.p-btn-primary:hover { box-shadow: 0 14px 32px -10px rgba(242, 116, 31, 0.85); color: #fff; }
.p-btn-ghost {
  border-color: rgba(180, 191, 205, 0.28);
  color: var(--text-hi);
  background: rgba(255, 255, 255, 0.02);
}
.p-btn-ghost:hover { border-color: var(--primary-500); background: rgba(242, 116, 31, 0.06); }
.p-btn-block { width: 100%; margin-top: 22px; }

.p-alert {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
  margin-bottom: 18px;
}
.p-alert-ok {
  background: rgba(79, 214, 149, 0.1);
  border-color: rgba(79, 214, 149, 0.35);
  color: #8ce8bd;
}

.p-foot { font-size: 0.88rem; color: var(--text-low); margin-top: 18px; text-align: center; }
.p-forgot { background: rgba(242, 116, 31, 0.07); border-radius: 10px; padding: 12px; }

.p-license-card { }
.p-license-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.p-plan-name { font-family: var(--font-display); font-weight: 700; color: var(--text-hi); text-transform: capitalize; }

.p-badge {
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.p-badge-active { background: rgba(79, 214, 149, 0.15); color: var(--green); }
.p-badge-blocked { background: rgba(239, 68, 68, 0.15); color: var(--red); }
.p-badge-expired { background: rgba(245, 166, 35, 0.15); color: var(--yellow); }

.p-kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid rgba(180, 191, 205, 0.08); font-size: 0.9rem; }
.p-kv span { color: var(--text-low); }
.p-kv strong { color: var(--text-hi); }
.p-green { color: var(--green) !important; }
.p-yellow { color: var(--yellow) !important; }
.p-red { color: var(--red) !important; }
.p-muted { color: var(--text-low) !important; }

.p-license-key-row { flex-direction: column; align-items: flex-start; gap: 6px; }
.p-license-key {
  display: block;
  width: 100%;
  padding: 11px 13px;
  background: #050d1a;
  border: 1px solid var(--dark-600);
  border-radius: 10px;
  color: var(--primary-400);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92rem;
  word-break: break-all;
}

/* ---------- Setup instructions ("¿Cómo configurar KiraStream?") ---------- */
.p-setup-option { padding: 16px 0; border-bottom: 1px solid rgba(180, 191, 205, 0.08); }
.p-setup-option:first-of-type { padding-top: 10px; }
.p-setup-option:last-of-type { border-bottom: none; padding-bottom: 4px; }
.p-setup-option-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 12px; }
.p-setup-option-head .p-price-icon { margin-bottom: 0; flex: none; }
.p-setup-option-head h4 { margin: 0 0 4px; font-size: 0.95rem; }
.p-setup-option-head .p-note { margin: 0; }
.p-setup-option .p-btn { margin-left: 54px; }
@media (max-width: 480px) {
  .p-setup-option-head { gap: 10px; }
  .p-setup-option .p-btn { margin-left: 0; width: 100%; }
}

.p-install-block { margin-top: 20px; padding-top: 20px; border-top: 1px solid rgba(180, 191, 205, 0.1); }
.p-code-block {
  background: #050d1a;
  border: 1px solid var(--dark-600);
  border-radius: 10px;
  padding: 13px 15px;
  color: var(--text-hi);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  overflow-x: auto;
}
.p-note { font-size: 0.8rem; color: var(--text-low); }

/* ---------- Payment method picker (upgrade.html) ---------- */
.p-method-grid {
  display: flex;
  gap: 8px;
  margin: 4px 0 4px;
}

.p-method-option { position: relative; display: flex; flex: 1 1 0; min-width: 0; }
.p-method-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.p-method-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: 10px;
  border: 1px solid var(--dark-600);
  background: #050d1a;
  font-size: 0.78rem;
  color: var(--text-mid);
  transition: border-color 0.15s ease, background 0.15s ease;
  width: 100%;
  min-height: 68px;
  text-align: center;
}
.p-method-card svg { width: 18px; height: 18px; color: var(--primary-400); flex: none; }
.p-method-card .p-method-label {
  font-weight: 700;
  color: var(--text-hi);
  line-height: 1.25;
}
.p-method-card .p-method-note {
  font-size: 0.68rem;
  color: var(--text-low);
  line-height: 1.3;
}
.p-method-option input:checked ~ .p-method-card {
  border-color: var(--primary-500);
  background: rgba(242, 116, 31, 0.08);
  box-shadow: 0 0 0 1px rgba(242, 116, 31, 0.35);
}
.p-method-option input:focus-visible ~ .p-method-card { outline: 2px solid var(--primary-500); outline-offset: 2px; }

@media (max-width: 480px) {
  .p-container { padding: 28px 16px 40px; }
  .p-card { padding: 22px; }
}

/* ---------- Upgrade page: wide container ---------- */
.p-container-wide { max-width: 1120px; }

.p-page-intro { text-align: center; max-width: 640px; margin: 0 auto 8px; }

/* ---------- Included-in-every-plan grid ---------- */
.p-included-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 32px 0 8px;
}
@media (min-width: 640px) { .p-included-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 940px) { .p-included-grid { grid-template-columns: repeat(3, 1fr); } }

.p-included-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--dark-800);
  border: 1px solid rgba(180, 191, 205, 0.1);
  border-radius: 12px;
  padding: 13px 16px;
}
.p-included-item svg { width: 18px; height: 18px; color: var(--primary-400); flex: none; }
.p-included-item span { font-size: 0.85rem; font-weight: 600; color: var(--text-hi); }

.p-included-note {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-low);
  margin: 16px auto 44px;
  max-width: 680px;
}

/* ---------- Pricing groups ---------- */
.p-group-label { text-align: center; margin: 8px 0 20px; }
.p-group-label h2 { font-size: 1.08rem; margin: 0 0 4px; }
.p-group-label p { font-size: 0.82rem; color: var(--text-low); margin: 0; max-width: 520px; margin-left: auto; margin-right: auto; }

.p-pricing-grid { display: grid; grid-template-columns: 1fr; gap: 18px; margin-bottom: 44px; }
@media (min-width: 640px) {
  .p-pricing-grid-2 { grid-template-columns: 1fr 1fr; max-width: 760px; margin-left: auto; margin-right: auto; }
  .p-pricing-grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); max-width: 900px; margin-left: auto; margin-right: auto; }
  .p-pricing-grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 980px) {
  /* auto-fit, not a hardcoded repeat(4,...) — this row holds 4 plans
     (Starter, Pro, Business, Enterprise) and shouldn't need a CSS edit
     every time a plan is added or retired. */
  .p-pricing-grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}

.p-price-card {
  position: relative;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
  background-color: var(--dark-800);
  border: 1px solid rgba(180, 191, 205, 0.14);
  border-radius: var(--radius);
  padding: 28px 22px 24px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px -30px rgba(0, 0, 0, 0.6);
}
.p-price-featured {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 1px rgba(242, 116, 31, 0.4), 0 24px 56px -26px rgba(242, 116, 31, 0.5);
}

.p-price-badge-top {
  position: absolute;
  top: -12px;
  left: 22px;
  background: linear-gradient(135deg, var(--primary-400), var(--primary-600));
  color: #fff;
  font-size: 0.66rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.p-price-icon {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(135deg, rgba(242, 116, 31, 0.18), rgba(242, 116, 31, 0.05));
  border: 1px solid rgba(242, 116, 31, 0.22);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.p-price-icon svg { width: 20px; height: 20px; color: var(--primary-400); }

.p-price-card h3.p-plan-name { font-size: 1.1rem; margin-bottom: 2px; }
.p-price-users { font-size: 0.78rem; color: var(--primary-400); font-weight: 700; margin: 0 0 18px; }

/* Period toggle (segmented control) */
.p-period-toggle {
  display: flex; gap: 5px;
  background: #050d1a; border: 1px solid var(--dark-600); border-radius: 10px;
  padding: 4px; margin-bottom: 14px;
}
/* flex-basis:0 + min-width:0 is what actually forces a true 50/50 split —
   plain `flex:1` alone still respects each item's intrinsic content width
   as a floor (min-width:auto by default), so "Cada 6 meses" being longer
   than "Mensual" was quietly stealing extra space from its sibling. */
.p-period-opt { flex: 1 1 0; min-width: 0; position: relative; }
.p-period-opt input {
  position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer;
}
.p-period-opt span {
  display: block; text-align: center; padding: 8px 6px;
  border-radius: 7px; font-size: 0.74rem; font-weight: 700; color: var(--text-low);
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.p-period-opt input:checked ~ span { background: var(--primary-500); color: #fff; }

.p-price-amount-row { display: flex; align-items: baseline; gap: 5px; margin-bottom: 2px; }
.p-price-amount { font-family: var(--font-display); font-size: 1.75rem; font-weight: 800; color: var(--text-hi); }
.p-price-period-txt { font-size: 0.78rem; color: var(--text-low); }
.p-price-save-note {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.7rem; color: var(--primary-400); font-weight: 800;
  background: rgba(242, 116, 31, 0.12); border: 1px solid rgba(242, 116, 31, 0.3);
  padding: 2px 9px; border-radius: 999px; margin: 0 0 18px;
}
.p-price-save-note svg { width: 11px; height: 11px; }
.p-price-save-note.p-hidden { visibility: hidden; }

.p-price-card form { margin-top: auto; }
.p-price-card .p-method-grid { margin-top: 4px; }
.p-method-hint { font-size: 0.72rem; color: var(--text-low); margin: 8px 0 0; }

/* ---------- Buy-crypto-with-card providers (invoice.html) ---------- */
.p-provider-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 4px; }
.p-provider-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--dark-600);
  background: #050d1a;
}
.p-provider-info { display: flex; align-items: center; gap: 10px; }
.p-provider-info svg { width: 20px; height: 20px; color: var(--primary-400); flex: none; }
.p-provider-name { font-weight: 700; color: var(--text-hi); font-size: 0.88rem; display: block; }
.p-provider-desc { font-size: 0.72rem; color: var(--text-low); }
.p-provider-item .p-btn { padding: 8px 16px; font-size: 0.8rem; flex: none; }

/* ---------- Authenticated panel shell (Resumen/Instalación/Cuenta/Facturación) ---------- */
.p-shell { display: flex; min-height: 100vh; }

.p-sidebar {
  width: 232px; flex: none; background: rgba(4, 11, 22, 0.5);
  border-right: 1px solid rgba(180, 191, 205, 0.1);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; padding: 22px 16px;
}

.p-sidebar .p-brand { padding: 0 8px 22px; }

.p-sidebar-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.p-sidebar-nav a {
  display: block; padding: 10px 12px; border-radius: 10px;
  color: var(--text-low); font-size: 14px; font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}
.p-sidebar-nav a:hover { color: var(--text-hi); background: rgba(247, 249, 252, 0.05); text-decoration: none; }
.p-sidebar-nav a.active { color: var(--primary-400); background: rgba(242, 116, 31, 0.12); }

.p-sidebar-foot { border-top: 1px solid rgba(180, 191, 205, 0.1); padding-top: 14px; margin-top: 10px; display: flex; flex-direction: column; gap: 3px; }
.p-sidebar-foot a { display: block; padding: 10px 12px; border-radius: 10px; color: var(--text-low); font-size: 14px; font-weight: 600; }
.p-sidebar-foot a:hover { color: var(--text-hi); background: rgba(247, 249, 252, 0.05); text-decoration: none; }
.p-sidebar-foot a.p-logout:hover { color: #fca5a5; background: rgba(239, 68, 68, 0.08); }

.p-main { flex: 1; min-width: 0; }
.p-main .p-container { max-width: 760px; margin: 0; padding: 40px 44px 60px; }

@media (max-width: 860px) {
  .p-shell { flex-direction: column; }
  .p-sidebar {
    width: auto; height: auto; position: static; flex-direction: row;
    align-items: center; padding: 12px 16px; gap: 16px; overflow-x: auto;
  }
  .p-sidebar .p-brand { padding: 0; flex: none; }
  .p-sidebar-nav { flex-direction: row; flex: none; }
  .p-sidebar-nav a { white-space: nowrap; }
  .p-sidebar-foot { flex-direction: row; border: none; margin: 0 0 0 auto; padding: 0; }
  .p-main .p-container { padding: 28px 20px 44px; }
}

/* ---------- Facturación ---------- */
.p-billing-table { margin-top: 4px; }
.p-billing-empty { color: var(--text-low); font-size: 0.88rem; padding: 8px 0; }

/* ---------- Tables (Facturación) ---------- */
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid rgba(180, 191, 205, 0.1); }
th { color: var(--text-low); font-weight: 700; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr:hover td { background: rgba(247, 249, 252, 0.02); }
