/* NindoTV Customer Portal — premium, streaming-inspired SaaS look.
   Self-contained, no framework, no external fonts (system stack only —
   keeps this fully offline/shared-hosting-safe with zero network deps). */

:root {
  --brand: #6d5bf7;
  --brand-dark: #5745e6;
  --brand-soft: #efeaff;
  --bg: #f6f5fb;
  --surface: #ffffff;
  --surface-alt: #f9f8fd;
  --border: #e6e3f2;
  --text: #1c1b2e;
  --text-muted: #6b6880;
  --text-faint: #9b98ac;
  --success: #16a37a;
  --success-soft: #e3f8f1;
  --warning: #d9840a;
  --warning-soft: #fdf1de;
  --danger: #e2493d;
  --danger-soft: #fce9e7;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(28, 27, 46, 0.06);
  --shadow-md: 0 8px 24px rgba(28, 27, 46, 0.08);
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
h1, h2 { margin: 0; font-weight: 700; }
p { margin: 0; }

.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), #a78bfa);
  display: inline-block;
}
.brand-mark-lg { width: 52px; height: 52px; border-radius: 14px; }

/* ---------- App shell (desktop: sidebar + main col) ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-5) var(--space-4); font-weight: 800; font-size: 17px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 var(--space-3); flex: 1; }
.sidebar-nav a {
  display: flex; align-items: center; gap: var(--space-3); padding: 10px var(--space-3);
  border-radius: var(--radius-sm); color: var(--text-muted); font-weight: 600; font-size: 13.5px;
}
.sidebar-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-nav a:hover { background: var(--surface-alt); color: var(--text); }
.sidebar-nav a.active { background: var(--brand-soft); color: var(--brand-dark); }
.sidebar-nav-bottom { margin-top: auto; padding-bottom: var(--space-4); border-top: 1px solid var(--border); padding-top: var(--space-3); }
.sidebar-logout-btn {
  display: flex; align-items: center; gap: var(--space-3); width: 100%; padding: 10px var(--space-3);
  border: none; background: none; border-radius: var(--radius-sm); color: var(--text-muted); font-weight: 600; font-size: 13.5px; cursor: pointer;
}
.sidebar-logout-btn:hover { background: var(--danger-soft); color: var(--danger); }
.sidebar-logout-btn svg { width: 18px; height: 18px; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4) var(--space-5); background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-weight: 700; font-size: 16px; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: var(--space-3); }
.mobile-menu-toggle { display: none; background: none; border: none; cursor: pointer; padding: 4px; color: var(--text); }
.mobile-menu-toggle svg { width: 22px; height: 22px; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-muted);
}
.icon-btn:hover { background: var(--surface-alt); }

.topbar-user { display: flex; align-items: center; gap: var(--space-2); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
.user-name { font-weight: 600; font-size: 13.5px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dropdown { position: relative; }
.dropdown-panel {
  display: none; position: absolute; inset-inline-end: 0; top: calc(100% + 6px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); min-width: 140px; padding: var(--space-2); z-index: 20;
}
.dropdown.open .dropdown-panel { display: block; }
.dropdown-panel form { margin: 0; }
.dropdown-item {
  display: block; width: 100%; text-align: start; padding: 8px 10px; border-radius: var(--radius-sm);
  border: none; background: none; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--text-muted);
}
.dropdown-item:hover { background: var(--surface-alt); }
.dropdown-item.active { color: var(--brand-dark); background: var(--brand-soft); }

.page-content { padding: var(--space-5); flex: 1; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-5); gap: var(--space-3); }
.page-header h1 { font-size: 22px; }
.section-title { font-size: 15px; font-weight: 700; margin: var(--space-6) 0 var(--space-4); }

.mobile-nav { display: none; }
.mobile-sidebar-overlay { display: none; }

/* ---------- Alerts ---------- */
.alert-banner {
  background: var(--danger-soft); color: var(--danger); border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4); margin-bottom: var(--space-4); font-weight: 600; font-size: 13.5px;
}
.alert-banner.alert-success { background: var(--success-soft); color: var(--success); }
/* Redeem live-preview card values (structured .detail-fields nested inside
   the green alert-banner) — labels/pill already have their own explicit
   color, only the plain value text needs a legibility override so it isn't
   green-on-green. */
.code-preview-fields .detail-field span:last-child { color: var(--text); }

