/* ============================================================
   JUQHUB - GLOBAL DESIGN SYSTEM
   One source of truth for tokens, themes, and shared chrome.
   ============================================================ */

/* ---------- Theme-independent tokens ---------- */
:root {
  --font: 'Space Grotesk', system-ui, -apple-system, sans-serif;

  --radius:    14px;
  --radius-sm: 9px;
  --radius-lg: 18px;
  --nav-h:     56px;
  --footer-h:  52px;

  /* Brand cyan scale (stable across themes) */
  --cyan-300: #7deaff;
  --cyan-400: #38d9ff;
  --cyan-500: #06c2f0;
  --cyan-600: #0099c2;
  --cyan-700: #007894;

  /* Fixed semantic accents (legible in both themes) */
  --green:  #2dce7a;
  --red:    #ff5a52;
  --gold:   #f0b429;
  --violet: #9147ff;   /* twitch brand purple - also JuqHub's secondary accent */
  --pink:   #ff5c9d;
  --orange: #ff9d2e;   /* amber - distinct from brand accent */

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- DARK (default) ---------- */
:root,
[data-theme="dark"] {
  color-scheme: dark;

  --bg:       #0e0e12;
  --bg-2:     #0a0a0d;
  --surface:  #16161b;
  --surface2: #1d1d23;
  --surface3: #26262e;
  --border:   #2a2a33;
  --border-2: #36363f;

  --text:       #f3f3f5;
  --text-muted: #8b8b97;
  --text-dim:   #55555f;

  --accent:        var(--cyan-500);
  --accent-hover:  var(--cyan-400);
  --accent-text:   #4fe0ff;
  --accent-soft:   rgba(6, 194, 240, 0.14);
  --accent-border: rgba(6, 194, 240, 0.34);
  --accent-glow:   rgba(6, 194, 240, 0.22);

  --shadow:  rgba(0, 0, 0, 0.55);
  --hover:   rgba(255, 255, 255, 0.035);
  --overlay: rgba(0, 0, 0, 0.62);
  --nav-bg:  rgba(14, 14, 18, 0.72);

  /* --purple now aliases the real Twitch/JuqHub violet (not the primary accent) -
     pages that reference var(--purple) get genuine purple as the secondary color. */
  --purple:      var(--violet);
  --purple-2:    #a97fff;
  --purple-glow: rgba(145, 71, 255, 0.14);
  --gold-dim:    rgba(240, 180, 41, 0.15);
}

/* ---------- LIGHT ---------- */
[data-theme="light"] {
  color-scheme: light;

  --bg:       #f6f3ee;
  --bg-2:     #efe9df;
  --surface:  #ffffff;
  --surface2: #f3efe8;
  --surface3: #e9e3d8;
  --border:   #e4ddd0;
  --border-2: #d4ccbc;

  --text:       #1c1a17;
  --text-muted: #6c665c;
  --text-dim:   #a59d8e;

  --accent:        var(--cyan-600);
  --accent-hover:  var(--cyan-500);
  --accent-text:   var(--cyan-700);
  --accent-soft:   rgba(0, 153, 194, 0.12);
  --accent-border: rgba(0, 153, 194, 0.30);
  --accent-glow:   rgba(0, 153, 194, 0.18);

  --shadow:  rgba(80, 55, 20, 0.16);
  --hover:   rgba(0, 0, 0, 0.04);
  --overlay: rgba(40, 30, 15, 0.42);
  --nav-bg:  rgba(246, 243, 238, 0.78);

  --purple:      var(--violet);
  --purple-2:    #7d2ff2;
  --purple-glow: rgba(145, 71, 255, 0.12);
  --gold-dim:    rgba(240, 180, 41, 0.18);
}

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

/* ---------- Scrollbars ----------
   Inner scrollable panels get a thin rounded native scrollbar; the PAGE
   itself hides its native bar entirely - the site draws its own scroll
   indicator (#scrollTrack, the white/cyan bar), and showing both side by
   side reads as a double scrollbar. ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-2); border-radius: 999px;
  border: 2px solid transparent; background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
*::-webkit-scrollbar-corner { background: transparent; }
html { scrollbar-width: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  padding-top: var(--nav-h);
  padding-bottom: var(--footer-h);
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}

/* ---- Page entrance (applied by app.js to each page's own content) ---- */
.em-page-in { animation: emPageIn 0.28s ease; }
@keyframes emPageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============================================================
   GLOBAL CHROME (injected by app.js)
   ============================================================ */

/* ---- Top navbar ---- */
.em-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  height: var(--nav-h); padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--border);
}
.em-nav-left, .em-nav-right { display: flex; align-items: center; gap: 8px; min-width: 0; }

