/* ============================================================
   まごとも Dashboard — Light mode · independent white cards
   ============================================================ */
@import url('magotomo.css');

/* ── Page shell ── */
html {
  background-color: #f8f9fa;
}

body.dash-page {
  background-color: #f8f9fa !important;
  background-image: radial-gradient(circle, #e2e8f0 1px, transparent 1px) !important;
  background-size: 24px 24px !important;
  background-attachment: scroll;
  color: #1f2937;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  scroll-padding-top: calc(64px + 48px + 8px);
  scroll-padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  -webkit-tap-highlight-color: transparent;
}

/* Expo / WebView 埋め込み — ネイティブタブバー利用、Web側ナビ非表示 */
body.dash-page.dash-embed {
  scroll-padding-top: calc(48px + env(safe-area-inset-top, 0px));
  scroll-padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

body.dash-embed #mg-nav-root,
body.dash-embed .mg-mob-nav {
  display: none !important;
}

body.dash-embed .dash-sub-bar {
  top: 0;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  padding-bottom: 10px;
}

body.dash-embed .dash-shell {
  padding-top: calc(48px + env(safe-area-inset-top, 0px) + 12px);
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

body.dash-page .mg-nav {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  backdrop-filter: none;
}

body.dash-page #mg-footer-root {
  display: none;
}

.dash-shell {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(64px + 48px + 12px) 16px calc(28px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  width: 100%;
}

@media (min-width: 768px) {
  .dash-shell {
    padding-left: 20px;
    padding-right: 20px;
  }
}

/* ── Status sub-bar (fixed under nav) ── */
.dash-sub-bar {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  z-index: 180;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  color: #1f2937;
}

.dash-sub-bar--unpaired {
  background: #fffbeb;
  border-bottom-color: #fcd34d;
  color: #1f2937;
}

.dash-sub-bar--paired {
  background: #ffffff;
}

.dash-sub-bar--paired .sub-ssid {
  color: #00b464;
  font-weight: 800;
}

/* ── Card system ── */
.dash-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dash-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: none;
  overflow: hidden;
  color: #1f2937;
  margin-bottom: 0;
  width: 100%;
  box-sizing: border-box;
}

.dash-card-lock {
  padding: 32px 24px;
  text-align: center;
  margin: 8px 0 16px;
}

body.dash-page .mg-lock-title {
  color: #1f2937;
}

body.dash-page .mg-lock-desc {
  color: #374151;
}

.dash-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
}

.dash-card-title {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: #1f2937;
}

.dash-card-body {
  padding: 16px;
  background: #ffffff;
}

.dash-card-body-compact {
  padding: 16px;
}

.dash-card-body-flush {
  padding: 0 16px 16px;
}

/* User header */
.dash-user-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.dash-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.dash-lang-toggle {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  cursor: pointer;
  letter-spacing: 0.04em;
}

.dash-lang-toggle:hover {
  background: #e2e8f0;
}

/* Horizontal swipe carousels */
.dash-carousel-section {
  width: 100%;
}

.dash-carousel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  padding: 0 2px;
}

.dash-carousel-head--inner {
  margin-bottom: 6px;
  justify-content: center;
}

.dash-carousel-hint {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.04em;
}

.dash-carousel-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dash-carousel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: #cbd5e1;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.dash-carousel-dot.active {
  background: #00b464;
  transform: scale(1.15);
}

.dash-carousel-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.dash-carousel-track::-webkit-scrollbar {
  display: none;
}

.dash-carousel-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  min-width: 0;
}

.dash-stats-carousel-wrap {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
}

.dash-stats-carousel {
  gap: 10px;
}

.dash-stats-carousel .dash-carousel-slide {
  flex: 0 0 min(100%, 280px);
}

@media (min-width: 480px) {
  .dash-stats-carousel .dash-carousel-slide {
    flex-basis: min(88%, 300px);
  }
}

.dash-user-name {
  margin: 0;
  font-size: clamp(15px, 3.8vw, 17px);
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.04em;
  color: #0f172a;
  line-height: 1.3;
}

.dash-user-meta {
  margin: 4px 0 0;
  font-size: 11px;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.03em;
  color: #64748b;
}

.badge-plan {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(0, 180, 100, 0.08);
  color: #00b464;
  border: 1px solid rgba(0, 180, 100, 0.25);
}

