/* Staff dashboard. Builds on styles.css tokens. */

.admin-body { background: var(--night); }

/* ---------- sign in ---------- */

.auth-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(700px 400px at 50% -10%, rgba(121, 184, 176, 0.12), transparent 70%),
    var(--night);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 36px 32px;
  border-radius: var(--r-lg);
  background: var(--panel);
  border: 1px solid var(--rule);
}
.auth-logo { width: 150px; height: 38px; margin-bottom: 28px; }
.auth-title { font-family: var(--font-display); font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 6px; }
.auth-sub { color: var(--muted); margin: 0 0 8px; }
.auth-back { display: block; text-align: center; margin-top: 22px; font-size: 14px; color: var(--muted); }
.uid-box { margin: 18px 0 12px; padding: 14px; border-radius: var(--r-sm); background: var(--night-2); border: 1px solid var(--rule); }
.uid-box code { display: block; font-size: 13px; word-break: break-all; color: var(--cream); }

/* ---------- shell ---------- */

.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 26px 16px 20px;
  border-right: 1px solid var(--rule);
  background: var(--night-2);
}
.sidebar-brand { padding: 0 10px; margin-bottom: 30px; }

.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--r-sm);
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.side-link svg { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }
.side-link:hover { color: var(--cream); background: var(--panel); }
.side-link.active { color: var(--cream); background: var(--panel-2); box-shadow: inset 3px 0 0 var(--teal); }
.badge {
  margin-left: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--gold);
  color: #241a05;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding-top: 20px; border-top: 1px solid var(--rule); }
.side-ext { padding: 8px 12px; border-radius: var(--r-sm); font-size: 14px; color: var(--cream-dim); text-decoration: none; }
.side-ext:hover { background: var(--panel); color: var(--cream); }
.side-user { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 12px 0; font-size: 13px; }
.side-user-email { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { padding: 36px 44px 80px; max-width: 1040px; width: 100%; min-width: 0; }

.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.view-title { font-family: var(--font-display); font-size: 36px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.05; margin: 0; }
.view-sub { color: var(--muted); margin: 6px 0 0; }

/* ---------- overview ---------- */

.state-card, .tie-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 24px 26px;
  border-radius: var(--r-lg);
  background: var(--panel);
  border: 1px solid var(--rule);
  margin-bottom: 16px;
}
.tie-card { border-color: rgba(240, 195, 106, 0.45); background: linear-gradient(0deg, rgba(240, 195, 106, 0.06), rgba(240, 195, 106, 0.06)), var(--panel); }
.state-main { display: flex; gap: 16px; align-items: flex-start; }
.state-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 9px; flex-shrink: 0; background: var(--muted); }
.state-dot.teal { background: var(--teal); animation: pulse 2.4s infinite; }
.state-dot.rose { background: var(--rose); }
.state-dot.gold { background: var(--gold); }
.state-title { font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.state-detail { color: var(--cream-dim); margin-top: 2px; font-variant-numeric: tabular-nums; }
.state-actions, .tie-options { display: flex; gap: 10px; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { padding: 18px 20px; border-radius: var(--r-md); background: var(--panel); border: 1px solid var(--rule); }
.stat-num { font-family: var(--font-display); font-size: 34px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 14px; margin-top: 2px; }

.panel {
  padding: 24px 26px;
  border-radius: var(--r-lg);
  background: var(--panel);
  border: 1px solid var(--rule);
  margin-bottom: 16px;
}
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.01em; }
.panel-note { color: var(--muted); font-size: 14px; margin: 0 0 6px; }

.stand-row { display: grid; grid-template-columns: 22px 34px 1fr 40px; gap: 12px; align-items: center; padding: 9px 0; }
.stand-rank { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.stand-title { font-weight: 600; font-size: 15px; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stand-count { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 99px; background: var(--night-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--rule-strong); transition: width 0.6s var(--ease-out); }
.stand-row.lead .bar-fill { background: var(--teal); }
.stand-row.lead .stand-title { color: var(--teal); }

.thumb {
  width: 34px;
  height: 50px;
  border-radius: 6px;
  background: var(--panel-3) center / cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}
.thumb.lg { width: 56px; height: 82px; border-radius: 8px; font-size: 20px; }
.thumb.xl { width: 96px; height: 142px; border-radius: 10px; font-size: 32px; }

.empty-line { color: var(--muted); padding: 14px 2px; margin: 0; }

/* ---------- toolbar & rows ---------- */

.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar-search { max-width: 340px; }
.seg { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--panel); border: 1px solid var(--rule); }
.seg-btn { border: 0; background: none; color: var(--muted); padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; cursor: pointer; }
.seg-btn.active { background: var(--cream); color: var(--night); }

.rows { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--panel);
  border: 1px solid var(--rule);
}
.row.is-hidden { opacity: 0.62; }
.row-body { min-width: 0; }
.row-title { font-weight: 700; font-size: 16px; }
.row-meta { color: var(--muted); font-size: 14px; }
.row-pitch {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--cream-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 62ch;
}
.row-votes { text-align: center; min-width: 56px; }
.row-votes strong { display: block; font-family: var(--font-display); font-size: 26px; line-height: 1; }
.row-votes span { font-size: 12px; color: var(--muted); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.voter-row { grid-template-columns: auto 1fr auto; }

/* ---------- approvals ---------- */

.toggle-panel { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.toggle-title { font-weight: 700; font-size: 16px; }
.toggle-desc { color: var(--muted); font-size: 14px; margin-top: 2px; max-width: 56ch; }

.switch {
  flex-shrink: 0;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--rule-strong);
  background: var(--night-2);
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s var(--ease-out), background 0.2s ease;
}
.switch.on { background: var(--teal); border-color: var(--teal); }
.switch.on::after { transform: translateX(22px); background: var(--night); }

.queue { display: grid; gap: 12px; }
.q-card {
  display: flex;
  gap: 20px;
  padding: 18px;
  border-radius: var(--r-lg);
  background: var(--panel);
  border: 1px solid var(--rule);
}
.q-body { flex: 1; min-width: 0; }
.q-body .bubble { max-width: 560px; }
.q-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

/* ---------- event setup ---------- */

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.split { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; }
.split + .split { border-top: 1px solid var(--rule); }
.danger-panel { border-color: rgba(255, 122, 107, 0.3); }

.upload-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 22px;
  border-radius: var(--r-md);
  border: 1.5px dashed var(--rule-strong);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.upload-drop:hover, .upload-drop:focus-within { border-color: var(--teal); background: var(--teal-soft); }
.upload-drop span { font-weight: 700; color: var(--teal); }
.upload-drop small { color: var(--muted); font-size: 13px; }

.gallery { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.gallery:empty { display: none; }
.gallery-item { position: relative; }
.gallery-img { width: 112px; height: 70px; border-radius: 8px; background: var(--panel-3) center / cover; }
.gallery-del {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--panel);
  background: var(--danger);
  color: #1b0805;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.save-bar {
  position: sticky;
  bottom: 16px;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px 14px 22px;
  border-radius: 999px;
  background: rgba(31, 39, 66, 0.92);
  border: 1px solid var(--rule-strong);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  margin-bottom: 16px;
}
.save-bar .field-hint { margin: 0; }

/* ---------- drawer ---------- */

.drawer-layer { justify-content: flex-end; align-items: stretch; padding: 0; }
.drawer {
  width: 100%;
  max-width: 520px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--rule-strong);
  transform: translateX(40px);
  transition: transform 0.3s var(--ease-out);
}
.layer.open .drawer { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 22px 24px; border-bottom: 1px solid var(--rule); }
.drawer-title { font-family: var(--font-display); font-size: 24px; font-weight: 700; margin: 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px 24px 28px; }
.drawer-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--rule); }
.drawer-preview { display: grid; grid-template-columns: 110px 1fr; gap: 18px; align-items: start; margin-bottom: 6px; }
.drawer-preview .poster { font-size: 40px; border-radius: 10px; }

