/* Mobile Workbench Framework & Shell Scoping (Amber Light/Dark) */

:root,
html[data-theme="light"] {
  --mw-bg: #f7f2ea;
  --mw-surface: #fffdf9;
  --mw-surface-2: #efe8dc;
  --mw-text: #2b241d;
  --mw-text-2: #6b5e50;
  --mw-accent: #9f4b1c;
  --mw-accent-icon: #b85c28;
  --mw-accent-fg: #fffdf9;
  --mw-accent-soft: #f5e5d8;
  --mw-border: #dfd5c7;
  --mw-border-strong: #cfc2b0;
  --mw-danger-bg: #f8e5df;
  --mw-danger-fg: #9c3419;
  --mw-warn-bg: #f6ead6;
  --mw-warn-fg: #8c5214;
  --mw-ok-bg: #e7efe6;
  --mw-ok-fg: #2f5e39;
  --mw-shadow: 0 4px 16px rgba(43, 36, 29, 0.08);
  --mw-radius-card: 16px;
  --mw-radius-sm: 12px;
  --mw-radius-pill: 999px;
  --mw-bottom-nav-h: 60px;
  --mw-font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

html[data-theme="dark"] {
  --mw-bg: #1b1815;
  --mw-surface: #25211d;
  --mw-surface-2: #312b25;
  --mw-text: #f3ece2;
  --mw-text-2: #a99c8d;
  --mw-accent: #ec8d56;
  --mw-accent-icon: #ec8d56;
  --mw-accent-fg: #1b1815;
  --mw-accent-soft: #3a2b21;
  --mw-border: #3a332c;
  --mw-border-strong: #4d443b;
  --mw-danger-bg: #3e251e;
  --mw-danger-fg: #f39d84;
  --mw-warn-bg: #3c2f1d;
  --mw-warn-fg: #ebb055;
  --mw-ok-bg: #233326;
  --mw-ok-fg: #98ca9f;
  --mw-shadow: 0 8px 24px rgba(0, 0, 0, 0.36);
}

/* Ordinary narrow-view desktop sidebar entry (only selector touching desktop) */
.mw-sidebar-entry {
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--mw-accent);
  background: var(--mw-accent-soft);
  border: 1px solid var(--mw-border);
  text-decoration: none;
}

/* ===== Scoped Mobile App Mode Shell ===== */
html.mw-app-mode,
body.mw-app-mode {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--mw-bg);
  color: var(--mw-text);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

html.mw-app-mode .app > .main > header.topbar,
html.mw-app-mode #sidebar,
body.mw-app-mode .app > .main > header.topbar,
body.mw-app-mode #sidebar {
  display: none !important;
}

html.mw-app-mode .app {
  display: block;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  min-width: 0;
  background: var(--mw-bg);
}

html.mw-app-mode .app > .main,
html.mw-app-mode #pages {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  box-sizing: border-box;
  background: var(--mw-bg);
}

html.mw-home-mode #pages > .page:not(#page-mobile-home),
html.mw-daily-mode #pages > #page-mobile-home {
  display: none !important;
}

/* ===== Framework Container & Views ===== */
#pages #page-mobile-home.mw-home-page {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--mw-bg);
  color: var(--mw-text);
  font-family: var(--mw-font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(var(--mw-bottom-nav-h) + 28px + env(safe-area-inset-bottom, 0px));
}

