/* Dashboard — post-login (isolated from global nav styles) */

body.dashboard-page {
  background: var(--shell-bg, #d4dce4);
  min-height: 100dvh;
  overflow-x: hidden;
}

.dashboard-shell {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  padding: 12px 12px 0;
}

.dashboard-app {
  width: 100%;
  max-width: 430px;
  min-height: calc(100dvh - 24px);
  display: flex;
  flex-direction: column;
  background: var(--surface-solid, #f4f7fa);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.38);
  overflow: hidden;
  position: relative;
}

/* ─── Topbar ─── */
.dashboard-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 16px;
  background: var(--surface-solid, #f4f7fa);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.dashboard-logo {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  line-height: 0;
}

.dashboard-logo:not(:has(.site-logo__img)) {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 20px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: -0.3px;
  line-height: normal;
}

.dashboard-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dashboard-plan-badge {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(124, 58, 237, 0.22);
  font-weight: 500;
}

.dashboard-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent-gradient, linear-gradient(135deg, #a78bfa 0%, #7c3aed 50%, #6d28d9 100%));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
  overflow: hidden;
}

.dashboard-avatar.has-avatar-img {
  background: rgba(124, 58, 237, 0.12);
}

.dashboard-avatar .avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* ─── Main scroll ─── */
.dashboard-main {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  -webkit-overflow-scrolling: touch;
}

.dashboard-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dashboard-section-last {
  padding-bottom: 8px;
}

.dashboard-hero {
  gap: 8px;
}

.dashboard-greeting-date {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.dashboard-greeting-name {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 32px;
  font-weight: 500;
  line-height: 1.12;
  color: var(--fg);
}

.dashboard-greeting-sub {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.55;
}

.dashboard-section-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dashboard-section-title {
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  font-weight: 500;
}

.dashboard-section-sub {
  font-size: 13px;
  color: var(--muted);
}

/* ─── Streak ─── */
.dashboard-streak-card {
  background: var(--surface-solid, #f4f7fa);
  border: 1px solid rgba(124, 58, 237, 0.18);
  border-radius: 22px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: 0 8px 28px rgba(124, 58, 237, 0.08);
}

.dashboard-streak-fire {
  font-size: 40px;
  line-height: 1;
  flex-shrink: 0;
  animation: dashboard-flicker 2.4s ease-in-out infinite;
}

@keyframes dashboard-flicker {
  0%, 100% { transform: scale(1) rotate(-2deg); }
  50% { transform: scale(1.08) rotate(2deg); }
}

.dashboard-streak-info {
  flex: 1;
  min-width: 0;
}

.dashboard-streak-count {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 28px;
  font-weight: 500;
  color: var(--fg);
  line-height: 1;
  margin-bottom: 6px;
}

.dashboard-streak-count span {
  font-size: 15px;
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
}

.dashboard-streak-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.dashboard-streak-dots {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.dashboard-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(18, 50, 56, 0.12);
}

.dashboard-dot.filled {
  background: var(--accent);
}

.dashboard-dot.today {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.22);
}

/* ─── Mode cards ─── */
.dashboard-modes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.dashboard-mode-card {
  background: var(--surface-solid, #f4f7fa);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px 16px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  position: relative;
  overflow: hidden;
  user-select: none;
  text-decoration: none;
  color: inherit;
  display: block;
  box-shadow: 0 4px 16px rgba(18, 50, 56, 0.04);
}

.dashboard-mode-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(124, 58, 237, 0.14);
  border-color: rgba(124, 58, 237, 0.35);
}

.dashboard-mode-card.wide {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.06), var(--surface-solid, #f4f7fa));
  border-color: rgba(124, 58, 237, 0.22);
}

.dashboard-mode-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  margin-bottom: 12px;
}

.dashboard-mode-card.wide .dashboard-mode-icon {
  margin-bottom: 0;
}

.dashboard-mode-card.wide .dashboard-mode-text {
  flex: 1;
}

.dashboard-mode-name {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 17px;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 5px;
}

.dashboard-mode-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.dashboard-mode-arrow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.dashboard-last-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 6px 12px;
  margin-top: 4px;
  border: 1px solid rgba(124, 58, 237, 0.15);
}

.dashboard-last-mode-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.dashboard-last-mode-pill[hidden] {
  display: none;
}

/* ─── History ─── */
.dashboard-section-head-row{
  flex-direction:row;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}

.dashboard-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dashboard-history-card-wrap {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.dashboard-history-card-wrap .dashboard-history-card {
  flex: 1;
  min-width: 0;
}

.dashboard-history-card {
  background: var(--surface-solid, #f4f7fa);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 12px rgba(18, 50, 56, 0.04);
}

.dashboard-history-card:hover {
  border-color: rgba(124, 58, 237, 0.35);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.1);
  transform: translateY(-1px);
}

.dashboard-history-mode-dot {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.dashboard-history-body {
  flex: 1;
  min-width: 0;
}

.dashboard-history-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 8px;
}

.dashboard-history-mode-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.dashboard-history-date {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--muted);
  flex-shrink: 0;
}

.dashboard-history-excerpt {
  font-size: 14px;
  color: var(--fg);
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.75;
}

.dashboard-history-msgs {
  margin-top: 6px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--muted);
}

.dashboard-empty-state {
  text-align: center;
  padding: 36px 24px;
  background: var(--surface-solid, #f4f7fa);
  border: 1px dashed rgba(124, 58, 237, 0.25);
  border-radius: 20px;
}

.dashboard-empty-state-icon {
  font-size: 36px;
  margin-bottom: 14px;
}

.dashboard-empty-state-text {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.65;
}

.dashboard-empty-state-text a {
  color: var(--accent);
  font-weight: 500;
  text-decoration: underline;
}

.dashboard-topbar--minimal {
  justify-content: center;
  padding: 16px 22px 14px;
}

.dashboard-topbar--minimal.dashboard-topbar--with-menu {
  justify-content: space-between;
}


.dashboard-topbar--with-menu .app-menu {
  margin-left: auto;
}

.dashboard-topbar--minimal .dashboard-logo {
  font-size: 18px;
}

@media (min-width: 480px) {
  .dashboard-shell {
    padding: 24px 24px 0;
  }

  .dashboard-app {
    border-radius: 32px 32px 0 0;
    min-height: calc(100dvh - 48px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-streak-fire {
    animation: none;
  }

  .dashboard-mode-card:hover,
  .dashboard-history-card:hover {
    transform: none;
  }
}
