/* ==========================================================================
   Horizon Tickets — shared stylesheet
   Theme is driven by <html data-theme="dark|light">, set before paint by the
   inline bootstrap script in each page's <head> (prevents a flash of the
   wrong theme).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  --bg: #030712;
  --bg-soft: #0b1120;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --cyan: #00f2fe;
  --cyan-rgb: 0, 242, 254;
  --purple: #7928ca;
  --purple-rgb: 121, 40, 202;

  --card-bg: rgba(15, 23, 42, 0.65);
  --card-bg-strong: rgba(15, 23, 42, 0.85);
  --card-border: rgba(255, 255, 255, 0.1);
  --input-bg: rgba(255, 255, 255, 0.04);
  --surface-bg: rgba(15, 23, 42, 0.95);
  --hover-bg: rgba(255, 255, 255, 0.08);
  --scrim: rgba(3, 7, 18, 0.72);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 30px 60px rgba(0, 0, 0, 0.5);

  --gradient: linear-gradient(135deg, #00f2fe 0%, #4facfe 40%, #7928ca 100%);
  --on-gradient: #030712;

  --red: #ef4444;
  --red-rgb: 239, 68, 68;
  --green: #22c55e;
  --green-rgb: 34, 197, 94;
  --amber: #eab308;
  --amber-rgb: 234, 179, 8;
  --orange-rgb: 249, 115, 22;
  --slate-rgb: 148, 163, 184;

  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-back: cubic-bezier(0.34, 1.4, 0.5, 1);

  --nav-max: 1280px;
  --font-body: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system,
    'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

html[data-theme='light'] {
  --bg: #f6f8fc;
  --bg-soft: #ffffff;
  --text: #0f172a;
  --text-muted: #475569;
  --cyan: #0284c7;
  --cyan-rgb: 2, 132, 199;
  --purple: #6b21a8;
  --purple-rgb: 107, 33, 168;

  --card-bg: rgba(255, 255, 255, 0.85);
  --card-bg-strong: rgba(255, 255, 255, 0.97);
  --card-border: rgba(15, 23, 42, 0.12);
  --input-bg: rgba(15, 23, 42, 0.035);
  --surface-bg: rgba(255, 255, 255, 0.97);
  --hover-bg: rgba(15, 23, 42, 0.06);
  --scrim: rgba(15, 23, 42, 0.45);
  --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.1);
  --shadow-xl: 0 30px 60px rgba(15, 23, 42, 0.18);

  --gradient: linear-gradient(135deg, #0284c7 0%, #2563eb 50%, #6b21a8 100%);
  --on-gradient: #ffffff;
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
  transition: background-color 0.45s var(--ease), color 0.45s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

/* Text selection is disabled for page chrome only — form fields stay usable. */
body {
  -webkit-user-select: none;
  user-select: none;
}

input,
textarea,
select,
[contenteditable='true'] {
  -webkit-user-select: text;
  user-select: text;
}

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--cyan);
  text-decoration: none;
}

/* Keyboard focus stays visible; pointer focus does not draw a ring. */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 6px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(var(--slate-rgb), 0.35);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--cyan-rgb), 0.55);
  background-clip: content-box;
}

body.is-locked {
  overflow: hidden;
}

/* Class-based display rules would otherwise beat the UA sheet's
   [hidden] { display: none } and leave "hidden" elements visible. */