:where(#page-mobile-home, .mw-bottom-nav, .mw-dialog) *,
:where(#page-mobile-home, .mw-bottom-nav, .mw-dialog) *::before,
:where(#page-mobile-home, .mw-bottom-nav, .mw-dialog) *::after {
  box-sizing: border-box;
}

:where(#page-mobile-home) button,
:where(#page-mobile-home) input,
:where(.mw-bottom-nav) button,
:where(.mw-dialog) button {
  font-family: var(--mw-font-sans);
  color: inherit;
}

:where(#page-mobile-home) button,
:where(.mw-bottom-nav) button,
:where(.mw-dialog) button {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

:where(#page-mobile-home, .mw-bottom-nav, .mw-dialog) :focus-visible {
  outline: 2px solid var(--mw-accent);
  outline-offset: 2px;
}

.mw-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mw-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: block;
}

.mw-icon-sm {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: block;
}

.mw-shell {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  min-width: 0;
}

.mw-view {
  display: none;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.mw-view.is-active {
  display: flex;
}

.mw-view[hidden] {
  display: none !important;
}

/* ===== Headers ===== */
.mw-home-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.mw-home-heading {
  min-width: 0;
  flex: 1 1 auto;
}

.mw-simple-header {
  min-width: 0;
}

.mw-brand-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--mw-accent);
  letter-spacing: 0.02em;
  margin-bottom: 4px;
  max-width: 100%;
}

.mw-brand-eyebrow > span {
  overflow-wrap: anywhere;
}

.mw-brand-mark {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: block;
}

.mw-page-title {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
  color: var(--mw-text);
  overflow-wrap: anywhere;
}

.mw-page-subtitle {
  font-size: 14px;
  color: var(--mw-text-2);
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.mw-avatar-btn {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  padding: 10px;
  border-radius: var(--mw-radius-pill);
  background: var(--mw-surface);
  border: 1px solid var(--mw-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--mw-accent-icon);
  flex: 0 0 48px;
}

.mw-avatar-btn:hover {
  background: var(--mw-surface-2);
}

/* ===== Home Live Root & LiveUpdates Status ===== */
.mw-home-live-root {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.mw-home-live-root > .j22-update-status {
  margin: 0;
  padding: 8px 12px;
  border-radius: var(--mw-radius-sm);
  background: var(--mw-surface-2);
  border: 1px solid var(--mw-border);
  color: var(--mw-text-2);
  font-size: 13px;
  line-height: 1.4;
}

.mw-home-live-root > .j22-update-status[hidden] {
  display: none;
}

.mw-home-live-root > p[role="alert"] {
  margin: 0;
  padding: 14px 16px;
  border-radius: var(--mw-radius-card);
  background: var(--mw-danger-bg);
  border: 1px solid var(--mw-border-strong);
  color: var(--mw-danger-fg);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}

.mw-home-dynamic {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* ===== Cards & Sections ===== */
.mw-card {
  background: var(--mw-surface);
  border: 1px solid var(--mw-border);
  border-radius: var(--mw-radius-card);
  padding: 16px;
  min-width: 0;
}

.mw-status-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mw-status-card.is-danger {
  background: var(--mw-danger-bg);
  border-color: var(--mw-border-strong);
  color: var(--mw-danger-fg);
}

.mw-status-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.mw-status-desc {
  margin: 0;
  font-size: 14px;
  color: var(--mw-text-2);
  overflow-wrap: anywhere;
}

.mw-status-card.is-danger .mw-status-desc {
  color: var(--mw-danger-fg);
}

.mw-section-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.mw-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px;
  min-width: 0;
}

.mw-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--mw-text-2);
  margin: 0;
}

.mw-section-scope {
  font-size: 12px;
  color: var(--mw-text-2);
  overflow-wrap: anywhere;
}

.mw-text-link-btn {
  min-height: 48px;
  padding: 4px 8px;
  margin: -6px -8px -6px 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--mw-accent);
  flex-shrink: 0;
}

.mw-text-link-btn:hover {
  background: var(--mw-surface-2);
}

/* ===== Summary Card ===== */
.mw-summary-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.mw-summary-card {
  width: 100%;
  min-height: 88px;
  background: var(--mw-surface);
  border: 1px solid var(--mw-border);
  border-radius: var(--mw-radius-card);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.mw-summary-card:hover {
  border-color: var(--mw-border-strong);
  background: var(--mw-surface-2);
}

.mw-summary-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.mw-summary-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.mw-summary-icon-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--mw-accent-soft);
  color: var(--mw-accent-icon);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
}

.mw-summary-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--mw-text);
}

