/**
 * LS remap over MPI app shell — keep shell UX, force Lam Soon colors + readable contrast.
 * Loaded AFTER mpi_app_shell.css + mt_ls_theme.css
 */
:root {
  --ls-red: #E31E24;
  --ls-red-dark: #B71C1C;
  --ls-red-light: #FFEBEE;
  --ls-gold-light: #FFF9E1;
  --ls-text: #333333;
  --ls-muted: #666666;
}

/* Topbar / bottom nav accents */
body.admin-pc-portal:not(.mt-auth-screen) #dsg-so-topbar {
  background:
    radial-gradient(circle at 88% 0%, rgba(227, 30, 36, 0.28) 0%, transparent 46%),
    linear-gradient(100deg, #7a1216 0%, #B71C1C 55%, #E31E24 100%) !important;
  border-bottom: 3px solid #E31E24 !important;
  box-shadow: 0 8px 24px rgba(183, 28, 28, 0.28) !important;
}

body.admin-pc-portal.admin-pc-drawer-open #dsg-so-drawer-backdrop {
  background: rgba(80, 16, 18, 0.52) !important;
}

#dsg-so-bottom-nav,
body.admin-pc-portal:not(.mt-auth-screen) #dsg-so-bottom-nav {
  border-top-color: rgba(227, 30, 36, 0.18) !important;
}

#dsg-so-bottom-nav .dsg-so-tab.is-active,
#dsg-so-bottom-nav button.is-active,
body.admin-pc-portal .dsg-so-tab.on,
.dsg-so-nav-item.active,
.dsg-so-nav-item.is-active {
  color: #E31E24 !important;
}

.dsg-so-brand-pill,
.dsg-so-badge {
  background: rgba(227, 30, 36, 0.12) !important;
  color: #E31E24 !important;
}

/* ══ Sidebar: light LS surface (override MPI navy) — text always dark ══ */
body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar,
body.admin-pc-portal #admin-portal-sidebar {
  background: #ffffff !important;
  color: #333333 !important;
  border-right: 1px solid rgba(227, 30, 36, 0.12) !important;
  box-shadow: 8px 0 28px rgba(183, 28, 28, 0.12) !important;
}

@media (max-width: 959px) {
  body.admin-pc-portal:not(.mt-auth-screen) #admin-portal-sidebar,
  body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar {
    background: #ffffff !important;
    color: #333333 !important;
    box-shadow: 12px 0 40px rgba(183, 28, 28, 0.22) !important;
  }
}

@media (min-width: 960px) {
  body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar,
  body.admin-pc-portal #admin-portal-sidebar {
    background: #ffffff !important;
    color: #333333 !important;
  }
}

body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-sidebar-brand,
body.admin-pc-portal #admin-portal-sidebar .admin-sidebar-brand {
  background: linear-gradient(135deg, #E31E24 0%, #B71C1C 100%) !important;
  border-bottom: none !important;
}

body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-sidebar-brand h1,
body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-sidebar-brand-text h1,
body.admin-pc-portal #admin-portal-sidebar .admin-sidebar-brand h1 {
  color: #ffffff !important;
}

body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-sidebar-brand p,
body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-sidebar-brand-text p,
body.admin-pc-portal #admin-portal-sidebar .admin-sidebar-brand p {
  color: rgba(255, 255, 255, 0.9) !important;
  opacity: 1 !important;
}

body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-sidebar-close-btn,
body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-sidebar-collapse-btn {
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.45) !important;
  background: rgba(255, 255, 255, 0.16) !important;
}

/* Accordion groups: soft red tint, never force white text */
body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-acc,
body.admin-pc-portal #admin-portal-sidebar .admin-acc {
  background: #fff !important;
  border: 1px solid rgba(227, 30, 36, 0.12) !important;
  box-shadow: inset 3px 0 0 rgba(227, 30, 36, 0.45) !important;
}

body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-acc[data-acc="home"],
body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-acc[data-acc="reports"],
body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-acc[data-acc="route"],
body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-acc[data-acc="hold"],
body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-acc[data-acc="settings"],
body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-acc[data-acc="people"],
body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-acc[data-acc="catalog"] {
  background: linear-gradient(145deg, #ffffff 0%, #FFEBEE 100%) !important;
  border-color: rgba(227, 30, 36, 0.16) !important;
}

body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-acc-hdr,
body.admin-pc-portal #admin-portal-sidebar .admin-acc-hdr {
  color: #B71C1C !important;
  opacity: 1 !important;
}

body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-acc-hdr i,
body.admin-pc-portal #admin-portal-sidebar .admin-acc-hdr i {
  color: #E31E24 !important;
  opacity: 1 !important;
}

