:root {
  --bg: #f8f5ee;
  --surface: #fffdf8;
  --ink: #23302b;
  --muted: #6f7772;
  --line: #e5dfd3;
  --soft: #f1ece2;
  --green: #2d8062;
  --green-dark: #1d5e48;
  --lime: #bde37a;
  --blue: #5b91ca;
  --amber: #d7943e;
  --coral: #eb7765;
  --purple: #8f79c9;
  --pink-soft: #fff0ed;
  --blue-soft: #edf5ff;
  --yellow-soft: #fff5d7;
  --green-soft: #e9f5e9;
  --red: #b84e48;
  --shadow: 0 18px 50px rgba(31, 48, 39, .09);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); background-image: radial-gradient(circle at 92% 8%, rgba(255, 208, 117, .18), transparent 22%), radial-gradient(circle at 76% 76%, rgba(113, 189, 172, .13), transparent 26%); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(31, 106, 77, .32); outline-offset: 3px; }
.skip-link { position: fixed; left: 1rem; top: -4rem; z-index: 100; padding: .75rem 1rem; background: var(--ink); color: white; border-radius: .5rem; }
.skip-link:focus { top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 26px 18px 20px; background: #203b34; color: #f8f4e9; display: flex; flex-direction: column; overflow-y: auto; z-index: 10; }
.sidebar-head { display: flex; align-items: flex-start; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; padding: 0 8px 26px; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.22); border-radius: 14px; background: #f4d978; color: #203124; font-weight: 800; font-size: 20px; transform: rotate(-3deg); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: .08em; }
.brand small { color: #9eaba2; margin-top: 2px; font-size: 11px; }
.nav-list { display: grid; gap: 5px; }
.nav-item { appearance: none; border: 0; background: transparent; color: #b9c9c0; display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 12px; cursor: pointer; text-align: left; font-size: 13px; }
.nav-item span { width: 20px; font-size: 19px; text-align: center; }
.nav-item:hover { color: white; background: rgba(255,255,255,.05); }
.nav-item.is-active { color: #23302b; background: #f4d978; font-weight: 750; }
.privacy-note { margin-top: auto; padding: 15px 11px 4px; border-top: 1px solid rgba(255,255,255,.09); display: flex; gap: 9px; align-items: flex-start; }
.status-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: #95cf77; box-shadow: 0 0 0 4px rgba(149,207,119,.1); }
.privacy-note strong, .privacy-note small { display: block; }
.privacy-note strong { font-size: 11px; font-weight: 650; }
.privacy-note small { color: #8f9b92; font-size: 10px; line-height: 1.45; margin-top: 2px; }

.content-column { min-width: 0; }
.topbar { height: 88px; padding: 0 clamp(24px, 4.5vw, 72px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(248,245,238,.9); position: sticky; top: 0; z-index: 8; backdrop-filter: blur(12px); }
.page-heading p, .page-heading h1 { margin: 0; }
.page-heading p { color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.page-heading h1 { font-size: 20px; letter-spacing: -.02em; }
.header-actions { display: flex; gap: 10px; align-items: center; }
.range-control select { appearance: none; padding: 10px 34px 10px 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12'%3E%3Cpath d='m2 4 4 4 4-4' fill='none' stroke='%23667068' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 11px center; color: var(--ink); font-size: 12px; }
.mobile-menu-button, .sidebar-close, .mobile-nav-backdrop { display: none; }
.button { appearance: none; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: var(--surface); font-weight: 700; font-size: 12px; cursor: pointer; min-height: 39px; }
.button:hover { border-color: #bdc6be; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button-primary { color: white; border-color: var(--green); background: var(--green); }
.button-primary:hover { background: var(--green-dark); border-color: var(--green-dark); }
.button-coral { color: white; border-color: var(--coral); background: var(--coral); }
.button-coral:hover { background: #d96050; border-color: #d96050; }

main { max-width: 1480px; margin: 0 auto; padding: 46px clamp(24px, 4.5vw, 72px) 80px; }
main:focus { outline: none; }
.notice { position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: 420px; padding: 13px 16px; border-radius: 8px; background: var(--ink); color: white; box-shadow: var(--shadow); font-size: 13px; }
.notice.is-error { background: var(--red); }
.section-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.section-intro h2 { margin: 5px 0 8px; font-size: clamp(24px, 3vw, 38px); line-height: 1.08; letter-spacing: -.045em; max-width: 720px; }
.section-intro > div > p:last-child { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.section-label { margin: 0; color: var(--green); font-size: 10px; line-height: 1.2; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.freshness { white-space: nowrap; padding-bottom: 4px; color: var(--muted); font-size: 11px; }

.empty-state { min-height: 470px; display: grid; grid-template-columns: minmax(260px, 1.2fr) minmax(280px, .8fr); gap: clamp(36px, 7vw, 100px); align-items: center; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.empty-state h2 { font-size: clamp(28px, 4vw, 48px); line-height: 1.05; letter-spacing: -.05em; margin: 8px 0 16px; }
.empty-state p:not(.section-label) { color: var(--muted); line-height: 1.65; max-width: 500px; margin-bottom: 24px; }
.empty-visual { height: 270px; display: flex; align-items: flex-end; justify-content: center; gap: clamp(14px, 3vw, 32px); padding: 30px; border-left: 1px solid var(--line); background: linear-gradient(180deg, transparent 24%, rgba(31,106,77,.04)); }
.empty-visual span { width: 13%; max-width: 66px; min-width: 28px; border-radius: 4px 4px 0 0; background: var(--soft); position: relative; }
.empty-visual span::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--lime); }
.empty-visual span:nth-child(1) { height: 38%; }
.empty-visual span:nth-child(2) { height: 72%; }
.empty-visual span:nth-child(3) { height: 54%; }
.empty-visual span:nth-child(4) { height: 88%; }

.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 26px; }
.today-context { display: grid; grid-template-columns: 190px repeat(5, minmax(0,1fr)); margin: -8px 0 24px; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.context-heading { display: flex; flex-direction: column; justify-content: center; padding: 16px 18px; background: var(--ink); color: white; }
.context-heading strong { font-size: 12px; }.context-heading span { margin-top: 4px; color: #b8c4bd; font-size: 8px; line-height: 1.45; }
.context-cell { min-width: 0; display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: center; padding: 14px 12px; border-left: 1px solid var(--line); }
.context-cell i { font-style: normal; font-size: 18px; }.context-cell strong, .context-cell span, .context-cell small { display: block; }
.context-cell strong { font-size: 14px; }.context-cell span { margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 8px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }.context-cell small { margin-top: 3px; color: #95a098; font-size: 7px; }
.metric { padding: 19px; position: relative; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 8px 24px rgba(48, 61, 52, .04); }
.metric:nth-child(1) { background: var(--yellow-soft); border-color: #f0dda7; }
.metric:nth-child(2) { background: var(--blue-soft); border-color: #cfdef1; }
.metric:nth-child(3) { background: var(--pink-soft); border-color: #f0d6d1; }
.metric:nth-child(4) { background: var(--green-soft); border-color: #cfdfcf; }
.metric + .metric { border-left: 1px solid var(--line); padding-left: 19px; }
.metric-label { color: var(--muted); font-size: 11px; display: flex; justify-content: space-between; gap: 8px; }
.metric-value { margin-top: 10px; font-variant-numeric: tabular-nums; font-weight: 700; font-size: clamp(26px, 3vw, 38px); letter-spacing: -.045em; }
.metric-unit { margin-left: 5px; color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: 0; }
.metric-foot { color: var(--muted); font-size: 10px; margin-top: 5px; }
.insight-section { margin-bottom: 22px; padding: 24px; background: #efeaf9; border: 1px solid #ddd4f0; border-radius: 16px; }
.insight-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; margin-bottom: 18px; }
.insight-heading h3 { margin: 4px 0 0; font-size: 18px; letter-spacing: -.025em; }
.insight-heading > span { color: var(--muted); font-size: 10px; }
.insight-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid #cbd6ca; }
.insight-card { min-width: 0; padding: 17px 18px 2px 0; }
.insight-card + .insight-card { border-left: 1px solid #cbd6ca; padding-left: 18px; }
.insight-delta { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 10px; font-size: 22px; line-height: 1; font-weight: 760; letter-spacing: -.04em; }
.insight-card h4 { margin: 0 0 7px; font-size: 12px; line-height: 1.35; }
.insight-card p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.insight-card footer { margin-top: 10px; color: #657568; font-size: 9px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr); gap: 22px; }
.chart-panel, .relationship-panel, .source-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 24px rgba(48, 61, 52, .035); }
.chart-panel { padding: 24px; min-width: 0; }
.relationship-panel { padding: 24px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.panel-heading h3, .coverage-band h3, .data-table-section h3, .source-panel h3, .method-note h3 { margin: 4px 0 0; font-size: 16px; letter-spacing: -.02em; }
.chart-legend { display: flex; gap: 15px; flex-wrap: wrap; justify-content: flex-end; }
.legend-item { color: var(--muted); font-size: 10px; display: inline-flex; gap: 6px; align-items: center; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; }
.legend-dot-0 { background: #1f6a4d; }
.legend-dot-1 { background: #477b89; }
.legend-dot-2 { background: #9b6a2b; }
.legend-dot-3 { background: #836b96; }
.chart-wrap { height: 285px; min-width: 0; overflow: hidden; }
.chart-wrap-tall { height: 400px; }
.chart-wrap svg { width: 100%; height: 100%; overflow: visible; }
.chart-grid { stroke: #e3e7e2; stroke-width: 1; }
.chart-axis { fill: #788179; font-size: 10px; }
.chart-line { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { opacity: .08; }
.info-tag { border: 1px solid #cbd6ca; color: var(--green); border-radius: 99px; padding: 4px 7px; font-size: 9px; font-weight: 700; }
.relationship-list { display: grid; }
.relationship { padding: 14px 0; border-top: 1px solid var(--line); }
.relationship:first-child { border-top: 0; padding-top: 0; }
.relationship strong { display: block; font-size: 13px; margin-bottom: 5px; }
.relationship span { color: var(--muted); font-size: 10px; }
.relationship-meter, .coverage-track { appearance: none; display: block; width: 100%; padding: 0; border: 0; overflow: hidden; background: var(--soft); }
.relationship-meter { height: 3px; margin-top: 9px; }
.relationship-meter::-webkit-progress-bar, .coverage-track::-webkit-progress-bar { background: var(--soft); }
.relationship-meter::-webkit-progress-value, .coverage-track::-webkit-progress-value { background: var(--green); }
.relationship-meter::-moz-progress-bar, .coverage-track::-moz-progress-bar { background: var(--green); }
.caution { border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; line-height: 1.5; padding-top: 14px; margin: 8px 0 0; }
.muted-empty { color: var(--muted); font-size: 12px; line-height: 1.6; padding: 18px 0; }
.coverage-band { margin-top: 22px; padding: 26px 0 8px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 250px 1fr; gap: 40px; }
.coverage-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 24px; }
.coverage-item { min-width: 0; }
.coverage-item-head { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 10px; margin-bottom: 7px; }
.coverage-track { height: 4px; background: #dfe4de; overflow: hidden; border-radius: 4px; }

.trend-toolbar { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 14px; scrollbar-width: thin; }
.metric-chip { flex: 0 0 auto; border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 99px; padding: 8px 12px; font-size: 11px; cursor: pointer; }
.metric-chip.is-active { background: var(--ink); color: white; border-color: var(--ink); }
.trend-main { margin-top: 8px; }
.trend-summary { text-align: right; }
.trend-summary strong { display: block; font-size: 24px; letter-spacing: -.04em; }
.trend-summary span { color: var(--muted); font-size: 10px; }

.timeline-list { max-width: 900px; border-top: 1px solid var(--line); }
.timeline-day { display: grid; grid-template-columns: 130px 1fr; border-bottom: 1px solid var(--line); }
.timeline-date { padding: 20px 20px 20px 0; font-size: 12px; font-weight: 700; }
.timeline-events { border-left: 1px solid var(--line); padding: 11px 0 11px 25px; }
.timeline-event { display: grid; grid-template-columns: 72px 1fr auto; gap: 14px; align-items: center; padding: 9px 0; }
.timeline-time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 10px; }
.timeline-event strong { display: block; font-size: 12px; }
.timeline-event small { color: var(--muted); font-size: 10px; }
.timeline-value { color: var(--green-dark); font-weight: 700; font-size: 11px; white-space: nowrap; }

.data-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, .5fr); gap: 22px; align-items: start; }
.data-table-section { min-width: 0; }
.data-table-section h3, .source-panel h3 { margin-bottom: 17px; }
.table-scroll { overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 680px; font-size: 11px; }
th { color: var(--muted); font-weight: 650; text-align: left; padding: 11px 12px 11px 0; border-bottom: 1px solid var(--line); }
td { padding: 15px 12px 15px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.filename { max-width: 220px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 650; }
.status { display: inline-flex; gap: 5px; align-items: center; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }
.status-complete::before { background: var(--green); }
.status-failed::before { background: var(--red); }
.source-panel { padding: 22px; }
.source-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 11px; }
.source-row span:first-child { overflow: hidden; text-overflow: ellipsis; }
.source-row span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.method-note { max-width: 790px; margin-top: 50px; padding-left: 22px; border-left: 3px solid var(--lime); }
.method-note p:last-child { color: var(--muted); font-size: 12px; line-height: 1.7; }

.soft-badge { padding: 9px 12px; border: 1px solid #ddd4f0; border-radius: 99px; background: #f1ecfb; color: #6d5a9b; font-size: 10px; white-space: nowrap; }
.relation-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 18px; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,253,248,.8); }
.relation-controls label, .journal-date-bar label { display: grid; gap: 6px; color: var(--muted); font-size: 10px; }
.relation-controls select, .journal-date-bar input { min-height: 39px; padding: 9px 34px 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--ink); font-size: 11px; }
.segmented { display: flex; padding: 3px; border-radius: 11px; background: var(--soft); }
.segmented button { appearance: none; border: 0; border-radius: 8px; padding: 8px 12px; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; }
.segmented button.is-active { background: white; color: var(--ink); box-shadow: 0 2px 8px rgba(42,54,47,.08); font-weight: 750; }
.relation-workspace { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .65fr); gap: 18px; align-items: start; }
.relation-table-card, .relation-guide, .daily-snapshot, .photo-section { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 8px 24px rgba(48,61,52,.035); }
.relation-table-card { min-width: 0; overflow: hidden; }
.relation-table-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 18px 20px 15px; }
.relation-table-heading h3, .relation-guide h3, .daily-snapshot h3, .photo-section h3 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.relation-table-heading span { color: var(--muted); font-size: 10px; }
.relation-scroll { max-height: 590px; border-top: 1px solid var(--line); }
.relation-table { min-width: 690px; }
.relation-table th { position: sticky; top: 0; padding-left: 15px; background: #fbf8f1; z-index: 1; }
.relation-table td { padding-left: 15px; }
.relation-table tr.is-selected td { background: #f0f7f2; }
.pair-name strong, .pair-name small { display: block; }
.pair-name strong { font-size: 11px; }
.pair-name small { color: var(--muted); margin-top: 3px; font-size: 9px; }
.coefficient { font-size: 14px; font-weight: 800; }
.strength-chip { display: inline-flex; padding: 5px 8px; border-radius: 99px; background: #f1ecfb; color: #685493; font-size: 9px; white-space: nowrap; }
.relation-select { appearance: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; background: white; color: var(--green); cursor: pointer; font-size: 10px; font-weight: 750; }
.relation-guide { position: sticky; top: 112px; padding: 22px; min-height: 330px; }
.guide-empty { min-height: 280px; display: grid; place-content: center; text-align: center; }
.guide-empty span { font-size: 32px; }
.guide-empty h3 { margin: 12px 0 7px; }
.guide-empty p { max-width: 250px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.guide-score { display: flex; align-items: center; justify-content: space-between; margin: 15px 0; padding: 14px; border-radius: 12px; background: var(--yellow-soft); }
.guide-score strong { font-size: 30px; letter-spacing: -.05em; }
.guide-score span { max-width: 130px; color: var(--muted); text-align: right; font-size: 10px; line-height: 1.4; }
.guide-copy { color: var(--muted); font-size: 11px; line-height: 1.65; }
.guide-evidence { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.guide-evidence span { padding: 6px 8px; border-radius: 8px; background: var(--soft); color: var(--muted); font-size: 9px; }
.guide-next { margin-top: 14px; padding: 14px; border-left: 3px solid var(--coral); background: var(--pink-soft); color: #74534d; font-size: 10px; line-height: 1.55; }
.guide-chart { height: 150px; margin-top: 16px; }

.journal-date-bar { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; margin-bottom: 18px; padding: 14px 16px; border-radius: 14px; background: var(--yellow-soft); border: 1px solid #efdda5; }
.journal-date-bar p { margin: 0 0 8px; color: #756a52; font-size: 10px; }
.daily-snapshot { padding: 22px; margin-bottom: 18px; background: var(--blue-soft); border-color: #cfdef1; }
.daily-metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.daily-metric { padding: 13px; border-radius: 12px; background: rgba(255,255,255,.75); }
.daily-metric span, .daily-metric strong { display: block; }
.daily-metric span { color: var(--muted); font-size: 9px; }
.daily-metric strong { margin-top: 5px; font-size: 18px; }
.photo-section { padding: 22px; }
.photo-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.photo-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: white; }
.photo-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--soft); }
.photo-card div { padding: 12px; }
.photo-card strong { display: block; font-size: 11px; }
.photo-card span { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.photo-empty { grid-column: 1 / -1; min-height: 220px; display: grid; place-items: center; padding: 30px; border: 1px dashed #e4b7ae; border-radius: 14px; background: var(--pink-soft); text-align: center; }
.photo-empty span { font-size: 36px; }
.photo-empty h3 { margin: 10px 0 5px; }
.photo-empty p { margin: 0; max-width: 340px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.photo-form-grid { display: grid; grid-template-columns: 1fr 1.5fr; gap: 12px; }
.photo-drop-zone { min-height: 210px; padding: 26px; border: 1px dashed #df9d91; border-radius: 14px; background: var(--pink-soft); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; text-align: center; }
.photo-drop-zone input { position: absolute; opacity: 0; pointer-events: none; }
.photo-icon { font-size: 38px; }
.photo-drop-zone strong { margin: 10px 0 5px; font-size: 13px; }
.photo-drop-zone span:last-child { color: var(--muted); font-size: 10px; }

.health-space-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.space-overview { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); margin-bottom: 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.space-overview > div { padding: 16px 18px; border-left: 1px solid var(--line); }.space-overview > div:first-child { border-left: 0; }
.space-overview span, .space-overview strong, .space-overview small { display: block; }.space-overview span { color: var(--muted); font-size: 8px; }.space-overview strong { margin-top: 5px; font-size: 21px; letter-spacing: -.03em; }.space-overview small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.health-space { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 8px 24px rgba(48,61,52,.035); }
.health-space:nth-child(1), .health-space:nth-child(4), .health-space:nth-child(7) { grid-row: span 2; }
.health-space header { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 18px; border-bottom: 1px solid rgba(40,55,47,.08); }
.health-space header h3, .health-space header p { margin: 0; }
.health-space header h3 { font-size: 15px; letter-spacing: -.02em; }
.health-space header p { margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.health-space header b { align-self: start; display: grid; place-items: center; min-width: 25px; height: 25px; border-radius: 50%; background: rgba(255,255,255,.65); font-size: 10px; }
.space-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.7); font-size: 21px; }
.tone-coral header { background: #ffe7e1; } .tone-blue header { background: #e3f2ff; } .tone-purple header { background: #eee8ff; }
.tone-green header { background: #e5f3df; } .tone-amber header { background: #f4eadb; } .tone-yellow header { background: #fff0b8; }
.tone-pink header { background: #ffe5f0; } .tone-red header { background: #f8e3e5; } .tone-sky header { background: #e1f5f5; } .tone-lab header { background: #e9edf8; }
.space-metrics { display: grid; padding: 5px 15px 11px; }
.space-metric { appearance: none; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 2px; border: 0; border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; text-align: left; }
.space-metric:last-child { border-bottom: 0; }
.space-metric:hover { color: var(--green-dark); }
.space-metric > span { display: grid; grid-template-columns: 22px minmax(0,1fr); align-items: center; font-size: 10px; font-weight: 700; }
.space-metric i { font-style: normal; font-size: 14px; }
.space-metric span small { grid-column: 2; color: var(--muted); font-size: 8px; font-weight: 500; }
.space-metric > strong { white-space: nowrap; font-size: 12px; font-variant-numeric: tabular-nums; }
.space-metric > strong small { color: var(--muted); font-size: 8px; font-weight: 500; }
.space-empty { padding: 25px 18px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.space-jump { appearance: none; width: 100%; padding: 17px; border: 0; background: transparent; color: var(--green); text-align: left; font-size: 11px; font-weight: 750; cursor: pointer; }

.privacy-chip { padding: 10px 12px; border: 1px solid #e4c9ce; border-radius: 10px; background: #f9e9ec; color: #764f58; font-size: 10px; white-space: nowrap; }
.logbook-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 18px; align-items: start; }
.entry-composer, .entry-history, .lab-form, .lab-results { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 8px 24px rgba(48,61,52,.035); }
.entry-composer { overflow: hidden; }
.entry-composer-heading, .entry-history-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 20px; }
.entry-composer-heading h3, .entry-history-heading h3, .lab-form h3 { margin: 4px 0 0; font-size: 16px; }
.entry-history-heading > span { color: var(--muted); font-size: 9px; }
.entry-type-tabs { display: flex; gap: 5px; overflow-x: auto; padding: 0 20px 15px; scrollbar-width: thin; }
.entry-type-tabs button { flex: 0 0 auto; appearance: none; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--muted); font-size: 10px; cursor: pointer; }
.entry-type-tabs button.is-active { border-color: var(--ink); background: var(--ink); color: white; }
#entry-form { padding: 18px 20px 20px; border-top: 1px solid var(--line); }
.entry-when { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.entry-when .field, .entry-field-grid .field, .lab-form .field { margin: 0; }
.entry-type-copy { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 4px 0 15px; }
.entry-type-copy strong { font-size: 13px; }
.entry-type-copy span { color: var(--muted); font-size: 9px; text-align: right; }
.entry-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.field select, .field textarea { width: 100%; padding: 11px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--ink); }
.field textarea { resize: vertical; min-height: 78px; }
.entry-note { margin: 16px 0 0; }
.entry-submit { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 15px; }
.entry-submit > span { color: var(--muted); font-size: 9px; }
.equipment-field { grid-column: 1 / -1; border: 0; padding: 0; margin: 0; }
.equipment-field legend { margin-bottom: 8px; color: var(--muted); font-size: 11px; }
.equipment-field > div { display: flex; flex-wrap: wrap; gap: 7px; }
.equipment-field label { cursor: pointer; }
.equipment-field input { position: absolute; opacity: 0; }
.equipment-field label span { display: block; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: white; font-size: 9px; }
.equipment-field input:checked + span { border-color: var(--green); background: var(--green-soft); color: var(--green-dark); font-weight: 700; }
.entry-history { position: sticky; top: 112px; max-height: 720px; overflow: auto; }
.entry-item { display: grid; grid-template-columns: 38px 1fr; gap: 10px; padding: 15px 18px; border-top: 1px solid var(--line); }
.entry-item-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--soft); }
.entry-item-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.entry-item-title strong { font-size: 11px; }
.entry-item-title time { color: var(--muted); font-size: 8px; white-space: nowrap; }
.entry-detail-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.entry-detail-chips span { padding: 4px 6px; border-radius: 6px; background: var(--soft); color: var(--muted); font-size: 8px; }
.entry-item p { margin: 7px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.history-empty { min-height: 290px; display: grid; place-content: center; padding: 30px; text-align: center; }
.history-empty > span { font-size: 30px; }.history-empty strong { margin-top: 9px; font-size: 12px; }.history-empty p { color: var(--muted); font-size: 9px; }

.labs-layout { display: grid; grid-template-columns: minmax(300px, .55fr) minmax(0, 1.45fr); gap: 18px; align-items: start; }
.lab-form { padding: 20px; }
.lab-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.field-wide { grid-column: 1 / -1; }
.lab-results { min-width: 0; overflow: hidden; }
.lab-table { min-width: 650px; }
.lab-table td strong, .lab-table td small { display: block; }.lab-table td small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.lab-flag { display: inline-flex; padding: 5px 8px; border-radius: 99px; background: var(--soft); color: var(--muted); font-size: 8px; font-weight: 700; }
.flag-low { background: #e7f1ff; color: #37658d; }.flag-normal { background: var(--green-soft); color: var(--green-dark); }.flag-high { background: #fde7e4; color: #a34339; }

.modal { width: min(580px, calc(100vw - 30px)); border: 0; padding: 0; border-radius: 13px; background: transparent; box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(18, 26, 21, .55); backdrop-filter: blur(4px); }
.modal-card { background: var(--surface); padding: 26px; }
.modal-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.modal-heading h2 { margin: 5px 0 0; font-size: 24px; letter-spacing: -.04em; }
.icon-button { appearance: none; border: 0; background: transparent; color: var(--muted); font-size: 27px; line-height: 1; cursor: pointer; }
.drop-zone { margin: 24px 0 18px; min-height: 210px; padding: 30px; border: 1px dashed #aeb9ae; background: #f5f7f4; border-radius: 9px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; cursor: pointer; }
.drop-zone.is-over { border-color: var(--green); background: #edf4ed; }
.drop-zone input { position: absolute; opacity: 0; pointer-events: none; }
.drop-zone strong { font-size: 14px; margin: 12px 0 6px; }
.drop-zone span:last-child { color: var(--muted); font-size: 11px; line-height: 1.5; max-width: 360px; }
.upload-mark { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 50%; background: var(--soft); color: var(--green); font-size: 23px; }
.modal-actions { display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.modal-hint { color: var(--muted); font-size: 10px; }
.upload-status { align-items: center; gap: 14px; margin: 18px 0; padding: 13px; background: var(--soft); border-radius: 8px; }
.upload-status:not([hidden]) { display: flex; }
.upload-status strong, .upload-status span { display: block; font-size: 11px; }
.upload-status span { color: var(--muted); margin-top: 3px; }
.spinner { width: 22px; height: 22px; border: 2px solid #c6cec6; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
.modal-small { max-width: 430px; }
.modal-card > p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.login-message { padding: 10px 12px; border: 1px solid #efc5c0; border-radius: 8px; background: #fff0ed; color: var(--red) !important; }
.field { display: grid; gap: 7px; margin: 20px 0; color: var(--muted); font-size: 11px; }
.field input { width: 100%; padding: 11px; border: 1px solid var(--line); border-radius: 7px; background: white; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 980px) {
  .shell { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar { padding-inline: 10px; }
  .brand { justify-content: center; padding-inline: 0; }
  .brand > span:last-child, .nav-item:not(.is-active)::after, .nav-item { font-size: 0; }
  .nav-item { justify-content: center; padding: 11px; }
  .nav-item span { font-size: 20px; }
  .privacy-note div { display: none; }
  .privacy-note { justify-content: center; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .insight-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .insight-card:nth-child(3) { border-left: 0; padding-left: 0; border-top: 1px solid #cbd6ca; }
  .insight-card:nth-child(4) { border-top: 1px solid #cbd6ca; }
  .coverage-band { grid-template-columns: 1fr; }
  .relation-workspace { grid-template-columns: 1fr; }
  .relation-guide { position: static; }
  .daily-metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .today-context { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .context-heading { grid-column: 1 / -1; }
  .context-cell:nth-child(5), .context-cell:nth-child(6) { border-top: 1px solid var(--line); }
  .health-space-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .space-overview { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .space-overview > div:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }.space-overview > div:nth-child(4) { border-top: 1px solid var(--line); }
  .health-space:nth-child(n) { grid-row: auto; }
  .logbook-layout, .labs-layout { grid-template-columns: 1fr; }
  .entry-history { position: static; max-height: none; }
}

@media (max-width: 720px) {
  body.mobile-nav-open { overflow: hidden; }
  .shell { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(82vw, 286px); height: 100dvh; transform: translateX(-105%); visibility: hidden; transition: transform .2s ease, visibility .2s; box-shadow: var(--shadow); z-index: 30; }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar.is-open { visibility: visible; }
  .sidebar .brand > span:last-child, .sidebar .nav-item { font-size: 14px; }
  .sidebar .nav-item { justify-content: flex-start; }
  .sidebar .privacy-note div { display: block; }
  .sidebar-head { align-items: center; justify-content: space-between; gap: 8px; }
  .sidebar-head .brand { min-width: 0; flex: 1; }
  .sidebar-close { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; margin: -9px -4px 0 0; padding: 0; border: 1px solid rgba(255,255,255,.14); border-radius: 12px; background: rgba(255,255,255,.06); color: white; font-size: 24px; cursor: pointer; }
  .mobile-nav-backdrop { position: fixed; inset: 0; z-index: 29; width: 100%; height: 100%; padding: 0; border: 0; background: rgba(19,32,27,.5); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  .sidebar.is-open + .mobile-nav-backdrop { display: block; opacity: 1; pointer-events: auto; }
  .mobile-menu-button { display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 0 12px; border: 0; border-radius: 12px; background: var(--ink); color: white; cursor: pointer; }
  .mobile-menu-button span { font-size: 20px; line-height: 1; }
  .mobile-menu-button strong { font-size: 11px; }
  .topbar { height: 76px; padding: 0 16px; gap: 10px; }
  .page-heading { margin-right: auto; }
  .page-heading p { display: none; }
  .page-heading h1 { font-size: 16px; }
  .range-control { display: none; }
  .header-actions .button { font-size: 0; width: 39px; padding: 0; }
  .header-actions .button span { font-size: 20px; }
  main { padding: 30px 16px 60px; }
  .section-intro { align-items: flex-start; flex-direction: column; margin-bottom: 26px; }
  .freshness { white-space: normal; }
  .empty-state { grid-template-columns: 1fr; padding: 10px 0 30px; }
  .empty-visual { order: 2; height: 190px; }
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .insight-section { padding: 18px; }
  .insight-heading { align-items: flex-start; flex-direction: column; }
  .insight-grid { grid-template-columns: 1fr; }
  .insight-card + .insight-card, .insight-card:nth-child(3) { border-left: 0; padding-left: 0; border-top: 1px solid #cbd6ca; }
  .metric:nth-child(3) { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); }
  .metric:nth-child(4) { border-top: 1px solid var(--line); }
  .coverage-grid { grid-template-columns: 1fr 1fr; }
  .relation-controls { align-items: stretch; flex-direction: column; }
  .relation-controls select { width: 100%; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; }
  .relation-table-card { margin-inline: -16px; border-radius: 0; }
  .relation-guide { min-height: 0; }
  .journal-date-bar { align-items: stretch; flex-direction: column; }
  .photo-grid { grid-template-columns: 1fr 1fr; }
  .photo-form-grid { grid-template-columns: 1fr; gap: 0; }
  .photo-heading { align-items: flex-start; }
  .health-space-grid { grid-template-columns: 1fr; }
  .today-context { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: 13px; }
  .context-heading { min-width: 155px; }.context-cell { min-width: 155px; scroll-snap-align: start; border-top: 0 !important; }
  .space-overview { grid-template-columns: 1fr 1fr; }
  .space-overview > div { padding: 13px; }
  .entry-field-grid, .entry-when, .lab-form-grid { grid-template-columns: 1fr; }
  .field-wide, .equipment-field { grid-column: auto; }
  .entry-type-copy, .entry-submit { align-items: flex-start; flex-direction: column; }
  .entry-submit .button { width: 100%; }
  .privacy-chip { white-space: normal; }
  .chart-panel, .relationship-panel { padding: 18px; }
  .chart-wrap { height: 250px; }
  .chart-legend { display: none; }
  .data-layout { grid-template-columns: 1fr; }
  .timeline-day { grid-template-columns: 84px 1fr; }
  .timeline-day, .timeline-events, .timeline-event, .timeline-event > div { min-width: 0; }
  .timeline-events { padding-left: 14px; }
  .timeline-event { grid-template-columns: 50px minmax(0, 1fr); }
  .timeline-event strong, .timeline-event small { overflow-wrap: anywhere; }
  .timeline-value { grid-column: 2; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .modal-card { padding: 20px; }
  .modal-actions { align-items: stretch; flex-direction: column; }
  .modal-actions .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