.mw-summary-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.mw-metric-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.mw-metric-label {
  font-size: 13px;
  color: var(--mw-text-2);
}

.mw-metric-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--mw-text);
  line-height: 1.2;
}

.mw-metric-value.is-overdue {
  color: var(--mw-danger-fg);
}

.mw-summary-arrow,
.mw-chevron {
  color: var(--mw-text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 20px;
}

.mw-summary-note {
  margin: 0;
  padding: 0 4px;
  font-size: 13px;
  color: var(--mw-text-2);
}

.mw-summary-note.is-accent {
  color: var(--mw-accent);
  font-weight: 600;
}

.mw-summary-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: var(--mw-radius-sm);
  background: var(--mw-danger-bg);
  color: var(--mw-danger-fg);
  font-size: 13px;
}

.mw-inline-btn {
  min-height: 48px;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--mw-surface);
  border: 1px solid var(--mw-border-strong);
  color: var(--mw-text);
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

/* ===== Apps Rows & Quick New ===== */
.mw-current-app-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.mw-app-row-card {
  width: 100%;
  background: var(--mw-surface);
  border: 1px solid var(--mw-border);
  border-radius: var(--mw-radius-card);
  padding: 14px 16px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.mw-app-row-card:hover {
  border-color: var(--mw-border-strong);
  background: var(--mw-surface-2);
}

.mw-app-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}

.mw-app-icon-box {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--mw-surface-2);
  color: var(--mw-accent-icon);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
}

.mw-app-icon-box.is-primary {
  background: var(--mw-accent-soft);
}

.mw-app-text-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mw-app-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--mw-text);
  overflow-wrap: anywhere;
}

.mw-app-desc {
  font-size: 13px;
  color: var(--mw-text-2);
  overflow-wrap: anywhere;
}

.mw-quick-create-btn {
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 14px;
  background: var(--mw-surface);
  color: var(--mw-accent);
  border: 1px solid var(--mw-border-strong);
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  transition: background-color 0.15s ease;
}

.mw-quick-create-btn:hover:not(:disabled) {
  background: var(--mw-surface-2);
}

.mw-quick-create-btn:disabled,
.mw-quick-create-btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  color: var(--mw-text-2);
}

.mw-quick-hint {
  margin: -2px 4px 0;
  font-size: 12px;
  color: var(--mw-text-2);
  overflow-wrap: anywhere;
}

/* ===== Tags ===== */
.mw-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--mw-radius-pill);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  flex-shrink: 0;
}

.mw-tag-board {
  background: var(--mw-surface-2);
  color: var(--mw-text-2);
  border: 1px solid var(--mw-border);
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.mw-tag-overdue {
  background: var(--mw-danger-bg);
  color: var(--mw-danger-fg);
}

.mw-tag-blocked {
  background: var(--mw-warn-bg);
  color: var(--mw-warn-fg);
}

.mw-tag-normal {
  background: var(--mw-surface-2);
  color: var(--mw-text-2);
}

/* ===== Focus / Attention List ===== */
.mw-focus-card {
  background: var(--mw-surface);
  border: 1px solid var(--mw-border);
  border-radius: var(--mw-radius-card);
  overflow: hidden;
  min-width: 0;
}

.mw-focus-item {
  width: 100%;
  min-height: 56px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--mw-border);
  min-width: 0;
}

.mw-focus-item:last-child {
  border-bottom: none;
}

.mw-focus-item:hover {
  background: var(--mw-surface-2);
}

.mw-focus-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.mw-focus-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--mw-text);
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.mw-focus-meta {
  font-size: 12px;
  color: var(--mw-danger-fg);
}

.mw-focus-empty {
  padding: 18px 16px;
  font-size: 14px;
  color: var(--mw-text-2);
  text-align: center;
}

/* ===== Apps Search & Groups ===== */
.mw-search-box {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.mw-search-icon {
  position: absolute;
  left: 14px;
  color: var(--mw-text-2);
  pointer-events: none;
  display: inline-flex;
  align-items: center;
}

.mw-search-input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 10px 48px 10px 42px;
  background: var(--mw-surface);
  border: 1px solid var(--mw-border);
  border-radius: 14px;
  font-size: 15px;
  color: var(--mw-text);
  appearance: none;
  -webkit-appearance: none;
}

