/* TIM-OE Mobile Final Layout 2026-05-02
   Correct file for phone header + dashboard mobile layout.
   Replaces older mobile patch files. No login/auth/API logic is changed.
*/

@media (max-width: 768px) {
  html, body {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  body.timoe-vibiz-admin [data-timoe-shell="vibiz"] {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    gap: 0 !important;
  }

  body.timoe-vibiz-admin [data-timoe-main="vibiz"] {
    width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    transform: none !important;
  }

  body.timoe-vibiz-admin [data-timoe-main="vibiz"] > div {
    padding-top: 8px !important;
  }

  body.timoe-vibiz-admin [data-timoe-main="vibiz"] > div > div[class*="px-3"] {
    padding-left: 8px !important;
    padding-right: 8px !important;
    padding-bottom: 88px !important;
  }

  body.timoe-vibiz-admin [data-timoe-main="vibiz"] > div > div[class*="px-3"] > div[class*="rounded-[30px]"] {
    padding: 8px !important;
    border-radius: 24px !important;
  }

  /* Sidebar opens as overlay and does not push header/content. */
  body.timoe-vibiz-admin aside[data-timoe-sidebar="vibiz"],
  body.timoe-vibiz-admin [data-timoe-sidebar="vibiz"] {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    width: min(86vw, 320px) !important;
    max-width: min(86vw, 320px) !important;
    height: 100dvh !important;
    z-index: 130 !important;
    margin: 0 !important;
    flex: none !important;
    overflow: visible !important;
  }

  body.timoe-vibiz-admin aside[data-timoe-sidebar="vibiz"] > div.sticky,
  body.timoe-vibiz-admin [data-timoe-sidebar="vibiz"] > div.sticky,
  body.timoe-vibiz-admin aside[data-timoe-sidebar="vibiz"] > div,
  body.timoe-vibiz-admin [data-timoe-sidebar="vibiz"] > div {
    width: min(86vw, 320px) !important;
    max-width: min(86vw, 320px) !important;
    min-height: 100dvh !important;
    height: 100dvh !important;
    margin: 0 !important;
    border-radius: 0 24px 24px 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    box-shadow: 0 24px 70px rgba(2,6,23,.42) !important;
  }

  body.timoe-vibiz-admin aside[data-timoe-sidebar="vibiz"] [class*="cursor-col-resize"],
  body.timoe-vibiz-admin [data-timoe-sidebar="vibiz"] [class*="cursor-col-resize"] {
    display: none !important;
  }

  /* Header final */
  body.timoe-vibiz-admin .tmf-header,
  body.timoe-vibiz-admin header.sticky,
  body.timoe-vibiz-admin main > div > div:first-child {
    position: sticky !important;
    top: 8px !important;
    z-index: 95 !important;
    width: auto !important;
    max-width: calc(100vw - 16px) !important;
    margin: 8px 8px 10px 8px !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
    transform: none !important;
  }

  body.timoe-vibiz-admin .tmf-card,
  body.timoe-vibiz-admin header.sticky > div,
  body.timoe-vibiz-admin main > div > div:first-child > div {
    width: 100% !important;
    min-width: 0 !important;
    border-radius: 24px !important;
    padding: 10px 12px !important;
    overflow: visible !important;
    background:
      radial-gradient(circle at 100% 0%, rgba(96,165,250,.13), transparent 24%),
      linear-gradient(135deg, rgba(255,255,255,.94), rgba(248,251,255,.91) 60%, rgba(244,249,255,.92)) !important;
    border: 1px solid rgba(226,232,240,.74) !important;
    box-shadow: 0 12px 34px rgba(15,23,42,.075), inset 0 1px 0 rgba(255,255,255,.88) !important;
    backdrop-filter: blur(14px) saturate(125%) !important;
  }

  body.timoe-vibiz-admin .tmf-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
  }

  body.timoe-vibiz-admin .tmf-left {
    min-width: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    overflow: hidden !important;
  }

  body.timoe-vibiz-admin .tmf-menu,
  body.timoe-vibiz-admin .tmf-left > button:first-child {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 16px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(255,255,255,.88) !important;
    border: 1px solid rgba(148,163,184,.20) !important;
    color: #0f766e !important;
    box-shadow: 0 8px 20px rgba(15,23,42,.06) !important;
    flex: 0 0 42px !important;
    position: relative !important;
    z-index: 5 !important;
    pointer-events: auto !important;
  }

  body.timoe-vibiz-admin .tmf-title {
    display: block !important;
    min-width: 0 !important;
    max-width: 104px !important;
    overflow: hidden !important;
  }

  body.timoe-vibiz-admin .tmf-title h1,
  body.timoe-vibiz-admin .tmf-title h2,
  body.timoe-vibiz-admin .tmf-title [class*="text-3xl"],
  body.timoe-vibiz-admin .tmf-title [class*="text-4xl"] {
    display: block !important;
    margin: 0 !important;
    max-width: 104px !important;
    font-size: 1.05rem !important;
    line-height: 1.15 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  body.timoe-vibiz-admin .tmf-title p,
  body.timoe-vibiz-admin .tmf-title .text-xs,
  body.timoe-vibiz-admin .tmf-title .text-sm,
  body.timoe-vibiz-admin .tmf-title span:not(:first-child) {
    display: none !important;
  }

  body.timoe-vibiz-admin .tmf-controls {
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 7px !important;
    min-width: 0 !important;
    overflow: visible !important;
    position: relative !important;
    z-index: 30 !important;
  }

  body.timoe-vibiz-admin .tmf-controls > * {
    flex: 0 0 auto !important;
    min-width: 0 !important;
    position: relative !important;
    overflow: visible !important;
  }

  body.timoe-vibiz-admin .tmf-theme {
    z-index: 50 !important;
  }

  body.timoe-vibiz-admin .tmf-theme > button,
  body.timoe-vibiz-admin .tmf-theme > a,
  body.timoe-vibiz-admin .tmf-theme [role="button"] {
    width: 104px !important;
    min-width: 104px !important;
    max-width: 104px !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 11px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: .74rem !important;
    font-weight: 800 !important;
    letter-spacing: .10em !important;
    pointer-events: auto !important;
    position: relative !important;
    z-index: 51 !important;
  }

  body.timoe-vibiz-admin .tmf-language > button,
  body.timoe-vibiz-admin .tmf-language > a,
  body.timoe-vibiz-admin .tmf-language [role="button"] {
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
  }

  body.timoe-vibiz-admin .tmf-language .text-xs,
  body.timoe-vibiz-admin .tmf-language .text-sm,
  body.timoe-vibiz-admin .tmf-language small {
    display: none !important;
  }

  body.timoe-vibiz-admin .tmf-profile > button,
  body.timoe-vibiz-admin .tmf-profile > a,
  body.timoe-vibiz-admin .tmf-profile [role="button"] {
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
  }

  body.timoe-vibiz-admin .tmf-profile .text-xs,
  body.timoe-vibiz-admin .tmf-profile .text-sm,
  body.timoe-vibiz-admin .tmf-profile svg:last-child {
    display: none !important;
  }

  body.timoe-vibiz-admin .tmf-header button,
  body.timoe-vibiz-admin .tmf-header a {
    pointer-events: auto !important;
  }

  /* Theme dropdown directly below the Ngjyrat button. */
  body.timoe-vibiz-admin .tmf-theme .absolute.right-0.mt-3,
  body.timoe-vibiz-admin .tmf-theme div[class*="absolute"][class*="right-0"][class*="mt-3"],
  body.timoe-vibiz-admin .tmf-theme .timoe-theme-floating-popover,
  body.timoe-vibiz-admin .tmf-theme .timoe-theme-popup-fixed,
  body.timoe-vibiz-admin .tmf-theme div[class*="w-56"] {
    position: absolute !important;
    left: 0 !important;
    right: auto !important;
    top: calc(100% + 8px) !important;
    margin-top: 0 !important;
    width: min(14rem, calc(100vw - 24px)) !important;
    max-width: calc(100vw - 24px) !important;
    max-height: 70vh !important;
    overflow-y: auto !important;
    z-index: 9999 !important;
    transform: none !important;
    border-radius: 20px !important;
  }

  /* Dashboard mobile */
  body.timoe-dashboard-page .tim-premium-hero,
  body.timoe-vibiz-admin .tim-premium-hero {
    border-radius: 22px !important;
    padding: 1rem !important;
  }

  body.timoe-dashboard-page .tim-premium-hero h2,
  body.timoe-vibiz-admin .tim-premium-hero h2 {
    font-size: 1.2rem !important;
    line-height: 1.2 !important;
  }

  body.timoe-dashboard-page .tim-premium-hero-actions,
  body.timoe-vibiz-admin .tim-premium-hero-actions {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    align-items: stretch !important;
  }

  body.timoe-dashboard-page .tim-premium-role,
  body.timoe-vibiz-admin .tim-premium-role,
  body.timoe-dashboard-page .tim-premium-hero-actions button,
  body.timoe-vibiz-admin .tim-premium-hero-actions button {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 48px !important;
    justify-content: center !important;
  }

  body.timoe-dashboard-page .tim-premium-kpis,
  body.timoe-vibiz-admin .tim-premium-kpis {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  body.timoe-dashboard-page .tim-premium-kpi,
  body.timoe-vibiz-admin .tim-premium-kpi {
    min-width: 0 !important;
    min-height: 108px !important;
    padding: .85rem !important;
  }

  body.timoe-dashboard-page .tim-premium-grid-main,
  body.timoe-dashboard-page .tim-premium-grid-end,
  body.timoe-vibiz-admin .tim-premium-grid-main,
  body.timoe-vibiz-admin .tim-premium-grid-end {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
}

@media (max-width: 390px) {
  body.timoe-vibiz-admin .tmf-title {
    max-width: 70px !important;
  }
  body.timoe-vibiz-admin .tmf-title h1,
  body.timoe-vibiz-admin .tmf-title h2 {
    max-width: 70px !important;
  }
  body.timoe-vibiz-admin .tmf-theme > button,
  body.timoe-vibiz-admin .tmf-theme > a,
  body.timoe-vibiz-admin .tmf-theme [role="button"] {
    width: 96px !important;
    min-width: 96px !important;
    max-width: 96px !important;
    padding: 0 9px !important;
    font-size: .70rem !important;
  }
}
