*, *::before, *::after { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: clip; }
.app-shell, .app-main { min-width: 0; }
.skip-link { position: fixed; top: -70px; z-index: 30; padding: 12px; background: #fff; color: var(--ink); }
.skip-link:focus { top: 8px; }
.account-pill { display: flex; align-items: center; gap: 5px; min-height: 32px; max-width: 120px; padding: 6px 10px; background: #eef7ee; border: 1px solid #dfeddf; border-radius: 20px; color: var(--green-dark); font-size: 11px; text-decoration: none; }
.account-pill > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online-dot { flex: 0 0 6px; height: 6px; border-radius: 50%; background: var(--green); }
.panel { margin: 14px 0; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); }
.panel h2, dialog h2 { font-size: 17px; line-height: 1.5; margin: 0 0 12px; }
.panel-heading, .page-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.panel-heading { margin-bottom: 12px; }
.panel-heading h2 { margin: 0; }
.panel-heading a { font-size: 12px; text-decoration: none; color: var(--green-dark); white-space: nowrap; }
.page-heading { margin: 12px 0 17px; }
.page-intro { color: var(--ink-soft); font-size: 13px; line-height: 1.8; }
.welcome-banner { position: relative; isolation: isolate; overflow: hidden; padding: 23px; margin: 0 0 15px; min-height: 156px; border: 1px solid #e2ece0; border-radius: 16px; background: linear-gradient(110deg,#f6f9f0,#f7faf6); box-shadow: var(--shadow); }
.welcome-banner h1 { font-size: 25px; max-width: 100%; overflow-wrap: anywhere; }
.welcome-banner h1 > span { color: #e8b826; }
.welcome-banner p:last-of-type { color: #627066; font-size: 13px; line-height: 1.8; margin: 10px 0 0; }
.landscape { position: absolute; z-index: -1; bottom: 0; right: 0; width: 58%; height: 65px; overflow: hidden; opacity: .75; }
.landscape i { position: absolute; width: 210px; height: 85px; right: -20px; bottom: -50px; border-radius: 50%; background: #76bc90; transform: rotate(-18deg); }
.landscape i:nth-child(2) { right: 70px; bottom: -50px; background: #d8e8b7; transform: rotate(14deg); }
.landscape i:nth-child(3) { right: -115px; bottom: -30px; background: #368d64; transform: rotate(-28deg); }
.nutrition-summary { display: flex; align-items: center; gap: 20px; min-height: 132px; }
.calorie-ring { --progress: 0deg; position: relative; flex: 0 0 138px; width: 138px; height: 138px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 50%; background: conic-gradient(var(--green) var(--progress),#f0f2f1 0); }
.calorie-ring::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: #fff; }
.calorie-ring > * { position: relative; }
.calorie-ring strong { font-size: 31px; letter-spacing: -1px; }
.calorie-ring small { font-size: 11px; color: var(--ink-soft); }
.calorie-ring span { font-size: 10px; margin-top: 5px; color: var(--green-dark); }
.macro-list { flex: 1; min-width: 0; }
.macro { margin: 11px 0; }
.macro > div { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; }
.macro > small { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 10px; }
progress { display: block; width: 100%; height: 6px; margin-top: 6px; border: 0; border-radius: 9px; overflow: hidden; background: #eef0ef; accent-color: var(--green); }
progress::-webkit-progress-bar { background: #eef0ef; border-radius: 9px; }
progress::-webkit-progress-value { background: linear-gradient(90deg,#7fca73,var(--green)); border-radius: 9px; }
.quick-actions { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.quick-actions a { display: flex; align-items: center; flex-direction: column; gap: 5px; padding: 14px 4px; text-decoration: none; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.quick-actions a:hover { background: #f2f8ef; }
.quick-actions svg, .quick-actions a > span { width: 28px; height: 28px; color: var(--green-dark); font-size: 28px; line-height: 28px; text-align: center; margin-bottom: 4px; }
.quick-actions strong { font-size: 12px; }
.quick-actions small { font-size: 10px; color: var(--ink-soft); }
.primary-button, .danger-button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 44px; padding: 10px 17px; border: 1px solid transparent; border-radius: 9px; color: white; background: linear-gradient(115deg,#279b46,#218b3b); font-weight: 650; font-size: 14px; text-decoration: none; }
.primary-button:hover { background: #157c2f; }
.primary-button:disabled { opacity: .65; cursor: wait; }
.compact { padding-inline: 12px; font-size: 12px; white-space: nowrap; }
.danger-button { background: #b83838; }
.text-button { min-height: 44px; padding: 5px 8px; color: var(--green-dark); border: 0; background: transparent; font-size: 12px; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; }
.button-row > * { flex: 1; }
.stack-form { display: flex; flex-direction: column; gap: 15px; }
label { display: block; color: var(--ink); font-size: 12px; line-height: 1.6; }
input, select, textarea { width: 100%; min-width: 0; margin-top: 6px; padding: 10px 11px; min-height: 44px; border: 1px solid #dce3e1; border-radius: 8px; background: #fff; color: var(--ink); font-size: 14px; }
textarea { resize: vertical; }
input[type="file"] { font-size: 11px; padding: 9px 6px; }
input::placeholder, textarea::placeholder { color: #7f8b88; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.form-note, .form-note a { color: var(--ink-soft); font-size: 11px; line-height: 1.7; }
.image-entry { margin: 11px 0; }
.image-entry small { font-size: 10px; color: var(--ink-soft); }
.analysis-entry { border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 17px; }
.analysis-entry .button-row { margin-top: 13px; }
.manual-food-entry { margin-top: 13px; padding: 12px; border: 1px solid #dce8d8; border-radius: 10px; background: #f6faf3; }
.manual-food-entry .secondary-button { width: 100%; margin-top: 11px; }
.analysis-note { font-size: 12px; color: #46623f; background: #f1f7eb; padding: 10px; border-radius: 8px; line-height: 1.7; white-space: pre-wrap; }
.item-editor { border: 1px solid var(--line); border-radius: 11px; padding: 12px; margin-bottom: 12px; background: #fafcf9; }
.item-editor .nutrient-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; }
.item-editor .nutrient-grid input { padding-inline: 7px; }
.item-editor label { font-size: 10px; }
.item-editor .form-grid { margin-bottom: 10px; }
.item-editor__head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.preview-total { margin: 0; font-size: 13px; color: var(--green-dark); }
.date-filter { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.date-filter input { width: auto; max-width: 65%; margin: 0; }
.meal-row, .stock-row { border-top: 1px solid var(--line); padding: 14px 0; }
.meal-row:first-child, .stock-row:first-child { border-top: 0; }
.panel.meal-row, .panel.stock-row { padding: 18px; border-top: 0; }
.meal-row h3, .stock-row h3, .recipe-card h3 { font-size: 15px; margin: 0 0 6px; overflow-wrap: anywhere; }
.meal-row p, .stock-row p { margin: 6px 0 0; font-size: 12px; line-height: 1.7; color: var(--ink-soft); }
.row-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row-heading > span { color: var(--green-dark); font-size: 12px; white-space: nowrap; }
.row-actions { display: flex; justify-content: flex-end; gap: 8px; }
.row-actions button { min-height: 36px; padding: 5px 8px; font-size: 11px; color: var(--ink-soft); background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.empty-state { margin: 0; padding: 20px 6px; color: var(--ink-soft); font-size: 13px; line-height: 1.8; text-align: center; }
.filter-row { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-chip { flex: 1; white-space: nowrap; min-height: 36px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 22px; color: var(--ink-soft); background: white; font-size: 11px; }
.filter-chip.active { color: var(--green-dark); border-color: var(--green); background: #f0f7ef; }
.expiry-badge { display: inline-block; font-size: 10px; padding: 4px 7px; color: var(--green-dark); background: #eef7ee; border-radius: 12px; }
.expiry-badge.soon { color: #a45909; background: #fff3e5; }
.expiry-badge.expired { color: #a13131; background: #fff0ef; }
.recipe-inspiration { background: linear-gradient(115deg,#f4f8ef,#fff); }
.recipe-inspiration > p { font-size: 12px; line-height: 1.8; color: var(--ink-soft); }
.recipe-inspiration > button { width: 100%; margin-top: 13px; }
#recipeSuggestion { font-size: 13px; white-space: pre-wrap; line-height: 1.8; margin-top: 18px; }
#recipeSuggestion button { display: block; margin-top: 14px; }
.recipe-card summary { font-weight: 700; font-size: 15px; cursor: pointer; padding: 4px 0; min-height: 35px; }
.recipe-card h4 { font-size: 12px; color: var(--green-dark); margin: 14px 0 5px; }
.recipe-card p { font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.8; }
.profile-card { display: flex; gap: 13px; align-items: center; }
.profile-card__identity { flex: 1; min-width: 0; }
.profile-name-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.profile-name-line h2 { min-width: 0; }
.icon-button { display: inline-grid; flex: 0 0 32px; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; color: var(--green-dark); background: #fff; font-size: 19px; cursor: pointer; }
.icon-button:hover { background: #f1f8ed; }
.inline-edit-form { flex-basis: 100%; display: flex; align-items: end; gap: 10px; padding-top: 4px; }
.inline-edit-form label { flex: 1; }
.inline-edit-form .button-row { flex: 0 0 auto; }
.profile-card h2 { overflow-wrap: anywhere; margin: 0; }
.profile-card p { font-size: 11px; color: var(--ink-soft); margin: 5px 0 0; }
.profile-card > div:nth-child(2) { flex: 1; min-width: 0; }
.profile-avatar { display: grid; place-items: center; width: 52px; height: 52px; flex: 0 0 52px; border-radius: 50%; color: var(--green-dark); background: #e9f3e7; font-size: 24px; }
.footnote { margin: 20px 0 0; font-size: 10px; line-height: 1.8; color: var(--ink-soft); text-align: center; }
.app-notice { position: sticky; top: 8px; z-index: 9; border: 1px solid #cee4cb; border-radius: 9px; margin-bottom: 14px; padding: 12px; background: #f1f8ed; color: #236433; box-shadow: var(--shadow); font-size: 13px; line-height: 1.6; }
.app-notice.error { color: #a12a2a; border-color: #f1cdcd; background: #fff2ef; }
.auth-panel { margin-top: 20px; }
.auth-panel form p { margin: 0; }
.auth-panel .helptext { display: block; margin-top: 5px; color: var(--ink-soft); font-size: 11px; line-height: 1.7; }
.auth-panel ul { padding-left: 18px; font-size: 11px; line-height: 1.7; color: var(--ink-soft); }
.social-login { display: grid; gap: 8px; margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line); }
.social-login p { margin: 0; color: var(--ink-soft); font-size: 12px; }
.social-login__disabled { padding: 9px 0; color: var(--ink-soft); font-size: 12px; }
.auth-panel .errorlist { color: #a12a2a; }
.account-alternative { margin: 18px 0 0; text-align: center; color: var(--ink-soft); font-size: 13px; }
.account-alternative a, .quiet-link { color: var(--green-dark); }
.quiet-link { display: block; padding: 14px; text-align: center; font-size: 13px; text-decoration: none; }
dialog { width: min(90vw, 390px); border: 1px solid var(--line); border-radius: 16px; padding: 24px; color: var(--ink); }
dialog::backdrop { background: rgba(16,35,69,.3); }
dialog > p { color: var(--ink-soft); font-size: 13px; margin-bottom: 20px; }
.save-voice-link { display: flex; margin-top: 16px; }
@media (max-width: 400px) {
  .nutrition-summary { gap: 15px; }
  .calorie-ring { flex-basis: 112px; width: 112px; height: 112px; }
  .calorie-ring strong { font-size: 27px; }
  .panel { padding: 15px; }
  .panel.meal-row, .panel.stock-row { padding: 15px; }
  .item-editor { padding: 9px; }
  .brand__tagline { display: none; }
  .welcome-banner h1 { font-size: 23px; }
}
@media (max-width: 540px) {
  .page-heading { align-items: flex-start; }
  .page-heading .compact { flex: 0 1 auto; max-width: 48%; white-space: normal; }
  .row-heading { align-items: flex-start; }
  .row-heading > span { white-space: normal; text-align: right; }
  .profile-card { flex-wrap: wrap; }
  .profile-card form { width: 100%; }
  .profile-card form .secondary-button { width: 100%; }
  .item-editor .nutrient-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .date-filter { align-items: stretch; flex-direction: column; gap: 6px; }
  .date-filter input { width: 100%; max-width: none; }
}
@media (max-width: 359px) {
  .form-grid, .item-editor .nutrient-grid { grid-template-columns: 1fr; }
  .quick-actions { gap: 5px; }
  .quick-actions strong { font-size: 11px; }
  .quick-actions small { display: none; }
}
@media (min-width: 900px) {
  .app-layout .app-shell { width: min(100%, 1180px); }
  .app-layout .app-header, .app-layout .app-main { width: min(100%, 1120px); margin-inline: auto; }
  .app-layout .app-main { padding: 26px 32px 130px; }
  .app-layout .bottom-nav { width: min(100%, 1120px); }
  .auth-layout-page .app-shell { width: min(100%, 760px); }
  .auth-layout-page .app-header, .auth-layout-page .app-main { width: min(100%, 700px); margin-inline: auto; }
  .voice-layout .app-shell, .voice-layout .bottom-nav { width: min(100%, 580px); }
}