[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.page-wrapper {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

main {
  position: relative;
  z-index: 10;
  flex: 1 0 auto;
  width: 100%;
}

footer.site-footer {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* --------------------------------------------------------------------------
   3. Reveal-on-scroll (never applied to magnetic elements)
   -------------------------------------------------------------------------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.75s var(--ease), transform 0.75s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}

[data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   4. Ambient canvas, cursor, ripples
   -------------------------------------------------------------------------- */
#spaceCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.custom-cursor,
.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease, border-color 0.35s ease, background-color 0.35s ease;
  will-change: transform;
}

body.cursor-ready .custom-cursor,
body.cursor-ready .cursor-dot {
  opacity: 1;
}

.custom-cursor {
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  border: 2px solid rgba(var(--cyan-rgb), 0.6);
  z-index: 9998;
}

.custom-cursor.is-active {
  border-color: var(--cyan);
  background-color: rgba(var(--cyan-rgb), 0.07);
}

.cursor-dot {
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  background: var(--cyan);
  z-index: 9999;
}

/* Custom cursor only replaces the pointer on precise-pointer devices. */
@media (hover: hover) and (pointer: fine) {
  body.cursor-ready,
  body.cursor-ready a,
  body.cursor-ready button,
  body.cursor-ready .ticket-card,
  body.cursor-ready [role='button'] {
    cursor: none;
  }
}

.click-shockwave {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(var(--cyan-rgb), 0.85) 0%,
    rgba(var(--purple-rgb), 0.35) 60%,
    transparent 100%
  );
  transform: translate(-50%, -50%) scale(0);
  animation: shockwaveExpand 0.75s cubic-bezier(0, 0.9, 0.2, 1) forwards;
  pointer-events: none;
  z-index: 4000;
}

@keyframes shockwaveExpand {
  from {
    transform: translate(-50%, -50%) scale(0.1);
    opacity: 0.9;
  }
  to {
    transform: translate(-50%, -50%) scale(26);
    opacity: 0;
  }
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(var(--cyan-rgb), 0.32);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0.9;
  animation: rippleEffect 0.65s var(--ease) forwards;
  pointer-events: none;
}

@keyframes rippleEffect {
  to {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
  }
}

/* --------------------------------------------------------------------------
   5. Navigation
   -------------------------------------------------------------------------- */
.site-nav {
  position: relative;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.35rem 5%;
  width: 100%;
  max-width: var(--nav-max);
  margin: 0 auto;
  animation: slideDown 0.9s var(--ease) both;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-24px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.logo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-img {
  height: 38px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(var(--cyan-rgb), 0.5));
  transition: filter 0.4s ease;
}

.logo-container:hover .logo-img {
  filter: drop-shadow(0 0 20px rgba(var(--cyan-rgb), 0.95));
}

.logo-text {
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: -0.4px;
  line-height: 1;
  text-transform: uppercase;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
}

.icon-svg {
  width: 1.25em;
  height: 1.25em;
  fill: currentColor;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

/* Stroke-drawn icons must not inherit the default fill. */
.icon-stroke {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text);
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: border-color 0.35s ease, color 0.35s ease, box-shadow 0.35s ease,
    background-color 0.35s ease;
}

.icon-btn:hover,
.icon-btn.is-active {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 10px 30px rgba(var(--cyan-rgb), 0.3);
  background: rgba(var(--cyan-rgb), 0.06);
}

/* Magnetic elements are positioned by JS through these variables only, so CSS
   hover states never fight the animation loop. */
.magnetic {
  transform: translate3d(var(--mx, 0px), var(--my, 0px), 0) scale(var(--ms, 1));
  will-change: transform;
}

/* --------------------------------------------------------------------------
   6. Profile dropdown
   -------------------------------------------------------------------------- */
.profile-menu-wrapper {
  position: relative;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 244px;
  background: var(--surface-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 0.55rem;
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.94) translateY(-10px);
  transform-origin: top right;
  transition: opacity 0.28s var(--ease), transform 0.28s var(--ease),
    visibility 0.28s;
}

.profile-dropdown.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  padding: 0.8rem 0.95rem;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.93rem;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  border-radius: 12px;
  transition: background 0.22s ease, transform 0.22s var(--ease), color 0.22s ease;
}

.dropdown-item:hover {
  background: var(--hover-bg);
  transform: translateX(5px);
}

.dropdown-divider {
  height: 1px;
  background: var(--card-border);
  margin: 0.3rem 0.5rem;
}

.dropdown-user {
  padding: 0.7rem 0.95rem 0.5rem;
}

.dropdown-user strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 800;
}

.dropdown-user span {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  word-break: break-all;
}

.cyan-icon {
  fill: var(--cyan);
}

.red-icon {
  fill: var(--red);
}

.is-danger {
  color: var(--red);
}

.is-danger:hover {
  background: rgba(var(--red-rgb), 0.14);
}

/* --------------------------------------------------------------------------
   7. Navigation drawer
   -------------------------------------------------------------------------- */
.menu-overlay {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 3000;
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.menu-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.menu-drawer {
  width: 100%;
  max-width: 340px;
  height: 100%;
  background: var(--surface-bg);
  border-left: 1px solid var(--card-border);
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  transform: translateX(100%);
  transition: transform 0.45s var(--ease);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  overflow-y: auto;
}

.menu-overlay.is-open .menu-drawer {
  transform: none;
}

.menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.menu-title {
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.close-drawer-btn {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.3s ease, color 0.3s ease, background 0.3s ease;
}

.close-drawer-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(var(--cyan-rgb), 0.06);
}

.menu-links {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.menu-link-item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.95rem 1.15rem;
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.97rem;
  transition: border-color 0.3s ease, color 0.3s ease, background 0.3s ease,
    transform 0.3s var(--ease);
}

.menu-link-item:hover,
.menu-link-item.is-current {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(var(--cyan-rgb), 0.07);
  transform: translateX(4px);
}

.menu-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.menu-user {
  padding: 0.9rem 1.1rem;
  border: 1px dashed var(--card-border);
  border-radius: 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.menu-user strong {
  display: block;
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

/* --------------------------------------------------------------------------
   8. Buttons
   -------------------------------------------------------------------------- */
.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.9rem 1.6rem;
  font-size: 0.97rem;
  font-weight: 700;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: box-shadow 0.35s ease, background 0.35s ease, border-color 0.35s ease,
    color 0.35s ease, opacity 0.2s ease;
}

.btn:disabled,
.btn[aria-disabled='true'] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--gradient);
  background-size: 180% 180%;
  color: var(--on-gradient);
  box-shadow: 0 10px 30px rgba(var(--cyan-rgb), 0.32);
  animation: gradientShift 7s ease infinite;
}

.btn-primary:hover {
  box-shadow: 0 16px 42px rgba(var(--cyan-rgb), 0.5);
}

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

.btn-ghost {
  background: var(--input-bg);
  border-color: var(--card-border);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(var(--cyan-rgb), 0.07);
}

