/* ============================================================
   Stan Home — Dashboard (#02) + bottom-tab nav
   Phase 2 of the Stanchat.dc.html redesign. Self-contained: the
   #stan-home overlay is injected by stan-home.js and sits above the
   chat like the other overlays. Uses the design tokens from
   stan-design.css. Purple/Stan, dark-only.
   ============================================================ */

#stan-home {
  position: fixed; inset: 0; z-index: 60;
  background: radial-gradient(120% 60% at 50% 0%, #1a1330 0%, #0d0d12 50%, #08080c 100%);
  color: var(--text-primary);
  display: flex; flex-direction: column;
  font-family: var(--font-ui);
  overflow: hidden;
}
#stan-home.hidden { display: none; }

.sh-scroll {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(var(--safe-top) + 20px) 18px calc(96px + var(--safe-bottom));
}

/* header row */
.sh-head { display: flex; align-items: center; gap: 14px; }
.sh-avatar {
  width: 56px; height: 56px; border-radius: 18px; flex-shrink: 0;
  background: #17131f; border: 1px solid rgba(124,92,255,0.4);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 16px rgba(124,92,255,0.35);
}
.sh-avatar img { width: 46px; height: 46px; object-fit: contain; }
.sh-greet { flex: 1; min-width: 0; }
.sh-greet h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.5px; }
.sh-greet .sh-date { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.sh-mood {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  font-size: 12px; font-weight: 600; color: var(--green);
  background: var(--green-bg); border: 1px solid rgba(51,232,141,0.25);
  border-radius: 20px; padding: 6px 11px;
}
.sh-mood .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green); }

/* stat cards */
.sh-stats { display: flex; gap: 10px; margin-top: 20px; }
.sh-stat {
  flex: 1; background: var(--bg-card); border: 1px solid var(--accent-dim);
  border-radius: 16px; padding: 13px; min-width: 0;
}
.sh-stat .n { font-size: 22px; font-weight: 700; color: var(--accent-soft); }
.sh-stat .n.small { font-size: 13px; color: var(--text-primary); }
.sh-stat .row { display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--green); }
.sh-stat .row .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.sh-stat .k { font-size: 11px; color: var(--text-dim); line-height: 1.3; margin-top: 6px; }

/* section label */
.sh-label { font-size: 13px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin: 22px 4px 10px; }

/* continue / recent list */
.sh-list { display: flex; flex-direction: column; gap: 9px; }
.sh-item {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  background: var(--bg-card); border: 1px solid var(--accent-dim);
  border-radius: 15px; padding: 13px 14px; transition: transform .1s ease, border-color .15s ease;
}
.sh-item:active { transform: scale(0.985); border-color: var(--accent-border); }
.sh-item .ico {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(124,92,255,0.16); color: var(--accent-soft);
  font-family: var(--font-mono); font-size: 14px;
}
.sh-item .body { flex: 1; min-width: 0; }
.sh-item .body .t { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-item .body .s { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-item .when { font-size: 11px; color: var(--text-dim); flex-shrink: 0; }
.sh-empty { font-size: 13px; color: var(--text-dim); padding: 4px 4px 0; }

/* quick actions grid */
.sh-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sh-qa {
  background: var(--bg-card); border: 1px solid var(--accent-dim);
  border-radius: 15px; padding: 14px; cursor: pointer;
  display: flex; flex-direction: column; gap: 8px; transition: transform .1s ease;
}
.sh-qa:active { transform: scale(0.97); }
.sh-qa.primary { background: linear-gradient(135deg, rgba(124,92,255,0.22), rgba(177,140,255,0.1)); border-color: var(--accent-border); }
.sh-qa svg { width: 22px; height: 22px; }
.sh-qa span { font-size: 14px; font-weight: 600; }

/* bottom tab nav */
.sh-nav {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: calc(86px + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: rgba(13,13,18,0.85); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--accent-dim);
  display: flex; align-items: flex-start; justify-content: space-around;
  padding-top: 12px; z-index: 30;
}
.sh-tab {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--text-dim); cursor: pointer; background: none; border: none;
  font-family: inherit; -webkit-tap-highlight-color: transparent;
}
.sh-tab svg { width: 24px; height: 24px; }
.sh-tab span { font-size: 10px; }
.sh-tab.active { color: var(--accent-soft); }
.sh-tab.active span { font-weight: 600; }

/* Home entry button injected into the app topbar */
#home-btn svg { stroke: currentColor; }
