/* ═══════════════════════════════════════════════
   CONNEK SUPER APP — Shell Layout
   Header · Main · Bottom Nav · Modals
═══════════════════════════════════════════════ */

/* ── TOP HEADER ── */
.shell-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--header-height) + var(--safe-area-top));
  padding-top: var(--safe-area-top);
  background: rgba(13, 13, 26, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: var(--space-md);
  padding-right: var(--space-md);
  z-index: 100;
  transition: background var(--transition-med), border-color var(--transition-med);
}

.shell-header.scrolled {
  background: rgba(13, 13, 26, 0.98);
  border-bottom-color: var(--border-medium);
}

/* Header Left — Logo */
.header-left {
  flex: 0 0 auto;
}

.logo-mark {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Header Center — Greeting */
.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0 var(--space-sm);
}

.greeting-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: color var(--transition-med);
}

/* Header Right — Points + Icons */
.header-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.points-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.25);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.points-badge:hover, .points-badge:active {
  background: rgba(255, 215, 0, 0.2);
  transform: scale(0.97);
}

#pointsValue {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-gold);
  font-variant-numeric: tabular-nums;
}

.points-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 500;
}

.icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.icon-btn:hover, .icon-btn:active {
  background: var(--bg-card);
  color: var(--text-primary);
}

.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--status-error);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-shell);
  display: none;
}

.notif-dot.visible { display: block; }

.avatar-btn {
  padding: 2px;
}

.avatar-ring {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  border: 2px solid var(--accent-primary);
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  background: var(--bg-card);
}

.avatar-btn:hover .avatar-ring,
.avatar-btn:active .avatar-ring {
  border-color: var(--accent-secondary);
  box-shadow: 0 0 12px rgba(0,200,150,0.4);
}

.avatar-ring img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── MAIN CONTENT AREA ── */
.shell-main {
  position: fixed;
  top: calc(var(--header-height) + var(--safe-area-top));
  left: 0;
  right: 0;
  bottom: calc(var(--nav-height) + var(--safe-area-bottom));
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-shell);
}

/* ── TAB VIEWS ── */
.tab-view {
  display: none;
  min-height: 100%;
  animation: fadeIn var(--transition-med) ease forwards;
}

.tab-view.active {
  display: block;
}

/* ── COUNTRY BANNER ── */
.country-banner {
  position: relative;
  padding: var(--space-md) var(--space-md) var(--space-sm);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  overflow: hidden;
}

.country-flag-strip {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}

.country-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.country-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.country-motto {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ── SECTION HEADERS ── */
.section-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md) 0;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.section-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.see-all-btn {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-primary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.see-all-btn:hover, .see-all-btn:active {
  background: rgba(0,200,150,0.1);
}

/* ── BOTTOM NAV ── */
.shell-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + var(--safe-area-bottom));
  padding-bottom: var(--safe-area-bottom);
  background: var(--bg-nav);
  border-top: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-nav);
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding-top: var(--space-xs);
  z-index: 100;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  /* Scrollable: items fill the bar when few, scroll when many */
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

.shell-nav::-webkit-scrollbar { display: none; }

.nav-item {
  flex: 1 0 auto;
  min-width: 68px;
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--space-sm) var(--space-xs);
  color: var(--text-muted);
  transition: color var(--transition-fast), transform var(--transition-fast);
  border-radius: var(--radius-md);
  position: relative;
}

.nav-item:hover, .nav-item:active {
  transform: scale(0.95);
}

.nav-item.active {
  color: var(--accent-primary);
}

.nav-item.active .nav-icon::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--accent-primary);
  border-radius: var(--radius-full);
}

.nav-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-label {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── CENTER FAB BUTTON (inline within scrollable bar) ── */
.nav-center-btn {
  flex: 1 0 auto;
  min-width: 68px;
}

.nav-fab {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--fab-bg, linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-fab);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  color: #000;
}

.nav-fab svg { width: 22px; height: 22px; }

.nav-center-btn:hover .nav-fab,
.nav-center-btn:active .nav-fab {
  transform: scale(0.92);
  box-shadow: none;
}

.nav-center-btn .nav-label {
  color: var(--text-muted);
}

/* Bridge AI FAB — purple-to-green AI gradient */
.nav-fab--ai {
  background: linear-gradient(135deg, #7C3AED 0%, #009E60 100%);
  box-shadow: 0 6px 24px rgba(124,58,237,0.45);
  color: #fff;
}

.nav-center-btn#navAiBtn .nav-label {
  color: #9D72FF;
  font-weight: 700;
}