/* ---------- Redeem Code CTA (dashboard) — deliberately quiet, one line, never a modal/popup ---------- */
.redeem-cta {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  background: var(--brand-soft); color: var(--brand-dark); border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4); margin-bottom: var(--space-5);
  font-weight: 700; font-size: 13.5px; text-decoration: none; transition: background 0.15s;
}
.redeem-cta:hover { background: #e4ddff; }
.redeem-cta svg { flex-shrink: 0; }
.redeem-actions { display: flex; flex-direction: column; gap: var(--space-3); }
.redeem-account-card {
  border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4);
  margin-bottom: var(--space-3); display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3); flex-wrap: wrap;
}
.redeem-account-info .cred-value { display: block; }
.redeem-account-info .cred-label { display: block; margin-top: 2px; }

/* ---------- Template selection (Choose Your Template) ---------- */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-3); }
.template-card {
  position: relative; display: flex; align-items: center; justify-content: center; text-align: center;
  border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4);
  cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease;
}
.template-card:hover { border-color: var(--brand); }
.template-card input[type="radio"] { position: absolute; inset-inline-start: var(--space-3); top: var(--space-3); margin: 0; }
.template-card:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); }
.template-card-label { font-weight: 600; padding-inline-start: var(--space-4); }
.template-selected-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap;
}

/* ---------- Cards / stats ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-5); box-shadow: var(--shadow-sm);
}
.card-title { font-weight: 700; font-size: 15px; }
.card-narrow { max-width: 480px; }

/* MAG entry card (/redeem) — a clearly separated, secondary purple/outlined
   card pointing at the isolated /redeem/mag flow; deliberately never styled
   like the primary M3U code form above it, so the two are never confused. */
.mag-entry-card {
  border: 1.5px solid var(--brand);
  background: var(--brand-soft);
  margin-top: var(--space-5);
  display: flex; flex-direction: column; gap: var(--space-2);
}
.mag-entry-card .card-title { color: var(--brand-dark); }
.mag-entry-card p { color: var(--text-muted); font-size: 13.5px; margin-bottom: var(--space-2); }
.input-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.03em; text-transform: uppercase; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }
.divider { height: 1px; background: var(--border); margin: var(--space-4) 0; border: none; }
.mb-3 { margin-bottom: var(--space-3); }
.mt-3 { margin-top: var(--space-3); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-5); }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5); box-shadow: var(--shadow-sm);
}
.stat-card-warning { border-color: var(--warning); background: var(--warning-soft); }
.stat-label { font-size: 12px; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 800; }
.stat-value-sm { font-size: 17px; }

.detail-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--space-5); align-items: start; }
.detail-fields { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.detail-field { display: flex; flex-direction: column; gap: 4px; }
.detail-field span:last-child { font-weight: 600; }

/* ---------- Account cards ---------- */
.account-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--space-4); }
.account-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); overflow: hidden; display: flex; flex-direction: column;
}
.account-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-4) 0; }
.account-card-title { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.account-card-body { padding: var(--space-4); display: flex; flex-direction: column; gap: 10px; }
.account-card-footer { padding: var(--space-4); border-top: 1px solid var(--border); background: var(--surface-alt); }

.cred-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.cred-label { font-size: 12px; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.02em; }
.cred-value { font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px; }
.cred-value-group { display: flex; align-items: center; gap: 6px; }
.icon-btn-sm {
  width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-muted); flex-shrink: 0;
}
.icon-btn-sm:hover { background: var(--surface-alt); color: var(--text); }
.icon-btn-sm.is-copied { background: var(--success-soft); color: var(--success); border-color: var(--success); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px);
  background: var(--text); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow-md); z-index: 100;
  opacity: 0; pointer-events: none; transition: opacity 0.18s ease, transform 0.18s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.expiry-info { display: flex; flex-direction: column; gap: 2px; }
