:root {
  --bg: #020617;
  --bg-alt: #020617;
  --accent: #6366f1;
  --accent-strong: #a855f7;
  --text: #f9fafb;
  --text-muted: #9ca3af;
  --border-subtle: rgba(148, 163, 184, 0.35);
  --card-bg: #020617;
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-full: 999px;
  --shadow-soft: 0 20px 60px rgba(15, 23, 42, 0.9);
  --progress-cyan:   #22d3ee;
  --progress-indigo: #6366f1;
  --progress-violet: #a855f7;
  --progress-orange: #f97316;

  --border-strong: rgba(148, 163, 184, 0.8);
  --border-soft-inner: rgba(15, 23, 42, 0.9);
  --card-shadow-strong: 0 22px 70px rgba(0, 0, 0, 0.95);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, #111827 0, #020617 55%, #000 100%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

/* ================= HEADER / LOGO ================= */

header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 6px 2px 18px;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: conic-gradient(
    from 160deg,
    #22d3ee,
    #6366f1,
    #a855f7,
    #f97316,
    #22d3ee
  );
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.55);
}

.logo-mark-inner {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-text span:first-child {
  font-weight: 650;
  letter-spacing: 0.12em;
  font-size: 12px;
  text-transform: uppercase;
}

.logo-text span:last-child {
  font-size: 11px;
  color: var(--text-muted);
}

/* Right side: icons + dropdown menu */

.header-icons {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 8px;
}

/* Base style shared by user-pill and other header buttons */

.header-button {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.45);
  background: rgba(15, 23, 42, 0.85);
  color: var(--text);
  gap: 8px;
  cursor: pointer;
}

/* User pill */

.user-pill {
  border-radius: 999px;
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: radial-gradient(circle at 30% 0, #38bdf8, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.6);
}

.header-user-name {
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
}

/* Envelope icon + badge */

.header-icon-btn {
  position: relative;
  background: transparent;
  border: none;
  padding: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  cursor: pointer;
  color: var(--text);
}

/* Base icon size (desktop) */
.messages-icon {
  width: 20px;
  height: 20px;
  display: block;
  fill: currentColor;
}

/* Bubble + icon size on mobile */
@media (max-width: 640px) {
  .header-icon-btn,
  .hamburger-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.96);
    border: none;
  }

  .messages-icon {
    width: 22px;
    height: 22px;
  }
}


.messages-badge {
  position: absolute;
  top: -4px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 1px #020617;
}

/* Hamburger base (desktop: hidden, mobile: shown via media query) */

.hamburger-btn {
  display: none;
  background: transparent;
  border: none;
  padding: 6px;
  border-radius: 999px;
  cursor: pointer;
}

.hamburger-btn span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 3px 0;
  background: var(--text, #f9fafb);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Buttons */

.btn {
  border-radius: var(--radius-full);
  padding: 6px 12px;
  font-size: 12px;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  background: transparent;
  color: var(--text);
  transition: background 0.15s ease, border-color 0.15s ease,
    transform 0.1s ease, box-shadow 0.1s ease, opacity 0.1s ease;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.btn-ghost {
  border-color: rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.8);
}

.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  border-color: rgba(129, 140, 248, 0.6);
  box-shadow: 0 10px 35px rgba(129, 140, 248, 0.7);
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 15px 45px rgba(15, 23, 42, 0.8);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 16px 55px rgba(129, 140, 248, 0.9);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
}

/* Mine button emphasis */

.mine-btn {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
}

