@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
  --gradient-a: #f5f3ff;
  --gradient-b: #e4f2ff;
  --gradient-c: #ffe6f3;
  --gradient-d: #fff2d9;
  --primary: #5d4bff;
  --primary-dark: #4635d1;
  --accent: #ff7ac7;
  --accent-dark: #e664b1;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --shadow: 0 24px 60px rgba(68, 53, 130, 0.18);
  --text-dark: #0d1740;
  --text-light: #51608c;
  --transition: cubic-bezier(0.18, 0.72, 0.3, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-dark);
  min-height: 100vh;
  background: linear-gradient(140deg, var(--gradient-a) 0%, var(--gradient-b) 30%, var(--gradient-c) 65%, var(--gradient-d) 100%);
  position: relative;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary-dark);
  text-decoration: none;
  transition: color 0.3s var(--transition);
}

a:hover,
a:focus-visible {
  color: var(--accent-dark);
}

body::before,
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  opacity: 0.75;
  background-size: 200% 200%;
  animation: gradientShift 24s ease-in-out infinite;
}

body::before {
  background: linear-gradient(140deg, rgba(93, 75, 255, 0.18), rgba(255, 122, 199, 0.16), rgba(255, 188, 87, 0.18));
}

body::after {
  z-index: -1;
  opacity: 0.45;
  background: radial-gradient(circle at 20% 20%, rgba(93, 75, 255, 0.32), transparent 55%),
    radial-gradient(circle at 80% 35%, rgba(255, 122, 199, 0.26), transparent 60%),
    radial-gradient(circle at 40% 80%, rgba(255, 188, 87, 0.24), transparent 65%);
  animation: pulse 16s ease-in-out infinite;
}


main {
  flex: 1 0 auto;
  width: min(1100px, 94vw);
  margin: 0 auto;
  padding: 5rem 0 4rem;
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 2.5rem;
  align-items: stretch;
}

@media (max-width: 900px) {
  .login-layout {
    grid-template-columns: 1fr;
  }

  .metric-card-wide {
    grid-column: auto;
  }
}

body:not(.app-dashboard) header.navbar {
  width: min(1100px, 94vw);
  margin: 1.5rem auto 0;
  padding: 1.25rem 1.75rem;
  border-radius: 1.5rem;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  position: sticky;
  top: 1rem;
  backdrop-filter: blur(18px);
  z-index: 10;
}


.admin-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  margin: 0 0 0.5rem;
  background: var(--surface);
  border-radius: 1.35rem;
  border: 1px solid rgba(93, 75, 255, 0.14);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}

.admin-title {
  flex: 1;
  min-width: 220px;
}

.admin-title h1 {
  margin: 0;
  font-size: 1.6rem;
}

.admin-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-left: auto;
}

.admin-actions .btn {
  padding: 0.75rem 1.35rem;
  white-space: nowrap;
}

.admin-actions .btn.secondary {
  color: var(--text-dark);
}

.admin-dashboard-page {
  padding: 2.5rem 1.75rem 4.5rem;
}

.admin-dashboard {
  max-width: none;
  width: 100%;
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

@media (max-width: 720px) {
  .admin-dashboard-page {
    padding: 2rem 1.1rem 3.5rem;
  }

  .admin-dashboard {
    gap: 1.5rem;
  }
}

.admin-tabs {
  display: inline-flex;
  gap: 0.75rem;
  padding: 0.35rem;
  background: var(--surface);
  border-radius: 999px;
  border: 1px solid rgba(93, 75, 255, 0.14);
  box-shadow: 0 14px 28px rgba(93, 75, 255, 0.18);
  align-self: flex-start;
}

.tab-pill {
  padding: 0.65rem 1.35rem;
  border-radius: 999px;
  font-weight: 700;
  color: var(--text-dark);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid transparent;
  box-shadow: 0 10px 20px rgba(13, 23, 64, 0.08);
  transition: transform 0.3s var(--transition), box-shadow 0.3s var(--transition), background 0.3s var(--transition);
}

.tab-pill:hover,
.tab-pill:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(93, 75, 255, 0.2);
}

.tab-pill.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border-color: transparent;
  box-shadow: 0 18px 32px rgba(93, 75, 255, 0.28);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.metric-card {
  position: relative;
  padding: 1rem 1.1rem 1.2rem;
  border-radius: 1.2rem;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.82)) padding-box,
    linear-gradient(135deg, rgba(93, 75, 255, 0.4), rgba(255, 122, 199, 0.42), rgba(255, 188, 87, 0.4)) border-box;
  border: 1px solid transparent;
  box-shadow: 0 20px 48px rgba(93, 75, 255, 0.25), 0 12px 24px rgba(8, 12, 54, 0.18);
  overflow: hidden;
  backdrop-filter: blur(10px);
  display: grid;
  gap: 0.55rem;
}

.metric-card::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: radial-gradient(circle at 18% 20%, rgba(93, 75, 255, 0.18), transparent 35%),
    radial-gradient(circle at 80% 0%, rgba(255, 122, 199, 0.18), transparent 36%),
    radial-gradient(circle at 20% 100%, rgba(255, 188, 87, 0.22), transparent 35%);
  pointer-events: none;
  opacity: 0.7;
}

.metric-card > * {
  position: relative;
  z-index: 1;
}

.metric-card-wide {
  grid-column: span 2;
}

.metric-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: linear-gradient(120deg, rgba(93, 75, 255, 0.16), rgba(255, 122, 199, 0.2));
  border: 1px solid rgba(93, 75, 255, 0.28);
  color: var(--text-dark);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.metric-divider {
  height: 3px;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--accent), #ffbc57);
  box-shadow: 0 12px 26px rgba(93, 75, 255, 0.28);
}

.metric-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-dark);
}