.btn-danger {
  background: rgba(var(--red-rgb), 0.12);
  border-color: rgba(var(--red-rgb), 0.32);
  color: var(--red);
}

.btn-danger:hover {
  background: rgba(var(--red-rgb), 0.22);
  border-color: var(--red);
}

.btn-lg {
  padding: 1.1rem 2.6rem;
  font-size: 1.05rem;
  border-radius: var(--radius-md);
}

.btn-sm {
  padding: 0.62rem 1rem;
  font-size: 0.85rem;
  border-radius: 11px;
}

.btn-block {
  width: 100%;
}

/* --------------------------------------------------------------------------
   9. Cards & panels
   -------------------------------------------------------------------------- */
.panel-card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 2.4rem 1.9rem 2rem;
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.panel-title-tag {
  position: absolute;
  top: -0.85rem;
  left: 1.75rem;
  padding: 0.35rem 1rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: var(--gradient);
  color: var(--on-gradient);
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(var(--cyan-rgb), 0.3);
}

.page-main-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.6px;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  margin-bottom: 0.35rem;
}

.page-main-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* --------------------------------------------------------------------------
   10. Forms
   -------------------------------------------------------------------------- */
.form-grid {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-group label,
.field-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.2px;
}

.optional-tag {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
}

.input-field-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-field-wrapper > svg {
  position: absolute;
  left: 1rem;
  width: 1.15rem;
  height: 1.15rem;
  fill: var(--text-muted);
  pointer-events: none;
  transition: fill 0.3s ease;
}

.input-field-wrapper:focus-within > svg {
  fill: var(--cyan);
}

.auth-input,
.auth-select,
.auth-textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.input-field-wrapper .auth-input {
  padding-left: 2.9rem;
}

.input-field-wrapper .auth-input.has-trailing {
  padding-right: 3rem;
}

.auth-textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.6;
}

.auth-select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 1.25rem) 55%, calc(100% - 0.95rem) 55%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2.6rem;
}

.auth-select option {
  background: var(--bg-soft);
  color: var(--text);
}

.auth-input::placeholder,
.auth-textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.75;
}

.auth-input:focus,
.auth-select:focus,
.auth-textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(var(--cyan-rgb), 0.13);
}

.auth-input[aria-invalid='true'] {
  border-color: var(--red);
}

.password-toggle {
  position: absolute;
  right: 0.6rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.25s ease, background 0.25s ease;
}

.password-toggle svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}

.password-toggle:hover {
  color: var(--cyan);
  background: rgba(var(--cyan-rgb), 0.1);
}

.field-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.field-hint.is-error {
  color: var(--red);
}

.char-counter {
  align-self: flex-end;
  font-size: 0.74rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Password strength meter */
.strength-meter {
  display: flex;
  gap: 5px;
  margin-top: 0.15rem;
}

.strength-meter span {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--card-border);
  transition: background 0.3s ease;
}

.strength-meter[data-score='1'] span:nth-child(1) {
  background: var(--red);
}

.strength-meter[data-score='2'] span:nth-child(-n + 2) {
  background: var(--amber);
}

.strength-meter[data-score='3'] span:nth-child(-n + 3) {
  background: var(--cyan);
}

.strength-meter[data-score='4'] span {
  background: var(--green);
}

/* Inline alert banner */
.alert-banner {
  display: none;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.45;
  border: 1px solid transparent;
}

.alert-banner.is-visible {
  display: flex;
  animation: alertIn 0.35s var(--ease) both;
}

@keyframes alertIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.alert-banner::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: currentColor;
}

.alert-banner.error {
  background: rgba(var(--red-rgb), 0.12);
  border-color: rgba(var(--red-rgb), 0.32);
  color: var(--red);
}

.alert-banner.success {
  background: rgba(var(--green-rgb), 0.12);
  border-color: rgba(var(--green-rgb), 0.32);
  color: var(--green);
}

.alert-banner.info {
  background: rgba(var(--cyan-rgb), 0.12);
  border-color: rgba(var(--cyan-rgb), 0.32);
  color: var(--cyan);
}

.auth-footer-text {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-footer-text a {
  font-weight: 700;
}

.auth-footer-text a:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   11. Modals (shared) + toasts
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.32s var(--ease), visibility 0.32s;
}

.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: var(--surface-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 430px;
  padding: 2.35rem 1.9rem;
  box-shadow: var(--shadow-xl);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  transform: scale(0.9) translateY(18px);
  opacity: 0;
  transition: transform 0.4s var(--ease-back), opacity 0.32s ease;
}

.modal-overlay.is-open .modal-card {
  transform: none;
  opacity: 1;
}

.modal-icon-wrapper {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  background: rgba(var(--cyan-rgb), 0.14);
  border: 1px solid rgba(var(--cyan-rgb), 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  color: var(--cyan);
}

.modal-icon-wrapper.is-danger {
  background: rgba(var(--red-rgb), 0.14);
  border-color: rgba(var(--red-rgb), 0.34);
  color: var(--red);
}

.modal-icon-wrapper svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.modal-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: 0.85rem;
}

.modal-actions .btn {
  flex: 1;
}