.mw-search-input::placeholder {
  color: var(--mw-text-2);
}

.mw-search-clear-btn {
  position: absolute;
  right: 0;
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--mw-text-2);
}

.mw-search-clear-btn[hidden] {
  display: none;
}

.mw-search-clear-btn:hover {
  background: var(--mw-surface-2);
  color: var(--mw-text);
}

.mw-apps-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.mw-apps-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.mw-empty-state {
  background: var(--mw-surface);
  border: 1px solid var(--mw-border);
  border-radius: var(--mw-radius-card);
  padding: 24px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.mw-empty-state-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--mw-text);
  margin: 0;
}

.mw-empty-state-desc {
  font-size: 13px;
  color: var(--mw-text-2);
  margin: 0;
  overflow-wrap: anywhere;
}

/* ===== Mine / Settings Page ===== */
.mw-mine-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.mw-account-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.mw-account-avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--mw-radius-pill);
  background: var(--mw-accent-soft);
  color: var(--mw-accent-icon);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 52px;
}

.mw-account-info {
  min-width: 0;
  flex: 1 1 auto;
}

.mw-account-name {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--mw-text);
  overflow-wrap: anywhere;
}

.mw-account-meta {
  font-size: 13px;
  color: var(--mw-text-2);
  margin: 3px 0 0;
  overflow-wrap: anywhere;
}

.mw-settings-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mw-card-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--mw-text-2);
  margin: 0;
}

.mw-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.mw-setting-text {
  min-width: 0;
  flex: 1 1 160px;
}

.mw-setting-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  color: var(--mw-text);
}

.mw-setting-sub {
  font-size: 13px;
  color: var(--mw-text-2);
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.mw-setting-divider {
  height: 1px;
  background: var(--mw-border);
  width: 100%;
}

.mw-setting-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.mw-segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--mw-surface-2);
  border: 1px solid var(--mw-border);
  border-radius: 12px;
  flex-shrink: 0;
}

.mw-segmented-btn {
  min-height: 48px;
  min-width: 60px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--mw-text-2);
  text-align: center;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.mw-segmented-btn[aria-pressed="true"] {
  background: var(--mw-surface);
  color: var(--mw-text);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.mw-install-steps {
  padding: 12px 14px;
  border-radius: var(--mw-radius-sm);
  background: var(--mw-surface-2);
  border: 1px solid var(--mw-border);
  font-size: 13px;
  color: var(--mw-text);
  line-height: 1.5;
}

.mw-install-steps p {
  margin: 0;
  overflow-wrap: anywhere;
}

.mw-install-tip {
  margin-top: 6px !important;
  color: var(--mw-text-2);
  font-size: 12px;
}

.mw-mine-footnote {
  margin: 0;
  padding: 0 4px;
  font-size: 13px;
  color: var(--mw-text-2);
  line-height: 1.5;
}

/* ===== Shared Mobile Framework Buttons ===== */
.mw-btn {
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.mw-btn-compact {
  min-height: 48px;
  padding: 8px 16px;
  font-size: 14px;
}

.mw-btn-full {
  width: 100%;
}

.mw-btn-primary {
  background: var(--mw-accent);
  color: var(--mw-accent-fg);
}

.mw-btn-secondary {
  background: var(--mw-surface-2);
  border: 1px solid var(--mw-border-strong);
  color: var(--mw-text);
}

.mw-btn-danger-ghost {
  background: var(--mw-danger-bg);
  color: var(--mw-danger-fg);
}

/* ===== Fixed 3-Tab Bottom Navigation ===== */
.mw-bottom-nav {
  display: none;
}

html.mw-app-mode .mw-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: var(--mw-surface);
  border-top: 1px solid var(--mw-border);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
}

html.mw-app-mode .mw-nav-tab {
  min-height: var(--mw-bottom-nav-h);
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--mw-text-2);
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  position: relative;
  min-width: 0;
}

