/* Galatea Dashboard — component styles
 * Design tokens come from assets/tokens.css (brandbook v1.0).
 * This file provides component rules only. DO NOT redefine :root here —
 * it would cascade-override tokens.css and silently break other surfaces.
 * Reset lives in tokens.css.
 *
 * Body font is intentionally monospace (cabinet = operator tool aesthetic).
 * Headings use --font-display which tokens.css aliases to --font (Plus Jakarta Sans).
 */

html { font-size: 16px; }
body {
  font-family: var(--font-mono);
  font-weight: 300;
  background: var(--bg-deep);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ── Atmospheric background ─────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(233, 69, 96, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 90%, rgba(83, 52, 131, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 50% 50%, rgba(30, 42, 74, 0.4) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Grain overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Typography ─────────────────────────────────────── */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* ── Layout ─────────────────────────────────────────── */
.page-wrap {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ── Header ─────────────────────────────────────────── */
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 36px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand h1 {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.btn-logout {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.04em;
}
.btn-logout:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Cards ──────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 20px;
  transition: border-color var(--transition);
  position: relative;
  overflow: hidden;
}
.card:hover { border-color: var(--border-hover); }

.card-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ── Grid ───────────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* ── Subscription Card ──────────────────────────────── */
.sub-card {
  position: relative;
}
.sub-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--accent) 0%, var(--secondary) 100%);
  border-radius: 4px 0 0 4px;
}

.sub-tier {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.sub-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 3px 10px;
  border-radius: 20px;
}
.badge-active {
  background: var(--success-dim);
  color: var(--success);
  border: 1px solid rgba(149, 213, 178, 0.25);
}
.badge-expired {
  background: rgba(233, 69, 96, 0.12);
  color: var(--accent);
  border: 1px solid rgba(233, 69, 96, 0.25);
}
.badge-tier {
  background: var(--secondary-soft);
  color: var(--text-dim);
  border: 1px solid rgba(83, 52, 131, 0.4);
}

.sub-meta {
  font-size: 0.8rem;
  color: var(--text-dim);
}
.sub-meta span { color: var(--text); }

/* ── License Key ────────────────────────────────────── */
.license-display {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-top: 8px;
}

.license-key {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text);
  flex: 1;
}

.btn-copy {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-copy:hover {
  border-color: var(--success);
  color: var(--success);
}
.btn-copy.copied {
  border-color: var(--success);
  color: var(--success);
}

/* ── Usage Stats ────────────────────────────────────── */
.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}
/* Hero variant — the single most important number on the page.
   Used by Replies Today on the Account tab (F-pattern top-left). */
.stat-value-hero {
  font-size: clamp(3.2rem, 6vw, 5rem);
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--accent) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  margin-bottom: 8px;
}
.stat-value-hero .stat-of {
  /* the "/ 150" part — smaller, de-emphasized so the big number dominates */
  font-size: 1.1rem;
  color: var(--text-muted);
  -webkit-text-fill-color: var(--text-muted);
}
.stat-value-md {
  font-size: 2.4rem;
  color: var(--text);
}
.stat-of {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-dim);
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Sparkline — inline SVG trend indicator for hero stat cards.
   14 data points from the last 14 days of usage.daily, rendered as a
   violet→magenta gradient line + subtle area fill. Empty until JS fills it. */
.stat-sparkline {
  display: block;
  width: 100%;
  height: 48px;
  margin-top: 18px;
  opacity: 0;
  transition: opacity 0.5s ease 0.2s;
}
.stat-sparkline.loaded { opacity: 1; }
.stat-sparkline-side { height: 38px; margin-top: 14px; }

/* F-pattern hero grid — wide Today + narrow This Month side column */
.account-hero-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.hero-stat-card {
  padding: 36px 32px;
  background: linear-gradient(155deg, rgba(139,92,246,0.08) 0%, var(--bg-card) 60%);
  border-color: var(--border-strong);
}
.hero-stat-card .card-label {
  font-size: 0.78rem;
  margin-bottom: 6px;
}
.hero-stat-card .stat-label {
  font-size: 0.85rem;
  margin-top: 4px;
}
.hero-stat-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
@media (max-width: 860px) {
  .account-hero-grid { grid-template-columns: 1fr; }
}

/* Celebration — when JS adds .celebrating to .hero-stat-card (e.g. progress
   hit 100% of daily limit, or monthRequests rolled past a milestone), the
   card pulses a gold glow once. 1.5s total. CSS-only, no JS dependencies. */
@keyframes celebrate-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.0),  var(--sh-md); }
  25%  { box-shadow: 0 0 60px 6px rgba(245, 158, 11, 0.55), 0 8px 32px rgba(139, 92, 246, 0.3); }
  60%  { box-shadow: 0 0 40px 4px rgba(236, 72, 153, 0.45), 0 8px 32px rgba(139, 92, 246, 0.25); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.0), var(--sh-md); }
}
.hero-stat-card.celebrating {
  animation: celebrate-pulse 1.8s cubic-bezier(0.4, 0, 0.2, 1) 1;
}
@keyframes celebrate-count {
  0%,100% { transform: translateY(0); }
  30%    { transform: translateY(-4px) scale(1.04); }
  60%    { transform: translateY(0) scale(1.01); }
}
.hero-stat-card.celebrating .stat-value-hero {
  display: inline-block;
  animation: celebrate-count 1.8s cubic-bezier(0.4, 0, 0.2, 1) 1;
}

/* Progress bar */
.progress-track {
  width: 100%;
  height: 6px;
  background: var(--bg-deep);
  border-radius: 3px;
  margin-top: 14px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--secondary) 100%);
  transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
}
.progress-fill::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 20px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2));
  border-radius: 0 3px 3px 0;
}

.stat-month {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.stat-month-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.stat-month-num {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
}

/* ── Buttons ────────────────────────────────────────── */
.btn {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 6px 30px var(--accent-glow);
}

.btn-secondary {
  background: var(--secondary);
  color: #FFFFFF;
  box-shadow: 0 4px 20px var(--secondary-soft);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--secondary-hover);
}

.btn-outline {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-outline:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-row {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

/* ── Table ──────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  margin-top: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

th {
  text-align: left;
  font-weight: 500;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 14px;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(42, 42, 69, 0.5);
}

tr:last-child td { border-bottom: none; }
tr:hover td { color: var(--text); }

.td-status {
  font-weight: 500;
}
.td-status.confirmed { color: var(--success); }
.td-status.pending { color: var(--warning); }
.td-status.failed { color: var(--accent); }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ── Login page ─────────────────────────────────────── */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.login-box {
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-brand {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent) 0%, var(--secondary) 50%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 40px;
  letter-spacing: 0.06em;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
}

.input-group {
  margin-bottom: 20px;
  text-align: left;
}

.input-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.input-field {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text);
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  outline: none;
  transition: var(--transition);
  text-align: center;
}
.input-field::placeholder {
  color: var(--text-muted);
  letter-spacing: 0.05em;
}
.input-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-btn {
  width: 100%;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 24px var(--accent-glow);
}
.login-btn:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 8px 32px var(--accent-glow);
  transform: translateY(-1px);
}
.login-btn:active { transform: translateY(0); }
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.login-error {
  font-size: 0.8rem;
  color: var(--accent);
  margin-top: 16px;
  min-height: 1.4em;
}

.login-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 24px;
}
.login-hint a {
  color: var(--accent);
  text-decoration: none;
}
.login-hint a:hover { text-decoration: underline; }

