:root {
  color-scheme: dark;
  --bg: #050505;
  --bg-soft: #0b0d10;
  --card: #101215;
  --card-2: #171b20;
  --border: #161a1f;
  --text: #f2f4f7;
  --muted: #98a2b3;
  --accent-gold: #d4af37;
  --accent-gold-dark: #b9902e;
  --accent-teal: #2fa7b3;
  --accent-blue: #4ea1ff;
  --positive: #3fbf7f;
  --negative: #e05a5a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(circle at top, #14181d 0%, #070809 46%, #040404 100%);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

.landing-body {
  min-height: 100vh;
  overflow: auto;
  font-family: "DM Sans", Segoe UI, sans-serif;
  background:
    radial-gradient(ellipse 90% 55% at 12% -10%, rgba(212, 175, 55, 0.14), transparent 55%),
    radial-gradient(ellipse 70% 45% at 90% 8%, rgba(47, 167, 179, 0.12), transparent 50%),
    radial-gradient(circle at top, #14181d 0%, #070809 46%, #040404 100%);
}

.landing-shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 18px 16px 36px;
  display: grid;
  gap: 16px;
}

.landing-topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 10px;
  z-index: 40;
  backdrop-filter: blur(10px);
}

.landing-home .landing-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 18px;
  align-items: end;
  min-height: min(72vh, 640px);
  padding: 28px 24px 24px;
  border: 1px solid rgba(176, 188, 202, 0.18);
  border-radius: 14px;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(20, 24, 30, 0.92), rgba(8, 10, 13, 0.96)),
    radial-gradient(circle at 80% 20%, rgba(47, 167, 179, 0.12), transparent 45%);
}

.landing-brand {
  margin: 0 0 10px;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  line-height: 0.95;
  color: var(--accent-gold);
  letter-spacing: 0.01em;
}

.landing-hero-copy h1 {
  margin: 0 0 12px;
  font-size: clamp(1.35rem, 2.4vw, 1.95rem);
  font-weight: 600;
  line-height: 1.25;
  max-width: 18ch;
}

.landing-lead {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.55;
  max-width: 36ch;
}

.landing-hero-visual {
  position: relative;
  align-self: stretch;
  min-height: 280px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(176, 188, 202, 0.22);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45);
  animation: heroFloat 7s ease-in-out infinite;
}

.landing-hero-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
  display: block;
  transform: scale(1.02);
}

.landing-hero-glow {
  position: absolute;
  inset: auto -10% -20% -10%;
  height: 45%;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.22), transparent 70%);
  pointer-events: none;
}

.section-kicker {
  margin: 0 0 6px;
  color: var(--accent-teal);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
}

.landing-home h2 {
  margin: 0 0 10px;
  font-size: clamp(1.35rem, 2.2vw, 1.85rem);
  font-weight: 650;
}

.landing-home h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.section-head {
  margin-bottom: 10px;
}