.expiry-date { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.days-remaining { font-weight: 700; font-size: 13.5px; }
.status-text-active, .status-text-neutral { color: var(--success); }
.status-text-expiring { color: var(--warning); }
.status-text-expired { color: var(--danger); }

/* Renewal Center (/renew) — Expiry Reminder & Renewal Center (isolated feature). */
.account-card-urgent { border-color: var(--warning); box-shadow: 0 0 0 1px var(--warning); }
.btn-whatsapp { background: var(--success); color: #fff; }
.btn-whatsapp:hover { background: var(--success); opacity: 0.9; }
.renewal-card-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); padding: 0 var(--space-4) var(--space-4); }
.renewal-card-actions .btn { flex: 1; white-space: nowrap; }
.renewal-card-feedback { margin: 0 var(--space-4) var(--space-4); padding: 8px 12px; border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 600; }
.renewal-card-feedback.is-success { background: var(--success-soft); color: var(--success); }
.renewal-card-feedback.is-error { background: var(--danger-soft); color: var(--danger); }

.status-pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.status-active { background: var(--success-soft); color: var(--success); }
.status-expiring { background: var(--warning-soft); color: var(--warning); }
.status-expired { background: var(--danger-soft); color: var(--danger); }
.status-neutral { background: var(--surface-alt); color: var(--text-muted); }

/* ---------- Quick filters ---------- */
.quick-filters { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-5); }
.quick-filter {
  padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  font-weight: 600; font-size: 13px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px;
}
.quick-filter.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.quick-filter .count { font-size: 11.5px; opacity: 0.8; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; min-width: 480px; }
.data-table th { text-align: start; font-size: 11.5px; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.02em; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.data-table tr:last-child td { border-bottom: none; }
.cell-name { font-weight: 700; }
.cell-muted { color: var(--text-muted); }

/* ---------- Timeline ---------- */
.timeline { display: flex; flex-direction: column; gap: var(--space-4); }
.timeline-item { padding-inline-start: var(--space-4); border-inline-start: 2px solid var(--border); position: relative; }
.timeline-item::before { content: ''; position: absolute; inset-inline-start: -5px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.timeline-date { font-size: 11.5px; color: var(--text-faint); font-weight: 700; }
.timeline-label { font-size: 12.5px; color: var(--brand-dark); font-weight: 700; margin-top: 2px; }
.timeline-desc { font-size: 13.5px; margin-top: 2px; }

/* ---------- Buttons / inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--radius-sm); padding: 9px 16px; font-weight: 700; font-size: 13.5px;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-alt); }
.btn-outline-brand { background: transparent; color: var(--brand-dark); border-color: var(--brand); }
.btn-outline-brand:hover { background: #e4ddff; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: none; color: var(--brand); font-weight: 700; font-size: 13px; cursor: pointer; padding: 4px; }
.btn-link:disabled { color: var(--text-faint); cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-4); }
.field label { font-size: 12.5px; font-weight: 700; color: var(--text-muted); }
.input {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-alt); font-size: 14px; color: var(--text); font-family: inherit;
}
.input:focus { outline: none; border-color: var(--brand); background: var(--surface); }
.otp-input { text-align: center; letter-spacing: 10px; font-size: 22px; font-weight: 700; }

/* ---------- Auth pages ---------- */
.auth-body { background: linear-gradient(160deg, #efeaff 0%, #f6f5fb 55%); min-height: 100vh; }
.auth-lang-switch { display: flex; justify-content: flex-end; gap: 6px; padding: var(--space-4) var(--space-5); }
.lang-pill { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 700; color: var(--text-muted); cursor: pointer; }
.lang-pill.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.auth-page { display: flex; align-items: center; justify-content: center; padding: var(--space-5); min-height: calc(100vh - 60px); }
.auth-card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: var(--space-6); width: 100%; max-width: 400px; text-align: center; }
.error-card { max-width: 440px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); margin-bottom: var(--space-5); }
.auth-brand-name { font-weight: 800; font-size: 18px; }
.auth-headline { font-size: 20px; margin-bottom: var(--space-2); }
.auth-subtext { color: var(--text-muted); font-size: 13.5px; margin-bottom: var(--space-5); }
.auth-form { text-align: start; }
.auth-form .field label { text-align: start; }
.auth-resend-form { margin-top: var(--space-4); }
.auth-back-link { display: block; margin-top: var(--space-3); }

/* ---------- Support ---------- */
.support-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-4); }
.support-card { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); color: var(--text); }
.support-card svg { color: var(--brand); }
.support-card-title { font-weight: 700; font-size: 15px; }
.support-card-desc { color: var(--text-muted); font-size: 13px; }
.support-card-accent { background: var(--brand-soft); border-color: var(--brand); }
.support-card-accent svg { color: var(--brand-dark); }

