@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500&family=Geist+Mono:wght@400;500&display=swap');

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

:root {
  --bg:           #F7F6F3;
  --surface:      #FFFFFF;
  --surface-2:    #F2F1EE;
  --black:        #111110;
  --black-2:      #1A1A18;
  --accent:       #5B21B6;
  --accent-soft:  #EDE9FE;
  --muted:        #8C8B86;
  --muted-2:      #C4C3BE;
  --border:       #E5E4E0;
  --border-2:     #D1D0CB;
  --live:         #DC2626;
  --live-bg:      #FEF2F2;
  --yt:           #DC2626;
  --web:          #1D4ED8;
  --success:      #15803D;
  --success-bg:   #F0FDF4;
  --font:         'Geist', system-ui, sans-serif;
  --mono:         'Geist Mono', monospace;
  --sidebar-w:    52px;
  --sidebar-exp:  196px;
  --ease:         cubic-bezier(0.4, 0, 0.2, 1);
}

html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--bg); color: var(--black); line-height: 1.5; }

/* ─── APP SHELL ─────────────────────────────── */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── SIDEBAR ────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--black-2);
  display: flex;
  flex-direction: column;
  padding: 16px 0 12px;
  flex-shrink: 0;
  transition: width 0.26s var(--ease);
  overflow: hidden;
  z-index: 50;
}

.sidebar:hover { width: var(--sidebar-exp); }

.sb-logo {
  padding: 2px 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 10px;
  white-space: nowrap;
}

.sb-logo-text {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.85);
}

.sb-logo-text span { color: rgba(255,255,255,0.25); }

.sb-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 6px;
}

.sb-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 8px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.16s;
}

.sb-item:hover { background: rgba(255,255,255,0.06); }
.sb-item.active { background: rgba(255,255,255,0.09); }

.sb-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: rgba(255,255,255,0.28);
  transition: color 0.16s;
}

.sb-icon svg { width: 15px; height: 15px; stroke-width: 1.5; }

.sb-item:hover .sb-icon,
.sb-item.active .sb-icon { color: rgba(255,255,255,0.75); }

.sb-label {
  font-size: 12.5px;
  font-weight: 400;
  color: rgba(255,255,255,0.3);
  transition: color 0.16s;
  overflow: hidden;
}

.sb-item:hover .sb-label,
.sb-item.active .sb-label { color: rgba(255,255,255,0.7); }

.sb-tag {
  margin-left: auto;
  font-size: 9px;
  font-family: var(--mono);
  color: rgba(255,255,255,0.15);
  flex-shrink: 0;
  padding-right: 2px;
}

.sb-bottom {
  padding: 10px 6px 0;
  border-top: 1px solid rgba(255,255,255,0.05);
  margin-top: 6px;
}

.sb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s;
}

.sb-user:hover { background: rgba(255,255,255,0.05); }

.sb-avatar {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 500;
  color: rgba(255,255,255,0.45);
  flex-shrink: 0;
  font-family: var(--mono);
}

.sb-user-name {
  font-size: 12px;
  color: rgba(255,255,255,0.35);
  overflow: hidden;
}

/* ─── MAIN ───────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ─── TOPBAR ─────────────────────────────────── */
.topbar {
  height: 46px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--black);
  flex: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-pill {
  display: none;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--live-bg);
  border: 1px solid rgba(220,38,38,0.12);
  font-size: 10px;
  font-weight: 500;
  color: var(--live);
  font-family: var(--mono);
  letter-spacing: 0.4px;
}

.live-pill.show { display: flex; }

.live-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--live);
  animation: blink 1.8s infinite;
}

@keyframes blink { 0%,100% { opacity:1; } 50% { opacity:0.25; } }

/* ─── PAGE BODY ──────────────────────────────── */
.page-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.page-body::-webkit-scrollbar { width: 3px; }
.page-body::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }

.page-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 28px;
}

/* ─── TYPOGRAPHY ─────────────────────────────── */
.page-title {
  font-size: 22px;
  font-weight: 400;
  color: var(--black);
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.page-sub {
  font-size: 13px;
  color: var(--muted);
  font-weight: 300;
}

.section-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
  margin-bottom: 12px;
  font-family: var(--mono);
}

/* ─── BUTTONS ────────────────────────────────── */
.btn {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.14s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--black); color: white; }
.btn-primary:hover { background: var(--black-2); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--black); border-color: var(--border-2); }
.btn-danger { background: var(--live-bg); color: var(--live); border: 1px solid rgba(220,38,38,0.12); }
.btn-danger:hover { background: #FEE2E2; }
.btn-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(21,128,61,0.15); }
.btn-sm { font-size: 12px; padding: 6px 11px; }
.btn-xs { font-size: 11px; padding: 4px 8px; border-radius: 4px; font-family: var(--mono); }

/* ─── FORMS ──────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 5px;
  font-family: var(--mono);
}
.field input, .field textarea, .field select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--black);
  background: var(--surface);
  outline: none;
  transition: border-color 0.14s;
}
.field input:focus, .field textarea:focus { border-color: var(--black); }
.field input::placeholder { color: var(--muted-2); }

/* ─── CARDS ──────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 20px;
}

.stat-card {
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 16px 18px;
}

.stat-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-bottom: 8px;
  font-family: var(--mono);
}

.stat-value {
  font-size: 26px;
  font-weight: 300;
  color: var(--black);
  line-height: 1;
  font-family: var(--mono);
  letter-spacing: -0.5px;
}

.stat-value.accent { color: var(--accent); }

/* ─── BADGES ─────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 500;
  font-family: var(--mono);
}

.badge-live    { background: var(--live-bg); color: var(--live); }
.badge-offline { background: var(--surface-2); color: var(--muted); }
.badge-yt      { background: #FEF2F2; color: var(--yt); }
.badge-web     { background: #EFF6FF; color: var(--web); }
.badge-accent  { background: var(--accent-soft); color: var(--accent); }

/* ─── TOAST ──────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--black);
  color: white;
  padding: 8px 16px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--mono);
  opacity: 0;
  transition: all 0.18s;
  pointer-events: none;
  z-index: 999;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── MODAL ──────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.2);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 26px;
  width: 420px;
  max-height: 80vh;
  overflow-y: auto;
  animation: modalIn 0.17s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.98) translateY(5px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-title { font-size: 15px; font-weight: 500; color: var(--black); margin-bottom: 4px; }
.modal-sub   { font-size: 12px; color: var(--muted); margin-bottom: 22px; }
.divider     { height: 1px; background: var(--border); margin: 18px 0; }

/* ─── ANIM ───────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.22s ease forwards; }