.landing-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.feature-card {
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
  transform: translateY(-3px);
  border-color: rgba(212, 175, 55, 0.4);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.feature-card-signal {
  border-color: rgba(212, 175, 55, 0.45);
  background:
    linear-gradient(160deg, rgba(212, 175, 55, 0.12), transparent 55%),
    linear-gradient(180deg, var(--card) 0%, #0a0c0f 100%);
}

.feature-tag {
  margin: 0 0 8px;
  color: var(--accent-gold);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.feature-card-signal .feature-tag {
  color: var(--accent-gold);
}

.exclusive-feature {
  border-color: rgba(212, 175, 55, 0.42);
  background:
    linear-gradient(145deg, rgba(212, 175, 55, 0.14), transparent 50%),
    linear-gradient(180deg, var(--card) 0%, #0a0c0f 100%);
}

.exclusive-bullets {
  margin: 12px 0 4px;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.exclusive-bullets li {
  line-height: 1.45;
}

.landing-steps-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.step-card {
  padding: 14px;
  border-radius: 10px;
  border: 1px solid rgba(176, 188, 202, 0.18);
  background: rgba(8, 11, 15, 0.55);
  display: grid;
  gap: 6px;
}

.step-num {
  color: var(--accent-gold);
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 1.4rem;
  line-height: 1;
}

.step-card p {
  margin: 0;
}

.landing-topnav-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.landing-topnav-links a {
  color: var(--muted);
  text-decoration: none;
  border: 1px solid rgba(176, 188, 202, 0.35);
  border-radius: 999px;
  padding: 4px 10px;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.landing-topnav-links a:hover {
  color: #f5f7fb;
  border-color: rgba(212, 175, 55, 0.75);
  background: rgba(212, 175, 55, 0.12);
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.22);
}

.landing-topnav-links a.nav-cta {
  color: #fff8e8;
  border-color: rgba(212, 175, 55, 0.7);
  background: rgba(212, 175, 55, 0.16);
}

.nav-toggle {
  display: none;
  border: 1px solid rgba(176, 188, 202, 0.35);
  border-radius: 8px;
  background: rgba(15, 19, 24, 0.9);
  color: var(--text);
  padding: 6px 10px;
  cursor: pointer;
}

.landing-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 4px 0;
  border-top: 1px solid rgba(176, 188, 202, 0.12);
  margin-top: 4px;
}

.landing-footer-brand {
  display: grid;
  gap: 2px;
}

.landing-footer-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.landing-footer-links a {
  color: var(--muted);
  text-decoration: none;
}

.landing-footer-links a:hover {
  color: #ffe08a;
}

.landing-hero-visual img.hero-float {
  animation: heroFloat 7s ease-in-out infinite;
}

@keyframes heroFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .landing-hero-visual,
  .landing-hero-visual img.hero-float {
    animation: none;
  }
}

@media (max-width: 980px) {
  .landing-home .landing-hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .landing-hero-copy h1 {
    max-width: none;
  }

  .landing-grid-4,
  .landing-steps-row {
    grid-template-columns: 1fr;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .landing-topnav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    margin-top: 8px;
  }

  .landing-topnav-links.is-open {
    display: flex;
  }

  .landing-topnav {
    flex-wrap: wrap;
  }
}

.landing-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.landing-kicker {
  margin: 0 0 6px;
  color: var(--accent-gold);
  letter-spacing: 0.08em;
  font-weight: 700;
}

.landing-cta-row {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.landing-btn {
  text-decoration: none;
  border-radius: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(176, 188, 202, 0.35);
  color: var(--text);
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.landing-btn:hover {
  color: #ffffff;
  border-color: rgba(212, 175, 55, 0.7);
  background: rgba(212, 175, 55, 0.14);
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.2);
  transform: translateY(-1px);
}

.landing-btn.primary {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.3), rgba(47, 167, 179, 0.18));
  border-color: rgba(212, 175, 55, 0.68);
}

.landing-btn.primary:hover {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.42), rgba(47, 167, 179, 0.28));
  border-color: rgba(212, 175, 55, 0.9);
}

.pricing-card .landing-btn,
.pricing-card button.landing-btn {
  display: inline-flex;
  margin-top: 8px;
  cursor: pointer;
  font: inherit;
}

.pricing-card .landing-btn[disabled],
.pricing-card button.landing-btn:disabled {
  opacity: 0.55;
  pointer-events: none;
}

.landing-body a.brand-link,
.landing-body .auth-switch a,
.landing-body .logged-in-tip a,
.landing-body .guide-item summary {
  transition: color 0.18s ease, text-shadow 0.18s ease;
}

.landing-body a.brand-link:hover,
.landing-body .auth-switch a:hover,
.landing-body .logged-in-tip a:hover {
  color: #ffe08a;
  text-shadow: 0 0 12px rgba(212, 175, 55, 0.45);
}

.guide-item summary:hover {
  color: #ffe08a;
  background: rgba(212, 175, 55, 0.06);
}

/* Solo pagine login/prezzi: Login e Registrati con hover blu */
.auth-page a.auth-cta,
.auth-page button.auth-cta,
.auth-page .landing-topnav-links a.auth-cta {
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.auth-page a.auth-cta:hover,
.auth-page button.auth-cta:hover,
.auth-page .landing-topnav-links a.auth-cta:hover {
  color: #eaf4ff;
  border-color: rgba(78, 161, 255, 0.95);
  background: rgba(78, 161, 255, 0.22);
  box-shadow: 0 0 18px rgba(78, 161, 255, 0.45);
  text-shadow: none;
}

.auth-page #loginSubmitBtn.auth-cta {
  border: 1px solid rgba(176, 188, 202, 0.35);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text);
  background: rgba(15, 19, 24, 0.95);
}

