/* ============================================================
   HI-PRO TOOL HUB — Responsive rules
   ============================================================ */

/* ------------------------------------------------------------ */
/* Large desktop tightening                                      */
/* ------------------------------------------------------------ */

@media (max-width: 1280px) {
  :root { --gutter: 22px; }

  .hero { padding: 28px; gap: 24px; }
  .orb { width: min(290px, 72vw); }
  .orb__tag--bl { display: none; }
}

/* ------------------------------------------------------------ */
/* Small desktop / large tablet                                  */
/* ------------------------------------------------------------ */

@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .footer__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }

  .file-row { grid-template-columns: 42px minmax(0, 1fr) 120px 96px; }
  .file-row__col--date { display: none; }
}

/* ------------------------------------------------------------ */
/* Tablet — sidebar becomes drawer                               */
/* ------------------------------------------------------------ */

@media (max-width: 1024px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(292px, 84vw);
    height: 100vh;
    transform: translateX(-104%);
    transition: transform var(--dur) var(--ease);
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.55);
  }

  .sidebar.is-open { transform: none; }

  body.nav-open .app-shell::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 39;
    background: rgba(4, 6, 9, 0.66);
    backdrop-filter: blur(3px);
  }

  .only-mobile { display: grid !important; }

  .topbar { gap: 10px; padding: 12px 18px; }
  .topbar__cta { display: none; }
  .search { max-width: none; }
  .search__kbd { display: none; }
  .sync-pill { padding: 0 12px; }

  .view { padding: 22px 18px 110px; }

  .bottom-nav {
    display: flex;
    align-items: stretch;
    gap: 4px;
  }

  .footer { padding-bottom: 108px; }
}

/* ------------------------------------------------------------ */
/* Small tablet / large phone                                    */
/* ------------------------------------------------------------ */

@media (max-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    padding: 24px;
  }

  .hero__art { order: -1; min-height: 300px; }
  .logo-stage { width: min(270px, 74vw); }
  .logo-slide img { width: min(176px, 100%); }
  .orb__tag--tl { top: 0; left: 2%; }
  .orb__tag--br { bottom: 4%; right: 2%; }

  .file-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

/* ------------------------------------------------------------ */
/* Phone                                                         */
/* ------------------------------------------------------------ */

@media (max-width: 720px) {
  body { font-size: 14.5px; }

  .topbar { flex-wrap: wrap; padding: 10px 14px; min-height: auto; }
  .topbar__actions { margin-left: 0; width: 100%; justify-content: space-between; }
  .search { order: 2; width: 100%; flex: 1 1 100%; }
  .topbar__actions { order: 3; }

  .view { padding: 18px 14px 112px; }
  .page { gap: 20px; }

  .hero { padding: 20px 18px; border-radius: var(--radius); gap: 18px; }
  .hero__title { font-size: clamp(27px, 8vw, 36px); }
  .hero__sub { font-size: 13.5px; }
  .hero__actions .btn { flex: 1 1 auto; }

  .stats { gap: 10px; }
  .stat { padding: 14px; }
  .stat__icon { width: 32px; height: 32px; margin-bottom: 10px; }
  .stat__icon svg { width: 16px; height: 16px; }
  .stat__value { font-size: 22px; }

  .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cat-card { padding: 14px; }

  .file-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }

  .toolbar { padding: 12px; gap: 10px; }
  .toolbar__row { gap: 8px; }
  .toolbar__row .select { flex: 1 1 auto; min-width: 0; }

  .chips {
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 90%, transparent 100%);
    mask-image: linear-gradient(90deg, #000 0, #000 90%, transparent 100%);
  }

  .file-list { border-radius: var(--radius-sm); }
  .file-row {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    row-gap: 4px;
    padding: 12px;
  }
  .file-row__col { display: none; }
  .file-row .file-icon { width: 38px; height: 38px; }
  .file-row__name .name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

  .detail__grid { grid-template-columns: minmax(0, 1fr); }
  .modal__panel { padding: 20px; border-radius: var(--radius); }
  .detail__actions .btn { flex: 1 1 100%; }

  .footer__grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .footer__base { flex-direction: column; gap: 6px; }

  .toasts { left: 14px; right: 14px; bottom: 96px; }
  .toast { max-width: none; width: 100%; }

  .support-card { padding: 14px; }
}

/* ------------------------------------------------------------ */
/* Very small phone                                              */
/* ------------------------------------------------------------ */

@media (max-width: 420px) {
  .cat-grid { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: minmax(0, 1fr); }
  .sync-pill span:not(.sync-pill__dot) { max-width: 132px; overflow: hidden; text-overflow: ellipsis; }
  .bottom-nav__item span { font-size: 9px; }
  .acc__body { padding-left: 18px; }
}

/* ------------------------------------------------------------ */
/* Overflow guards                                               */
/* ------------------------------------------------------------ */

html,
body { max-width: 100%; }

@media (max-width: 1024px) {
  .topbar > * { min-width: 0; }
  .topbar__actions { min-width: 0; flex-wrap: wrap; }
  .search { min-width: 0; }
  .sync-pill { min-width: 0; }
  .bottom-nav__item { min-width: 0; }
  .bottom-nav__item span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ------------------------------------------------------------ */
/* Reseller layout and six-item bottom nav                       */
/* ------------------------------------------------------------ */

@media (max-width: 720px) {
  .bottom-nav { padding: 6px; gap: 2px; }
  .bottom-nav__item { padding: 6px 2px; font-size: 9px; gap: 2px; }
  .bottom-nav__item svg { width: 19px; height: 19px; }

  .reseller-grid { grid-template-columns: minmax(0, 1fr); }
  .reseller-join { flex-direction: column; align-items: flex-start; }
  .reseller-join .btn { width: 100%; }
}

/* ------------------------------------------------------------ */
/* Print                                                         */
/* ------------------------------------------------------------ */

@media print {
  .sidebar,
  .topbar,
  .bottom-nav,
  .footer,
  .toasts,
  .bg-layer { display: none !important; }

  body { background: #fff; color: #111; }
  .app-shell { display: block; }
  .panel, .file-card { box-shadow: none; border: 1px solid #ccc; }
}
