/* ============================================================================
   Haidong Hub · Antigravity PWA — Apple iOS 18 Pearl-White Renovation
   Covers Level 1 (Home), Level 2 (All Sessions + Drawer), Level 3 (Detail + Modals)
   ============================================================================ */

:root,
html,
html[data-theme="light"],
body {
  --bg: #f5f7fb !important;
  --bg-elevated: #ffffff !important;
  --surface: #ffffff !important;
  --surface-2: #eef2f8 !important;
  --surface-hover: #f8fafc !important;
  --card-bg: #ffffff !important;
  --text: #0f172a !important;
  --text-primary: #0f172a !important;
  --text-secondary: #475569 !important;
  --text-muted: #64748b !important;
  --border: rgba(15, 23, 42, 0.07) !important;
  --accent: #2563eb !important;
  --accent-soft: rgba(37, 99, 235, 0.1) !important;
  color-scheme: light !important;
}

html,
body {
  background: linear-gradient(180deg, #f7f9fd 0%, #eef2f9 100%) !important;
  color: #0f172a !important;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent !important;
}

/* ==================== LEVEL 1: HOME WORKSPACE ==================== */
.app-header {
  background: rgba(247, 249, 253, 0.84) !important;
  backdrop-filter: blur(22px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(22px) saturate(180%) !important;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06) !important;
  color: #0f172a !important;
}

.app-header-title {
  color: #0f172a !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em !important;
}

.app-header-menu .menu-line {
  background: #334155 !important;
}

.hub-connection {
  background: rgba(255, 255, 255, 0.92) !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  color: #334155 !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04) !important;
}

.app-header-term,
.app-header-avatar {
  background: #ffffff !important;
  color: #1e293b !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05) !important;
}

.hub-hero {
  background: transparent !important;
  padding-top: 12px !important;
}

.hub-engine-label {
  color: #059669 !important;
  font-weight: 600 !important;
  letter-spacing: 0.02em !important;
}

#heroGreeting {
  color: #0f172a !important;
  font-weight: 750 !important;
  letter-spacing: -0.025em !important;
}

/* Floating Pure-White Composer Card */
.hub-composer {
  background: #ffffff !important;
  border: 1px solid rgba(15, 23, 42, 0.07) !important;
  border-radius: 26px !important;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.07), 0 2px 6px rgba(15, 23, 42, 0.03) !important;
  padding: 18px !important;
}

.hub-composer-heading h3 {
  color: #0f172a !important;
  font-weight: 700 !important;
}

.hub-composer-model {
  background: rgba(16, 185, 129, 0.1) !important;
  color: #047857 !important;
  border: 1px solid rgba(16, 185, 129, 0.22) !important;
  border-radius: 999px !important;
  font-weight: 600 !important;
}

.hub-prompt {
  color: #0f172a !important;
  background: transparent !important;
  font-size: 16px !important;
  line-height: 1.55 !important;
}

.hub-prompt::placeholder {
  color: #94a3b8 !important;
}

.hub-attach {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border: 1px solid rgba(15, 23, 42, 0.06) !important;
  border-radius: 14px !important;
}

.hub-send {
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 14px !important;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28) !important;
  font-weight: 600 !important;
}

.hub-shortcuts button {
  background: rgba(255, 255, 255, 0.94) !important;
  color: #1e293b !important;
  border: 1px solid rgba(15, 23, 42, 0.07) !important;
  border-radius: 16px !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04) !important;
}

.hub-recent-heading h3 {
  color: #0f172a !important;
  font-weight: 700 !important;
}

.hub-all-sessions {
  color: #2563eb !important;
  font-weight: 600 !important;
}

/* ==================== LEVEL 2: ALL SESSIONS & SIDE DRAWER ==================== */
#tabSessions {
  background: linear-gradient(180deg, #f7f9fd 0%, #eef2f9 100%) !important;
}

.hub-library-header {
  background: transparent !important;
}

.hub-library-title {
  color: #0f172a !important;
  font-weight: 750 !important;
  letter-spacing: -0.02em !important;
}

.hub-nav-button {
  background: #ffffff !important;
  color: #1e293b !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  border-radius: 999px !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04) !important;
}

.hub-library-search {
  background: #ffffff !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  border-radius: 16px !important;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04) !important;
}

.hub-library-search input {
  color: #0f172a !important;
}

.filter-pill {
  background: rgba(255, 255, 255, 0.9) !important;
  color: #475569 !important;
  border: 1px solid rgba(15, 23, 42, 0.07) !important;
  border-radius: 999px !important;
  font-weight: 500 !important;
}