/* ── PLACEHOLDER VIEWS ── */
.placeholder-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: var(--space-md);
  padding: var(--space-xl);
  text-align: center;
}

.placeholder-icon {
  opacity: 0.5;
}

.placeholder-view h3 {
  font-size: 1.3rem;
  color: var(--text-primary);
}

.placeholder-view p {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 240px;
}

.phase-badge {
  display: inline-flex;
  padding: 4px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
}

/* ── MODAL OVERLAY ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-med);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-modal);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-md) var(--space-md) calc(var(--space-xl) + var(--safe-area-bottom));
  transform: translateY(100%);
  transition: transform var(--transition-slow);
  max-height: 85vh;
  overflow-y: auto;
}

.modal-overlay.open .modal-sheet {
  transform: translateY(0);
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border-medium);
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-lg);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
  text-align: center;
}

/* ── COUNTRY LIST (inside modal) ── */
.country-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.country-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.country-list-item:hover, .country-list-item:active {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
  transform: scale(0.99);
}

.country-list-item.active {
  border-color: var(--accent-primary);
  background: rgba(0,200,150,0.08);
}

.country-list-item .flag { font-size: 1.5rem; }
.country-list-item .cname { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.country-list-item .greeting { font-size: 0.75rem; color: var(--text-muted); }
.country-list-item .checkmark { margin-left: auto; color: var(--accent-primary); opacity: 0; }
.country-list-item.active .checkmark { opacity: 1; }

/* ── WALLET VIEW ── */
.wallet-view {
  padding-bottom: var(--space-xl);
}

.wallet-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-xl) var(--space-md);
  overflow: hidden;
  text-align: center;
  background: var(--bg-surface);
  margin: var(--space-md);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.wallet-bg-glow {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: var(--accent-primary);
  opacity: 0.08;
  filter: blur(60px);
  animation: glowPulse 3s ease-in-out infinite;
}

.wallet-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  position: relative;
  z-index: 1;
}

.wallet-balance {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  margin: var(--space-sm) 0;
  position: relative;
  z-index: 1;
}

.balance-number {
  font-size: 3.5rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-variant-numeric: tabular-nums;
}

.balance-unit {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.wallet-equiv {
  font-size: 0.8rem;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}

.wallet-actions {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
}

.wallet-action-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.wallet-action-btn:hover, .wallet-action-btn:active {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.tx-list {
  padding: 0 var(--space-md);
}

.tx-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: var(--space-xl) 0;
}

/* ── ACTIVITY SECTION ── */
.activity-section {
  padding-bottom: var(--space-xl);
}

.activity-feed {
  padding: var(--space-sm) var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.activity-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  animation: slideUp var(--transition-med) ease forwards;
}

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.activity-text {
  flex: 1;
}

.activity-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.activity-desc {
  font-size: 0.73rem;
  color: var(--text-muted);
}

.activity-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── PROFILE VIEW ── */
.profile-view {
  padding: var(--space-lg) var(--space-md);
}

.profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-xl) 0;
  text-align: center;
}

.profile-avatar-wrap {
  position: relative;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  border: 3px solid var(--accent-primary);
  object-fit: cover;
  background: var(--bg-card);
}

.profile-country-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 28px;
  height: 28px;
  background: var(--bg-nav);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-nav);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.profile-name {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
}

.profile-handle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.profile-stats {
  display: flex;
  gap: var(--space-xl);
}

.profile-stat {
  text-align: center;
}

.stat-num {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent-primary);
}

.stat-lbl {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.profile-settings-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  margin-top: var(--space-lg);
}

.settings-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border-subtle);
}

.settings-item:last-child { border-bottom: none; }
.settings-item:hover, .settings-item:active { background: var(--bg-card-hover); }

.settings-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
}