.em-brand {
  font-size: 14px; font-weight: 800; letter-spacing: -0.2px;
  text-decoration: none; color: var(--text);
  display: inline-flex; align-items: center; gap: 9px;
}
.em-brand .em-logo {
  width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 15px;
  background: var(--accent-soft); border: 1px solid var(--accent-border);
}
.em-brand .em-brand-txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.em-back {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px 0 11px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-muted);
  font-family: inherit; font-size: 12.5px; font-weight: 700; letter-spacing: 0.2px;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.em-back:hover { border-color: var(--accent-border); color: var(--text); background: var(--accent-soft); }
.em-back svg { width: 15px; height: 15px; }

.em-iconbtn {
  width: 36px; height: 36px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-muted);
  cursor: pointer; transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.em-iconbtn:hover { border-color: var(--accent-border); color: var(--text); background: var(--accent-soft); }
.em-iconbtn svg { width: 17px; height: 17px; }
.em-iconbtn.em-view-on { border-color: var(--accent-border); color: var(--accent); background: var(--accent-soft); }

.em-signin {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px;
  background: var(--accent); border: none; border-radius: var(--radius-sm);
  color: #fff; font-family: inherit; font-size: 12.5px; font-weight: 700;
  letter-spacing: 0.2px; cursor: pointer; white-space: nowrap;
  transition: filter 0.15s, transform 0.1s;
}
.em-signin:hover { filter: brightness(1.08); }
.em-signin:active { transform: translateY(1px); }
.em-signin svg { width: 15px; height: 15px; fill: #fff; }

.em-userpill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 10px 0 7px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 700;
  color: var(--text); white-space: nowrap; cursor: default;
}
.em-userpill img, .em-avatar {
  width: 24px; height: 24px; border-radius: 7px; object-fit: cover; flex-shrink: 0;
}
.em-avatar-init {
  width: 24px; height: 24px; border-radius: 7px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--accent-soft); border: 1px solid var(--accent-border);
  font-size: 11px; font-weight: 800; color: var(--accent);
}
.em-userpill .em-signout {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0 2px; transition: color 0.15s;
}
.em-userpill .em-signout:hover { color: var(--red); }

@media (max-width: 560px) {
  .em-back .em-back-txt { display: none; }
  .em-back { padding: 0 11px; }
  .em-signin .em-signin-txt { display: none; }
  .em-signin { padding: 0 12px; }
  .em-userpill .em-username { display: none; }
}

