:root {
  --bg: #0c0a18;
  --bg-surface: #131129;
  --bg-hover: #1c1935;
  --bg-active: #221f40;
  --border: #252244;
  --border-bright: #3a3568;
  --text: #ede9ff;
  --text-muted: #8580aa;
  --text-dim: #4a4670;
  --accent: #9b72ff;
  --accent-dim: #6b4fc4;
  --gold: #c9a030;
  --gold-bright: #e6bb42;
  --danger: #f87171;
  --sidebar-w: 240px;
  --header-h: 60px;
  --radius: 10px;
  --radius-sm: 6px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* ── Login ── */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(100,60,200,0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(201,160,48,0.06) 0%, transparent 50%),
    var(--bg);
  z-index: 0;
}

.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  padding: 24px;
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
}

.login-brand {
  text-align: center;
  margin-bottom: 40px;
}

.brand-mark {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

.brand-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--text);
}

.brand-subtitle {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  margin-top: 6px;
  text-transform: uppercase;
}

.login-form { display: flex; flex-direction: column; gap: 20px; }

.form-group { display: flex; flex-direction: column; gap: 8px; }

.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.form-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.form-input::placeholder { color: var(--text-dim); }
.form-input:focus { border-color: var(--accent-dim); }

.error-msg {
  font-size: 13px;
  color: var(--danger);
  display: none;
}

.error-msg.visible { display: block; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary { background: var(--accent-dim); color: #fff; }
.btn-primary:hover { background: var(--accent); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-full { width: 100%; }

/* ── Panel Layout ── */

.panel-page { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--text);
  line-height: 1.3;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.nav-item:hover { background: var(--bg-hover); color: var(--text); }

.nav-item.active { background: var(--bg-active); color: var(--text); }
.nav-item.active .nav-icon { color: var(--gold); }

.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-label { font-size: 13px; font-weight: 500; }

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.user-details { min-width: 0; }

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role { font-size: 11px; color: var(--text-muted); }

.logout-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: color 0.2s;
  flex-shrink: 0;
}

.logout-btn:hover { color: var(--danger); }

.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.content-header {
  height: var(--header-h);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.page-title { font-size: 17px; font-weight: 600; color: var(--text); }

.header-date { font-size: 12px; color: var(--text-muted); }

.content-body { flex: 1; overflow-y: auto; padding: 32px; }

.module-section { display: none; }
.module-section.active { display: block; }

/* ── Coming Soon ── */

.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 380px;
  color: var(--text-dim);
}

.coming-soon-icon { opacity: 0.25; }
.coming-soon h3 { font-size: 17px; font-weight: 600; color: var(--text-muted); }
.coming-soon p { font-size: 13px; color: var(--text-dim); }

/* ── Intel Module ── */

.intel-container { max-width: 860px; }

.report-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.report-list-title { font-size: 15px; font-weight: 600; color: var(--text); }
.report-count { font-size: 12px; color: var(--text-muted); }

.report-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 18px;
  cursor: pointer;
  transition: all 0.15s;
}

.report-card:hover { border-color: var(--border-bright); background: var(--bg-hover); }

.report-date-badge {
  background: var(--bg-active);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  text-align: center;
  flex-shrink: 0;
  min-width: 58px;
}

.report-date-day { font-size: 22px; font-weight: 600; color: var(--text); line-height: 1; }
.report-date-month { font-size: 10px; color: var(--text-muted); margin-top: 3px; }

.report-meta { flex: 1; }
.report-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 6px; }

.report-stats { display: flex; gap: 16px; }

.report-stat {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
}

.report-arrow { color: var(--text-dim); transition: transform 0.15s; }
.report-card:hover .report-arrow { transform: translateX(3px); }

/* Report detail */

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  color: var(--text-muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 28px;
}

.back-btn:hover { border-color: var(--border-bright); color: var(--text); }

.report-detail-header { margin-bottom: 32px; }

.report-detail-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.report-detail-meta { font-size: 12px; color: var(--text-muted); }

.lang-section { margin-bottom: 40px; }