.auth-page #loginSubmitBtn.auth-cta:hover {
  color: #ffffff;
  border-color: rgba(78, 161, 255, 0.95);
  background: rgba(78, 161, 255, 0.28);
  box-shadow: 0 0 20px rgba(78, 161, 255, 0.5);
}

.landing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.landing-steps {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.about-highlights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.about-highlights > div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(176, 188, 202, 0.18);
  background: rgba(8, 11, 15, 0.55);
}

.about-highlights strong {
  color: var(--accent-gold);
  font-size: 0.92rem;
}

.landing-guide {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.guide-item {
  border: 1px solid rgba(176, 188, 202, 0.22);
  border-radius: 8px;
  background: rgba(8, 11, 15, 0.55);
  overflow: hidden;
}

.guide-item summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 650;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  user-select: none;
}

.guide-item summary::-webkit-details-marker {
  display: none;
}

.guide-item summary::after {
  content: "+";
  color: var(--accent-teal);
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
}

.guide-item[open] summary {
  border-bottom: 1px solid rgba(176, 188, 202, 0.16);
  color: var(--accent-gold);
}

.guide-item[open] summary::after {
  content: "–";
}

.guide-body {
  padding: 12px 14px 14px;
}

.guide-body p {
  margin: 0 0 8px;
  color: var(--muted);
}

.guide-body ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.guide-body li strong {
  color: var(--text);
}

.landing-auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.landing-access-cta .landing-cta-row {
  margin-top: 10px;
}

.auth-page-shell {
  max-width: 720px;
}

.auth-panel h1 {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 2.5vw, 2.1rem);
}

.auth-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.auth-switch {
  margin: 14px 0 0;
}

.auth-switch a,
.brand-link {
  color: var(--accent-gold);
  text-decoration: none;
}

.brand-link strong {
  color: var(--text);
}

.pricing-placeholder-grid .pricing-card {
  display: grid;
  gap: 8px;
  align-content: start;
}

.pricing-placeholder-grid .landing-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.landing-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.preview-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preview-item img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top center;
  border-radius: 8px;
  border: 1px solid rgba(176, 188, 202, 0.25);
  display: block;
  background: #0b0f14;
}

.preview-clickable {
  cursor: zoom-in;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.preview-clickable:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.preview-lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(3, 5, 7, 0.86);
  z-index: 9999;
  padding: 16px;
}

.preview-lightbox.open {
  display: flex;
}

.preview-lightbox-inner {
  position: relative;
  max-width: 1200px;
  width: min(96vw, 1200px);
}

.preview-lightbox img {
  width: 100%;
  display: block;
  border-radius: 10px;
  border: 1px solid rgba(176, 188, 202, 0.35);
  background: #0b0f14;
}

.preview-lightbox-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(176, 188, 202, 0.45);
  background: rgba(14, 17, 21, 0.96);
  color: #e6e9ef;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.pricing-card .price-placeholder {
  margin: 8px 0 0;
  color: var(--accent-gold);
  font-weight: 700;
}

.pricing-badge {
  margin: 0 0 6px;
  color: var(--accent-teal);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
}

