/* Channel Tracker visual system: structured data surfaces, clear blue actions. */
:root {
  --ct-bg: #f4f7fb;
  --ct-surface: #fff;
  --ct-surface-soft: #f8fafd;
  --ct-text: #17263d;
  --ct-muted: #53657d;
  --ct-subtle: #64748b;
  --ct-border: #dce5ef;
  --ct-blue: #2459c4;
  --ct-blue-dark: #17489f;
  --ct-blue-soft: #eaf1ff;
  --ct-green: #167347;
  --ct-red: #b84046;
  --ct-shadow: 0 8px 28px rgba(28, 51, 85, .055);
}

html { scroll-behavior: smooth; }
body { background: var(--ct-bg); color: var(--ct-text); line-height: 1.55; }
button, input, select, textarea { font-family: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid #84aafa; outline-offset: 3px;
}

body > header {
  min-height: 72px; padding: 12px max(24px, calc((100vw - 1240px) / 2));
  background: rgba(255,255,255,.97); border-bottom-color: var(--ct-border);
  box-shadow: 0 1px 0 rgba(22,49,86,.02);
}
.logo { font-size: 17px; color: var(--ct-text); letter-spacing: -.025em; }
.logo span { color: var(--ct-text); }
.logo-badge {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--ct-blue); box-shadow: none;
}
.primary-nav { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.primary-nav a {
  color: var(--ct-muted); text-decoration: none; font-size: 14px; font-weight: 700;
  padding: 9px 13px; border-radius: 9px;
}
.primary-nav a:hover, .primary-nav a[aria-current="page"] {
  color: var(--ct-blue-dark); background: var(--ct-blue-soft);
}
.header-spacer-left, .header-spacer-right { display: none; }
.search-wrap { width: min(400px, 30vw); margin-left: auto; }
.search-box, #sortSelect, #countryFilter, #categoryFilter, .text-input, .ai-textarea {
  min-height: 42px; color: var(--ct-text); border: 1px solid var(--ct-border);
  border-radius: 10px; background: var(--ct-surface); font-size: 14px;
}
.search-box::placeholder, .text-input::placeholder { color: #74839a; }
.search-icon { color: var(--ct-subtle); }
.search-dropdown { border: 1px solid var(--ct-border); border-radius: 12px; box-shadow: 0 18px 48px rgba(20,41,77,.15); }
.search-dropdown-label, .search-result-meta, .search-result-empty { color: var(--ct-muted); font-size: 12px; }
.search-result-item:hover { background: var(--ct-blue-soft); }
.search-result-name { font-size: 14px; }
.dropdown-add-btn, .add-from-search-btn { background: var(--ct-blue); box-shadow: none; border-radius: 9px; }
.account-actions { margin-left: 0; }
.account-button {
  color: var(--ct-blue-dark); border-color: var(--ct-border); border-radius: 9px;
  min-height: 38px; background: #fff;
}
.account-button:hover { background: var(--ct-blue-soft); }
.account-button.primary { background: var(--ct-blue); border-color: var(--ct-blue); }
.back-link { color: var(--ct-muted); font-size: 14px; font-weight: 650; }

.page, .page-wide { max-width: 1240px; padding: 32px 24px 72px; }
.section-eyebrow {
  color: var(--ct-blue); font-size: 11px; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase; margin-bottom: 6px;
}

/* Home overview and ranking */
.hero {
  color: var(--ct-text); background: linear-gradient(115deg, #ecf3ff 0%, #f8fbff 52%, #fff 100%);
  border: 1px solid #d8e5f6; border-radius: 18px; padding: 38px 42px;
  margin-bottom: 18px; box-shadow: var(--ct-shadow);
}
.hero::before, .hero::after { display: none; }
.hero-inner { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 46px; align-items: center; }
.hero-eyebrow { color: var(--ct-blue); font-size: 12px; opacity: 1; letter-spacing: .12em; }
.hero h1 { color: #12233e; font-size: clamp(30px, 3vw, 42px); line-height: 1.26; letter-spacing: -.045em; margin: 12px 0 14px; }
.hero p { color: var(--ct-muted); font-size: 15px; line-height: 1.7; margin: 0 0 24px; max-width: 550px; opacity: 1; }
.hero-actions { margin: 0; }
.cta-btn, .submit-btn, .collect-btn {
  min-height: 42px; background: var(--ct-blue); color: #fff; border: 1px solid var(--ct-blue);
  border-radius: 9px; box-shadow: none; font-size: 14px; font-weight: 750;
  padding: 10px 17px; transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.cta-btn:hover, .submit-btn:hover, .collect-btn:hover { background: var(--ct-blue-dark); border-color: var(--ct-blue-dark); box-shadow: none; }
.cta-btn.ghost { background: #fff; color: var(--ct-blue-dark); border: 1px solid #c5d6f2; box-shadow: none; }
.cta-btn.ghost:hover { background: var(--ct-blue-soft); }
.hero-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.hero-stat {
  background: #fff; border: 1px solid #dce6f3; border-radius: 12px;
  padding: 16px 18px; min-width: 0; backdrop-filter: none;
}
.hero-stat:first-child { grid-column: 1 / -1; padding: 20px 22px; }
.hero-stat .num { color: var(--ct-text); font-size: 22px; letter-spacing: -.035em; line-height: 1.25; }
.hero-stat:first-child .num { color: var(--ct-blue-dark); font-size: 30px; }
.hero-stat .label { color: var(--ct-muted); font-size: 12px; opacity: 1; margin-top: 5px; }
.update-note { color: var(--ct-muted); font-size: 13px; margin: 0 0 18px; }
.update-note .dot { background: #1e9966; box-shadow: 0 0 0 3px #e2f5ed; }
.ranking-card, .card, .chart-card, .tag-editor, .ch-identity-card, .channel-list {
  background: #fff; border: 1px solid var(--ct-border); border-radius: 14px; box-shadow: var(--ct-shadow);
}
.ranking-card { padding: 26px 28px; }
.ranking-header { margin-bottom: 17px; align-items: end; }
.ranking-header h2 { color: var(--ct-text); font-size: 21px; line-height: 1.25; letter-spacing: -.025em; }
.tabs, .range-tabs, .video-sort { background: #edf2f8; border-radius: 9px; }
.tab-btn, .range-tab-btn, .video-sort button { color: var(--ct-muted); font-size: 13px; min-height: 34px; }
.tab-btn.active, .range-tab-btn.active, .video-sort button.active {
  color: var(--ct-blue-dark); background: #fff; border-radius: 7px; box-shadow: 0 1px 3px rgba(28,51,85,.1);
}
.notice { color: var(--ct-muted); background: var(--ct-surface-soft); border-color: var(--ct-border); font-size: 13px; margin: 0 0 16px; }
.ranking-grid { gap: 0 30px; }
.rank-row { padding: 14px 10px; border-bottom-color: #e9eef4; }
.rank-row:hover { background: var(--ct-surface-soft); }
.rank-num { color: var(--ct-subtle); font-size: 16px; }
.rank-num.top3 { color: var(--ct-blue); }
.rank-avatar { width: 46px; height: 46px; box-shadow: none; border: 1px solid var(--ct-border); }
.rank-name { color: var(--ct-text); font-size: 15px; }
.rank-meta { color: var(--ct-muted); font-size: 12.5px; }
.rank-meta .hl { color: var(--ct-blue-dark); }
.site-footer, footer.site-footer, footer.site-footer a { color: var(--ct-muted); font-size: 12px; }

/* Searchable channel catalog */
.list-intro { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.list-intro h1 { font-size: 30px; letter-spacing: -.04em; margin: 0 0 3px; line-height: 1.3; }
.list-intro p { color: var(--ct-muted); font-size: 14px; margin: 0; }
.list-count { color: var(--ct-blue-dark); background: var(--ct-blue-soft); border: 1px solid #d8e5fb; border-radius: 8px; padding: 7px 11px; font-size: 13px; font-weight: 750; white-space: nowrap; }
.toolbar {
  background: #fff; border: 1px solid var(--ct-border); border-radius: 12px;
  padding: 14px; margin-bottom: 14px; gap: 10px; box-shadow: var(--ct-shadow);
}
.toolbar .search-box { width: min(320px, 100%); }
.toolbar select { min-height: 42px; padding: 9px 32px 9px 12px; border: 1px solid var(--ct-border); border-radius: 9px; color: var(--ct-text); background-color: #fff; font-size: 13px; }
.toolbar .tag-filters { order: 2; flex-basis: 100%; padding-top: 9px; border-top: 1px solid #edf1f6; }
.tag-chip { color: var(--ct-muted); border-color: var(--ct-border); border-radius: 8px; padding: 7px 12px; font-weight: 650; }
.tag-chip:hover { background: var(--ct-blue-soft); color: var(--ct-blue-dark); }
.tag-chip.active { background: var(--ct-blue); border-color: var(--ct-blue); box-shadow: none; color: #fff; }
.tag-chip.small, .tag-chip.removable { background: #eff4fb; color: #3c5878; border: 1px solid #e0e9f3; border-radius: 6px; font-size: 11.5px; padding: 3px 7px; }
.list-add { margin-left: auto; white-space: nowrap; }
.channel-list { overflow: hidden; }
.channel-item { padding: 17px 22px; gap: 16px; border-bottom-color: #e9eef4; }
.channel-item:hover { background: #f7faff; }
.avatar { width: 52px; height: 52px; box-shadow: none; border: 1px solid var(--ct-border); }
.channel-name { color: var(--ct-text); font-size: 15px; font-weight: 750; }
.channel-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.channel-meta { color: var(--ct-muted); font-size: 12.5px; }
.channel-stats { min-width: 235px; color: var(--ct-muted); font-size: 13px; }
.channel-stats .stat-row { gap: 24px; }
.channel-stats .stat-label { color: var(--ct-muted); }
.channel-stats .stat-value { color: var(--ct-text); font-weight: 700; }
.growth-up, .change-badge.up, .day-table .up { color: var(--ct-green) !important; }
.growth-down, .change-badge.down, .day-table .down { color: var(--ct-red) !important; }
.load-more-channels, .video-show-more { color: var(--ct-blue-dark); border-color: var(--ct-border); border-radius: 9px; }
.load-more-channels:hover, .video-show-more:hover { background: var(--ct-blue-soft); }
.empty, .video-empty { color: var(--ct-muted); font-size: 14px; }

/* Channel analytics */
.ch-identity-card { padding: 23px 26px; gap: 16px; }
.ch-identity-avatar { width: 70px; height: 70px; border-radius: 14px; box-shadow: none; border: 1px solid var(--ct-border); }
.ch-identity-name { color: var(--ct-text); font-size: 23px; letter-spacing: -.035em; }
.ch-identity-sub { color: var(--ct-muted); font-size: 13px; }
.ch-identity-visit, .video-more-link, .video-section-footer a, .description-toggle { color: var(--ct-blue-dark); font-size: 13px; }
.channel-classification { flex-basis: 100%; order: 3; color: var(--ct-muted); border-top: 1px solid #edf1f6; padding: 11px 0 0; }
.ch-identity-metrics { gap: 0; }
.identity-metric { min-width: 125px; padding: 0 20px; border-left: 1px solid var(--ct-border); }
.identity-metric .label { color: var(--ct-muted); font-size: 12px; }
.identity-metric .value { color: var(--ct-text); font-size: 20px; }
.ch-subnav { border: 0; border-bottom: 1px solid var(--ct-border); background: transparent; border-radius: 0; box-shadow: none; padding: 0; gap: 14px; }
.ch-subnav-btn { color: var(--ct-muted); border-radius: 0; font-size: 14px; padding: 11px 14px; }
.ch-subnav-btn.active { color: var(--ct-blue-dark); background: transparent; box-shadow: inset 0 -3px 0 var(--ct-blue); }
.ch-subnav-btn:hover { color: var(--ct-blue-dark); background: var(--ct-blue-soft); }
.analytics-grid { grid-template-columns: minmax(0, 1.75fr) minmax(280px, .8fr); gap: 16px; }
.analytics-main, .analytics-side { gap: 16px; }
.mini-stat-card { border: 1px solid var(--ct-border); border-radius: 12px; padding: 19px 21px; box-shadow: var(--ct-shadow); }
.mini-stat-card:hover { border-color: #a9c4ef; }
.mini-stat-card.active { border: 1px solid var(--ct-blue); box-shadow: inset 0 3px 0 var(--ct-blue), var(--ct-shadow); }
.mini-stat-label { color: var(--ct-muted); font-size: 12px; }
.mini-stat-value { color: var(--ct-text); font-size: 28px; letter-spacing: -.035em; }
.mini-stat-period { color: var(--ct-muted); font-size: 12px; }
.change-badge.up { background: #e8f5ee; }
.change-badge.down { background: #fff0f0; }
.chart-card { padding: 24px; }
.chart-title { color: var(--ct-text); font-size: 16px; letter-spacing: -.015em; }
.chart-view-toggle button { font-size: 15px; color: var(--ct-muted); }
.chart-view-toggle button.active { color: var(--ct-blue-dark); }
.chart-summary .big-number { color: var(--ct-text); font-size: 32px; letter-spacing: -.04em; }
.change-period, .video-section-note, .video-meta { color: var(--ct-muted); font-size: 12px; }
.growth-rate-box { background: var(--ct-surface-soft); border: 1px solid #edf1f6; }
.growth-rate-box .label { color: var(--ct-muted); }
.video-title { color: var(--ct-text); font-size: 13px; }
.recent-video .video-title { font-size: 12.5px; }
.recent-video .video-meta { font-size: 11.5px; }
.video-thumb { border-radius: 9px; }
.day-table th { color: var(--ct-muted); font-size: 12px; background: var(--ct-surface-soft); border-bottom-color: var(--ct-border); }
.day-table td { color: var(--ct-text); font-size: 13px; border-bottom-color: #e9eef4; }
.day-table td:nth-child(1), .day-table td:nth-child(2) { color: var(--ct-muted); }
.day-table tr:hover td { background: #f8fbff; }
.day-table tr.summary-row td { background: #edf3fc; }
.channel-description { color: var(--ct-text); font-size: 14px; }
.tag-editor { padding: 20px 24px; }

/* Legal and login-adjacent content */
.legal-page { max-width: 860px; padding-top: 40px; }
.legal-header h1 { color: var(--ct-text); font-size: 28px; }
.legal-header .legal-meta, .legal-toc a { color: var(--ct-muted); font-size: 13px; }
.legal-card { border-color: var(--ct-border); border-radius: 14px; box-shadow: var(--ct-shadow); padding: 36px; }
.legal-card h2 { color: var(--ct-text); font-size: 17px; }
.legal-card h2 .num, .legal-card a { color: var(--ct-blue-dark); }
.legal-card p, .legal-card li { color: #34465e; font-size: 14px; }
.legal-note { color: var(--ct-muted); border-color: var(--ct-border); }
.access-page { max-width: 640px; padding-top: clamp(40px, 10vh, 100px); }
.access-card { background: #fff; border: 1px solid var(--ct-border); border-radius: 14px; box-shadow: var(--ct-shadow); padding: 36px; }
.access-card h1 { font-size: 28px; letter-spacing: -.035em; margin: 0 0 8px; }
.access-card p { color: var(--ct-muted); font-size: 14px; line-height: 1.7; margin: 0 0 24px; }
.access-card .cta-btn { width: 100%; justify-content: center; }
.access-back { display: block; text-align: center; color: var(--ct-muted); margin-top: 18px; font-size: 13px; text-decoration: none; }
.access-back:hover { color: var(--ct-blue-dark); text-decoration: underline; }

@media (max-width: 1040px) {
  body > header { padding-inline: 24px; }
  .hero-inner { grid-template-columns: minmax(0,1fr) minmax(260px,.7fr); gap: 22px; }
  .ch-identity-metrics { flex-basis: 100%; justify-content: space-between; order: 2; }
  .identity-metric { flex: 1; text-align: left; padding: 10px 16px 0; }
  .identity-metric:first-child { padding-left: 0; border-left: 0; }
  .channel-classification { order: 3; }
}
@media (max-width: 880px) {
  .analytics-grid { grid-template-columns: 1fr; }
  .analytics-side { display: block; }
}
@media (max-width: 720px) {
  body > header { flex-wrap: wrap; gap: 10px; min-height: 62px; padding: 10px 16px; }
  .primary-nav { order: 3; width: 100%; border-top: 1px solid #edf1f6; padding-top: 6px; }
  .primary-nav a { font-size: 13px; }
  .search-wrap { order: 4; flex: 1 1 100%; width: 100%; margin: 0; }
  .account-actions { margin-left: auto; }
  .page, .page-wide { padding: 24px 16px 60px; }
  .hero { padding: 26px 22px; }
  .hero-inner { grid-template-columns: 1fr; gap: 24px; }
  .hero h1 { font-size: 31px; }
  .hero-stats { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .hero-stat:first-child { grid-column: auto; padding: 16px; }
  .hero-stat:first-child .num { font-size: 22px; }
  .hero-stat { padding: 16px; }
  .ranking-card { padding: 20px 18px; }
  .ranking-header { align-items: start; }
  .ranking-grid { grid-template-columns: 1fr; }
  .list-intro { align-items: start; flex-direction: column; gap: 10px; }
  .toolbar .tag-filters { overflow-x: auto; flex-wrap: nowrap; }
  .toolbar .tag-chip { white-space: nowrap; }
  .channel-stats { min-width: 178px; }
}
@media (max-width: 560px) {
  .hero h1 { font-size: 28px; }
  .hero-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .hero-stat:first-child { grid-column: 1 / -1; }
  .ranking-header { display: block; }
  .ranking-header .tabs { margin-top: 16px; overflow-x: auto; }
  .tab-btn { white-space: nowrap; }
  .toolbar .search-box { width: calc(100% - 28px); flex: 1; }
  .toolbar select { flex: 1 1 calc(50% - 6px); min-width: 0; }
  .list-add { order: 1; width: 100%; justify-content: center; }
  .toolbar .tag-filters { order: 2; }
  .channel-item { display: grid; grid-template-columns: 52px minmax(0,1fr); gap: 10px 12px; padding: 16px; }
  .channel-stats { grid-column: 2; width: 100%; min-width: 0; text-align: left; border-top: 1px solid #edf1f6; padding-top: 8px; }
  .channel-stats .stat-row { padding: 3px 0; }
  .ch-identity-card { padding: 18px; }
  .ch-identity-name { font-size: 20px; }
  .ch-identity-avatar { width: 58px; height: 58px; }
  .ch-identity-metrics { gap: 0; }
  .identity-metric { min-width: 0; padding: 8px; }
  .identity-metric .value { font-size: 15px; }
  .identity-metric .label { font-size: 11px; }
  .chart-card { padding: 18px; }
  .chart-toggle-row { align-items: start; }
  .range-tabs { max-width: 100%; overflow-x: auto; }
  .range-tab-btn { white-space: nowrap; }
  .mini-stat-value { font-size: 23px; }
  .legal-card { padding: 24px 20px; }
  .access-card { padding: 26px 22px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
