/* R253 style.css · care-journal-dashboard · v5.0 */
:root {
  --primary: #0F766E; --secondary: #5EEAD4; --success: #10B981; --warning: #F59E0B; --danger: #EF4444;
  --bg: #F0FDFA; --card: #FFF; --text: #134E4A; --text-secondary: #0D9488; --border: #99F6E4;
  --accent: #115E59; --tile-bg: #CCFBF1;
  --contact-footer-h: 92px; --fab-size: 56px; --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --font-scale: 1.15;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { lang: zh-CN; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.55;
  max-width: 480px; margin: 0 auto;
  font-size: calc(14px * var(--font-scale));
}
body.has-contact-footer { padding-bottom: calc(var(--contact-footer-h) + var(--fab-size) + 20px + var(--safe-area-bottom)); }
body.share-page { padding-bottom: calc(var(--contact-footer-h) + 16px + var(--safe-area-bottom)); }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.reduce-motion * { animation: none !important; transition: none !important; }

.top-nav { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 70; }
.nav-brand { font-weight: 800; font-size: calc(16px * var(--font-scale)); }
.nav-share { min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; color: var(--primary); }

.profile-bar { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; padding: 12px 16px; }
.profile-row { display: flex; gap: 10px; align-items: flex-start; }
.profile-avatar { width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; font-size: 28px; flex-shrink: 0; }
.profile-meta { flex: 1; min-width: 0; }
.profile-meta strong { display: block; font-size: calc(17px * var(--font-scale)); }
.profile-meta span { display: block; font-size: calc(11px * var(--font-scale)); opacity: .92; margin-top: 2px; }
.recorder-line { font-size: calc(10px * var(--font-scale)) !important; }
.sos-btn { background: rgba(239,68,68,.85); color: #fff; border-radius: 12px; padding: 10px 12px; font-size: calc(18px * var(--font-scale)); min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
.font-toggle { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.font-btn { border: 1px solid rgba(255,255,255,.45); background: transparent; color: #fff; border-radius: 8px; padding: 6px 12px; font-size: calc(11px * var(--font-scale)); min-height: 36px; cursor: pointer; }
.font-btn.active { background: #fff; color: var(--accent); font-weight: 700; }

.segment-bar { display: flex; gap: 6px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 44px; z-index: 65; overflow-x: auto; }
.seg-pill { flex: 1; min-width: 0; border: none; background: var(--bg); color: var(--text-secondary); border-radius: 18px; padding: 10px 4px; font-size: calc(11px * var(--font-scale)); font-weight: 700; cursor: pointer; min-height: 44px; white-space: nowrap; }
.seg-pill.active { background: var(--primary); color: #fff; }
.seg-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.calendar-bar { display: flex; gap: 6px; padding: 10px 16px; overflow-x: auto; background: var(--bg); }
.day-cell { flex: 0 0 auto; width: 52px; padding: 8px 4px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); text-align: center; cursor: pointer; min-height: 56px; position: relative; }
.day-cell.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.day-cell.today { border-color: var(--warning); }
.day-num { display: block; font-size: calc(16px * var(--font-scale)); font-weight: 800; }
.day-w { font-size: calc(10px * var(--font-scale)); opacity: .85; }
.day-dot { position: absolute; top: 4px; right: 4px; background: var(--danger); color: #fff; font-size: 9px; border-radius: 8px; padding: 1px 5px; font-weight: 700; }
.day-cell.active .day-dot { background: #fff; color: var(--primary); }

.summary-strip { display: flex; gap: 12px; align-items: center; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--border); }
.summary-ring { position: relative; width: 56px; height: 56px; flex-shrink: 0; }
.ring-svg { width: 56px; height: 56px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--border); stroke-width: 3; }
.ring-fill { fill: none; stroke: var(--primary); stroke-width: 3; stroke-linecap: round; }
.ring-pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: calc(12px * var(--font-scale)); font-weight: 800; color: var(--primary); }
.ring-conic { background: conic-gradient(var(--primary) calc(var(--pct) * 1%), var(--border) 0); border-radius: 50%; }
.ring-text-only { display: flex; flex-direction: column; align-items: center; justify-content: center; border: 2px solid var(--primary); border-radius: 50%; }
.ring-text-only small { font-size: 9px; color: var(--text-secondary); }
.cal-text { font-size: calc(13px * var(--font-scale)); padding: 8px 0; color: var(--text-secondary); }
.svg-chart { width: 100%; height: auto; margin-bottom: 12px; background: var(--card); border-radius: 12px; border: 1px solid var(--border); }
.sos-hint { font-size: calc(12px * var(--font-scale)); color: var(--text-secondary); margin-bottom: 12px; }
.sos-actions { margin-bottom: 16px; }
.sos-dial-btn small { font-weight: 400; opacity: .85; }
.sos-history { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.sos-row { display: flex; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: calc(11px * var(--font-scale)); }
.sos-row:last-child { border-bottom: none; }
.profile-simple, .profile-plain { color: #fff; margin-bottom: 8px; }
.storage-hint { font-size: calc(11px * var(--font-scale)); color: var(--text-secondary); margin: 8px 0; }
.p1-banner { background: var(--warning); color: #fff; text-align: center; padding: 8px; font-size: calc(12px * var(--font-scale)); font-weight: 700; }
.theme-transition { transition: background .3s, color .3s; }
.font-animate { transition: font-size .2s; }
.share-text-only { white-space: pre-wrap; font-size: 14px; padding: 20px; }
.share-plain .share-list { display: block; }
.summary-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.sum-chip { font-size: calc(10px * var(--font-scale)); padding: 4px 8px; border-radius: 8px; background: var(--tile-bg); border: 1px dashed var(--border); opacity: .65; }
.sum-chip.done { opacity: 1; border-style: solid; border-color: var(--chip-c, var(--primary)); font-weight: 700; }

.main-scroll { padding: 12px 16px 0; }
.timeline-section { padding: 0 16px 16px; }
.section-title { font-size: calc(16px * var(--font-scale)); font-weight: 800; margin-bottom: 10px; }
.section-title small { font-weight: 600; color: var(--text-secondary); font-size: calc(12px * var(--font-scale)); }

.timeline { padding-top: 4px; }
.tl-item { display: flex; gap: 10px; margin-bottom: 4px; cursor: pointer; }
.tl-rail { display: flex; flex-direction: column; align-items: center; width: 18px; padding-top: 16px; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.tl-line { flex: 1; width: 2px; background: var(--border); min-height: 20px; margin-top: 2px; }
.tl-card { flex: 1; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px; margin-bottom: 8px; }
.tl-card:active { transform: scale(.98); }
.tl-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.tl-time { font-size: calc(12px * var(--font-scale)); color: var(--text-secondary); }
.tl-note { font-size: calc(14px * var(--font-scale)); margin-bottom: 4px; }
.tl-meta { font-size: calc(11px * var(--font-scale)); color: var(--text-secondary); }

.filter-chips, .tpl-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.fchip, .tpl-chip { border: 1px solid var(--border); background: var(--card); border-radius: 16px; padding: 8px 12px; font-size: calc(12px * var(--font-scale)); cursor: pointer; min-height: 40px; }
.fchip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tpl-label { font-size: calc(11px * var(--font-scale)); color: var(--text-secondary); margin-bottom: 6px; }

.ledger-card, .settings-card, .card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 10px; cursor: pointer; }
.ledger-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.ledger-date { font-size: calc(11px * var(--font-scale)); color: var(--text-secondary); white-space: nowrap; }
.ledger-note { font-size: calc(13px * var(--font-scale)); margin-bottom: 4px; }
.ledger-meta { font-size: calc(11px * var(--font-scale)); color: var(--text-secondary); }

.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 140px; padding: 12px 0; margin-bottom: 16px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar-track { width: 100%; height: 100px; background: var(--border); border-radius: 6px 6px 0 0; display: flex; align-items: flex-end; overflow: hidden; }
.bar-fill { width: 100%; background: var(--primary); border-radius: 6px 6px 0 0; transition: height .3s; min-height: 4px; }
.bar-val { font-size: calc(12px * var(--font-scale)); font-weight: 700; color: var(--primary); }
.bar-lbl { font-size: calc(10px * var(--font-scale)); color: var(--text-secondary); }
.mood-table { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.mood-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: calc(11px * var(--font-scale)); }
.mood-row:last-child { border-bottom: none; }

.form-group { display: block; margin-bottom: 12px; font-size: calc(12px * var(--font-scale)); font-weight: 600; }
.form-input, .form-textarea { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 10px; margin-top: 4px; font-weight: 400; background: #fff; min-height: 44px; }
.form-textarea { min-height: 88px; resize: vertical; }
.theme-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.theme-btn { height: 40px; border-radius: 10px; border: 2px solid transparent; cursor: pointer; min-height: 44px; }
.theme-btn.active { border-color: var(--text); }
.link-card { display: block; padding: 14px; background: var(--tile-bg); border-radius: 12px; margin-bottom: 10px; font-weight: 700; text-align: center; }

.btn { border: none; border-radius: 12px; padding: 14px; font-size: calc(14px * var(--font-scale)); font-weight: 700; min-height: 48px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-outline { background: var(--card); border: 2px solid var(--border); color: var(--text); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-block { margin-top: 8px; }
.btn:focus-visible, .service-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.empty-hint { text-align: center; padding: 32px 16px; color: var(--text-secondary); font-size: calc(13px * var(--font-scale)); }

.fab-add {
  position: fixed; right: 16px;
  bottom: calc(var(--contact-footer-h) + 12px + var(--safe-area-bottom));
  background: var(--accent); color: #fff; border: none; border-radius: 28px;
  padding: 14px 20px; font-size: calc(14px * var(--font-scale)); font-weight: 700;
  box-shadow: 0 4px 20px rgba(15,118,110,.4); z-index: 780; min-height: var(--fab-size); cursor: pointer;
}
.fab-add:active { transform: scale(.97); }

.quick-log-sheet, .entry-drawer { position: fixed; inset: 0; z-index: 900; pointer-events: none; visibility: hidden; }
.quick-log-sheet.open, .entry-drawer.open { pointer-events: auto; visibility: visible; }
.sheet-backdrop, .drawer-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.sheet-panel, .drawer-panel {
  position: absolute; left: 0; right: 0; bottom: 0; background: var(--card);
  border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + var(--safe-area-bottom));
  max-height: 90vh; overflow-y: auto; transform: translateY(100%); transition: transform .28s ease;
}
.quick-log-sheet.open .sheet-panel, .entry-drawer.open .drawer-panel { transform: translateY(0); }
.sheet-head, .drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.sheet-close, .drawer-close { border: none; background: var(--bg); width: 40px; height: 40px; border-radius: 50%; font-size: 22px; cursor: pointer; min-width: 44px; min-height: 44px; }
.drawer-meta, .drawer-mood { font-size: calc(12px * var(--font-scale)); color: var(--text-secondary); margin-bottom: 8px; }
.drawer-note { font-size: calc(15px * var(--font-scale)); line-height: 1.6; margin-bottom: 12px; }

.share-main { padding: 24px 16px; }
.share-card { background: var(--card); border-radius: 20px; padding: 28px 20px; text-align: center; box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.share-icon { font-size: 56px; margin-bottom: 8px; }
.share-slogan { color: var(--primary); font-weight: 700; margin: 8px 0; }
.share-list { text-align: left; padding-left: 20px; margin: 12px 0 16px; font-size: calc(13px * var(--font-scale)); line-height: 1.8; }

.toast-container { position: fixed; left: 50%; transform: translateX(-50%); top: 60px; z-index: 99999; pointer-events: none; }
.toast-item { background: rgba(19,78,74,.92); color: #fff; padding: 12px 20px; border-radius: 20px; margin-top: 6px; opacity: 0; transition: opacity .3s; font-size: calc(13px * var(--font-scale)); max-width: 90vw; text-align: center; }
.toast-item.show { opacity: 1; }

.contact-footer { position: fixed; left: 0; right: 0; bottom: 0; background: #1a1a1a; z-index: 850; padding: .55rem .75rem calc(.55rem + var(--safe-area-bottom)); min-height: var(--contact-footer-h); }
.contact-footer__btns { display: grid; grid-template-columns: repeat(3, minmax(0, 88px)); justify-content: center; gap: .4rem; max-width: 320px; margin: 0 auto; }
.contact-footer__cta, .contact-footer__btn { display: flex; align-items: center; justify-content: center; min-height: 36px; border-radius: 8px; font-size: 12px; font-weight: 600; }
.contact-footer__cta { background: #E87722; color: #fff; }
.contact-footer__btn { background: #333; color: #fff; border: none; cursor: pointer; }
.contact-footer__brand { text-align: center; color: #888; font-size: 10px; margin-top: 6px; }

@media (prefers-reduced-motion: reduce) {
  .sheet-panel, .drawer-panel, .bar-fill, .toast-item { transition: none; }
}
@media (min-width: 768px) {
  body { max-width: 480px; }
  .tile-grid { grid-template-columns: repeat(2, 1fr); }
}
