:root {
  --topnav-height: 4.1875rem;
}

/* ══════════════════════════════════════════════
   PREMIUM DESIGN SYSTEM — SQB palette
   ══════════════════════════════════════════════ */
html[data-mode="light"] {
  /* ── Single hero: Blue-600 ── */
  --B9:  #1A2B4B;   /* navy-900  — navbar, digest header  */
  --B8:  #122035;   /* navy-800  — hover/dark state       */
  --B6:  #2D4F8A;   /* navy-600  — PRIMARY accent          */
  --B5:  #3D6CB8;   /* navy-500  — card top border        */
  --B1:  #C8DAEF;   /* navy-100  — highlight/tint         */
  --B0:  #EAF0FA;   /* navy-50   — footer/light bg        */

  /* ── Aliases (used by existing code) ── */
  --navy:      var(--B9);
  --navy-2:    #0D1A2F;
  --teal:      var(--B6);
  --accent:    var(--B5);
  --accent-2:  #60A5FA;   /* blue-400 */
  --cream:     var(--B0);
  --cream-2:   var(--B1);
  --success:   #059669;
  --warn:      #DC2626;
  --ink:       #0F172A;
  --muted:     #64748B;
  --line:      #E2E8F0;
  --shadow:    0 .0419rem .1256rem rgba(0,0,0,.05),
               0 .335rem 1.005rem rgba(37,99,235,.07),
               0 0 0 .0419rem rgba(226,232,240,.9);
  --shadow-lg: 0 .1675rem .5025rem rgba(0,0,0,.08),
               0 .8375rem 2.01rem rgba(37,99,235,.12),
               0 0 0 .0419rem rgba(37,99,235,.10);

  /* Override app.css vars */
  --page-bg:             var(--cream);
  --bg-color:            #FFFFFF;
  --text-color:          var(--ink);
  --strip-bg:            var(--cream-2);
  --btn-hover-bg:        var(--cream-2);
  --header-bg:           var(--navy);
  --glass-blur:          .5025rem;
  --glass-saturate:      125%;
  --glass-strip:         rgba(239,234,224,0.90);
  --glass-surface:       rgba(255,255,255,0.84);
  --glass-surface-strong:rgba(255,255,255,0.96);
  --glass-border:        var(--line);
}

body.horizontal .wrapper { padding-top: var(--topnav-height); }
/* The site footer follows the page content: the wrapper no longer fills the
   viewport (Bootstrap's .min-vh-100), so a short page has no empty band above
   the footer. Pages that lay out a one-screen dashboard set their own height. */
body.horizontal > .wrapper.min-vh-100 { min-height: 0 !important; }

body.horizontal .wrapper > nav.navbar {
  position: fixed; top:0; left:0; right:0; z-index:1050;
}
body.horizontal .wrapper > nav.navbar > .container-fluid {
  padding-top:.6281rem; padding-bottom:.6281rem;
}

/* ── Navbar: dark navy like screenshot ── */
html[data-mode="light"] body.horizontal .wrapper > nav.navbar {
  background: var(--navy) !important;
  border-bottom: none;
  box-shadow: var(--shadow) !important;
}

/* ── Nav links: white on dark navbar, consistent size ── */
html[data-mode="light"] .page-nav-link {
  color:     rgba(255,255,255,.80);
  font-size: .8375rem;
  font-weight: 600;
  height:    1.5075rem;
  padding:   0 .5863rem;
}
html[data-mode="light"] .page-nav-link:hover,
html[data-mode="light"] .page-nav-link:focus {
  background: rgba(255,255,255,.10) !important;
  color: #fff !important;
  text-decoration: none;
}
html[data-mode="light"] .page-nav-link.active {
  background: rgba(255,255,255,.18) !important;
  color: #fff !important;
  border-radius: .2513rem;
}
html[data-mode="light"] .page-nav-link.active::after { background: transparent !important; }

/* ── Navbar right-side buttons — same size, white on navy ── */
html[data-mode="light"] .btn-methodology {
  color:        rgba(255,255,255,.88);
  border-color: rgba(255,255,255,.35);
  background:   rgba(255,255,255,.08);
  font-size:    .8375rem;
  height:       1.5075rem !important;
  border-radius: .2513rem;
}
html[data-mode="light"] .btn-methodology:hover,
html[data-mode="light"] .btn-methodology:focus,
html[data-mode="light"] .btn-methodology:active {
  background:   rgba(255,255,255,.20) !important;
  color:        #fff !important;
  border-color: rgba(255,255,255,.65) !important;
}
html[data-mode="light"] .btn-telegram-bot {
  color:        rgba(255,255,255,.88);
  border-color: rgba(255,255,255,.35);
  background:   rgba(255,255,255,.08);
  font-size:    .8375rem;
  height:       1.5075rem;
}
html[data-mode="light"] .btn-telegram-bot:hover,
html[data-mode="light"] .btn-telegram-bot:focus {
  background:   rgba(255,255,255,.20) !important;
  color:        #fff !important;
  border-color: rgba(255,255,255,.65) !important;
}
html[data-mode="light"] .btn-weekly-download {
  color:        rgba(255,255,255,.88);
  border-color: rgba(255,255,255,.35);
  background:   rgba(255,255,255,.08);
  font-size:    .8375rem;
  height:       1.5075rem;
}
html[data-mode="light"] .btn-weekly-download:hover,
html[data-mode="light"] .btn-weekly-download:focus {
  background:   rgba(255,255,255,.20) !important;
  color:        #fff !important;
  border-color: rgba(255,255,255,.65) !important;
}
html[data-mode="light"] #languageDropdown,
html[data-mode="light"] #languageDropdown span {
  color:     rgba(255,255,255,.88);
  font-size: .8375rem;
}