/* ---- Bottom footer bar ---- */
.em-footer {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 900;
  height: var(--footer-h); padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  border-top: 1px solid var(--border);
}
.em-footer-copy {
  font-size: 11px; color: var(--text-dim); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.em-footer-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.em-footer-btn {
  height: 32px; padding: 0 13px;
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-muted);
  font-family: inherit; font-size: 11.5px; font-weight: 700; letter-spacing: 0.2px;
  cursor: pointer; white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.em-footer-btn:hover { border-color: var(--accent-border); color: var(--text); background: var(--accent-soft); }
.em-footer-btn svg { width: 15px; height: 15px; }

/* ---- Info drop-up popover ---- */
.em-info-pop {
  position: fixed; bottom: calc(var(--footer-h) + 8px); right: 16px; z-index: 949;
  width: min(620px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 16px 44px var(--shadow);
  padding: 18px 20px; max-height: 70vh; overflow-y: auto;
  opacity: 0; transform: translateY(8px) scale(0.99); pointer-events: none;
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
}
.em-info-pop.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

/* ---- Global "fun loading" placeholder (site-wide) - bouncing dots +
   a rotating silly phrase instead of a bare "Loading…". See emLoadingHtml()
   in assets/app.js, exposed to other modules via EM.loadingHtml. */
.em-fun-loading { display: inline-flex; align-items: center; gap: 7px; color: var(--text-dim); font-size: inherit; }
.em-fun-dots { display: inline-flex; gap: 3px; }
.em-fun-dots i {
  width: 4px; height: 4px; border-radius: 50%; background: currentColor;
  display: inline-block; font-style: normal;
  animation: emDotBounce 1.1s infinite ease-in-out;
}
.em-fun-dots i:nth-child(2) { animation-delay: 0.15s; }
.em-fun-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes emDotBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* ---- Global custom tooltip (site-wide, replaces native title=) ----
   Any element with a data-tip="..." attribute gets this automatically -
   see initTooltips() in assets/app.js. */
#emTip {
  position: fixed; z-index: 99999; pointer-events: none;
  background: var(--surface3); border: 1px solid var(--border);
  color: var(--text); font-size: 11.5px; line-height: 1.4;
  padding: 7px 11px; border-radius: var(--radius-sm);
  max-width: 280px; box-shadow: 0 6px 22px rgba(0,0,0,0.45);
  opacity: 0; transform: translateY(3px);
  transition: opacity 0.12s, transform 0.12s;
}
#emTip.show { opacity: 1; transform: translateY(0); }
[data-tip] { cursor: help; }

/* ---- Global custom date picker (replaces native input[type=date]) ---- */
.em-dp-wrap { position: relative; display: block; width: 100%; }
.em-dp-input { cursor: pointer; }
.em-dp-pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 1000;
  width: 220px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 16px 44px var(--shadow);
  padding: 10px 12px;
  opacity: 0; transform: translateY(-4px) scale(0.99); pointer-events: none;
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);
}
.em-dp-pop.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.em-dp-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.em-dp-navlabel { font-size: 11.5px; font-weight: 700; color: var(--text); }
.em-dp-navbtn {
  width: 20px; height: 20px; display: grid; place-items: center;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text-muted); font-size: 12px; font-weight: 700; line-height: 1; cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.em-dp-navbtn:hover { border-color: var(--accent-border); color: var(--text); background: var(--accent-soft); }
