/*
 * Financeiro — hierarchy-only refinement.
 * Scoped to the current Finance root so no other D.O Command Center module is affected.
 * No financial logic, data source, permission, route, or calculation is changed here.
 */

/* The Finance page currently owns this exact root class signature. */
div[class="mx-auto w-full max-w-[1600px] p-4 sm:p-6 space-y-5"] > div[class*="lg:grid-cols-[230px_minmax(0,1fr)]"] {
  display: block;
}

/* Replace the second vertical navigation with compact horizontal secondary navigation. */
div[class="mx-auto w-full max-w-[1600px] p-4 sm:p-6 space-y-5"] > div[class*="lg:grid-cols-[230px_minmax(0,1fr)]"] > aside {
  border: 0 !important;
  background: transparent !important;
  padding: 0 !important;
  border-radius: 0 !important;
}

div[class="mx-auto w-full max-w-[1600px] p-4 sm:p-6 space-y-5"] > div[class*="lg:grid-cols-[230px_minmax(0,1fr)]"] > aside > div:first-child,
div[class="mx-auto w-full max-w-[1600px] p-4 sm:p-6 space-y-5"] > div[class*="lg:grid-cols-[230px_minmax(0,1fr)]"] > aside > div:last-child {
  display: none;
}

div[class="mx-auto w-full max-w-[1600px] p-4 sm:p-6 space-y-5"] > div[class*="lg:grid-cols-[230px_minmax(0,1fr)]"] > aside > div.space-y-1 {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  background: hsl(var(--card));
  padding: 0.25rem;
}

div[class="mx-auto w-full max-w-[1600px] p-4 sm:p-6 space-y-5"] > div[class*="lg:grid-cols-[230px_minmax(0,1fr)]"] > aside > div.space-y-1::-webkit-scrollbar {
  display: none;
}

div[class="mx-auto w-full max-w-[1600px] p-4 sm:p-6 space-y-5"] > div[class*="lg:grid-cols-[230px_minmax(0,1fr)]"] > aside > div.space-y-1 > button {
  flex: 0 0 auto;
  width: auto !important;
  min-width: max-content;
  padding: 0.55rem 0.75rem !important;
  text-align: center !important;
}

div[class="mx-auto w-full max-w-[1600px] p-4 sm:p-6 space-y-5"] > div[class*="lg:grid-cols-[230px_minmax(0,1fr)]"] > aside > div.space-y-1 > button > div {
  justify-content: center;
}

div[class="mx-auto w-full max-w-[1600px] p-4 sm:p-6 space-y-5"] > div[class*="lg:grid-cols-[230px_minmax(0,1fr)]"] > aside > div.space-y-1 > button > p {
  display: none;
}

div[class="mx-auto w-full max-w-[1600px] p-4 sm:p-6 space-y-5"] > div[class*="lg:grid-cols-[230px_minmax(0,1fr)]"] > main {
  margin-top: 1rem;
}

/* Overview hierarchy: keep commitments, remove redundant shortcut panel from the primary surface. */
div[class="mx-auto w-full max-w-[1600px] p-4 sm:p-6 space-y-5"] main > section[class*="xl:grid-cols-2"] {
  grid-template-columns: minmax(0, 1fr) !important;
}

div[class="mx-auto w-full max-w-[1600px] p-4 sm:p-6 space-y-5"] main > section[class*="xl:grid-cols-2"] > div:nth-child(2) {
  display: none;
}

/* Historical attached costs remain visible but clearly secondary, not a fresh obligation. */
div[class="mx-auto w-full max-w-[1600px] p-4 sm:p-6 space-y-5"] main > section[class*="xl:grid-cols-2"] > div:first-child > div[class*="grid-cols-2"] > div:nth-child(4) {
  opacity: 0.55;
}

/* Categories belong to Reports: keep a compact handoff instead of a large duplicate grid on Overview. */
div[class="mx-auto w-full max-w-[1600px] p-4 sm:p-6 space-y-5"] main > section[class*="overflow-hidden"] > div.grid {
  display: none;
}

div[class="mx-auto w-full max-w-[1600px] p-4 sm:p-6 space-y-5"] main > section[class*="overflow-hidden"] > div:first-child {
  border-bottom: 0 !important;
}

/* Let tabs distribute evenly once there is enough horizontal room. */
@media (min-width: 768px) {
  div[class="mx-auto w-full max-w-[1600px] p-4 sm:p-6 space-y-5"] > div[class*="lg:grid-cols-[230px_minmax(0,1fr)]"] > aside > div.space-y-1 > button {
    flex: 1 1 0;
    min-width: 0;
  }
}

/* Small screens: prevent clipped amounts and keep the page itself free of horizontal overflow. */
@media (max-width: 520px) {
  div[class="mx-auto w-full max-w-[1600px] p-4 sm:p-6 space-y-5"] main div[class*="grid-cols-2"],
  div[class="mx-auto w-full max-w-[1600px] p-4 sm:p-6 space-y-5"] main section div[class*="grid-cols-2"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}