.metric-subtext {
  color: var(--text-light);
  font-size: 0.95rem;
  font-weight: 600;
}

.metric-pair {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.section-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem 1.2rem 0.75rem;
}

.section-header h2 {
  margin: 0 0 0.25rem;
}

.section-subtext {
  margin: 0;
  color: var(--text-light);
  font-weight: 500;
}

.chip-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  align-items: center;
  overflow-x: auto;
  padding: 0.25rem;
  margin: -0.25rem;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.chip-row .chip {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .chip-row {
    gap: 0.4rem;
  }

  .chip-row .chip {
    padding: 0.5rem 1rem;
  }
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.chip {
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(93, 75, 255, 0.14);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-dark);
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 16px rgba(13, 23, 64, 0.06);
  transition: transform 0.25s var(--transition), box-shadow 0.25s var(--transition), background 0.25s var(--transition);
}

.chip.secondary {
  background: rgba(93, 75, 255, 0.08);
}

.chip.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  box-shadow: 0 16px 28px rgba(93, 75, 255, 0.22);
  border-color: transparent;
}

.chip:hover,
.chip:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(93, 75, 255, 0.2);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: rgba(93, 75, 255, 0.08);
  font-weight: 700;
  text-transform: capitalize;
  border: 1px solid rgba(93, 75, 255, 0.18);
}

.status-open { background: rgba(255, 188, 87, 0.16); border-color: rgba(255, 188, 87, 0.4); }
.status-pending { background: rgba(255, 122, 199, 0.18); border-color: rgba(255, 122, 199, 0.32); }
.status-cpaa { background: rgba(93, 75, 255, 0.14); border-color: rgba(93, 75, 255, 0.32); }
.status-resolved { background: rgba(96, 223, 255, 0.18); border-color: rgba(96, 223, 255, 0.36); }
.status-closed { background: rgba(93, 75, 255, 0.16); border-color: rgba(93, 75, 255, 0.36); }
.status-invalid { background: rgba(255, 87, 87, 0.14); border-color: rgba(255, 87, 87, 0.32); color: #7a0b0b; }
.status-none { background: rgba(13, 23, 64, 0.05); border-color: rgba(13, 23, 64, 0.14); }
.status-plan { background: rgba(93, 75, 255, 0.1); border-color: rgba(93, 75, 255, 0.24); }

.link-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border-radius: 0.75rem;
  font-weight: 700;
  font-size: 0.9rem;
  background: rgba(93, 75, 255, 0.08);
  color: var(--primary-dark);
  border: 1px solid rgba(93, 75, 255, 0.18);
  box-shadow: 0 12px 18px rgba(93, 75, 255, 0.12);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.2s var(--transition), box-shadow 0.2s var(--transition), filter 0.2s var(--transition);
}

.link-action:hover,
.link-action:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(93, 75, 255, 0.18);
  filter: brightness(1.05);
}

.link-action:disabled,
.link-action[aria-disabled="true"] {
  opacity: 0.65;
  pointer-events: none;
}

.disabled-action {
  opacity: 0.55;
  cursor: not-allowed;
}

.row-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tickets-section,
.users-section,
.analytics-section {
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.86)) padding-box,
    linear-gradient(135deg, rgba(93, 75, 255, 0.38), rgba(255, 122, 199, 0.36), rgba(255, 188, 87, 0.32)) border-box;
  border: 1px solid transparent;
  border-radius: 1.4rem;
  box-shadow: 0 20px 48px rgba(93, 75, 255, 0.24), 0 12px 26px rgba(12, 8, 64, 0.12);
  overflow: hidden;
}

.tickets-section h2,
.users-section h2,
.analytics-section h2 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: 0.01em;
}

.tickets-section {
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.86)) padding-box,
    linear-gradient(135deg, rgba(93, 75, 255, 0.38), rgba(255, 122, 199, 0.36), rgba(255, 188, 87, 0.32)) border-box;
  border: 1px solid transparent;
  border-radius: 1.4rem;
  box-shadow: 0 20px 48px rgba(93, 75, 255, 0.24), 0 12px 26px rgba(12, 8, 64, 0.12);
  overflow: hidden;
}

.tickets-section h2 {
  margin: 0;
  padding: 1.1rem 1.25rem;
  font-size: 1.2rem;
  letter-spacing: 0.01em;
  border-bottom: 1px solid rgba(93, 75, 255, 0.12);
  background: linear-gradient(120deg, rgba(93, 75, 255, 0.1), rgba(255, 122, 199, 0.08));
}

.table-scroll {
  overflow-x: auto;
  width: 100%;
  box-sizing: border-box;
  padding: 0 0 1rem;
}

.tickets-table {
  width: 100%;
  border-collapse: collapse;
  min-width: min(680px, 100%);
}

.tickets-table th,
.tickets-table td {
  padding: 0.72rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid rgba(93, 75, 255, 0.08);
  font-size: 0.95rem;
}

.tickets-table .ticket-description-col {
  max-width: 420px;
  width: 32%;
}

.ticket-description-text {
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.tickets-table th {
  background: linear-gradient(120deg, rgba(93, 75, 255, 0.08), rgba(255, 122, 199, 0.08));
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.03em;
  color: var(--text-dark);
}

.tickets-table tr:hover {
  background: rgba(93, 75, 255, 0.06);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-dark);
  text-decoration: none;
}

.brand span.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.85rem;
  background: linear-gradient(140deg, rgba(93, 75, 255, 0.9), rgba(255, 122, 199, 0.85));
  color: white;
  font-size: 1.3rem;
  box-shadow: 0 12px 24px rgba(93, 75, 255, 0.25);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-light);
  font-weight: 500;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  transition: transform 0.35s var(--transition), box-shadow 0.35s var(--transition), color 0.35s var(--transition);
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text-dark);
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(93, 75, 255, 0.18);
}

