:root {
  --tm-page-bg: #071426;
  --tm-page-text: #eaf4ff;
  --tm-muted: #9fb8d8;
  --tm-card: rgba(15, 31, 58, 0.74);
  --tm-card-strong: rgba(16, 34, 64, 0.96);
  --tm-border: rgba(148, 163, 184, 0.18);
  --tm-accent: #31d3ee;
  --tm-accent-2: #3487ff;
}

html.tm-theme-light {
  --tm-page-bg: #f5f8fc;
  --tm-page-text: #0f172a;
  --tm-muted: #526174;
  --tm-card: rgba(255, 255, 255, 0.92);
  --tm-card-strong: rgba(255, 255, 255, 0.98);
  --tm-border: rgba(15, 23, 42, 0.12);
  --tm-accent: #0284c7;
  --tm-accent-2: #2563eb;
  color-scheme: light;
}

html.tm-theme-dark { color-scheme: dark; }

body.tm-global-nav-enabled {
  background:
    radial-gradient(circle at 12% 4%, rgba(49, 211, 238, 0.10), transparent 28%),
    radial-gradient(circle at 92% 12%, rgba(52, 135, 255, 0.10), transparent 30%),
    var(--tm-page-bg) !important;
  color: var(--tm-page-text) !important;
}

body.tm-global-nav-enabled .fn-header,
body.tm-global-nav-enabled .tm-article-nav-wrap,
body.tm-global-nav-enabled .tm-articles-nav {
  display: none !important;
}

.tm-global-nav-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 20px 10px;
  position: relative;
  z-index: 50;
}

.tm-global-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--tm-border);
  border-radius: 24px;
  background: var(--tm-card-strong);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.18);
}

.tm-global-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 210px;
  text-decoration: none;
  color: var(--tm-page-text);
}

.tm-global-logo {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #31d3ee 0%, #3487ff 100%);
  color: #061322;
  font-weight: 950;
  font-size: 18px;
  box-shadow: 0 10px 30px rgba(49, 211, 238, 0.22);
}

.tm-global-brand-text strong {
  display: block;
  color: var(--tm-page-text);
  font-size: 16px;
  line-height: 1.1;
}

.tm-global-brand-text span {
  display: block;
  margin-top: 3px;
  color: var(--tm-muted);
  font-size: 12.5px;
  font-weight: 700;
}

.tm-global-menu {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
}

.tm-global-menu a {
  color: var(--tm-page-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 850;
  padding: 10px 12px;
  border-radius: 999px;
  opacity: 0.88;
}

.tm-global-menu a:hover,
.tm-global-menu a[aria-current="page"] {
  color: var(--tm-accent);
  background: rgba(49, 211, 238, 0.10);
  opacity: 1;
}

.tm-global-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 210px;
  position: relative;
}

.tm-theme-toggle,
.tm-global-bell {
  width: 42px;
  height: 42px;
  border: 1px solid var(--tm-border);
  border-radius: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--tm-card);
  color: var(--tm-page-text);
  cursor: pointer;
  position: relative;
}

html.tm-theme-light .tm-theme-icon-moon { display: none; }
html.tm-theme-dark .tm-theme-icon-sun { display: none; }

.tm-global-bell-count {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  border: 2px solid var(--tm-page-bg);
}

.tm-global-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 15px;
  border-radius: 15px;
  color: #ffffff !important;
  text-decoration: none;
  font-size: 14px;
  font-weight: 900;
  background: linear-gradient(135deg, #31d3ee 0%, #3487ff 100%);
}

.tm-global-bell-panel {
  display: none;
  position: absolute;
  right: 54px;
  top: 52px;
  width: min(330px, calc(100vw - 36px));
  border: 1px solid var(--tm-border);
  border-radius: 20px;
  background: var(--tm-card-strong);
  box-shadow: 0 28px 90px rgba(0,0,0,.28);
  overflow: hidden;
  z-index: 80;
}

.tm-global-bell-panel.is-open { display: block; }

.tm-global-bell-head {
  padding: 16px 16px 10px;
  border-bottom: 1px solid var(--tm-border);
}

.tm-global-bell-head strong {
  display: block;
  color: var(--tm-page-text);
  font-size: 15px;
}

.tm-global-bell-head span,
.tm-global-bell-empty {
  color: var(--tm-muted);
  font-size: 13px;
  line-height: 1.55;
}

.tm-global-bell-body { padding: 14px 16px 16px; }

.tm-global-bell-link {
  margin-top: 12px;
  display: inline-flex;
  width: 100%;
  justify-content: center;
  align-items: center;
  min-height: 40px;
  border-radius: 13px;
  background: rgba(49, 211, 238, 0.12);
  border: 1px solid rgba(49, 211, 238, 0.24);
  color: var(--tm-page-text);
  text-decoration: none;
  font-weight: 900;
  font-size: 13px;
}

html.tm-theme-light .card,
html.tm-theme-light .fn-card,
html.tm-theme-light .fn-tool,
html.tm-theme-light .fn-panel,
html.tm-theme-light .tm-articles-hero,
html.tm-theme-light .tm-article-card,
html.tm-theme-light .tm-bottom-cta-inner,
html.tm-theme-light .tm-article-shell,
html.tm-theme-light .tm-content-section,
html.tm-theme-light .tm-faq-item {
  background: var(--tm-card) !important;
  color: var(--tm-page-text) !important;
  border-color: var(--tm-border) !important;
}

html.tm-theme-light h1,
html.tm-theme-light h2,
html.tm-theme-light h3,
html.tm-theme-light strong {
  color: var(--tm-page-text) !important;
}

html.tm-theme-light p,
html.tm-theme-light li,
html.tm-theme-light .muted {
  color: var(--tm-muted) !important;
}

@media (max-width: 860px) {
  .tm-global-nav {
    align-items: flex-start;
    flex-direction: column;
  }
  .tm-global-menu {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .tm-global-actions {
    width: 100%;
    justify-content: flex-start;
    min-width: 0;
  }
  .tm-global-bell-panel {
    left: 0;
    right: auto;
    top: 52px;
  }
}

/* Dark-only final mode: hide theme toggle if any old cached markup remains */
.tm-theme-toggle {
  display: none !important;
}

html,
html.tm-theme-dark {
  color-scheme: dark;
}

html.tm-theme-light {
  color-scheme: dark;
}