.filter-pill.active {
  background: #0f172a !important;
  color: #ffffff !important;
  border-color: #0f172a !important;
  font-weight: 600 !important;
}

.hub-library-row,
.session-item {
  background: #ffffff !important;
  border: 1px solid rgba(15, 23, 42, 0.06) !important;
  border-radius: 18px !important;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04) !important;
  color: #0f172a !important;
  margin-bottom: 10px !important;
  transition: transform 0.14s ease, box-shadow 0.14s ease !important;
}

.hub-library-row:active,
.session-item:active {
  transform: scale(0.985) !important;
}

.hub-library-row-title,
.session-title-inline {
  color: #0f172a !important;
  font-weight: 600 !important;
}

.hub-library-row-summary,
.hub-library-row-time,
.session-time-inline {
  color: #64748b !important;
}

.hub-library-row-flags {
  color: #2563eb !important;
  font-weight: 600 !important;
}

/* Light Frosted Side Drawer */
.gemini-drawer {
  background: rgba(248, 250, 253, 0.96) !important;
  backdrop-filter: blur(28px) !important;
  -webkit-backdrop-filter: blur(28px) !important;
  color: #0f172a !important;
  border-right: 1px solid rgba(15, 23, 42, 0.08) !important;
}

.drawer-header,
.drawer-title,
.drawer-section-title {
  color: #0f172a !important;
}

.drawer-new-chat-btn {
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 16px !important;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25) !important;
}

.drawer-term-card,
.drawer-chip,
.drawer-footer-btn,
.grouped-card {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid rgba(15, 23, 42, 0.07) !important;
  border-radius: 16px !important;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.03) !important;
}

.drawer-term-launch-btn {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border: 1px solid rgba(37, 99, 235, 0.18) !important;
  border-radius: 12px !important;
}

/* ==================== LEVEL 3: CHAT DETAIL & MODALS ==================== */
.detail-view {
  background: linear-gradient(180deg, #f7f9fd 0%, #eef2f9 100%) !important;
  color: #0f172a !important;
}

.detail-header {
  background: rgba(247, 249, 253, 0.88) !important;
  backdrop-filter: blur(22px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(22px) saturate(180%) !important;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06) !important;
}

.detail-title {
  color: #0f172a !important;
  font-weight: 700 !important;
}

.detail-status {
  color: #64748b !important;
}

.detail-back-btn,
.detail-term-btn,
.detail-more-btn {
  background: #ffffff !important;
  color: #1e293b !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04) !important;
}

/* iMessage-style User Bubbles + Pure-White Elevated Assistant Cards */
.msg-row.user .msg-bubble,
.message.user .bubble,
.bubble.user {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 20px 20px 6px 20px !important;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.22) !important;
}

.msg-row.assistant .msg-bubble,
.message.assistant .bubble,
.bubble.assistant {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid rgba(15, 23, 42, 0.06) !important;
  border-radius: 20px 20px 20px 6px !important;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.05) !important;
  line-height: 1.68 !important;
}

.detail-messages pre,
.detail-messages code {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: rgba(15, 23, 42, 0.08) !important;
}

/* Detail Composer Pill */
.detail-composer {
  background: rgba(247, 249, 253, 0.9) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-top: 1px solid rgba(15, 23, 42, 0.06) !important;
}

.detail-input-wrap {
  background: #ffffff !important;
  border: 1px solid rgba(15, 23, 42, 0.1) !important;
  border-radius: 24px !important;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05) !important;
}

#detailFollowupInput {
  color: #0f172a !important;
}

.detail-send-btn {
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%) !important;
  color: #ffffff !important;
}

/* Action Sheet, Bot Modal, Passcode Lock Overlay */
.action-sheet,
.action-group,
.action-cancel,
.bot-edit-card,
.lock-card {
  background: rgba(255, 255, 255, 0.96) !important;
  color: #0f172a !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.14) !important;
}

.action-item {
  color: #0f172a !important;
  border-color: rgba(15, 23, 42, 0.07) !important;
}

.action-item.handoff-primary {
  color: #2563eb !important;
  font-weight: 600 !important;
}

.lock-overlay {
  background: linear-gradient(180deg, #f7f9fd 0%, #eef2f9 100%) !important;
}

.lock-card input,
#botEditInput {
  background: #f8fafc !important;
  color: #0f172a !important;
  border: 1px solid rgba(15, 23, 42, 0.12) !important;
}

/* Native Haidong Hub bottom floating Tab bar safe clearance */
body.haidong-hub-native .hub-workspace,
body.haidong-hub-native .hub-library-list {
  padding-bottom: 108px !important;
}

body.haidong-hub-native .detail-composer {
  padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important;
}