.nav-links .cta {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  box-shadow: 0 16px 32px rgba(93, 75, 255, 0.25);
}

.hero {
  background: var(--surface-strong);
  border-radius: 2rem;
  padding: clamp(2.5rem, 5vw, 4rem);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2.75rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(93, 75, 255, 0.16), rgba(255, 122, 199, 0.12));
  mix-blend-mode: screen;
}

.hero-text {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hero-text h1,
.hero-text h2 {
  margin: 0;
  font-size: clamp(2.25rem, 5vw, 3.1rem);
  line-height: 1.15;
}

.hero-text p {
  margin: 0;
  color: var(--text-light);
  font-size: 1.05rem;
  max-width: 32ch;
}

/* App dashboard experience */
.app-dashboard {
  margin: 0;
  min-height: 100vh;
  color: #f7f5ff;
  background: radial-gradient(circle at 10% 20%, rgba(93, 75, 255, 0.3), transparent 30%),
    radial-gradient(circle at 80% 10%, rgba(255, 122, 199, 0.28), transparent 32%),
    linear-gradient(135deg, #0f0a2b, #251056 45%, #381677 70%, #5a2aa8 100%);
  font-family: 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow-x: hidden;
  position: relative;
}

.app-dashboard a {
  color: inherit;
}

.app-dashboard::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 30% 70%, rgba(255, 188, 87, 0.08), transparent 50%),
    radial-gradient(circle at 75% 55%, rgba(96, 223, 255, 0.12), transparent 45%);
  pointer-events: none;
  z-index: 0;
}

.app-dashboard canvas#bgCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  filter: brightness(1.05) blur(0.75px);
  mix-blend-mode: screen;
}

.app-dashboard .user-badge {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(93, 75, 255, 0.5), rgba(255, 122, 199, 0.45)) padding-box,
    linear-gradient(120deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08)) border-box;
  border: 1px solid transparent;
  color: #ffffff;
  box-shadow: 0 16px 32px rgba(8, 6, 38, 0.45), 0 10px 22px rgba(93, 75, 255, 0.28);
  text-decoration: none;
}

.app-dashboard .user-badge .label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 10px;
  background: linear-gradient(120deg, rgba(93, 75, 255, 0.7), rgba(255, 122, 199, 0.75));
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.app-dashboard .user-badge .value {
  font-weight: 700;
  font-size: 0.98rem;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

.app-dashboard .top-actions {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 2;
  display: flex;
  gap: 10px;
  align-items: center;
}

.app-dashboard .cancel-top-button,
.app-dashboard .logout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.25s var(--transition), box-shadow 0.25s var(--transition);
  box-shadow: 0 16px 32px rgba(8, 6, 38, 0.45);
}

.app-dashboard .cancel-top-button {
  background: linear-gradient(135deg, rgba(255, 94, 98, 0.28), rgba(255, 166, 43, 0.26));
  box-shadow: 0 14px 28px rgba(255, 94, 98, 0.24);
}

.app-dashboard .logout-button {
  background: linear-gradient(135deg, rgba(255, 94, 98, 0.28), rgba(93, 75, 255, 0.26));
}

.app-dashboard .cancel-top-button:hover,
.app-dashboard .cancel-top-button:focus-visible,
.app-dashboard .logout-button:hover,
.app-dashboard .logout-button:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 20px 36px rgba(93, 75, 255, 0.45);
}


.app-dashboard .main-app-wrapper {
  position: relative;
  width: 100%;
  min-height: 100vh;
}

.app-dashboard .container {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 24px auto 32px;
  padding: 26px 24px 32px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02)) padding-box,
    linear-gradient(135deg, rgba(93, 75, 255, 0.55), rgba(255, 122, 199, 0.45), rgba(255, 188, 87, 0.45)) border-box;
  border: 1px solid transparent;
  box-shadow: 0 24px 68px rgba(7, 3, 36, 0.65), 0 12px 28px rgba(93, 75, 255, 0.35);
  border-radius: 18px;
  backdrop-filter: blur(12px);
}

.app-topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  margin-bottom: 16px;
}

.app-topbar-left {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.app-plan-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
  color: #ffffff;
}

.app-plan-name {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
}

.app-topbar-username {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #ffffff;
}

.app-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-dashboard .account-pill {
  border: none;
  cursor: pointer;
  border-radius: 9999px;
  padding: 7px 14px;
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #ff6ac1, #7b5cff);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.app-dashboard .account-pill:hover,
.app-dashboard .account-pill:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.42);
}

.app-dashboard header.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  margin: 0 0 18px;
  width: 100%;
  box-sizing: border-box;
  border-radius: 16px;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 16px 32px rgba(8, 6, 38, 0.45);
  flex-wrap: wrap;
  gap: 12px;
  position: static;
}

.app-dashboard header.navbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  text-decoration: none;
  font-size: 1.2rem;
  letter-spacing: 0.01em;
  color: #fdfcff;
}

.app-dashboard header.navbar .nav-right {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
}

.app-dashboard .account-menu {
  position: relative;
  display: flex;
  align-items: center;
}

.app-dashboard .account-avatar {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.16);
  color: #0f0a2b;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 8px 18px rgba(10, 4, 48, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.app-dashboard .account-avatar:hover,
.app-dashboard .account-avatar:focus-visible {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.22);
  box-shadow: 0 12px 22px rgba(10, 4, 48, 0.45);
}

.app-dashboard .account-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  min-width: 200px;
  background: #1f2933;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
  padding: 6px 0;
  z-index: 20;
  font-size: 13px;
  color: #e5e7eb;
}

.app-dashboard .account-dropdown.hidden {
  display: none;
}


