/* ============================================================
   seekn — round 5 fixes  (fixes2.css)
   PURE CSS — no DOM restructuring required.
   ============================================================ */

/* ---------- Defensive: never let an account/search/analytics view
   leak into the dashboard scroll. .view+.active should already gate
   this, but some older browsers + content-visibility caches don't
   honor toggling reliably, so be explicit. ---------------------- */
section.view:not(.active) {
  display: none !important;
}

/* The "Account settings" card built by enhancements.js sits in
   #view-account. When the user is on the dashboard it must be hidden. */
body[data-view="menu"] #view-account,
body[data-view="menu"] #view-search,
body[data-view="menu"] #view-analytics,
body[data-view="menu"] #view-settings,
body[data-view="menu"] #view-edit,
body[data-view="menu"] #view-tos,
body[data-view="menu"] #view-profile,
body[data-view="menu"] #view-auth {
  display: none !important;
}

/* ---------- /settings → full-width dashboard layout (no DOM edits) -- */
body[data-view="settings"] #view-settings .centerStage {
  max-width: none !important;
  width: 100% !important;
  padding: 24px 16px 60px !important;
  display: block !important;
}

#view-settings .settingsCard {
  max-width: 1240px !important;
  width: 100% !important;
  margin: 0 auto !important;
  padding: 28px 28px 32px !important;
  background: linear-gradient(180deg, rgba(20, 14, 36, .55), rgba(10, 8, 22, .65)) !important;
  border: 1px solid rgba(255, 255, 255, .08) !important;
  border-radius: 18px !important;
  backdrop-filter: blur(14px) saturate(140%) !important;
  -webkit-backdrop-filter: blur(14px) saturate(140%) !important;
}

#view-settings .settingsCard > h2 {
  font-size: 28px !important;
  margin: 0 0 4px !important;
  letter-spacing: .2px !important;
}
#view-settings .settingsCard > h2 + p.muted {
  margin: 0 0 22px !important;
  font-size: 14px !important;
  opacity: .85 !important;
}

/* Lay out the existing .form children as a 12-col responsive grid.
   No DOM was moved — we let the existing IDs / handlers keep working. */
@media (min-width: 820px) {
  #view-settings .settingsCard > .form {
    display: grid !important;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
  }
  /* UI effects toggle (label) */
  #view-settings .settingsCard > .form > label.toggleLabel {
    grid-column: span 6;
    background: rgba(255, 255, 255, .03);
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 14px;
    padding: 16px 18px;
    margin: 0 !important;
    min-height: 110px;
    display: flex !important;
    align-items: center;
  }
  /* Section divider before the bg fx field */
  #view-settings .settingsCard > .form > div.field {
    grid-column: span 6;
    background: rgba(255, 255, 255, .03);
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 14px;
    padding: 16px 18px;
    margin: 0 !important;
  }
  /* Admin boxes always span full width */
  #view-settings .settingsCard > .form > #adminBadgeBox,
  #view-settings .settingsCard > .form > #adminUserMgmtBox {
    grid-column: 1 / -1;
    background: linear-gradient(180deg, rgba(155, 100, 255, .07), rgba(80, 60, 200, .04));
    border: 1px solid rgba(155, 100, 255, .25);
    padding: 18px;
  }
  /* Buttons row (save / theme / logout) */
  #view-settings .settingsCard > .form > button {
    grid-column: span 4;
    margin-top: 4px !important;
  }
  /* Status text */
  #view-settings .settingsCard > .form > #settingsStatus {
    grid-column: 1 / -1;
  }
  /* The bg fx picker becomes a wrap-grid */
  #view-settings .effectPicker {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
  }
}

/* On tablet/mobile keep single-column but let admin boxes shine */
@media (max-width: 819px) {
  #view-settings .settingsCard {
    padding: 22px 18px 28px !important;
  }
}

/* ---------- /analytics page ---------- */
#view-analytics .analyticsWrap {
  max-width: 1240px;
  width: 100%;
  margin: 24px auto 64px;
  padding: 0 16px;
  display: flex; flex-direction: column;
  gap: 18px;
}
#view-analytics .anHeader {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
#view-analytics .anHeader h1 { margin: 0; font-size: 28px; letter-spacing: .2px; }
#view-analytics .anHeader p { margin: 4px 0 0; font-size: 14px; opacity: .8; }
#view-analytics .anRangeRow {
  display: inline-flex; gap: 4px;
  background: rgba(255, 255, 255, .04);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .07);
}
#view-analytics .anRangeRow button {
  background: transparent; border: 0; color: rgba(230, 230, 245, .7);
  padding: 6px 14px; font-size: 12.5px;
  border-radius: 7px; cursor: pointer; font-weight: 500;
}
#view-analytics .anRangeRow button.active {
  background: linear-gradient(180deg, rgba(155, 100, 255, .28), rgba(110, 70, 220, .22));
  color: #fff;
}

