:root {
    color-scheme: light;
    --paper: #f7f4ee;
    --panel: #faf7f1;
    --green: #123b33;
    --text: #202821;
    --muted: #565e54;
    --border: #c1b6a6;
    --line: #ded6ca;
    --sage: #d7dfca;
    --timer: #ebeee1;
    --day: #eee9df;
    --serif: Georgia, 'Times New Roman', serif;
    --sans: system-ui, sans-serif;
    background: var(--paper);
    color: var(--text);
    font: 16px/1.45 var(--sans);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
svg { inline-size: 1.4em; block-size: 1.4em; flex: none; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3, .brand, .quick-actions button, .entry strong, .care-row strong { font-family: var(--serif); color: var(--green); }
h1 { font-size: clamp(2.35rem, 4.7vw, 4rem); line-height: 1.06; letter-spacing: -.042em; }
h2 { font-size: clamp(1.45rem, 2.45vw, 2.14rem); line-height: 1.16; letter-spacing: -.034em; }
h3 { font-size: 1.27rem; line-height: 1.24; letter-spacing: -.015em; }
p { line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button { border: 0; background: none; padding: 0; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #337964; outline-offset: 3px; }

.topbar { border-bottom: 1px solid var(--border); }
.top-inner, .shell { max-width: 1540px; margin-inline: auto; padding-inline: clamp(18px, 2.8vw, 44px); }
.top-inner { min-height: 74px; display: flex; align-items: center; gap: clamp(15px, 3vw, 38px); }
.brand { display: inline-flex; gap: 12px; align-items: center; margin-right: auto; font-size: 2.65rem; font-weight: bold; letter-spacing: -.04em; line-height: 1; }
.brand svg { width: 48px; height: 48px; }
nav { display: flex; align-items: center; gap: 8px; }
nav a { padding: .5em .9em; border-radius: 10px; font-family: var(--serif); font-size: 1.16rem; }
nav a:hover, nav a[aria-current] { background: var(--sage); color: var(--green); }
nav a[aria-current] { font-weight: 700; }
.logout { border-left: 1px solid var(--border); padding-left: clamp(12px, 2.7vw, 34px); }
.logout button { display: flex; align-items: center; gap: 8px; color: var(--green); min-height: 44px; }

.shell { padding-block: 36px 56px; }
.intro { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 32px; }
.intro p { margin-top: 6px; font: clamp(1rem, 1.75vw, 1.52rem)/1.4 var(--serif); }
.primary, .outline { min-height: 44px; border-radius: 10px; padding: 8px 14px; display: inline-flex; gap: 8px; align-items: center; justify-content: center; font-weight: 650; }
.primary { background: var(--green); color: white; border: 1px solid var(--green); }
.primary:hover { background: #255548; }
.outline { border: 1px solid var(--border); color: var(--green); }
.outline:hover { background: var(--day); }
.add { font-size: 1.22rem; padding: 11px 26px; flex: none; }
.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 30px; }
.quick-actions button { min-width: 0; min-height: 76px; display: flex; gap: 20px; align-items: center; text-align: left; padding: 9px clamp(10px, 2vw, 28px); border: 1px solid var(--border); border-radius: 13px; font-size: clamp(1.12rem, 2vw, 1.7rem); font-weight: 700; }
.quick-actions button:hover { background: var(--panel); border-color: #638171; }
.icon-block { display: inline-grid; place-items: center; border-radius: 12px; width: 49px; height: 48px; flex: none; color: var(--green); background: var(--sage); }
.icon-block svg { width: 29px; height: 29px; }

.dashboard { display: grid; grid-template-columns: minmax(0, 1.68fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.panel { border: 1px solid var(--border); border-radius: 16px; background: var(--panel); }
.log { padding: 17px 16px 21px; min-height: 340px; }
.section-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding-inline: 9px 5px; margin-bottom: 18px; }
.filter { margin: 0; }
select, input, textarea { width: 100%; min-width: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); padding: 9px 10px; }
.filter select { background: var(--paper); min-height: 40px; }
.day { background: var(--day); border-radius: 9px; padding: 9px 16px; }
.timeline { list-style: none; padding: 5px 0 5px 58px; margin: 0 0 12px; }
.timeline:last-child { margin-bottom: 0; }
.timeline li { position: relative; }
.timeline li::before { content: ''; width: 1px; background: var(--border); position: absolute; left: -28px; top: 0; bottom: 0; }
.timeline li:first-child::before { top: 35px; }
.timeline li:last-child::before { bottom: auto; height: 35px; }
.timeline li:only-child::before { display: none; }
.timeline li::after { content: ''; position: absolute; top: 28px; left: -35px; width: 15px; height: 15px; border: 1px solid #766a5a; border-radius: 50%; background: var(--panel); pointer-events: none; }
.entry { display: grid; align-items: start; grid-template-columns: 49px 70px minmax(0, 1fr); gap: clamp(8px, 1.8vw, 26px); text-align: left; width: 100%; padding: 12px 4px; }
.timeline li + li .entry { border-top: 1px solid var(--line); }
.entry:hover, .care-row:hover { background: var(--paper); }
.entry time { margin-top: 5px; font-variant-numeric: tabular-nums; }
.entry-copy { display: grid; margin-top: 1px; font-family: var(--serif); font-size: 1.05rem; overflow-wrap: anywhere; }
.entry strong, .care-row strong { font-size: 1.24rem; }
.entry-note { white-space: pre-wrap; }
.entry small, .care-row small { font: .81rem/1.5 var(--sans); color: var(--muted); }
.temperature strong, .temperature .icon-block { color: #a83e19; }
.empty { padding: 34px 16px; text-align: center; }
.empty h3 { margin-top: 12px; }
.empty p { margin: 5px auto 16px; color: var(--muted); }

aside { display: grid; gap: 20px; min-width: 0; }
.side { padding: 17px 20px 20px; }
.side h2 { margin-bottom: 15px; }
.timer-card { padding: 15px; margin: 0 0 13px; background: var(--timer); border: 1px solid #dde2d4; border-radius: 14px; overflow-wrap: anywhere; }
.summary { display: flex; align-items: flex-start; gap: 15px; }
.summary p { font-family: var(--serif); font-size: 1.05rem; }
.summary h3 { margin-block: 3px; }
.countdown { border-top: 1px solid var(--border); margin-top: 13px; text-align: center; padding-top: 10px; color: var(--green); font: bold clamp(2rem, 4.1vw, 3.75rem)/1.1 var(--serif); font-variant-numeric: lining-nums tabular-nums; }
.timer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.timer-actions:last-child { margin-bottom: 0; }
.timer-actions button { flex: 1 1 auto; font-size: .9rem; }
.care-row { border-top: 1px solid var(--line); display: flex; gap: 13px; align-items: center; width: 100%; padding-block: 10px; text-align: left; }
.care-row span span, .care-row small { display: block; }
.muted { color: var(--muted); }
.month { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.month p { display: flex; justify-content: space-between; margin-top: 6px; }

.login-shell { max-width: 500px; padding: 56px 18px; margin: auto; }
.login { padding: clamp(20px, 5vw, 36px); }
.login > p { margin: 10px 0 22px; color: var(--muted); }
.fields { display: grid; gap: 13px; }
.fields label { display: grid; gap: 4px; font-size: .94rem; font-weight: 650; }
.fields small { font-weight: 400; color: var(--muted); }
.fields textarea { resize: vertical; }
.fields input[type="datetime-local"] { min-height: 42px; }
.error, .flash { border-radius: 8px; margin-bottom: 12px; padding: 8px 12px; }
.error { background: #f7e3d8; color: #812d13; }
.flash { background: var(--timer); color: var(--green); }
dialog { width: min(94vw, 495px); max-height: 92dvh; padding: 20px; border: 1px solid var(--border); border-radius: 16px; background: var(--panel); color: inherit; }
dialog::backdrop { background: #13282195; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.icon-button { display: inline-grid; place-items: center; width: 42px; height: 42px; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; }
.remove { min-height: 44px; padding: 8px; color: #812d13; margin-right: auto; }

@media (max-width: 830px) {
    .dashboard { grid-template-columns: minmax(0, 1fr); }
    .dashboard aside { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}

@media (max-width: 590px) {
    .top-inner { flex-wrap: wrap; gap: 4px 12px; padding-block: 8px; }
    .brand { font-size: 2.05rem; }
    .brand svg { width: 37px; height: 37px; }
    .logout { border-left: 0; padding: 0; }
    nav { order: 1; flex: 1 0 100%; gap: 4px; }
    nav a { font-size: 1.03rem; padding-inline: 11px; }
    .shell { padding-block: 22px 36px; }
    .intro { flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
    .add { font-size: 1rem; padding: 8px 15px; }
    .quick-actions { gap: 7px; margin-bottom: 19px; }
    .quick-actions button { font-size: .94rem; align-items: center; flex-direction: column; justify-content: center; gap: 4px; padding: 7px 3px; text-align: center; }
    .icon-block { width: 39px; height: 39px; border-radius: 9px; }
    .icon-block svg { width: 24px; height: 24px; }
    .log, .side { padding: 13px; }
    .section-head { padding-inline: 0; margin-bottom: 12px; }
    .filter select { font-size: .83rem; }
    .timeline { padding-left: 15px; }
    .timeline li::before { left: -10px; }
    .timeline li::after { left: -14px; width: 9px; height: 9px; top: 31px; }
    .entry { grid-template-columns: 39px 40px minmax(0, 1fr); gap: 7px; }
    .entry time { font-size: .83rem; }
    .entry strong { font-size: 1.05rem; }
    .entry-copy { font-size: .97rem; }
    .dashboard aside { grid-template-columns: minmax(0, 1fr); }
    .fields input, .fields select, .fields textarea { font-size: 16px; }
}
