/* ==========================================================================
   css/layouts/mobile-shell.css
   Split from app.html (build 2026.10.08.9-beta), original lines 44470-44643.
   Rules are in their ORIGINAL order; load order is defined in index.html.
   ========================================================================== */
body.mobile-shell { --mtab-h: 58px; }
body.mobile-shell #nativeTitleBar { display: none !important; }
body.mobile-shell .user-panel, body.mobile-shell .voice-bar { display: none !important; }

/* #app is only on screen when we're showing a drilled-in channel list or a chat. */
body.mobile-shell.app-ready #app {
  position: fixed !important; left: 0; top: 0; right: 0;
  bottom: calc(var(--mtab-h) + env(safe-area-inset-bottom, 0px));
  width: auto !important; height: auto !important; min-height: 0; display: none;
}
body.mobile-shell.app-ready.mchat-open #app,
body.mobile-shell.app-ready.mtab-servers.mserv-open #app { display: block; }
/* Hide every desktop panel; each state re-shows only what it needs. */
body.mobile-shell.app-ready #serverRail,
body.mobile-shell.app-ready #folderSecondaryRail,
body.mobile-shell.app-ready #channelRail,
body.mobile-shell.app-ready #trayArea,
body.mobile-shell.app-ready .channel-area { display: none; }
/* Servers drill-down: the real channel list, full-screen. */
body.mobile-shell.app-ready.mtab-servers.mserv-open:not(.mchat-open) #channelRail {
  display: flex; position: absolute; inset: 0; width: auto !important; transform: none !important;
  border: none; overflow: hidden; padding-top: calc(env(safe-area-inset-top, 0px) + 44px);
}
body.mobile-shell.app-ready.mtab-servers.mserv-open #channelRail .channel-list { flex: 1 1 auto; min-height: 0; }
/* Conversation open: the chat/composer, full-screen. */
body.mobile-shell.app-ready.mchat-open .channel-area {
  display: flex; position: absolute; inset: 0; width: auto !important; z-index: 8;
}
body.mobile-shell.app-ready.members-open #trayArea {
  display: flex !important; bottom: calc(var(--mtab-h) + env(safe-area-inset-bottom, 0px));
}

/* ---- our full-screen mobile views ---- */
/* Hidden by DEFAULT (incl. desktop, where body.mobile-shell is absent) so these static
   panels never render stacked under the desktop app; mobile show-rules below reveal them. */
