/* ============================================================================
   TAISEI DOJO — admin panel + app-specific additions (loads after taisei.css)
   ========================================================================== */

/* ---- alerts / flash ---- */
.alert {
  border-radius: 10px; padding: 12px 16px; font-size: .85rem; margin-bottom: 18px;
  border: 1px solid var(--td-line);
}
.alert--ok    { background: rgba(63,166,90,.14); border-color: rgba(63,166,90,.4); color: #bff0cd; }
.alert--error { background: var(--td-red-soft); border-color: rgba(233,26,47,.4); color: #ffd9dd; }
.errors { margin: 0 0 4px; padding-left: 18px; }
.errors li { font-size: .8rem; }

/* ---- admin layout ---- */
.admin-shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  border-right: 1px solid var(--td-line); background: var(--td-bg-2);
  padding: 22px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side .brand { margin-bottom: 26px; }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.side nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 9px; font-size: .86rem; color: var(--td-ink-dim);
  transition: background .14s, color .14s;
}
.side nav a:hover { background: var(--td-surface-2); color: var(--td-ink); }
.side nav a.is-active { background: var(--td-red-soft); color: #fff; box-shadow: inset 2px 0 0 var(--td-red); }
.side .side__sep { margin: 16px 6px 8px; font-size: .62rem; letter-spacing: .18em; text-transform: uppercase; color: var(--td-ink-mute); }
.side__foot { margin-top: auto; padding-top: 18px; }

.admin-main { min-width: 0; display: flex; flex-direction: column; }
.admin-bar {
  height: 64px; border-bottom: 1px solid var(--td-line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 26px;
  position: sticky; top: 0; background: rgba(11,11,13,.82); backdrop-filter: blur(12px); z-index: 20;
}
.admin-bar h1 { font-size: 1.05rem; text-transform: uppercase; letter-spacing: .1em; }
.admin-content { padding: 26px; max-width: 1000px; width: 100%; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }

/* ---- stat cards ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat { padding: 20px; }
.stat .k { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--td-ink-mute); }
.stat .v { font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; margin-top: 6px; line-height: 1; }
.stat .v small { font-size: .9rem; color: var(--td-ink-dim); font-weight: 500; }

/* belt distribution bar */
.belt-dist { display: flex; flex-direction: column; gap: 10px; }
.belt-dist__row { display: grid; grid-template-columns: 120px 1fr 34px; align-items: center; gap: 12px; font-size: .82rem; }
.belt-dist__track { height: 10px; border-radius: 999px; background: var(--td-surface-2); overflow: hidden; }
.belt-dist__fill { height: 100%; border-radius: 999px; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--td-line); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 640px; }
table.data th, table.data td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--td-line-soft); }
table.data th {
  font-family: var(--font-display); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--td-ink-mute); background: var(--td-bg-2);
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: rgba(255,255,255,.02); }
table.data td .sub { color: var(--td-ink-mute); font-size: .76rem; }

.row-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px;
  font-size: .72rem; font-weight: 600; border: 1px solid var(--td-line); background: var(--td-surface-2);
}
.badge .dot { width: 9px; height: 9px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.35); }
.badge--ok    { color: #bff0cd; border-color: rgba(63,166,90,.4); }
.badge--muted { color: var(--td-ink-mute); }

/* pagination */
.pagination { display: flex; gap: 6px; list-style: none; padding: 0; margin: 18px 0 0; flex-wrap: wrap; font-size: .82rem; }
.pagination a, .pagination span {
  display: inline-flex; min-width: 34px; height: 34px; align-items: center; justify-content: center;
  padding: 0 10px; border-radius: 8px; border: 1px solid var(--td-line); color: var(--td-ink-dim);
}
.pagination .active span { background: var(--td-red); border-color: var(--td-red); color: #fff; }
.pagination .disabled span { opacity: .4; }

/* photo cell / avatar small */
.avatar-sm { width: 40px; height: 40px; border-radius: 9px; overflow: hidden; background: var(--td-surface-2);
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: .9rem; color: var(--td-ink-dim); flex: none; }
.avatar-sm img { width: 100%; height: 100%; object-fit: cover; }
.cell-user { display: flex; align-items: center; gap: 12px; }

/* ---- watch page ---- */
.watch-frame { position: relative; width: 100%; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--td-line); background: #000; }
.watch-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--td-ink-dim); margin-bottom: 14px; }
.back-link:hover { color: var(--td-red); }

/* checkbox row */
.check-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: .88rem; }
.check-row input { width: 18px; height: 18px; accent-color: var(--td-red); }

/* photo preview in form */
.photo-preview { width: 84px; height: 84px; border-radius: 12px; overflow: hidden; border: 1px solid var(--td-line);
  background: var(--td-surface-2); display: grid; place-items: center; color: var(--td-ink-mute); font-size: .7rem; flex: none; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }

/* mobile admin */
@media (max-width: 820px) {
  .admin-shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--td-line);
    display: flex; align-items: center; gap: 16px; overflow-x: auto; padding: 14px 16px; }
  .side .brand { margin-bottom: 0; }
  .side nav { flex-direction: row; }
  .side .side__sep, .side__foot { display: none; }
  .side nav a.is-active { box-shadow: inset 0 -2px 0 var(--td-red); }
}