#view-analytics .anStats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
#view-analytics .anStat {
  background: linear-gradient(180deg, rgba(20, 14, 36, .55), rgba(10, 8, 22, .65));
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 14px;
  padding: 16px 18px;
  position: relative; overflow: hidden;
}
#view-analytics .anStat::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(80% 60% at 100% 0%, rgba(155, 100, 255, .15), transparent 60%);
  pointer-events: none;
}
#view-analytics .anStat .lbl {
  font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .8px; color: rgba(230, 230, 245, .6);
}
#view-analytics .anStat .val { font-size: 28px; font-weight: 700; margin-top: 4px; }
#view-analytics .anStat .delta { font-size: 12px; margin-top: 4px; color: #7be6a4; }
#view-analytics .anStat .delta.down { color: #ff8d8d; }

#view-analytics .anGrid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}
#view-analytics .anCard {
  background: linear-gradient(180deg, rgba(20, 14, 36, .55), rgba(10, 8, 22, .65));
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 14px;
  padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
  min-width: 0;
}
#view-analytics .anCard h3 { margin: 0; font-size: 15px; }
#view-analytics .anCard .sub { margin: -6px 0 0; font-size: 12.5px; color: rgba(230, 230, 245, .65); }
#view-analytics .anCard.span8 { grid-column: span 8; }
#view-analytics .anCard.span4 { grid-column: span 4; }
#view-analytics .anCard.span6 { grid-column: span 6; }
@media (max-width: 900px) {
  #view-analytics .anCard.span8,
  #view-analytics .anCard.span4,
  #view-analytics .anCard.span6 { grid-column: span 12; }
}
#view-analytics .chartSvg { width: 100%; height: 220px; display: block; }
#view-analytics .chartSvg .bar { fill: url(#anGrad); rx: 4; }
#view-analytics .chartSvg .grid line { stroke: rgba(255, 255, 255, .07); stroke-dasharray: 3 3; }
#view-analytics .chartSvg .axis text {
  fill: rgba(230, 230, 245, .5);
  font: 10px ui-sans-serif, system-ui, sans-serif;
}
#view-analytics .connClickList { display: flex; flex-direction: column; gap: 8px; }
#view-analytics .connClickRow {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .05);
  border-radius: 10px;
}
#view-analytics .connClickRow .icn {
  width: 36px; height: 36px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(155, 100, 255, .25), rgba(80, 60, 200, .15));
  color: #fff; font-weight: 700; font-size: 14px;
}
#view-analytics .connClickRow .name { font-size: 13.5px; font-weight: 600; }
#view-analytics .connClickRow .meter {
  margin-top: 5px; height: 4px; max-width: 320px;
  background: rgba(255, 255, 255, .06); border-radius: 2px; overflow: hidden;
}
#view-analytics .connClickRow .meter > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, #b48bff, #6f5cff);
}
#view-analytics .connClickRow .count {
  font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px;
}
#view-analytics .anEmpty {
  text-align: center; padding: 18px 0;
  color: rgba(230, 230, 245, .6); font-size: 13.5px;
}

/* ---------- Discord profile badges (chips + tooltip) ---------- */
#discordSyncBlock .dsBadges {
  display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 4px;
}
/* BUG FIX: badges no longer carry pill / box backgrounds. */
#discordSyncBlock .dsBadge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 !important;
  border-radius: 4px;
  font-size: 11px; font-weight: 700;
  background: transparent !important;
  color: #fff;
  border: none !important;
  box-shadow: none !important;
  text-shadow: 0 0 6px rgba(167, 139, 250, .55);
  position: relative; cursor: help;
}
#discordSyncBlock .dsBadge::after {
  content: attr(data-badge-name);
  position: absolute; bottom: 130%; left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(8, 6, 18, .95); color: #fff;
  font-size: 11px; font-weight: 500; padding: 4px 8px;
  border-radius: 6px; white-space: nowrap;
  pointer-events: none; opacity: 0;
  transition: opacity .15s, transform .15s;
  border: 1px solid rgba(255, 255, 255, .1); z-index: 5;
}
#discordSyncBlock .dsBadge:hover::after {
  opacity: 1; transform: translateX(-50%) translateY(0);
}
/* BUG FIX: hide any leftover "verified member of seekn" pills entirely. */
#discordSyncBlock .dsBadge.dsBadgeVerified { display: none !important; }
#discordSyncBlock .dsStatusDot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block; background: #747f8d;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .35);
}
#discordSyncBlock .dsStatusDot[data-status="online"] { background: #3ba55d; box-shadow: 0 0 6px rgba(59, 165, 93, .8), 0 0 0 2px rgba(0,0,0,.35); }
#discordSyncBlock .dsStatusDot[data-status="idle"]   { background: #faa61a; box-shadow: 0 0 6px rgba(250, 166, 26, .8), 0 0 0 2px rgba(0,0,0,.35); }
#discordSyncBlock .dsStatusDot[data-status="dnd"]    { background: #ed4245; box-shadow: 0 0 6px rgba(237, 66, 69, .8), 0 0 0 2px rgba(0,0,0,.35); }
#discordSyncBlock .dsHead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#discordSyncBlock .dsActivity { font-size: 12.5px; }