.m-view { display: none; }
body.mobile-shell .m-view {
  position: fixed; left: 0; right: 0; top: 0;
  bottom: calc(var(--mtab-h) + env(safe-area-inset-bottom, 0px));
  display: none; flex-direction: column; background: var(--bg-deep, #0d0b16);
  z-index: 300; overflow: hidden;
}
body.mobile-shell.app-ready.mtab-home:not(.mchat-open) #mHomeView,
body.mobile-shell.app-ready.mtab-servers:not(.mchat-open):not(.mserv-open) #mServersView,
body.mobile-shell.app-ready.mtab-notifs #mNotifView,
body.mobile-shell.app-ready.mtab-profile #mProfileView { display: flex; }

.m-view-head { display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 16px 10px; }
.m-view-head h1 { margin: 0 auto 0 0; font: 700 23px/1 var(--font-display, 'Space Grotesk', system-ui);
  color: var(--text-primary, #fff); letter-spacing: -0.01em; }
.m-hbtn { width: 38px; height: 38px; border: none; background: var(--bg-elevated, #191622); border-radius: 11px;
  color: var(--text-secondary, #c4c0d0); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.m-hbtn:active { background: var(--bg-hover, #221d33); }
.m-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; padding: 2px 0 16px; }

.m-seg { display: flex; gap: 6px; margin: 0 16px 8px; background: var(--bg-void, #08060f);
  border: 1px solid var(--border, #23202e); border-radius: 12px; padding: 3px; flex-shrink: 0; }
.m-seg button { flex: 1; border: none; background: none; padding: 9px; border-radius: 9px;
  font: 600 13.5px var(--font-sans, system-ui); color: var(--text-muted, #8b879c); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.m-seg button.active { background: var(--accent, #7b6cff); color: #fff; }

.m-row { display: flex; align-items: center; gap: 12px; padding: 9px 16px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.m-row:active { background: var(--bg-hover, #221d33); }
.m-av { width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0; background: var(--bg-elevated, #191622) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: 16px; position: relative; }
.m-av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.m-av.sq, .m-av.sq img { border-radius: 15px; }
.m-pres { position: absolute; right: -1px; bottom: -1px; width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--bg-deep, #0d0b16); }
.m-pres.online { background: #3ba55d; } .m-pres.idle { background: #faa61a; }
.m-pres.dnd { background: #ed4245; } .m-pres.offline { background: #747f8d; }
.m-rmid { flex: 1; min-width: 0; }
.m-rname { font-size: 15.5px; font-weight: 600; color: var(--text-primary, #fff); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-rsub { font-size: 13px; color: var(--text-muted, #8b879c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.m-rmeta { flex-shrink: 0; display: flex; align-items: center; }
.m-badge { background: var(--red, #ed4245); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; min-width: 18px; text-align: center; }
.m-seclabel { font: 700 12px var(--font-sans, system-ui); text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted, #8b879c); padding: 14px 16px 6px; }
.m-empty { padding: 44px 28px; text-align: center; color: var(--text-muted, #8b879c); font-size: 14px; line-height: 1.5; }
.m-cta { margin: 10px 16px 4px; }
.m-cta button { width: 100%; border: none; border-radius: 11px; padding: 12px; font: 600 14px var(--font-sans, system-ui);
  background: var(--accent, #7b6cff); color: #fff; cursor: pointer; }

/* server grid */
.m-srv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 12px 8px; padding: 14px 16px 24px; }
.m-srv-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.m-srv-ic { width: 64px; height: 64px; border-radius: 20px; background: var(--bg-elevated, #191622) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--text-secondary, #c4c0d0); font-size: 20px; position: relative; overflow: visible; box-shadow: 0 3px 10px rgba(0,0,0,.28); transition: transform .1s; }
.m-srv-ic img { width: 100%; height: 100%; border-radius: 20px; object-fit: cover; }
.m-srv-tile:active .m-srv-ic { transform: scale(.93); }
.m-srv-name { font-size: 12px; color: var(--text-secondary, #c4c0d0); text-align: center; max-width: 84px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-srv-dot { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 999px; background: var(--red, #ed4245);
  color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 5px; border: 2px solid var(--bg-deep, #0d0b16); }

/* servers channel-list back button (drill-down) */
#mServBack { display: none; }
body.mobile-shell.app-ready.mtab-servers.mserv-open:not(.mchat-open) #mServBack {
  display: flex; position: fixed; left: 10px; top: calc(env(safe-area-inset-top, 0px) + 8px); z-index: 330;
  width: 34px; height: 34px; align-items: center; justify-content: center; border: none; border-radius: 10px;
  background: color-mix(in srgb, var(--bg-void, #08060f) 72%, transparent); color: var(--text-primary, #fff);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); cursor: pointer;
}

/* profile */
.m-prof-banner { height: 118px; background: var(--accent, #7b6cff) center/cover no-repeat; flex-shrink: 0; }
.m-prof-card { padding: 0 16px; margin-top: -40px; }
.m-prof-av { width: 86px; height: 86px; border-radius: 50%; border: 4px solid var(--bg-deep, #0d0b16); background: var(--bg-elevated, #191622) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: 30px; }
.m-prof-name { font: 700 21px var(--font-display, 'Space Grotesk', system-ui); color: var(--text-primary, #fff); margin-top: 8px; }
.m-prof-user { font-size: 14px; color: var(--text-muted, #8b879c); }
.m-status-row { display: flex; gap: 8px; padding: 4px 16px 8px; flex-wrap: wrap; }
.m-status-btn { display: flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border, #23202e);
  background: var(--bg-void, #08060f); color: var(--text-secondary, #c4c0d0); font-size: 13px; font-weight: 600; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.m-status-btn.active { border-color: var(--accent, #7b6cff); color: var(--text-primary, #fff); background: var(--accent-dim, rgba(123,108,255,.16)); }
.m-status-dot { width: 9px; height: 9px; border-radius: 50%; }
.m-prof-list { margin: 16px 0; }
.m-prof-item { display: flex; align-items: center; gap: 14px; padding: 15px 16px; cursor: pointer; border-top: 1px solid var(--border, #23202e);
  color: var(--text-primary, #fff); font-size: 15px; font-weight: 500; -webkit-tap-highlight-color: transparent; }
.m-prof-item:last-child { border-bottom: 1px solid var(--border, #23202e); }
.m-prof-item:active { background: var(--bg-hover, #221d33); }
.m-prof-item svg { color: var(--text-muted, #8b879c); flex-shrink: 0; }
.m-prof-item .m-chev { margin-left: auto; color: var(--text-muted, #8b879c); font-size: 20px; line-height: 1; }
.m-prof-item.danger { color: var(--red, #ed4245); } .m-prof-item.danger svg { color: var(--red, #ed4245); }

/* bottom tab bar */
#mTabBar { display: none; }
body.mobile-shell.app-ready #mTabBar {
  display: flex; position: fixed; left: 0; right: 0; bottom: 0;
  height: calc(var(--mtab-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-void, #08060f); border-top: 1px solid var(--border, #23202e); z-index: 400;
}
.m-tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: none; color: var(--text-muted, #8b879c); cursor: pointer; position: relative;
  font: 600 10px/1 var(--font-sans, system-ui); -webkit-tap-highlight-color: transparent; padding-top: 4px; }
.m-tab svg { width: 23px; height: 23px; }
.m-tab.active { color: var(--text-primary, #fff); }
.m-tab.active .m-tab-ic { color: var(--accent, #7b6cff); }
.m-tab-av { width: 23px; height: 23px; border-radius: 50%; background: var(--bg-elevated, #191622) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; box-shadow: inset 0 0 0 1px var(--border, #23202e); }
.m-tab.active .m-tab-av { box-shadow: inset 0 0 0 2px var(--accent, #7b6cff); }
.m-tab-dot { position: absolute; top: 3px; left: calc(50% + 7px); width: 9px; height: 9px; border-radius: 50%;
  background: var(--red, #ed4245); display: none; box-shadow: 0 0 0 2px var(--bg-void, #08060f); }
.m-tab.has-unread .m-tab-dot { display: block; }

/* ---- mobile SETTINGS: turn the horizontal tab strip into a vertical
   category list that drills into a full-screen detail pane (body.mset-detail). ---- */
body.mobile-shell .settings-modal-full { flex-direction: column; }
body.mobile-shell .settings-sidebar {
  width: 100% !important; height: 100%; flex-direction: column !important; align-items: stretch !important;
  overflow-y: auto; overflow-x: hidden; gap: 1px;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 12px 28px !important; border-bottom: none !important;
}
body.mobile-shell .settings-sidebar .settings-nav-section,
body.mobile-shell .settings-sidebar .settings-nav-sep,
body.mobile-shell #settingsVersionBox { display: block !important; }
body.mobile-shell .settings-nav-item {
  flex-shrink: 0; white-space: normal !important; padding: 14px 14px !important; font-size: 15.5px; border-radius: 10px;
}
body.mobile-shell .settings-nav-item::after { content: '\203A'; float: right; color: var(--text-muted); font-size: 19px; line-height: 1; opacity: .6; }
body.mobile-shell #settingsSidebarUser { border-bottom: 1px solid var(--border) !important; margin-bottom: 8px !important; padding: 6px 10px 16px !important; }
body.mobile-shell #settingsSidebarUser > div:last-child { display: block !important; }
body.mobile-shell.mset-detail .settings-sidebar { display: none !important; }
body.mobile-shell:not(.mset-detail) .settings-content { display: none !important; }
body.mobile-shell.mset-detail .settings-content { padding-top: calc(env(safe-area-inset-top, 0px) + 52px); }

/* floating back chips (servers channel-list + settings detail) */
#mSetBack { display: none; }
body.mobile-shell.mset-detail #mSetBack {
  display: flex; position: fixed; left: 10px; top: calc(env(safe-area-inset-top, 0px) + 10px); z-index: 100000;
  width: 36px; height: 36px; align-items: center; justify-content: center; border: none; border-radius: 10px;
  background: var(--bg-elevated, #191622); color: var(--text-primary, #fff); cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.35);
}
  