/* ── Dropdowns ── */
html[data-mode="light"] .dropdown-menu {
  background: #fff !important;
  border: .0419rem solid var(--line);
  box-shadow: var(--shadow);
}
html[data-mode="light"] .dropdown-menu .dropdown-item { color: var(--ink) !important; }
/* Language selector: active/hover — navy in light, green in dark, white text */
html[data-mode="light"] .dropdown-menu[aria-labelledby="languageDropdown"] .dropdown-item:hover,
html[data-mode="light"] .dropdown-menu[aria-labelledby="languageDropdown"] .dropdown-item.active,
html[data-mode="light"] .dropdown-menu[aria-labelledby="languageDropdown"] .dropdown-item:active { background: #1A2B4B !important; color: #ffffff !important; }
html[data-mode="dark"] .dropdown-menu[aria-labelledby="languageDropdown"] .dropdown-item:hover,
html[data-mode="dark"] .dropdown-menu[aria-labelledby="languageDropdown"] .dropdown-item.active,
html[data-mode="dark"] .dropdown-menu[aria-labelledby="languageDropdown"] .dropdown-item:active { background: #4caf50 !important; color: #ffffff !important; }

/* ── Modal headers ── */
html[data-mode="light"] #videoGuideModal .modal-header,
html[data-mode="light"] #videoGuidePartsModal .modal-header,
html[data-mode="light"] #weeklyExcelModal .modal-header {
  background: var(--navy) !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: none !important;
}
html[data-mode="light"] #videoGuideModal .modal-title,
html[data-mode="light"] #videoGuidePartsModal .modal-title,
html[data-mode="light"] #weeklyExcelModal .modal-title { color: #fff !important; }
html[data-mode="light"] #videoGuideModal .close,
html[data-mode="light"] #videoGuidePartsModal .close,
html[data-mode="light"] #weeklyExcelModal .close { color: rgba(255,255,255,.8) !important; }
html[data-mode="light"] #videoGuideModal .modal-content,
html[data-mode="light"] #videoGuidePartsModal .modal-content,
html[data-mode="light"] #weeklyExcelModal .modal-content {
  border: .0419rem solid var(--line) !important;
  border-radius: .5863rem !important;
  overflow: hidden;
}
html[data-mode="light"] #videoGuidePartsModal .video-part-btn:hover,
html[data-mode="light"] #videoGuidePartsModal .video-part-btn:focus {
  background: var(--teal) !important; color: #fff !important; border-color: var(--teal) !important;
}

/* ── Mobile nav ── */
html[data-mode="light"] .mobile-nav-link.active,
html[data-mode="light"] .mobile-nav-link:hover { color: var(--teal) !important; }
html[data-mode="light"] .lang-btn.active-lang { background: var(--teal) !important; color: #fff !important; border-color: var(--teal) !important; }
html[data-mode="light"] .lang-btn:hover { background: var(--cream-2) !important; color: var(--teal) !important; }

/* ── Dark mode navbar — size match only (colors unchanged) ── */
html[data-mode="dark"] .page-nav-link {
  font-size: .8375rem;
  font-weight: 600;
  height: 1.5075rem;
  padding: 0 .5863rem;
}
html[data-mode="dark"] .page-nav-link.active {
  border-radius: .2513rem;
  background: rgba(255,255,255,.18) !important;
}
html[data-mode="dark"] .page-nav-link.active::after { background: transparent !important; }
html[data-mode="dark"] .btn-methodology,
html[data-mode="dark"] .btn-telegram-bot,
html[data-mode="dark"] .btn-weekly-download {
  font-size: .8375rem;
  height: 1.5075rem !important;
  border-radius: .2513rem;
}
html[data-mode="dark"] .btn-methodology:hover,
html[data-mode="dark"] .btn-methodology:focus,
html[data-mode="dark"] .btn-telegram-bot:hover,
html[data-mode="dark"] .btn-telegram-bot:focus,
html[data-mode="dark"] .btn-weekly-download:hover,
html[data-mode="dark"] .btn-weekly-download:focus {
  background:   rgba(76, 175, 80, 0.15) !important;
  border-color: #4caf50 !important;
  color:        #4caf50 !important;
}
html[data-mode="dark"] #languageDropdown,
html[data-mode="dark"] #languageDropdown span {
  font-size: .8375rem;
}