.mine-btn-ready {
  box-shadow: 0 16px 55px rgba(52, 211, 153, 0.9);
  background: linear-gradient(120deg, #22c55e, #4ade80);
  border-color: rgba(74, 222, 128, 0.9);
}

.mine-btn:disabled {
  background: rgba(31, 41, 55, 0.9);
  border-color: rgba(75, 85, 99, 0.8);
  color: rgba(156, 163, 175, 0.9);
  box-shadow: none;
  text-transform: none;
  letter-spacing: 0.02em;
}

/* Ready flash */

.mine-btn-flash {
  animation: mineFlash 0.9s ease-in-out 2;
}

@keyframes mineFlash {
  0%   { transform: translateY(0); box-shadow: 0 0 0 rgba(52,211,153,0.0); }
  50%  { transform: translateY(-1px) scale(1.03); box-shadow: 0 0 20px rgba(52,211,153,0.9); }
  100% { transform: translateY(0); box-shadow: 0 0 0 rgba(52,211,153,0.0); }
}

/* Layout */

main {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 24px;
}

@media (max-width: 900px) {
  main {
    grid-template-columns: minmax(0, 1fr);
  }
}

.dash-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dash-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Panels / Cards */

.panel {
  padding: 16px 16px 18px;
  border-radius: var(--radius-xl);
  background:
    linear-gradient(
      to bottom,
      rgba(15, 23, 42, 0.96),
      rgba(15, 23, 42, 0.98)
    );
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
}

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

.panel-title {
  font-size: 15px;
  font-weight: 600;
}

.panel-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.panel-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Apps grid */

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-top: 6px;
}

.app-card {
  border-radius: var(--radius-lg);
  padding: 10px 11px 11px;
  background:
    radial-gradient(circle at top, rgba(31, 41, 55, 0.85), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(148, 163, 184, 0.4);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
}

/* hover glow */

.app-card:hover {
  border-color: rgba(148, 163, 184, 0.32);
  background: rgba(15, 23, 42, 0.70);
  box-shadow: 0 0 26px rgba(56, 189, 248, 0.15);
}

.app-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-tagline {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

/* Edit button on card */

.app-edit-icon {
  font-size: 18px;
  color: white;
  cursor: pointer;
  transition: color 0.15s ease, transform 0.1s ease;
  position: absolute;
  top: 10px;
  right: 10px;
}

.app-edit-icon:hover {
  color: rgba(30,64,175,0.9);
  transform: translateY(-1px);
}

.app-status-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  gap: 6px;
}

.status-pill {
  border-radius: 999px;
  padding: 2px 8px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.95);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 9px;
}

/* Pills: extra stijl voor "MINED BY" */
.status-pill[data-pill^="MINED BY"] {
  border-color: var(--accent-strong);
  background: rgba(168, 85, 247, 0.18);
  color: #e9d5ff;
  font-weight: 600;
}

.time-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  gap: 6px;
}

.time-row span {
  white-space: nowrap;
}

.time-row code {
  font-size: 10px;
  color: #e5e7eb;
  background: rgba(15, 23, 42, 0.95);
  padding: 1px 4px;
  border-radius: 6px;
  border: 1px solid rgba(31, 41, 55, 0.9);
}

.progress-bar {
  margin-top: 4px;
  height: 5px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.95);
  overflow: hidden;
  border: 1px solid rgba(31, 41, 55, 0.9);
  position: relative;
}

/* Empty shimmer background */

.progress-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, rgba(31, 41, 55, 0.3), rgba(15, 23, 42, 0.4));
  animation: shimmer 2s linear infinite;
  pointer-events: none;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    var(--progress-cyan),
    var(--progress-indigo),
    var(--progress-violet),
    var(--progress-orange),
    var(--progress-cyan)
  );
  background-size: 220% 100%;
  width: 0%;
  transition: width 0.2s linear;
}

/* When mining is finished, change to green gradient */
.progress-fill.finished {
  background: rgb(40,201,99);
  background-size: 200% 100%;
}

/* When mining: animated stripes */
.progress-fill.progress-anim {
  animation: progressStripe 1.4s linear infinite;
}

@keyframes progressStripe {
  0%   { background-position: 0% 0; }
  100% { background-position: -200% 0; }
}

.app-footer {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.small-muted {
  font-size: 10px;
  color: var(--text-muted);
}

.app-icon-image {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
}

/* Cards that do not match selected pill */

.app-card.pill-dimmed {
  opacity: 0.35;
  filter: grayscale(0.7);
}

.app-card.pill-dimmed .app-name,
.app-card.pill-dimmed .app-tagline,
.app-card.pill-dimmed .small-muted {
  color: var(--text-muted);
}

/* QR panel */

.qr-panel {
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.22), transparent 55%),
    rgba(15, 23, 42, 0.98);
  border: 1px solid var(--border-subtle);
  padding: 16px 16px 18px;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.qr-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.qr-title {
  font-size: 14px;
  font-weight: 600;
}