/* ---------- ToS rules grid ---------- */
#view-tos .tosRules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px; margin: 8px 0 6px;
}
#view-tos .tosRules .ruleItem {
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 10px; padding: 12px 14px;
  display: flex; gap: 10px; align-items: flex-start;
}
#view-tos .tosRules .ruleItem .num {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 6px;
  background: linear-gradient(135deg, #9b64ff, #5d4cff);
  color: #fff; display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
}
#view-tos .tosRules .ruleItem strong { display: block; font-size: 13.5px; margin-bottom: 2px; }
#view-tos .tosRules .ruleItem span {
  font-size: 12.5px; color: rgba(230, 230, 245, .7); line-height: 1.45;
}

/* ---------- Top nav: extra links visible only when logged in ----------
   Analytics is intentionally NOT in the nav — it's reachable only via
   the direct /analytics URL. We keep a hard `display:none` here so any
   stale anchor inserted by an older build stays invisible.            */
#navAccountLink { display: none; }
body.is-logged-in #navAccountLink { display: inline-flex !important; }
#navAnalyticsLink,
body.is-logged-in #navAnalyticsLink { display: none !important; }

/* ---------- Edit profile page reinforcement ---------- */
/* Make sure edit page goes wide and uses 2-col layout */
@media (min-width: 980px) {
  body[data-view="edit"] #view-edit .centerStage {
    max-width: none !important;
    width: 100% !important;
    padding: 18px 16px 60px !important;
    display: block !important;
  }
  #view-edit .editCard {
    max-width: 1180px !important;
    width: 100% !important;
    margin: 0 auto !important;
  }
  /* If the tabs already laid out grid, leave them alone (fixes.css does it).
     If for some reason they didn't, force a 2-col flow on the form. */
  #view-edit .editCard:not([data-tabbed="1"]) > .form {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 22px;
    align-items: start;
  }
  #view-edit .editCard:not([data-tabbed="1"]) > .form > .field:has(textarea),
  #view-edit .editCard:not([data-tabbed="1"]) > .form > .fieldGridTwo,
  #view-edit .editCard:not([data-tabbed="1"]) > .form > .connectionsGrid,
  #view-edit .editCard:not([data-tabbed="1"]) > .form > h2,
  #view-edit .editCard:not([data-tabbed="1"]) > .form > h3,
  #view-edit .editCard:not([data-tabbed="1"]) > .form > .editActions,
  #view-edit .editCard:not([data-tabbed="1"]) > .form > #editStatus,
  #view-edit .editCard:not([data-tabbed="1"]) > .form > #editSaveBtn {
    grid-column: 1 / -1;
  }
}

  /* =====================================================================
     v23 — Discord card customization grid + edit-page UI polish
     ===================================================================== */

  /* Grid for the new "Discord card appearance" controls */
  .discordCardCustomGrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
    align-items: start;
    padding: 10px 12px;
    background: rgba(88, 101, 242, 0.06);
    border: 1px solid rgba(88, 101, 242, 0.20);
    border-radius: 10px;
  }
  .discordCardCustomGrid input[type="color"] {
    width: 100%;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.10);
    background: transparent;
    cursor: pointer;
    padding: 2px;
  }
  .discordCardCustomGrid input[type="range"] {
    width: 100%;
    accent-color: #5865f2;
  }
  .discordCardCustomGrid > label > span:first-child {
    display: block;
    margin-bottom: 4px;
    color: var(--text-soft, #e5e5ec);
  }

  /* ---------- Edit-page polish: nicer field spacing + softer cards ----- */
  #view-edit .seeknEditContent .field {
    margin-bottom: 14px;
  }
  #view-edit .seeknEditContent .field > span:first-child {
    font-weight: 600;
    letter-spacing: 0.01em;
  }
  #view-edit .seeknEditContent .toggleLabel {
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.05);
    transition: background 0.18s ease, border-color 0.18s ease;
  }
  #view-edit .seeknEditContent .toggleLabel:hover {
    background: rgba(167,139,250,0.07);
    border-color: rgba(167,139,250,0.22);
  }
  #view-edit .seeknEditContent input[type="color"] {
    height: 38px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.10);
    background: transparent;
    cursor: pointer;
    padding: 2px;
  }
  #view-edit .seeknEditContent .seeknTabHead {
    font-size: 16px;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: baseline;
    gap: 8px;
  }
  #view-edit .seeknEditContent .seeknTabHead .crumb {
    color: var(--text-mute, #9aa0b4);
    font-size: 12px;
    font-weight: 400;
  }

  /* Sticky save bar: clearer separation from the form body */
  .seeknSaveBar {
    position: sticky;
    bottom: 0;
    background: linear-gradient(180deg, rgba(7,7,13,0) 0%, rgba(7,7,13,0.92) 60%, rgba(7,7,13,0.98) 100%);
    padding: 14px 0 4px;
    margin-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    z-index: 5;
  }

  /* Sidebar nav: a touch more elegant on the active item */
  .seeknEditSidebar [data-tab-btn].active {
    background: linear-gradient(135deg, rgba(167,139,250,0.16), rgba(236,72,153,0.06));
    border-color: rgba(167,139,250,0.35);
  }
  