.lang-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.lang-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 100px;
}

.lang-badge.zh {
  background: rgba(155,114,255,0.12);
  color: var(--accent);
  border: 1px solid rgba(155,114,255,0.28);
}

.lang-badge.en {
  background: rgba(201,160,48,0.12);
  color: var(--gold-bright);
  border: 1px solid rgba(201,160,48,0.28);
}

.lang-section-title { font-size: 14px; font-weight: 600; color: var(--text-muted); }

.video-grid { display: flex; flex-direction: column; gap: 14px; }

.video-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color 0.15s;
}

.video-card:hover { border-color: var(--border-bright); }

.video-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.video-info { flex: 1; }
.video-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; line-height: 1.4; }
.video-channel { font-size: 12px; color: var(--text-muted); }

.video-rating { display: flex; gap: 2px; flex-shrink: 0; padding-top: 2px; }
.star { font-size: 13px; color: var(--text-dim); }
.star.filled { color: var(--gold); }

.video-card-body { display: flex; flex-direction: column; gap: 14px; }

.video-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.video-points { list-style: none; display: flex; flex-direction: column; gap: 5px; }

.video-points li {
  font-size: 13px;
  color: var(--text-muted);
  padding-left: 14px;
  position: relative;
  line-height: 1.55;
}

.video-points li::before {
  content: '·';
  position: absolute;
  left: 2px;
  color: var(--accent-dim);
  font-size: 16px;
  line-height: 1.2;
}

.video-um-view {
  background: var(--bg);
  border-left: 2px solid var(--accent-dim);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 16px;
}

.video-um-view p { font-size: 13px; color: var(--text-muted); line-height: 1.65; font-style: italic; }

.video-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--accent);
  transition: opacity 0.15s;
}

.video-link:hover { opacity: 0.75; }

/* ── States ── */

.loading-state {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  padding: 48px 0;
}

.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 80px 0;
  color: var(--text-muted);
}

.empty-state p { margin-top: 8px; font-size: 13px; color: var(--text-dim); }

/* ── Modal ── */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-bright);
  border-radius: 14px;
  width: 100%;
  max-width: 380px;
  margin: 24px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 15px; font-weight: 600; color: var(--text); }

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  transition: color 0.15s;
}

.modal-close:hover { color: var(--text); }

.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }

.modal-error {
  font-size: 13px;
  color: var(--danger);
  min-height: 18px;
}

.modal-footer {
  padding: 0 24px 22px;
  display: flex;
  justify-content: flex-end;
}

/* ── Intel v2 (new format) ── */

.intel-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  margin-bottom: 32px;
}

.intel-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
}

.intel-section { margin-bottom: 40px; }

.intel-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.intel-section-count {
  font-size: 12px;
  color: var(--text-dim);
  margin-left: auto;
}

.section-type-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--bg-active);
  color: var(--text-muted);
  border: 1px solid var(--border-bright);
}

.vid-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.vid-stats { display: flex; align-items: center; gap: 3px; }

.vid-stat { font-size: 11px; color: var(--text-dim); }
.vid-sep { font-size: 11px; color: var(--text-dim); opacity: 0.4; }

.caption-badge {
  background: rgba(155,114,255,0.1);
  color: var(--accent);
  border: 1px solid rgba(155,114,255,0.22);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.vid-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.vid-tag {
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-active);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
}

.video-title-link {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 2px;
  transition: color 0.15s;
}

.video-title-link:hover { color: var(--accent); }

.vid-desc { border: none; outline: none; }

.vid-desc-toggle {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  transition: color 0.15s;
}

.vid-desc-toggle::-webkit-details-marker { display: none; }
.vid-desc-toggle::before { content: '▸'; font-size: 10px; transition: transform 0.15s; display: inline-block; }
details[open] .vid-desc-toggle::before { transform: rotate(90deg); }
.vid-desc-toggle:hover { color: var(--text-muted); }

.vid-desc-body {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
  padding: 10px 0 2px 16px;
  border-left: 2px solid var(--border);
  margin-top: 8px;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-bright); }
