:root {
  --paper: #f4f2ec;
  --paper-deep: #e8e5dc;
  --ink: #25302c;
  --muted: #6e7772;
  --line: #d9d7cf;
  --white: #fffefa;
  --green: #39705e;
  --green-dark: #285546;
  --mint: #dce9e1;
  --coral: #d96f5f;
  --coral-soft: #f5ded8;
  --yellow: #f1d788;
  --blue: #86a8b2;
  --shadow: 0 12px 28px rgba(51, 62, 56, .08);
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  color: var(--ink);
  background: var(--paper);
  letter-spacing: 0;
}
* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink); letter-spacing: 0; }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; touch-action: manipulation; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(57,112,94,.2); outline-offset: 2px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 28px; line-height: 1.2; margin-bottom: 8px; }
h2 { font-size: 18px; line-height: 1.3; }
small { color: var(--muted); line-height: 1.45; }
.app-shell { width: min(100%, 680px); min-height: 100vh; margin: 0 auto; background: var(--paper); }
.topbar { position: sticky; top: 0; z-index: 20; min-height: 68px; padding: calc(10px + env(safe-area-inset-top)) 18px 10px; display: flex; align-items: center; justify-content: space-between; background: rgba(244,242,236,.92); backdrop-filter: blur(16px); border-bottom: 1px solid rgba(217,215,207,.75); }
.brand { border: 0; background: transparent; padding: 0; display: flex; align-items: center; gap: 10px; color: var(--ink); text-align: left; }
.brand img { border-radius: 8px; }
.brand span { display: grid; gap: 1px; }
.brand strong { font-size: 17px; }
.brand small { font-size: 11px; }
.icon-button { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--ink); color: white; font-size: 25px; line-height: 1; }
main { padding: 22px 18px calc(98px + env(safe-area-inset-bottom)); }
.view[hidden] { display: none; }
.greeting-block { padding: 12px 2px 22px; }
.greeting-block h1 { font-size: 30px; }
.greeting-block p:last-child, .page-heading p:last-child { color: var(--muted); margin-bottom: 0; line-height: 1.6; }
.eyebrow { color: var(--green); font-size: 12px; font-weight: 750; text-transform: uppercase; margin-bottom: 7px; }
.page-heading { padding: 10px 2px 24px; }
.mood-panel { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.section-heading h2 { margin-bottom: 0; }
.section-heading output { width: 52px; height: 52px; display: grid; place-items: center; flex: none; border-radius: 50%; background: var(--yellow); color: #473d24; font-size: 24px; font-weight: 800; }
.section-heading.simple { align-items: center; }
input[type="range"] { width: 100%; margin: 24px 0 5px; accent-color: var(--green); }
.range-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
label { display: grid; gap: 7px; font-size: 14px; font-weight: 680; }
.compact-field { margin-top: 18px; }
input:not([type="range"]):not([type="radio"]):not([type="checkbox"]), textarea, select { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 12px; background: var(--white); color: var(--ink); font-size: 16px; }
textarea { min-height: 132px; resize: vertical; line-height: 1.6; }
button:not(.brand):not(.icon-button):not(.quick-action):not(.bottom-nav button):not(.filter):not(.period-tabs button):not(.modal-close), .button-like { min-height: 44px; border: 0; border-radius: var(--radius); padding: 10px 15px; background: var(--green); color: white; font-weight: 750; display: inline-grid; place-items: center; text-decoration: none; }
.mood-panel > button { width: 100%; margin-top: 12px; }
button.secondary, .button-like.secondary { color: var(--ink) !important; background: var(--paper-deep) !important; }
.text-button { background: transparent !important; color: var(--green) !important; padding-inline: 6px !important; }
.inline-feedback { min-height: 18px; margin: 8px 0 -4px; color: var(--green); font-size: 13px; text-align: center; }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.quick-action { min-width: 0; padding: 15px 13px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); color: var(--ink); display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; text-align: left; }
.quick-action > span:nth-child(2) { display: grid; gap: 2px; min-width: 0; }
.quick-action strong { font-size: 14px; white-space: nowrap; }
.quick-action small { font-size: 10px; }
.quick-mark { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; }
.resist .quick-mark { background: var(--coral-soft); color: var(--coral); }
.ease .quick-mark { background: var(--mint); color: var(--green); }
.salary-strip { padding: 18px; margin-top: 10px; display: flex; justify-content: space-between; gap: 14px; align-items: center; background: var(--ink); color: white; border-radius: var(--radius); }
.salary-strip[hidden] { display: none; }
.salary-strip div { display: grid; gap: 2px; }
.salary-strip .eyebrow, .salary-strip small { color: #cbd6d1; margin: 0; }
.salary-strip strong { font-size: 25px; }
.salary-strip .secondary { background: #f4f2ec !important; white-space: nowrap; }
.today-list { margin-top: 28px; }
.entry-list, .timeline-list { display: grid; gap: 10px; margin-top: 12px; }
.entry-card { width: 100%; padding: 14px 15px; border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: var(--radius); background: var(--white); color: var(--ink); text-align: left; }
.entry-card.resist { border-left-color: var(--coral); }
.entry-card.ease { border-left-color: var(--green); }
.entry-card.mood { border-left-color: var(--yellow); }
.entry-card-head { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.entry-card p { margin: 9px 0 7px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.entry-card-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.entry-card-tags span { padding: 3px 7px; background: var(--paper); border-radius: 999px; color: var(--muted); font-size: 11px; }
.empty-state { padding: 32px 18px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); line-height: 1.7; }
.record-form, .settings-form { display: grid; gap: 22px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-size: 14px; font-weight: 680; margin-bottom: 8px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; background: var(--paper-deep); border-radius: var(--radius); }
.segmented label { display: block; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { min-height: 42px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); }
.segmented input:checked + span { background: var(--white); color: var(--ink); box-shadow: 0 2px 8px rgba(42,52,47,.09); }
.intensity-options { display: grid; grid-template-columns: repeat(5,1fr); gap: 7px; }
.intensity-options label { display: block; }
.intensity-options input { position: absolute; opacity: 0; }
.intensity-options span { height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); color: var(--muted); }
.intensity-options input:checked + span { background: var(--ink); border-color: var(--ink); color: white; }
.chip-options { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-options label { display: block; }
.chip-options input { position: absolute; opacity: 0; }
.chip-options span { display: block; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); color: var(--muted); font-size: 13px; }
.chip-options input:checked + span { background: var(--mint); border-color: var(--green); color: var(--green-dark); }
.custom-tag { margin-top: 12px; }
.field-note { display: block; margin-top: 9px; }
.form-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.insight-panel, .summary-lead, .privacy-note { padding: 18px; margin-top: 20px; border-radius: var(--radius); background: var(--mint); color: var(--ink); line-height: 1.65; }
.insight-panel h2, .summary-lead h2 { margin-bottom: 8px; }
.insight-panel p:last-child, .summary-lead p:last-child, .privacy-note p:last-child { margin-bottom: 0; }
.filter-row, .period-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 3px; }
.filter, .period-tabs button { min-height: 38px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); white-space: nowrap; }
.filter.active, .period-tabs button.active { border-color: var(--ink); background: var(--ink); color: white; }
.timeline-group { margin: 22px 0 10px; font-size: 14px; color: var(--muted); }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 28px; }
.metric { padding: 14px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); text-align: center; }
.metric strong { display: block; font-size: 23px; margin-bottom: 4px; }
.metric small { font-size: 11px; }
.plain-section { padding: 22px 0; border-top: 1px solid var(--line); }
.plain-section > h2 { margin-bottom: 14px; }
.chart { height: 160px; margin-top: 18px; display: flex; align-items: end; gap: 7px; border-bottom: 1px solid var(--line); }
.chart-column { flex: 1; min-width: 12px; height: 100%; display: flex; flex-direction: column; justify-content: end; align-items: center; gap: 6px; }
.chart-bar { width: 100%; max-width: 26px; min-height: 4px; border-radius: 4px 4px 0 0; background: var(--green); }
.chart-column small { font-size: 9px; white-space: nowrap; }
.bar-list { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 74px 1fr 28px; gap: 9px; align-items: center; font-size: 13px; }
.bar-track { height: 8px; border-radius: 99px; background: var(--paper-deep); overflow: hidden; }
.bar-fill { height: 100%; background: var(--coral); border-radius: inherit; }
.bar-list.ease .bar-fill { background: var(--green); }
.wide { width: 100%; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 10px; }
.check-row { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 10px; margin-top: 16px; }
.check-row input { width: 20px; height: 20px; accent-color: var(--green); }
.data-actions { display: grid; gap: 10px; margin-top: 24px; }
.data-actions h2 { margin-bottom: 4px; }
.danger-text { background: transparent !important; color: #aa4037 !important; }
.privacy-note { background: var(--coral-soft); }
.version { text-align: center; color: var(--muted); font-size: 12px; margin: 25px 0; }
.bottom-nav { position: fixed; z-index: 25; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, 680px); padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5,1fr); background: rgba(255,254,250,.94); backdrop-filter: blur(18px); border-top: 1px solid var(--line); }
.bottom-nav button { min-width: 0; min-height: 52px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; align-content: center; gap: 2px; font-size: 11px; }
.bottom-nav button span { height: 22px; font-size: 20px; line-height: 1; }
.bottom-nav button.active { color: var(--green-dark); font-weight: 750; }
.modal-backdrop { position: fixed; inset: 0; z-index: 50; padding: 24px 16px; display: grid; place-items: center; background: rgba(22,28,25,.45); backdrop-filter: blur(4px); }
.modal-backdrop[hidden] { display: none; }
.modal { position: relative; width: min(100%, 520px); max-height: 86vh; overflow-y: auto; padding: 24px; border-radius: var(--radius); background: var(--white); box-shadow: 0 24px 70px rgba(20,28,24,.25); }
.modal-close { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border: 0; background: transparent; color: var(--muted); font-size: 28px; }
.modal-meta { color: var(--muted); font-size: 12px; }
.modal-text { margin: 18px 0; line-height: 1.75; white-space: pre-wrap; }
.modal-insight { padding: 15px; background: var(--mint); border-radius: var(--radius); line-height: 1.65; }
.modal-actions { margin-top: 20px; display: flex; justify-content: flex-end; }
.toast { position: fixed; z-index: 70; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100% - 36px); padding: 11px 16px; border-radius: 999px; background: var(--ink); color: white; box-shadow: var(--shadow); font-size: 13px; text-align: center; }
@media (max-width: 390px) {
  .quick-actions { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric { display: flex; justify-content: space-between; align-items: center; text-align: left; }
  .metric strong { margin: 0; }
}
@media (min-width: 760px) {
  body { background: #e8ebe6; }
  .app-shell { box-shadow: 0 0 50px rgba(30,43,36,.1); }
}
@media (prefers-reduced-motion: no-preference) {
  .view:not([hidden]) { animation: enter .24s ease-out; }
  @keyframes enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
}
