:root {
  color-scheme: light;
  --page: #f1f4ed;
  --paper: #fbfcf8;
  --ink: #20352e;
  --muted: #74827a;
  --line: #e3e9df;
  --green: #2f7058;
  --green-dark: #1e5140;
  --green-pale: #e4f0e5;
  --grain: #edbc63;
  --grain-pale: #fff3d9;
  --red: #bf6457;
  --red-pale: #f9e9e5;
  --shadow: 0 12px 34px rgba(40, 67, 53, .045);
  font-family: 'DM Sans', 'Avenir Next', ui-sans-serif, system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--page); }
body { margin: 0; min-height: 100vh; background: var(--page); color: var(--ink); }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid rgba(47, 112, 88, .38); outline-offset: 3px; }
button:disabled { cursor: not-allowed; opacity: .55; }
[hidden] { display: none !important; }

.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; height: 100vh; flex-direction: column; padding: 28px 19px 19px; background: #e8eee5; border-right: 1px solid #dfe7dc; }
.brand { display: flex; align-items: center; gap: 11px; margin: 0 7px 52px; color: var(--green-dark); text-decoration: none; }
.brand-mark { display: grid; width: 39px; height: 39px; place-items: center; border-radius: 13px 13px 13px 5px; background: #d6e7d7; }
.brand-mark svg { width: 29px; height: 29px; }
.brand-name { display: flex; align-items: baseline; gap: 6px; font-family: Manrope, sans-serif; font-size: 19px; font-weight: 800; letter-spacing: -.8px; }
.brand-name span { color: #8b9b8d; font-family: 'DM Sans', sans-serif; font-size: 12px; font-weight: 600; letter-spacing: -.1px; }
.primary-nav { display: grid; gap: 7px; }
.nav-item { display: flex; width: 100%; min-height: 46px; align-items: center; gap: 13px; padding: 0 13px; border: 0; border-radius: 12px; background: transparent; color: #74827a; cursor: pointer; text-align: left; font-size: 13px; font-weight: 600; transition: color .16s ease, background .16s ease; }
.nav-item svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:hover { background: rgba(255, 255, 255, .5); color: var(--green-dark); }
.nav-item.is-active { background: #d8e9d8; color: var(--green-dark); }
.nav-item.is-active svg { stroke-width: 2; }
.sidebar-device { display: flex; align-items: center; gap: 10px; margin: auto 2px 21px; padding: 13px 11px; border: 1px solid #dce6da; border-radius: 14px; background: rgba(255, 255, 255, .54); }
.sidebar-device strong, .sidebar-device span:not(.pulse-dot) { display: block; }
.sidebar-device strong { max-width: 130px; overflow: hidden; color: var(--ink); font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-device div:nth-child(2) span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.mini-bowl { display: flex; width: 32px; height: 30px; align-items: flex-end; justify-content: center; overflow: hidden; border: 1.5px solid #8fae95; border-top: 0; border-radius: 2px 2px 11px 11px; }
.mini-bowl span { width: 20px; height: 10px; margin-bottom: 4px; border-radius: 50%; background: var(--grain); }
.pulse-dot, .pill-dot { flex: 0 0 auto; width: 7px; height: 7px; margin-left: auto; border-radius: 50%; background: #6da77d; box-shadow: 0 0 0 3px #dfeddf; }
.sidebar-bottom { display: grid; gap: 13px; }
.offline-note { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: 11px; color: #77877c; font-size: 10px; line-height: 1.45; }
.offline-icon { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 8px; background: #dbe9dc; color: var(--green); font-size: 15px; }
.settings-nav { min-height: 41px; padding-left: 13px; font-size: 12px; }
.settings-nav svg { width: 17px; height: 17px; }
.sidebar-version { margin: 0 13px; color: #9aa69c; font-size: 9px; }
.sidebar-version span { margin-left: 5px; color: #b0b9b1; }

.main-content { width: 100%; max-width: 1550px; margin: 0 auto; padding: 0 42px 48px; }
.topbar { display: flex; min-height: 82px; align-items: center; justify-content: space-between; border-bottom: 1px solid #e3e9df; }
.crumb { display: flex; align-items: center; gap: 9px; color: #718078; font-size: 11px; font-weight: 600; }
.crumb-mark { width: 7px; height: 7px; border-radius: 2px; background: var(--grain); transform: rotate(45deg); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.connection-pill { display: inline-flex; min-height: 32px; align-items: center; gap: 9px; padding: 0 11px; border: 1px solid #dce7dc; border-radius: 999px; background: #f7faf5; color: #55725f; font-size: 10px; font-weight: 700; }
.connection-pill .pill-dot { width: 6px; height: 6px; margin: 0; box-shadow: 0 0 0 3px #e2efe1; }
.connection-pill.is-live { border-color: #c4deca; background: #eff7ed; color: var(--green-dark); }
.connection-pill.is-offline { border-color: #e9d5cf; background: #fbf1ee; color: var(--red); }
.connection-pill.is-offline .pill-dot { background: var(--red); box-shadow: 0 0 0 3px var(--red-pale); }
.icon-button { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid transparent; border-radius: 10px; background: transparent; color: #718078; cursor: pointer; }
.icon-button:hover { border-color: var(--line); background: white; color: var(--green); }
.icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.page-view { padding-top: 32px; animation: page-in .22s ease both; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 0 0 23px; }
.eyebrow, .section-kicker { margin: 0 0 8px; color: #8c9a8d; font-size: 9px; font-weight: 700; letter-spacing: .13em; }
.eyebrow { color: var(--green); }
h1, h2, p { margin-top: 0; }
h1, h2 { font-family: Manrope, 'Avenir Next', sans-serif; }
h1 { margin-bottom: 5px; color: #21392f; font-size: clamp(25px, 3vw, 34px); font-weight: 700; letter-spacing: -1.35px; line-height: 1.15; }
h2 { margin: 0; color: #2b3d34; font-size: 15px; font-weight: 700; letter-spacing: -.25px; }
.subtitle { margin: 0; color: #86928a; font-size: 12px; }
.button { display: inline-flex; min-height: 41px; align-items: center; justify-content: center; gap: 9px; padding: 0 16px; border: 1px solid transparent; border-radius: 11px; cursor: pointer; font-size: 11px; font-weight: 700; transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--green); box-shadow: 0 6px 14px rgba(47, 112, 88, .14); color: white; }
.button-primary:hover { background: var(--green-dark); box-shadow: 0 8px 17px rgba(47, 112, 88, .18); }
.button-soft { border-color: #dce8dc; background: #f5f9f2; color: var(--green-dark); }
.button-soft:hover { background: #e9f3e8; }
.button-quiet { border-color: #e3e9df; background: white; color: #718078; }
.button-plus { display: grid; width: 17px; height: 17px; place-items: center; border-radius: 6px; background: rgba(255, 255, 255, .18); font-size: 16px; line-height: 1; }
.feed-now-button { min-width: 120px; }
.panel { border: 1px solid #e6ebe2; border-radius: 17px; background: var(--paper); box-shadow: var(--shadow); }
.overview-grid { display: grid; grid-template-columns: minmax(290px, .95fr) minmax(370px, 1.35fr); gap: 17px; }
.today-card, .week-card { min-height: 264px; padding: 21px 23px 19px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.section-kicker { display: block; margin-bottom: 6px; font-size: 8px; letter-spacing: .12em; }
.sample-badge { padding: 6px 8px; border-radius: 6px; background: #fff4dd; color: #9c7732; font-size: 8px; font-weight: 700; letter-spacing: .08em; }
.today-total { display: flex; align-items: center; gap: 12px; margin-top: 24px; }
.today-total strong { color: var(--green-dark); font-family: Manrope, sans-serif; font-size: 55px; font-weight: 700; letter-spacing: -3px; line-height: .95; }
.today-total div { display: grid; gap: 3px; padding-top: 7px; }
.today-total div span { color: #55685d; font-size: 12px; font-weight: 700; }
.today-total small { color: #99a49c; font-size: 9px; }
.today-progress { height: 5px; margin: 21px 0 11px; overflow: hidden; border-radius: 9px; background: #e9eee6; }
.today-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--grain); transition: width .3s ease; }
.today-foot { display: flex; justify-content: space-between; color: #87948a; font-size: 9px; }
.today-foot .has-failure { color: var(--red); }
.card-divider { height: 1px; margin: 16px 0 12px; background: #edf0e9; }
.quick-feed-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.quick-feed-copy { display: grid; gap: 3px; }
.quick-feed-copy .section-kicker { margin-bottom: 1px; }
.quick-feed-copy strong { color: #43594b; font-size: 11px; }
.quick-feed-copy small { color: #9aa49c; font-size: 9px; }
.round-arrow { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid #dce8dc; border-radius: 50%; background: #f0f6ef; color: var(--green); cursor: pointer; font-size: 16px; transition: background .15s ease, transform .15s ease; }
.round-arrow:hover { background: #e3f0e3; transform: rotate(5deg); }
.chart-heading { align-items: center; }
.chart-total { display: flex; align-items: baseline; gap: 5px; color: var(--green-dark); }
.chart-total strong { font-family: Manrope, sans-serif; font-size: 20px; font-weight: 700; letter-spacing: -.6px; }
.chart-total small { color: #95a198; font-size: 9px; }
.week-chart { display: grid; height: 142px; grid-template-columns: repeat(7, minmax(0, 1fr)); align-items: end; gap: clamp(8px, 2.1vw, 18px); margin-top: 19px; padding: 0 4px; border-bottom: 1px solid #edf0e9; }
.chart-column { display: grid; height: 100%; grid-template-rows: 12px minmax(0, 1fr) 17px; justify-items: center; align-items: end; gap: 4px; }
.chart-value { grid-row: 1; }
.chart-bar-track { display: flex; width: min(26px, 72%); height: 100%; grid-row: 2; align-items: flex-end; justify-content: center; }
.chart-bar { width: 100%; min-height: 3px; border-radius: 7px 7px 2px 2px; background: #d7e6d5; transition: height .3s ease, background .2s ease; }
.chart-bar.is-today { background: var(--green); }
.chart-value { margin-bottom: 0; color: #98a49b; font-size: 8px; }
.chart-day { grid-row: 3; color: #87948a; font-size: 9px; }
.chart-day.is-today { color: var(--green-dark); font-weight: 700; }
.chart-footnote { display: flex; align-items: center; gap: 7px; margin-top: 10px; color: #9aa49c; font-size: 9px; }
.legend-dot { display: inline-block; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--green); }
.lower-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(265px, .8fr); gap: 17px; margin-top: 17px; }
.timeline-card, .device-card, .recent-card { padding: 20px 22px; }
.text-button { padding: 3px 0; border: 0; background: transparent; color: var(--green); cursor: pointer; font-size: 10px; font-weight: 700; }
.text-button:hover { color: var(--green-dark); }
.text-button span { margin-left: 4px; }
.meal-list { display: grid; gap: 0; margin-top: 17px; }
.meal-row { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 12px; min-height: 52px; border-top: 1px solid #eff1ed; }
.meal-row:first-child { border-top: 0; }
.meal-time { color: #69796e; font-family: Manrope, sans-serif; font-size: 11px; font-weight: 700; }
.meal-track { position: relative; height: 2px; background: #e9eee7; }
.meal-track::before { position: absolute; top: -3px; left: 0; width: 8px; height: 8px; border: 2px solid #fbfcf8; border-radius: 50%; background: var(--grain); box-shadow: 0 0 0 1px #ebd6a9; content: ''; }
.meal-summary { display: grid; justify-items: end; gap: 2px; }
.meal-summary strong { color: #506256; font-size: 10px; }
.meal-summary small { color: #9aa49c; font-size: 8px; }
.meal-empty { padding: 19px 0; color: #97a29a; font-size: 11px; }
.device-card { position: relative; overflow: hidden; }
.device-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #e4b95f; box-shadow: 0 0 0 4px #fff3d9; }
.device-status-dot.is-live { background: #69a879; box-shadow: 0 0 0 4px #e2f0e3; }
.device-status-dot.is-offline { background: var(--red); box-shadow: 0 0 0 4px var(--red-pale); }
.device-illustration { position: relative; display: grid; height: 98px; place-items: center; margin: 2px 0 8px; overflow: hidden; border-radius: 12px; background: linear-gradient(110deg, #f2f6ed, #f8f9f4); }
.feeder-shape { position: relative; width: 62px; height: 76px; margin-top: 6px; }
.feeder-lid { position: absolute; top: 0; left: 7px; width: 48px; height: 11px; border: 1px solid #638a6c; border-radius: 8px 8px 4px 4px; background: #7fa786; }
.feeder-window { position: absolute; top: 9px; left: 12px; width: 38px; height: 42px; overflow: hidden; border: 1.5px solid #638a6c; border-radius: 5px 5px 9px 9px; background: #dcead8; }
.food-level { position: absolute; right: 0; bottom: 0; left: 0; height: 32%; background: repeating-linear-gradient(135deg, #edc46e 0 5px, #f5d58f 5px 9px); }
.feeder-base { position: absolute; bottom: 9px; left: 6px; width: 50px; height: 18px; border: 1px solid #678b70; border-radius: 4px 4px 11px 11px; background: #789f7e; }
.feeder-base span { position: absolute; top: 5px; left: 20px; width: 9px; height: 3px; border-radius: 4px; background: #d6e5d2; }
.bowl-shape { position: absolute; bottom: 1px; left: 0; width: 62px; height: 9px; border: 1px solid #aec0a9; border-top: 2px solid #aec0a9; border-radius: 0 0 15px 15px; background: #e6eee2; }
.illustration-spark { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--grain); }
.spark-one { top: 25px; left: calc(50% - 48px); }
.spark-two { right: calc(50% - 49px); bottom: 25px; width: 4px; height: 4px; background: #91b49a; }
.device-readings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.device-readings div { display: grid; gap: 4px; }
.device-readings span { color: #98a39a; font-size: 8px; }
.device-readings strong { color: #53675a; font-size: 10px; font-weight: 700; }
.connect-button { width: 100%; min-height: 35px; font-size: 10px; }
.recent-card { margin-top: 17px; }
.recent-card .panel-heading { margin-bottom: 13px; }
.table-wrap { width: 100%; overflow-x: auto; }
.feed-table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
.feed-table th { padding: 9px 10px; border-bottom: 1px solid #e9eee7; color: #9aa49d; font-size: 8px; font-weight: 700; letter-spacing: .08em; }
.feed-table td { padding: 11px 10px; border-bottom: 1px solid #f0f2ee; color: #6d7c72; font-size: 10px; }
.feed-table tr:last-child td { border-bottom: 0; }
.feed-table td:first-child { color: #516358; font-weight: 600; }
.source-label { display: inline-flex; align-items: center; gap: 6px; }
.source-label::before { width: 5px; height: 5px; border-radius: 50%; background: #91b49a; content: ''; }
.source-label.source-manual::before, .source-label.source-remote::before { background: var(--grain); }
.result-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 6px; background: #edf5eb; color: #56805f; font-size: 8px; font-weight: 700; }
.result-pill.is-failed { background: #faeeeb; color: #b65f54; }
.amount-cell { color: #53675a !important; font-weight: 700; }
.empty-state { padding: 21px 10px; color: #9aa49c; font-size: 11px; text-align: center; }

.plan-state { display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid #dce8dc; border-radius: 999px; background: #f7faf5; color: #64806b; font-size: 9px; font-weight: 700; }
.plan-state .pill-dot { width: 6px; height: 6px; margin: 0; }
.plan-state.is-off { border-color: #e7e7dd; background: #f7f7f1; color: #8b9085; }
.plan-state.is-off .pill-dot { background: #afb6a8; box-shadow: 0 0 0 3px #eceee7; }
.schedule-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(225px, .72fr); align-items: start; gap: 17px; }
.schedule-panel, .schedule-help { padding: 23px; }
.switch-label { display: inline-flex; align-items: center; gap: 8px; color: #6f8075; font-size: 10px; font-weight: 600; cursor: pointer; }
.switch-input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); clip-path: inset(50%); }
.switch-track { position: relative; width: 34px; height: 19px; border-radius: 99px; background: #dfe5dd; transition: background .2s ease; }
.switch-track::after { position: absolute; top: 3px; left: 3px; width: 13px; height: 13px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(20, 40, 30, .18); content: ''; transition: transform .2s ease; }
.switch-input:checked + .switch-track { background: #5f9b70; }
.switch-input:checked + .switch-track::after { transform: translateX(15px); }
.switch-input:focus-visible + .switch-track { outline: 3px solid rgba(47, 112, 88, .3); outline-offset: 2px; }
.schedule-mode-row { display: flex; align-items: center; justify-content: space-between; margin: 23px 0 22px; padding: 14px 0; border-top: 1px solid #edf0e9; border-bottom: 1px solid #edf0e9; }
.schedule-mode-row label { color: #748179; font-size: 10px; font-weight: 600; }
.select-control { min-height: 34px; padding: 0 27px 0 10px; border: 1px solid #e0e8de; border-radius: 9px; background: #fbfcf8; color: #53665a; cursor: pointer; font-size: 10px; font-weight: 600; }
.schedule-list-heading { display: grid; grid-template-columns: minmax(94px, .65fr) minmax(88px, .58fr) minmax(180px, 1.7fr) 28px; gap: 12px; padding: 0 8px 9px; color: #9aa49c; font-size: 8px; font-weight: 700; letter-spacing: .1em; }
.schedule-rows { display: grid; gap: 9px; }
.schedule-row { display: grid; grid-template-columns: minmax(94px, .65fr) minmax(88px, .58fr) minmax(180px, 1.7fr) 28px; align-items: center; gap: 12px; min-height: 56px; padding: 8px; border: 1px solid #e9eee6; border-radius: 12px; background: #fdfefb; }
.time-input, .portion-input { width: 100%; min-height: 34px; padding: 0 8px; border: 1px solid #e5eae2; border-radius: 8px; background: #fafcf8; color: #53665a; font-size: 10px; }
.portion-control { position: relative; display: flex; align-items: center; }
.portion-input { width: 70px; padding-right: 29px; text-align: center; }
.portion-unit { margin-left: 7px; color: #9aa49c; font-size: 8px; }
.row-remove { display: grid; width: 27px; height: 27px; place-items: center; border: 0; border-radius: 8px; background: transparent; color: #a6afa8; cursor: pointer; font-size: 16px; }
.row-remove:hover { background: #faeeeb; color: var(--red); }
.days-control { display: flex; gap: 4px; }
.day-toggle { display: grid; width: 22px; height: 25px; place-items: center; padding: 0; border: 1px solid #e6ebe3; border-radius: 7px; background: #fff; color: #9aa49c; cursor: pointer; font-size: 8px; font-weight: 600; }
.day-toggle:hover { border-color: #aac7ad; }
.day-toggle.is-selected { border-color: #d7e9d6; background: #e8f2e6; color: var(--green-dark); }
.add-meal-button { display: flex; width: 100%; min-height: 39px; align-items: center; justify-content: center; gap: 8px; margin-top: 12px; border: 1px dashed #cbd9c9; border-radius: 10px; background: transparent; color: #56805f; cursor: pointer; font-size: 10px; font-weight: 700; }
.add-meal-button:hover { border-color: #9dbb9f; background: #f6faf4; }
.add-meal-button span { font-size: 16px; font-weight: 400; }
.schedule-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 17px; border-top: 1px solid #edf0e9; }
.form-message { color: #98a39a; font-size: 9px; }
.form-message.is-error { color: var(--red); }
.schedule-help { position: relative; overflow: hidden; background: #f4f7ef; }
.help-icon { display: grid; width: 34px; height: 34px; place-items: center; margin-bottom: 22px; border-radius: 11px; background: #e2efdd; color: #58956a; font-size: 20px; }
.schedule-help h2 { margin-bottom: 10px; font-size: 16px; }
.schedule-help p { color: #829087; font-size: 10px; line-height: 1.65; }
.schedule-help .help-rule { height: 1px; margin: 16px 0; background: #e2e9dd; }
.schedule-help .help-small { margin-bottom: 14px; color: #9aa49c; font-size: 9px; }
.schedule-disabled { opacity: .55; }
.schedule-disabled .schedule-row, .schedule-disabled .add-meal-button { pointer-events: none; }

.history-summary { display: grid; grid-template-columns: repeat(3, minmax(110px, 1fr)) minmax(190px, 1.25fr); gap: 16px; align-items: center; padding: 20px 22px; }
.history-summary > div:not(.history-summary-note) { display: grid; gap: 5px; }
.history-summary > div:not(.history-summary-note) .section-kicker { margin: 0; }
.history-summary strong { color: var(--green-dark); font-family: Manrope, sans-serif; font-size: 24px; font-weight: 700; letter-spacing: -.6px; }
.history-summary small { color: #98a39a; font-size: 9px; }
.history-summary-note { display: flex; align-items: center; gap: 8px; color: #8c998f; font-size: 9px; }
.history-list-card { margin-top: 17px; padding: 20px 22px 11px; }
.history-heading { align-items: center; margin-bottom: 14px; }
.history-filters { display: flex; align-items: center; gap: 8px; }
.history-filters label { color: #96a198; font-size: 9px; }
.history-note { margin: 13px 2px; color: #929d94; font-size: 9px; line-height: 1.6; }

.app-dialog { width: min(100% - 28px, 440px); max-width: 440px; padding: 0; overflow: visible; border: 0; border-radius: 19px; background: transparent; color: var(--ink); box-shadow: 0 22px 90px rgba(21, 48, 36, .22); }
.app-dialog::backdrop { background: rgba(28, 49, 40, .35); backdrop-filter: blur(3px); }
.dialog-card { position: relative; padding: 30px; border: 1px solid #e6ebe2; border-radius: 19px; background: var(--paper); }
.dialog-close { position: absolute; top: 13px; right: 14px; display: grid; width: 30px; height: 30px; place-items: center; border: 0; border-radius: 9px; background: transparent; color: #859188; cursor: pointer; font-size: 22px; }
.dialog-close:hover { background: #f0f4ee; }
.dialog-card h2 { margin-bottom: 9px; font-size: 20px; letter-spacing: -.6px; }
.dialog-copy { max-width: 340px; margin-bottom: 22px; color: #839087; font-size: 11px; line-height: 1.6; }
.field-label { display: block; margin-bottom: 7px; color: #627268; font-size: 10px; font-weight: 700; }
.text-input { display: block; width: 100%; min-height: 42px; padding: 0 12px; border: 1px solid #dfe7dd; border-radius: 10px; background: white; color: #42574a; font-size: 11px; }
.text-input::placeholder { color: #b1bbb1; }
.field-help { margin: 8px 0 19px; color: #9aa49c; font-size: 9px; line-height: 1.7; }
.field-help code { padding: 2px 4px; border-radius: 4px; background: #f0f4ed; color: #64806b; font-size: 8px; }
.dialog-error { margin: -6px 0 15px; color: var(--red); font-size: 10px; line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.serving-picker { display: flex; align-items: center; justify-content: center; gap: 21px; padding: 5px 0 12px; }
.serving-picker button { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid #dfe8dc; border-radius: 12px; background: #f5f9f2; color: var(--green); cursor: pointer; font-size: 20px; }
.serving-picker button:hover { background: #e8f2e6; }
.serving-picker output { min-width: 42px; color: var(--green-dark); font-family: Manrope, sans-serif; font-size: 31px; font-weight: 700; text-align: center; }
.serving-note { margin: 0 0 22px; color: #9aa49c; font-size: 9px; text-align: center; }
.toast { position: fixed; z-index: 10; right: 24px; bottom: 24px; max-width: min(390px, calc(100vw - 32px)); padding: 12px 16px; border: 1px solid #dce8dc; border-radius: 12px; background: #fbfcf8; color: #47634e; box-shadow: 0 8px 25px rgba(33, 56, 41, .12); font-size: 10px; opacity: 0; pointer-events: none; transform: translateY(9px); transition: opacity .2s ease, transform .2s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.mobile-nav { display: none; }

@keyframes page-in { from { opacity: .3; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 215px minmax(0, 1fr); }
  .sidebar { padding-right: 14px; padding-left: 14px; }
  .main-content { padding-right: 27px; padding-left: 27px; }
  .overview-grid { grid-template-columns: minmax(250px, .9fr) minmax(320px, 1.1fr); }
  .schedule-list-heading, .schedule-row { grid-template-columns: minmax(84px, .58fr) minmax(80px, .52fr) minmax(155px, 1.45fr) 26px; gap: 8px; }
  .day-toggle { width: 20px; }
}

@media (max-width: 820px) {
  .app-shell { display: block; min-height: 100dvh; }
  .sidebar { display: none; }
  .main-content { max-width: 720px; padding: 0 22px 100px; }
  .topbar { min-height: 67px; }
  .page-view { padding-top: 26px; }
  .overview-grid { grid-template-columns: 1fr 1.1fr; gap: 12px; }
  .today-card, .week-card { min-height: 250px; padding: 18px; }
  .lower-grid { gap: 12px; margin-top: 12px; }
  .timeline-card, .device-card, .recent-card { padding: 18px; }
  .schedule-layout { grid-template-columns: 1fr; }
  .schedule-help { display: grid; grid-template-columns: 38px 1fr; column-gap: 12px; align-items: center; }
  .help-icon { grid-row: span 2; margin: 0; }
  .schedule-help h2 { margin: 0; }
  .schedule-help p, .schedule-help .help-rule, .schedule-help .text-button { grid-column: 1 / -1; }
  .schedule-help p { margin-top: 12px; }
  .schedule-help .help-rule { margin: 5px 0 0; }
  .schedule-help .help-small { margin: 9px 0; }
  .mobile-nav { position: fixed; z-index: 8; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(4, 1fr); min-height: calc(61px + env(safe-area-inset-bottom)); padding: 7px 9px calc(7px + env(safe-area-inset-bottom)); border-top: 1px solid #e1e9df; background: rgba(248, 250, 245, .96); backdrop-filter: blur(16px); }
  .mobile-nav-item { display: grid; align-content: center; justify-items: center; gap: 3px; border: 0; border-radius: 11px; background: transparent; color: #95a198; cursor: pointer; }
  .mobile-nav-item span { font-size: 17px; line-height: 1; }
  .mobile-nav-item small { font-size: 8px; font-weight: 600; }
  .mobile-nav-item.is-active { background: #e9f2e6; color: var(--green-dark); }
}

@media (max-width: 620px) {
  .main-content { padding-right: 15px; padding-left: 15px; }
  .topbar { min-height: 58px; }
  .crumb { font-size: 10px; }
  .connection-pill { min-height: 29px; padding: 0 8px; font-size: 9px; }
  .topbar-actions { gap: 5px; }
  .page-view { padding-top: 22px; }
  .page-heading { align-items: flex-start; margin-bottom: 17px; }
  .page-heading h1 { max-width: 260px; font-size: 27px; }
  .page-heading .subtitle { max-width: 300px; font-size: 10px; line-height: 1.5; }
  .feed-now-button { min-width: 99px; min-height: 37px; gap: 6px; padding: 0 10px; font-size: 10px; }
  .overview-grid, .lower-grid { grid-template-columns: 1fr; gap: 12px; }
  .today-card { min-height: 247px; }
  .week-card { min-height: 236px; }
  .week-chart { height: 127px; }
  .lower-grid { margin-top: 12px; }
  .device-card { display: grid; grid-template-columns: minmax(0, 1fr) 120px; column-gap: 12px; align-items: start; }
  .device-card .panel-heading { grid-column: 1 / -1; }
  .device-illustration { grid-column: 2; grid-row: 2 / span 2; height: 113px; margin: 10px 0 0; }
  .device-readings { grid-column: 1; grid-row: 2; grid-template-columns: 1fr; margin: 12px 0 0; }
  .connect-button { grid-column: 1 / -1; margin-top: 13px; }
  .recent-card { padding: 16px 13px; }
  .recent-card .feed-table th, .recent-card .feed-table td { padding-right: 7px; padding-left: 7px; }
  .history-summary { grid-template-columns: repeat(3, 1fr); gap: 13px 8px; padding: 16px 14px; }
  .history-summary strong { font-size: 21px; }
  .history-summary-note { grid-column: 1 / -1; }
  .history-list-card { padding: 16px 12px 8px; }
  .history-heading { align-items: flex-start; }
  .history-table { min-width: 540px; }
  .schedule-panel, .schedule-help { padding: 17px 13px; }
  .schedule-list-heading { display: none; }
  .schedule-row { grid-template-columns: 1fr 1fr 26px; gap: 8px; padding: 10px; }
  .schedule-row .days-control { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  .schedule-row .row-remove { grid-column: 3; grid-row: 1; justify-self: end; }
  .day-toggle { width: 31px; height: 29px; font-size: 9px; }
  .time-input { max-width: 130px; }
  .portion-input { width: 65px; }
  .schedule-actions { align-items: flex-end; }
  .form-message { max-width: 52%; line-height: 1.5; }
  .plan-state { margin-top: 4px; padding: 7px 9px; font-size: 8px; }
  .schedule-help { display: block; }
  .schedule-help .help-icon { margin-bottom: 12px; }
  .dialog-card { padding: 27px 20px 20px; }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions .button { flex: 1; }
  .toast { right: 16px; bottom: calc(78px + env(safe-area-inset-bottom)); }
}

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

.connection-divider { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
#last-command { overflow-wrap: anywhere; }

.meal-active-label { display: flex; gap: 6px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--muted); }
.meal-active { accent-color: var(--green); }
#time-zone { max-width: 240px; }