.app-dashboard .account-user {
  padding: 8px 14px 6px;
  font-size: 12px;
  color: #cbd5e1;
  font-weight: 600;
  line-height: 1.2;
  word-break: break-word;
}

.app-dashboard .account-divider {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 4px 0;
}

.app-dashboard .account-item {
  width: 100%;
  text-align: left;
  padding: 8px 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  font: inherit;
  color: #e5e7eb;
  transition: background 0.15s ease, color 0.15s ease;
}

.app-dashboard .account-item:hover,
.app-dashboard .account-item:focus-visible {
  background: rgba(255, 255, 255, 0.06);
}

.app-dashboard .plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 14px;
  background:
    linear-gradient(140deg, rgba(96, 216, 255, 0.15), rgba(160, 32, 240, 0.15)) padding-box,
    linear-gradient(120deg, rgba(93, 75, 255, 0.4), rgba(255, 122, 199, 0.35)) border-box;
  border: 1px solid transparent;
  box-shadow: 0 10px 26px rgba(10, 4, 48, 0.32), 0 6px 16px rgba(255, 122, 199, 0.16);
  white-space: nowrap;
}

.app-dashboard .plan-badge .label {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f5f1ff;
  opacity: 0.85;
}

.app-dashboard .plan-badge .value {
  font-weight: 700;
  color: #ffffff;
  font-size: 0.95rem;
}

.app-dashboard .plan-usage-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08)) padding-box,
    linear-gradient(120deg, rgba(93, 75, 255, 0.65), rgba(255, 122, 199, 0.55)) border-box;
  border: 1px solid transparent;
  box-shadow: 0 10px 26px rgba(10, 4, 48, 0.45), 0 6px 14px rgba(255, 122, 199, 0.18);
}

.app-dashboard .unlimited-banner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  margin: 10px 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  border-radius: 9999px;
  background: linear-gradient(135deg, #34d399, #10b981);
  box-shadow: 0 10px 20px rgba(16, 185, 129, 0.25);
}

.app-dashboard .plan-usage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.app-dashboard .plan-usage-summary,
.app-dashboard .plan-usage-remaining {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-dashboard .plan-usage-card .label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: linear-gradient(120deg, rgba(93, 75, 255, 0.75), rgba(255, 122, 199, 0.75));
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-size: 0.66rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #fefbff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.app-dashboard .plan-usage-card .value {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.01em;
}

.app-dashboard .plan-usage-progress {
  position: relative;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.25);
}

.app-dashboard .plan-usage-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00ffa3, #5d4bff, #ff7ac7);
  box-shadow: 0 0 12px rgba(255, 122, 199, 0.4);
  transition: width 0.4s ease;
}

.app-dashboard header.navbar nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.app-dashboard header.navbar nav a {
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(93, 75, 255, 0.2), rgba(255, 122, 199, 0.2));
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f9f8ff;
  font-weight: 600;
  font-size: 0.92rem;
  transition: transform 0.3s var(--transition), box-shadow 0.3s var(--transition);
}

.app-dashboard header.navbar nav .cancel-link {
  background: linear-gradient(135deg, rgba(255, 94, 98, 0.22), rgba(255, 166, 43, 0.2));
  border-color: rgba(255, 129, 133, 0.35);
  color: #fff5f5;
  box-shadow: 0 8px 16px rgba(255, 94, 98, 0.18);
}

.app-dashboard header.navbar .upgrade-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(93, 75, 255, 0.45), rgba(255, 122, 199, 0.4));
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.94rem;
  text-decoration: none;
  box-shadow: 0 14px 28px rgba(10, 4, 48, 0.4), 0 8px 18px rgba(255, 122, 199, 0.22);
  transition: transform 0.3s var(--transition), box-shadow 0.3s var(--transition);
  white-space: nowrap;
}

.app-dashboard header.navbar .upgrade-button:hover,
.app-dashboard header.navbar .upgrade-button:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(93, 75, 255, 0.5);
}

.app-dashboard header.navbar nav a:hover,
.app-dashboard header.navbar nav a:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(93, 75, 255, 0.35);
}

.app-dashboard .user-stats {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  justify-content: flex-start;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.app-dashboard .user-stats::-webkit-scrollbar {
  display: none;
}

.app-dashboard .user-stats .stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 8px;
  min-width: 0;
  max-width: 100%;
  flex-shrink: 0;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.05)) padding-box,
    linear-gradient(120deg, rgba(93, 75, 255, 0.45), rgba(255, 122, 199, 0.4)) border-box;
  border: 1px solid transparent;
  box-shadow: 0 10px 26px rgba(10, 4, 48, 0.45), 0 6px 14px rgba(255, 122, 199, 0.18);
  text-align: left;
}

.app-dashboard .user-stats .stat .label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px;
  border-radius: 10px;
  background: linear-gradient(120deg, rgba(93, 75, 255, 0.7), rgba(255, 122, 199, 0.75));
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-size: 0.66rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #fefbff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.app-dashboard .user-stats .stat .value {
  font-size: 0.86rem;
  font-weight: 600;
  margin-top: 0;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-dashboard .accent-divider {
  height: 4px;
  margin: 14px 0 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, #5d4bff, #ff7ac7, #5d4bff 70%, #ffbc57);
  box-shadow: 0 16px 32px rgba(93, 75, 255, 0.35), 0 10px 24px rgba(255, 122, 199, 0.28);
}