/* Live badges */
.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-live.live {
  background: rgba(0, 180, 100, 0.1);
  color: #00b464;
  border: 1px solid rgba(0, 180, 100, 0.35);
}

.badge-live.live .live-dot {
  animation: livePulse 1.4s ease-in-out infinite;
  background: #00b464;
}

.badge-live.wait {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fdba74;
}

.badge-live.wait .live-dot {
  background: #ff8c00;
  animation: none;
}

.badge-live.offline {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fdba74;
}

.badge-live.offline .live-dot {
  background: #ff8c00;
  animation: none;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* 3D view — dark spatial canvas */
.dash-card-3d .view-3d-wrap {
  background: linear-gradient(165deg, #0f172a 0%, #1e293b 48%, #0f172a 100%);
  border-bottom-left-radius: inherit;
  border-bottom-right-radius: inherit;
}

.view-3d-full {
  position: relative;
  width: 100%;
  min-height: clamp(240px, 44vw, 340px);
  height: clamp(240px, 44vw, 340px);
  background: transparent;
  overflow: hidden;
}

.view-3d-full::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 120%, rgba(0, 180, 100, 0.12), transparent 55%),
    radial-gradient(circle at 20% 0%, rgba(56, 189, 248, 0.08), transparent 40%);
  pointer-events: none;
  z-index: 1;
}

#iso-dash {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

#iso-dash:active {
  cursor: grabbing;
}

.iso-cam-badge {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 14;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.06em;
  color: #67e8f9;
  background: rgba(2, 6, 23, 0.72);
  border: 1px solid rgba(34, 211, 238, 0.35);
  pointer-events: none;
}

.dash-loading {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(15, 23, 42, 0.88);
}

.dash-loading.visible { display: flex; }

.dash-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(148, 163, 184, 0.35);
  border-top-color: #34d399;
  border-radius: 50%;
  animation: dashSpin 0.85s linear infinite;
}

@keyframes dashSpin { to { transform: rotate(360deg); } }

.dash-loading-text {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
}

.dash-empty-state {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 20px;
  padding-bottom: 48px;
  text-align: center;
  pointer-events: none;
  background: transparent;
}

.dash-empty-state.visible { display: flex; }

.dash-empty-icon { font-size: 14px; opacity: 0.7; color: #67e8f9; font-family: ui-monospace, monospace; }

.dash-empty-state p {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #94a3b8;
  letter-spacing: 0.06em;
  max-width: 280px;
}

.dash-scan-label .ghost-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  letter-spacing: 0.04em;
}

.iso-pill,
.iso-count-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

#dash-3d-overlays {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  overflow: hidden;
}