/* ── Scrollbar: light=navy, dark=green ── */
::-webkit-scrollbar        { width:.2513rem; height:.2513rem; }
::-webkit-scrollbar-track  { background:rgba(0,0,0,.04); border-radius:.1256rem; }
::-webkit-scrollbar-thumb  { background:var(--teal,#1A2B4B); border-radius:.1256rem; transition:background .3s; }
::-webkit-scrollbar-thumb:hover { background:var(--navy,#122035); }
*                          { scrollbar-width:thin; scrollbar-color:#1A2B4B rgba(0,0,0,.04); }
html[data-mode="dark"] ::-webkit-scrollbar-thumb       { background:#4caf50; }
html[data-mode="dark"] ::-webkit-scrollbar-thumb:hover { background:#388e3c; }
html[data-mode="dark"] *   { scrollbar-color:#4caf50 rgba(255,255,255,.04); }

/* Override app.css body-level teal/gray variables with navy palette */
html[data-mode="light"] body {
  --header-bg:     #1A2B4B;
  --strip-bg:      var(--B1);       /* #C8DAEF — was #E8F5F5 */
  --btn-hover-bg:  var(--B1);
  --highlight-bg:  var(--B0);
  --highlight-border: var(--B6);
  --glass-header:  rgba(26,43,75,0.92);
  --glass-strip:   rgba(26,43,75,0.92);
}

.icon-container { transition:transform .3s ease; }
.carousel-item:hover .icon-container { transform:scale(1.1); box-shadow:0 .335rem 1.0469rem rgba(0,0,0,.15); }
.carousel-control-prev-icon, .carousel-control-next-icon { filter:drop-shadow(.0419rem .0419rem .0419rem rgba(0,0,0,.3)); }

/* Always-on avatar sizing (non-toggled) so the profile icon doesn't flash full-size
   during the theme stylesheet swap (its size otherwise lives only in the theme sheet). */
.avatar-img { width: 1.34rem; height: 1.34rem; max-width: 1.34rem; border-radius: 50%; object-fit: cover; }

/* ── Dark-mode size unification: match light so the layout never shifts on theme switch.
   Only colours differ between modes; these are shared (navbar/modal/body) bits. ── */
html[data-mode="dark"] body, body.dark { line-height: 1.3; }

/* Light mode, every screen size: the bars that carried a frosted-glass
   blur (navbar, card and table headers) are opaque here, so the blur
   showed nothing and only cost GPU work on scroll. Translucent overlays
   keep it (modals, mobile menu, the map path pill). */
html[data-mode="light"] body *:not(.modal-content):not(.mobile-nav-panel):not(.mobile-nav-overlay):not(.nm-crumb) {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* ── Phones / tablets: smooth scrolling ──
   backdrop-filter (frosted glass) and filter: drop-shadow are re-computed
   on every scroll frame for sticky/fixed bars; on phones that left the
   next content painting in chunks. In light mode those bars are opaque
   anyway; in dark mode an almost-opaque colour replaces the blur. Modals
   and the mobile menu (not scrolled) keep their glass. */
@media (max-width: 991.98px) {
  body *:not(.modal-content):not(.mobile-nav-panel):not(.mobile-nav-overlay) {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  html[data-mode="dark"] nav.navbar { background-color: rgba(31, 31, 31, .97) !important; }
  html[data-mode="dark"] .card-full .card-header { background-color: rgb(36, 37, 40) !important; }
  .nm-map .highcharts-series-group { filter: none; }
}
html[data-mode="dark"] nav.navbar, body.dark nav.navbar { border-bottom-width: 0 !important; }
html[data-mode="dark"] #navbarSupportedContent, body.dark #navbarSupportedContent { border-bottom: .0625rem solid transparent; }
html[data-mode="dark"] .modal-content, body.dark .modal-content { border-radius: .5863rem !important; }
html[data-mode="dark"] .modal-header, body.dark .modal-header { border-bottom-width: 0 !important; }

/* Mobile: let chart table headers (current/previous price, nominal change…) wrap to
   multiple lines (each word) so the columns aren't squeezed/cramped. */
@media (max-width: 991.98px) {
  .district-header, .region-header, .product-header { align-items: flex-end; }
  .district-header *, .region-header *, .product-header * {
    white-space: normal !important;
    word-break: keep-all;
    line-height: 1.15;
  }
  /* nominal-change column: push the unit "(so'm)" onto its own (3rd) line so the
     column header is narrow and the column itself can be slim. */
  .district-header > div:last-child span[style*="italic"],
  .region-header > div:last-child span[style*="italic"] {
    display: block;
    font-size: 0.82em;
  }
}

body, p, span, div, a, h1, h2, h3, h4, h5, h6,
label, input, select, textarea, button, td, th, li {
  font-family: "Segoe UI", Arial, Helvetica, "Noto Sans", sans-serif !important;
}

@media print {
  nav.navbar { display: none; }
  .ticker-wrap, #ticker-title { display: none; }
  body.horizontal .wrapper { padding-top: 0 !important; }
  .card-full { break-inside: avoid; box-shadow: none !important; border: .0419rem solid #ccc !important; }
  #rightSidebar { display: none !important; }
  #mainContentWrapper { max-width: 100%; flex: 0 0 100%; }
  .btn-group, button { display: none !important; }
}