.price-amount {
  margin: 8px 0 4px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.price-value {
  color: var(--accent-gold);
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(1.8rem, 3vw, 2.35rem);
  line-height: 1;
  font-weight: 400;
}

.price-period {
  color: var(--muted);
  font-size: 0.92rem;
}

.pricing-features {
  margin: 10px 0 14px;
  padding-left: 18px;
  color: var(--muted);
  display: grid;
  gap: 4px;
}

.pricing-features li {
  line-height: 1.4;
}

.legal-doc h2 {
  margin: 18px 0 6px;
  font-size: 1.05rem;
}

.legal-doc ul {
  padding-left: 18px;
}

.legal-doc p,
.legal-doc li {
  line-height: 1.55;
}

.auth-form {
  display: grid;
  gap: 8px;
}

.app-shell {
  max-width: 1840px;
  margin: 0 auto;
  padding: 10px 14px;
  height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
  overflow: hidden;
}

.card {
  background:
    linear-gradient(155deg, rgba(198, 208, 220, 0.08) 0%, rgba(255, 255, 255, 0) 48%),
    linear-gradient(180deg, var(--card) 0%, #0a0c0f 100%);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(242, 244, 247, 0.03);
  transition: transform 180ms ease, box-shadow 220ms ease, border-color 200ms ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(176, 188, 202, 0.5);
  box-shadow:
    0 18px 34px rgba(0, 0, 0, 0.55),
    0 6px 16px rgba(176, 188, 202, 0.12),
    inset 0 1px 0 rgba(242, 244, 247, 0.06);
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.brand h1 {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.brand-links {
  margin-top: 8px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.brand-links a,
.brand-links .linkish-btn,
.brand-links #authLogoutBtn {
  color: var(--accent-gold);
  text-decoration: none;
  font-size: 0.85rem;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  border-radius: 0;
}

.brand-links a:hover,
.brand-links .linkish-btn:hover,
.brand-links #authLogoutBtn:hover {
  text-decoration: underline;
  border-color: transparent;
}

.logged-in-tip {
  margin-top: 10px;
}

.logged-in-tip a {
  color: var(--accent-gold);
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.timeframe-group {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tf-btn,
#refreshNowBtn,
#refreshInterval,
#resetZoomBtn,
#userProfile,
#layoutMode,
#assetGroup,
#assetSearch,
#authUser,
#authPass,
#authLoginBtn,
#authLogoutBtn {
  background: linear-gradient(180deg, rgba(24, 29, 35, 0.9) 0%, rgba(14, 17, 21, 0.95) 100%);
  color: var(--text);
  border: 1px solid rgba(176, 188, 202, 0.35);
  border-radius: 7px;
  padding: 5px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tf-btn:hover,
#refreshNowBtn:hover,
#refreshInterval:hover,
#resetZoomBtn:hover,
#userProfile:hover,
#layoutMode:hover,
#assetGroup:hover,
#assetSearch:hover,
#authUser:hover,
#authPass:hover,
#authLoginBtn:hover,
#authLogoutBtn:hover {
  border-color: rgba(195, 205, 218, 0.7);
  background: linear-gradient(180deg, rgba(32, 38, 46, 0.95) 0%, rgba(18, 22, 28, 0.98) 100%);
}

#assetSearch {
  min-width: 320px;
}

.tf-btn.active {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.28) 0%, rgba(47, 167, 179, 0.18) 100%);
  border-color: rgba(212, 175, 55, 0.72);
}

.refresh-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.auth-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

#authUser,
#authPass {
  min-width: 120px;
}

#authStatus {
  min-width: 150px;
}

