/* What: styles for the iOS-parity home dashboard (cards, streak badge, trend chart, modal) and the journal-library screen.
   Called by: both app shells via <link>, after challenge-app.css.
   Depends on: challenge-app.css primitives (.card, .btn) and the token files. */

/* ── iOS-parity home dashboard (Step 3, 2026-09-04) — see project memory
   consal-ios-dashboard-spec-2026-09-04.md. Renders inside the same shared
   .card wrapper as every other screen (so render()/pressure-mode plumbing
   stays untouched), but needs a very different left-aligned, multi-card
   layout — :has() neutralizes .card's own centered/padded/bordered look
   for this screen only, without touching any other screen's .card. Colors
   come from tokens-ios-dashboard.css's --ios-* tokens (ported 1:1 from
   iOS's Theme.swift), never the site's Living Ritual tokens. */
.card:has(.dash-root) {
  background: transparent; border: none; box-shadow: none; border-radius: 0;
  padding: 0; text-align: left; max-width: 640px;
}
.dash-root { color: var(--ios-ink); }
.dash-root h1, .dash-root h2, .dash-root h3 { font-family: var(--serif); font-weight: 600; margin: 0; }
.dash-root p.dash-sub { color: var(--ios-ink-soft); margin: 0; font-size: 0.94em; }
.dash-home-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 8px 0 6px; }
.dash-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.dash-brand .logo { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; display: block; }
.dash-brand span { font-size: 0.78em; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ios-ink-faint); }
.dash-header-actions { display: flex; align-items: flex-start; gap: 10px; }
.dash-streak-badge { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 10px 14px; border-radius: var(--ios-radius-chip); background: var(--ios-terracotta-tint); }
.dash-streak-badge.zero { background: var(--ios-sunken); }
.dash-streak-badge .flame { line-height: 1; color: var(--ios-terracotta-deep); display: flex; }
.dash-streak-badge.zero .flame { color: var(--ios-ink-faint); }
.dash-streak-badge .n { font-family: var(--serif); font-weight: 600; font-size: 1.15em; line-height: 1.1; color: var(--ios-terracotta-deep); }
.dash-streak-badge.zero .n { color: var(--ios-ink-faint); }
.dash-streak-badge .label { font-size: 0.62em; color: var(--ios-ink-faint); }
.dash-settings-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--ios-sunken); display: flex; align-items: center; justify-content: center; color: var(--ios-ink-faint); border: none; cursor: pointer; margin-top: 4px; padding: 0; }
.dash-greeting { font-size: clamp(1.7em, 5vw, 2em); margin: 2px 0 22px; }
.dash-root .home-card { background: var(--ios-card-cream); border: 1px solid var(--ios-border); border-radius: var(--ios-radius-card); box-shadow: var(--ios-card-shadow); padding: 20px; margin-bottom: 16px; }
.dash-root .section-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.72em; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 10px; color: var(--ios-ink-faint); }
.dash-root .section-label .tag { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.dash-root .section-label .meta { color: var(--ios-ink-soft); font-weight: 600; text-transform: none; letter-spacing: 0; font-size: 1em; }
.dash-root .today-card { background: var(--ios-teal-tint); border-color: rgba(91,124,141,0.3); }
.dash-root .today-card .section-label .tag { color: var(--ios-teal); }
.dash-root .today-card h2 { font-size: 1.25em; margin-bottom: 6px; }
.dash-root .today-card p.dash-sub { margin: 0 0 16px; }
.dash-root .journal-locked-card { background: var(--ios-terracotta-tint); border-color: var(--ios-border); }
.dash-root .journal-locked-card .section-label .tag { color: var(--ios-terracotta-deep); }
.dash-root .journal-locked-card .dash-cta-fill { background: var(--ios-terracotta-fill); box-shadow: 0 10px 16px rgba(204,116,85,0.3); }
.dash-root .diario-card { background: var(--ios-sage-tint); border-color: rgba(127,160,140,0.35); }
.dash-root .diario-card .section-label .tag { color: var(--ios-sage-deep); }
.dash-root .diario-card h2 { font-size: 1.25em; margin: 2px 0 6px; }
.dash-root .diario-card p.dash-sub { margin: 0 0 14px; }
.dash-root .diario-card .timer-chip { display: flex; align-items: center; gap: 4px; font-size: 0.8em; font-weight: 600; color: var(--ios-sage-deep); text-transform: none; letter-spacing: 0; }
.dash-cta-fill { display: block; width: 100%; text-align: center; border: none; cursor: pointer; padding: 15px 20px; border-radius: var(--ios-radius-pill); font-weight: 600; font-size: 1em; color: #fff; text-decoration: none; box-shadow: 0 10px 16px rgba(91,124,141,0.35); font-family: inherit; }
.dash-root .today-card .dash-cta-fill.locked { background: var(--ios-ink-faint); box-shadow: none; cursor: not-allowed; }
.dash-root .diario-card .dash-cta-fill { background: var(--ios-sage-deep); box-shadow: 0 10px 16px rgba(94,122,104,0.3); }
.dash-root .diario-card .dash-cta-fill:disabled { background: var(--ios-ink-faint); box-shadow: none; cursor: default; opacity: 0.7; }
.dash-milestone-row { display: flex; gap: 20px; margin: 14px 0 2px; padding-top: 12px; border-top: 1px solid rgba(127,160,140,0.3); flex-wrap: wrap; }
.dash-milestone-line { font-size: 0.82em; font-weight: 600; color: var(--ios-sage-deep); }
.dash-library-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 10px 14px; border-radius: var(--ios-radius-chip); background: var(--ios-sunken); text-decoration: none; color: inherit; cursor: pointer; border: none; width: 100%; text-align: left; font-family: inherit; }
.dash-library-row .icon { width: 32px; height: 32px; flex-shrink: 0; border-radius: 6px; }
.dash-library-row .txt { font-size: 0.92em; font-weight: 600; color: var(--ios-ink); flex: 1; }
.dash-library-row .chev { color: var(--ios-ink-faint); font-size: 0.85em; }
.dash-streak-cal-wrap .streak-row { justify-content: flex-start; }
.dash-streak-cal-wrap p.sub.streak-label { text-align: left; margin: 8px 0 0; }
.dash-root .trend-caption { font-size: 0.85em; color: var(--ios-ink-soft); margin-top: 6px; }
.dash-root .trend-chart-wrap { position: relative; }
.dash-root .trend-tooltip { position: absolute; pointer-events: none; opacity: 0; transition: opacity 0.1s; background: var(--ios-ink); color: #fff; font-size: 0.75em; padding: 4px 8px; border-radius: 8px; transform: translate(-50%, -110%); white-space: nowrap; }
.dash-root .locked-card .section-label .tag { color: var(--ios-ink-faint); }
.dash-locked-row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px solid var(--ios-border); }
.dash-locked-row:first-of-type { border-top: none; padding-top: 2px; }
.dash-locked-row .lock-icon { width: 34px; height: 34px; border-radius: 50%; background: var(--ios-sunken); display: flex; align-items: center; justify-content: center; color: var(--ios-ink-faint); flex-shrink: 0; }
.dash-locked-row .row-text { flex: 1; }
.dash-locked-row .row-text h3 { font-size: 0.96em; margin-bottom: 2px; color: var(--ios-ink-soft); font-weight: 600; }
.dash-locked-row .row-text p { margin: 0; font-size: 0.82em; color: var(--ios-ink-faint); }
.dash-journey-preview { height: 8px; border-radius: 999px; background: var(--ios-sunken); overflow: hidden; margin-top: 6px; opacity: 0.6; }
.dash-journey-preview .fill { height: 100%; width: 6%; border-radius: 999px; background: var(--ios-journey-fill); }
.dash-root .dash-cta-ghost { display: block; width: 100%; box-sizing: border-box; text-align: center; margin-top: 14px; padding: 13px 20px; border-radius: var(--ios-radius-pill); font-weight: 600; font-size: 0.9em; color: var(--ios-teal-deep); background: transparent; border: 1.5px solid var(--ios-teal-deep); cursor: pointer; font-family: inherit; text-decoration: none; }
.dash-modal-backdrop { position: fixed; inset: 0; background: rgba(52,48,42,0.35); display: flex; align-items: center; justify-content: center; padding: 24px; opacity: 0; pointer-events: none; transition: opacity 0.15s; z-index: 20; }
.dash-modal-backdrop.show { opacity: 1; pointer-events: auto; }
.dash-modal-box { background: var(--ios-card-cream); border-radius: var(--ios-radius-card); padding: 28px; max-width: 380px; width: 100%; text-align: center; box-shadow: 0 20px 60px rgba(52,48,42,0.25); }
.dash-modal-box h3 { font-size: 1.2em; margin-bottom: 10px; }
.dash-modal-box p { color: var(--ios-ink-soft); font-size: 0.95em; margin: 0 0 20px; font-family: inherit; }
.dash-modal-box button { cursor: pointer; border: none; color: #fff; background: var(--ios-teal-fill); padding: 14px 24px; border-radius: var(--ios-radius-pill); font-weight: 600; font-size: 0.95em; font-family: inherit; }
/* Journal library screen ("Mis Diarios" port, 2026-09-04) — see
   consal-ios-dashboard-spec-2026-09-04.md. Rendered by journal.js's
   renderHome() inside the same .dash-root shell as the dashboard above. */
.dash-back-link { display: inline-block; background: none; border: none; cursor: pointer; padding: 4px 0 16px; font-size: 0.88em; font-weight: 600; color: var(--ios-teal-deep); font-family: inherit; }
.dash-root .dash-stat-row { display: flex; gap: 24px; flex-wrap: wrap; }
.dash-root .dash-stat-block { display: flex; flex-direction: column; gap: 2px; }
.dash-root .dash-stat-block .v { font-family: var(--serif); font-weight: 600; font-size: 1.35em; line-height: 1.1; color: var(--ios-ink); }
.dash-root .dash-stat-block .l { font-size: 0.78em; color: var(--ios-ink-soft); }
.dash-root .dash-onthisday-card { background: var(--ios-terracotta-tint); border-color: rgba(204,116,85,0.3); }
.dash-root .dash-onthisday-card .section-label .tag { color: var(--ios-terracotta-deep); }
.dash-search-input { width: 100%; box-sizing: border-box; padding: 12px 16px; border-radius: var(--ios-radius-pill); border: 1px solid var(--ios-border); background: var(--ios-card-cream); color: var(--ios-ink); font: inherit; margin: 4px 0 14px; }
.dash-search-input::placeholder { color: var(--ios-ink-faint); }
.dash-journal-row { background: var(--ios-card-cream); border: 1px solid var(--ios-border); border-radius: var(--ios-radius-card); box-shadow: var(--ios-card-shadow); padding: 16px 18px; margin-bottom: 12px; }
.dash-journal-row .top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.dash-journal-row .date { font-weight: 600; font-size: 0.96em; color: var(--ios-ink); }
.dash-journal-row .meta { font-size: 0.8em; color: var(--ios-ink-soft); white-space: nowrap; }
.dash-journal-row .win { font-size: 0.88em; color: var(--ios-ink-soft); margin-top: 6px; line-height: 1.4; }
.dash-journal-row details { margin-top: 8px; }
.dash-journal-row summary { cursor: pointer; font-size: 0.8em; font-weight: 600; color: var(--ios-teal-deep); list-style: none; }
.dash-journal-row summary::-webkit-details-marker { display: none; }
.dash-journal-row .transcript { margin: 10px 0 0; background: none; border: none; padding: 0; font-size: 0.88em; color: var(--ios-ink-soft); white-space: pre-wrap; line-height: 1.5; }
.dash-journal-row .correction { background: var(--ios-sunken); border: none; border-radius: 10px; padding: 12px; margin-top: 8px; }
.dash-journal-row .correction .orig { color: var(--ios-ink-faint); }
.dash-journal-row .correction .better { color: var(--ios-ink); }
.dash-journal-row .correction .note { color: var(--ios-ink-soft); }
.dash-journal-empty { text-align: center; padding: 34px 10px 10px; }
.dash-journal-empty img { width: 96px; height: 96px; margin: 0 auto 14px; display: block; }
.dash-journal-empty p { margin: 0; font-size: 0.92em; }

/* Expand the outer wrapper as well as the card; keep focused recording screens compact. */
.wrap:has(.dash-root) { max-width: 1120px; justify-content: flex-start; }
.card:has(.dash-root) { max-width: none; width: 100%; }
.dash-grid { display: grid; gap: 16px; }
.dash-grid > .home-card { margin: 0; min-width: 0; }
#journal-list { display: grid; gap: 16px; }
#journal-list > .dash-journal-row { margin: 0; min-width: 0; }
@media (min-width: 760px) {
  .dash-grid, #journal-list { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .dash-grid > :nth-child(3) { grid-column: 1; grid-row: 2; }
  .dash-grid > :nth-child(2) { grid-column: 2; grid-row: 1; }
}
@media (max-width: 380px) {
  .dash-journal-row .top { flex-wrap: wrap; }
}