/* ── Animations ─────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.anim-in {
  opacity: 0;
  animation: fadeUp 0.5s ease forwards;
}
.anim-in:nth-child(1) { animation-delay: 0s; }
.anim-in:nth-child(2) { animation-delay: 0.08s; }
.anim-in:nth-child(3) { animation-delay: 0.16s; }
.anim-in:nth-child(4) { animation-delay: 0.24s; }
.anim-in:nth-child(5) { animation-delay: 0.32s; }

.login-box { animation: fadeUp 0.6s ease forwards; }

/* ── Loading spinner ────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ──────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 12px 20px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 100;
  animation: fadeUp 0.3s ease;
  transition: opacity 0.3s ease;
}
.toast.toast-success { border-color: var(--success); color: var(--success); }
.toast.toast-error { border-color: var(--accent); color: var(--accent); }
.toast.hiding { opacity: 0; }

/* ── Home Tab ──────────────────────────────────────── */
.home-welcome {
  border-left: 3px solid var(--accent);
  background: linear-gradient(135deg, rgba(139,92,246,0.08) 0%, var(--bg-card) 40%);
  padding: 28px 28px;
}
.home-golive-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: var(--transition);
  letter-spacing: 0.02em;
}
.home-golive-btn:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(139,92,246,0.06);
}
.home-shift-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.home-shift-card {
  padding: 20px 16px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.home-shift-conv { border-top: 2px solid var(--accent); }
.home-shift-return { border-top: 2px solid var(--success); }
.home-shift-spender { border-top: 2px solid var(--warning); }
.home-shift-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}
.home-shift-conv .home-shift-value { color: var(--accent); }
.home-shift-return .home-shift-value { color: var(--success); }
.home-shift-spender .home-shift-value { color: var(--warning); }
.home-shift-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 6px;
}
.home-shift-hint {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 4px;
  min-height: 1em;
}
.home-sparkline {
  height: 28px;
  margin-top: 8px;
}
.home-empty-state {
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 28px 16px;
  text-align: center;
  width: 100%;
}
.home-regulars {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.home-regulars::-webkit-scrollbar { height: 4px; }
.home-regulars::-webkit-scrollbar-track { background: transparent; }
.home-regulars::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.home-regular-card {
  flex: 0 0 140px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  cursor: pointer;
  transition: var(--transition);
}
.home-regular-card:hover {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(139,92,246,0.06) 0%, var(--bg-card) 100%);
}
.home-regular-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-regular-meta {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 3px;
}
.home-regular-badge {
  display: inline-block;
  font-size: 0.55rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 1px 6px;
  border-radius: 10px;
  margin-bottom: 6px;
}
.home-regular-drift {
  font-size: 0.6rem;
  color: var(--accent);
  margin-top: 4px;
}
.home-progress {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.home-progress-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.home-progress-icon { font-size: 1.1rem; }
.home-progress-val {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text);
}
.home-progress-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.home-progress-sep {
  width: 1px;
  height: 24px;
  background: var(--border);
}
.account-details-collapse {
  margin-top: 24px;
}
.account-details-collapse > .card,
.account-details-collapse > .grid-2,
.account-details-collapse > .account-hero-grid {
  margin-top: 12px;
}
.account-details-summary {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dim);
  cursor: pointer;
  padding: 12px 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.account-details-summary::before {
  content: '\25B6';
  font-size: 0.6rem;
  transition: transform 0.2s ease;
}
details[open] > .account-details-summary::before {
  transform: rotate(90deg);
}
.account-details-summary::-webkit-details-marker { display: none; }

/* ── Pinned Fields ────────────────────────────────── */
.pinned-field-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pinned-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-deep);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
}
.pinned-field-icon { font-size: 0.9rem; flex-shrink: 0; }
.pinned-field-key {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  min-width: 60px;
}
.pinned-field-val {
  flex: 1;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pinned-field-edit,
.pinned-field-del {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 2px 4px;
  border-radius: 3px;
  transition: var(--transition);
}
.pinned-field-edit:hover { color: var(--accent); }
.pinned-field-del:hover { color: var(--accent); }
.pinned-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--sh-md);
  z-index: 100;
  min-width: 120px;
}
.pinned-dropdown-item {
  padding: 8px 14px;
  font-size: 0.75rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease;
}
.pinned-dropdown-item:hover {
  background: var(--bg-deep);
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 640px) {
  .page-wrap { padding: 24px 16px 60px; }
  .dash-header { flex-wrap: wrap; gap: 12px; }
  .btn-row { flex-direction: column; }
  .card { padding: 20px; }
  .sub-tier { font-size: 1.3rem; }
  .stat-value { font-size: 1.6rem; }
  .home-shift-grid { grid-template-columns: 1fr; }
  .home-progress { gap: 10px; }
  .home-progress-sep { display: none; }
}