.toast-stack {
  position: fixed;
  left: 50%;
  bottom: 1.75rem;
  transform: translateX(-50%);
  z-index: 6000;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: center;
  width: min(420px, calc(100% - 2rem));
  pointer-events: none;
}

.toast {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1.15rem;
  border-radius: 14px;
  background: var(--surface-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  animation: toastIn 0.4s var(--ease-back) both;
}

.toast.is-leaving {
  animation: toastOut 0.3s ease forwards;
}

.toast::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--cyan);
}

.toast.success::before {
  background: var(--green);
}

.toast.error::before {
  background: var(--red);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

/* --------------------------------------------------------------------------
   12. Status & priority badges (shared by tickets + account)
   -------------------------------------------------------------------------- */
.status-badge,
.priority-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.8rem;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  white-space: nowrap;
  border: 1px solid transparent;
}

.status-open {
  background: rgba(var(--green-rgb), 0.12);
  border-color: rgba(var(--green-rgb), 0.3);
  color: var(--green);
}

.status-pending {
  background: rgba(var(--amber-rgb), 0.12);
  border-color: rgba(var(--amber-rgb), 0.3);
  color: var(--amber);
}

.status-resolved {
  background: rgba(var(--slate-rgb), 0.14);
  border-color: rgba(var(--slate-rgb), 0.3);
  color: var(--text-muted);
}

.priority-low {
  background: rgba(var(--slate-rgb), 0.12);
  border-color: rgba(var(--slate-rgb), 0.3);
  color: var(--text-muted);
}

.priority-medium {
  background: rgba(var(--cyan-rgb), 0.12);
  border-color: rgba(var(--cyan-rgb), 0.3);
  color: var(--cyan);
}

.priority-high {
  background: rgba(var(--orange-rgb), 0.12);
  border-color: rgba(var(--orange-rgb), 0.32);
  color: #f97316;
}

.priority-critical {
  background: rgba(var(--red-rgb), 0.12);
  border-color: rgba(var(--red-rgb), 0.32);
  color: var(--red);
}

/* --------------------------------------------------------------------------
   13. Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
  }

  .custom-cursor,
  .cursor-dot,
  .click-shockwave {
    display: none;
  }
}

/* ==========================================================================
   14. Home page
   ========================================================================== */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3.5rem 1.5rem 1rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 1.2rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--cyan);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 10px 30px rgba(var(--cyan-rgb), 0.14);
  margin-bottom: 1.5rem;
}

.hero-badge i {
  width: 8px;
  height: 8px;
  background: var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--cyan);
  animation: blink 1.6s infinite ease-in-out;
}

@keyframes blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.72); }
}