.settings-label {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.settings-value {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.settings-chevron {
  color: var(--text-muted);
}

/* ── Theme toggle switch ── */
.settings-item--toggle {
  cursor: default;
}
.settings-item--toggle:hover,
.settings-item--toggle:active {
  background: transparent;
}

.theme-switch {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.theme-switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}
.theme-switch-track {
  position: absolute;
  inset: 0;
  background: var(--bg-card);
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-full);
  transition: background 0.22s ease, border-color 0.22s ease;
  pointer-events: none;
}
.theme-switch-track::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.22s cubic-bezier(0.4,0,0.2,1), background 0.22s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.theme-switch input:checked + .theme-switch-track {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}
.theme-switch input:checked + .theme-switch-track::after {
  transform: translateX(20px);
  background: #ffffff;
}

/* Smooth transition for the whole page when theme switches */
html {
  transition: background-color 0.25s ease, color 0.25s ease;
}
body,
.shell-header,
.shell-nav,
.wpa-card,
.activity-item,
.profile-settings-list,
.settings-item,
.settings-icon,
.auth-gate {
  transition: background-color 0.25s ease, color 0.25s ease,
              border-color 0.25s ease, box-shadow 0.25s ease;
}

/* ════════════════════════════════════════
   BRIDGE AI WIDGET OVERLAY
   Floats over shell — shell stays visible & interactive behind it
════════════════════════════════════════ */
.ai-widget-root {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 300;
  pointer-events: none; /* taps fall through to shell above the panel */
}

.ai-widget-panel {
  pointer-events: auto;
  background: var(--bg-surface);
  border-radius: 22px 22px 0 0;
  border-top: 1px solid var(--border-subtle);
  box-shadow: 0 -10px 48px rgba(0,0,0,0.45), 0 -1px 0 rgba(124,58,237,0.25);
  height: 54vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: aiWidgetSlideUp 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes aiWidgetSlideUp {
  from { transform: translateY(100%); opacity: 0.6; }
  to   { transform: translateY(0);   opacity: 1; }
}
@keyframes aiWidgetSlideDown {
  from { transform: translateY(0);   opacity: 1; }
  to   { transform: translateY(100%); opacity: 0; }
}

.ai-widget-handle {
  width: 36px;
  height: 4px;
  background: var(--border-medium);
  border-radius: 2px;
  margin: 10px auto 2px;
  flex-shrink: 0;
}

/* ── Widget header ── */
.ai-widget-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 10px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.ai-widget-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7C3AED, #009E60);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.ai-widget-info { flex: 1; min-width: 0; }
.ai-widget-name { font-size: 0.88rem; font-weight: 700; color: var(--text-primary); }
.ai-widget-status {
  font-size: 0.62rem;
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  gap: 4px;
}
.ai-widget-status::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent-primary);
}
.ai-widget-expand,
.ai-widget-close {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: 50%;
  width: 30px; height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.75rem;
  flex-shrink: 0;
  transition: background 0.15s;
}
.ai-widget-expand:active,
.ai-widget-close:active { background: var(--bg-card-hover); }

/* ── Messages ── */
.ai-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