.iso-heatmap-legend {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 9;
  display: flex;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.legend-item {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding-left: 12px;
  position: relative;
  color: #cbd5e1;
}

.legend-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-ok::before { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.legend-warn::before { background: #f97316; box-shadow: 0 0 6px #f97316; }
.legend-alert::before { background: #ef4444; box-shadow: 0 0 6px #ef4444; }

.dash-person-label {
  position: absolute;
  transform: translate(-50%, -100%);
  white-space: nowrap;
  font-size: 11px;
  font-weight: 800;
  color: #1f2937;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 5px 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.dash-person-label .bpm-num { color: #00b464; }

.dash-ghost-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(52, 211, 153, 0.45);
  pointer-events: auto;
  cursor: default;
  opacity: 0.78;
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.15);
}

.dash-ghost-label:hover {
  opacity: 1;
  transform: translate(-50%, -108%) scale(1.04);
  box-shadow: 0 0 18px rgba(52, 211, 153, 0.35);
  z-index: 20;
}

.dash-ghost-label .ghost-id {
  font-size: 10px;
  font-weight: 800;
  color: #6ee7b7;
  letter-spacing: 0.02em;
}

.dash-ghost-label .ghost-meta {
  font-size: 10px;
  font-weight: 600;
  color: #cbd5e1;
}

.dash-ghost-label .ghost-bpm {
  font-size: 10px;
  font-weight: 700;
  color: #34d399;
}

.dash-card-3d .iso-pill,
.dash-card-3d .iso-count-badge {
  background: rgba(15, 23, 42, 0.82);
  border-color: rgba(148, 163, 184, 0.35);
  color: #e2e8f0;
}

.spatial-intel-body { display: flex; flex-direction: column; gap: 16px; }

.spatial-metric-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.spatial-metric-label {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.spatial-metric-value {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  color: #0f766e;
}

.spatial-metric-mono {
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
}

.spatial-metric-sub {
  margin: 4px 0 0;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
}

.spatial-layout-alert { color: #dc2626 !important; }

.spatial-density-track {
  margin-top: 8px;
  height: 6px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.spatial-density-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #22c55e, #eab308, #ef4444);
  transition: width 0.4s ease;
}

.spatial-anomalies-list { display: flex; flex-direction: column; gap: 8px; }

.spatial-anomaly-empty {
  margin: 0;
  font-size: 12px;
  color: #64748b;
  padding: 8px 0;
}

.spatial-anomaly-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.spatial-anomaly-item--stagnation,
.spatial-anomaly-item--panic,
.spatial-anomaly-item--fall {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(254, 226, 226, 0.5);
}

.spatial-anomaly-type {
  font-size: 12px;
  font-weight: 800;
  color: #b91c1c;
}

.spatial-anomaly-detail {
  font-size: 11px;
  color: #374151;
}

.iso-pill,
.iso-count-badge {
  position: absolute;
  top: 10px;
  z-index: 8;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #374151;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.iso-pill { left: 10px; }
.iso-count-badge { right: 10px; color: #00b464; }

/* Stats grid — スマホ縦画面: 340px未満1列、それ以上2列 */
.dash-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}

@media (max-width: 339px) {
  .dash-stats-grid {
    grid-template-columns: 1fr;
  }
}

.dash-stat-card .dash-card-body {
  padding: 16px;
}

.dash-stat-card-wide {
  grid-column: 1 / -1;
}

.dash-stat-label {
  margin: 0 0 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #1f2937;
}

.dash-stat-emoji {
  display: block;
  font-size: 18px;
  margin-bottom: 4px;
}

.dash-stat-value {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.15;
  color: #1f2937;
}

.dash-stat-value.accent { color: #00b464; }

.dash-stat-sub {
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 500;
  color: #1f2937;
}

.stat-countdown-wrap {
  position: relative;
  display: inline-block;
  margin: 2px 0 4px;
}

.stat-countdown-val {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 800;
  color: #00b464;
}

/* CSI waveform & CSI bars */
.csi-wave-wrap {
  position: relative;
  min-height: 96px;
  background: #020617;
  border-radius: 12px;
  overflow: hidden;
}

#csi-wave-canvas {
  width: 100%;
  min-height: 84px;
  display: block;
  border-radius: 12px;
  background: #020617;
  border: 1px solid rgba(34, 211, 238, 0.22);
}

.csi-wave-stats {
  position: absolute;
  top: 8px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 10px;
  font-weight: 700;
  font-family: ui-monospace, monospace;
  color: rgba(148, 163, 184, 0.9);
  text-align: right;
  pointer-events: none;
}

.dash-card-csi-wave .dash-card-body-flush {
  padding: 0;
  background: #020617;
}

/* Vital monitors */
.dash-card-vital .dash-card-body {
  padding: 12px;
}

.vital-monitors-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vital-empty {
  margin: 0;
  padding: 20px 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
}

.vital-monitor-card {
  background: #041a0e;
  border: 1px solid rgba(0, 255, 136, 0.25);
  border-radius: 14px;
  padding: 10px 12px 12px;
  box-shadow: inset 0 0 24px rgba(0, 255, 136, 0.04);
}

.vital-monitor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.vital-subject-id {
  font-size: 13px;
  font-weight: 800;
  font-family: ui-monospace, monospace;
  color: #00ff88;
  letter-spacing: 0.04em;
}

.vital-live-pill {
  font-size: 10px;
  font-weight: 800;
  color: #34d399;
}

.vital-ecg-canvas {
  width: 100%;
  height: 72px;
  display: block;
  border-radius: 8px;
  background: #041a0e;
}

.vital-readout-row {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}

.vital-readout-row > div {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.vital-readout-label {
  font-size: 10px;
  font-weight: 800;
  color: #64748b;
  font-family: ui-monospace, monospace;
}

.vital-readout-val {
  font-size: 22px;
  font-weight: 900;
  color: #00ff88;
  font-family: ui-monospace, monospace;
  line-height: 1;
}

.vital-readout-unit {
  font-size: 10px;
  font-weight: 700;
  color: #475569;
  font-family: ui-monospace, monospace;
}

#csi-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 56px;
  padding: 8px 8px 0;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.csi-bar {
  flex: 1;
  min-height: 3px;
  border-radius: 2px 2px 0 0;
  background: #00b464;
  transition: height 0.65s ease;
}

.csi-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 500;
  color: #374151;
}

#cd-ring {
  transform-origin: 50% 50%;
  transform: rotate(-90deg);
  transition: stroke-dashoffset 0.9s linear;
}

/* Alerts */
#alert-banner {
  display: none;
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 16px;
  padding: 16px;
  align-items: flex-start;
  gap: 12px;
}

#alert-banner.shown { display: flex; }

.alert-title { font-size: 14px; font-weight: 800; color: #c2410c; }
.alert-body { font-size: 13px; color: #374151; line-height: 1.5; }

.alert-dismiss {
  background: #ff8c00;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.sensor-wait-banner {
  display: none;
  background: #ffffff;
  border: 1px dashed #e2e8f0;
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: #1f2937;
}

.sensor-wait-banner.visible { display: block; }
.sensor-wait-banner strong { color: #00b464; }

/* Timeline */
#timeline-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tl-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  margin-bottom: 8px;
}
.tl-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f8f9fa;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}
.tl-time { font-size: 11px; font-weight: 700; color: #64748b; font-family: ui-monospace, monospace; }
.tl-desc { font-size: 13px; font-weight: 700; color: #0f172a; margin-top: 4px; line-height: 1.45; }
.tl-connector { display: none; }

/* Live region visibility */
#dash-live-region { display: none; }
#dash-live-region.visible {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mg-lock-screen {
  display: none;
  margin: 0;
  max-width: none;
}

.mg-lock-screen.visible { display: block; }

.val-fade { animation: fadeVal 0.35s ease-out; }
@keyframes fadeVal {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Nav gear */
.gear-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #374151;
  text-decoration: none;
}

.gear-btn:hover { border-color: #00b464; color: #00b464; }

/* Mobile tab bar */
body.dash-page .mg-mob-nav {
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.04);
}

body.dash-page .mg-mob-nav-item {
  color: #1f2937;
  min-height: 52px;
  touch-action: manipulation;
}

body.dash-page .mg-mob-nav-item.active {
  color: #00b464;
}

/* Wi-Fi sheet */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  background: rgba(31, 41, 55, 0.25);
  backdrop-filter: blur(2px);
}

.sheet-backdrop.open { display: block; }

.wifi-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 301;
  display: none;
  max-height: 88vh;
  overflow-y: auto;
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
  background: #ffffff;
  border-radius: 20px 20px 0 0;
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
}

.wifi-sheet.open { display: block; animation: slideUp 0.28s ease-out; }

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.ws-handle {
  width: 40px;
  height: 4px;
  margin: 0 auto 16px;
  border-radius: 2px;
  background: #e2e8f0;
}

.wifi-sheet-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 800;
  color: #1f2937;
}

.wifi-sheet-desc {
  margin: 0 0 16px;
  font-size: 13px;
  color: #374151;
}

.ws-pair-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.ws-pair-ssid { font-size: 14px; font-weight: 700; color: #1f2937; }
.ws-pair-meta { font-size: 11px; color: #374151; margin-top: 2px; }

.ws-btn-remove {
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #374151;
  cursor: pointer;
}

.ws-status-ok {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(0, 180, 100, 0.06);
  border: 1px solid rgba(0, 180, 100, 0.25);
  border-radius: 12px;
}

.ws-status-ok-title { font-size: 13px; font-weight: 800; color: #00b464; }
.ws-status-ok-sub { font-size: 11px; color: #374151; margin-top: 2px; }

body.dash-page .mg-label {
  color: #374151;
}

body.dash-page .mg-input {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #1f2937;
}

body.dash-page .mg-input:focus {
  border-color: #00b464;
  box-shadow: 0 0 0 3px rgba(0, 180, 100, 0.12);
}