.hero-title {
  font-size: clamp(2.35rem, 6vw, 4.3rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -1.5px;
  margin-bottom: 1.1rem;
  max-width: 15ch;
}

.hero-title span {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  display: inline-block;
  filter: drop-shadow(0 0 35px rgba(var(--cyan-rgb), 0.28));
}

.hero-sub {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.65;
  max-width: 58ch;
  margin: 0 auto 2rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  justify-content: center;
}

.hero-btn svg {
  transition: transform 0.4s var(--ease);
}

.hero-btn:hover svg {
  transform: translateX(5px);
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2.5rem;
  margin-top: 3.25rem;
  padding-top: 2.25rem;
  border-top: 1px solid var(--card-border);
  width: min(100%, 640px);
}

.hero-stat strong {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.hero-stat span {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.9px;
  font-weight: 600;
}

.guide-section {
  width: 100%;
  max-width: 1100px;
  margin: 4rem auto 2rem;
  padding: 0 1.5rem;
}

.guide-header {
  text-align: center;
  margin-bottom: 2.75rem;
}

.guide-header h2 {
  font-size: clamp(1.7rem, 3.5vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 0.7rem;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.guide-header p {
  color: var(--text-muted);
  font-size: 1.02rem;
  max-width: 62ch;
  margin: 0 auto;
  line-height: 1.65;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(238px, 1fr));
  gap: 1.5rem;
  perspective: 1200px;
}

.guide-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 2rem 1.7rem;
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transform-style: preserve-3d;
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.guide-card:hover {
  border-color: var(--cyan);
  box-shadow: 0 26px 55px rgba(var(--cyan-rgb), 0.2);
}

.guide-step-number {
  position: absolute;
  top: -0.7rem;
  right: 0.9rem;
  font-size: 4.75rem;
  font-weight: 800;
  color: var(--text);
  opacity: 0.045;
  pointer-events: none;
  line-height: 1;
}

.guide-icon-box {
  width: 50px;
  height: 50px;
  border-radius: 15px;
  background: rgba(var(--cyan-rgb), 0.1);
  border: 1px solid rgba(var(--cyan-rgb), 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan);
}

.guide-icon-box svg {
  width: 23px;
  height: 23px;
  fill: currentColor;
}

.guide-card h3 {
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.guide-card p {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ==========================================================================
   15. Auth pages
   ========================================================================== */
.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem 3rem;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 2.6rem 2rem;
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.auth-header {
  text-align: center;
}

.auth-header h1 {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.8px;
  margin-bottom: 0.45rem;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.auth-header p {
  color: var(--text-muted);
  font-size: 0.93rem;
  line-height: 1.55;
}

/* ==========================================================================
   16. Create ticket page
   ========================================================================== */
.dashboard-main {
  padding: 1.5rem 5% 3rem;
}

.dashboard-container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 2.25rem;
  align-items: start;
}

.warning-content {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.warning-content strong {
  color: var(--text);
}

.warning-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.warning-list li {
  position: relative;
  padding-left: 1.35rem;
}

.warning-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
}

.warning-list span {
  color: var(--text);
  font-weight: 700;
}

.warning-panel {
  border-color: rgba(var(--red-rgb), 0.28);
}

.warning-panel .panel-title-tag {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: #fff;
  box-shadow: 0 8px 20px rgba(var(--red-rgb), 0.3);
}

/* ==========================================================================
   17. Tickets page
   ========================================================================== */
.tickets-main {
  padding: 1.5rem 5% 3rem;
}

.tickets-container {
  width: 100%;
  max-width: 950px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.tickets-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 1rem;
}

.tickets-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
  justify-content: space-between;
}

.search-wrapper {
  position: relative;
  flex: 1 1 260px;
  display: flex;
  align-items: center;
}

.search-wrapper svg {
  position: absolute;
  left: 0.95rem;
  width: 1.05rem;
  height: 1.05rem;
  fill: var(--text-muted);
  pointer-events: none;
}

.search-wrapper input {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.78rem 1rem 0.78rem 2.7rem;
  color: var(--text);
  font-size: 0.92rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-wrapper input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(var(--cyan-rgb), 0.12);
}

.filter-chips {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.filter-chip {
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.filter-chip .chip-count {
  font-size: 0.72rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: var(--hover-bg);
  font-variant-numeric: tabular-nums;
}

.filter-chip:hover {
  color: var(--text);
  border-color: var(--cyan);
}

.filter-chip.is-active {
  background: rgba(var(--cyan-rgb), 0.12);
  border-color: var(--cyan);
  color: var(--cyan);
}

.tickets-list {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.ticket-card {
  position: relative;
  overflow: hidden;
  width: 100%;
  text-align: left;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  box-shadow: var(--shadow-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  cursor: pointer;
  transition: border-color 0.3s ease, transform 0.3s var(--ease),
    box-shadow 0.3s ease, background 0.3s ease;
  animation: cardIn 0.5s var(--ease) both;
  animation-delay: var(--card-delay, 0ms);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.ticket-card:hover {
  border-color: var(--cyan);
  transform: translateY(-3px);
  box-shadow: 0 25px 50px rgba(var(--cyan-rgb), 0.16);
  background: var(--card-bg-strong);
}

.ticket-info {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  min-width: 0;
  flex: 1;
}

.ticket-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.ticket-id {
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.3px;
}

.ticket-title {
  display: block;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-desc {
  display: block;
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60ch;
}

.ticket-desc .from-tag {
  color: var(--text);
  font-weight: 700;
}

.ticket-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.msg-count {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.msg-count svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: currentColor;
}

.empty-state {
  background: var(--card-bg);
  border: 1px dashed var(--card-border);
  border-radius: var(--radius-xl);
  padding: 3.25rem 2rem;
  text-align: center;
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
}

.empty-state svg {
  width: 3rem;
  height: 3rem;
  fill: var(--text-muted);
  opacity: 0.7;
}

.empty-state h3 {
  font-size: 1.2rem;
  font-weight: 800;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.94rem;
  max-width: 46ch;
  line-height: 1.6;
}

/* Chat modal */
.chat-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4500;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.32s var(--ease), visibility 0.32s;
}

.chat-modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.chat-modal {
  width: 100%;
  max-width: 580px;
  height: min(78vh, 680px);
  background: var(--surface-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.94) translateY(20px);
  opacity: 0;
  transition: transform 0.4s var(--ease-back), opacity 0.3s ease;
}

.chat-modal-overlay.is-open .chat-modal {
  transform: none;
  opacity: 1;
}

.chat-modal-header {
  padding: 1.15rem 1.4rem;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-shrink: 0;
}

.chat-modal-header h3 {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
  line-height: 1.35;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.chat-icon-btn {
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.chat-icon-btn svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: currentColor;
}

.chat-icon-btn:hover {
  color: var(--cyan);
  border-color: var(--cyan);
  background: rgba(var(--cyan-rgb), 0.08);
}

.chat-icon-btn.is-danger:hover {
  color: var(--red);
  border-color: var(--red);
  background: rgba(var(--red-rgb), 0.12);
}

.chat-modal-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.25rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.chat-day-divider {
  align-self: center;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  margin: 0.25rem 0;
}

.chat-bubble {
  max-width: 82%;
  padding: 0.72rem 1rem;
  border-radius: 18px;
  font-size: 0.91rem;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  animation: bubbleIn 0.35s var(--ease) both;
}

@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.chat-bubble.from-user {
  align-self: flex-end;
  background: var(--gradient);
  color: var(--on-gradient);
  border-bottom-right-radius: 5px;
}

.chat-bubble.from-staff {
  align-self: flex-start;
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  color: var(--text);
  border-bottom-left-radius: 5px;
}

.chat-bubble-time {
  display: block;
  font-size: 0.68rem;
  opacity: 0.75;
  margin-top: 0.35rem;
  font-weight: 600;
}

.typing-bubble {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.85rem 1rem;
  border-radius: 18px;
  border-bottom-left-radius: 5px;
  background: var(--input-bg);
  border: 1px solid var(--card-border);
}

.typing-bubble i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingBounce 1.2s infinite ease-in-out;
}

.typing-bubble i:nth-child(2) { animation-delay: 0.16s; }
.typing-bubble i:nth-child(3) { animation-delay: 0.32s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.chat-notice {
  display: none;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.4rem;
  background: rgba(var(--slate-rgb), 0.12);
  border-top: 1px solid var(--card-border);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.45;
  flex-shrink: 0;
}

.chat-notice.is-visible {
  display: flex;
}

.chat-notice svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: currentColor;
  flex-shrink: 0;
}

.chat-modal-footer {
  padding: 0.95rem 1.4rem;
  border-top: 1px solid var(--card-border);
  display: flex;
  gap: 0.65rem;
  align-items: flex-end;
  flex-shrink: 0;
}

.chat-modal-footer textarea {
  flex: 1;
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.72rem 0.95rem;
  color: var(--text);
  font-size: 0.91rem;
  line-height: 1.45;
  resize: none;
  max-height: 120px;
  min-height: 44px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.chat-modal-footer textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(var(--cyan-rgb), 0.12);
}

.chat-send-btn {
  position: relative;
  overflow: hidden;
  background: var(--gradient);
  border: none;
  border-radius: var(--radius-sm);
  width: 44px;
  height: 44px;
  color: var(--on-gradient);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: box-shadow 0.3s ease, opacity 0.25s ease;
}

.chat-send-btn:hover:not(:disabled) {
  box-shadow: 0 10px 24px rgba(var(--cyan-rgb), 0.4);
}

.chat-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chat-send-btn svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: currentColor;
}

/* ==========================================================================
   18. Account page
   ========================================================================== */
.account-main {
  padding: 1.5rem 5% 3rem;
}

.account-container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.account-identity {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  flex-wrap: wrap;
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--gradient);
  color: var(--on-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  box-shadow: 0 12px 28px rgba(var(--cyan-rgb), 0.3);
  flex-shrink: 0;
}

.identity-text h1 {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.6px;
}

.identity-text p {
  color: var(--text-muted);
  font-size: 0.9rem;
  word-break: break-all;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.3rem;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-card strong {
  font-size: 1.7rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

.stat-card span {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
}

.panels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 2rem 1.75rem;
  align-items: start;
}

.profile-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.field-row {
  display: flex;
  gap: 0.6rem;
  align-items: stretch;
}

.field-row .auth-input {
  flex: 1;
  min-width: 0;
}

.help-guide-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.help-guide-content h3 {
  font-size: 1.05rem;
  font-weight: 800;
}

.help-guide-content p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.help-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.help-steps li {
  position: relative;
  padding-left: 1.5rem;
  font-size: 0.89rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.help-steps li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(var(--cyan-rgb), 0.7);
}

.danger-panel {
  border-color: rgba(var(--red-rgb), 0.28);
}

.danger-panel .panel-title-tag {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: #fff;
  box-shadow: 0 8px 20px rgba(var(--red-rgb), 0.3);
}

.danger-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: auto;
}

.take-help-wrapper {
  display: flex;
  justify-content: center;
  padding-top: 0.5rem;
}

/* ==========================================================================
   19. Responsive
   ========================================================================== */
@media (max-width: 900px) {
  .dashboard-container {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .site-nav {
    padding: 1.1rem 1.25rem;
  }

  .logo-text {
    font-size: 0.8rem;
  }

  .icon-btn {
    width: 42px;
    height: 42px;
  }

  .hero {
    padding-top: 2.25rem;
  }

  .hero-stats {
    gap: 1.5rem 2rem;
    justify-content: space-around;
  }

  .tickets-main,
  .dashboard-main,
  .account-main {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .ticket-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
  }

  .ticket-badges {
    justify-content: flex-start;
  }

  .ticket-title,
  .ticket-desc {
    white-space: normal;
  }

  .panel-card {
    padding: 2.1rem 1.35rem 1.75rem;
  }

  .panel-title-tag {
    left: 1.25rem;
  }

  .chat-modal {
    height: 100%;
    max-height: none;
    border-radius: var(--radius-lg);
  }

  .chat-modal-overlay {
    padding: 0.75rem;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .field-row {
    flex-direction: column;
  }
}

/* --------------------------------------------------------------------------
   14. Supabase states
   Added for the server-backed build: the boot fade that hides a protected
   page until the session resolves, the Closed status, read receipts and
   the announcements panel. Nothing above this line was changed.
   -------------------------------------------------------------------------- */

/* Protected pages stay blank for the few hundred milliseconds it takes to
   confirm the session, so their contents never flash at a signed-out
   visitor before the redirect fires. */
html.hz-booting body {
  opacity: 0;
}

html.hz-ready body {
  opacity: 1;
  transition: opacity 0.24s var(--ease);
}

.status-closed {
  background: rgba(var(--slate-rgb), 0.14);
  border-color: rgba(var(--slate-rgb), 0.3);
  color: var(--text-muted);
}

/* Sent / Seen, shown only under messages the reader sent themselves. */
.chat-receipt {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 0.4rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  opacity: 0.85;
}

.chat-receipt.is-seen {
  opacity: 1;
}

.chat-bubble.from-staff .chat-receipt.is-seen {
  color: var(--cyan);
}

/* Inline feedback while a list or conversation is loading. */
.hz-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 2.4rem 1rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.hz-loading::before {
  content: '';
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(var(--slate-rgb), 0.35);
  border-top-color: var(--cyan);
  animation: hzSpin 0.7s linear infinite;
}

@keyframes hzSpin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .hz-loading::before { animation-duration: 2s; }
  html.hz-ready body { transition: none; }
}

/* Published announcements, drawn with the existing panel styling. */
.announce-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.announce-item {
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: var(--input-bg);
  border: 1px solid var(--card-border);
}

.announce-item h3 {
  font-size: 0.95rem;
  margin: 0 0 0.3rem;
}

.announce-item p {
  margin: 0;
  font-size: 0.87rem;
  line-height: 1.55;
  color: var(--text-muted);
  white-space: pre-wrap;
}

.announce-item time {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.8;
}

/* Profile pictures, profile viewer and account editor */
.profile-avatar-trigger { cursor: pointer; border: 0; padding: 0; overflow: hidden; position: relative; }
.profile-avatar-trigger img, .profile-avatar-trigger .account-avatar-image { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.profile-picture-editor { display:flex; align-items:center; gap:1rem; }
.profile-picture-preview { width:72px; height:72px; border-radius:50%; overflow:hidden; display:grid; place-items:center; background:rgba(255,255,255,.08); font-weight:800; }
.profile-picture-preview img { width:100%; height:100%; object-fit:cover; }
.profile-bio-input { width:100%; resize:vertical; min-height:90px; padding: .85rem 1rem; }
.profile-field-group .field-row { align-items:center; justify-content:space-between; }
.hz-avatar-fallback { display:grid; place-items:center; width:100%; height:100%; font-weight:800; }
.hz-message-row { display:flex; gap:.65rem; align-items:flex-end; margin:.45rem 0; }
.hz-message-row.from-user { justify-content:flex-start; }
.hz-message-row.from-staff { justify-content:flex-end; }
.hz-message-avatar { flex:0 0 38px; width:38px; height:38px; border:0; border-radius:50%; overflow:hidden; padding:0; cursor:pointer; background:rgba(255,255,255,.08); color:inherit; }
.hz-message-avatar img { width:100%; height:100%; object-fit:cover; display:block; }
.hz-message-avatar .hz-avatar-fallback { font-size:.72rem; }
.hz-message-bubble-wrap { max-width:min(78%, 680px); }
.hz-message-meta { display:flex; gap:.45rem; align-items:center; flex-wrap:wrap; margin-top:.28rem; font-size:.68rem; opacity:.7; }
.hz-message-meta .chat-receipt { opacity:1; }
.hz-profile-modal { position:fixed; inset:0; z-index:10000; display:none; place-items:center; padding:1rem; background:rgba(0,0,0,.65); backdrop-filter:blur(10px); }
.hz-profile-modal.is-open { display:grid; }
.hz-profile-dialog { width:min(420px,100%); position:relative; border:1px solid rgba(255,255,255,.12); border-radius:24px; padding:2rem; background:rgba(10,15,28,.97); box-shadow:0 25px 80px rgba(0,0,0,.45); text-align:center; }
.hz-profile-close { position:absolute; top:.7rem; right:.8rem; border:0; background:transparent; color:inherit; font-size:1.7rem; cursor:pointer; }
.hz-profile-avatar { width:96px; height:96px; margin:0 auto 1rem; border-radius:50%; overflow:hidden; background:rgba(255,255,255,.08); display:grid; place-items:center; font-size:1.8rem; font-weight:800; }
.hz-profile-avatar img { width:100%; height:100%; object-fit:cover; }
.hz-profile-dialog h2 { margin:.2rem 0; }
.hz-profile-username { margin:.15rem 0 .7rem; opacity:.65; }
.hz-profile-role { display:inline-block; padding:.3rem .65rem; border-radius:999px; background:rgba(255,255,255,.09); font-size:.72rem; font-weight:700; }
.hz-profile-bio { margin:1.2rem 0; padding:1rem; border-radius:14px; background:rgba(255,255,255,.05); line-height:1.55; }
.hz-profile-details { display:grid; gap:.55rem; text-align:left; }
.hz-profile-details div { display:flex; justify-content:space-between; gap:1rem; padding:.7rem 0; border-bottom:1px solid rgba(255,255,255,.07); }
.hz-profile-details span { opacity:.6; }
.hz-profile-loading { padding:3rem 1rem; text-align:center; opacity:.7; }


/* =====================================================================
   Horizon chat extras — reactions, replies, edit/delete, files, typing
   ===================================================================== */

.hz-chat-context-menu {
  position: fixed;
  z-index: 12050;
  min-width: 190px;
  max-width: 250px;
  padding: .45rem;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: var(--surface-bg);
  box-shadow: 0 18px 60px rgba(0,0,0,.32);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: none;
}
.hz-chat-context-menu.is-open { display: block; }
.hz-chat-context-menu button {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: .58rem .7rem;
  border-radius: 9px;
  font: inherit;
  font-size: .76rem;
  cursor: pointer;
}
.hz-chat-context-menu button:hover {
  background: var(--hover-bg);
}
.hz-chat-context-menu .is-danger { color: var(--red); }
.hz-chat-emoji-row {
  display: none;
  gap: .18rem;
  padding: .4rem .25rem .25rem;
  border-top: 1px solid var(--card-border);
  margin-top: .25rem;
  flex-wrap: wrap;
}
.hz-chat-emoji-row.is-open { display: flex; }
.hz-chat-emoji-row button {
  width: auto;
  min-width: 32px;
  padding: .35rem;
  text-align: center;
  font-size: 1.05rem;
}
.hz-chat-message-action-target { outline: 1px solid rgba(var(--cyan-rgb), .35); outline-offset: 3px; }

.hz-message-bubble,
.chat-bubble,
.message-bubble { position: relative; }

.hz-message-body-tools {
  display: flex;
  gap: .35rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: .42rem;
}
.hz-reaction-chip {
  border: 1px solid var(--card-border);
  background: var(--input-bg);
  color: var(--text);
  border-radius: 999px;
  padding: .18rem .42rem;
  font: inherit;
  font-size: .72rem;
  line-height: 1.1;
  cursor: pointer;
}
.hz-reaction-chip:hover,
.hz-reaction-chip.is-mine {
  border-color: rgba(var(--cyan-rgb), .55);
  background: rgba(var(--cyan-rgb), .1);
}
.hz-reaction-chip.is-mine { box-shadow: 0 0 0 1px rgba(var(--cyan-rgb), .12) inset; }

.hz-message-reply {
  margin-bottom: .5rem;
  padding: .42rem .55rem;
  border-left: 3px solid rgba(var(--cyan-rgb), .65);
  border-radius: 8px;
  background: rgba(255,255,255,.06);
  font-size: .7rem;
  overflow: hidden;
}
.hz-message-reply strong { display: block; margin-bottom: .1rem; }
.hz-message-reply span {
  display: block;
  opacity: .72;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.message-row.user .hz-message-reply,
.chat-bubble.from-user .hz-message-reply {
  background: rgba(3,7,18,.13);
  border-left-color: rgba(3,7,18,.35);
}

.hz-message-edited {
  opacity: .62;
  font-style: italic;
}

.hz-attachment-card {
  display: flex;
  align-items: center;
  gap: .55rem;
  max-width: 100%;
  margin-top: .5rem;
  padding: .55rem .65rem;
  border: 1px solid var(--card-border);
  border-radius: 11px;
  background: rgba(255,255,255,.05);
}
.hz-attachment-card a {
  min-width: 0;
  color: inherit;
  text-decoration: none;
  font-size: .72rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.hz-attachment-card a:hover { text-decoration: underline; }
.hz-attachment-meta { display: block; margin-top: .12rem; opacity: .62; font-size: .62rem; font-weight: 500; }

.chat-typing-status {
  min-height: 0;
  padding: 0 .05rem .35rem;
  color: var(--text-muted);
  font-size: .7rem;
  font-weight: 600;
}
.chat-typing-status:empty { display: none; }
.chat-typing-status::before {
  content: '•';
  display: inline-block;
  margin-right: .3rem;
  opacity: .7;
}

.chat-compose-row {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
  width: 100%;
}
.chat-attach-btn {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border: 1px solid var(--card-border);
  border-radius: 11px;
  background: var(--input-bg);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
}
.chat-attach-btn:hover {
  border-color: rgba(var(--cyan-rgb), .5);
  transform: translateY(-1px);
}
.chat-compose-state {
  margin-bottom: .45rem;
  padding: .55rem .7rem;
  border: 1px solid rgba(var(--cyan-rgb), .35);
  border-radius: 10px;
  background: rgba(var(--cyan-rgb), .07);
  font-size: .72rem;
}
.chat-compose-state button {
  float: right;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
}
.chat-attachment-preview {
  margin-bottom: .45rem;
  padding: .55rem .7rem;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: var(--input-bg);
  font-size: .72rem;
  overflow-wrap: anywhere;
}
.chat-attachment-preview button {
  float: right;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.chat-drop-hint {
  padding-top: .32rem;
  text-align: center;
  color: var(--text-muted);
  font-size: .62rem;
  opacity: .7;
}
.chat-modal-footer.is-dragover,
.ticket-composer.is-dragover {
  border-color: rgba(var(--cyan-rgb), .55);
  background: rgba(var(--cyan-rgb), .045);
}
.hz-message-row.is-deleted .message-bubble { opacity: .55; }

@media (max-width: 650px) {
  .hz-chat-context-menu {
    min-width: 180px;
    max-width: calc(100vw - 24px);
  }
  .hz-message-bubble-wrap { max-width: 86%; }
  .chat-drop-hint { font-size: .58rem; }
}