.qr-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* QR body layout */

.qr-body {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.qr-left {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.qr-right {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  min-width: 0;
}

.qr-box {
  width: 120px;
  height: 120px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 30% 0, rgba(56, 189, 248, 0.16), transparent 55%),
    #020617;
  border: 1px solid rgba(148, 163, 184, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.qr-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

.qr-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.qr-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.qr-code-value {
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.95);
}

.qr-share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.qr-link-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.qr-link-inner code {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}



/* When QR is modal: floating */

.qr-panel.qr-panel--modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, 100% - 32px);
  max-height: calc(100vh - 80px);
  z-index: 1300;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(15, 23, 42, 0.68);
  border-color: rgba(148, 163, 184, 0.25);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 28px 80px rgba(0, 0, 0, 0.9);
}

.qr-panel.qr-panel--modal .qr-body {
  flex-direction: column;
}

/* Stats */

.stats-panel {
  padding: 14px 14px 15px;
  border-radius: var(--radius-xl);
  background: radial-gradient(circle at top, rgba(31, 41, 55, 0.85), #020617 70%);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
}

.stats-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 12px;
}

.stats-col {
  flex: 1;
}

.stats-label {
  color: var(--text-muted);
  font-size: 11px;
}

.stats-value {
  font-weight: 600;
}

/* Footer */

footer {
  margin-top: 24px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

/* Filter buttons */

.filter-group {
  display: flex;
  gap: 6px;
}

.filter-toggle {
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.9);
  background: rgba(15,23,42,0.95);
  padding: 5px 10px;
  cursor: pointer;
  font-size: 11px;
  color: var(--text);
}

.filter-toggle.active {
  border-color: rgba(129,140,248,0.9);
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  box-shadow: 0 8px 25px rgba(129,140,248,0.6);
}

/* Pill legend */

.pill-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.pill-legend-label {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.pill-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill-legend-item {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid rgba(148,163,184,0.7);
  background: rgba(15,23,42,0.9);
  cursor: pointer;
  color: var(--text);
}

.pill-legend-item.active {
  border-color: rgba(129,140,248,0.9);
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  box-shadow: 0 6px 20px rgba(129,140,248,0.7);
}

/* Empty state */

.apps-empty {
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.7);
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.apps-empty-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}

/* Floating Refer button */

.refer-fab {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 1200;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.refer-fab-mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: conic-gradient(
    from 160deg,
    #22d3ee,
    #6366f1,
    #a855f7,
    #f97316,
    #22d3ee
  );
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.55);
  transition: transform 0.14s ease, box-shadow 0.14s ease, opacity 0.14s ease;
}

.refer-fab-inner {
  width: 34px;
  height: 34px;
  background: rgba(15, 23, 42, 0.96);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e5e7eb;
}

.refer-fab:hover .refer-fab-mark {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 18px 45px rgba(129, 140, 248, 0.9);
}

.refer-fab:active .refer-fab-mark {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.9);
}

@media (max-width: 480px) {
  .refer-fab {
    bottom: 14px;
  }
  .refer-fab-mark {
    width: 50px;
    height: 50px;
    border-radius: 16px;
  }
  .refer-fab-inner {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }
}

/* Auth pages */