body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-acc-hdr .admin-acc-chevron,
body.admin-pc-portal #admin-portal-sidebar .admin-acc-hdr .admin-acc-chevron {
  color: #B71C1C !important;
  opacity: 0.7 !important;
}

body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-nav-item,
body.admin-pc-portal #admin-portal-sidebar .admin-nav-item {
  color: #333333 !important;
  background: transparent !important;
  box-shadow: none !important;
  opacity: 1 !important;
}

body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-nav-item > i,
body.admin-pc-portal #admin-portal-sidebar .admin-nav-item > i {
  color: #E31E24 !important;
}

body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-nav-item > span,
body.admin-pc-portal #admin-portal-sidebar .admin-nav-item > span {
  color: inherit !important;
}

body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-nav-item:hover,
body.admin-pc-portal #admin-portal-sidebar .admin-nav-item:hover {
  background: #FFEBEE !important;
  color: #B71C1C !important;
}

body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-nav-item.active,
body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-nav-item.is-active,
body.admin-pc-portal #admin-portal-sidebar .admin-nav-item.active,
body.admin-pc-portal #admin-portal-sidebar .admin-nav-item.is-active {
  background: linear-gradient(135deg, #E31E24, #B71C1C) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(227, 30, 36, 0.28) !important;
  border-left: none !important;
  font-weight: 700 !important;
}

body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-nav-item.active > i,
body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-nav-item.is-active > i,
body.admin-pc-portal #admin-portal-sidebar .admin-nav-item.active > i {
  color: #ffffff !important;
}

body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-nav-item.active > span,
body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-nav-item.is-active > span {
  color: #ffffff !important;
}

body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-nav-item--disabled,
body.admin-pc-portal #admin-portal-sidebar .admin-nav-item--disabled {
  color: #78909C !important;
  opacity: 0.85 !important;
}

body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-nav-off-badge {
  color: #546E7A !important;
  background: #ECEFF1 !important;
}

/* Footer user / logout — dark text on cream */
body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-sidebar-foot,
body.admin-pc-portal #admin-portal-sidebar .admin-sidebar-foot {
  background: #FFF9E1 !important;
  border-top: 1px solid rgba(227, 30, 36, 0.14) !important;
  color: #333333 !important;
  opacity: 1 !important;
}

body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-sidebar-user-meta #admin-so-side-name,
body.admin-pc-portal #admin-portal-sidebar .admin-sidebar-user-meta #admin-so-side-name {
  color: #333333 !important;
  font-weight: 700 !important;
}

body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-sidebar-user-meta #admin-so-side-role,
body.admin-pc-portal #admin-portal-sidebar .admin-sidebar-user-meta #admin-so-side-role {
  color: #666666 !important;
}

body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-sidebar-logout,
body.admin-pc-portal #admin-portal-sidebar .admin-sidebar-logout {
  color: #B71C1C !important;
  background: #ffffff !important;
  border: 1px solid rgba(227, 30, 36, 0.28) !important;
}

body.mt-tissue-brand.admin-pc-portal #admin-portal-sidebar .admin-sidebar-logout:hover,
body.admin-pc-portal #admin-portal-sidebar .admin-sidebar-logout:hover {
  background: #FFEBEE !important;
  color: #E31E24 !important;
}

body.admin-pc-portal #admin-sidebar-reopen {
  background: #E31E24 !important;
  border-color: #B71C1C !important;
  color: #ffffff !important;
}

/* ══ Red → white headers (override MPI navy) ══ */
body.mt-tissue-brand .ah-hdr,
body.mobile-app-enabled .ah-hdr,
.ah-hdr,
body.mt-tissue-brand .py-hdr,
.py-hdr,
body.mt-tissue-brand .mttt-team-hdr,
.mttt-team-hdr,
body.mt-tissue-brand .ci-hdr,
.ci-hdr,
body.mt-tissue-brand .att-hub-hdr,
.att-hub-hdr,
#s-attendance-hub .ah-hdr {
  background: linear-gradient(100deg, #E31E24 0%, #C62828 48%, #FFEBEE 100%) !important;
  border-bottom: 3px solid #E31E24 !important;
  box-shadow: 0 8px 24px -10px rgba(183, 28, 28, 0.28) !important;
}

body.mt-tissue-brand,
body.mobile-app-enabled {
  --pigeon-navy: #B71C1C;
  --pigeon-blue: #E31E24;
  --pigeon-red: #E31E24;
}

body.mt-tissue-brand .mob-wrap,
body.mobile-app-enabled .mob-wrap,
body.mobile-app-enabled #s-mobile-profile,
body.mobile-app-enabled #s-mobile-work,
body.mobile-app-enabled #s-admin-settings,
body.mttt-team-on #s-mobile-work {
  background: linear-gradient(180deg, #FFF5F5 0%, #FFFFFF 45%, #FFF9E1 100%) !important;
}