html.mw-app-mode .mw-nav-tab[aria-current="page"] {
  color: var(--mw-accent);
  font-weight: 700;
}

html.mw-app-mode .mw-nav-tab[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: 0;
  left: 24%;
  right: 24%;
  height: 2px;
  background: var(--mw-accent);
  border-radius: 0 0 2px 2px;
}

/* ===== Non-blocking Navigation Busy Notice ===== */
.mw-nav-notice {
  display: none;
}

html.mw-app-mode .mw-nav-notice:not([hidden]) {
  display: block;
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--mw-bottom-nav-h) + 14px + env(safe-area-inset-bottom, 0px));
  max-width: 480px;
  margin: 0 auto;
  z-index: 45;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--mw-text);
  color: var(--mw-surface);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--mw-shadow);
}

/* Hide body-level mobile chrome while account auth gate is not ready */
.account-mode:not(.account-ready) .mw-bottom-nav,
.account-mode:not(.account-ready) .mw-nav-notice {
  display: none !important;
}

/* ===== App-Owned Leave Confirmation Dialog ===== */
dialog.mw-dialog {
  width: min(360px, calc(100vw - 32px));
  max-width: 100%;
  margin: auto;
  padding: 0;
  border: 1px solid var(--mw-border-strong);
  border-radius: 18px;
  background: var(--mw-surface);
  color: var(--mw-text);
  box-shadow: var(--mw-shadow);
  font-family: var(--mw-font-sans);
}

dialog.mw-dialog::backdrop {
  background: rgba(20, 16, 13, 0.54);
}

.mw-dialog-card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mw-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mw-dialog-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--mw-text);
}

.mw-dialog-close {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--mw-text-2);
}

.mw-dialog-close:hover {
  background: var(--mw-surface-2);
  color: var(--mw-text);
}

.mw-dialog-body {
  margin: 0;
  font-size: 14px;
  color: var(--mw-text-2);
  line-height: 1.5;
}

.mw-dialog-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

/* ===== Scoped view=daily: hide idle LiveUpdates block while keeping genuine errors visible ===== */
html.mw-daily-mode .live-updates:not(.error):not(.is-error):not(.danger):not(.warn):not([data-state="error"]):not([data-status="error"]):not([role="alert"]),
html.mw-daily-mode .live-status:not(.error):not(.is-error):not(.danger):not(.warn):not([data-state="error"]):not([data-status="error"]):not([role="alert"]),
html.mw-daily-mode .live-bar:not(.error):not(.is-error):not(.danger):not(.warn):not([data-state="error"]):not([data-status="error"]):not([role="alert"]),
html.mw-daily-mode [data-live-updates]:not(.error):not(.is-error):not([data-state="error"]):not([data-status="error"]),
html.mw-daily-mode [data-live-status]:not(.error):not(.is-error):not([data-state="error"]):not([data-status="error"]) {
  display: none;
}

/* ===== Narrow Phone (360px) & Short Landscape (e.g. 844x390) ===== */
@media (max-width: 380px) {
  #pages #page-mobile-home.mw-home-page {
    padding-left: 12px;
    padding-right: 12px;
  }

  .mw-card,
  .mw-summary-card,
  .mw-app-row-card {
    padding-left: 14px;
    padding-right: 14px;
  }
}

@media (max-height: 480px) {
  :root,
  html[data-theme="light"],
  html[data-theme="dark"] {
    --mw-bottom-nav-h: 52px;
  }

  #pages #page-mobile-home.mw-home-page {
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(var(--mw-bottom-nav-h) + 20px + env(safe-area-inset-bottom, 0px));
  }

  .mw-view {
    gap: 12px;
  }

  .mw-page-title {
    font-size: 20px;
  }

  html.mw-app-mode .mw-nav-tab {
    flex-direction: row;
    gap: 6px;
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.mw-app-mode *,
  html.mw-app-mode *::before,
  html.mw-app-mode *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