.auth-body {
  background:
    radial-gradient(circle at top, #111827 0, #020617 55%, #000 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-page {
  width: 100%;
  max-width: 1120px;
  padding: 24px 16px;
  display: flex;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  background:
    radial-gradient(circle at top left, rgba(129,140,248,0.25), transparent 60%),
    radial-gradient(circle at bottom right, rgba(15,118,110,0.25), transparent 60%),
    #020617;
  box-shadow: var(--shadow-soft);
  padding: 20px 18px 18px;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.auth-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Google button */

.auth-google-btn {
  width: 100%;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.7);
  background: rgba(15,23,42,0.95);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.auth-google-btn:hover {
  background: rgba(30,64,175,0.95);
  border-color: rgba(129,140,248,0.9);
  transform: translateY(-1px);
}

.auth-google-icon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: #ffffff;
  color: #1f2937;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

/* Divider */

.auth-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0;
}

.auth-divider span {
  flex: 1;
  height: 1px;
  background: rgba(55,65,81,0.9);
}

.auth-divider em {
  font-size: 11px;
  color: var(--text-muted);
}

/* Form */

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-label {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-input {
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.7);
  background: rgba(15,23,42,0.95);
  padding: 7px 11px;
  font-size: 12px;
  color: var(--text);
}

.auth-input:focus {
  outline: none;
  border-color: rgba(129,140,248,0.9);
  box-shadow: 0 0 0 1px rgba(129,140,248,0.4);
}

.auth-submit {
  width: 100%;
  margin-top: 4px;
  justify-content: center;
}

/* Auth footer */

.auth-footer-text {
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

.auth-footer-text a {
  color: #a5b4fc;
  text-decoration: underline;
}

/* Auth error */

.auth-error {
  margin-top: 10px;
  font-size: 11px;
  color: #fecaca;
  background: rgba(127,29,29,0.3);
  border-radius: 12px;
  padding: 6px 8px;
  border: 1px solid rgba(248,113,113,0.6);
}

/* === MODAL OVERLAY =================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(0, 0, 0, 0.8);
  overflow-y: auto;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.2s ease-out;
}

/* hidden attribute: completely hide */

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Modal card */

.modal {
  width: 100%;
  max-width: 420px;
  border-radius: var(--radius-xl);
  background: rgba(20, 28, 48, 0.75);
  border: 1px solid rgba(209, 213, 219, 0.2);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.95);
  padding: 14px 16px 16px;
  color: var(--text);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  padding-bottom: 8px;
}

.modal-title {
  font-size: 14px;
  font-weight: 600;
  color: #e5e7eb;
}

.modal-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.modal-body {
  font-size: 12px;
  max-height: none;
  overflow: visible;
  padding-right: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.modal-body::-webkit-scrollbar {
  width: 0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-label {
  font-size: 11px;
  color: var(--text-muted);
}

.modal-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

#refModalCode {
  font-size: 11px;
  background: rgba(15, 23, 42, 0.96);
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid rgba(30, 64, 175, 0.9);
}

.modal-input {
  width: 100%;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.96);
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text);
  outline: none;
}

.modal-input:focus {
  outline: none;
  border-color: rgba(129, 140, 248, 0.9);
  box-shadow: 0 0 8px rgba(129, 140, 248, 0.25);
}

/* Close buttons */

/* Close buttons */

/* Generieke X-knop: standaard verborgen */
.qr-close-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  display: none; /* standaard: geen X */
  align-items: center;
  justify-content: center;
}


/* Open link button inside modal not full width */

#refModalLink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* === HAMBURGER MENU – MOBILE BEHAVIOUR === */

@media (max-width: 640px) {

  header {
    position: relative;
    padding: 8px 12px;
    gap: 8px;
  }

  .logo-text span:nth-child(2) {
    display: none;
  }

  .header-icons {
    margin-left: auto;
    gap: 8px;
  }

  /* Dropdown menu: initially hidden */
  .header-right {
    display: none;
    position: absolute;
    top: 100%;
    right: 12px;
    margin-top: 8px;
    padding: 8px;
    background: var(--bg-alt, #020617);
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-soft, 0 20px 60px rgba(15, 23, 42, 0.9));
    flex-direction: column;
    align-items: stretch;
    min-width: 180px;
    z-index: 50;
    gap: 6px;
  }

  header.menu-open .header-right {
    display: flex;
  }

  .header-right .header-button,
  .header-right .user-pill {
    width: 100%;
    justify-content: flex-start;
  }

  .hamburger-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  header.menu-open .hamburger-btn span:nth-child(1) {
    transform: translateY(5px) rotate(45deg);
  }
  header.menu-open .hamburger-btn span:nth-child(2) {
    opacity: 0;
  }
  header.menu-open .hamburger-btn span:nth-child(3) {
    transform: translateY(-5px) rotate(-45deg);
  }

  /* QR body stacked on small screens */
  .qr-body {
    flex-direction: column;
  }
}