/* Welcome state */
.ai-widget-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  flex: 1;
  padding: 16px;
}
.ai-ww-icon { font-size: 2rem; }
.ai-ww-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.ai-ww-desc  { font-size: 0.76rem; color: var(--text-secondary); }
.ai-ww-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 4px;
}
.ai-ww-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
  font-size: 0.72rem;
  padding: 5px 10px;
  border-radius: 9999px;
  cursor: pointer;
}
.ai-ww-chip:active { border-color: #7C3AED; color: #9D72FF; }

/* Message bubbles */
.ai-wm { max-width: 82%; animation: aiMsgIn 0.18s ease; }
@keyframes aiMsgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ai-wm--ai   { align-self: flex-start; }
.ai-wm--user { align-self: flex-end; }

.ai-wm-bubble {
  padding: 8px 12px;
  font-size: 0.84rem;
  line-height: 1.5;
  word-break: break-word;
  border-radius: 4px 14px 14px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}
.ai-wm--user .ai-wm-bubble {
  background: linear-gradient(135deg, #7C3AED, #009E60);
  border: none;
  color: #fff;
  border-radius: 14px 14px 4px 14px;
}
.ai-wm-time {
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-top: 3px;
  padding: 0 3px;
}
.ai-wm--user .ai-wm-time { text-align: right; }

/* Typing dots */
.ai-wm-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 11px 14px;
}
.ai-wm-typing span {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: aiTypingDot 1.2s infinite;
}
.ai-wm-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-wm-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes aiTypingDot {
  0%,60%,100% { opacity:0.3; transform:scale(0.8); }
  30%          { opacity:1;   transform:scale(1.1); }
}

/* ── Input bar ── */
.ai-widget-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 9px 12px;
  padding-bottom: calc(9px + env(safe-area-inset-bottom, 0px));
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.ai-wib-textarea {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: 18px;
  color: var(--text-primary);
  font-size: 0.86rem;
  font-family: inherit;
  padding: 8px 13px;
  resize: none;
  outline: none;
  overflow-y: auto;
  max-height: 88px;
  line-height: 1.4;
  transition: border-color 0.15s;
}
.ai-wib-textarea:focus { border-color: #7C3AED; }
.ai-wib-textarea::placeholder { color: var(--text-muted); }
.ai-wib-btn {
  background: none;
  border: none;
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  flex-shrink: 0;
  transition: transform 0.1s;
}
.ai-wib-btn:active { transform: scale(0.9); }
.ai-wib-mic {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
}
.ai-wib-mic.listening {
  background: rgba(255,82,82,0.12);
  border-color: #ff5252;
  color: #ff5252;
}
.ai-wib-send {
  background: linear-gradient(135deg, #7C3AED, #009E60);
  color: #fff;
}
.ai-wib-send:disabled {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  color: var(--text-muted);
}

/* ════════════════════════════════════════
   PINNED APPS ROW
════════════════════════════════════════ */
.pinned-section {
  padding: var(--space-sm) var(--space-md) 0;
}

.pinned-header {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.pinned-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.pinned-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 6px 0 10px;
}

.pinned-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.pinned-row::-webkit-scrollbar { display: none; }

.pinned-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  flex-shrink: 0;
  width: 60px;
  transition: transform var(--transition-fast);
  user-select: none;
  -webkit-user-select: none;
}

.pinned-card:active { transform: scale(0.9); }

.pinned-card-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.pinned-card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.pinned-card-name {
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  width: 100%;
}

/* Pin context menu (bottom action sheet) */
.pin-context-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.pin-context-menu {
  width: 100%;
  max-width: 480px;
  background: var(--bg-modal);
  border-radius: 18px 18px 0 0;
  padding: 14px 16px calc(24px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pin-menu-app-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: center;
  padding: 4px 0 12px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 4px;
}

.pin-menu-btn {
  width: 100%;
  padding: 15px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--transition-fast);
  text-align: center;
}

.pin-menu-btn:active { background: var(--bg-card-hover); }

.pin-menu-cancel {
  color: var(--text-muted);
  font-weight: 500;
}

/* ════════════════════════════════════════
   MY CITY TAB
════════════════════════════════════════ */
.city-view {
  padding-bottom: calc(var(--space-xl) * 2);
  min-height: 100%;
}

.city-header {
  padding: var(--space-lg) var(--space-md) var(--space-sm);
}

.city-main-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.city-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.city-section {
  margin-bottom: var(--space-sm);
}

/* Horizontal scrollable card row */
.city-scroll-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: var(--space-xs) var(--space-md) var(--space-sm);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.city-scroll-row::-webkit-scrollbar { display: none; }

/* Base card */
.city-card {
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 12px;
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition-fast);
}
.city-card:active {
  transform: scale(0.97);
  background: var(--bg-card-hover);
}

.city-card--biz { width: 155px; }
.city-card--topic { width: 210px; }

.city-card-icon {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-surface) 100%);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 10px;
  overflow: hidden;
}
.city-card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.city-card-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 5px;
}

.city-card-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 4px;
}

.city-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 6px;
}

.city-card-meta {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.city-card-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  background: var(--accent-primary);
  color: #fff;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.city-card-reactions {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.city-empty {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 24px 0;
  font-style: italic;
}

/* Loading skeletons */
.city-skeleton-block {
  margin: var(--space-md) var(--space-md) 0;
  height: 110px;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-card) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* Make see-all-btn work as an anchor */
a.see-all-btn {
  text-decoration: none;
}

/* ── NOTIFICATION PANEL ── */
.notif-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.notif-overlay.visible { display: block; opacity: 1; }

.notif-panel {
  position: fixed;
  top: 0;
  right: -320px;
  width: 320px;
  height: 100%;
  background: var(--bg-surface);
  z-index: 1001;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}
.notif-panel.open { right: 0; }

.notif-header {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.notif-header h3 { font-size: 1.1rem; font-weight: 700; margin: 0; }
.notif-close { background: none; border: none; font-size: 1.5rem; color: var(--text-muted); cursor: pointer; }

.notif-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.2s;
  cursor: pointer;
  display: flex;
  gap: 12px;
}
.notif-item:active { background: var(--bg-card); }
.notif-item.unread { background: rgba(64, 196, 255, 0.05); }
.notif-item-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--bg-card); flex-shrink: 0; }
.notif-item-content { flex: 1; min-width: 0; }
.notif-item-title { font-size: 0.88rem; font-weight: 700; margin-bottom: 2px; }
.notif-item-body { font-size: 0.78rem; color: var(--text-muted); line-height: 1.4; }
.notif-item-time { font-size: 0.68rem; color: var(--text-dim); margin-top: 4px; }

.notif-empty { padding: 40px 20px; text-align: center; color: var(--text-dim); font-size: 0.9rem; }
.notif-mark-all { padding: 14px; border: none; background: var(--bg-card); color: var(--accent-primary); font-size: 0.82rem; font-weight: 600; cursor: pointer; border-top: 1px solid var(--border-light); }
