/* RC4-7: lightweight mobile and loading refinements. */
body.sl-rc47-ready img {
  max-width: 100%;
}

body.trDashboardRedesign .trMainPillNavWrap,
body.trDashboardRedesign .trMainPillNav,
body.trDashboardRedesign .topbar,
body.trDashboardRedesign .header {
  max-width: 100%;
}

.slAiCenterDashboard,
.slAiCenterPanel,
.slNotificationCenter,
.slNotificationPanel,
.slKakaoPrepPanel,
.sl-ai-highlight,
.sl-ai-photo,
.sl-director-assistant,
.sl-gpt-briefing,
.sl-ai-counseling,
.sl-ai-note {
  max-width: 100%;
  overflow-wrap: anywhere;
}

@media (max-width: 1024px) {
  body.trDashboardRedesign .trDashTop {
    grid-template-columns: 1fr 1fr !important;
  }

  body.trDashboardRedesign .trDashMain,
  body.trDashboardRedesign .trDashGrid,
  body.trDashboardRedesign .trDashSectionGrid,
  body.trDashboardRedesign .slAiCenterDashboard {
    grid-template-columns: 1fr !important;
  }

  body.trDashboardRedesign .trMainPillNavWrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 6px;
  }

  body.trDashboardRedesign .trMainPillNav {
    min-width: max-content;
  }

  body.trDashboardRedesign .trMainPillNav button {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

@media (max-width: 720px) {
  body.trDashboardRedesign .app {
    padding-left: 10px !important;
    padding-right: 10px !important;
    padding-bottom: 96px !important;
  }

  body.trDashboardRedesign .header,
  body.trDashboardRedesign .trDashTop,
  body.trDashboardRedesign .trDashCardGrid,
  body.trDashboardRedesign .trDashMiniGrid,
  body.trDashboardRedesign .homeCategoryGrid,
  .slp-summary-grid,
  .slp-day-flow,
  .slp-menu-grid,
  .sl-notification-grid,
  .sl-payment-grid,
  .sl-album-grid {
    grid-template-columns: 1fr !important;
  }

  body.trDashboardRedesign .trDashWelcome,
  body.trDashboardRedesign .trDashMetric,
  body.trDashboardRedesign .trDashPanel,
  body.trDashboardRedesign .trDashCard,
  .slAiCenterPanel,
  .slNotificationCenter,
  .slKakaoPrepPanel {
    min-width: 0;
  }

  body.trDashboardRedesign .trDashWelcome {
    min-height: auto;
    padding: 18px;
  }

  body.trDashboardRedesign .trDashMetric {
    min-height: auto;
    padding: 16px;
  }

  body.trDashboardRedesign .trDashMetric b {
    font-size: clamp(1.8rem, 9vw, 2.8rem);
  }

  body.trDashboardRedesign .trMainPillNavWrap,
  body.trDashboardRedesign .topbar,
  body.trDashboardRedesign .headerActions {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.trDashboardRedesign button,
  body.trDashboardRedesign .btn,
  body.trDashboardRedesign input,
  body.trDashboardRedesign select,
  body.trDashboardRedesign textarea {
    max-width: 100%;
  }

  .slp-photo-strip,
  .slp-photo-grid,
  .albumGrid,
  .photoGrid {
    grid-template-columns: 1fr !important;
  }

  .slp-photo-strip img,
  .albumGrid img,
  .photoGrid img,
  .sl-ai-photo-item img {
    width: 100%;
    height: auto;
    object-fit: cover;
  }
}

/* Dashboard desktop restore: keep mobile refinements off the PC dashboard only. */
@media (min-width: 1024px) {
  body.dashboard-active {
    overflow-x: hidden;
  }

  body.dashboard-active.mobile,
  body.dashboard-active.mobile-mode,
  body.dashboard-active.compact,
  body.dashboard-active.app-mobile,
  body.dashboard-active.narrow-layout,
  body.dashboard-active.centered-layout {
    max-width: none !important;
  }

  body.dashboard-active .slAdminSidebar,
  body.dashboard-active .sidebar,
  body.dashboard-active .admin-sidebar,
  body.dashboard-active .side-nav,
  body.dashboard-active #sidebar,
  body.dashboard-active #adminSidebar {
    display: block !important;
    visibility: visible !important;
    transform: none !important;
    opacity: 1 !important;
  }

  body.dashboard-active .slAdminSidebar {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 252px !important;
    max-width: 252px !important;
    margin: 0 !important;
    overflow-y: auto !important;
    z-index: 80 !important;
  }

  body.dashboard-active .app,
  body.dashboard-active .sportlink-app,
  body.dashboard-active .app-shell,
  body.dashboard-active .admin-shell,
  body.dashboard-active .dashboard-shell {
    width: calc(100vw - 252px) !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 0 0 252px !important;
    padding-left: 22px !important;
    padding-right: 22px !important;
    box-sizing: border-box !important;
  }

  body.dashboard-active .admin-main,
  body.dashboard-active .dashboard-main,
  body.dashboard-active .app-main,
  body.dashboard-active .main-content,
  body.dashboard-active .page-content,
  body.dashboard-active .content-wrap,
  body.dashboard-active .dashboard-wrap,
  body.dashboard-active main,
  body.dashboard-active #home,
  body.dashboard-active .trDash {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }

  body.dashboard-active main:not(#home),
  body.dashboard-active #settings,
  body.dashboard-active #gameHome,
  body.dashboard-active #classToolReady {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none !important;
  }

  body.dashboard-active #home {
    display: block !important;
    visibility: visible !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  body.dashboard-active #home > :not(.trDash) {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none !important;
  }

  body.dashboard-active .header,
  body.dashboard-active .topbar,
  body.dashboard-active .trMainPillNavWrap {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  body.dashboard-active .trDashWorkGrid {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }

  body.dashboard-active .trDashHubGrid {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 12px !important;
    overflow: visible !important;
  }

  body.dashboard-active .trDashOpsGrid {
    display: grid !important;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, .85fr) minmax(0, .9fr) minmax(0, .85fr) !important;
    gap: 14px !important;
  }

  body.dashboard-active .dashboard-grid,
  body.dashboard-active .dashboard-cards,
  body.dashboard-active .home-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 18px !important;
  }

  body.dashboard-active .bottom-nav,
  body.dashboard-active .mobile-bottom-nav,
  body.dashboard-active .floating-bottom-nav,
  body.dashboard-active .mobile-nav,
  body.dashboard-active #bottomNav,
  body.dashboard-active .bottomDock,
  body.dashboard-active .dock,
  body.dashboard-active .navDock,
  body.dashboard-active .tkdPremiumDock,
  body.dashboard-active .tkdPremiumFab,
  body.dashboard-active .trAutoFab,
  body.dashboard-active .trPayPgFab,
  body.dashboard-active #sportlinkBuildBadge {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