/* ---------- Empty states ---------- */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-3); padding: var(--space-6); color: var(--text-muted); text-align: center; }
.empty-state svg { color: var(--text-faint); }
.empty-state-page { padding: var(--space-6) var(--space-5); }
.text-muted { color: var(--text-muted); }
.hint { font-size: 12.5px; color: var(--text-faint); }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .sidebar { position: fixed; inset-inline-start: -260px; top: 0; height: 100vh; z-index: 40; transition: inset-inline-start 0.2s ease; width: 240px; }
  .sidebar.open { inset-inline-start: 0; }
  .mobile-menu-toggle { display: inline-flex; }
  .mobile-sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(28,27,46,0.4); z-index: 30; }
  .mobile-sidebar-overlay.open { display: block; }

  .page-content { padding: var(--space-4); padding-bottom: 80px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-fields { grid-template-columns: 1fr; }
  .account-grid { grid-template-columns: 1fr; }
  .user-name { display: none; }

  .mobile-nav {
    display: flex; position: fixed; bottom: 0; inset-inline-start: 0; inset-inline-end: 0; z-index: 20;
    background: var(--surface); border-top: 1px solid var(--border); padding: 6px var(--space-2);
    justify-content: space-around;
  }
  .mobile-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--text-faint); font-size: 10px; font-weight: 700; padding: 4px; }
  .mobile-nav a svg { width: 20px; height: 20px; }
  .mobile-nav a.active { color: var(--brand); }
}

@media (min-width: 861px) {
  .mobile-sidebar-overlay { display: none !important; }
}

/* ==========================================================================
   /redeem/renew — page-isolated redesign. Every rule below is scoped under
   .redeem-renew-page and touches nothing outside it (status-pill/.btn base
   classes are reused as-is, not redefined). See views/pages/redeem-renew-
   select.php. Do not add unscoped rules to this block.
   ========================================================================== */

.redeem-renew-page {
  max-width: 860px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4) 64px;
  position: relative;
  overflow-x: hidden; /* clips the ::before gradient's intentional bleed below — it must never cause page-level horizontal scroll */
}

.redeem-renew-page::before {
  content: '';
  position: absolute;
  inset: -32px -32px auto -32px;
  height: 320px;
  background: radial-gradient(60% 100% at 50% 0%, var(--brand-soft) 0%, rgba(239, 234, 255, 0) 70%);
  z-index: -1;
  pointer-events: none;
}

.redeem-renew-page .rrp-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.redeem-renew-page .rrp-hero-text h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 var(--space-2);
}

.redeem-renew-page .rrp-hero-subtitle {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.5;
  margin: 0;
  max-width: 52ch;
}

.redeem-renew-page .rrp-back-btn {
  flex-shrink: 0;
  border-radius: var(--radius-md);
}

.redeem-renew-page .rrp-account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: var(--space-4);
}

.redeem-renew-page .rrp-account-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-width: 0; /* grid items default to min-width:auto — without this, a flex-container card won't shrink below its content's min-content width and overflows its grid track */
  transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.redeem-renew-page .rrp-account-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #d7d0f5;
  transform: translateY(-1px);
}

.redeem-renew-page .rrp-account-main {
  min-width: 0; /* allow the long-username case to actually truncate instead of pushing the card wider */
  flex: 1;
}

.redeem-renew-page .rrp-account-top {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.redeem-renew-page .rrp-account-badge {
  display: inline-block;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: 999px;
}

.redeem-renew-page .rrp-account-username {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: var(--space-1);
}

.redeem-renew-page .rrp-account-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.redeem-renew-page .rrp-dot { color: var(--text-faint); }

.redeem-renew-page .rrp-account-days {
  display: inline-block;
  margin-top: var(--space-3);
  font-size: 12.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
}

.redeem-renew-page .rrp-days-active { background: var(--success-soft); color: var(--success); }
.redeem-renew-page .rrp-days-expiring { background: var(--warning-soft); color: var(--warning); }
.redeem-renew-page .rrp-days-expired { background: var(--danger-soft); color: var(--danger); }

.redeem-renew-page .rrp-account-action {
  flex-shrink: 0;
}

.redeem-renew-page .rrp-confirm-btn {
  padding: 12px 22px;
  font-size: 14.5px;
  font-weight: 700;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(109, 91, 247, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.redeem-renew-page .rrp-confirm-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(109, 91, 247, 0.34);
}

.redeem-renew-page .rrp-confirm-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(109, 91, 247, 0.28);
}

.redeem-renew-page .rrp-confirm-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.redeem-renew-page .rrp-empty-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6) var(--space-5);
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
}