.mttt-team-tab.on {
  color: #B71C1C !important;
}

/* ══ Mobile spacing fixes (header / bottom nav / drawer) ══ */
@media (max-width: 959px) {
  /* 1) Header ไม่ชิดขอบบน — กัน status bar / notch */
  body.mobile-app-enabled .ah-hdr,
  body.mobile-app-enabled .py-hdr,
  body.mt-tissue-brand.mobile-app-enabled .ah-hdr,
  body.mttt-team-on .mttt-team-hdr {
    padding-top: max(14px, calc(10px + env(safe-area-inset-top, 0px))) !important;
  }

  body.admin-pc-portal:not(.mt-auth-screen) #dsg-so-topbar {
    height: auto !important;
    min-height: var(--dsg-so-topbar-h);
    padding-top: env(safe-area-inset-top, 0px) !important;
    box-sizing: content-box !important;
  }

  /* 2) เมนูล่างเตี้ยชิดขอบล่าง — เนื้อหาใช้พื้นที่เต็มจอ */
  body.mobile-app-enabled #mobile-app-tabbar,
  body.mt-tissue-brand.mobile-app-enabled #mobile-app-tabbar,
  #mobile-app-tabbar {
    min-height: calc(50px + env(safe-area-inset-bottom, 0px)) !important;
    height: auto !important;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px)) !important;
    background: #ffffff !important;
    align-items: center !important;
    box-shadow: 0 -2px 12px rgba(183, 28, 28, 0.1) !important;
  }

  body.mobile-app-enabled #mobile-app-tabbar::before,
  body.mt-tissue-brand.mobile-app-enabled #mobile-app-tabbar::before,
  #mobile-app-tabbar::before {
    display: none !important;
    content: none !important;
    height: 0 !important;
    top: auto !important;
  }

  body.mobile-app-enabled #mobile-app-tabbar .mob-tab-ic,
  body.mt-tissue-brand.mobile-app-enabled #mobile-app-tabbar .mob-tab-ic {
    width: 40px !important;
    height: 40px !important;
  }

  body.mobile-app-enabled #mobile-app-tabbar .mob-tab-fab .mob-tab-ic,
  body.mt-tissue-brand.mobile-app-enabled #mobile-app-tabbar .mob-tab-fab .mob-tab-ic,
  body.mt-tissue-brand #mobile-app-tabbar .mob-tab-fab .mob-tab-ic {
    width: 46px !important;
    height: 46px !important;
    margin-top: -6px !important;
    transform: none !important;
  }

  body.mobile-app-enabled #mobile-app-tabbar .mob-tab-lbl,
  body.mt-tissue-brand.mobile-app-enabled #mobile-app-tabbar .mob-tab-lbl {
    font-size: 10px !important;
    line-height: 1.1 !important;
  }

  /* padding ล่างพอดีแท็บ — ไม่ทิ้งแถบครีมสูง */
  body.mobile-app-enabled .app,
  body.mobile-app-enabled .app:has(#s-mobile-home.active),
  body.mobile-app-enabled .app:has(#s-mobile-work.active),
  body.mobile-app-enabled .app:has(#s-mobile-profile.active),
  body.mobile-app-enabled .app:has(#s-mobile-leave-swap.active),
  body.mobile-app-enabled .app:has(#s-mobile-alerts.active),
  body.mobile-app-enabled .app:has(#s-attendance-hub.active),
  body.mobile-app-enabled .app:has(#s-admin-route-sup.active),
  body.mobile-app-enabled .app:has(#s-admin-settings.active),
  body.mobile-app-enabled #s-admin-route-sup,
  body.mobile-app-enabled #s-admin-route-sup .rs-sup-page-body,
  body.mobile-app-enabled .mob-wrap,
  body.mobile-app-enabled #s-mobile-home,
  body.mobile-app-enabled #s-mobile-work,
  body.mobile-app-enabled #s-mobile-profile,
  body.mobile-app-enabled #s-admin-settings,
  body.mobile-app-enabled #s-attendance-hub {
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.mttt-home-on #s-mobile-home.mob-wrap {
    padding-bottom: calc(54px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* 3) เปิด drawer แล้วซ่อนเมนูล่าง — ไม่ทับปุ่ม/เนื้อหา drawer */
  body.mttt-drawer-open #mobile-app-tabbar,
  body.mttt-drawer-open.mobile-app-enabled #mobile-app-tabbar,
  body.mttt-drawer-open.mobile-app-enabled:not([data-role="admin"]):not([data-role="staff"]) #mobile-app-tabbar {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}