.app-dashboard .logo-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.app-dashboard .glow-avatar {
  height: 44px;
  animation: float-glow 3s ease-in-out infinite;
  filter: drop-shadow(0 0 10px #aa00ff);
}

.app-dashboard .logo-title h4 {
  font-size: 1.5rem;
  margin: 0;
  font-weight: 800;
  display: inline-block;
  letter-spacing: 0.02em;
}

.app-dashboard .logo-title .highlight {
  background: linear-gradient(90deg, #60d8ff, #a020f0, #ff7ac7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shine 2.25s linear infinite;
}

.app-dashboard .logo-title .subtitle {
  background: linear-gradient(90deg, #bce5ff, #eac8ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-dashboard #ebookForm {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

/* 2-column layout: topic/chapters stacked + genres */
.gen-form-row {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.35fr);
  gap: 22px;
  align-items: start;
  margin-top: 10px;
}

.gen-col {
  min-width: 0;
}

.topic-stack {
  display: grid;
  gap: 14px;
}

.topic-stack .form-row {
  max-width: 420px;
  width: 100%;
}

/* Keep genres box usable and not too tall in the row */
.genres-col .genres-container,
.genres-col .genres-box,
.genres-col .genre-list {
  max-height: 220px;
  overflow: auto;
}

/* Mobile: stack vertically */
@media (max-width: 900px) {
  .gen-form-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .genres-col .genres-container,
  .genres-col .genres-box,
  .genres-col .genre-list {
    max-height: 260px;
  }
}

.genres-col .genres-container * {
  box-sizing: border-box;
}
.genres-col .genres-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.app-dashboard form label {
  display: block;
  margin-top: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fdfcff;
}

.app-dashboard #ebookForm input,
.app-dashboard #ebookForm button,
.app-dashboard #bottom-buttons button,
.app-dashboard #download button {
  width: 100%;
  padding: 12px 14px;
  margin: 8px 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transition: border-color 0.3s var(--transition), box-shadow 0.3s var(--transition), transform 0.2s ease;
}

.app-dashboard #ebookForm input::placeholder {
  color: #ffffff;
  opacity: 0.8;
}

.app-dashboard #ebookForm input:focus-visible,
.app-dashboard .preview-controls input:focus-visible,
.app-dashboard .preview-controls select:focus-visible,
.app-dashboard #ebookForm button:focus-visible,
.app-dashboard #bottom-buttons button:focus-visible,
.app-dashboard #download button:focus-visible {
  outline: none;
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 16px 34px rgba(93, 75, 255, 0.32);
}

.app-dashboard #ebookForm button,
.app-dashboard #bottom-buttons button,
.app-dashboard #download button {
  background: linear-gradient(120deg, #00ffa3, #5d4bff, #ff7ac7);
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 18px 36px rgba(0, 255, 163, 0.25), 0 10px 24px rgba(93, 75, 255, 0.3);
}

.app-dashboard #ebookForm button:hover,
.app-dashboard #bottom-buttons button:hover,
.app-dashboard #download button:hover {
  transform: translateY(-1px);
}

.app-dashboard #viewer {
  --viewer-bg-color: rgba(21, 12, 56, 0.82);
  --viewer-text-color: #fefbff;
  --viewer-font-size-pt: 12pt;
  --viewer-font-weight: 400;
  --viewer-font-style: normal;
  --viewer-text-decoration: none;
  --viewer-page-width: 900px;
  margin-top: 20px;
  background: var(--viewer-bg-color, rgba(21, 12, 56, 0.92));
  color: var(--viewer-text-color, #fff);
  padding: 26px;
  border-radius: 18px;
  max-height: 520px;
  overflow-y: auto;
  font-size: var(--viewer-font-size-pt, 12pt);
  font-family: var(--viewer-font-family, 'Segoe UI', sans-serif);
  font-weight: var(--viewer-font-weight, 400);
  font-style: var(--viewer-font-style, normal);
  text-decoration: var(--viewer-text-decoration, none);
  overflow-x: hidden;
  word-break: break-word;
  hyphens: auto;
}

.app-dashboard #viewer.is-editing {
  outline: 2px dashed rgba(255, 255, 255, 0.35);
  box-shadow: 0 20px 48px rgba(8, 4, 44, 0.65), 0 12px 28px rgba(93, 75, 255, 0.5);
}

.app-dashboard .preview-controls {
  margin-top: 22px;
  display: flex;
  align-items: stretch;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 28px rgba(8, 4, 44, 0.5);
  overflow-x: auto;
  white-space: normal;
  scrollbar-width: thin;
}

.app-dashboard .preview-controls .toolbar-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 5px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f6f5ff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.32);
}

.app-dashboard .preview-controls .toolbar-item label {
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.01em;
}

.app-dashboard .preview-controls input,
.app-dashboard .preview-controls select,
.app-dashboard .preview-controls button {
  padding: 3px 4px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.18);
  color: #0a0a0a;
  font-size: 0.78rem;
}

.app-dashboard .preview-controls select {
  min-width: 68px;
  background: #0d0b1d;
  color: #fdfbff;
}

.app-dashboard .preview-controls #fontFamilySelect,
.app-dashboard .preview-controls #customFontInput {
  min-width: 140px;
  background: #0d0b1d;
  color: #fdfbff;
  border-color: rgba(255, 255, 255, 0.25);
}

.app-dashboard .preview-controls #fontFamilySelect:focus-visible,
.app-dashboard .preview-controls #customFontInput:focus-visible,
.app-dashboard .preview-controls select:focus-visible,
.app-dashboard .preview-controls button:focus-visible,
.app-dashboard .preview-controls input[type='color']:focus-visible {
  outline: 2px solid #ff7ac7;
  outline-offset: 2px;
}

.mini-toolbar select {
  appearance: auto;
}

.app-dashboard .preview-controls .text-style-group {
  display: inline-flex;
  gap: 4px;
}

.app-dashboard .preview-controls .alignment-group {
  display: inline-flex;
  gap: 4px;
}