.track-row { display: flex; gap: 8px; }
.track-preview { margin-top: 12px; }
.track-preview iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--r-sm); background: #000; }
.track-preview audio { width: 100%; }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    height: auto;
    z-index: 50;
    flex-direction: row;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: 1px solid var(--rule);
    background: rgba(20, 26, 46, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .sidebar-brand, .side-foot .side-ext { display: none; }
  .side-nav { flex-direction: row; flex: 1; gap: 2px; }
  .side-link { flex-direction: column; gap: 3px; padding: 8px 2px; font-size: 11px; justify-content: center; position: relative; }
  .side-link.active { box-shadow: inset 0 2px 0 var(--teal); }
  .side-link .badge { position: absolute; top: 2px; right: calc(50% - 22px); margin: 0; min-width: 18px; height: 18px; font-size: 11px; padding: 0 5px; }
  .side-foot { display: none; }
  .main { padding: 22px 16px 120px; }
  .view-title { font-size: 30px; }
  .row { grid-template-columns: auto 1fr auto; }
  .row-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .voter-row .row-actions { grid-column: auto; }
  .q-card { flex-direction: column; }
  .grid-2 { grid-template-columns: 1fr; }
  .toggle-panel { align-items: flex-start; }
  .save-bar { bottom: 84px; border-radius: var(--r-md); }
  .drawer-layer { align-items: flex-end; }
  .drawer { max-width: none; height: 92vh; border-left: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; transform: translateY(30px); }
  .state-actions { width: 100%; }
  .state-actions .btn { flex: 1; }
}

@media (max-width: 480px) {
  .stats { gap: 8px; }
  .stat { padding: 14px; }
  .stat-num { font-size: 28px; }
  .split { flex-direction: column; align-items: flex-start; }
  .voter-row { grid-template-columns: auto 1fr; }
  .voter-row .row-actions { grid-column: 1 / -1; }
}

/* mobile: account + sign out lives at the top of each view */
.mobile-account { display: none; }
@media (max-width: 860px) {
  .mobile-account { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 22px; }
  .mobile-links { display: flex; gap: 8px; }
}
