/* Xovos TTB — Tahlil dashboard interactions 2026-09-06
   Desktop sidebar collapse + chart focus/fullscreen + readability polish.
   Existing filters / CSV / print / Excel calculations are intentionally untouched. */

@media (min-width: 981px) {
  .overall-report-page .or-workspace {
    --or-active-sidebar-width: var(--or-sidebar-width, 390px);
    position: relative;
    grid-template-columns: var(--or-active-sidebar-width) minmax(0, 1fr) !important;
    transition: grid-template-columns .34s cubic-bezier(.2,.8,.2,1), gap .34s cubic-bezier(.2,.8,.2,1);
  }

  .overall-report-page .or-main.or-sidebar-collapsed .or-workspace {
    --or-active-sidebar-width: 76px;
    gap: 12px !important;
  }

  .overall-report-page .or-sidebar {
    transition: padding .3s ease, border-radius .3s ease, box-shadow .3s ease;
  }

  .overall-report-page .or-sidebar-collapse-btn {
    position: absolute;
    z-index: 85;
    top: 22px;
    left: calc(var(--or-active-sidebar-width) - 18px);
    width: 38px;
    height: 38px;
    border: 1px solid rgba(10, 83, 119, .16);
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #fff;
    color: var(--or-theme, #087f5b);
    box-shadow: 0 10px 25px rgba(17, 61, 91, .18);
    font: 900 25px/1 Inter, system-ui, sans-serif;
    cursor: pointer;
    transition: left .34s cubic-bezier(.2,.8,.2,1), transform .18s ease, background .18s ease, color .18s ease;
  }

  .overall-report-page .or-sidebar-collapse-btn:hover {
    transform: scale(1.07);
    background: var(--or-theme, #087f5b);
    color: #fff;
  }

  .overall-report-page .or-sidebar-collapse-btn:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--or-theme, #087f5b) 30%, transparent);
    outline-offset: 3px;
  }

  .overall-report-page .or-main.or-sidebar-collapsed .or-sidebar {
    padding: 10px 8px !important;
    overflow-x: hidden !important;
  }

  .overall-report-page .or-main.or-sidebar-collapsed .or-sidebar-brand {
    justify-content: center;
    padding: 5px 0 13px;
  }

  .overall-report-page .or-main.or-sidebar-collapsed .or-sidebar-brand > div:not(.or-sidebar-brand-icon),
  .overall-report-page .or-main.or-sidebar-collapsed .or-tab-number,
  .overall-report-page .or-main.or-sidebar-collapsed .or-tab-copy,
  .overall-report-page .or-main.or-sidebar-collapsed .or-tab > em,
  .overall-report-page .or-main.or-sidebar-collapsed .or-sidebar-legend {
    display: none !important;
  }

  .overall-report-page .or-main.or-sidebar-collapsed .or-sidebar-brand-icon {
    width: 46px !important;
    height: 46px !important;
    flex: 0 0 46px;
    font-size: 22px !important;
  }

  .overall-report-page .or-main.or-sidebar-collapsed .or-dashboard-tabs {
    gap: 8px !important;
  }

  .overall-report-page .or-main.or-sidebar-collapsed .or-tab {
    min-height: 56px !important;
    grid-template-columns: 1fr !important;
    place-items: center;
    padding: 5px !important;
    border-radius: 15px;
  }

  .overall-report-page .or-main.or-sidebar-collapsed .or-tab:hover {
    transform: translateY(-2px) !important;
  }

  .overall-report-page .or-main.or-sidebar-collapsed .or-side-visual {
    width: 44px !important;
    height: 44px !important;
    border-radius: 13px !important;
  }
}

@media (min-width: 981px) and (max-width: 1320px) {
  .overall-report-page .or-workspace {
    --or-active-sidebar-width: var(--or-sidebar-width-compact, 330px);
  }
  .overall-report-page .or-main.or-sidebar-collapsed .or-workspace {
    --or-active-sidebar-width: 76px;
  }
}

@media (max-width: 980px) {
  .overall-report-page .or-sidebar-collapse-btn { display: none !important; }
}

/* Dashboard text must stay readable even when the available width is tight. */
.overall-report-page .or-kpi-label {
  min-height: 0 !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
}
.overall-report-page .or-kpi-note {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  line-height: 1.35;
  min-height: 1.35em;
}
.overall-report-page .or-card-head h3 { font-size: 17px; line-height: 1.25; }
.overall-report-page .or-card-head p { font-size: 12px; }
.overall-report-page .or-legend span { font-size: 11px; }
.overall-report-page .or-chart svg text { font-size: 10.5px; }

/* Charts are clickable. The full-screen dialog is a direct child of body. */
.overall-report-page .or-chart-expandable {
  position: relative;
  cursor: zoom-in;
  transition: box-shadow .2s ease, border-color .2s ease;
}
.overall-report-page .or-chart-expandable:hover {
  border-color: color-mix(in srgb, var(--or-theme, #087f5b) 34%, #dce7ef);
  box-shadow: 0 18px 46px rgba(17, 61, 91, .13);
}
.overall-report-page .or-chart-expandable > .or-card-head {
  position: relative;
  padding-right: 44px;
}
.overall-report-page .or-chart-expand-btn {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 1px solid #cbdce7;
  border-radius: 10px;
  background: #f0f6fa;
  color: #264c65;
  display: grid;
  place-items: center;
  cursor: pointer;
  font: 700 21px/1 system-ui, sans-serif;
  padding: 0;
  margin: 0;
  transition: background .18s ease, color .18s ease;
}
.overall-report-page .or-chart-expand-btn:hover {
  background: var(--or-theme, #087f5b);
  color: #fff;
}
.overall-report-page :is(.or-chart-expand-btn,.or-chart-expandable):focus-visible {
  outline: 3px solid var(--or-theme, #087f5b);
  outline-offset: 3px;
}
.overall-report-page .or-chart-placeholder {
  visibility: hidden !important;
  pointer-events: none !important;
  box-sizing: border-box !important;
  animation: none !important;
  transition: none !important;
}

/* showModal() puts this in the browser top layer. The fallback uses the SAME
   body-level element for the background and card, so they cannot swap layers. */
body.overall-report-page > .or-chart-dialog {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483000 !important;
  width: 100% !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-width: none !important;
  max-height: none !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: clamp(8px, 1.4vw, 22px) !important;
  padding-top: max(8px, min(1.4vw, 22px), env(safe-area-inset-top)) !important;
  padding-bottom: max(8px, min(1.4vw, 22px), env(safe-area-inset-bottom)) !important;
  padding-left: max(8px, min(1.4vw, 22px), env(safe-area-inset-left)) !important;
  padding-right: max(8px, min(1.4vw, 22px), env(safe-area-inset-right)) !important;
  box-sizing: border-box !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--or-ink, #13283d);
  overflow: hidden !important;
  overscroll-behavior: contain;
  transform: none !important;
  filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
body.overall-report-page > .or-chart-dialog[open] { display: block !important; }
body.overall-report-page > .or-chart-dialog[hidden],
body.overall-report-page > .or-chart-dialog:not([open]) { display: none !important; }
.or-chart-dialog::backdrop { background: rgba(8, 25, 42, .68); }
body.overall-report-page > .or-chart-dialog.or-chart-dialog-fallback {
  background: rgba(8, 25, 42, .68) !important;
}
body.overall-report-page.or-chart-modal-open > [inert] { pointer-events: none !important; }

body.overall-report-page > .or-chart-dialog > .or-card.or-chart-expanded {
  position: relative !important;
  inset: auto !important;
  display: flex !important;
  flex-direction: column;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: clamp(14px, 2vw, 28px) !important;
  box-sizing: border-box !important;
  overflow: auto !important;
  overscroll-behavior: contain;
  cursor: zoom-out;
  border-radius: 18px;
  background: #fff !important;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .3);
  opacity: 1;
  transform: none !important;
  filter: none !important;
  clip-path: none !important;
  backface-visibility: visible !important;
  will-change: auto !important;
}
.overall-report-page .or-chart-dialog .or-card-head {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: flex-start;
  position: sticky;
  top: -1px;
  z-index: 4;
  background: #fff;
  padding: 0 56px 12px 0;
  margin-bottom: 12px;
  border-bottom: 1px solid #e3ebf1;
}
.overall-report-page .or-chart-dialog .or-card-head > div { min-width: 0; }
.overall-report-page .or-chart-dialog .or-card-head h3 {
  font-size: clamp(18px, 2vw, 28px);
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.overall-report-page .or-chart-dialog .or-card-head p,
.overall-report-page .or-chart-dialog .or-legend span { font-size: clamp(12px, 1vw, 14px); }
.overall-report-page .or-chart-dialog .or-legend { justify-content: flex-start; }
.overall-report-page .or-chart-dialog .or-chart-expand-btn { width: 44px; height: 44px; }
.overall-report-page .or-chart-dialog .or-chart {
  flex: 1 0 auto;
  width: 100% !important;
  height: auto !important;
  min-height: min(60vh, 620px) !important;
  min-height: min(60dvh, 620px) !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  overflow: visible !important;
}
.overall-report-page .or-chart-dialog .or-chart > svg {
  width: 100%;
  height: 100%;
  min-height: min(60vh, 620px);
  min-height: min(60dvh, 620px);
}
.overall-report-page .or-chart-dialog .or-chart svg text { font-size: 12px; }
.overall-report-page .or-chart-dialog .or-donut-layout { gap: 24px; min-height: inherit; }
.overall-report-page .or-chart-dialog .or-donut-layout svg {
  height: min(58vh, 540px);
  height: min(58dvh, 540px);
  max-height: none;
}
.overall-report-page .or-chart-dialog .or-donut-list { gap: 16px; }
.overall-report-page .or-chart-dialog .or-donut-row { font-size: clamp(12px, 1.3vw, 17px); gap: 10px; }
.overall-report-page .or-chart-dialog .or-donut-row span,
.overall-report-page .or-chart-dialog .or-performance-row > span {
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
}
.overall-report-page .or-chart-dialog .or-performance-list { gap: 14px; }
.overall-report-page .or-chart-dialog .or-performance-row {
  grid-template-columns: minmax(110px, 1fr) minmax(100px, 2fr) 70px;
  font-size: clamp(12px, 1.2vw, 16px);
}
.overall-report-page .or-chart-dialog .or-performance-row > b { font-size: 12px; }
.overall-report-page .or-chart-dialog .or-performance-track { height: 18px; }
.overall-report-page .or-tooltip { transform: none; max-width: min(280px, calc(100vw - 24px)); }
html.or-chart-modal-open, body.overall-report-page.or-chart-modal-open {
  overflow: hidden !important;
  overscroll-behavior: none !important;
}

/* Keep the existing grouped bars, including reports with a single date. */
.overall-report-page .or-trend-card .or-chart rect.or-chart-mark { transition: opacity .16s ease; }
.overall-report-page .or-trend-card .or-chart rect.or-chart-mark:hover { opacity: .82; }
@media (max-width: 680px) {
  .overall-report-page .or-chart-dialog .or-card-head { display: block; }
  .overall-report-page .or-chart-dialog :is(.or-trend-card,.or-compare-card) .or-chart {
    overflow-x: auto !important;
  }
  .overall-report-page .or-chart-dialog .or-chart > svg { min-width: 640px; }
  .overall-report-page .or-chart-dialog :is(.or-trend-card,.or-compare-card) .or-card-head::after {
    content: 'Grafikni yon tomonga surib ko‘rish mumkin.';
    display: block;
    margin-top: 8px;
    color: #65778a;
    font-size: 11px;
  }
  .overall-report-page .or-chart-dialog .or-donut-layout { grid-template-columns: 1fr; }
  .overall-report-page .or-chart-dialog .or-donut-layout svg { height: 260px; }
  .overall-report-page .or-chart-dialog .or-performance-row {
    grid-template-columns: minmax(90px, 1fr) minmax(50px, 1fr) 52px;
    gap: 6px;
  }
  .overall-report-page .or-chart-dialog .or-performance-row > b { padding: 4px 2px; }
  .overall-report-page .or-card-head h3 { font-size: 15px; }
  .overall-report-page .or-chart svg text { font-size: 9.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .overall-report-page .or-workspace,
  .overall-report-page .or-sidebar,
  .overall-report-page .or-sidebar-collapse-btn,
  .overall-report-page .or-chart-expandable,
  .overall-report-page .or-chart-expand-btn { transition: none !important; }
}
@media print {
  .or-sidebar-collapse-btn, .or-chart-expand-btn, .or-chart-placeholder,
  body.overall-report-page > .or-chart-dialog { display: none !important; }
  /* beforeprint restores the live card to its original position. Remove the
     desktop scroll viewport so every dashboard row can reach the printout. */
  html:has(body.overall-report-page), body.overall-report-page,
  body.overall-report-page .or-main, body.overall-report-page .or-workspace,
  body.overall-report-page .or-content {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
  body.overall-report-page .or-main { width: 100% !important; margin: 0 !important; padding: 0 !important; }
}
