
/* FLEX desktop-friendly dashboard patch */

@media (min-width: 760px) {
  html,
  body {
    min-width: 1180px !important;
    overflow-x: auto !important;
  }

  body {
    background-size: auto !important;
  }

  /* Keep dashboard shell as desktop layout */
  body > div,
  .admin-shell,
  .dashboard-shell,
  .app-shell,
  .layout,
  .wrapper {
    max-width: none !important;
  }

  aside,
  nav.sidebar,
  .sidebar,
  .admin-sidebar,
  [class*="sidebar"] {
    flex: 0 0 250px !important;
    width: 250px !important;
    min-width: 250px !important;
    max-width: 250px !important;
  }

  main,
  .main,
  .content,
  .admin-content,
  [class*="content"] {
    min-width: 900px !important;
  }

  /* Header/top actions must stay horizontal */
  header,
  .topbar,
  .admin-topbar,
  .toolbar,
  .top-actions,
  .page-actions,
  [class*="topbar"],
  [class*="toolbar"] {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 10px !important;
  }

  header a,
  header button,
  .topbar a,
  .topbar button,
  .admin-topbar a,
  .admin-topbar button,
  .toolbar a,
  .toolbar button {
    width: auto !important;
    max-width: none !important;
    white-space: nowrap !important;
    flex: 0 0 auto !important;
  }

  /* Search and create area */
  input[type="search"],
  input[placeholder*="Search"],
  input[placeholder*="search"] {
    width: 280px !important;
    max-width: 340px !important;
    min-width: 240px !important;
    flex: 0 0 auto !important;
  }

  /* KPI cards */
  .stats,
  .kpis,
  .cards,
  .grid,
  [class*="stats"],
  [class*="kpi"] {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(180px, 1fr)) !important;
    gap: 14px !important;
  }

  /* Link list card */
  .link-row,
  .links-row,
  tr,
  .fdp-row-ready,
  .fda-row-ready {
    overflow: visible !important;
  }

  .fda-row-ready {
    min-height: 68px !important;
    padding-right: 82px !important;
  }

  .fda-action-wrap {
    right: 22px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
  }

  .fda-menu {
    right: 0 !important;
    left: auto !important;
    top: 54px !important;
  }

  .fda-copy-icon {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
  }

  .fda-copy-icon svg {
    width: 19px !important;
    height: 19px !important;
  }

  /* Prevent buttons from stretching full width on small desktop */
  a,
  button {
    max-width: none;
  }

  /* Hide accidental mobile hamburger on desktop/tablet */
  .mobile-menu,
  .hamburger,
  .menu-toggle,
  [class*="hamburger"],
  [class*="menu-toggle"] {
    display: none !important;
  }
}

/* Tablet/small desktop: allow horizontal scroll instead of broken mobile layout */
@media (min-width: 760px) and (max-width: 1180px) {
  body {
    min-width: 1180px !important;
  }

  main,
  .main,
  .content,
  .admin-content,
  [class*="content"] {
    min-width: 900px !important;
  }
}

/* Real mobile only */
@media (max-width: 759px) {
  html,
  body {
    min-width: 0 !important;
    overflow-x: hidden !important;
  }

  .fda-copy-icon {
    width: 30px !important;
    height: 30px !important;
  }
}