/* Install banner */

.install-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(12px);
  z-index: 9999;
  display: none;
}

.install-banner.show {
  display: block;
}

.install-banner-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.install-banner-text {
  flex: 1;
  font-size: 12px;
  color: var(--text-muted, #9ca3af);
}

.install-banner-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #f9fafb);
}

.install-banner-sub {
  font-size: 11px;
  margin-top: 2px;
}

.install-banner-actions {
  display: flex;
  gap: 6px;
}

@media (max-width: 520px) {
  .install-banner-inner {
    flex-direction: column;
    align-items: stretch;
  }
  .install-banner-actions {
    justify-content: flex-end;
  }
}

/* Splash screen */

.app-splash {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at top, #0b1120 0, #020617 60%);
  z-index: 9999;
  pointer-events: auto;
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.35s ease-out, transform 0.35s ease-out;
}

.app-splash.hide {
  opacity: 0;
  transform: scale(1.02);
}

.app-splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 26px;
  border-radius: 24px;
  background: rgba(15, 23, 42, 0.88);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.35);
  animation: splash-pop 0.45s ease-out;
}

.app-splash-logo {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 24px;
  letter-spacing: 0.05em;
  color: #e5e7eb;
  background: conic-gradient(
    from 210deg,
    #22d3ee,
    #6366f1,
    #a855f7,
    #f97316,
    #22d3ee
  );
  position: relative;
  overflow: hidden;
}

.app-splash-logo::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: inherit;
  background: radial-gradient(circle at top, #1e293b 0, #020617 80%);
}

.app-splash-logo::after {
  content: "M";
  position: relative;
  z-index: 1;
}

.app-splash-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #f9fafb;
}

.app-splash-sub {
  font-size: 13px;
  color: #9ca3af;
}

@keyframes splash-pop {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Steps in modal */

.steps {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.step-block {
  display: flex;
  gap: 12px;
  background: rgba(255,255,255,0.03);
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.06);
}

.step-number {
  width: 26px;
  height: 26px;
  background: var(--accent);
  color: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(0,0,0,0.15);
}

.step-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.step-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.step-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Copy feedback */

.copied-text {
  font-size: 11px;
  color: var(--accent);
  opacity: 0;
  transition: opacity .3s;
}

.copied-text.visible {
  opacity: 1;
}

/* Universal glassy look for main cards */

.panel,
.app-card,
.qr-panel,
.modal {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 10px 30px rgba(0, 0, 0, 0.65);
}

/* Stronger borders on app-cards */

.app-card {
  border: 1px solid rgba(148, 163, 184, 0.16);
}

/* Mobile performance mode */

@media (max-width: 768px) {

  .panel,
  .app-card,
  .qr-panel,
  .stats-panel,
  .modal {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(15, 23, 42, 0.96) !important;
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.75) !important;
  }

  .install-banner {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(15, 23, 42, 0.98) !important;
  }

  .app-card:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.7);
    background: rgba(15, 23, 42, 0.98);
  }

  .refer-fab-mark {
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.8);
  }
}

/* Toggle switch (Subscribed / Unsubscribed) */

.toggle-switch {
  position: relative;
  width: 210px;
  height: 40px;
  background: rgba(255,255,255,0.05);
  border-radius: 999px;
  padding: 4px;
  display: flex;
  align-items: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.08);
}

.toggle-option {
  flex: 1;
  text-align: center;
  font-size: 14px;
  z-index: 2;
  transition: color .25s;
  user-select: none;
  color: #9ca3af;
}

.toggle-option.active {
  color: #fff;
}