.app-dashboard .preview-controls .style-toggle {
  width: 32px;
  height: 30px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.08));
  color: #0d0b1d;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.app-dashboard .preview-controls .style-toggle.is-active {
  box-shadow: 0 0 0 2px #ff7ac7 inset, 0 6px 16px rgba(255, 122, 199, 0.4);
  transform: translateY(-1px);
}

.app-dashboard .preview-controls .align-toggle {
  font-size: 0.85rem;
}

.app-dashboard .preview-controls .color-pair {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.app-dashboard .preview-controls .color-chip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 3px 4px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.app-dashboard .preview-controls .color-chip span {
  font-weight: 700;
  color: #fdfbff;
  font-size: 0.72rem;
}

.app-dashboard .preview-controls input[type='color'] {
  width: 34px;
  height: 26px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
}

.app-dashboard #progress {
  margin-top: 16px;
  min-height: 24px;
}

.app-dashboard .status-message {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 12px 26px rgba(8, 4, 44, 0.45);
  line-height: 1.6;
  color: #fdfcff;
}

.app-dashboard .status-message p {
  margin: 0;
  font-weight: 700;
}

.app-dashboard .status-message.info {
  background: rgba(96, 223, 255, 0.14);
  border-color: rgba(96, 223, 255, 0.4);
}

.app-dashboard .status-message.error {
  background: rgba(255, 99, 132, 0.18);
  border-color: rgba(255, 99, 132, 0.45);
}

.app-dashboard .status-message.success {
  background: rgba(0, 255, 163, 0.18);
  border-color: rgba(0, 255, 163, 0.45);
}

.app-dashboard .status-message .actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.app-dashboard .status-message .action-link {
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  font-weight: 700;
  transition: transform 0.2s ease, background 0.2s ease;
}

.app-dashboard .status-message .action-link:hover,
.app-dashboard .status-message .action-link:focus-visible {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.15);
}

.app-dashboard .status-message .action-link.primary {
  background: linear-gradient(120deg, #ff8c00, #ff0080);
  border: none;
  box-shadow: 0 12px 24px rgba(255, 0, 128, 0.28);
}

.app-dashboard .chapter-card {
  background: transparent;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 18px;
  box-shadow: 0 12px 28px rgba(7, 3, 36, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.16);
  max-width: min(100%, var(--viewer-page-width, 900px));
  margin-left: auto;
  margin-right: auto;
  overflow: hidden;
}

.app-dashboard .chapter-card h2 {
  margin-top: 0;
  text-align: left;
  font-size: calc(var(--viewer-font-size-pt, 12pt) * 1.35);
  color: inherit;
  line-height: 1.3;
  font-weight: 800;
  word-break: break-word;
  hyphens: auto;
}

.app-dashboard .chapter-card p {
  margin: 0 0 12px;
  line-height: 1.7;
  color: inherit;
}

.app-dashboard .chapter-card,
.app-dashboard .chapter-card p,
.app-dashboard #viewer {
  white-space: normal;
  overflow-wrap: break-word;
  word-wrap: break-word;
  text-align: var(--viewer-text-align, left);
}

.app-dashboard .book-header {
  text-align: center;
  margin-bottom: 18px;
}

.app-dashboard .book-header h1 {
  margin: 0;
  font-size: calc(var(--viewer-font-size-pt, 12pt) * 2.2);
  color: inherit;
}

.app-dashboard .book-header p {
  margin: 6px 0 0;
  color: inherit;
}

.app-dashboard .book-footer {
  margin-top: 26px;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: inherit;
}

.app-dashboard #viewer h1,
.app-dashboard #viewer h2,
.app-dashboard #viewer h3 {
  font-weight: 800;
  margin: 18px 0 10px;
  text-align: var(--viewer-text-align, left);
  line-height: 1.3;
  color: inherit;
}

.app-dashboard #viewer h1 {
  font-size: calc(var(--viewer-font-size-pt, 12pt) * 2);
}

.app-dashboard #viewer h2 {
  font-size: calc(var(--viewer-font-size-pt, 12pt) * 1.6);
}

.app-dashboard #viewer h3 {
  font-size: calc(var(--viewer-font-size-pt, 12pt) * 1.3);
}

.app-dashboard #viewer p {
  line-height: 1.8;
  margin: 0 0 15px;
  color: inherit;
  text-align: var(--viewer-text-align, left);
}

.app-dashboard #viewer ul,
.app-dashboard #viewer ol {
  margin: 0 0 20px 25px;
  padding: 0;
  text-align: var(--viewer-text-align, left);
}

.app-dashboard #viewer li {
  margin-bottom: 8px;
  line-height: 1.7;
  color: inherit;
  text-align: var(--viewer-text-align, left);
}

.app-dashboard #viewer h1.chapter-title {
  font-size: calc(var(--viewer-font-size-pt, 12pt) * 2.2);
}

.app-dashboard #progressContainer {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  overflow: hidden;
  height: 22px;
  margin-top: 12px;
  display: none;
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.app-dashboard #progressBar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #00ffa3, #5d4bff, #ff7ac7);
  text-align: center;
  line-height: 22px;
  color: #0d0c2c;
  font-weight: 800;
  transition: width 0.3s ease;
}

.app-dashboard #bottom-buttons {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.app-dashboard #download {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
  flex: 0 0 auto;
  align-items: center;
}

.app-dashboard #bottom-buttons button,
.app-dashboard #download button {
  flex: 1 1 180px;
}

/* Make bottom action and download buttons compact */
.app-dashboard #bottom-buttons button,
.app-dashboard #download button {
  width: auto;
  min-width: 0;
  padding: 8px 14px;
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.2;
  flex: 0 0 auto;
  width: fit-content;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app-dashboard #download button {
  background: linear-gradient(120deg, #ff8c00, #ff0080);
}

.app-dashboard #toggleBtn {
  display: none;
}