.live-badge {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #eafbf7;
  background: linear-gradient(135deg, #2fa7b3 0%, #217c85 100%);
  border: 1px solid rgba(47, 167, 179, 0.42);
}

.live-badge.badge-live {
  color: #eafbf7;
  background: linear-gradient(135deg, #2fa7b3 0%, #217c85 100%);
  border-color: rgba(47, 167, 179, 0.42);
}

.live-badge.badge-cache {
  color: #fff8e8;
  background: linear-gradient(135deg, #c9a227 0%, #8a7018 100%);
  border-color: rgba(201, 162, 39, 0.5);
}

.live-badge.badge-failover {
  color: #fff4ec;
  background: linear-gradient(135deg, #d08945 0%, #9a5a22 100%);
  border-color: rgba(208, 137, 69, 0.5);
}

.live-badge.badge-down {
  color: #ffe8ea;
  background: linear-gradient(135deg, #c44b5a 0%, #8a2f3a 100%);
  border-color: rgba(196, 75, 90, 0.5);
}

.grid {
  display: grid;
  gap: 10px;
}

.page-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.page-tab-btn {
  background: linear-gradient(180deg, rgba(24, 29, 35, 0.9) 0%, rgba(14, 17, 21, 0.95) 100%);
  color: var(--text);
  border: 1px solid rgba(176, 188, 202, 0.35);
  border-radius: 7px;
  padding: 6px 10px;
  cursor: pointer;
}

#resetZoomBtn {
  font-weight: 600;
}

.page-tab-btn.active {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.28) 0%, rgba(47, 167, 179, 0.18) 100%);
  border-color: rgba(212, 175, 55, 0.72);
}

.page-view {
  display: none;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.page-view.active {
  display: flex;
  flex-direction: column;
}

.kpi-strip {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  flex: 0 0 auto;
}

.bias-strip {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  flex: 0 0 auto;
  margin-top: 8px;
}

.kpi-strip .card h2 {
  margin: 0 0 4px;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
}

.main-grid {
  min-height: 0;
  height: 100%;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 2.1fr 1fr;
  gap: 10px;
  margin-top: 10px;
  overflow: hidden;
}

.left-stack,
.right-stack {
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.charts-grid {
  min-height: 0;
  height: 100%;
  flex: 1 1 auto;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  overflow: hidden;
}

.chart-panel {
  min-height: 0;
  resize: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.cot-focus-panel {
  height: 100%;
  min-height: 470px;
  resize: none;
  overflow: hidden;
}

.cot-focus-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(4, minmax(150px, 190px));
  gap: 8px;
  align-items: end;
  margin-bottom: 6px;
  overflow: hidden;
}

.cot-focus-selectors {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.cot-focus-selectors select,
.cot-focus-selectors input[type="range"] {
  background: linear-gradient(180deg, rgba(22, 26, 31, 0.9) 0%, rgba(13, 15, 18, 0.95) 100%);
  color: var(--text);
  border: 1px solid rgba(78, 161, 255, 0.3);
  border-radius: 7px;
  padding: 5px 8px;
}

.chart-panel h2 {
  margin: 0 0 4px;
  font-size: 0.86rem;
}

.chart-panel small {
  color: var(--muted);
  margin-bottom: 6px;
  font-size: 0.73rem;
}

canvas {
  width: 100%;
  height: calc(100% - 88px) !important;
  background: linear-gradient(180deg, #161b22 0%, #0c1015 100%);
  border: 1px solid rgba(22, 26, 31, 0.95);
  border-radius: 8px;
  box-shadow: inset 0 0 22px rgba(8, 12, 18, 0.75);
  transition: filter 180ms ease, box-shadow 220ms ease;
}

canvas:hover {
  filter: brightness(1.03);
  box-shadow:
    inset 0 0 24px rgba(8, 12, 18, 0.85),
    0 0 0 1px rgba(212, 175, 55, 0.35);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  font-size: 0.86rem;
}

.flow-table-card {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.alert-card {
  flex: 0 0 180px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.alert-feed {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
  min-height: 0;
}

.alert-item {
  border: 1px solid rgba(30, 36, 44, 0.95);
  border-radius: 8px;
  background: rgba(13, 15, 18, 0.88);
  padding: 6px 8px;
  font-size: 0.74rem;
}

.alert-item .time {
  color: var(--muted);
  margin-right: 6px;
}

.table-wrap {
  height: 100%;
  max-height: none;
  overflow: auto;
  border: 1px solid rgba(22, 26, 31, 0.95);
  border-radius: 8px;
  background: linear-gradient(180deg, #101319 0%, #090b0f 100%);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

th,
td {
  border-bottom: 1px solid rgba(30, 36, 44, 0.95);
  padding: 6px 8px;
  white-space: nowrap;
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  background: #171d24;
  z-index: 1;
}

.status-card p {
  margin: 4px 0;
  font-size: 0.8rem;
}

.seasonality-controls select {
  margin-top: 6px;
  background: linear-gradient(180deg, rgba(22, 26, 31, 0.9) 0%, rgba(13, 15, 18, 0.95) 100%);
  color: var(--text);
  border: 1px solid rgba(78, 161, 255, 0.3);
  border-radius: 7px;
  padding: 6px 10px;
}

.signal-tools-card select,
.signal-tools-card input[type="range"] {
  margin-top: 6px;
  background: linear-gradient(180deg, rgba(22, 26, 31, 0.9) 0%, rgba(13, 15, 18, 0.95) 100%);
  color: var(--text);
  border: 1px solid rgba(78, 161, 255, 0.3);
  border-radius: 7px;
  padding: 6px 10px;
}

.macro-controls select,
.notification-config-card select,
.notification-config-card input,
#macroRefreshBtn,
#notifyTestBtn {
  margin-top: 6px;
  background: linear-gradient(180deg, rgba(24, 29, 35, 0.9) 0%, rgba(14, 17, 21, 0.95) 100%);
  color: var(--text);
  border: 1px solid rgba(176, 188, 202, 0.35);
  border-radius: 7px;
  padding: 6px 10px;
}

#macroRefreshBtn,
#notifyTestBtn {
  cursor: pointer;
}

.notify-input-block {
  min-width: 220px;
  display: flex;
  flex-direction: column;
}

.macro-feed-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 86px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid rgba(176, 188, 202, 0.35);
  background: rgba(16, 20, 25, 0.9);
}

.macro-feed-live {
  color: #3fbf7f;
  border-color: rgba(63, 191, 127, 0.6);
  background: rgba(20, 56, 35, 0.65);
}

.macro-feed-failover {
  color: #f5c06b;
  border-color: rgba(245, 192, 107, 0.65);
  background: rgba(70, 50, 20, 0.62);
}

.macro-feed-cache {
  color: #98a2b3;
  border-color: rgba(152, 162, 179, 0.6);
  background: rgba(30, 36, 44, 0.78);
}

.macro-feed-down {
  color: #e05a5a;
  border-color: rgba(224, 90, 90, 0.65);
  background: rgba(66, 22, 22, 0.7);
}

.macro-feed-unknown {
  color: #c4ccd7;
}

.macro-days-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  min-height: 0;
}

.macro-day-card {
  border: 1px solid rgba(30, 36, 44, 0.95);
  border-radius: 10px;
  background: rgba(16, 20, 25, 0.9);
  padding: 10px;
}

.macro-day-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.macro-day-header h3 {
  margin: 0;
  font-size: 0.95rem;
  text-transform: capitalize;
}

.macro-event-item {
  border: 1px solid rgba(30, 36, 44, 0.95);
  border-radius: 8px;
  background: rgba(12, 15, 20, 0.85);
  margin-bottom: 8px;
  overflow: hidden;
}

.macro-event-item:last-child {
  margin-bottom: 0;
}

.macro-event-summary {
  list-style: none;
  cursor: pointer;
  padding: 8px;
}

.macro-event-summary::-webkit-details-marker {
  display: none;
}

.macro-event-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.macro-event-title {
  margin-top: 4px;
}

.macro-folder-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  color: var(--muted);
  border: 1px solid rgba(176, 188, 202, 0.35);
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
  background: rgba(18, 22, 28, 0.88);
}

.macro-event-item[open] .macro-folder-tag {
  border-color: rgba(212, 175, 55, 0.6);
  color: #e6d7a5;
}

.macro-event-details {
  border-top: 1px solid rgba(30, 36, 44, 0.95);
  padding: 8px;
  display: grid;
  gap: 5px;
  background: rgba(9, 11, 15, 0.86);
}

.macro-impact-high {
  border-color: rgba(224, 90, 90, 0.55);
}

.macro-impact-medium {
  border-color: rgba(212, 175, 55, 0.5);
}

.macro-impact-low {
  border-color: rgba(63, 191, 127, 0.4);
}

.signal-slider-wrap {
  min-width: 260px;
  display: flex;
  flex-direction: column;
}

.signal-intel-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.journal-table-card {
  margin-top: 10px;
}

.journal-controls {
  margin: 8px 0;
  align-items: flex-end;
}

.journal-controls select,
#exportJournalCsvBtn {
  margin-top: 6px;
  background: linear-gradient(180deg, rgba(24, 29, 35, 0.9) 0%, rgba(14, 17, 21, 0.95) 100%);
  color: var(--text);
  border: 1px solid rgba(176, 188, 202, 0.35);
  border-radius: 7px;
  padding: 6px 10px;
}

#exportJournalCsvBtn {
  cursor: pointer;
}

.journal-table-card .table-wrap {
  max-height: 260px;
}

.seasonality-only {
  min-height: 0;
  height: auto;
  min-height: 300px;
  margin-top: 0;
}

.seasonality-numbers {
  display: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.seasonality-insights {
  margin-top: 0;
}

.seasonality-insight-cards {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.seasonality-ranking {
  margin-top: 0;
  min-height: 0;
}

.seasonality-ranking .table-wrap {
  max-height: 240px;
}

.seasonality-day-timing .table-wrap {
  max-height: 320px;
}

.seasonality-day-timing-note {
  margin: 0 0 8px;
  font-size: 0.82rem;
}

.timing-focus-long {
  color: var(--positive);
  font-weight: 650;
}

.timing-focus-short {
  color: var(--negative);
  font-weight: 650;
}

.seasonality-bottom-grid {
  margin-top: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  min-height: 0;
}

.seasonality-signal-history {
  min-height: 0;
}

.seasonality-signal-history .table-wrap {
  max-height: 240px;
}

.seasonality-backtest {
  margin-top: 0;
}

#seasonalityPage.page-view.active {
  display: block;
  overflow: auto;
  padding-right: 2px;
}

#signalPage.page-view.active {
  display: block;
  overflow: auto;
  padding-right: 2px;
}

#macroPage.page-view.active {
  display: block;
  overflow: auto;
  padding-right: 2px;
}

#signalPage .card {
  margin-bottom: 10px;
}

#signalPage .card:last-child {
  margin-bottom: 0;
}