.toggle-slider {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: linear-gradient(135deg, #6366f1, #a855f7);
  border-radius: 999px;
  transition: transform .25s ease-in-out;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.toggle-switch.unsubscribed .toggle-slider {
  transform: translateX(100%);
}

/* =========================
   MESSAGES PANEL + COMPOSE
   ========================= */

/* Prevent body scroll when messages modal open */
body.messages-open {
  overflow: hidden;
}

/* Tabs row */

.messages-tab-bar {
  display: inline-flex;
  margin-top: 8px;
  gap: 4px;
  padding: 2px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148,163,184,0.35);
}

.messages-tab {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  line-height: 1.2;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.messages-tab.active {
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: 0 8px 20px rgba(129,140,248,0.7);
}

/* Messages container uses qr-body styling */
.messages-panel .qr-body {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.messages-panel-inner {
  width: 100%;
}

/* Message list */

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
  width: 100%;
}

.message-item {
  width: 100%;
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(148,163,184,0.35);
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .1s ease;
}

.message-item:hover {
  border-color: rgba(129,140,248,0.9);
  background: rgba(15, 23, 42, 0.98);
  transform: translateY(-1px);
}

.message-item.unread {
  border-color: rgba(129,140,248,0.9);
  background: radial-gradient(circle at top left, rgba(37,99,235,0.25), rgba(15,23,42,0.98));
}

.message-item-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 10px;
  color: var(--text-muted);
}

.message-from,
.message-to {
  font-weight: 600;
  font-size: 11px;
}

.message-date {
  font-size: 10px;
  color: var(--text-muted);
}

.message-subject {
  font-size: 12px;
  font-weight: 600;
}

.message-snippet {
  font-size: 11px;
  color: var(--text-muted);
}

.message-reply-inline.btn {
  padding: 3px 8px;
  font-size: 10px;
}

/* Compose form */

.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.form-row label {
  font-size: 11px;
  color: var(--text-muted);
}

.char-counter {
  font-size: 10px;
  color: var(--text-muted);
  text-align: right;
  margin-top: 2px;
}

/* Recipient chips + input */

.recipient-to-wrapper {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.5);
  background: rgba(15,23,42,0.96);
}

.recipient-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.recipient-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(30,64,175,0.45);
  border: 1px solid rgba(59,130,246,0.6);
  font-size: 11px;
  color: #e5e7eb;
}

.recipient-chip button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 0;
  line-height: 1;
}

.recipient-input {
  border: none;
  background: transparent;
  flex: 1 1 auto;
  min-width: 90px;
  padding: 2px 4px;
  font-size: 12px;
  color: var(--text);
  outline: none;
}

.recipient-input::placeholder {
  color: rgba(148,163,184,0.7);
}

/* Referral choices */

.referred-choices {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.referred-choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.referred-choice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(15,23,42,0.96);
  border: 1px solid rgba(55,65,81,0.9);
  cursor: pointer;
  font-size: 11px;
}

.referred-choice input[type="checkbox"] {
  accent-color: var(--accent);
}

/* Messages detail (if used later) */

.messages-detail {
  margin-top: 4px;
}

/* Messages panel also as modal (same chrome as QR modal) */

.messages-panel.qr-panel--modal {
  background: rgba(15, 23, 42, 0.68);
  border-color: rgba(148, 163, 184, 0.25);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 28px 80px rgba(0, 0, 0, 0.9);
  z-index: 1300;
}

/* Alleen X tonen als het paneel echt in modal-modus staat */
.qr-panel.qr-panel--modal .qr-close-btn,
.messages-panel.qr-panel--modal .qr-close-btn {
  display: inline-flex;
}

.modal-input,
.recipient-to-wrapper,
.recipient-input {
  border-radius: 8px !important;
}

/* Default size for the envelope icon inside the header button */
.header-icon-btn .messages-icon {
  font-size: 18px;       /* desktop */
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 640px) {
  /* Make envelope + hamburger same size bubble */
  .header-icon-btn,
  .hamburger-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.96);
    border: none;
  }

  /* Make the envelope itself bigger on mobile */
  .header-icon-btn .messages-icon {
    font-size: 22px;
    line-height: 1;
  }
}