.redeem-renew-page .rrp-empty-card .rrp-confirm-btn {
  margin-top: var(--space-4);
}

@media (max-width: 1024px) {
  .redeem-renew-page .rrp-account-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .redeem-renew-page { padding: var(--space-4) var(--space-3) 48px; }
  .redeem-renew-page .rrp-hero { flex-direction: column; align-items: stretch; }
  .redeem-renew-page .rrp-hero-text h1 { font-size: 22px; }
  .redeem-renew-page .rrp-back-btn { align-self: flex-start; }
  .redeem-renew-page .rrp-account-card { flex-direction: column; align-items: stretch; }
  .redeem-renew-page .rrp-account-action,
  .redeem-renew-page .rrp-account-action .rrp-confirm-btn { width: 100%; }
}

/* ---------- 20-day renewal grace period (Renew, Subscriptions/expired) ---------- */
.renew-grace-banner {
  display: flex; align-items: flex-start; gap: var(--space-3);
  background: var(--brand-soft); color: var(--brand-dark); border-radius: var(--radius-md);
  padding: var(--space-4); margin-bottom: var(--space-5);
}
.renew-grace-banner svg { flex-shrink: 0; margin-top: 2px; }
.renew-grace-banner-title { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.renew-grace-banner-body { font-size: 13px; opacity: 0.9; }
/* The compact banner on /subscriptions?status=expired has no title/body split, just one line. */
.renew-grace-banner p:only-child { font-size: 13px; font-weight: 600; }

.renew-urgency-line { margin-top: 6px; font-size: 12.5px; font-weight: 700; color: var(--warning); }

.account-card-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.renew-badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.renew-badge-ok { background: var(--warning-soft); color: var(--warning); }
.renew-badge-ended { background: var(--danger-soft); color: var(--danger); }

.renewal-card-secondary { padding: 0 var(--space-4) var(--space-4); text-align: center; }
.renew-redeem-code-link { font-size: 12.5px; }

.account-card-ended { border-color: var(--border); }
.renewal-ended-state { padding: 0 var(--space-4) var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); }
.renewal-ended-title { font-weight: 700; font-size: 13.5px; color: var(--text); }
.renewal-ended-body { font-size: 12.5px; color: var(--text-muted); margin-bottom: 4px; }

/* ---------- Device Note (customer-writable, per subscription) ---------- */
.account-note-row { min-width: 0; }
.account-note-value {
  flex: 1; min-width: 0; text-align: end; margin-inline-start: var(--space-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.device-note-block { display: flex; flex-direction: column; gap: 8px; }
.device-note-display { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.device-note-text { font-weight: 600; font-size: 13.5px; }
.device-note-form { display: flex; flex-direction: column; gap: 8px; }
.device-note-textarea { resize: vertical; min-height: 44px; font-family: inherit; }
.device-note-form-actions { display: flex; gap: var(--space-2); }
.device-note-feedback { padding: 8px 12px; border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 600; }
.device-note-feedback.is-success { background: var(--success-soft); color: var(--success); }
.device-note-feedback.is-error { background: var(--danger-soft); color: var(--danger); }

/* ---------- Profile — support notice ---------- */
.profile-support-notice {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: var(--space-4) var(--space-5); margin-top: var(--space-4);
}
.profile-support-notice-title { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.profile-support-notice-body { font-size: 12.5px; color: var(--text-muted); }

@media (max-width: 640px) {
  .device-note-display { flex-direction: column; align-items: flex-start; gap: 6px; }
  .profile-support-notice { flex-direction: column; align-items: stretch; }
}

/* ---------- Complete Your Profile (Redeem flow gate) ---------- */
.phone-field-group { display: flex; gap: var(--space-2); }
.phone-field-group .phone-dial-select { flex: 0 0 42%; min-width: 0; }
.phone-field-group .phone-number-input { flex: 1; min-width: 0; }

@media (max-width: 480px) {
  .phone-field-group { flex-direction: column; }
  .phone-field-group .phone-dial-select { flex: 1; }
}
