/*
 * MADINA V69.1 — Visual quality corrections
 * Scope: admin workspace, merchant mobile workspace, customer home mobile.
 * This file is intentionally loaded last. It changes presentation only.
 */

/* ------------------------------------------------------------
   ADMIN: neutral, calm workspace palette (light and dark themes)
   ------------------------------------------------------------ */
body.m33-admin-page {
  --bg:#F3F6F7 !important;
  --card:#FFFFFF !important;
  --ink:#23333B !important;
  --mut:#63747B !important;
  --line:#DDE5E8 !important;
  --acc:#2D7074 !important;
  --acc2:#235A5E !important;
  --grad:linear-gradient(120deg,#284D55 0%,#2D7074 100%) !important;
  --hero-gradient:linear-gradient(120deg,#E9F1F1 0%,#F7F9F9 100%) !important;
  --sh:0 7px 22px rgba(31,57,63,.055) !important;
  --soft:#EAF2F2 !important;
  --soft-2:#F3F0E9 !important;
  --button-secondary-ink:#235A5E !important;
  --shadow-sm:0 7px 22px rgba(31,57,63,.055) !important;
  --shadow-md:0 14px 34px rgba(31,57,63,.09) !important;
  background:#F3F6F7 !important;
  color:#23333B !important;
}
html:has(body.m33-admin-page) { background:#F3F6F7 !important; color:#23333B !important; }
body.m33-admin-page .m36-admin,
body.m33-admin-page .m36-workspace,
body.m33-admin-page .m36-main { background:transparent !important; color:var(--ink) !important; }
body.m33-admin-page .m36-sidebar,
body.m33-admin-page .m36-toolbar,
body.m33-admin-page .m36-mobile-nav {
  background:#FFFFFF !important;
  border:1px solid var(--line) !important;
  border-radius:18px !important;
  box-shadow:0 6px 20px rgba(31,57,63,.045) !important;
}
body.m33-admin-page .m36-brand-mark,
body.m33-admin-page .m36-kpi>span,
body.m33-admin-page .m36-task>span,
body.m33-admin-page .m36-action>span,
body.m33-admin-page .m36-panel-icon,
body.m33-admin-page .m36-rank-row> b,
body.m33-admin-page .m36-post-row>span {
  background:#EAF2F2 !important;
  color:#2D7074 !important;
  border-color:#D6E6E6 !important;
  border-radius:12px !important;
}
body.m33-admin-page #app .m36-nav-item {
  background:transparent !important;
  color:#62747B !important;
  border:1px solid transparent !important;
  border-radius:11px !important;
}
body.m33-admin-page #app .m36-nav-item:hover,
body.m33-admin-page #app .m36-nav-item.is-active,
body.m33-admin-page #app .m36-nav-item.active {
  background:#EAF2F2 !important;
  color:#235A5E !important;
  border-color:#D7E7E7 !important;
  box-shadow:none !important;
}
body.m33-admin-page #app button.m36-task {
  background:#FFFFFF !important;
  color:#23333B !important;
  border:1px solid transparent !important;
  border-bottom-color:#E8EEF0 !important;
  box-shadow:none !important;
  border-radius:12px !important;
}
body.m33-admin-page #app button.m36-task:hover { background:#F5F9F9 !important; border-color:#DDE9E9 !important; }
body.m33-admin-page #app button.m36-action {
  background:#FFFFFF !important;
  color:#23333B !important;
  border:1px solid #DDE5E8 !important;
  border-radius:14px !important;
  box-shadow:0 3px 10px rgba(31,57,63,.035) !important;
}
body.m33-admin-page #app button.m36-action:hover {
  background:#F7FAFA !important;
  color:#235A5E !important;
  border-color:#BFD5D6 !important;
  box-shadow:0 7px 17px rgba(31,57,63,.07) !important;
}
body.m33-admin-page .m36-welcome {
  background:linear-gradient(120deg,#E9F1F1 0%,#F7F9F9 100%) !important;
  color:#23333B !important;
  border:1px solid #DCE7E8 !important;
}
body.m33-admin-page .m36-welcome :is(h1,h2,h3,p,span,b,small) { color:#23333B !important; }
body.m33-admin-page .m36-welcome-icon { color:#2D7074 !important; }
body.m33-admin-page .m36-counter,
body.m33-admin-page .m36-ad-mini-stats span { background:#F2F6F6 !important; color:#49636A !important; border:1px solid #E1E9EA !important; border-radius:11px !important; }
body.m33-admin-page .m36-text-button { background:#EAF2F2 !important; color:#235A5E !important; border:1px solid #D7E7E7 !important; border-radius:10px !important; }
body.m33-admin-page .m36-toolbar-search { background:#F7F9F9 !important; border:1px solid #DDE5E8 !important; border-radius:12px !important; }
body.m33-admin-page .m36-toolbar-link { background:#EAF2F2 !important; color:#235A5E !important; border-radius:11px !important; }
body.m33-admin-page .m36-page-heading :is(span,p,small) { color:#63747B !important; }
body.m33-admin-page .m36-page-heading h1 { color:#23333B !important; }

/* ------------------------------------------------------------
   MERCHANT: remove legacy violet remnants; retain the calm teal
   ------------------------------------------------------------ */
body.m33-merchant-page .madina-wordmark strong { color:#27353C !important; }
body.m33-merchant-page .madina-wordmark small { color:#2F6F68 !important; }
body.m33-merchant-page #nav :is(a,button):hover,
body.m33-merchant-page .madina-topbar .ib:hover { background:#E9F1F0 !important; color:#245A54 !important; border-color:#CADBD8 !important; }
body.m33-merchant-page .m33-sidebar-title>span,
body.m33-merchant-page .md-quick-action>i:first-child,
body.m33-merchant-page .md-order-mark,
body.m33-merchant-page .md-empty-orders>i,
body.m33-merchant-page .md-merchant-tool>i:first-child,
body.m33-merchant-page .m62-courier-stat>span,
body.m33-merchant-page .m62-courier-action>i:first-child,
body.m33-merchant-page .m62-assigned-order-icon {
  background:#E8F1EF !important;
  color:#2F6F68 !important;
  border-color:#D5E3E0 !important;
}
body.m33-merchant-page .m33-nav-list button:hover,
body.m33-merchant-page .md-quick-action:hover,
body.m33-merchant-page .md-merchant-tool:hover { background:#F6FAF9 !important; border-color:#C9DCD8 !important; color:#245A54 !important; }
body.m33-merchant-page .m33-nav-list button.active,
body.m33-merchant-page .m33-nav-list button.active:hover { background:#2F6F68 !important; color:#FFFFFF !important; border-color:#2F6F68 !important; }
body.m33-merchant-page .m33-nav-list button.active i { color:#FFFFFF !important; }
body.m33-merchant-page .m33-sidebar-back,
body.m33-merchant-page .md-back-tools,
body.m33-merchant-page .md-recent-heading button { color:#245A54 !important; }
body.m33-merchant-page .md-dashboard-intro,
body.m33-merchant-page .m33-merchant-content .md-dashboard-intro {
  background:linear-gradient(120deg,#EAF2F0 0%,#F6F8F7 100%) !important;
  color:#27353C !important;
  border:1px solid #D8E5E1 !important;
  box-shadow:none !important;
}
body.m33-merchant-page .md-dashboard-intro :is(h1,h2,h3,p,span,b,small,strong) { color:#27353C !important; }
body.m33-merchant-page .md-primary-quick,
body.m33-merchant-page .md-courier-quick,
body.m33-merchant-page .md-quick-action.md-primary-quick { background:#F0F6F4 !important; border-color:#CADCD7 !important; }
body.m33-merchant-page .md-recent-heading button { background:#EAF2F0 !important; border-color:#D3E2DE !important; }

/* Mobile merchant: remove duplicate store title and keep quick navigation
   in one horizontal row, rather than a tall two-by-two block. */
@media(max-width:760px){
  body.m33-merchant-page #app .m33-merchant-sidebar { padding:8px 10px !important; gap:7px !important; }
  body.m33-merchant-page #app .m33-merchant-sidebar .m33-sidebar-title { display:none !important; }
  body.m33-merchant-page #app .m33-mobile-quick-nav {
    display:flex !important;
    flex-flow:row nowrap !important;
    align-items:center !important;
    gap:7px !important;
    overflow-x:auto !important;
    overflow-y:hidden !important;
    padding:0 0 4px !important;
    margin:0 !important;
    scrollbar-width:thin !important;
    -webkit-overflow-scrolling:touch;
  }
  body.m33-merchant-page #app .m33-mobile-quick-nav button:not(.g):not(.r):not(.ib):not(.chip):not(.mn-community-filter):not(.pa-btn):not(.qty-ctrl button) {
    display:inline-flex !important;
    flex:0 0 auto !important;
    width:auto !important;
    min-width:max-content !important;
    min-height:38px !important;
    padding:7px 11px !important;
    background:#F7FAF9 !important;
    color:#34464D !important;
    border:1px solid #D8E5E1 !important;
    border-radius:11px !important;
    font-size:13px !important;
  }
  body.m33-merchant-page #app .m33-mobile-quick-nav button.active:not(.g):not(.r):not(.ib):not(.chip):not(.mn-community-filter):not(.pa-btn):not(.qty-ctrl button) {
    background:#2F6F68 !important; color:#FFFFFF !important; border-color:#2F6F68 !important;
  }
  body.m33-merchant-page #app .m33-mobile-sections-toggle { min-height:39px !important; padding:7px 10px !important; font-size:13px !important; }
  body.m33-merchant-page #app .md-merchant-top { min-height:58px !important; padding:8px 10px !important; }
  body.m33-merchant-page #app .md-merchant-shell { gap:9px !important; }
}

/* ------------------------------------------------------------
   CUSTOMER: make the fixed bottom dock deliberate and readable;
   protect home content from the dock and improve small-screen type.
   ------------------------------------------------------------ */
body.m33-customer-page #bn {
  background:#FFFFFF !important;
  border:1px solid #E0E5E8 !important;
  box-shadow:0 -8px 28px rgba(32,47,54,.13) !important;
  -webkit-backdrop-filter:blur(16px) saturate(120%) !important;
  backdrop-filter:blur(16px) saturate(120%) !important;
}
body.m33-customer-page #bn a span { font-size:12px !important; line-height:1.2 !important; }
body.m33-customer-page #bn a.active,
body.m33-customer-page #bn a.on,
body.m33-customer-page #bn a[aria-current="page"] { transform:none !important; }
body.m33-customer-page #app { padding-bottom:calc(132px + env(safe-area-inset-bottom,0px)) !important; }
body.m33-customer-page .cp-home { padding-bottom:18px !important; gap:24px !important; }
body.m33-customer-page .cp-home :is(small,.mut,.desc,.hint,.meta,.caption,.cp-eyebrow,.cp-search-caption) {
  font-size:max(12px,.78em) !important;
  line-height:1.55 !important;
}
body.m33-customer-page .cp-offer-card :is(h3,h4,b,strong,p,small,span) { overflow-wrap:anywhere; }
@media(max-width:380px){
  body.m33-customer-page .cp-home { gap:18px !important; }
  body.m33-customer-page .cp-offers-grid { grid-template-columns:1fr !important; gap:12px !important; }
  body.m33-customer-page #bn { width:calc(100% - 16px) !important; bottom:calc(7px + env(safe-area-inset-bottom,0px)) !important; min-height:68px !important; padding:6px 5px !important; }
  body.m33-customer-page #bn a { min-height:52px !important; padding:5px 1px !important; }
  body.m33-customer-page #bn a span { font-size:11px !important; }
}

/* Admin small screens: readable compact cards; avoid narrow two-column actions. */
@media(max-width:600px){
  body.m33-admin-page .m36-main { padding:6px 0 22px !important; }
  body.m33-admin-page .m36-toolbar { gap:8px !important; padding:8px 9px !important; }
  body.m33-admin-page .m36-toolbar-title { min-width:0 !important; }
  body.m33-admin-page .m36-toolbar-search { min-width:0 !important; }
  body.m33-admin-page .m36-kpi-grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:8px !important; }
  body.m33-admin-page .m36-kpi { min-height:84px !important; padding:10px !important; gap:8px !important; }
  body.m33-admin-page .m36-kpi b { font-size:17px !important; }
  body.m33-admin-page .m36-kpi small { font-size:12px !important; line-height:1.45 !important; }
  body.m33-admin-page .m36-kpi em { font-size:11.5px !important; line-height:1.4 !important; }
  body.m33-admin-page .m36-dashboard-grid { grid-template-columns:1fr !important; }
  body.m33-admin-page .m36-panel { padding:12px !important; }
  body.m33-admin-page .m36-page-heading { align-items:flex-start !important; }
  body.m33-admin-page .m36-page-heading h1 { font-size:23px !important; }
  body.m33-admin-page .m36-page-heading p { font-size:13px !important; line-height:1.55 !important; }
}
@media(max-width:360px){
  body.m33-admin-page .m36-quick-grid>div,
  body.m33-admin-page .m36-content-actions { grid-template-columns:1fr !important; }
  body.m33-admin-page .m36-action { min-height:68px !important; padding:10px 12px !important; }
  body.m33-admin-page .m36-kpi-grid { grid-template-columns:1fr !important; }
  body.m33-admin-page .m36-welcome { padding:13px !important; gap:8px !important; }
  body.m33-admin-page .m36-welcome h2 { font-size:17px !important; }
  body.m33-admin-page .m36-welcome p { font-size:12.5px !important; }
}

/* Dark theme counterparts keep the same role-specific color hierarchy. */
html[data-theme="dark"] body.m33-admin-page {
  --bg:#172226 !important; --card:#222F34 !important; --ink:#EDF3F4 !important;
  --mut:#B1C0C4 !important; --line:#3B4B50 !important; --acc:#75B7B1 !important;
  --acc2:#9CCFC9 !important; --soft:#2B4143 !important; --soft-2:#3B3530 !important;
  --sh:0 8px 24px rgba(0,0,0,.22) !important;
  background:#172226 !important; color:#EDF3F4 !important;
}
html[data-theme="dark"]:has(body.m33-admin-page) { background:#172226 !important; }
html[data-theme="dark"] body.m33-admin-page .m36-sidebar,
html[data-theme="dark"] body.m33-admin-page .m36-toolbar,
html[data-theme="dark"] body.m33-admin-page .m36-panel,
html[data-theme="dark"] body.m33-admin-page .m36-kpi,
html[data-theme="dark"] body.m33-admin-page .m36-card,
html[data-theme="dark"] body.m33-admin-page #app button.m36-action { background:#222F34 !important; color:#EDF3F4 !important; border-color:#3B4B50 !important; }
html[data-theme="dark"] body.m33-admin-page .m36-welcome { background:linear-gradient(120deg,#263B3D,#222F34) !important; border-color:#3B4B50 !important; }
html[data-theme="dark"] body.m33-admin-page .m36-welcome :is(h1,h2,h3,p,span,b,small) { color:#EDF3F4 !important; }
html[data-theme="dark"] body.m33-admin-page #app .m36-nav-item.is-active,
html[data-theme="dark"] body.m33-admin-page #app .m36-nav-item.active { background:#2B4143 !important; color:#9CCFC9 !important; }
html[data-theme="dark"] body.m33-admin-page .m36-kpi>span,
html[data-theme="dark"] body.m33-admin-page .m36-task>span,
html[data-theme="dark"] body.m33-admin-page .m36-action>span { background:#2B4143 !important; color:#9CCFC9 !important; }
html[data-theme="dark"] body.m33-customer-page #bn { background:#202A2F !important; border-color:#3B4B50 !important; }

/* Override the legacy high-specificity global button skin only for admin
   dashboard action surfaces; keep the actual primary action accent-colored. */
body.m33-admin-page #app button.m36-task:not(.g):not(.r):not(.ib):not(.chip):not(.mn-community-filter):not(.pa-btn):not(.qty-ctrl button) {
  background:#FFFFFF !important; color:#23333B !important; border:1px solid #E5ECEE !important;
  box-shadow:none !important;
}
body.m33-admin-page #app button.m36-task:not(.g):not(.r):not(.ib):not(.chip):not(.mn-community-filter):not(.pa-btn):not(.qty-ctrl button):hover {
  background:#F5F9F9 !important; color:#235A5E !important; border-color:#C9DCDD !important;
}
body.m33-admin-page #app button.m36-action:not(.g):not(.r):not(.ib):not(.chip):not(.mn-community-filter):not(.pa-btn):not(.qty-ctrl button) {
  background:#FFFFFF !important; color:#23333B !important; border:1px solid #DDE5E8 !important;
  box-shadow:0 3px 10px rgba(31,57,63,.035) !important;
}
body.m33-admin-page #app button.m36-action:not(.g):not(.r):not(.ib):not(.chip):not(.mn-community-filter):not(.pa-btn):not(.qty-ctrl button):hover {
  background:#F7FAFA !important; color:#235A5E !important; border-color:#BFD5D6 !important;
}
body.m33-admin-page #app button.m36-text-button:not(.g):not(.r):not(.ib):not(.chip):not(.mn-community-filter):not(.pa-btn):not(.qty-ctrl button),
body.m33-admin-page #app button.m36-mobile-toggle:not(.g):not(.r):not(.ib):not(.chip):not(.mn-community-filter):not(.pa-btn):not(.qty-ctrl button) {
  background:#EAF2F2 !important; color:#235A5E !important; border:1px solid #D7E7E7 !important; box-shadow:none !important;
}
html[data-theme="dark"] body.m33-admin-page #app button.m36-task:not(.g):not(.r):not(.ib):not(.chip):not(.mn-community-filter):not(.pa-btn):not(.qty-ctrl button),
html[data-theme="dark"] body.m33-admin-page #app button.m36-action:not(.g):not(.r):not(.ib):not(.chip):not(.mn-community-filter):not(.pa-btn):not(.qty-ctrl button) {
  background:#222F34 !important; color:#EDF3F4 !important; border-color:#3B4B50 !important;
}

/* Admin navigation is intentionally low-emphasis until the current section is selected. */
body.m33-admin-page #app button.m36-brand:not(.g):not(.r):not(.ib):not(.chip):not(.mn-community-filter):not(.pa-btn):not(.qty-ctrl button),
body.m33-admin-page #app button.m36-nav-item:not(.g):not(.r):not(.ib):not(.chip):not(.mn-community-filter):not(.pa-btn):not(.qty-ctrl button) {
  background:transparent !important; color:#5F7178 !important; border:1px solid transparent !important;
  box-shadow:none !important;
}
body.m33-admin-page #app button.m36-nav-item.is-active:not(.g):not(.r):not(.ib):not(.chip):not(.mn-community-filter):not(.pa-btn):not(.qty-ctrl button),
body.m33-admin-page #app button.m36-nav-item.active:not(.g):not(.r):not(.ib):not(.chip):not(.mn-community-filter):not(.pa-btn):not(.qty-ctrl button) {
  background:#EAF2F2 !important; color:#235A5E !important; border-color:#D7E7E7 !important;
}
body.m33-admin-page #app button.m36-nav-item:not(.g):not(.r):not(.ib):not(.chip):not(.mn-community-filter):not(.pa-btn):not(.qty-ctrl button):hover {
  background:#F4F8F8 !important; color:#235A5E !important; border-color:#E2ECEC !important;
}
body.m33-admin-page .m36-sidebar .m36-nav-group h3 { color:#72828A !important; font-size:12px !important; font-weight:850 !important; }
body.m33-admin-page .m36-side-back { color:#5F7178 !important; border-top:1px solid #E7EDEE !important; }
html[data-theme="dark"] body.m33-admin-page #app button.m36-brand:not(.g):not(.r):not(.ib):not(.chip):not(.mn-community-filter):not(.pa-btn):not(.qty-ctrl button),
html[data-theme="dark"] body.m33-admin-page #app button.m36-nav-item:not(.g):not(.r):not(.ib):not(.chip):not(.mn-community-filter):not(.pa-btn):not(.qty-ctrl button) { color:#B1C0C4 !important; }
html[data-theme="dark"] body.m33-admin-page #app button.m36-nav-item.is-active:not(.g):not(.r):not(.ib):not(.chip):not(.mn-community-filter):not(.pa-btn):not(.qty-ctrl button) { background:#2B4143 !important; color:#9CCFC9 !important; }

@media(max-width:760px){
  body.m33-merchant-page #app .md-merchant-stats > :last-child:nth-child(odd) {
    grid-column:1 / -1 !important;
    width:calc(50% - 4px) !important;
    justify-self:center !important;
  }
}

@media(max-width:760px){
  body.m33-merchant-page #app .md-merchant-stats > :last-child:nth-child(odd) {
    grid-column:1 / -1 !important; width:min(50%,220px) !important; justify-self:center !important;
  }
}
