/* StarHub (星枢助手) Mobile Design System — Deep Sea Teal */
:root {
  --font-display: "Outfit", -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", sans-serif;
  --font-sans: "DM Sans", -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", sans-serif;
  --font-mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;

  --bg: #ffffff;
  --surface: #f7faf9;
  --surface-2: #edf3f2;
  --fg: #1e293b;
  --fg-strong: #0f172a;
  --muted: #475569;
  --meta: #64748b;
  --border: #dce6e4;
  --border-soft: #eaf1f0;
  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, 0.09);
  --accent-on: #ffffff;
  --success: #15803d;
  --warning: #d97706;
  --danger: #dc2626;
  --overlay: rgba(15, 23, 42, 0.44);
}

[data-theme="dark"] {
  --bg: #0c1315;
  --surface: #121c1f;
  --surface-2: #1a282c;
  --fg: #ecf5f4;
  --fg-strong: #ffffff;
  --muted: #9eb3b5;
  --meta: #799194;
  --border: #26393e;
  --border-soft: #1d2d31;
  --accent: #2dd4bf;
  --accent-soft: rgba(45, 212, 191, 0.14);
  --accent-on: #042f2e;
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --overlay: rgba(0, 0, 0, 0.65);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-sans);
  background: #eceff4;
  color: var(--fg);
  font-size: 15px;
  line-height: 1.55;
}
[data-theme="dark"] body { background: #090b0e; }
button, input, textarea { font: inherit; color: inherit; }
.svg-ic {
  display: inline-block;
  vertical-align: -0.16em;
  flex-shrink: 0;
}

/* Desktop Preview Frame -> Native Fullscreen on Mobile */
.phone-stage {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 12px;
}
.phone-frame {
  width: 392px;
  height: 844px;
  max-height: calc(100dvh - 36px);
  background: var(--bg);
  border-radius: 36px;
  border: 6px solid #1d2028;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
@media (max-width: 520px) {
  .phone-stage { padding: 0; }
  .phone-frame {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    border: 0;
    box-shadow: none;
  }
}

.m-status-strip {
  height: 34px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}

.m-header {
  min-height: 54px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}
.m-icon-btn {
  min-width: 40px;
  min-height: 40px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--fg-strong);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.m-icon-btn:active { background: var(--surface-2); }

.m-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 24px;
  -webkit-overflow-scrolling: touch;
}

/* Active Chat Timeline (No BottomNav stealing space!) */
.m-chat-msg {
  margin-bottom: 18px;
}
.m-chat-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--meta);
  margin-bottom: 4px;
}
.m-chat-body {
  font-size: 15px;
  line-height: 1.62;
  color: var(--fg);
}
.m-chat-body p { margin: 0 0 8px; }
.m-chat-body p:last-child { margin-bottom: 0; }
.m-chat-body code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 5px;
}

.m-composer {
  padding: 8px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border-soft);
  background: var(--bg);
  flex-shrink: 0;
}
.m-composer-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px 12px 8px;
}
.m-composer-input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  resize: none;
  min-height: 38px;
  max-height: 96px;
  font-size: 15px;
}
.m-composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}
.m-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 0;
  background: var(--accent);
  color: var(--accent-on);
  display: grid;
  place-items: center;
  cursor: pointer;
}

/* Top-level Hub Bottom Navigation (Hidden inside active chat per DESIGN.md!) */
.m-tabbar {
  height: calc(58px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  border-top: 1px solid var(--border);
  background: var(--bg);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  flex-shrink: 0;
}
.m-tab {
  border: 0;
  background: transparent;
  color: var(--meta);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11.5px;
  cursor: pointer;
  position: relative;
}
.m-tab.active {
  color: var(--accent);
  font-weight: 600;
}
.m-tab-badge {
  position: absolute;
  top: 5px;
  right: 22px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-on);
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* Bottom Sheet */
.m-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  z-index: 40;
}
.m-sheet {
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  padding: 18px 18px calc(20px + env(safe-area-inset-bottom, 0px));
  max-height: 82%;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}

.m-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  background: var(--bg);
  margin-bottom: 12px;
}
.m-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 6px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
}
.m-btn {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg-strong);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
}
.m-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-on);
}
.m-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--surface-2);
  color: var(--muted);
}
