:root {
  --bg: #0c0d0f;
  --surface: #121417;
  --surface-2: #17191d;
  --surface-3: #1d2024;
  --line: rgba(255,255,255,.085);
  --line-strong: rgba(255,255,255,.14);
  --text: #f4f4f1;
  --muted: #9a9da3;
  --faint: #666b73;
  --coral: #ff6268;
  --coral-2: #ff444d;
  --coral-soft: rgba(255, 86, 94, .13);
  --gold: #e3b85a;
  --gold-soft: rgba(227,184,90,.14);
  --green: #55d890;
  --red: #ff6b70;
  --shadow: 0 18px 54px rgba(0,0,0,.28);
  --radius: 18px;
  --sidebar: 242px;
}
* { box-sizing: border-box; }
html { background: var(--bg); color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 76% -20%, rgba(255,92,99,.08), transparent 34%),
    var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button,input,select,textarea { font: inherit; }
button,a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: .14em;
  font-weight: 800;
  color: var(--coral);
}
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar);
  display: flex; flex-direction: column;
  padding: 24px 14px 18px;
  background: rgba(13,14,16,.92);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
  z-index: 50;
}
.brand { display:flex; align-items:center; gap:12px; padding: 8px 10px 24px; }
.brand-mark {
  width: 48px; height: 40px; border-radius: 13px;
  background: linear-gradient(145deg, #ff545c, #e92d38);
  display:grid; place-items:center; box-shadow: 0 12px 32px rgba(255,70,80,.2);
}
.brand-mark svg { width: 31px; height: 31px; }
.brand-mark rect { fill: transparent; }
.brand-mark path { fill: white; }
.brand-mark.small { width:34px; height:30px; border-radius:10px; }
.brand-mark.small svg { width:24px; }
.brand-name { font-size: 20px; font-weight: 820; letter-spacing: -.03em; }
.brand-sub { color: var(--muted); font-size: 12px; margin-top:2px; }
.nav-list { display:flex; flex-direction:column; gap:5px; }
.nav-item {
  width:100%; border:0; background:transparent; color:#d7d8db;
  min-height:44px; border-radius:12px; padding:0 13px;
  display:flex; align-items:center; gap:13px; text-align:left;
  cursor:pointer; font-weight:650;
}
.nav-item span { width:21px; text-align:center; color:#aeb1b7; font-size:18px; }
.nav-item:hover { background: rgba(255,255,255,.045); }
.nav-item.active { background: linear-gradient(90deg, rgba(255,87,94,.2), rgba(255,87,94,.11)); color:#fff; }
.nav-item.active span { color:var(--coral); }
.sidebar-footer { margin-top:auto; padding:14px 7px 0; border-top:1px solid var(--line); }
.channel-mini { display:flex; gap:10px; align-items:center; padding:4px 3px 12px; }
.avatar { width:42px; height:42px; border-radius:50%; object-fit:cover; background:#25282d; border:1px solid var(--line); }
.channel-mini-text { min-width:0; display:flex; flex-direction:column; gap:3px; }
.channel-mini-text strong { font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.channel-mini-text span { font-size:11px; color:var(--muted); }
.connection-row { display:flex; align-items:flex-start; gap:10px; margin-top:15px; padding:13px 4px 2px; border-top:1px solid var(--line); }
.connection-dot { width:9px; height:9px; border-radius:50%; margin-top:4px; background:var(--green); box-shadow:0 0 0 4px rgba(85,216,144,.08); }
.connection-dot.demo { background:var(--gold); box-shadow:0 0 0 4px rgba(227,184,90,.08); }
.connection-row div { display:flex; flex-direction:column; gap:3px; }
.connection-row strong { font-size:12px; }
.connection-row span { font-size:10px; color:var(--muted); }

.main { margin-left:var(--sidebar); min-height:100vh; padding: 76px 24px 42px; }
.topbar {
  position:fixed; top:0; right:0; left:var(--sidebar); height:64px;
  z-index:40; display:flex; align-items:center; gap:16px;
  padding:0 28px; border-bottom:1px solid var(--line);
  background:rgba(12,13,15,.78); backdrop-filter: blur(18px);
}
.mobile-brand { display:none; align-items:center; gap:9px; }
.search-wrap {
  width:min(420px, 48vw); height:40px; border:1px solid var(--line);
  border-radius:12px; display:flex; align-items:center; gap:9px;
  padding:0 13px; background:rgba(255,255,255,.035); color:var(--muted);
}
.search-wrap input { width:100%; border:0; outline:0; background:transparent; color:var(--text); }
.search-wrap input::placeholder { color:#747880; }
.top-actions { margin-left:auto; display:flex; align-items:center; gap:10px; }
.profile-compact { display:flex; align-items:center; gap:9px; margin-left:3px; }
.small-avatar { width:34px; height:34px; }
.profile-copy { display:flex; flex-direction:column; gap:1px; min-width:120px; }
.profile-copy strong { font-size:12px; }
.profile-copy span { font-size:10px; color:var(--muted); }

.page { display:none; max-width:1500px; margin:0 auto; animation: fadeIn .18s ease-out; }
.page.active { display:block; }
@keyframes fadeIn { from{opacity:.25; transform:translateY(3px)} to{opacity:1; transform:none} }
.page-head { display:flex; justify-content:space-between; align-items:flex-start; gap:18px; margin: 12px 2px 22px; }
.page-head h1 { margin:0; font-size:30px; letter-spacing:-.035em; line-height:1.1; }
.page-head p:not(.eyebrow) { margin:8px 0 0; font-size:13px; }
.page-head-actions { display:flex; align-items:center; gap:10px; }
.mode-badge, .status-pill {
  display:inline-flex; align-items:center; border:1px solid rgba(227,184,90,.26);
  background:var(--gold-soft); color:#f0ca7c; border-radius:999px;
  font-size:10px; font-weight:800; letter-spacing:.08em; padding:8px 10px;
}

.metric-grid { display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:14px; margin-bottom:14px; }
.metric-card {
  min-height:124px; display:flex; align-items:center; gap:16px; padding:18px;
  background:linear-gradient(145deg, rgba(255,255,255,.045), rgba(255,255,255,.022));
  border:1px solid var(--line); border-radius:var(--radius); box-shadow:0 12px 40px rgba(0,0,0,.09);
}
.metric-card.accent { background:linear-gradient(145deg, rgba(255,86,94,.12), rgba(255,255,255,.02)); }
.metric-icon {
  width:48px; height:48px; flex:0 0 48px; display:grid; place-items:center;
  border-radius:14px; color:#ff8990; background:var(--coral-soft); font-size:21px; font-weight:900;
}
.metric-icon.gold { color:#f2cf7d; background:var(--gold-soft); }
.metric-icon.coral { color:#ff888d; }
.metric-icon.neutral { color:#d7d7d1; background:rgba(255,255,255,.07); }
.metric-card div:last-child { min-width:0; display:flex; flex-direction:column; }
.metric-card span { color:#c1c3c7; font-size:12px; }
.metric-card strong { margin-top:7px; font-size:26px; line-height:1; letter-spacing:-.035em; }
.metric-card small { margin-top:10px; color:var(--muted); font-size:10px; }
.trend-up { color:var(--green)!important; }
.trend-down { color:var(--red)!important; }

.dashboard-grid { display:grid; grid-template-columns:minmax(0, 2.1fr) minmax(310px,.95fr); gap:14px; }
.panel {
  background:linear-gradient(150deg, rgba(255,255,255,.037), rgba(255,255,255,.018));
  border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow);
}
.chart-panel { min-height:340px; padding:18px 18px 10px; }
.top-videos-panel { padding:18px; }
.latest-panel { padding:18px; }
.comments-panel { padding:18px; }
.panel-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:14px; }
.panel-head h2 { margin:0; font-size:15px; letter-spacing:-.01em; }
.panel-head p { margin:5px 0 0; font-size:10px; }
.panel-total { display:flex; align-items:center; gap:8px; }
.panel-total strong { font-size:12px; }
.panel-total span { color:var(--green); font-size:11px; font-weight:800; }
.chart { height:270px; width:100%; position:relative; overflow:hidden; }
.chart.large { height:360px; }
.chart svg { width:100%; height:100%; overflow:visible; }
.chart-grid-line { stroke:rgba(255,255,255,.065); stroke-width:1; }
.chart-axis-label { fill:#787c83; font-size:10px; }
.chart-line { fill:none; stroke:var(--coral); stroke-width:2.5; stroke-linecap:round; stroke-linejoin:round; }
.chart-area { fill:url(#areaGradient); opacity:.9; }
.chart-dot { fill:var(--coral); stroke:#fff; stroke-width:2; }
.chart-empty { height:100%; display:grid; place-items:center; color:var(--muted); font-size:12px; }

.mini-video-list { display:flex; flex-direction:column; gap:10px; }
.mini-video { display:grid; grid-template-columns:76px minmax(0,1fr) auto; gap:10px; align-items:center; }
.thumb { width:76px; aspect-ratio:16/9; object-fit:cover; border-radius:9px; background:#25282c; }
.mini-video-copy { min-width:0; }
.mini-video-copy strong { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; font-size:11px; line-height:1.35; }
.mini-video-copy span { display:block; margin-top:4px; color:var(--muted); font-size:10px; }
.spark { display:flex; align-items:flex-end; gap:2px; height:28px; }
.spark i { width:3px; border-radius:3px; background:linear-gradient(#ff737a,#b83840); opacity:.9; }

.video-table { display:flex; flex-direction:column; }
.video-row {
  display:grid; grid-template-columns:112px minmax(180px,1.6fr) 110px 90px 90px 90px 44px;
  gap:12px; align-items:center; min-height:78px; padding:10px 4px;
  border-bottom:1px solid rgba(255,255,255,.055);
}
.video-table.compact .video-row {
  grid-template-columns:90px minmax(160px,1.7fr) 82px 70px 70px 34px;
  min-height:65px;
}
.video-row:last-child { border-bottom:0; }
.video-row .thumb { width:100%; max-width:112px; }
.video-table.compact .thumb { max-width:90px; }
.video-title { min-width:0; }
.video-title strong { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-size:12px; }
.video-title span { display:block; margin-top:5px; color:var(--muted); font-size:10px; }
.table-stat { color:#c5c7cb; font-size:11px; white-space:nowrap; }
.visibility {
  width:max-content; padding:5px 8px; border-radius:999px; font-size:9px; text-transform:capitalize;
  color:#ff9ba0; background:rgba(255,85,94,.09); border:1px solid rgba(255,85,94,.13);
}
.more-btn,.icon-btn {
  border:1px solid var(--line); background:rgba(255,255,255,.035); cursor:pointer;
  border-radius:10px; min-width:36px; height:36px; display:grid; place-items:center;
}
.more-btn { border:0; background:transparent; color:var(--muted); }
.icon-btn:hover,.more-btn:hover { background:rgba(255,255,255,.075); }
.text-btn {
  border:0; background:transparent; color:#ff858b; cursor:pointer; font-size:10px; font-weight:750; padding:4px;
}
.primary-btn,.secondary-btn,.danger-btn,.ghost-btn {
  min-height:38px; display:inline-flex; align-items:center; justify-content:center;
  padding:0 14px; border-radius:11px; border:1px solid transparent;
  cursor:pointer; font-weight:750; font-size:11px;
}
.primary-btn { background:linear-gradient(135deg,var(--coral),var(--coral-2)); color:white; box-shadow:0 10px 28px rgba(255,75,84,.15); }
.secondary-btn { background:rgba(255,255,255,.045); border-color:var(--line); color:#e4e5e7; }
.ghost-btn { background:transparent; border-color:var(--line); }
.danger-btn { background:rgba(255,70,79,.08); border-color:rgba(255,70,79,.18); color:#ff858c; }
.full { width:100%; }
.centered { text-align:center; }
.select,.field {
  min-height:39px; padding:0 12px; border-radius:11px; border:1px solid var(--line);
  background:#15171a; color:var(--text); outline:none;
}
.select:focus,.field:focus,.search-wrap:focus-within { border-color:rgba(255,98,104,.48); box-shadow:0 0 0 3px rgba(255,98,104,.07); }
.textarea { min-height:130px; padding:11px 12px; resize:vertical; }
.table-toolbar { display:flex; gap:10px; padding:14px; border-bottom:1px solid var(--line); }
.table-toolbar .field { flex:1; }

.comment-list { display:flex; flex-direction:column; }
.comment-item {
  display:grid; grid-template-columns:42px minmax(0,1fr) auto; gap:12px;
  padding:13px 4px; border-bottom:1px solid rgba(255,255,255,.055);
}
.comment-item:last-child { border-bottom:0; }
.comment-avatar { width:36px; height:36px; border-radius:50%; object-fit:cover; background:#26292d; }
.comment-copy { min-width:0; }
.comment-meta { display:flex; gap:7px; align-items:center; flex-wrap:wrap; }
.comment-meta strong { font-size:11px; }
.comment-meta span { font-size:9px; color:var(--muted); }
.comment-copy p { margin:5px 0 0; color:#e1e2e4; font-size:12px; line-height:1.45; }
.comment-actions { margin-top:9px; display:flex; gap:8px; align-items:center; }
.reply-box { display:flex; gap:8px; width:100%; margin-top:9px; }
.reply-box input { flex:1; min-width:0; }
.comment-video-thumb { width:52px; aspect-ratio:16/9; border-radius:7px; object-fit:cover; align-self:center; }
.comment-list.compact .comment-item { grid-template-columns:36px minmax(0,1fr) 46px; padding:10px 0; }
.comment-list.compact .comment-avatar { width:31px; height:31px; }

.playlist-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
.playlist-card { overflow:hidden; }
.playlist-cover { position:relative; aspect-ratio:16/9; background:#23262b; overflow:hidden; }
.playlist-cover img { width:100%; height:100%; object-fit:cover; }
.playlist-count { position:absolute; right:9px; bottom:9px; background:rgba(0,0,0,.72); border:1px solid rgba(255,255,255,.15); padding:5px 7px; border-radius:7px; font-size:9px; }
.playlist-body { padding:14px; }
.playlist-body h3 { margin:0; font-size:13px; }
.playlist-body p { margin:6px 0 0; font-size:10px; color:var(--muted); }

.analytics-grid { display:grid; grid-template-columns:minmax(0,2fr) minmax(300px,.85fr); gap:14px; }
.analytics-grid .panel { padding:18px; }
.channel-profile { padding:24px; }
.channel-hero { display:flex; align-items:center; gap:18px; }
.channel-hero .avatar { width:82px; height:82px; }
.channel-hero h2 { margin:0; font-size:24px; }
.channel-hero p { margin:6px 0 0; color:var(--muted); font-size:12px; }
.channel-stats { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin-top:24px; }
.channel-stat { background:rgba(255,255,255,.03); border:1px solid var(--line); border-radius:13px; padding:14px; }
.channel-stat span { color:var(--muted); font-size:10px; }
.channel-stat strong { display:block; margin-top:6px; font-size:18px; }

.settings-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.setting-card { padding:20px; display:flex; gap:15px; }
.setting-icon { flex:0 0 44px; width:44px; height:44px; border-radius:13px; display:grid; place-items:center; background:var(--coral-soft); color:#ff858b; font-size:18px; }
.setting-main h2 { margin:2px 0 0; font-size:15px; }
.setting-main p { margin:7px 0 13px; font-size:11px; line-height:1.55; }
.setting-actions { display:flex; gap:8px; flex-wrap:wrap; }

.app-footer { display:flex; justify-content:space-between; gap:15px; margin:30px 2px 0; color:var(--faint); font-size:9px; }

.bottom-nav { display:none; }
.toast {
  position:fixed; z-index:120; left:50%; bottom:28px; transform:translate(-50%,14px);
  background:#22252a; border:1px solid var(--line-strong); color:white;
  border-radius:12px; padding:11px 14px; font-size:11px; box-shadow:var(--shadow);
  opacity:0; pointer-events:none; transition:.2s ease;
}
.toast.show { opacity:1; transform:translate(-50%,0); }

.login-overlay { position:fixed; inset:0; z-index:200; display:grid; place-items:center; padding:22px; background:rgba(8,9,10,.94); backdrop-filter:blur(20px); }
.login-card { width:min(390px,100%); border:1px solid var(--line); border-radius:24px; padding:30px; background:#121417; box-shadow:var(--shadow); text-align:center; }
.brand-mark-large { margin:0 auto 22px; width:62px; height:52px; }
.login-card h1 { margin:0; font-size:28px; }
.login-copy { font-size:12px; }
.login-form { display:flex; flex-direction:column; gap:10px; margin-top:20px; }
.login-form input { min-height:46px; border:1px solid var(--line); border-radius:12px; background:#0f1113; padding:0 13px; color:white; outline:none; }
.error-text { min-height:16px; color:#ff777e; font-size:10px; }

.modal {
  width:min(760px, calc(100vw - 30px)); padding:0; border:1px solid var(--line-strong); border-radius:20px;
  background:#121417; color:var(--text); box-shadow:0 34px 100px rgba(0,0,0,.5);
}
.modal::backdrop { background:rgba(0,0,0,.7); backdrop-filter:blur(8px); }
.modal-shell { margin:0; }
.modal-head { padding:18px 20px; display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid var(--line); }
.modal-head h2 { margin:0; font-size:18px; }
.modal-body { padding:20px; display:flex; flex-direction:column; gap:15px; }
.video-detail-top { display:grid; grid-template-columns:minmax(220px,1.3fr) 1fr; gap:16px; }
.detail-thumb { width:100%; aspect-ratio:16/9; object-fit:cover; border-radius:14px; background:#202328; }
.detail-stats { display:grid; grid-template-columns:1fr; gap:8px; }
.detail-stats div { padding:12px; border-radius:12px; border:1px solid var(--line); background:rgba(255,255,255,.025); }
.detail-stats span { font-size:10px; color:var(--muted); }
.detail-stats strong { display:block; margin-top:5px; font-size:18px; }
.modal-body label { display:flex; flex-direction:column; gap:7px; font-size:10px; color:var(--muted); }
.modal-actions { padding:16px 20px; display:flex; justify-content:flex-end; gap:9px; border-top:1px solid var(--line); }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns:repeat(2,1fr); }
  .dashboard-grid { grid-template-columns:1fr; }
  .top-videos-panel { order:2; }
  .latest-panel { order:3; }
  .comments-panel { order:4; }
  .mini-video-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .analytics-grid { grid-template-columns:1fr; }
  .video-row { grid-template-columns:96px minmax(180px,1.7fr) 90px 78px 78px 42px; }
  .video-row > :nth-child(6) { display:none; }
}
@media (max-width: 820px) {
  :root { --sidebar:0px; }
  .sidebar { display:none; }
  .main { margin-left:0; padding:68px 14px calc(94px + env(safe-area-inset-bottom)); }
  .topbar { left:0; height:58px; padding:0 14px; }
  .mobile-brand { display:flex; }
  .search-wrap { display:none; }
  .profile-compact { display:none; }
  .top-actions { margin-left:auto; }
  .page-head { margin-top:10px; flex-direction:column; }
  .page-head h1 { font-size:25px; }
  .page-head-actions { width:100%; justify-content:space-between; }
  .metric-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .metric-card { min-height:106px; padding:14px; gap:11px; }
  .metric-icon { width:40px; height:40px; flex-basis:40px; }
  .metric-card strong { font-size:21px; }
  .dashboard-grid { gap:10px; }
  .panel { border-radius:15px; }
  .chart-panel,.top-videos-panel,.latest-panel,.comments-panel { padding:14px; }
  .chart { height:225px; }
  .chart.large { height:260px; }
  .mini-video-list { display:flex; }
  .video-row,.video-table.compact .video-row {
    grid-template-columns:86px minmax(0,1fr) 62px 34px;
    gap:9px; min-height:70px;
  }
  .video-row > :nth-child(3),
  .video-row > :nth-child(5),
  .video-row > :nth-child(6) { display:none; }
  .video-title strong { white-space:normal; display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; }
  .playlist-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .settings-grid { grid-template-columns:1fr; gap:10px; }
  .channel-stats { grid-template-columns:repeat(2,1fr); }
  .bottom-nav {
    position:fixed; z-index:70; display:grid; grid-template-columns:repeat(5,1fr);
    left:0; right:0; bottom:0; height:calc(66px + env(safe-area-inset-bottom));
    padding:6px 7px env(safe-area-inset-bottom);
    background:rgba(16,17,19,.94); border-top:1px solid var(--line); backdrop-filter:blur(20px);
  }
  .bottom-item {
    border:0; background:transparent; color:#8d9198; border-radius:11px; cursor:pointer;
    display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px;
  }
  .bottom-item span { font-size:18px; line-height:1; }
  .bottom-item small { font-size:8px; }
  .bottom-item.active { color:var(--coral); background:rgba(255,92,99,.07); }
  .app-footer { display:none; }
  .toast { bottom:84px; max-width:calc(100vw - 32px); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
}
@media (max-width: 520px) {
  .metric-grid { grid-template-columns:1fr 1fr; }
  .metric-card { align-items:flex-start; flex-direction:column; min-height:130px; }
  .metric-card small { margin-top:7px; }
  .mini-video { grid-template-columns:70px minmax(0,1fr) auto; }
  .thumb { width:70px; }
  .playlist-grid { grid-template-columns:1fr; }
  .channel-hero { align-items:flex-start; }
  .channel-hero .avatar { width:66px; height:66px; }
  .video-detail-top { grid-template-columns:1fr; }
  .detail-stats { grid-template-columns:repeat(3,1fr); }
  .modal-actions { flex-direction:column; }
  .modal-actions > * { width:100%; }
  .table-toolbar { flex-direction:column; }
}