/* ── Toggle switch (settings-slider) ──────────────── */
.notify-toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}
.notify-toggle-wrap + .notify-toggle-wrap {
  border-top: 1px solid var(--border);
}
.notify-toggle-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.4;
}
.notify-toggle-label small {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.notify-switch {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.notify-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.notify-switch .slider {
  position: absolute;
  inset: 0;
  background: #333;
  border-radius: 22px;
  cursor: pointer;
  transition: background 0.3s;
}
.notify-switch .slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: #FFFFFF;
  border-radius: 50%;
  transition: transform 0.3s;
}
.notify-switch input:checked + .slider {
  background: var(--accent);
}
.notify-switch input:checked + .slider::before {
  transform: translateX(18px);
}

/* ── Reduced motion ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════════════════
   CABINET — moved from cabinet.html inline <style>
   ═══════════════════════════════════════════════════════ */

/* ── Tab Navigation ──────────────────────────────── */
.tab-bar { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 28px; gap: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn { font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; padding: 12px 20px; border: none; border-bottom: 2px solid transparent; background: none; color: var(--text-muted); cursor: pointer; transition: var(--transition); flex-shrink: 0; white-space: nowrap; }
.tab-btn:hover { color: var(--text-dim); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; contain: content; }

/* ── Viewer Grid ─────────────────────────────────── */
.viewer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.viewer-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; cursor: pointer; transition: border-color var(--transition), box-shadow var(--transition); position: relative; }
.viewer-card:hover { border-color: var(--border-hover); box-shadow: 0 4px 20px rgba(0,0,0,0.3); }
.viewer-card .v-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.viewer-card .v-nick { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.viewer-card .v-display { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); margin-bottom: 0; }
.viewer-card .v-score { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 700; min-width: 32px; text-align: center; padding: 2px 6px; border-radius: 6px; line-height: 1.4; }
.viewer-card .v-badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.viewer-card .v-platform { display: inline-block; font-family: var(--font-mono); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.1em; padding: 2px 8px; border-radius: 20px; background: var(--secondary-soft); color: var(--text-dim); border: 1px solid rgba(83,52,131,0.4); }
.viewer-card .v-segment { display: inline-block; font-family: var(--font-mono); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.1em; padding: 2px 8px; border-radius: 20px; }
.viewer-card .v-churn { display: inline-block; font-family: var(--font-mono); font-size: 0.6rem; padding: 2px 8px; border-radius: 20px; background: rgba(248,113,113,0.1); color: #f87171; border: 1px solid rgba(248,113,113,0.3); }
.viewer-card .v-meta { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-dim); line-height: 1.7; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.viewer-card .v-summary { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); margin-top: 8px; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.viewer-card .v-icons { display: flex; gap: 8px; margin-top: 8px; font-size: 0.65rem; color: var(--text-muted); }
.viewer-card .v-tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.viewer-card .v-tag { font-family: var(--font-mono); font-size: 0.6rem; padding: 2px 8px; border-radius: 12px; background: var(--bg-deep); color: var(--text-dim); border: 1px solid var(--border); }

/* ── Viewers Stats Summary ──────────────────────────── */
.vt-stats { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.vt-stat { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; flex: 1; min-width: 100px; text-align: center; }
.vt-stat-value { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; color: var(--text); }
.vt-stat-label { font-family: var(--font-mono); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-top: 2px; }
@media (max-width: 600px) { .viewer-grid { grid-template-columns: 1fr !important; } .vt-stats { gap: 8px; } .vt-stat { min-width: 70px; padding: 8px 10px; } }

/* ── Search & Sort Row ────────────────────────────── */
.search-row { display: flex; gap: 12px; margin-bottom: 20px; }
.search-input { flex: 1; width: 100%; font-family: var(--font-mono); font-size: 0.85rem; font-weight: 500; letter-spacing: 0.04em; color: var(--text); background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; outline: none; transition: var(--transition); text-align: left; }
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.sort-select { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text); background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; outline: none; cursor: pointer; transition: var(--transition); min-width: 160px; }
.sort-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* ── Viewer Detail Modal ─────────────────────────── */
.viewer-detail-overlay { display: none; position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); }
.viewer-detail { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 90%; max-width: 520px; max-height: 85vh; overflow-y: auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; }
.viewer-detail .notes-textarea { width: 100%; font-family: var(--font-mono); font-size: 0.8rem; color: var(--text); background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; resize: vertical; outline: none; transition: var(--transition); }
.viewer-detail .notes-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.viewer-detail .tags-input { width: 100%; font-family: var(--font-mono); font-size: 0.8rem; color: var(--text); background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; outline: none; transition: var(--transition); }
.viewer-detail .tags-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* ── Stats Tab ────────────────────────────────────── */
.roi-card { background: var(--bg-card); border: 1px solid var(--border); border-left: 4px solid #C5A05E; border-radius: var(--radius-lg); padding: 24px; margin-bottom: 20px; }
.roi-value { font-family: var(--font-display); font-size: 2.4rem; font-weight: 800; color: #C5A05E; line-height: 1; margin-bottom: 4px; }
.roi-label { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.1em; }
.stat-bar-row { display: flex; align-items: center; margin-bottom: 8px; }
.stat-bar-label { font-family: var(--font-mono); font-size: 0.72rem; width: 120px; color: var(--text-dim); flex-shrink: 0; }
.stat-bar { flex: 1; height: 24px; background: var(--bg-deep); border-radius: var(--radius-sm); overflow: hidden; }
.stat-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent) 0%, var(--secondary) 100%); border-radius: var(--radius-sm); transition: width 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
.stat-bar-count { font-family: var(--font-mono); font-size: 0.72rem; margin-left: 8px; color: var(--text-dim); min-width: 32px; text-align: right; }

/* ── Wizard Overlay ──────────────────────────────── */
.wizard-overlay { display: none; position: fixed; inset: 0; z-index: 100; background: var(--bg-deep); overflow-y: auto; }
.wizard-wrap { max-width: 520px; margin: 0 auto; padding: 60px 24px 80px; position: relative; z-index: 1; }
.wizard-progress { display: flex; gap: 4px; margin-bottom: 32px; }
.wizard-progress .step { flex: 1; height: 4px; background: var(--border); border-radius: 2px; transition: background var(--transition); }
.wizard-progress .step.active { background: var(--accent); }
.wizard-progress .step.done { background: var(--success); }
.wizard-title { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.wizard-subtitle { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-dim); margin-bottom: 28px; }
.wizard-step { display: none; }
.wizard-step.active { display: block; }
.wizard-field { margin-bottom: 16px; }
.wizard-field label { display: block; font-family: var(--font-mono); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); margin-bottom: 8px; }
.wizard-field input, .wizard-field textarea { width: 100%; font-family: var(--font-mono); font-size: 0.9rem; color: var(--text); background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; outline: none; transition: var(--transition); }
.wizard-field input:focus, .wizard-field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.wizard-field textarea { resize: vertical; min-height: 60px; }
.wizard-field input::placeholder, .wizard-field textarea::placeholder { color: var(--text-muted); }
.wizard-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 32px; }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.preset-card { background: var(--bg-card); border: 2px solid var(--border); padding: 16px; border-radius: var(--radius); cursor: pointer; transition: var(--transition); }
.preset-card:hover { border-color: var(--border-hover); }
.preset-card.selected { border-color: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }
.preset-card h4 { font-family: var(--font-display); font-size: 0.9rem; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.preset-card .preset-desc { font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-dim); line-height: 1.4; }
.preset-example { font-family: var(--font-mono); font-size: 0.72rem; font-style: italic; color: var(--text-muted); margin-top: 8px; line-height: 1.3; }
.wizard-summary { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.wizard-summary .sum-row { display: flex; justify-content: space-between; padding: 6px 0; font-family: var(--font-mono); font-size: 0.78rem; border-bottom: 1px solid rgba(42,42,69,0.5); }
.wizard-summary .sum-row:last-child { border-bottom: none; }
.wizard-summary .sum-label { color: var(--text-muted); }
.wizard-summary .sum-value { color: var(--text); text-align: right; }
.ext-install-steps { list-style: none; padding: 0; margin: 0 0 24px 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }
.ext-install-steps li { display: flex; align-items: flex-start; gap: 12px; padding: 11px 20px; border-bottom: 1px solid rgba(42,42,69,0.5); color: var(--text); font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.5; }
.ext-install-steps li:last-child { border-bottom: none; }
.ext-install-steps .sn { color: var(--accent); font-weight: bold; min-width: 18px; flex-shrink: 0; }
.vt-pagination { display: flex; justify-content: center; gap: 8px; margin-top: 20px; }

/* ── Settings Tab ────────────────────────────────── */
.settings-input { width: 100%; font-family: var(--font-mono); font-size: 0.85rem; color: var(--text); background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; outline: none; transition: var(--transition); }
.settings-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.settings-input::placeholder { color: var(--text-muted); }
.settings-input:disabled, .settings-textarea:disabled { opacity: 0.5; cursor: not-allowed; }
.settings-textarea { width: 100%; font-family: var(--font-mono); font-size: 0.8rem; color: var(--text); background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; resize: vertical; outline: none; transition: var(--transition); }
.settings-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.settings-select { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text); background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; outline: none; cursor: pointer; min-width: 160px; }
.settings-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.settings-slider { position: absolute; inset: 0; background: #333; border-radius: 22px; cursor: pointer; transition: background 0.3s; }
.settings-slider::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; bottom: 3px; background: #FFFFFF; border-radius: 50%; transition: transform 0.3s; }
#settDebugToggle:checked + .settings-slider { background: var(--accent); }
#settDebugToggle:checked + .settings-slider::before { transform: translateX(18px); }
#settWhaleEnabled:checked + .settings-slider { background: var(--accent); }
#settWhaleEnabled:checked + .settings-slider::before { transform: translateX(18px); }
#settWhaleDesktop:checked + .settings-slider { background: var(--accent); }
#settWhaleDesktop:checked + .settings-slider::before { transform: translateX(18px); }

/* ── Cabinet Responsive ─────────────────────────────── */
@media (max-width: 640px) { .viewer-grid { grid-template-columns: 1fr; } .tab-btn { padding: 10px 14px; font-size: 0.68rem; } .preset-grid { grid-template-columns: 1fr; } .search-row { flex-direction: column; } .sort-select { min-width: auto; } .stat-bar-label { width: 90px; font-size: 0.65rem; } .roi-value { font-size: 1.8rem; } }

/* ── Download Tab: Chrome Mockup ──────────────────── */
.dl-chrome{background:#202124;border-radius:8px;overflow:hidden;box-shadow:0 2px 16px rgba(0,0,0,.45),0 0 0 1px rgba(255,255,255,.04);margin-left:40px}
.dl-chrome-bar{background:#35363a;padding:6px 10px;display:flex;align-items:center;gap:7px}
.dl-chrome-dots{display:flex;gap:6px;flex-shrink:0;padding-right:4px}
.dl-chrome-dots i{width:12px;height:12px;border-radius:50%;display:block}
.dl-chrome-dots i:nth-child(1){background:#ed6a5e}
.dl-chrome-dots i:nth-child(2){background:#f5bf4f}
.dl-chrome-dots i:nth-child(3){background:#62c554}
.dl-chrome-nav{display:flex;gap:2px;flex-shrink:0}
.dl-chrome-nav svg{opacity:.45}
.dl-chrome-url{flex:1;background:#202124;border-radius:16px;padding:5px 14px;font-family:var(--font-mono);font-size:.72rem;color:#e8eaed;display:flex;align-items:center;gap:7px;min-width:0}
.dl-chrome-url .lock{color:#aaa;flex-shrink:0;display:flex}
.dl-chrome-url .addr{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dl-chrome-body{background:#292a2d;padding:20px 24px;min-height:52px;position:relative}
.dl-chrome-body h3{font-family:'Segoe UI','Roboto',system-ui,sans-serif;font-weight:400;font-size:1.15rem;color:#e8eaed;margin:0 0 2px;letter-spacing:-.01em}
.dl-chrome-body .sub{font-family:var(--font-mono);font-size:.65rem;color:#9aa0a6;margin:0}
.dl-toggle{width:36px;height:14px;border-radius:7px;position:relative;flex-shrink:0}
.dl-toggle.on{background:#a78bfa}
.dl-toggle.off{background:#5f6368}
.dl-toggle::after{content:'';width:20px;height:20px;border-radius:50%;position:absolute;top:-3px;box-shadow:0 1px 4px rgba(0,0,0,.4)}
.dl-toggle.on::after{right:-2px;background:#d4b9ff}
.dl-toggle.off::after{left:-2px;background:#bdc1c6}
.dl-pill{font-family:var(--font-mono);font-size:.72rem;padding:7px 18px;border-radius:4px;cursor:default;border:1px solid transparent}
.dl-pill.active{background:#a78bfa;color:#fff;border-color:#a78bfa;box-shadow:0 1px 6px rgba(167,139,250,.3)}
.dl-pill.dim{background:transparent;color:#9aa0a6;border-color:#5f6368}
.dl-ext-card{background:#292a2d;border-radius:8px;border:1px solid rgba(255,255,255,.06);padding:16px 20px;display:flex;align-items:center;gap:14px;box-shadow:0 1px 6px rgba(0,0,0,.25)}
.dl-step{margin-bottom:32px}
.dl-step:last-child{margin-bottom:0}
.dl-step-head{display:flex;align-items:flex-start;gap:14px;margin-bottom:14px}
.dl-step-num{width:30px;height:30px;border-radius:50%;background:linear-gradient(135deg,#a78bfa,#7c3aed);display:flex;align-items:center;justify-content:center;font-family:var(--font-display);font-weight:800;font-size:.82rem;color:#fff;flex-shrink:0;box-shadow:0 2px 8px rgba(124,58,237,.25)}
.dl-step-title{font-family:var(--font-display);font-weight:700;font-size:.95rem;color:var(--text)}
.dl-step-desc{font-family:var(--font-mono);font-size:.78rem;color:var(--text-dim);margin-top:4px;line-height:1.65}
.dl-step-desc strong{color:var(--text)}
.dl-divider{border:0;border-top:1px solid rgba(255,255,255,.04);margin:0 0 32px 44px}
.dl-callout{display:inline-flex;align-items:center;gap:6px;margin-top:8px;font-family:var(--font-mono);font-size:.65rem;color:#a78bfa;background:rgba(167,139,250,.06);padding:4px 10px;border-radius:4px;border:1px solid rgba(167,139,250,.12)}
.dl-popup{width:280px;background:#292a2d;border-radius:8px;overflow:hidden;box-shadow:0 12px 48px rgba(0,0,0,.6),0 0 0 1px rgba(255,255,255,.06)}
.dl-popup-header{padding:18px 22px 14px;text-align:center;background:linear-gradient(180deg,rgba(167,139,250,.05) 0%,transparent 100%);border-bottom:1px solid rgba(255,255,255,.04)}
.dl-popup input,.dl-popup .dl-field{background:#202124;border:1px solid #3c4043;border-radius:4px;padding:9px 12px;font-family:var(--font-mono);font-size:.72rem;color:#e8eaed;display:block;width:100%;box-sizing:border-box}
.dl-popup label{font-family:var(--font-mono);font-size:.6rem;color:#9aa0a6;text-transform:uppercase;letter-spacing:.04em;margin-bottom:5px;display:block}
.dl-popup .dl-btn{background:#a78bfa;border:0;border-radius:4px;padding:10px;text-align:center;font-family:var(--font-display);font-weight:700;font-size:.82rem;color:#fff;width:100%;cursor:default}
.dl-dropdown{width:240px;background:#292a2d;border-radius:8px;overflow:hidden;box-shadow:0 8px 32px rgba(0,0,0,.5),0 0 0 1px rgba(255,255,255,.06)}
.dl-dropdown-row{padding:10px 16px;display:flex;align-items:center;justify-content:space-between}
.dl-dropdown-row.hl{background:rgba(167,139,250,.06)}
.dl-dropdown-row .icon{width:20px;height:20px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.dl-dropdown-row .pin{width:20px;height:20px;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:default}
.dl-dropdown-row .pin svg{stroke:#9aa0a6;opacity:.4}
.dl-dropdown-row.hl .pin svg{stroke:#a78bfa;opacity:1}
.dl-faq{background:rgba(0,0,0,.18);border-radius:8px;padding:14px 18px;border-left:3px solid rgba(255,189,46,.5);transition:border-color .2s}
.dl-faq:hover{border-left-color:rgba(255,189,46,.8)}
.dl-faq b{font-family:var(--font-display);font-weight:700;font-size:.82rem;color:var(--text);display:block;margin-bottom:4px}
.dl-faq span{font-family:var(--font-mono);font-size:.72rem;color:var(--text-dim);line-height:1.6}
@media(max-width:640px){.dl-chrome,.dl-popup-wrap,.dl-dropdown-wrap{margin-left:0!important}.dl-chrome-bar{padding:5px 8px}.dl-chrome-dots i{width:10px;height:10px}.dl-chrome-url{font-size:.65rem;padding:4px 10px}.dl-popup{width:100%;max-width:280px}}
/* ── Support Widget ── */
.support-bubble{position:fixed;bottom:24px;right:24px;width:56px;height:56px;border-radius:50%;background:var(--accent);color:#fff;border:none;cursor:pointer;z-index:10000;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 20px rgba(0,0,0,.4);transition:transform .2s}
.support-bubble:hover{transform:scale(1.08)}
.support-bubble svg{width:24px;height:24px}
.support-badge{position:absolute;top:-4px;right:-4px;min-width:20px;height:20px;border-radius:10px;background:#e53e3e;color:#fff;font-size:.7rem;display:flex;align-items:center;justify-content:center;padding:0 5px}
.support-panel{position:fixed;bottom:90px;right:24px;width:380px;max-height:500px;background:var(--bg-deep);border:1px solid var(--border);border-radius:16px;z-index:10001;display:flex;flex-direction:column;box-shadow:0 8px 40px rgba(0,0,0,.5);animation:supportSlideUp .2s ease-out}
@keyframes supportSlideUp{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
.support-header{padding:14px 16px;background:var(--accent);border-radius:16px 16px 0 0;display:flex;justify-content:space-between;align-items:center;color:#fff;font-family:var(--font-display)}
.support-header h3{margin:0;font-size:.95rem}
.support-close{background:none;border:none;color:#fff;cursor:pointer;font-size:1.2rem;padding:0;line-height:1}
.support-messages{flex:1;overflow-y:auto;padding:12px 16px;display:flex;flex-direction:column;gap:8px;min-height:200px;max-height:340px}
.support-msg{max-width:80%;padding:8px 12px;border-radius:12px;font-size:.82rem;line-height:1.4;word-wrap:break-word}
.support-msg.user{align-self:flex-end;background:var(--accent);color:#fff;border-bottom-right-radius:4px}
.support-msg.admin{align-self:flex-start;background:var(--bg-card);color:var(--text);border-bottom-left-radius:4px}
.support-msg.system{align-self:center;background:transparent;color:var(--text-muted);font-size:.75rem;font-style:italic}
.support-msg-time{font-size:.65rem;opacity:.6;margin-top:2px}
.support-input-wrap{display:flex;gap:8px;padding:10px 16px;border-top:1px solid var(--border)}
.support-input{flex:1;background:var(--bg-elevated);color:var(--text);border:1px solid var(--border);border-radius:8px;padding:8px 12px;font-size:.82rem;resize:none;font-family:var(--font-mono);min-height:36px;max-height:80px}
.support-input:focus{outline:none;border-color:var(--accent)}
.support-send{background:var(--accent);color:#fff;border:none;border-radius:8px;padding:8px 14px;cursor:pointer;font-size:.82rem;white-space:nowrap}
.support-send:hover{opacity:.85}
.support-send:disabled{opacity:.4;cursor:not-allowed}
.support-guest-form{padding:16px;display:flex;flex-direction:column;gap:10px}
.support-guest-form input,.support-guest-form textarea{background:var(--bg-elevated);color:var(--text);border:1px solid var(--border);border-radius:8px;padding:8px 12px;font-size:.82rem;font-family:var(--font-mono)}
.support-guest-form label{font-size:.75rem;color:var(--text-muted)}
.support-list{padding:12px 16px;display:flex;flex-direction:column;gap:6px}
.support-list-item{padding:10px 12px;background:var(--bg-card);border-radius:8px;cursor:pointer;border:1px solid transparent;transition:border-color .15s}
.support-list-item:hover{border-color:var(--accent)}
.support-list-item.unread{border-left:3px solid var(--accent)}
.support-list-subject{font-size:.82rem;font-weight:600;color:var(--text)}
.support-list-preview{font-size:.75rem;color:var(--text-muted);margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.support-list-meta{font-size:.65rem;color:var(--text-muted);margin-top:4px;display:flex;justify-content:space-between}
.support-empty{text-align:center;padding:32px 16px;color:var(--text-muted);font-size:.82rem}
.support-new-btn{display:block;margin:12px 16px;padding:10px;background:var(--accent);color:#fff;border:none;border-radius:8px;cursor:pointer;font-size:.82rem;text-align:center}
.support-back{background:none;border:none;color:var(--text-muted);cursor:pointer;font-size:.82rem;padding:0}
@media(max-width:480px){
  .support-panel{bottom:0;right:0;left:0;width:100%;max-height:calc(100vh - 60px);border-radius:16px 16px 0 0}
}
/* ── Admin Support Tab ── */
.support-queue{display:flex;gap:16px;height:calc(100vh - 200px);min-height:400px}
.support-queue-list{flex:0 0 40%;overflow-y:auto;border-right:1px solid var(--border);padding-right:16px}
.support-queue-detail{flex:1;display:flex;flex-direction:column;overflow:hidden}
.support-queue-row{padding:10px 12px;border-radius:8px;cursor:pointer;border:1px solid transparent;margin-bottom:6px;transition:background .15s}
.support-queue-row:hover{background:var(--bg-elevated)}
.support-queue-row.active{background:var(--bg-elevated);border-color:var(--accent)}
.support-queue-row.unread{font-weight:600}
.support-queue-email{font-size:.82rem;color:var(--text)}
.support-queue-subject{font-size:.75rem;color:var(--text-muted);margin-top:2px}
.support-queue-meta{font-size:.65rem;color:var(--text-muted);margin-top:4px;display:flex;justify-content:space-between}
.support-queue-badge{display:inline-block;padding:1px 6px;border-radius:4px;font-size:.6rem;font-weight:700;text-transform:uppercase}
.support-queue-badge.high{background:rgba(229,62,62,.2);color:#e53e3e}
.support-queue-badge.open{background:rgba(56,178,172,.2);color:#38b2ac}
.support-queue-badge.pending{background:rgba(214,158,46,.2);color:#d69e2e}
.support-queue-badge.resolved{background:rgba(160,174,192,.2);color:#a0aec0}
.support-detail-header{padding:12px 0;border-bottom:1px solid var(--border);margin-bottom:12px}
.support-detail-messages{flex:1;overflow-y:auto;padding:8px 0;display:flex;flex-direction:column;gap:6px}
.support-detail-input{display:flex;gap:8px;padding-top:12px;border-top:1px solid var(--border)}
.support-detail-input textarea{flex:1;background:var(--bg-elevated);color:var(--text);border:1px solid var(--border);border-radius:8px;padding:8px 12px;font-size:.82rem;resize:none;font-family:var(--font-mono);min-height:60px}
.support-detail-actions{display:flex;gap:8px;align-items:flex-end}
.support-filter-bar{display:flex;gap:8px;margin-bottom:12px;flex-wrap:wrap}
.support-filter-bar button{padding:4px 12px;border-radius:6px;border:1px solid var(--border);background:var(--bg-card);color:var(--text-muted);cursor:pointer;font-size:.75rem}
.support-filter-bar button.active{background:var(--accent);color:#fff;border-color:var(--accent)}

/* ═══════════════════════════════════════════════════════════════════
   SHARE HUB MODAL — referral link sharing (QR, channels, templates)
   ═══════════════════════════════════════════════════════════════════ */
.share-hub-overlay{position:fixed;inset:0;background:rgba(0,0,0,.75);backdrop-filter:blur(6px);z-index:10050;display:flex;align-items:center;justify-content:center;padding:20px;animation:shareHubFadeIn .2s ease-out}
@keyframes shareHubFadeIn{from{opacity:0}to{opacity:1}}
.share-hub-dialog{position:relative;background:linear-gradient(180deg,var(--bg-card) 0%,var(--bg-deep) 100%);border:1px solid var(--border);border-radius:16px;padding:28px 28px 24px;max-width:460px;width:100%;max-height:calc(100vh - 40px);overflow-y:auto;box-shadow:0 20px 60px rgba(0,0,0,.6),0 0 0 1px rgba(147,51,234,.1);animation:shareHubSlideUp .25s cubic-bezier(.34,1.56,.64,1)}
@keyframes shareHubSlideUp{from{opacity:0;transform:translateY(20px) scale(.96)}to{opacity:1;transform:translateY(0) scale(1)}}
.share-hub-close{position:absolute;top:12px;right:14px;background:none;border:none;color:var(--text-muted);font-size:1.8rem;cursor:pointer;line-height:1;padding:4px 8px;border-radius:6px;transition:all .15s}
.share-hub-close:hover{color:var(--text);background:rgba(255,255,255,.06)}
.share-hub-dialog h3{margin:0 0 6px;font-family:var(--font-display,serif);font-size:1.3rem;color:var(--text);font-weight:700}
.share-hub-sub{margin:0 0 20px;font-size:.82rem;color:var(--text-muted);line-height:1.5}
.share-hub-tabs{display:flex;gap:4px;background:var(--bg-deep);border-radius:10px;padding:4px;margin-bottom:18px}
.share-hub-tab{flex:1;padding:9px 14px;background:none;border:none;color:var(--text-muted);cursor:pointer;font-size:.78rem;font-weight:600;border-radius:7px;transition:all .15s;font-family:inherit}
.share-hub-tab:hover{color:var(--text)}
.share-hub-tab.active{background:var(--accent);color:#fff;box-shadow:0 2px 10px rgba(147,51,234,.35)}
.share-hub-link-box{display:flex;gap:8px;margin-bottom:12px}
.share-hub-link-box input{flex:1;background:var(--bg-deep);border:1px solid var(--border);border-radius:8px;padding:10px 12px;font-family:var(--font-mono);font-size:.75rem;color:var(--accent);user-select:all}
.share-hub-link-box input:focus{outline:none;border-color:var(--accent)}
.share-hub-native{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;padding:11px;background:rgba(147,51,234,.12);border:1px solid rgba(147,51,234,.3);border-radius:10px;color:var(--accent);cursor:pointer;font-size:.82rem;font-weight:600;margin-bottom:18px;transition:all .2s;font-family:inherit}
.share-hub-native:hover{background:rgba(147,51,234,.2);border-color:var(--accent);transform:translateY(-1px)}
.share-hub-native svg{width:18px;height:18px}
.share-hub-section-label{font-size:.65rem;text-transform:uppercase;letter-spacing:.1em;color:var(--text-muted);margin:14px 0 10px;font-weight:600}
.share-hub-channels{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-bottom:4px}
.share-hub-channel{display:flex;flex-direction:column;align-items:center;gap:6px;padding:12px 6px;background:var(--bg-deep);border:1px solid var(--border);border-radius:10px;cursor:pointer;transition:all .15s;text-decoration:none;color:var(--text);font-family:inherit}
.share-hub-channel:hover{border-color:var(--accent);background:var(--bg-elevated);transform:translateY(-1px)}
.share-hub-channel.active{border-color:var(--accent);background:rgba(147,51,234,.12)}
.share-hub-channel-icon{width:28px;height:28px;display:flex;align-items:center;justify-content:center;color:var(--accent)}
.share-hub-channel-icon svg{width:100%;height:100%}
.share-hub-channel-name{font-size:.68rem;color:var(--text-muted);font-weight:600}
.share-hub-channel.active .share-hub-channel-name{color:var(--text)}
.share-hub-message{width:100%;background:var(--bg-deep);border:1px solid var(--border);border-radius:8px;padding:10px 12px;color:var(--text);font-size:.78rem;font-family:var(--font-mono);resize:vertical;min-height:80px;line-height:1.5;box-sizing:border-box}
.share-hub-message:focus{outline:none;border-color:var(--accent)}
.share-hub-campaign{margin-top:14px}
.share-hub-campaign label{display:block;font-size:.65rem;text-transform:uppercase;letter-spacing:.1em;color:var(--text-muted);margin-bottom:6px;font-weight:600}
.share-hub-campaign input{width:100%;background:var(--bg-deep);border:1px solid var(--border);border-radius:8px;padding:9px 12px;color:var(--text);font-size:.78rem;font-family:var(--font-mono);box-sizing:border-box}
.share-hub-campaign input:focus{outline:none;border-color:var(--accent)}
.share-hub-qr-wrap{display:flex;flex-direction:column;align-items:center;gap:12px;margin-bottom:16px;padding:20px;background:var(--bg-deep);border-radius:12px;border:1px solid var(--border)}
.share-hub-qr{width:240px;height:240px;background:#fff;padding:12px;border-radius:8px;display:flex;align-items:center;justify-content:center}
.share-hub-qr img{width:100%;height:100%;display:block}
.share-hub-qr canvas{display:block;max-width:100%;max-height:100%}
.share-hub-qr-meta{font-family:var(--font-mono);font-size:.7rem;color:var(--accent);word-break:break-all;text-align:center;max-width:100%}
.share-hub-qr-hint{margin:10px 0 0;font-size:.7rem;color:var(--text-muted);text-align:center;line-height:1.5}
#shareHubQrDownload{width:100%;padding:11px}
@media(max-width:480px){
  .share-hub-dialog{padding:24px 18px 20px;max-height:calc(100vh - 20px)}
  .share-hub-channels{grid-template-columns:repeat(3,1fr);gap:6px}
  .share-hub-channel{padding:10px 4px}
  .share-hub-qr{width:220px;height:220px}
}

/* Best Hours heatmap (Session 2) */
.bh-grid {
  display: grid;
  grid-template-columns: 28px repeat(24, minmax(0, 1fr));  /* minmax(0,…) lets cells shrink below natural size */
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  width: 100%;
  min-width: 0;  /* allow grid itself to shrink in flex/grid parents */
}
.bh-cell {
  aspect-ratio: 1 / 1;
  min-height: 10px;
  min-width: 0;  /* critical: lets grid compress cells */
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 2px;
  position: relative;
  cursor: help;
  transition: transform 0.1s ease;
  box-sizing: border-box;
}
.bh-cell:hover { transform: scale(1.4); z-index: 5; outline: 1px solid var(--accent); }
.bh-cell.has-gens-no-tips {
  background: rgba(167, 139, 250, 0.08);
  border-color: rgba(167, 139, 250, 0.15);
}
.bh-row-label {
  font-size: 0.55rem;
  color: var(--text-muted);
  text-align: right;
  padding-right: 4px;
  align-self: center;
}
.bh-col-label {
  font-size: 0.5rem;
  color: var(--text-muted);
  text-align: center;
}
.bh-swatch {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 4px;
}
.bh-swatch-faint { background: rgba(167, 139, 250, 0.05); border: 1px solid rgba(167, 139, 250, 0.15); }
.bh-swatch-low   { background: rgba(167, 139, 250, 0.30); }
.bh-swatch-mid   { background: rgba(167, 139, 250, 0.60); }
.bh-swatch-high  { background: rgba(167, 139, 250, 0.95); }

/* ═══════════════════════════════════════════════════════════════════
   HEADER — right side (status pill, model switcher, logout)
   ═══════════════════════════════════════════════════════════════════ */

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Status Pill ───────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 9px 18px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
  white-space: nowrap;
}
.status-pill:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background var(--transition), box-shadow var(--transition);
}

/* ── Header Language Switcher ─────────────────────────── */
.header-lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.header-lang-switcher .lang-chip {
  padding: 5px 10px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.header-lang-switcher .lang-chip:hover { color: var(--text-dim); }
.header-lang-switcher .lang-chip.active {
  background: var(--accent);
  color: #fff;
}

@media (max-width: 768px) {
  .header-lang-switcher { padding: 3px; }
  .header-lang-switcher .lang-chip { padding: 4px 7px; font-size: 0.68rem; }
}

/* Connected state */
.status-pill.status-connected { border-color: rgba(16, 185, 129, 0.3); }
.status-pill.status-connected .status-dot {
  background: var(--status-connected);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}
.status-pill.status-connected .status-text { color: var(--success); }

/* Warning state */
.status-pill.status-warning { border-color: rgba(245, 158, 11, 0.3); }
.status-pill.status-warning .status-dot {
  background: var(--status-warning);
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
  animation: statusPulse 2s ease-in-out infinite;
}
.status-pill.status-warning .status-text { color: var(--warning); }

/* Disconnected state */
.status-pill.status-disconnected { border-color: rgba(248, 113, 113, 0.3); }
.status-pill.status-disconnected .status-dot {
  background: var(--status-disconnected);
  box-shadow: 0 0 6px rgba(248, 113, 113, 0.5);
}
.status-pill.status-disconnected .status-text { color: var(--status-disconnected); }

/* Checking state (initial) */
.status-pill.status-checking .status-dot {
  background: var(--text-muted);
}
.status-pill.status-checking .status-text { color: var(--text-muted); }

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* ═══════════════════════════════════════════════════════════════════
   SETTINGS — two-column grid
   ═══════════════════════════════════════════════════════════════════ */

.settings-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
}

.settings-performer,
.settings-account {
  display: flex;
  flex-direction: column;
  gap: 0; /* cards have their own margin-bottom */
}

/* ═══════════════════════════════════════════════════════════════════
   EARNINGS HERO — prominent earnings display
   ═══════════════════════════════════════════════════════════════════ */

.earnings-hero {
  position: relative;
  overflow: hidden;
}

.earnings-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 5vw, 2.8rem);
  color: var(--success);
  line-height: 1;
}

/* Timeframe tab switcher (desktop) */
.earnings-timeframe {
  display: inline-flex;
  gap: 2px;
  background: var(--bg-deep);
  border-radius: var(--radius);
  padding: 3px;
}

.earnings-tf-btn {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: lowercase;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.earnings-tf-btn:hover {
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
}
.earnings-tf-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* Mobile timeframe dropdown (hidden by default, shown via JS) */
.earnings-tf-mobile {
  display: none;
}

/* Private shows row */
.earnings-privates {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════════════
   CRM — insight cards (2-column compact)
   ═══════════════════════════════════════════════════════════════════ */

.crm-insights {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
  align-items: start;  /* don't stretch cards to equal height when one expands */
}

.crm-insight-card {
  padding: 16px 20px;
  min-width: 0;  /* allow grid children to shrink, prevent hour 21-23 clipping */
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.crm-insight-card:hover {
  border-color: var(--border-hover);
}

/* Expandable card transition */
.crm-insight-card.expanded {
  overflow: visible;
}

/* ── Segment Chips ───────────────────────────────────── */

.crm-segment-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.segment-chip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 6px 14px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition), opacity var(--transition);
  white-space: nowrap;
}
.segment-chip:hover {
  border-color: var(--border-hover);
  color: var(--text);
}
.segment-chip.active {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.12);
  color: var(--text);
}
.segment-chip:not(.active) {
  opacity: 0.7;
}
.segment-chip:not(.active):hover {
  opacity: 1;
}

.segment-count {
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-left: 4px;
}
.segment-chip.active .segment-count {
  color: var(--accent);
}

/* ── Viewer Card v2 (grid cards) ─────────────────────── */

.viewer-card-v2 {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
  position: relative;
}
.viewer-card-v2:hover {
  border-color: var(--border-hover);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* ═══════════════════════════════════════════════════════════════════
   VIEWER DETAIL MODAL v4 — sections, badges, chips, contacts, merge
   ═══════════════════════════════════════════════════════════════════ */

.viewer-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.viewer-section-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* AI & Private badges */
.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--success-dim);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.private-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

/* Preference chips */
.pref-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--bg-deep);
  color: var(--text-dim);
  border: 1px solid var(--border);
  transition: border-color var(--transition);
}
.pref-chip:hover {
  border-color: var(--border-hover);
}
.pref-chip .pref-remove {
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  transition: color var(--transition-fast);
}
.pref-chip .pref-remove:hover {
  color: var(--status-disconnected);
}

.pref-chip-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.pref-chip-add:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Contact info */
.contact-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}
.contact-item .contact-key {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  min-width: 70px;
  flex-shrink: 0;
}
.contact-item .contact-val {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-preset-btn {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.contact-preset-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Auto-merge suggestion card */
.auto-merge-suggestion {
  background: rgba(139, 92, 246, 0.06);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.auto-merge-suggestion .merge-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.auto-merge-suggestion .merge-desc {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 10px;
}
.auto-merge-suggestion .merge-actions {
  display: flex;
  gap: 8px;
}

/* Viewer history collapsible toggle */
.viewer-history-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  margin-top: 8px;
  transition: color var(--transition);
}
.viewer-history-toggle:hover {
  color: var(--accent);
}
.viewer-history-toggle .toggle-arrow {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}
.viewer-history-toggle.open .toggle-arrow {
  transform: rotate(90deg);
}

/* ═══════════════════════════════════════════════════════════════════
   AUTO-SAVE FIELD STATES — border + indicator feedback
   ═══════════════════════════════════════════════════════════════════ */

/* Border states on input/textarea/select */
.as-editing {
  border-color: var(--as-editing) !important;
}
.as-saving {
  border-color: var(--as-saving) !important;
}
.as-saved {
  border-color: var(--as-saved) !important;
}
.as-error {
  border-color: var(--as-error) !important;
}

/* Inline indicator text next to field */
.as-indicator {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  min-height: 1.2em;
  margin-top: 4px;
  color: var(--text-muted);
  transition: color var(--transition-fast), opacity var(--transition-fast);
}

/* Saved state — green */
.as-saved ~ .as-indicator,
.as-indicator-saved {
  color: var(--as-saved);
}

/* Error state — red, clickable for retry */
.as-error ~ .as-indicator,
.as-indicator-error {
  color: var(--as-error);
  cursor: pointer;
}
.as-indicator-error:hover {
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════════════
   GUIDE DRAWER — slide-in overlay from right
   ═══════════════════════════════════════════════════════════════════ */

.guide-drawer {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
}

.guide-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.guide-drawer-content {
  position: absolute;
  top: 0;
  right: 0;
  width: 40%;
  min-width: 360px;
  max-width: 560px;
  height: 100%;
  overflow-y: auto;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  padding: 32px 28px;
  box-shadow: var(--sh-lg);
  animation: guideSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes guideSlideIn {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

.guide-drawer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 1.6rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}
.guide-drawer-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

/* ═══════════════════════════════════════════════════════════════════
   ACTIVATION BLOCK — 3-step new-user activation card
   ═══════════════════════════════════════════════════════════════════ */

.activation-block { position: relative; }

.activation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.activation-title { margin-bottom: 0; }
.activation-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.activation-counter {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.activation-dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 6px;
  transition: color var(--transition);
}
.activation-dismiss:hover { color: var(--text); }

.activation-bar-track {
  height: 2px;
  background: var(--bg-deep);
  border-radius: 1px;
  overflow: hidden;
  margin-bottom: 14px;
}
.activation-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--success) 0%, var(--accent) 100%);
  transition: width 400ms ease;
}

.activation-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.activation-step {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  background: transparent;
  transition: background var(--transition), border-color var(--transition);
}

.step-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 600;
  flex-shrink: 0;
  border: 1.5px solid var(--text-muted);
  color: var(--text-muted);
  background: transparent;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.step-icon::before { content: ''; }

.step-body { min-width: 0; }
.step-title {
  font-size: 0.88rem;
  color: var(--text);
  font-weight: 500;
}
.step-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: none;
}

.step-cta {
  display: none;
  align-items: center;
  gap: 10px;
}

/* Active state */
.activation-step.active {
  background: rgba(132, 90, 255, 0.05);
  border-left-color: var(--accent);
}
.activation-step.active .step-icon {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.activation-step.active .step-icon::before { content: '\25CF'; }
.activation-step.active .step-title { font-weight: 600; }
.activation-step.active .step-sub { display: block; }
.activation-step.active .step-cta { display: inline-flex; }

/* Upcoming state */
.activation-step.upcoming .step-title { color: var(--text-dim); }
.activation-step.upcoming .step-icon::before { content: '\25CB'; }

/* Done state */
.activation-step.done .step-icon {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}
.activation-step.done .step-icon::before { content: '\2713'; }
.activation-step.done .step-title { color: var(--text-muted); }
.activation-step.done .step-sub { display: none; }
.activation-step.done .step-cta { display: none; }

.btn-primary-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  font-size: 0.78rem;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), box-shadow var(--transition);
}
.btn-primary-sm:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 12px var(--accent-glow);
}
.link-secondary {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
  transition: color var(--transition);
}
.link-secondary:hover { color: var(--text); }

/* Celebration (3/3) */
.activation-done {
  text-align: center;
  padding: 24px 12px 18px;
}
.activation-done-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.activation-done-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Dismiss confirmation modal (reused minimal modal pattern) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}
.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px 18px;
  width: calc(100% - 32px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}
.modal-body { margin-bottom: 18px; line-height: 1.5; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Mobile: stack CTA under title */
@media (max-width: 560px) {
  .activation-step { grid-template-columns: 22px 1fr; }
  .activation-step.active .step-cta {
    grid-column: 1 / -1;
    padding-left: 34px;
    flex-wrap: wrap;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE — mobile overrides (max-width: 768px)
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* Settings grid → single column */
  .settings-grid {
    grid-template-columns: 1fr;
  }

  /* CRM insights → single column */
  .crm-insights {
    grid-template-columns: 1fr;
  }

  /* Viewer grid → single column */
  .viewer-grid {
    grid-template-columns: 1fr;
  }

  /* Status pill → dot only, hide text */
  .status-pill .status-text {
    display: none;
  }
  .status-pill {
    padding: 6px 8px;
  }

  /* Earnings → stack vertically */
  .earnings-timeframe {
    width: 100%;
    justify-content: stretch;
  }
  .earnings-tf-btn {
    flex: 1;
    text-align: center;
    padding: 6px 8px;
  }
  /* Show mobile dropdown, hide desktop tabs */
  .earnings-tf-mobile {
    display: block;
  }
  .earnings-timeframe {
    display: none;
  }

  /* Shift cards → horizontal scroll with snap */
  .home-shift-grid {
    grid-template-columns: 1fr;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .home-shift-card {
    scroll-snap-align: start;
  }

  /* Viewer modal → full-screen bottom sheet */
  .viewer-detail {
    top: auto;
    bottom: 0;
    left: 0;
    transform: none;
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  /* Guide drawer → full screen */
  .guide-drawer-content {
    width: 100%;
    min-width: auto;
    max-width: none;
  }
}

/* ===== Quick Replies — editor (modal) ===== */
.qr-hint { padding: 10px 14px; background: var(--bg-section); border: 1px dashed var(--border); border-radius: var(--r-xs); font-size: 12px; color: var(--text-muted); margin-bottom: 14px; line-height: 1.55; }
.qr-hint code { background: var(--accent-soft); padding: 1px 7px; border-radius: 4px; color: var(--brand-violet-100); font-size: 11px; font-family: ui-monospace, Menlo, Consolas, monospace; }

.qr-list { background: var(--bg-deep, var(--bg-card)); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; min-height: 72px; }
.qr-list:empty::before { content: attr(data-empty); display: block; padding: 36px 24px; color: var(--text-muted); font-size: 13px; text-align: center; line-height: 1.7; white-space: pre-line; }

/* View row — 2-line grid: drag | label + actions (top), text (bottom) */
.qr-row {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  grid-template-areas:
    "drag label actions"
    "drag text  text";
  column-gap: 12px;
  row-gap: 4px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  font-size: 13px;
  transition: background .12s ease;
}
.qr-row:last-child { border-bottom: 0; }
.qr-row:hover { background: rgba(255,255,255,.02); }
.qr-row.dragging { opacity: .35; }
.qr-row.drop-target { box-shadow: inset 0 2px 0 0 var(--accent); }

.qr-row .qr-drag {
  grid-area: drag;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-subtle);
  cursor: grab;
  user-select: none;
  font-size: 14px;
  line-height: 1;
  border-radius: var(--r-xs);
  transition: color .12s ease, background .12s ease;
}
.qr-row:hover .qr-drag { color: var(--text-muted); }
.qr-row .qr-drag:hover { color: var(--accent); background: var(--accent-soft); }
.qr-row .qr-drag:active { cursor: grabbing; }

.qr-row .qr-label {
  grid-area: label;
  justify-self: start;
  font-size: 10px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  background: var(--accent-soft);
  color: var(--brand-violet-100);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qr-row .qr-text {
  grid-area: text;
  color: var(--text-dim);
  line-height: 1.55;
  word-break: break-word;
}
.qr-row .qr-text .qr-var { color: var(--brand-magenta-500); font-weight: 600; }

.qr-row .qr-actions { grid-area: actions; display: flex; gap: 4px; opacity: 0; transition: opacity .12s ease; }
.qr-row:hover .qr-actions,
.qr-row:focus-within .qr-actions { opacity: 1; }
.qr-row .qr-act { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 1px solid transparent; border-radius: var(--r-xs); cursor: pointer; color: var(--text-muted); font-size: 13px; transition: color .12s, border-color .12s, background .12s; }
.qr-row .qr-act:hover { background: var(--bg-card-hover, var(--bg-card)); border-color: var(--border); color: var(--text); }
.qr-row .qr-act.danger:hover { color: var(--danger, #e25a5a); border-color: var(--danger, #e25a5a); }

/* Edit row — compact, inline-style (no heavy accent border) */
.qr-edit-row { padding: 14px 16px; background: var(--bg-section, rgba(139,92,246,.04)); border-bottom: 1px solid rgba(255,255,255,.05); }
.qr-edit-row:last-child { border-bottom: 0; }
.qr-edit-row .qr-fields { display: flex; flex-direction: column; gap: 12px; }
.qr-edit-row .qr-field-label { font-size: 10px; color: var(--text-muted); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 4px; display: flex; align-items: center; justify-content: space-between; }
.qr-edit-row .qr-count { font-family: var(--font-mono); font-size: 10px; color: var(--text-subtle); font-weight: 500; letter-spacing: 0; text-transform: none; }
.qr-edit-row .qr-count.over { color: var(--warning, #e0a000); }
.qr-edit-row .qr-input-wrap { position: relative; display: flex; gap: 6px; }
.qr-edit-row input { flex: 1 1 auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-xs); padding: 9px 12px; color: var(--text); font: inherit; font-size: 13px; transition: border-color .12s, box-shadow .12s; }
.qr-edit-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.qr-edit-row .qr-insert-chip {
  flex: 0 0 auto;
  padding: 0 12px;
  background: var(--accent-soft);
  border: 1px dashed var(--accent);
  border-radius: var(--r-xs);
  color: var(--brand-violet-100);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.qr-edit-row .qr-insert-chip:hover { background: var(--accent); color: #fff; }
.qr-edit-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.qr-edit-footer .btn { padding: 7px 14px; font-size: 12px; box-shadow: none; }

.qr-add-btn { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 11px 14px; margin-top: 10px; color: var(--accent); background: transparent; border: 1px dashed var(--border); border-radius: var(--r-sm); font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; transition: background .12s, border-color .12s; }
.qr-add-btn:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); }
.qr-add-btn:disabled { opacity: .35; cursor: not-allowed; color: var(--text-muted); }

/* Restore link (footer-left) */
.qr-restore-link { background: transparent; border: 0; padding: 0; color: var(--text-muted); font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.qr-restore-link:hover { color: var(--accent); }

/* ===== Quick Replies — preview + summary in Settings card ===== */
.qr-preview {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--bg-deep, rgba(0,0,0,.2));
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  min-height: 52px;
  align-items: center;
}
.qr-preview .qr-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .12s, border-color .12s, background .12s;
  cursor: default;
}
.qr-preview .qr-chip:hover { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.qr-preview .qr-chip .qr-var { color: var(--brand-magenta-500); font-weight: 600; }
.qr-preview .qr-more {
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 6px;
  font-family: var(--font-mono);
}
.qr-preview[data-state="loading"] { opacity: .7; }
.qr-preview[data-state="empty"] { justify-content: center; color: var(--text-muted); font-size: 12px; font-style: italic; }
.qr-preview .qr-skel {
  display: inline-block;
  height: 22px;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, rgba(255,255,255,.04) 25%, rgba(255,255,255,.09) 50%, rgba(255,255,255,.04) 75%);
  background-size: 200% 100%;
  animation: qrSkel 1.2s ease-in-out infinite;
}
.qr-preview .qr-skel:nth-child(1) { width: 46px; }
.qr-preview .qr-skel:nth-child(2) { width: 68px; }
.qr-preview .qr-skel:nth-child(3) { width: 54px; }
.qr-preview .qr-skel:nth-child(4) { width: 82px; }
@keyframes qrSkel {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.qr-summary-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.qr-summary-meta { display: flex; align-items: center; gap: 8px; min-height: 22px; }
.qr-summary-count { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted); letter-spacing: .02em; }
.qr-summary-badge { font-size: 9px; padding: 2px 8px; border-radius: var(--r-full); background: var(--accent-soft); color: var(--brand-violet-100); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }

.qr-link-btn {
  background: transparent;
  border: 0;
  padding: 6px 2px;
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  transition: color .12s;
}
.qr-link-btn:hover { color: var(--brand-magenta-500); }

/* ===== Quick Replies — modal editor ===== */
.qr-modal-overlay { position: fixed; inset: 0; z-index: 120; background: rgba(0,0,0,.7); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.qr-modal-overlay[hidden] { display: none; }
.qr-modal { width: 100%; max-width: 680px; max-height: 85vh; display: flex; flex-direction: column; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg, 14px); box-shadow: 0 30px 80px rgba(0,0,0,.6); overflow: hidden; }
.qr-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.qr-modal-header h2 { margin: 0; font-size: 1rem; font-weight: 700; color: var(--text); }
.qr-modal-close { background: transparent; border: 0; color: var(--text-muted); font-size: 24px; line-height: 1; cursor: pointer; padding: 4px 10px; border-radius: var(--r-xs); }
.qr-modal-close:hover { color: var(--text); background: var(--bg-deep); }
.qr-modal-body { padding: 18px 22px; overflow-y: auto; flex: 1 1 auto; }
.qr-modal-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--bg-deep, var(--bg-card)); flex-wrap: wrap; }
.qr-modal-footer-left { display: flex; align-items: center; gap: 14px; }
.qr-modal-actions { display: flex; gap: 10px; margin-left: auto; }
.qr-modal-actions .btn { padding: 9px 18px; font-size: 12px; }
.qr-modal-actions .btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.qr-card-desc {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-dim);
  margin: -8px 0 14px;
}

.qr-dirty-indicator { font-size: 12px; color: var(--warning, #e0a000); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.qr-dirty-indicator[hidden] { display: none; }
.qr-dirty-indicator::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }

@media (max-width: 560px) {
  .qr-modal-overlay { padding: 0; }
  .qr-modal { max-width: none; max-height: 100vh; height: 100vh; border-radius: 0; border: 0; }
  .qr-summary-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .qr-link-btn { align-self: flex-start; }
}