@media print {
  .app-dashboard,
  .app-dashboard #viewer {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    background: #5d4bff !important;
    color: #fff !important;
    padding: 20px !important;
  }

  .app-dashboard .mjx-chtml {
    font-size: 100% !important;
    color: #fff !important;
  }

  .app-dashboard .container {
    background: rgba(0, 0, 0, 0.5) !important;
    border-radius: 10px !important;
    padding: 20px !important;
  }
}

@keyframes float-glow {
  0% {
    transform: translateY(0px);
    filter: drop-shadow(0 0 6px #aa00ff);
  }
  50% {
    transform: translateY(-8px);
    filter: drop-shadow(0 0 14px #ff00ff);
  }
  100% {
    transform: translateY(0px);
    filter: drop-shadow(0 0 6px #aa00ff);
  }
}

@keyframes shine {
  0% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.5);
  }
  100% {
    filter: brightness(1);
  }
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  position: relative;
  z-index: 1;
}

.hero-actions .btn {
  font-size: 1rem;
  padding: 0.85rem 1.65rem;
}

.hero-image {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 1.25rem;
  align-content: center;
}

.hero-image img {
  width: min(100%, 320px);
  justify-self: center;
  filter: drop-shadow(0 32px 55px rgba(33, 23, 85, 0.35));
  animation: float 7s ease-in-out infinite;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.badge {
  padding: 0.5rem 1rem;
  border-radius: 0.9rem;
  background: linear-gradient(120deg, rgba(93, 75, 255, 0.18), rgba(255, 122, 199, 0.24));
  color: var(--text-dark);
  font-weight: 700;
  font-size: 0.9rem;
  border: 1px solid rgba(93, 75, 255, 0.24);
  box-shadow: 0 12px 22px rgba(93, 75, 255, 0.18);
}

.section-card {
  background: var(--surface);
  border-radius: 1.75rem;
  padding: clamp(2rem, 4vw, 2.75rem);
  box-shadow: var(--shadow);
  position: relative;
  overflow: visible;
}

.section-card h2,
.section-card h3 {
  margin-top: 0;
}

.section-card p {
  color: var(--text-light);
}

.form-card form {
  display: grid;
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--text-light);
  font-weight: 600;
  font-size: 0.95rem;
}

.form-status {
  min-height: 1.5rem;
  margin-top: 0.25rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  background: rgba(93, 75, 255, 0.08);
  color: var(--text-light);
  font-weight: 500;
  text-align: center;
  transition: opacity 0.3s var(--transition);
}

.form-status.success {
  background: rgba(47, 154, 93, 0.15);
  color: #217a4a;
}

.form-status.error {
  background: rgba(229, 72, 77, 0.15);
  color: #b12a34;
}

.text-muted {
  color: var(--text-light);
  opacity: 0.75;
  text-align: center;
}

input,
textarea,
select {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(93, 75, 255, 0.15);
  background: rgba(255, 255, 255, 0.85);
  font-family: inherit;
  font-size: 1rem;
  color: var(--text-dark);
  transition: border-color 0.3s var(--transition), box-shadow 0.3s var(--transition), transform 0.3s var(--transition);
}

.input-with-toggle {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-toggle input {
  padding-right: 3.25rem;
}

.password-toggle {
  position: absolute;
  right: 0.55rem;
  border: none;
  background: none;
  color: var(--text-light);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  box-shadow: none;
  transition: color 0.2s var(--transition), transform 0.2s var(--transition);
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--primary);
}

.password-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 0.65rem;
}

.password-toggle .icon-eye-off {
  display: none;
}

.password-toggle[aria-pressed="true"] .icon-eye {
  display: none;
}

.password-toggle[aria-pressed="true"] .icon-eye-off {
  display: inline;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(93, 75, 255, 0.12);
  transform: translateY(-2px);
}

textarea {
  min-height: 160px;
  resize: vertical;
}

.btn,
button {
  appearance: none;
  border: none;
  border-radius: 0.95rem;
  padding: 0.85rem 1.7rem;
  font-weight: 600;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  box-shadow: 0 18px 30px rgba(93, 75, 255, 0.28);
  transition: transform 0.35s var(--transition), box-shadow 0.35s var(--transition), filter 0.35s var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-decoration: none;
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary);
  box-shadow: inset 0 0 0 2px rgba(93, 75, 255, 0.25);
}

.btn:hover,
.btn:focus-visible,
button:hover,
button:focus-visible {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 24px 40px rgba(93, 75, 255, 0.32);
  filter: brightness(1.02);
}

.info-grid {
  display: grid;
  gap: 1.75rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.info-card {
  background: rgba(255, 255, 255, 0.82);
  padding: 1.75rem;
  border-radius: 1.5rem;
  box-shadow: 0 16px 40px rgba(15, 23, 66, 0.12);
  display: grid;
  gap: 0.75rem;
  position: relative;
  overflow: hidden;
}

.info-card::after {
  content: '';
  position: absolute;
  inset: auto -20% -40% -20%;
  height: 60%;
  background: linear-gradient(135deg, rgba(93, 75, 255, 0.18), rgba(255, 122, 199, 0.18));
  filter: blur(45px);
  opacity: 0;
  transition: opacity 0.5s ease;
}

.info-card:hover::after {
  opacity: 1;
}

.plan-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-items: stretch;
  grid-auto-rows: 1fr;
  position: relative;
  z-index: 2;
  isolation: isolate;
}

.plans-heading {
  margin: 0 0 0.5rem;
  text-align: center;
  font-size: clamp(2rem, 5vw, 3rem);
}

.plans-subheading {
  margin: 0 auto 2rem;
  text-align: center;
  max-width: 780px;
  color: var(--text-light);
  font-size: 1.05rem;
}