#macroPage .card {
  margin-bottom: 10px;
}

#macroPage .card:last-child {
  margin-bottom: 0;
}

#seasonalityPage .card {
  margin-bottom: 10px;
}

#seasonalityPage .card:last-child {
  margin-bottom: 0;
}

#seasonalityChart {
  height: clamp(260px, 40vh, 420px) !important;
}

.seasonality-numbers {
  margin-top: 10px;
}

.seasonality-insight-card {
  border: 1px solid rgba(30, 36, 44, 0.95);
  border-radius: 8px;
  padding: 8px;
  background: rgba(13, 15, 18, 0.9);
}

.seasonality-insight-card .label {
  font-size: 0.74rem;
  color: var(--muted);
}

.seasonality-insight-card .value {
  margin-top: 4px;
  font-size: 1rem;
  font-weight: 700;
}

.seasonality-insight-card .note {
  margin-top: 2px;
  font-size: 0.72rem;
  color: var(--muted);
}

.seasonality-number-card {
  border: 1px solid rgba(30, 36, 44, 0.95);
  border-radius: 8px;
  padding: 8px;
  background: rgba(13, 15, 18, 0.9);
}

.seasonality-number-card .month {
  font-size: 0.78rem;
  color: var(--muted);
}

.seasonality-number-card .value {
  margin-top: 4px;
  font-size: 1.05rem;
  font-weight: 700;
}

