/**
 * HYDRA Hit Tracker — layout override (load last among tool CSS).
 * Fixes month dashboard grid + report KPI card grid when earlier sheets miss or lose cascade.
 * Cache: 20260612-hit-mobile-menu-v1
 */

#hydraToolsShell .ht-weeks-dashboard,
.ht-tracker-shell .ht-weeks-dashboard,
.ht-weeks-dashboard {
  max-width: 1280px;
  margin: 0 auto;
}

#hydraToolsShell .ht-month-dash-grid,
.ht-tracker-shell .ht-month-dash-grid,
.ht-month-dash-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

#hydraToolsShell .ht-month-dash-card,
.ht-tracker-shell .ht-month-dash-card,
.ht-month-dash-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 118px;
  padding: 16px 18px;
  border: 1px solid #eadfd2;
  border-radius: 18px;
  background: #fffdf9;
  text-align: left;
  width: auto !important;
  max-width: none !important;
}

#hydraToolsShell .ht-month-dash-card__title,
.ht-month-dash-card__title {
  font-size: 18px;
  font-weight: 900;
}

#hydraToolsShell .ht-month-dash-card__line,
#hydraToolsShell .ht-month-dash-card__meta-line,
#hydraToolsShell .ht-month-dash-card__empty,
.ht-month-dash-card__line,
.ht-month-dash-card__meta-line,
.ht-month-dash-card__empty {
  font-size: 13px;
  line-height: 1.5;
}

#hydraToolsShell .report-kpi-grid,
#hydraToolsShell .report-kpi-grid--portfolio,
.ht-tracker-shell .report-kpi-grid,
.ht-report-view .report-kpi-grid,
.report-kpi-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
  gap: 12px;
  max-width: min(1840px, 95vw);
  margin: 0 auto 16px;
}

#hydraToolsShell .report-kpi-grid .report-kpi-card,
#hydraToolsShell .report-kpi-grid .ht-kpi,
.ht-report-view .report-kpi-card,
.report-kpi-grid .report-kpi-card,
.report-kpi-grid .ht-kpi {
  display: flex !important;
  flex-direction: column;
  justify-content: center;
  min-height: 96px;
  padding: 16px 18px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  width: auto !important;
  max-width: none !important;
  box-sizing: border-box;
}

#hydraToolsShell .report-kpi-card .ht-kpi__label,
.report-kpi-card .ht-kpi__label,
.report-kpi-grid .ht-kpi__label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.2;
  margin-bottom: 8px;
  color: #9aa4b2;
}

#hydraToolsShell .report-kpi-card .ht-kpi__value,
.report-kpi-card .ht-kpi__value,
.report-kpi-grid .ht-kpi__value {
  display: block;
  margin-top: 0;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.1;
  color: #0f172a;
}

#hydraToolsShell .ht-report-wrap--wide {
  max-width: min(1840px, 95vw);
}

/* Legacy row wrapper — force grid if still rendered */
#hydraToolsShell .ht-kpi-row--report,
.ht-kpi-row--report {
  display: grid !important;
  grid-template-columns: repeat(8, minmax(120px, 1fr));
  gap: 10px;
}

#hydraToolsShell .ht-kpi-row--report > .report-kpi-card,
#hydraToolsShell .ht-kpi-row--report > .ht-kpi,
.ht-kpi-row--report > .report-kpi-card,
.ht-kpi-row--report > .ht-kpi {
  width: auto !important;
  max-width: none !important;
}

/* Suppress legacy week master-detail (sidebar + right panel) */
#hydraToolsShell .ht-master-detail--months {
  display: none !important;
}

/* Mobile action popover — see tools-hit.css; inline backup for cache */
body > .ht-mobile-action-menu,
#htMobileActionMenu.ht-mobile-action-menu {
  position: fixed;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  min-width: 180px;
  padding: 6px;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fffdf9;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
}

body > .ht-mobile-action-menu[hidden],
#htMobileActionMenu.ht-mobile-action-menu[hidden] {
  display: none !important;
}

body > .ht-mobile-action-menu .ht-menu-item,
#htMobileActionMenu .ht-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 42px;
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 0 12px;
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

body > .ht-mobile-action-menu .ht-menu-item:hover,
body > .ht-mobile-action-menu .ht-menu-item:active,
#htMobileActionMenu .ht-menu-item:hover,
#htMobileActionMenu .ht-menu-item:active {
  background: #fff3e8;
  color: #ea580c;
}

body > .ht-mobile-action-menu .ht-menu-item--danger,
#htMobileActionMenu .ht-menu-item--danger {
  color: #dc2626;
}

body > .ht-mobile-action-menu .ht-mobile-action-menu__divider,
#htMobileActionMenu .ht-mobile-action-menu__divider {
  height: 1px;
  margin: 4px 6px;
  background: rgba(15, 23, 42, 0.08);
}

@media (max-width: 1200px) {
  #hydraToolsShell .report-kpi-grid,
  #hydraToolsShell .report-kpi-grid--portfolio,
  .ht-tracker-shell .report-kpi-grid,
  .report-kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
  }

  #hydraToolsShell .ht-month-dash-grid,
  .ht-tracker-shell .ht-month-dash-grid,
  .ht-month-dash-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  #hydraToolsShell .ht-month-dash-grid.ht-desktop-only,
  .ht-tracker-shell .ht-month-dash-grid.ht-desktop-only,
  .ht-month-dash-grid.ht-desktop-only {
    display: none !important;
  }

  #hydraToolsShell .report-kpi-grid,
  #hydraToolsShell .report-kpi-grid--portfolio,
  .ht-tracker-shell .report-kpi-grid,
  .report-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  #hydraToolsShell .ht-month-dash-grid,
  .ht-tracker-shell .ht-month-dash-grid,
  .ht-month-dash-grid {
    grid-template-columns: 1fr;
  }
}