.plan-card {
  background: rgba(255, 255, 255, 0.88);
  padding: 2rem 1.75rem;
  border-radius: 1.75rem;
  box-shadow: 0 20px 45px rgba(15, 23, 66, 0.14);
  display: grid;
  gap: 0.8rem;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(93, 75, 255, 0.12);
}

.plan-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(93, 75, 255, 0.18), transparent 60%);
  opacity: 0;
  transition: opacity 0.45s ease;
}

.plan-card:hover::before {
  opacity: 1;
}

.plan-card h3 {
  margin: 0;
}

.plan-card .price {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
}

.plan-card ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  color: var(--text-light);
  display: grid;
  gap: 0.35rem;
}

.plan-card ul li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.plan-card .plan-btn {
  width: 100%;
  text-align: center;
  margin-top: auto;
}

.plan-card button {
  margin-top: 0.75rem;
}

.plan-card button.loading {
  opacity: 0.65;
  cursor: progress;
  box-shadow: inset 0 0 0 1px rgba(93, 75, 255, 0.2);
}

.plan-card button.highlight {
  animation: planPulse 1.5s ease-in-out infinite;
}

@keyframes planPulse {
  0% { box-shadow: 0 18px 30px rgba(93, 75, 255, 0.28); }
  50% { box-shadow: 0 28px 45px rgba(93, 75, 255, 0.45); }
  100% { box-shadow: 0 18px 30px rgba(93, 75, 255, 0.28); }
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background: rgba(93, 75, 255, 0.18);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--primary-dark);
  font-weight: 600;
}

.chat-container {
  display: grid;
  gap: 1.75rem;
}

.chat-log {
  background: rgba(255, 255, 255, 0.82);
  border-radius: 1.5rem;
  padding: 1.5rem;
  height: clamp(260px, 45vh, 420px);
  overflow: auto;
  box-shadow: inset 0 0 0 1px rgba(93, 75, 255, 0.1);
}

.chat-form {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.chat-form input {
  flex: 1 1 250px;
}

.ticket-list {
  display: grid;
  gap: 1rem;
}

.ticket-item {
  padding: 1rem 1.25rem;
  border-radius: 1.2rem;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 28px rgba(15, 23, 66, 0.12);
  font-weight: 500;
}

#bg-canvas, canvas.page-bg, .page-overlay, .page-gradient::before { pointer-events:none !important; z-index:0 !important; }
header, nav, main, .plans, .plan-card { position:relative; z-index:1; }

.modal[hidden]{ display:none; }
.modal{ position:fixed; inset:0; background:rgba(0,0,0,.35); display:flex; align-items:center; justify-content:center; z-index:9999; }
.modal-card{ background:#fff; color:#111; border-radius:12px; padding:20px; width:min(420px, 92vw); box-shadow:0 20px 60px rgba(0,0,0,.25); }
.modal-card input{ width:100%; height:44px; font-size:16px; padding:8px 12px; margin:10px 0 6px; }
.modal-card .actions{ display:flex; gap:12px; justify-content:flex-end; }

footer {
  text-align: center;
  color: var(--text-light);
  padding: 2.5rem 0 1.5rem;
  font-size: 0.9rem;
}

.floating-shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(45px);
  opacity: 0.45;
  pointer-events: none;
  animation: float 18s ease-in-out infinite;
}

.shape-1 {
  width: 340px;
  height: 340px;
  background: rgba(93, 75, 255, 0.26);
  top: 8%;
  left: -120px;
}

.shape-2 {
  width: 260px;
  height: 260px;
  background: rgba(255, 122, 199, 0.25);
  bottom: 12%;
  right: -80px;
  animation-delay: -4s;
}

.shape-3 {
  width: 220px;
  height: 220px;
  background: rgba(255, 188, 87, 0.32);
  top: 55%;
  right: 12%;
  animation-delay: -7s;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-14px);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.38;
  }
  50% {
    opacity: 0.55;
  }
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@media (max-width: 768px) {
  header.navbar {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .hero {
    padding: 2.5rem 2rem;
  }

  .hero-text h1,
  .hero-text h2 {
    font-size: clamp(2.1rem, 6vw, 2.6rem);
  }

  .hero-image img {
    width: min(100%, 260px);
  }

  .chat-form {
    flex-direction: column;
  }

  .chat-form input {
    flex: 1 1 auto;
    width: 100%;
  }
}

@media (max-width: 520px) {
  main {
    padding-top: 4rem;
  }

  header.navbar {
    padding: 1.1rem 1.35rem;
    border-radius: 1.25rem;
  }

  .section-card,
  .hero {
    border-radius: 1.5rem;
  }
}

.section-card { overflow: visible; }
.chapter-body{
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.75;
  font-size: var(--viewer-font-size-pt, 16px);
  max-width: 100%;
  padding-right: 8px;
  font-family: var(--viewer-font-family, 'Merriweather', Georgia, serif);
  text-align: var(--viewer-text-align, left);
  hyphens: auto;
}
.chapter-body h1,.chapter-body h2,.chapter-body h3{ margin:.6em 0 .4em; line-height:1.25; word-break:break-word; hyphens:auto; }
.chapter-body p{ margin:.75em 0; }
.chapter-body ul,.chapter-body ol{ margin:.75em 0 .85em 1.4em; }
.chapter-body li{ margin:.25em 0; }
.chapter-body pre{
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  padding: 12px 14px;
  margin: .85em 0;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  font-size: .95em;
  max-width: 100%;
  box-sizing: border-box;
}
.chapter-body code{
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  background: rgba(255,255,255,0.06);
  border-radius: 6px;
  padding: 2px 6px;
  word-break: break-word;
}

/* If an old <pre> preview still exists anywhere, kill it */
#chapter-output pre { display:none !important; }
