/* cetVerse Referral — shared stylesheet */

:root {
  --primary: #3c64b1;
  --primary-dark: #1e3a8a;
  --primary-light: #5b82d4;
  --accent: #03a9f4;

  --bg: #f8faff;
  --surface: #f0f4ff;
  --card-bg: #ffffff;

  --text-primary: #0d1b4e;
  --text-secondary: #5a6a8a;
  --text-hint: #9aaac0;

  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --border: #dde3f0;

  --radius: 16px;
  --radius-sm: 14px;
  --shadow-card: 0 4px 16px rgba(60, 100, 177, 0.08);
  --header-gradient: linear-gradient(135deg, #1e3a8a, #3c64b1, #2d5ac8);
  --sidebar-width: 240px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

button {
  font-family: inherit;
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.hidden {
  display: none !important;
}

/* ---------------------------------------------------------------------- */
/* Buttons                                                                 */
/* ---------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(60, 100, 177, 0.28);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--surface);
  color: var(--primary-dark);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: #e6ecfb;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  transition: background 0.12s ease, color 0.12s ease;
}

.icon-btn:hover {
  background: var(--surface);
  color: var(--primary);
}

.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  background: #fff;
  color: #3c4043;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.google-btn:hover:not(:disabled) {
  box-shadow: 0 6px 18px rgba(60, 100, 177, 0.16);
}

/* ---------------------------------------------------------------------- */
/* Forms                                                                   */
/* ---------------------------------------------------------------------- */

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.form-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-field .hint {
  font-size: 12px;
  color: var(--text-hint);
}

.form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.form-row .form-field {
  flex: 1 1 160px;
}

input[type="text"],
input[type="date"],
input[type="number"],
input[type="email"],
input[type="password"] {
  font-family: inherit;
  font-size: 15px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(60, 100, 177, 0.12);
}

input.input-error {
  border-color: var(--error);
}

input.input-error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14);
}

.code-input-row {
  display: flex;
  gap: 10px;
}

.code-input-row input {
  flex: 1;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: "Courier New", monospace;
  font-weight: 600;
}

.field-error {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--error);
  font-weight: 500;
}

.radio-group {
  display: flex;
  gap: 10px;
}

.radio-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}

.radio-pill input {
  accent-color: var(--primary);
}

.radio-pill:has(input:checked) {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: #eaf0fd;
}

.value-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.value-input-wrap input {
  flex: 1;
}

.value-unit {
  font-weight: 700;
  color: var(--primary-dark);
  min-width: 20px;
  text-align: center;
}

/* ---------------------------------------------------------------------- */
/* Banners / toasts                                                        */
/* ---------------------------------------------------------------------- */

.banner {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 16px;
}

.banner-error {
  background: #fdecec;
  color: #b91c1c;
  border: 1px solid #f7c9c9;
}

.toast-root {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 1000;
  pointer-events: none;
}

.toast {
  background: var(--text-primary);
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(13, 27, 78, 0.3);
  animation: toast-in 0.18s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------------------------------------------------------------------- */
/* Cards                                                                    */
/* ---------------------------------------------------------------------- */

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 24px;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.card-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* ---------------------------------------------------------------------- */
/* Status badges                                                           */
/* ---------------------------------------------------------------------- */

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-active {
  background: #e3f9ef;
  color: #0a8a5c;
}

.status-upcoming {
  background: #e8edf9;
  color: #3c4f8a;
}

.status-expired {
  background: #fdecec;
  color: #b91c1c;
}

.status-exhausted {
  background: #fef3d9;
  color: #a3690a;
}

.status-disabled {
  background: #eceef2;
  color: #6b7280;
}

/* ---------------------------------------------------------------------- */
/* Index / hero                                                            */
/* ---------------------------------------------------------------------- */

.hero {
  background: var(--header-gradient);
  color: #fff;
  padding: 48px 20px 64px;
  text-align: center;
}

.hero-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  margin: 0 auto 20px;
  background: rgba(255, 255, 255, 0.15);
  object-fit: cover;
}

.hero-wordmark {
  font-size: 22px;
  font-weight: 700;
  margin: 0 auto 20px;
}

.hero h1 {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
  max-width: 420px;
  margin: 0 auto 12px;
}

.hero p {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.85);
  max-width: 380px;
  margin: 0 auto;
}

.index-main {
  max-width: 420px;
  margin: -34px auto 60px;
  padding: 0 20px;
}

.signin-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(30, 58, 138, 0.16);
  padding: 28px 24px;
  text-align: center;
}

.signin-card h2 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 6px;
}

.signin-card .card-subtitle {
  margin-bottom: 22px;
}