.seasonality-number-card .range {
  margin-top: 3px;
  font-size: 0.72rem;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.up {
  color: var(--positive);
}

.down {
  color: var(--negative);
}

@media (max-width: 1480px) {
  .kpi-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .bias-strip {
    grid-template-columns: 1fr;
  }

  .charts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 1fr;
  }
}

@media (max-width: 1220px) {
  body {
    overflow: auto;
    height: auto;
  }

  .app-shell {
    height: auto;
    display: block;
    overflow: visible;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .main-grid {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .charts-grid {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .cot-focus-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .cot-focus-controls > div:first-child {
    grid-column: 1 / -1;
  }

  .seasonality-numbers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .seasonality-insight-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .signal-intel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .seasonality-bottom-grid {
    grid-template-columns: 1fr;
  }

  #seasonalityPage.page-view.active {
    overflow: visible;
    padding-right: 0;
  }

  #signalPage.page-view.active {
    overflow: visible;
    padding-right: 0;
  }

  #macroPage.page-view.active {
    overflow: visible;
    padding-right: 0;
  }

  #seasonalityChart {
    height: clamp(240px, 36vh, 360px) !important;
  }

}

@media (max-width: 860px) {
  .signal-intel-grid {
    grid-template-columns: 1fr;
  }

  .macro-days-grid {
    grid-template-columns: 1fr;
  }

  .landing-grid,
  .landing-preview-grid,
  .landing-auth-grid,
  .about-highlights,
  .landing-grid-4,
  .landing-steps-row {
    grid-template-columns: 1fr;
  }
}

body.layout-desk .app-shell {
  padding: 8px 10px;
  gap: 8px;
}

body.layout-desk .card {
  padding: 8px 10px;
}

body.layout-desk .main-grid {
  gap: 8px;
  margin-top: 8px;
}

body.layout-desk .metric {
  font-size: 1.15rem;
}

body.layout-focus .app-shell {
  max-width: 1960px;
  padding: 12px 18px;
  gap: 12px;
}

body.layout-focus .card {
  padding: 12px 14px;
}

body.layout-focus .main-grid {
  gap: 12px;
  margin-top: 12px;
}

body.layout-focus .metric {
  font-size: 1.4rem;
}