.slMobileAdminHeader,
.slMobileMenuOverlay {
  display: none;
}

@media (max-width: 768px) {
  body.dashboard-active {
    background: #f6f8fc !important;
    overflow-x: hidden;
  }

  body.dashboard-active .slMobileAdminHeader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100030;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    align-items: center;
    gap: 8px;
    min-height: 56px;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid #e6edf8;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
    backdrop-filter: blur(14px);
  }

  body.dashboard-active .slMobileMenuButton,
  body.dashboard-active .slMobileSettingsButton {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 !important;
    border: 1px solid #dbeafe !important;
    border-radius: 14px !important;
    background: #eff6ff !important;
    color: #1d4ed8 !important;
    box-shadow: none !important;
    font-size: 20px !important;
    line-height: 1 !important;
  }

  body.dashboard-active .slMobileAdminTitle {
    min-width: 0;
    display: grid;
    gap: 2px;
  }

  body.dashboard-active .slMobileAdminTitle strong {
    overflow: hidden;
    color: #0f172a;
    font-size: 16px;
    font-weight: 1000;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.dashboard-active .slMobileAdminTitle span {
    overflow: hidden;
    color: #64748b;
    font-size: 12px;
    font-weight: 850;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.dashboard-active .slMobileMenuOverlay {
    position: fixed;
    inset: 0;
    z-index: 100020;
    display: none;
    width: 100%;
    min-height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(15, 23, 42, 0.42);
    box-shadow: none;
  }

  body.dashboard-active.slMobileMenuOpen .slMobileMenuOverlay {
    display: block;
  }

  body.dashboard-active .slAdminSidebar {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    z-index: 100040 !important;
    display: block !important;
    width: min(82vw, 292px) !important;
    max-width: 292px !important;
    padding: calc(18px + env(safe-area-inset-top, 0px)) 12px 18px !important;
    overflow-y: auto !important;
    transform: translateX(-105%) !important;
    transition: transform 0.22s ease !important;
    box-shadow: 18px 0 44px rgba(15, 23, 42, 0.2) !important;
  }

  body.dashboard-active.slMobileMenuOpen .slAdminSidebar {
    transform: translateX(0) !important;
  }

  body.dashboard-active .slAdminSidebarBrand {
    height: 38px;
    margin-bottom: 10px;
  }

  body.dashboard-active .slAdminBrandMark {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }

  body.dashboard-active .slAdminSidebarBrand strong {
    font-size: 17px;
  }

  body.dashboard-active .slAdminSideGroup {
    padding: 8px 0;
  }

  body.dashboard-active .slAdminSideGroup summary {
    min-height: 32px;
    padding: 0 6px 5px;
    font-size: 13px;
  }

  body.dashboard-active .slAdminSideItems {
    gap: 2px;
  }

  body.dashboard-active .slAdminSideItems button {
    min-height: 34px !important;
    grid-template-columns: 22px minmax(0, 1fr) !important;
    gap: 6px !important;
    padding: 7px 9px !important;
    border-radius: 9px !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
  }

  body.dashboard-active .slAdminSideItems button span {
    width: 22px;
    height: 22px;
    font-size: 13px;
  }

  body.dashboard-active .header,
  body.dashboard-active .topbar,
  body.dashboard-active .trMainPillNavWrap,
  body.dashboard-active .tkdUpgradeBar,
  body.dashboard-active .tkdPremiumDock,
  body.dashboard-active .bottomDock,
  body.dashboard-active .dock,
  body.dashboard-active .navDock,
  body.dashboard-active .trAutoFab,
  body.dashboard-active .trPayPgFab,
  body.dashboard-active .tkdPremiumFab {
    display: none !important;
  }

  body.dashboard-active .app {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: calc(68px + env(safe-area-inset-top, 0px)) 10px calc(18px + env(safe-area-inset-bottom, 0px)) !important;
    box-sizing: border-box !important;
  }

  body.dashboard-active #home,
  body.dashboard-active .trDash {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
  }

  body.dashboard-active .trDash {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
  }

  body.dashboard-active .trDashHero {
    order: 1;
  }

  body.dashboard-active .trDashWorkPanel {
    order: 2;
  }

  body.dashboard-active .trDashHubGrid {
    order: 3;
  }

  body.dashboard-active .trOwnerSummaryPanel {
    order: 4;
  }

  body.dashboard-active .trDashOpsGrid {
    order: 5;
  }

  body.dashboard-active .trDashCta {
    order: 6;
  }

  body.dashboard-active .trDashHero,
  body.dashboard-active .trDashWorkPanel,
  body.dashboard-active .trDashSection,
  body.dashboard-active .trOwnerSummaryPanel,
  body.dashboard-active .trDashCta {
    border-radius: 16px !important;
    padding: 14px !important;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.055) !important;
  }

  body.dashboard-active .trDashHero {
    min-height: 0 !important;
    grid-template-columns: 1fr !important;
  }

  body.dashboard-active .trDashLogoBig,
  body.dashboard-active .trDashHeroMeta {
    display: none !important;
  }

  body.dashboard-active .trDashWelcomeText,
  body.dashboard-active .trDashWelcomeText h2 {
    min-width: 0;
  }

  body.dashboard-active .trDashWelcomeText h2,
  body.dashboard-active .trDashHero h2 {
    margin: 0 0 5px !important;
    font-size: 20px !important;
    line-height: 1.18 !important;
  }

  body.dashboard-active .trDashWelcomeText p,
  body.dashboard-active .trDashHero p,
  body.dashboard-active .trDashCta span {
    display: -webkit-box;
    overflow: hidden;
    margin: 0 !important;
    color: #64748b !important;
    font-size: 13px !important;
    line-height: 1.35 !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  body.dashboard-active .trDashWelcomeSummary {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px !important;
    margin-top: 12px !important;
  }

  body.dashboard-active .trDashWelcomeSummary span {
    min-width: 0;
    padding: 9px !important;
    border-radius: 12px !important;
  }

  body.dashboard-active .trDashWelcomeSummary em,
  body.dashboard-active .trDashWelcomeSummary b {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.dashboard-active .trDashSectionHead,
  body.dashboard-active .trOwnerSummaryHead {
    gap: 8px !important;
    margin-bottom: 10px !important;
  }

  body.dashboard-active .trDashSectionIcon {
    width: 32px !important;
    height: 32px !important;
    font-size: 14px !important;
  }

  body.dashboard-active .trDashSection h3,
  body.dashboard-active .trOwnerSummaryHead h3 {
    font-size: 17px !important;
    line-height: 1.2 !important;
  }

  body.dashboard-active .trDashMoreInline {
    font-size: 12px !important;
    white-space: nowrap;
  }

  body.dashboard-active .trDashWorkGrid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  body.dashboard-active .trDashMetric {
    min-height: 72px !important;
    height: auto !important;
    padding: 10px !important;
    border-radius: 14px !important;
  }

  body.trBrandSystem.slDashboardUxRenewal.dashboard-active .trDashWorkGrid button.trDashMetric,
  body.slDashboardUxRenewal.dashboard-active .trDashWorkGrid button.trDashMetric,
  body.trBrandSystem.slDashboardUxRenewal.dashboard-active .trDashWorkGrid .trDashMetric,
  body.slDashboardUxRenewal.dashboard-active .trDashWorkGrid .trDashMetric {
    min-height: 72px !important;
    height: auto !important;
    display: grid !important;
    grid-template-rows: auto auto auto !important;
    align-content: center !important;
    gap: 4px !important;
    padding: 10px !important;
    border-radius: 14px !important;
  }

  body.dashboard-active .trDashMetricIcon {
    width: 30px !important;
    min-width: 30px !important;
    height: 30px !important;
    min-height: 30px !important;
    font-size: 15px !important;
  }

  body.dashboard-active .trDashMetricTop {
    gap: 6px !important;
    min-height: 0 !important;
  }

  body.dashboard-active .trDashMetricTop span:last-child,
  body.dashboard-active .trDashMetric b,
  body.dashboard-active .trDashMetric small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.dashboard-active .trDashMetricTop span:last-child {
    font-size: 11px !important;
  }

  body.trBrandSystem.slDashboardUxRenewal.dashboard-active .trDashMetricTop,
  body.slDashboardUxRenewal.dashboard-active .trDashMetricTop {
    min-height: 0 !important;
    font-size: 11px !important;
  }

  body.dashboard-active .trDashMetric b {
    margin-top: 4px !important;
    font-size: 20px !important;
    min-height: 0 !important;
    line-height: 1.1 !important;
  }

  body.trBrandSystem.slDashboardUxRenewal.dashboard-active .trDashMetric b,
  body.slDashboardUxRenewal.dashboard-active .trDashMetric b {
    min-height: 0 !important;
    font-size: 20px !important;
    line-height: 1.1 !important;
  }

  body.dashboard-active .trDashMetric small {
    font-size: 11px !important;
  }

  body.trBrandSystem.slDashboardUxRenewal.dashboard-active .trDashMetric small,
  body.slDashboardUxRenewal.dashboard-active .trDashMetric small {
    white-space: nowrap !important;
    font-size: 11px !important;
  }

  body.dashboard-active .trDashHubGrid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  body.dashboard-active .trDashHubCard {
    min-height: 76px !important;
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) 22px !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 10px 12px !important;
    border-radius: 16px !important;
  }

  body.dashboard-active .trDashHubIcon {
    width: 42px !important;
    height: 42px !important;
    font-size: 20px !important;
  }

  body.dashboard-active .trDashHubText {
    min-width: 0;
  }

  body.dashboard-active .trDashHubText b,
  body.dashboard-active .trDashHubText small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.dashboard-active .trDashHubText b {
    font-size: 15px !important;
    line-height: 1.2 !important;
  }

  body.dashboard-active .trDashHubText small {
    font-size: 12px !important;
    line-height: 1.25 !important;
  }

  body.dashboard-active .trDashHubArrow {
    font-size: 22px !important;
  }

  body.dashboard-active .trOwnerSummaryGrid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  body.dashboard-active .trOwnerSummaryItem {
    min-height: 68px !important;
    padding: 10px !important;
    border-radius: 14px !important;
  }

  body.dashboard-active .trOwnerSummaryItem span {
    width: 30px !important;
    height: 30px !important;
    font-size: 15px !important;
  }

  body.dashboard-active .trOwnerSummaryItem small,
  body.dashboard-active .trOwnerSummaryItem b {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.dashboard-active .trOwnerSummaryItem b {
    font-size: 20px !important;
  }

  body.dashboard-active .trDashOpsGrid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  body.dashboard-active .trDashOpsGrid .trDashSection:nth-child(n+3) {
    display: none !important;
  }

  body.dashboard-active .trDashTabs {
    display: flex !important;
    gap: 6px !important;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  body.dashboard-active .trDashTabs button {
    flex: 0 0 auto;
    min-height: 32px !important;
    padding: 7px 10px !important;
    border-radius: 999px !important;
    font-size: 12px !important;
    white-space: nowrap;
  }

  body.dashboard-active .trDashTaskRow,
  body.dashboard-active .trDashNoticeRow {
    min-height: 54px !important;
    grid-template-columns: 24px minmax(0, 1fr) auto !important;
    gap: 8px !important;
    padding: 9px 8px !important;
    border-radius: 12px !important;
  }

  body.dashboard-active .trDashNoticeRow {
    grid-template-columns: 10px minmax(0, 1fr) auto !important;
  }

  body.dashboard-active .trDashTaskRow span,
  body.dashboard-active .trDashNoticeRow span:nth-child(2) {
    min-width: 0;
  }

  body.dashboard-active .trDashTaskRow b,
  body.dashboard-active .trDashTaskRow small,
  body.dashboard-active .trDashNoticeRow span:nth-child(2) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.dashboard-active .trDashTaskRow small {
    display: block;
    font-size: 11px !important;
  }

  body.dashboard-active .trDashTaskRow em,
  body.dashboard-active .trDashTime {
    display: none !important;
  }

  body.dashboard-active .trDashTaskRow button {
    min-width: 52px !important;
    min-height: 30px !important;
    padding: 6px 8px !important;
    border-radius: 10px !important;
    font-size: 12px !important;
  }

  body.dashboard-active .trDashTag {
    margin: 0 !important;
    padding: 4px 7px !important;
    font-size: 11px !important;
    white-space: nowrap;
  }

  body.dashboard-active .trDashCta {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  body.dashboard-active .trDashCta b {
    display: block;
    overflow: hidden;
    font-size: 16px !important;
    line-height: 1.25 !important;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.dashboard-active .trDashCta button {
    width: 100% !important;
    min-height: 42px !important;
    border-radius: 14px !important;
    font-size: 14px !important;
  }

  body.dashboard-active #sportlinkBuildBadge {
    right: 6px !important;
    bottom: 6px !important;
    max-width: 118px !important;
    overflow: hidden !important;
    padding: 2px 5px !important;
    opacity: 0.26 !important;
    font-size: 9px !important;
    line-height: 1.1 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
}

@media (max-width: 420px) {
  body.dashboard-active .trOwnerSummaryGrid,
  body.dashboard-active .trDashWelcomeSummary {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 360px) {
  body.dashboard-active .trDashWorkGrid {
    grid-template-columns: 1fr !important;
  }
}
