/* ============================================================
   Web Dashboard v2 shell (handoff "NassZone Stock Redesign (15)")
   Loaded only when the preview switch is on (include/ui_v2.php);
   every rule is scoped under html.mz-v2.
   ============================================================ */
html.mz-v2 {
  --bg:          #ECE5D8;
  --bg-soft:     #E8E0D1;
  --card:        #F4EFE6;
  --card-raised: #FBF8F2;
  --ink:         #2C3A36;
  --ink-mid:     #6B776F;
  --ink-soft:    #9CA59E;
  --hairline:    rgba(44,58,54,.08);
  --green:       #5FA98D;
  --green-deep:  #3E8470;
  --green-dark:  #2A5A4C;
  --green-mist:  #DCE9DF;
  --bad:         #C8664F;
  --shadow-sm:   0 12px 28px -20px rgba(44,58,54,.35);
  --radius-card: 20px;
  --sidebar-w:   248px;
  --v2-ease:     cubic-bezier(.2,.8,.2,1);
}
html.mz-v2 body {
  font-family: Geist, system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  background: #ECE5D8;
}
@keyframes v2Up    { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes v2Blink { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) {
  html.mz-v2 *, html.mz-v2 *::before, html.mz-v2 *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── Sidebar ─────────────────────────────────────────────── */
html.mz-v2 .v2-sidebar {
  width: 248px; height: 100vh; min-height: 0;
  background: #1E332D; color: #F2EDE3; box-shadow: none;
  display: flex; flex-direction: column; overflow: hidden;
}
html.mz-v2 .v2-watermark {
  position: absolute; left: -30px; bottom: -60px;
  font-size: 320px; font-weight: 700; letter-spacing: -.08em; line-height: 1;
  color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,.05);
  pointer-events: none; user-select: none;
}
html.mz-v2 .v2-logo { position: relative; height: 84px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 24px; }
html.mz-v2 .v2-logo-tile {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  background: linear-gradient(145deg,#5FA98D 0%,#3E8470 45%,#2A5A4C 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 16px;
}
html.mz-v2 .v2-logo-tile.sm { width: 32px; height: 32px; border-radius: 10px; font-size: 15px; }
html.mz-v2 .v2-logo-text { font-size: 17px; font-weight: 700; letter-spacing: -.02em; color: #F2EDE3; }

html.mz-v2 .v2-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: #5FA98D; box-shadow: 0 0 0 3px rgba(95,169,141,.2);
  animation: v2Blink 1.8s ease-in-out infinite;
}
html.mz-v2 .v2-dot.sm  { width: 7px; height: 7px; }
html.mz-v2 .v2-dot.off { background: #C8664F; box-shadow: 0 0 0 3px rgba(200,102,79,.2); animation: none; }

html.mz-v2 .v2-router { position: relative; padding: 0 16px 12px; flex: none; }
html.mz-v2 .v2-router-btn {
  width: 100%; height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 12px;
  border-radius: 14px; border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.05);
  color: #F2EDE3; cursor: pointer; white-space: nowrap; text-align: left; transition: background .15s;
}
html.mz-v2 .v2-router-btn:hover { background: rgba(255,255,255,.08); }
html.mz-v2 .v2-router-txt  { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
html.mz-v2 .v2-router-lbl  { font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #8FA89D; }
html.mz-v2 .v2-router-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
html.mz-v2 .v2-router-chev { color: #8FA89D; display: flex; }
html.mz-v2 .v2-router-panel {
  position: absolute; top: 52px; left: 16px; right: 16px; z-index: 20;
  padding: 6px; border-radius: 16px; background: #F4EFE6; color: #2C3A36;
  box-shadow: 0 18px 40px -12px rgba(0,0,0,.5);
  max-height: 60vh; overflow-y: auto;
  animation: v2Up .18s var(--v2-ease);
}
html.mz-v2 .v2-router-panel[hidden] { display: none; }
html.mz-v2 .v2-router-row {
  height: 42px; display: flex; align-items: center; gap: 10px; padding: 0 10px;
  border-radius: 10px; font-size: 13px; font-weight: 500; color: #2C3A36; text-decoration: none;
}
html.mz-v2 .v2-router-row:hover, html.mz-v2 .v2-router-row.cur { background: #E8E0D1; color: #2C3A36; }
html.mz-v2 .v2-router-row.cur { font-weight: 600; }
html.mz-v2 .v2-router-row .v2-dot { animation: none; box-shadow: none; }
html.mz-v2 .v2-router-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.mz-v2 .v2-router-st { font-size: 11px; color: #6B776F; }
html.mz-v2 .v2-router-st.off { color: #C8664F; }
html.mz-v2 .v2-router-sep { height: 1px; background: rgba(44,58,54,.08); margin: 6px 4px; }
html.mz-v2 .v2-router-manage {
  height: 38px; display: flex; align-items: center; padding: 0 10px; border-radius: 10px;
  font-size: 13px; font-weight: 600; color: #3E8470; text-decoration: none;
}
html.mz-v2 .v2-router-manage:hover { background: #E8E0D1; color: #2A5A4C; }

html.mz-v2 .v2-nav {
  position: relative; flex: 1; overflow-y: auto; padding: 8px 16px;
  display: flex; flex-direction: column; gap: 4px; scrollbar-width: none;
}
html.mz-v2 .v2-nav::-webkit-scrollbar { display: none; }
html.mz-v2 .v2-nav-item {
  width: 100%; height: 46px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 14px;
  border: none; border-radius: 13px; background: transparent; color: #A9C8BA;
  font-size: 14px; font-weight: 500; cursor: pointer; text-align: left; white-space: nowrap;
  text-decoration: none; transition: background .15s, color .15s;
}
html.mz-v2 .v2-nav-item svg { flex: none; }
html.mz-v2 .v2-nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
html.mz-v2 .v2-nav-item.solid {
  background: linear-gradient(180deg,#4A957F 0%,#3E8470 100%); color: #fff; font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 10px 22px -8px rgba(62,132,112,.8);
}
html.mz-v2 .mz-nav-group.kid-on > .v2-nav-item { color: #fff; font-weight: 600; }
html.mz-v2 .v2-nav-label { flex: 1; }
html.mz-v2 .v2-badge {
  height: 20px; padding: 0 7px; border-radius: 10px; background: rgba(95,169,141,.35);
  color: #fff; font-size: 11px; font-weight: 600; display: inline-flex; align-items: center;
}
html.mz-v2 .v2-nav-item.solid .v2-badge { background: rgba(255,255,255,.22); }
html.mz-v2 .v2-chev { display: flex; opacity: .6; transition: transform .25s var(--v2-ease); }
html.mz-v2 .mz-nav-group.open .v2-chev { transform: rotate(90deg); }
html.mz-v2 .v2-kids-wrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s var(--v2-ease); }
html.mz-v2 .mz-nav-group.open .v2-kids-wrap { grid-template-rows: 1fr; }
html.mz-v2 .v2-kids-inner { overflow: hidden; min-height: 0; }
html.mz-v2 .v2-kids {
  margin: 4px 0 6px 23px; padding-left: 14px; border-left: 1px solid rgba(255,255,255,.1);
  display: flex; flex-direction: column; gap: 2px;
}
html.mz-v2 .v2-kid {
  position: relative; height: 36px; flex: none; display: flex; align-items: center; padding: 0 10px;
  border-radius: 10px; color: #8FA89D; font-size: 13px; font-weight: 500; white-space: nowrap; text-decoration: none;
}
html.mz-v2 .v2-kid:hover { color: #fff; }
html.mz-v2 .v2-kid.active { background: rgba(255,255,255,.06); color: #fff; font-weight: 600; }
html.mz-v2 .v2-kid-mark { position: absolute; left: -15px; top: 10px; bottom: 10px; width: 2px; border-radius: 1px; background: transparent; }
html.mz-v2 .v2-kid.active .v2-kid-mark { background: #5FA98D; }

html.mz-v2 .v2-foot { position: relative; flex: none; padding: 12px 16px 20px; display: flex; flex-direction: column; gap: 2px; }
html.mz-v2 .v2-foot-item {
  height: 42px; display: flex; align-items: center; gap: 12px; padding: 0 14px; border-radius: 12px;
  color: #A9C8BA; font-size: 14px; font-weight: 500; text-decoration: none;
}
html.mz-v2 .v2-foot-item:hover, html.mz-v2 .v2-foot-item.on { color: #fff; }
html.mz-v2 .v2-foot-item.on { background: rgba(255,255,255,.06); }
html.mz-v2 .v2-foot-item.bad { color: #F0A593; }
html.mz-v2 .v2-foot-item.bad:hover { color: #fff; background: rgba(200,102,79,.25); }

/* ── Main + topbar ───────────────────────────────────────── */
html.mz-v2 .v2-main { margin-left: 248px; padding: 24px 28px 40px; background: #ECE5D8; }
html.mz-v2 .v2-topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; margin-bottom: 22px; }
html.mz-v2 .v2-title-wrap { flex: 1 1 360px; min-width: 0; }
html.mz-v2 .v2-title { font-size: 24px; font-weight: 700; letter-spacing: -.02em; color: #2C3A36; }
html.mz-v2 .v2-sub   { font-size: 13px; color: #6B776F; margin-top: 3px; }
html.mz-v2 .v2-profile {
  position: relative; flex: 0 1 320px; min-width: 0; height: 56px;
  display: flex; align-items: center; gap: 12px; padding: 0 8px;
  border-radius: 18px; background: #F4EFE6; border: 1px solid rgba(44,58,54,.05);
}
html.mz-v2 .v2-profile-me {
  flex: 1; min-width: 0; height: 48px; display: flex; align-items: center; gap: 12px; padding: 0 6px;
  border: none; background: none; border-radius: 13px; cursor: pointer; text-align: left; color: inherit;
}
html.mz-v2 .v2-profile-me:hover { background: #E8E0D1; }
html.mz-v2 .v2-avatar {
  position: relative; width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: linear-gradient(145deg,#5FA98D 0%,#3E8470 45%,#2A5A4C 100%);
  color: #fff; font-size: 15px; font-weight: 600; display: flex; align-items: center; justify-content: center;
}
html.mz-v2 .v2-avatar-dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: #5FA98D; border: 2px solid #F4EFE6; }
html.mz-v2 .v2-profile-txt  { flex: 1; min-width: 0; display: flex; flex-direction: column; }
html.mz-v2 .v2-profile-name { font-size: 14px; font-weight: 700; color: #2C3A36; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.mz-v2 .v2-profile-role { font-size: 12px; color: #6B776F; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.mz-v2 .v2-timer { font-size: 11px; color: #9CA59E; font-variant-numeric: tabular-nums; }
html.mz-v2 .v2-timer:empty { display: none; }
html.mz-v2 .v2-bell-wrap { position: relative; flex: none; }
html.mz-v2 .v2-bell {
  position: relative; width: 40px; height: 40px; border-radius: 12px; border: none; background: #E8E0D1; color: #2C3A36;
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: filter .15s, transform .1s;
}
html.mz-v2 .v2-bell:hover  { filter: brightness(1.04); }
html.mz-v2 .v2-bell:active { transform: scale(.97); }
html.mz-v2 .v2-bell-badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: #C8664F; color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px #F4EFE6;
}
html.mz-v2 .v2-bell-panel, html.mz-v2 .v2-menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 999;
  background: #FBF8F2; border: 1px solid rgba(44,58,54,.08); border-radius: 16px;
  box-shadow: 0 14px 30px -12px rgba(44,58,54,.45); animation: v2Up .18s var(--v2-ease);
}
html.mz-v2 .v2-bell-panel { width: 340px; max-width: calc(100vw - 28px); max-height: 380px; overflow-y: auto; }
html.mz-v2 .v2-bell-hd { padding: 12px 16px; border-bottom: 1px solid rgba(44,58,54,.08); font-size: 13px; font-weight: 700; }
html.mz-v2 .v2-bell-empty { padding: 18px 16px; font-size: 13px; color: #6B776F; }
html.mz-v2 .v2-notif { display: flex; align-items: flex-start; gap: 10px; padding: 11px 16px; border-bottom: 1px solid rgba(44,58,54,.06); font-size: 13px; line-height: 1.4; }
html.mz-v2 .v2-notif-dot { width: 8px; height: 8px; border-radius: 50%; background: #3E8470; margin-top: 6px; flex: none; }
html.mz-v2 .v2-notif-dot.off { background: #C8664F; }
html.mz-v2 .v2-notif-body { flex: 1; min-width: 0; }
html.mz-v2 .v2-notif-time { font-size: 11px; color: #9CA59E; margin-top: 2px; }
html.mz-v2 .v2-notif-x { border: none; background: #E8E0D1; color: #6B776F; width: 24px; height: 24px; border-radius: 8px; cursor: pointer; flex: none; font-size: 15px; line-height: 1; }
html.mz-v2 .v2-menu { left: 0; right: auto; min-width: 230px; padding: 6px; }
html.mz-v2 .v2-menu[hidden] { display: none; }
html.mz-v2 .v2-menu a {
  height: 40px; display: flex; align-items: center; gap: 10px; padding: 0 12px; border-radius: 10px;
  font-size: 13px; font-weight: 500; color: #2C3A36; text-decoration: none;
}
html.mz-v2 .v2-menu a:hover { background: #E8E0D1; color: #2C3A36; }
html.mz-v2 .v2-menu a.v2-menu-mute { font-size: 12px; color: #6B776F; }
html.mz-v2 .v2-menu a.v2-menu-bad  { color: #A4503C; }

/* PWA install banner (js/pwa.js sets inline styles, hence !important) */
html.mz-v2 #pwa-banner { background: #1E332D !important; border-top: none !important; color: #F2EDE3 !important; font-family: inherit; }
html.mz-v2 #pwa-install-btn { background: #3E8470 !important; border-radius: 10px !important; font-weight: 600; }

/* ── Mobile (<760px): top bar, drawer, bottom tab bar ────── */
html.mz-v2 .v2-mtop { display: none; }
html.mz-v2 .v2-tabbar { display: none; }
html.mz-v2 .mz-sidebar-backdrop { background: rgba(30,51,45,.5); }
@media (min-width: 761px) {
  html.mz-v2 .v2-sidebar { transform: none; position: fixed; z-index: 100; }
  html.mz-v2 .v2-main    { margin-left: 248px; padding-bottom: 40px; }
  html.mz-v2 .mz-sidebar-backdrop { display: none !important; }
}
@media (max-width: 760px) {
  html.mz-v2 .mz-wrapper { flex-direction: column; }
  html.mz-v2 .v2-mtop {
    display: flex; position: sticky; top: 0; z-index: 30; height: 60px; flex: none;
    align-items: center; gap: 10px; padding: 0 14px; background: #1E332D; color: #F2EDE3;
    box-shadow: 0 8px 20px -14px rgba(0,0,0,.6);
  }
  html.mz-v2 .v2-mtop .v2-logo-text { font-size: 16px; }
  html.mz-v2 .v2-mtop-pill {
    margin-left: auto; min-width: 0; height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 12px;
    border-radius: 19px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.06);
    color: #F2EDE3; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
  }
  html.mz-v2 .v2-mtop-pill svg { color: #8FA89D; flex: none; }
  html.mz-v2 .v2-mtop-name { overflow: hidden; text-overflow: ellipsis; }
  /* Pages without a router: the page title on the right of the bar replaces the big heading */
  html.mz-v2 .v2-mtop-page { margin-left: auto; min-width: 0; font-size: 15px; font-weight: 600; color: #F2EDE3; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html.mz-v2 .v2-topbar-ns .v2-title-wrap { display: none; }
  html.mz-v2 .v2-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 200;
    transform: translateX(-105%); transition: transform .32s var(--v2-ease); box-shadow: none;
  }
  html.mz-v2 .v2-sidebar.open { transform: none; box-shadow: 20px 0 50px -10px rgba(0,0,0,.5); }
  html.mz-v2 .v2-main { margin-left: 0; padding: 18px 14px 104px; }
  html.mz-v2 .v2-tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 180;
    gap: 4px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border-radius: 0; border: none; border-top: 1px solid rgba(44,58,54,.08);
    background: rgba(244,239,230,.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 -10px 24px -18px rgba(44,58,54,.4);
  }
  html.mz-v2 .v2-tab {
    position: relative; flex: 1; min-width: 0; height: 54px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    border: none; border-radius: 14px; background: transparent; color: #6B776F;
    font-size: 11px; font-weight: 500; cursor: pointer; text-decoration: none; transition: background .2s, color .2s;
    -webkit-tap-highlight-color: transparent;
  }
  html.mz-v2 .v2-tab.active, html.mz-v2 #mzTabMenu[aria-expanded="true"] { background: #DCE9DF; color: #2A5A4C; font-weight: 700; }
  html.mz-v2 .v2-tab-badge {
    position: absolute; top: 5px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    background: #3E8470; color: #fff; font-size: 10px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px #F4EFE6;
  }
  html.mz-v2 .v2-topbar { margin-bottom: 18px; }
  html.mz-v2 .v2-title  { font-size: 20px; }
  html.mz-v2 .v2-profile { flex: 1 1 100%; }
  html.mz-v2 .v2-bell-panel { right: -8px; }
  /* keep the install banner clear of the tab bar */
  html.mz-v2 #pwa-banner {
    bottom: calc(80px + env(safe-area-inset-bottom)) !important; left: 10px !important; right: 10px !important;
    border-radius: 16px; z-index: 170 !important;
  }
}