.perks {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.perks li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.perks li::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.index-footer {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-hint);
  padding: 0 20px 40px;
}

.index-footer a {
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
}

/* ---------------------------------------------------------------------- */
/* App shell (dashboard.html / master-dashboard.html)                      */
/* ---------------------------------------------------------------------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex: none;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}

.sidebar-brand img {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.sidebar-brand span {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-dark);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: auto;
}

.sidebar-user img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.sidebar-user .avatar-fallback {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.sidebar-user-info {
  min-width: 0;
}

.sidebar-user-info .name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-info .role {
  font-size: 11.5px;
  color: var(--text-hint);
}

.sidebar #sign-out-btn {
  margin-top: 20px;
}

.topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-brand img {
  width: 26px;
  height: 26px;
  border-radius: 7px;
}

.topbar-brand span {
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 15px;
}

.app-main {
  flex: 1;
  min-width: 0;
  padding: 32px;
  max-width: 880px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.stat-strip {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.stat-tile {
  flex: 1 1 140px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  padding: 16px 18px;
}

.stat-tile .stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary-dark);
}

.stat-tile .stat-label {
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 500;
}

.section-gap {
  margin-top: 28px;
}

/* ---------------------------------------------------------------------- */
/* Coupon cards                                                            */
/* ---------------------------------------------------------------------- */

.coupon-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.coupon-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
  border: 1px solid var(--border);
}

.coupon-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.coupon-code-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.coupon-code {
  font-family: "Courier New", monospace;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--primary-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coupon-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.coupon-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
}

.meta-label {
  color: var(--text-hint);
  font-weight: 500;
}

.meta-value {
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
}

.toggle-redemptions-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  background: var(--surface);
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-dark);
}

.toggle-redemptions-btn .chevron-icon {
  transition: transform 0.15s ease;
}

.toggle-redemptions-btn.is-open .chevron-icon {
  transform: rotate(180deg);
}

.redemptions-panel {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.redemptions-loading,
.redemptions-empty,
.coupon-empty-note {
  font-size: 13px;
  color: var(--text-hint);
  padding: 8px 2px;
}

.redemption-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 12.5px;
}

.redemption-main {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 600;
}

.redemption-plan {
  color: var(--text-secondary);
  font-weight: 500;
}

.redemption-amounts {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.amount-before {
  color: var(--text-hint);
  text-decoration: line-through;
}

.amount-after {
  color: var(--text-primary);
  font-weight: 700;
}

.discount-tag {
  background: #e3f9ef;
  color: #0a8a5c;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
}

.redemption-date {
  color: var(--text-hint);
}

/* ---------------------------------------------------------------------- */
/* Empty state                                                             */
/* ---------------------------------------------------------------------- */

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-hint);
  font-size: 13.5px;
}

/* ---------------------------------------------------------------------- */
/* Referrer rows (master dashboard)                                        */
/* ---------------------------------------------------------------------- */

.referrer-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.referrer-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  overflow: hidden;
}

.referrer-card-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  background: transparent;
  border: none;
  text-align: left;
  flex-wrap: wrap;
}

.referrer-identity {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
}

.referrer-name {
  font-weight: 600;
  font-size: 14.5px;
}

.referrer-email {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.referrer-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.referrer-stat strong {
  color: var(--primary-dark);
  font-size: 14px;
}

.referrer-chevron {
  display: flex;
  color: var(--text-hint);
  transition: transform 0.15s ease;
}

.referrer-card-header.is-open .referrer-chevron {
  transform: rotate(180deg);
}

.referrer-drilldown {
  padding: 4px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

/* ---------------------------------------------------------------------- */
/* Master login                                                            */
/* ---------------------------------------------------------------------- */

.centered-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--surface);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 32px 28px;
}

.login-card .sidebar-brand,
.login-card .brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.brand-row img {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}

.brand-row span {
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 16px;
}

.login-card h1 {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 4px;
}

.login-card .card-subtitle {
  margin-bottom: 22px;
}

/* ---------------------------------------------------------------------- */
/* Responsive: sidebar -> topbar under 900px                               */
/* ---------------------------------------------------------------------- */

@media (max-width: 899px) {
  .sidebar {
    display: none;
  }

  .topbar {
    display: flex;
  }

  .app-shell {
    flex-direction: column;
  }

  .app-main {
    padding: 20px 16px 48px;
    max-width: 100%;
  }
}

@media (min-width: 900px) {
  .topbar {
    display: none;
  }
}

@media (max-width: 480px) {
  .referrer-card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .referrer-chevron {
    display: none;
  }
}

/* Master dashboard: discount enable/disable toggle */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  user-select: none;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}