.em-dp-dow {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 3px;
  font-size: 9px; font-weight: 700; color: var(--text-dim); text-align: center;
}
.em-dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.em-dp-cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 600; border-radius: 4px; cursor: pointer;
  background: var(--surface2); color: var(--text-muted);
  transition: background 0.13s, color 0.13s;
}
.em-dp-cell:hover { background: var(--accent-soft); color: var(--text); }
.em-dp-cell.empty { background: transparent; cursor: default; }
.em-dp-cell.sel { background: var(--accent); color: var(--badge-ink, #14110b); font-weight: 800; }

/* ---- Tenzin forecast widget (homepage nav only) ---- */
.em-tzwidget-wrap { position: relative; }
.em-tzwidget {
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 13px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: inherit; font-size: 12.5px; font-weight: 700; letter-spacing: 0.1px;
  cursor: pointer; white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}
.em-tzwidget:hover { border-color: var(--accent-border); background: var(--accent-soft); }
.em-tzwidget-icon { font-size: 15px; line-height: 1; }
.em-tzwidget-icon:empty { display: none; }
.em-tzwidget-txt { text-transform: uppercase; }
.em-tzwidget-txt .em-fun-loading { color: #fff; }
.em-tz-pill-seg.forecast { color: var(--text); }
.em-tz-pill-seg.pto { color: var(--accent-text); }
.em-tz-pill-seg.events { color: var(--violet); }
.em-tz-pill-seg.live { color: var(--red); }
.em-tz-pill-dot { color: var(--text-dim); font-weight: 400; margin: 0 7px; }
/* Drop-DOWN (not up) - this one lives in the top nav, not the footer. */
.em-tzwidget-pop {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 949;
  width: 760px; max-height: 80vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 16px 44px var(--shadow);
  padding: 16px 18px;
  opacity: 0; transform: translateY(-6px) scale(0.99); pointer-events: none;
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
}
.em-tzwidget-pop.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.em-tzwidget-cols { display: flex; gap: 16px; align-items: flex-start; }
.em-tz-col { flex: 1 1 0; min-width: 0; }
.em-tz-col-r { border-left: 1px solid var(--border); padding-left: 16px; }
.em-tz-row-sub { opacity: 0.7; font-size: 11px; font-style: italic; }
.em-tz-ev { display: block; padding: 6px 8px; margin: 0 -8px; border-radius: var(--radius-sm); color: inherit; text-decoration: none; }
.em-tz-ev + .em-tz-ev { margin-top: 4px; }
.em-tz-ev.clickable { cursor: pointer; transition: background 0.15s; }
.em-tz-ev.clickable:hover { background: var(--accent-soft); }
.em-tz-ev-row { display: flex; align-items: flex-start; gap: 10px; }
.em-tz-ev-img { width: 40px; height: 40px; flex-shrink: 0; object-fit: cover; border-radius: var(--radius-sm); display: block; }
.em-tz-ev-body { flex: 1; min-width: 0; }
.em-tz-ev-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.em-tz-ev-date { font-size: 10.5px; font-weight: 800; letter-spacing: 0.4px; text-transform: uppercase; color: var(--accent-text); }
.em-tz-ev-countdown { font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text-dim); }
.em-tz-ev-time { font-size: 10.5px; color: var(--text-dim); flex-shrink: 0; }
.em-tz-ev-title { font-size: 12.5px; font-weight: 700; color: var(--text); line-height: 1.4; }
.em-tz-pastbtn {
  width: 100%; margin-top: 10px; background: none; border: 1px dashed var(--border);
  color: var(--text-dim); border-radius: var(--radius-sm); padding: 6px 12px;
  font-size: 11.5px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: border-color 0.18s, color 0.18s;
}
.em-tz-pastbtn:hover { border-color: var(--accent); color: var(--accent-text); }
.em-tzwidget-past {
  max-height: 0; overflow: hidden; margin-top: 12px;
  transition: max-height 0.28s var(--ease);
}
.em-tzwidget-past-inner { padding-top: 12px; border-top: 1px solid var(--border); }
.em-tzwidget-past .em-tz-subhead { margin: 0 0 8px; }
#emTzPastList { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 16px; }
#emTzPastList .em-tz-status { grid-column: 1 / -1; }
/* Grid columns already give each card its own lane via `gap` - the
   negative-margin hover trick (used elsewhere to give the highlight
   breathing room) would push the first/last column's card past the grid's
   own edge and get clipped by the popup's overflow, so cancel it here. */
#emTzPastList .em-tz-ev { margin: 0; }
@media (max-width: 760px) {
  #emTzPastList { grid-template-columns: 1fr; }
}
.em-tzwidget-h { font-size: 13px; font-weight: 800; color: var(--text); margin-bottom: 10px; }
.em-tz-status { font-size: 12.5px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.5; }
.em-tz-status.live { color: var(--red, #ff5c5c); font-weight: 700; }
.em-tz-trend {
  display: inline-flex; align-items: center; gap: 5px; cursor: help;
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: var(--radius-sm);
  margin: -4px 0 10px;
}
.em-tz-trend.hot  { color: #fb923c; background: rgba(251,146,60,0.12); }
.em-tz-trend.cold { color: var(--accent-text); background: var(--accent-soft); }
.em-tz-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px 0; border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted);
}
.em-tz-row:last-child { border-bottom: none; }
.em-tz-row strong { color: var(--text); font-weight: 700; }
.em-tz-refname { display: inline-flex; align-items: center; gap: 6px; }
.em-tz-refname.live { color: var(--red, #ff5c5c); font-weight: 700; }
.em-tz-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--red, #ff5c5c); flex-shrink: 0;
  box-shadow: 0 0 0 0 rgba(255,92,92,0.5); animation: emTzPulse 1.6s infinite;
}
@keyframes emTzPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,92,92,0.45); }
  70%  { box-shadow: 0 0 0 5px rgba(255,92,92,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,92,92,0); }
}
.em-tz-subhead { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin: 12px 0 8px; }
.em-tz-week { display: flex; align-items: flex-end; justify-content: space-between; gap: 4px; }
.em-tz-day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.em-tz-day-pct { font-size: 8.5px; font-weight: 700; color: var(--text-dim); }
.em-tz-day.today .em-tz-day-pct { color: var(--accent-text); }
.em-tz-day-track { width: 100%; max-width: 18px; height: 34px; display: flex; align-items: flex-end; }
.em-tz-day-bar { display: block; width: 100%; background: var(--border-2); border-radius: 3px 3px 0 0; transition: background 0.15s; }
.em-tz-day.today .em-tz-day-bar { background: var(--accent); }
.em-tz-day-lbl { font-size: 9px; font-weight: 700; color: var(--text-dim); }
.em-tz-day.today .em-tz-day-lbl { color: var(--accent-text); }
.em-tz-pto-big { font-size: 34px; font-weight: 800; color: var(--accent); line-height: 1; }
.em-tz-pto-sub { font-size: 11px; color: var(--text-muted); margin: 4px 0 10px; }
.em-tz-cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.em-tz-cal-navlabel { font-size: 11.5px; font-weight: 700; color: var(--text); }
.em-tz-cal-navbtn {
  width: 22px; height: 22px; display: grid; place-items: center;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text-muted); font-size: 13px; font-weight: 700; line-height: 1; cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.em-tz-cal-navbtn:hover { border-color: var(--accent-border); color: var(--text); background: var(--accent-soft); }
.em-tz-cal-navbtn:disabled { opacity: 0.35; cursor: default; }
.em-tz-cal-navbtn:disabled:hover { border-color: var(--border); color: var(--text-muted); background: var(--surface2); }
.em-tz-cal-dow {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 3px;
  font-size: 9px; font-weight: 700; color: var(--text-dim); text-align: center;
}
.em-tz-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.em-tz-cal-cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 9.5px; font-weight: 700; border-radius: 4px;
  background: var(--surface2); color: var(--text-dim);
}
.em-tz-cal-cell.empty { background: transparent; }
.em-tz-cal-cell.stream { background: var(--accent); color: var(--badge-ink, #14110b); }
.em-tz-cal-cell.off { background: var(--red, #ff5c5c); opacity: 0.7; color: #fff; }
.em-tz-cal-cell.unknown { background: var(--border-2); opacity: 0.5; }
.em-tz-cal { margin-top: 14px; }
.em-tz-cal-summary {
  margin-top: 10px; font-size: 10px; text-align: center;
  display: flex; align-items: center; justify-content: center; flex-wrap: nowrap;
  white-space: nowrap; overflow-x: hidden;
}
.em-tz-cal-sum-item { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.em-tz-cal-sum-item.stream  { color: var(--accent-text); }
.em-tz-cal-sum-item.pto     { color: var(--red, #ff5c5c); }
.em-tz-cal-sum-item.weekend { color: var(--violet); }
.em-tz-cal-sum-dot { color: var(--text-dim); font-weight: 400; margin: 0 4px; flex-shrink: 0; }
@media (max-width: 900px) {
  .em-tzwidget-pop { width: min(760px, calc(100vw - 32px)); }
}
@media (max-width: 760px) {
  .em-tzwidget-cols { flex-direction: column; }
  .em-tz-col-r { border-left: none; padding-left: 0; border-top: 1px solid var(--border); padding-top: 14px; }
}
@media (max-width: 560px) {
  .em-tzwidget-txt { display: none; }
  .em-tzwidget { padding: 0 10px; }
  .em-tzwidget-pop { left: -8px; }
}

/* ---- Scroll progress bar ---- */
#scrollTrack {
  position: fixed; top: var(--nav-h); right: 0; z-index: 895;
  width: 8px; height: calc(100vh - var(--nav-h) - var(--footer-h));
  background: rgba(255,255,255,0.06); cursor: pointer;
  border-radius: 6px;
}
#scrollFill { width: 100%; height: 0%; background: linear-gradient(to bottom, var(--text), var(--accent)); border-radius: 6px; pointer-events: none; }
#scrollHandle {
  position: absolute; left: 0; top: 0; width: 8px; height: 40px;
  background: #fff; border-radius: 4px; cursor: grab;
}
#scrollHandle.dragging { cursor: grabbing; }

/* ---- Back to top ---- */
#backToTop {
  position: fixed; bottom: calc(var(--footer-h) + 10px); right: 14px; z-index: 9998;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-muted);
  font-family: inherit; cursor: pointer;
  opacity: 0; pointer-events: none; transform: translateY(6px);
  transition: border-color 0.15s, color 0.15s, background 0.15s, opacity 0.2s, transform 0.2s;
}
#backToTop.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
#backToTop:hover { border-color: var(--accent-border); color: var(--text); background: var(--accent-soft); }
#backToTop svg { width: 20px; height: 20px; }

/* ---- Modal (feedback / universal) ---- */
.em-modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--overlay);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.em-modal-overlay.show { display: flex; }
.em-modal {
  position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 22px 20px;
  width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 64px var(--shadow);
}
.em-modal-close {
  position: absolute; top: 12px; right: 12px;
  background: none; border: none; color: var(--text-dim);
  font-size: 21px; line-height: 1; cursor: pointer; padding: 4px; transition: color 0.15s;
}
.em-modal-close:hover { color: var(--text); }
.em-modal-title { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
.em-modal-sub { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; line-height: 1.5; }

/* ---- Tiered chips (feedback) ---- */
.em-tier-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-dim); margin: 4px 0 7px;
}
.em-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.em-chip {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 5px 12px; font-size: 12px;
  color: var(--text-muted); cursor: pointer; user-select: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.em-chip:hover { border-color: var(--accent-border); color: var(--text); }
.em-chip.active { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }

/* ---- Feedback context pill (collapsed tool picker) ---- */
.em-fb-context {
  display: flex; align-items: center; gap: 6px; width: 100%;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px; margin-bottom: 10px;
  color: var(--text); font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; text-align: left; transition: border-color 0.15s, background 0.15s;
}
.em-fb-context:hover { border-color: var(--accent-border); background: var(--accent-soft); }
.em-fb-context-lbl { color: var(--text-dim); font-weight: 500; }
.em-fb-context-val { flex: 1; color: var(--accent-text); }
.em-fb-context-chev { color: var(--text-dim); font-size: 10px; transition: transform 0.15s; }
.em-fb-context.open .em-fb-context-chev { transform: rotate(180deg); }
.em-chips.em-fb-tools {
  max-height: 0; overflow: hidden; opacity: 0; margin-bottom: 0;
  transition: max-height 0.25s var(--ease), opacity 0.2s var(--ease), margin-bottom 0.25s var(--ease);
}
.em-chips.em-fb-tools.show { max-height: 220px; opacity: 1; margin-bottom: 14px; }

.em-textarea {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px;
  color: var(--text); resize: vertical; min-height: 76px; font-family: inherit;
  outline: none; transition: border-color 0.15s; margin-bottom: 10px;
}
.em-textarea:focus { border-color: var(--accent); }
.em-textarea::placeholder { color: var(--text-dim); }
.em-modal-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.em-hint { font-size: 11.5px; color: var(--text-dim); }
.em-send {
  background: var(--accent); color: #fff; border: none;
  border-radius: var(--radius-sm); padding: 8px 18px; font-size: 13px;
  font-weight: 700; font-family: inherit; cursor: pointer; transition: filter 0.15s, opacity 0.15s;
}
.em-send:hover { filter: brightness(1.06); }
.em-send:disabled { opacity: 0.4; cursor: default; }
.em-sent { font-size: 13px; color: var(--green); font-weight: 700; text-align: center; padding: 14px 0; }

/* ---- Admin modal ---- */
.em-modal--wide { max-width: 580px; }
.em-adm-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.em-adm-stat {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  transition: border-color 0.15s;
}
.em-adm-stat.live { border-color: var(--accent-border); }
.em-adm-stat-lbl { font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.em-adm-stat-num { font-size: 26px; font-weight: 800; letter-spacing: -1px; }
.em-adm-stat-meta { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.em-adm-sep { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.em-adm-sec-lbl {
  font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 10px;
}
.em-drop {
  border: 2px dashed var(--border); border-radius: var(--radius-sm);
  padding: 18px; text-align: center; cursor: pointer;
  background: var(--surface2); transition: border-color 0.18s, background 0.18s;
}
.em-drop:hover, .em-drop.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.em-drop-lbl { font-size: 13px; font-weight: 600; color: var(--text); }
.em-drop-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.em-drop input[type=file] { display: none; }
.em-drop-prev {
  margin-top: 8px; padding: 8px 12px; background: var(--surface2);
  border-radius: var(--radius-sm); font-size: 12px; color: var(--text-muted); display: none;
}
.em-drop-prev.has-data { display: block; color: var(--text); }
.em-drop-prev strong { color: var(--accent-text); }
.em-boost-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 8px 0; }
.em-boost-table th { text-align: left; font-size: 10.5px; font-weight: 600; color: var(--text-dim); padding: 0 10px 9px 0; border-bottom: 1px solid var(--border); }
.em-boost-table th:nth-child(2) { text-align: center; width: 88px; }
.em-boost-table th:nth-child(3) { text-align: right; width: 56px; }
.em-boost-table th:last-child { width: 20px; }
.em-boost-table td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--border); vertical-align: middle; }
.em-boost-login-wrap { display: flex; align-items: center; gap: 8px; }
.em-boost-login { background: none; border: none; outline: none; font-size: 12.5px; color: var(--text); flex: 1; min-width: 0; }
.em-boost-login::placeholder { color: var(--text-dim); }
.em-boost-ind { flex-shrink: 0; font-size: 9.5px; font-weight: 700; letter-spacing: 0.4px; padding: 2px 7px; border-radius: 4px; white-space: nowrap; }
.em-boost-ind:empty { display: none; }
.em-chance-cell { width: 56px; text-align: right; }
.em-boost-chance { font-size: 11.5px; font-weight: 600; color: var(--text-muted); font-family: monospace; }
.em-boost-table tfoot td { padding: 9px 10px 4px 0; border-top: 1px solid var(--border); border-bottom: none; }
.em-boost-else-lbl { font-size: 12px; color: var(--text-dim); font-style: italic; }
.em-boost-ind.in-pool { background: rgba(34,197,94,0.12); color: #22c55e; border: 1px solid rgba(34,197,94,0.25); }
.em-boost-ind.not-in-pool { background: rgba(251,146,60,0.12); color: #fb923c; border: 1px solid rgba(251,146,60,0.25); }
.em-ac-drop { position: fixed; z-index: 10001; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 6px 20px rgba(0,0,0,0.35); display: none; overflow-y: auto; overflow-x: hidden; }
.em-ac-drop.show { display: block; }
.em-ac-item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; cursor: pointer; }
.em-ac-item:hover { background: var(--accent-soft); }
.em-ac-thumb { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.em-ac-name { font-size: 12.5px; color: var(--text); flex: 1; }
.em-ac-login { font-size: 11px; color: var(--text-dim); font-family: monospace; }
.em-wt-cell { white-space: nowrap; display: flex; align-items: center; justify-content: center; gap: 5px; }
.em-wt-val { width: 22px; text-align: center; font-weight: 700; font-size: 13.5px; }
.em-wbtn { background: var(--surface2); border: 1px solid var(--border); color: var(--text); width: 22px; height: 22px; border-radius: 4px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; transition: background 0.13s; }
.em-wbtn:hover { background: var(--accent-soft); border-color: var(--accent-border); }
.em-del-row { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 15px; opacity: 0.55; line-height: 1; }
.em-del-row:hover { opacity: 1; color: var(--red); }
.em-add-boost { margin-top: 8px; background: none; border: 1px dashed var(--border); color: var(--text-dim); border-radius: var(--radius-sm); padding: 6px 12px; font-size: 12px; font-weight: 600; cursor: pointer; width: 100%; transition: border-color 0.18s, color 0.18s; font-family: inherit; }
.em-add-boost:hover { border-color: var(--accent); color: var(--accent-text); }
.em-add-boost:disabled { opacity: 0.4; cursor: not-allowed; }
.em-add-boost:disabled:hover { border-color: var(--border); color: var(--text-dim); }
.em-boost-table td.em-adm-loading-cell { padding: 14px 0; text-align: center; color: var(--text-dim); }
.em-upload-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.em-upload-btn { background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 700; border: none; border-radius: var(--radius-sm); padding: 8px 18px; cursor: pointer; font-family: inherit; transition: opacity 0.18s; }
.em-upload-btn:hover { opacity: 0.85; }
.em-upload-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.em-upload-status { font-size: 12px; color: var(--text-muted); }
.em-upload-status.ok  { color: var(--green); }
.em-upload-status.err { color: var(--red); }

/* Tenzin Events admin table - own column widths, reuses .em-boost-table row/base styles */
.em-events-table th:nth-child(1) { width: 56px; }
.em-events-table th:nth-child(3) { width: 118px; }
.em-events-table th:nth-child(4) { width: 90px; }
.em-events-table th:nth-child(5) { width: auto; }
.em-events-table th:last-child { width: 20px; }
.em-ev-input {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 5px;
  outline: none; font-size: 12px; color: var(--text); font-family: inherit;
  padding: 5px 7px; width: 100%; min-width: 0;
}
.em-ev-input:focus { border-color: var(--accent-border); }
.em-ev-input::placeholder { color: var(--text-dim); }
.em-ev-td-title { min-width: 130px; }
.em-ev-td-link { min-width: 140px; }
.em-ev-td-img { width: 56px; }
.em-ev-imgbox {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  background: var(--surface2); border: 1px dashed var(--border);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.em-ev-imgbox:hover { border-color: var(--accent); background: var(--accent-soft); }
.em-ev-imgbox img { width: 100%; height: 100%; object-fit: cover; }
.em-ev-imgph { font-size: 15px; color: var(--text-dim); }
