:root {
  color-scheme: light;
  --ink: #183128;
  --ink-soft: #52645d;
  --forest: #1f4d3b;
  --forest-deep: #15382b;
  --forest-soft: #dfe9e1;
  --orange: #db6e42;
  --orange-soft: #f7e3d8;
  --cream: #f4f0e7;
  --paper: #fffcf6;
  --white: #ffffff;
  --line: #dedbd1;
  --danger: #a13a32;
  --shadow: 0 18px 50px rgb(40 55 45 / 10%);
  --shadow-soft: 0 7px 24px rgb(40 55 45 / 8%);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  scroll-behavior: smooth;
  background: var(--cream);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgb(255 255 255 / 72%), transparent 32rem),
    var(--cream);
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.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;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 26rem;
  height: 26rem;
  border-radius: 50%;
  filter: blur(100px);
  opacity: .16;
  pointer-events: none;
}

.ambient-one { top: -12rem; right: -8rem; background: var(--orange); }
.ambient-two { bottom: -15rem; left: -8rem; background: #7ba98b; }

.eyebrow {
  margin: 0 0 .45rem;
  color: var(--forest);
  font-size: .69rem;
  font-weight: 800;
  letter-spacing: .16em;
  line-height: 1.2;
}

.eyebrow-light { color: #b9d0c4; }
.muted { color: var(--ink-soft); }

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 3.25rem;
  height: 3.25rem;
  color: var(--paper);
  background: var(--forest);
  border-radius: 1.1rem;
  font-family: Georgia, serif;
  font-size: 1.65rem;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 12%);
}

.brand-mark-small {
  width: 2.3rem;
  height: 2.3rem;
  border-radius: .78rem;
  font-size: 1.15rem;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: max(1.25rem, var(--safe-top)) max(1.25rem, var(--safe-right)) max(1.25rem, var(--safe-bottom)) max(1.25rem, var(--safe-left));
}

.auth-card {
  width: min(100%, 29rem);
  padding: clamp(1.4rem, 5vw, 2.4rem);
  border: 1px solid rgb(255 255 255 / 72%);
  border-radius: var(--radius-xl);
  background: rgb(255 252 246 / 88%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.brand-lockup { display: flex; align-items: center; gap: 1rem; margin-bottom: 2rem; }
.brand-lockup h1 { margin: 0; font-family: Georgia, "Noto Serif SC", serif; font-size: 2rem; letter-spacing: -.04em; }
.auth-intro { margin: 0 0 1.5rem; color: var(--ink-soft); line-height: 1.65; }
.auth-section-title { margin: 0 0 1rem; font-family: Georgia, "Noto Serif SC", serif; font-size: 1.65rem; font-weight: 600; letter-spacing: -.03em; }
.invite-summary { display: grid; gap: .35rem; margin-bottom: 1rem; padding: .85rem; border: 1px solid #cddbcf; border-radius: 12px; background: #edf4ee; line-height: 1.5; }
.invite-summary strong { font-size: .88rem; }
.invite-summary span { color: var(--ink-soft); font-size: .78rem; }
.auth-link-actions { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-top: 1rem; }

.stack-form, .form-grid { display: grid; gap: 1rem; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-two { grid-column: 1 / -1; }

label {
  display: grid;
  gap: .48rem;
  color: var(--ink);
  font-size: .84rem;
  font-weight: 700;
}

.field-hint { float: right; color: var(--ink-soft); font-size: .7rem; font-weight: 500; }

input, select, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  background: var(--white);
  color: var(--ink);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input, select { min-height: 3rem; padding: 0 .82rem; }
textarea { padding: .8rem; resize: vertical; line-height: 1.5; }
input[readonly] { background: var(--paper); color: var(--ink-soft); }
input:focus, select:focus, textarea:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgb(31 77 59 / 12%); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
  padding: .72rem 1rem;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease, background .16s ease;
}

.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:focus-visible, .icon-button:focus-visible, .quick-action:focus-visible, .filter-chip:focus-visible, .choice-card:focus-visible, .text-button:focus-visible, .dialog-close:focus-visible, .topbar-invite-button:focus-visible { outline: 3px solid rgb(219 110 66 / 38%); outline-offset: 2px; }
.button:disabled, button:disabled { cursor: not-allowed; opacity: .5; transform: none; }
.button-wide { width: 100%; }
.button-primary { color: var(--white); background: var(--forest); box-shadow: 0 9px 20px rgb(31 77 59 / 18%); }
.button-primary:hover { background: var(--forest-deep); }
.button-secondary { color: var(--forest); border-color: var(--line); background: var(--paper); }
.button-danger-quiet { min-height: 2.75rem; color: var(--danger); border-color: rgb(161 58 50 / 25%); background: #fff8f6; box-shadow: none; }
.button-light { color: var(--forest-deep); background: var(--paper); box-shadow: 0 7px 18px rgb(8 32 23 / 16%); }
.text-button { min-height: 2.75rem; padding: .4rem 0; border: 0; background: transparent; font-weight: 800; cursor: pointer; }
.text-button-light { color: #d7e8df; }

.form-error {
  margin: .8rem 0 0;
  padding: .7rem .8rem;
  color: var(--danger);
  border: 1px solid rgb(161 58 50 / 24%);
  border-radius: 10px;
  background: #fff3f0;
  font-size: .82rem;
  line-height: 1.45;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(4.5rem + var(--safe-top));
  padding: calc(.75rem + var(--safe-top)) max(1rem, var(--safe-right), calc((100vw - 1200px) / 2)) .75rem max(1rem, var(--safe-left), calc((100vw - 1200px) / 2));
  border-bottom: 1px solid rgb(222 219 209 / 72%);
  background: rgb(244 240 231 / 84%);
  backdrop-filter: blur(18px);
}

.brand { display: inline-flex; align-items: center; gap: .72rem; font-family: Georgia, serif; font-size: 1.17rem; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: .8rem; }
.topbar-invite-button { display: inline-flex; align-items: center; justify-content: center; gap: .38rem; min-height: 2.75rem; padding: .42rem .72rem; border: 1px solid var(--line); border-radius: 999px; color: var(--forest); background: var(--paper); font-size: .76rem; font-weight: 800; cursor: pointer; }
.topbar-invite-button > span:first-child { font-size: 1rem; line-height: 1; }
.connection-badge { display: inline-flex; align-items: center; gap: .42rem; padding: .4rem .65rem; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-soft); background: rgb(255 255 255 / 55%); font-size: .72rem; font-weight: 700; }
.status-dot { width: .46rem; height: .46rem; border-radius: 50%; background: #42966c; box-shadow: 0 0 0 3px rgb(66 150 108 / 14%); }
.connection-badge.is-offline .status-dot { background: #bf6b48; }
.connection-badge.is-unavailable .status-dot { background: #bd8a33; }
.icon-button { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); cursor: pointer; }

.page-shell { width: min(100% - 2rem, 1200px); margin: 0 auto; padding: 2.1rem 0 7rem; }
.hero-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(28rem, 1.25fr); align-items: stretch; gap: 1.4rem; }
.welcome-block { align-self: center; padding: clamp(1rem, 3vw, 2.2rem); }
.welcome-block h1 { margin: 0; font-family: Georgia, "Noto Serif SC", serif; font-size: clamp(2rem, 4.6vw, 4rem); font-weight: 500; letter-spacing: -.055em; line-height: 1.04; }
.welcome-block p:last-child { margin: .8rem 0 0; line-height: 1.6; }

.calorie-card {
  position: relative;
  overflow: hidden;
  min-height: 18rem;
  padding: clamp(1.4rem, 4vw, 2.2rem);
  border-radius: var(--radius-xl);
  color: var(--white);
  background:
    radial-gradient(circle at 88% 15%, rgb(255 255 255 / 12%) 0 5rem, transparent 5.1rem),
    linear-gradient(135deg, var(--forest), #173f31 62%, #102f24);
  box-shadow: 0 22px 55px rgb(31 77 59 / 22%);
}

.calorie-card::after { content: ""; position: absolute; right: -4rem; bottom: -5rem; width: 15rem; height: 15rem; border: 1px solid rgb(255 255 255 / 10%); border-radius: 50%; }
.calorie-card-heading { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.calorie-number { display: flex; align-items: baseline; gap: .55rem; margin-top: .25rem; }
.calorie-number span { font-family: Georgia, serif; font-size: clamp(3rem, 7vw, 5.1rem); line-height: .95; letter-spacing: -.06em; }
.calorie-number small { color: #bed3c8; font-size: .9rem; font-weight: 700; }
.coverage-ring { --coverage: 0deg; display: grid; place-items: center; flex: 0 0 auto; width: 4.25rem; height: 4.25rem; border-radius: 50%; background: conic-gradient(var(--orange) var(--coverage), rgb(255 255 255 / 14%) 0); }
.coverage-ring::before { content: ""; grid-area: 1 / 1; width: 3.25rem; height: 3.25rem; border-radius: 50%; background: var(--forest-deep); }
.coverage-ring span { z-index: 1; grid-area: 1 / 1; font-size: .76rem; font-weight: 800; }
.calorie-copy { position: relative; z-index: 1; max-width: 33rem; min-height: 2.8rem; margin: 1rem 0 .6rem; color: #edf4f0; font-size: .95rem; line-height: 1.55; }
.source-note { position: relative; z-index: 1; display: inline-flex; padding: .45rem .65rem; border: 1px solid rgb(255 255 255 / 12%); border-radius: 9px; color: #c3d7cc; background: rgb(255 255 255 / 6%); font-size: .72rem; line-height: 1.4; }
.calorie-actions { position: relative; z-index: 1; display: flex; align-items: center; gap: 1.1rem; margin-top: 1.35rem; }

.quick-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; margin: 1.25rem 0 1.7rem; }
.quick-action { display: flex; align-items: center; gap: .85rem; min-width: 0; padding: 1rem; border: 1px solid rgb(222 219 209 / 92%); border-radius: var(--radius-lg); text-align: left; background: rgb(255 252 246 / 76%); box-shadow: var(--shadow-soft); cursor: pointer; transition: transform .16s ease, border-color .16s ease; }
.quick-action:hover { transform: translateY(-2px); border-color: #c5cfc6; }
.quick-action span:last-child { display: grid; min-width: 0; }
.quick-action strong { font-size: .88rem; }
.quick-action small { overflow: hidden; margin-top: .25rem; color: var(--ink-soft); font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.quick-icon { display: grid; place-items: center; flex: 0 0 auto; width: 2.7rem; height: 2.7rem; border-radius: .9rem; font-size: 1.25rem; font-weight: 500; }
.quick-icon-green { color: var(--forest); background: var(--forest-soft); }
.quick-icon-orange { color: #9a4828; background: var(--orange-soft); }
.quick-icon-cream { color: #776748; background: #eee5d0; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(18rem, .78fr); align-items: start; gap: 1.1rem; }
.side-column { display: grid; gap: 1.1rem; }
.panel { border: 1px solid rgb(222 219 209 / 92%); border-radius: var(--radius-xl); background: rgb(255 252 246 / 86%); box-shadow: var(--shadow-soft); }
.inventory-panel, .log-panel { padding: clamp(1rem, 3vw, 1.5rem); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-heading.compact { margin-bottom: .5rem; }
.section-heading h2, .privacy-panel h2 { margin: 0; font-family: Georgia, "Noto Serif SC", serif; font-size: 1.42rem; font-weight: 600; letter-spacing: -.025em; }
.count-pill { flex: 0 0 auto; padding: .38rem .62rem; border-radius: 999px; color: var(--forest); background: var(--forest-soft); font-size: .72rem; font-weight: 800; }

.search-field { position: relative; display: flex; align-items: center; gap: .4rem; }
.search-field > span { position: absolute; left: .9rem; z-index: 1; color: var(--ink-soft); font-size: 1.15rem; }
.search-field input { padding-left: 2.7rem; background: #faf8f1; }
.filter-row { display: flex; gap: .42rem; margin: .8rem 0 1rem; overflow-x: auto; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip { flex: 0 0 auto; min-height: 2.75rem; padding: .45rem .8rem; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink-soft); font-size: .76rem; font-weight: 800; cursor: pointer; }
.filter-chip.is-active { border-color: var(--forest); color: var(--white); background: var(--forest); }

.inventory-list { display: grid; gap: .65rem; }
.inventory-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: .8rem; padding: .9rem; border: 1px solid #e6e1d7; border-radius: var(--radius-md); background: #fffefb; }
.inventory-item-main { min-width: 0; }
.inventory-item-main strong { display: block; overflow: hidden; font-size: .93rem; text-overflow: ellipsis; white-space: nowrap; }
.inventory-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .55rem; margin-top: .3rem; color: var(--ink-soft); font-size: .7rem; }
.location-dot { display: inline-block; width: .4rem; height: .4rem; margin-right: .2rem; border-radius: 50%; background: var(--orange); }
.nutrition-badge { padding: .24rem .42rem; border-radius: 6px; color: var(--forest); background: var(--forest-soft); font-size: .65rem; font-weight: 800; }
.nutrition-badge.is-unknown { color: #7c6540; background: #f1e8d5; }
.quantity-block { text-align: right; }
.quantity-block strong { display: block; font-family: Georgia, serif; font-size: 1.08rem; }
.quantity-block small { color: var(--ink-soft); font-size: .67rem; }
.consume-button { min-height: 2.75rem; padding: .55rem .75rem; border: 1px solid var(--forest-soft); border-radius: 9px; color: var(--forest); background: var(--forest-soft); font-size: .76rem; font-weight: 800; cursor: pointer; }

.empty-state { display: grid; justify-items: center; padding: 2.8rem 1rem; text-align: center; }
.empty-state > span { display: grid; place-items: center; width: 4rem; height: 4rem; margin-bottom: .85rem; border-radius: 50%; color: var(--forest); background: var(--forest-soft); font-size: 2rem; }
.empty-state strong { font-family: Georgia, serif; font-size: 1.2rem; }
.empty-state p { max-width: 22rem; margin: .5rem 0 1.1rem; color: var(--ink-soft); font-size: .82rem; line-height: 1.5; }

.calorie-log { display: grid; }
.log-entry { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) auto; align-items: center; gap: .7rem; padding: .82rem 0; border-bottom: 1px solid #e9e4da; }
.log-entry:last-child { border-bottom: 0; }
.log-icon { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: .75rem; color: var(--forest); background: var(--forest-soft); }
.log-entry strong { display: block; overflow: hidden; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.log-entry small { color: var(--ink-soft); font-size: .67rem; }
.log-energy { text-align: right; font-size: .76rem; font-weight: 800; }
.log-energy.is-unknown { color: #8c7146; }
.mini-empty { padding: 1.4rem .2rem; color: var(--ink-soft); font-size: .8rem; line-height: 1.5; }

.privacy-panel { display: flex; align-items: flex-start; gap: .8rem; padding: 1.15rem; color: #eaf2ed; border-color: transparent; background: var(--forest); }
.privacy-panel h2 { font-family: inherit; font-size: .9rem; }
.privacy-panel p { margin: .35rem 0 0; color: #c6d8ce; font-size: .72rem; line-height: 1.55; }
.privacy-seal { display: grid; place-items: center; flex: 0 0 auto; width: 2.2rem; height: 2.2rem; border-radius: .7rem; color: var(--forest); background: var(--paper); }

.mobile-nav { display: none; }

.dialog {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: max(1rem, var(--safe-top)) max(1rem, var(--safe-right)) max(1rem, var(--safe-bottom)) max(1rem, var(--safe-left));
  border: 0;
  background: transparent;
}

.dialog::backdrop { background: rgb(17 38 30 / 58%); backdrop-filter: blur(7px); }
.dialog[open] { display: grid; place-items: center; }
.dialog-card { width: min(100%, 37rem); max-height: min(90dvh, 50rem); overflow: auto; overscroll-behavior: contain; padding: clamp(1.1rem, 4vw, 1.7rem); border: 1px solid rgb(255 255 255 / 65%); border-radius: var(--radius-xl); background: var(--paper); box-shadow: 0 30px 90px rgb(8 28 21 / 28%); }
.dialog-card-small { width: min(100%, 30rem); }
.dialog-card-wide { width: min(100%, 54rem); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.35rem; }
.dialog-heading h2, .settlement-dialog h2 { margin: 0; font-family: Georgia, "Noto Serif SC", serif; font-size: 1.65rem; font-weight: 600; letter-spacing: -.03em; }
.dialog-close { display: grid; place-items: center; flex: 0 0 auto; width: 2.75rem; height: 2.75rem; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: transparent; font-size: 1.4rem; cursor: pointer; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .65rem; margin-top: 1.2rem; }
.dialog-lead { margin: -.4rem 0 1rem; color: var(--ink-soft); }
.field-explainer { grid-column: 1 / -1; margin: 0; color: var(--ink-soft); font-size: .74rem; line-height: 1.55; }
.nutrition-details { margin-top: 1rem; padding: .85rem; border: 1px solid var(--line); border-radius: var(--radius-md); }
.nutrition-details summary { color: var(--forest); font-size: .8rem; font-weight: 800; cursor: pointer; }
.nutrition-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 1rem; }

.upload-zone { display: grid; justify-items: center; padding: 1.5rem; margin-bottom: 1rem; border: 1.5px dashed #bcc8bd; border-radius: var(--radius-lg); text-align: center; background: #f7f6ee; }
.upload-symbol { display: grid; place-items: center; width: 3.3rem; height: 3.3rem; margin-bottom: .7rem; border-radius: 1rem; color: #9a4828; background: var(--orange-soft); font-size: 1.5rem; }
.upload-zone p { margin: .55rem 0 0; color: var(--ink-soft); font-size: .72rem; }
.file-button input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.file-button:focus-within { outline: 3px solid rgb(219 110 66 / 38%); outline-offset: 2px; }
.notice { margin-bottom: 1rem; padding: .8rem; border: 1px solid #e2d4ad; border-radius: 12px; color: #745d30; background: #fff6dd; font-size: .8rem; line-height: 1.5; }
.review-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .7rem; margin-bottom: 1rem; }
.receipt-lines { display: grid; gap: .6rem; }
.receipt-line { display: grid; grid-template-columns: auto minmax(8rem, 1.6fr) minmax(5rem, .6fr) minmax(5rem, .6fr) minmax(5rem, .6fr); grid-template-areas: "include name quantity unit price" ". reason reason reason reason"; align-items: end; gap: .55rem; padding: .75rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fffefb; }
.receipt-line label { font-size: .68rem; }
.receipt-line input, .receipt-line select { min-height: 2.5rem; padding: 0 .6rem; font-size: .8rem; }
.include-check { grid-area: include; align-self: center; }
.receipt-field-name { grid-area: name; }
.receipt-field-quantity { grid-area: quantity; }
.receipt-field-unit { grid-area: unit; }
.receipt-field-price { grid-area: price; }
.include-check input { width: 1.2rem; min-height: 1.2rem; accent-color: var(--forest); }
.review-reason { grid-area: reason; margin: -.2rem 0 0; color: #8a6e3f; font-size: .7rem; }
.review-footer { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.review-footer > label { max-width: 12rem; }

.invitation-create-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .7rem; }
.created-invitation-panel { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1rem 0; padding: .9rem; border: 1px solid #cddbcf; border-radius: var(--radius-md); background: #edf4ee; }
.created-invitation-panel p { margin: .25rem 0 0; color: var(--ink-soft); font-size: .75rem; line-height: 1.5; }
.created-invitation-panel .button { flex: 0 0 auto; }
.admin-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.2rem; border-bottom: 1px solid var(--line); }
.admin-list-heading h3 { margin: 0; padding-bottom: .7rem; font-family: Georgia, "Noto Serif SC", serif; font-size: 1.08rem; }
.admin-invitations-list { display: grid; }
.admin-invitation-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .8rem; padding: .85rem 0; border-bottom: 1px solid #e9e4da; }
.admin-invitation-row:last-child { border-bottom: 0; }
.admin-invitation-summary { min-width: 0; }
.admin-invitation-summary p { margin: .3rem 0 0; color: var(--ink-soft); font-size: .72rem; line-height: 1.45; }
.admin-invitation-heading { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; min-width: 0; }
.admin-invitation-heading strong { overflow-wrap: anywhere; }
.invitation-status { display: inline-flex; padding: .25rem .48rem; border-radius: 999px; font-size: .65rem; font-weight: 800; }
.status-active { color: #17573c; background: #dcefe2; }
.status-expired { color: #725e38; background: #f3ead7; }
.status-revoked { color: #83352f; background: #f8dfda; }
.status-consumed { color: #425d68; background: #e1ebef; }

.install-guide-card { text-align: center; }
.install-guide-card .dialog-heading { text-align: left; }
.install-guide-mark { display: grid; place-items: center; width: 4.3rem; height: 4.3rem; margin: .2rem auto 1rem; border-radius: 1.25rem; color: var(--paper); background: var(--forest); font-family: Georgia, serif; font-size: 2rem; font-weight: 700; box-shadow: 0 12px 26px rgb(31 77 59 / 20%); }
.install-guide-copy { margin: 0 auto 1rem; color: var(--ink-soft); line-height: 1.6; }
.install-manual-steps { margin: 1rem 0; padding: .9rem; border: 1px solid var(--line); border-radius: var(--radius-md); text-align: left; background: #f8f6ef; }
.install-manual-steps ol { display: grid; gap: .45rem; margin: .65rem 0 0; padding-left: 1.35rem; color: var(--ink-soft); font-size: .8rem; line-height: 1.5; }
.install-later-button { margin-top: .8rem; }

.settlement-dialog .dialog-card { max-height: min(92dvh, 50rem); overflow: auto; text-align: center; }
.settlement-illustration { display: grid; place-items: center; width: 4.4rem; height: 4.4rem; margin: 0 auto 1.1rem; border: .45rem solid var(--paper); border-radius: 50%; background: var(--orange); box-shadow: 0 10px 24px rgb(219 110 66 / 22%); }
.settlement-illustration span { color: var(--white); font-size: 1.45rem; font-weight: 900; }
.settlement-total { display: flex; align-items: baseline; justify-content: center; gap: .45rem; margin: .8rem 0 .4rem; }
.settlement-total span { font-family: Georgia, serif; font-size: 3.5rem; letter-spacing: -.06em; }
.settlement-total small { color: var(--ink-soft); font-weight: 700; }
.settlement-copy { margin: .4rem auto 1rem; color: var(--ink-soft); line-height: 1.55; }
.settlement-disclaimer { padding: .7rem; border-radius: 10px; color: #6e6249; background: #f4eddf; font-size: .7rem; line-height: 1.5; }
.settlement-choices { display: grid; gap: .65rem; margin-top: 1rem; }
.choice-card { position: relative; display: grid; gap: .25rem; width: 100%; padding: .9rem 2.7rem .9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-md); text-align: left; background: var(--white); cursor: pointer; }
.choice-card strong { font-size: .86rem; }
.choice-card small { color: var(--ink-soft); font-size: .7rem; line-height: 1.45; }
.choice-card > span { position: absolute; top: 50%; right: 1rem; transform: translateY(-50%); font-size: 1.15rem; }
.choice-primary { border-color: var(--forest); color: var(--white); background: var(--forest); }
.choice-primary small { color: #c7d9cf; }

.toast-region { position: fixed; z-index: 80; right: max(1rem, var(--safe-right)); bottom: calc(1rem + var(--safe-bottom)); display: grid; gap: .5rem; width: min(calc(100% - 2rem), 22rem); }
.dialog-toast-region { z-index: 2; }
.toast { padding: .8rem 1rem; border: 1px solid rgb(255 255 255 / 20%); border-radius: 12px; color: var(--white); background: #1c3e31; box-shadow: var(--shadow); font-size: .78rem; line-height: 1.45; animation: toast-in .25s ease both; }
.toast.is-error { background: #7c302b; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .welcome-block { padding: 1rem .3rem .3rem; }
  .content-grid { grid-template-columns: 1fr; }
  .side-column { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
  .page-shell { width: min(100% - 1.2rem, 1200px); padding-top: 1rem; }
  .topbar { min-height: calc(4rem + var(--safe-top)); padding-right: max(.8rem, var(--safe-right)); padding-left: max(.8rem, var(--safe-left)); }
  .connection-badge span:last-child { display: none; }
  .topbar-actions { gap: .55rem; }
  .welcome-block h1 { font-size: 2.15rem; }
  .calorie-card { min-height: 17rem; border-radius: 23px; }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .quick-action:last-child { grid-column: 1 / -1; }
  .side-column { grid-template-columns: 1fr; }
  .inventory-item { grid-template-columns: minmax(0, 1fr) auto; }
  .consume-button { grid-column: 1 / -1; width: 100%; }
  .mobile-nav { position: fixed; z-index: 40; right: max(.55rem, var(--safe-right)); bottom: calc(.55rem + var(--safe-bottom)); left: max(.55rem, var(--safe-left)); display: grid; grid-template-columns: repeat(4, 1fr); padding: .45rem; border: 1px solid rgb(255 255 255 / 28%); border-radius: 19px; color: #d6e2db; background: rgb(21 56 43 / 94%); box-shadow: 0 18px 42px rgb(13 38 28 / 30%); backdrop-filter: blur(18px); }
  .mobile-nav a, .mobile-nav button { display: grid; min-height: 2.75rem; justify-items: center; gap: .18rem; padding: .38rem .2rem; border: 0; border-radius: 12px; color: inherit; background: transparent; font-size: .68rem; font-weight: 700; cursor: pointer; }
  .mobile-nav span { font-size: 1rem; }
  .mobile-nav .is-active { color: var(--white); background: rgb(255 255 255 / 10%); }
  .form-grid, .nutrition-grid { grid-template-columns: 1fr; }
  .span-two { grid-column: auto; }
  .dialog { padding: max(.6rem, var(--safe-top)) max(.6rem, var(--safe-right)) max(.6rem, var(--safe-bottom)) max(.6rem, var(--safe-left)); align-items: end; }
  .dialog[open] { place-items: end center; }
  .dialog-card { max-height: 92dvh; border-radius: 23px 23px 16px 16px; }
  .receipt-line { grid-template-columns: auto minmax(0, 1fr) minmax(5.8rem, .7fr); grid-template-areas: "include name name" ". quantity unit" ". price price" ". reason reason"; }
  .review-toolbar { grid-template-columns: 1fr; }
  .admin-invitations-card { border-radius: 23px 23px 16px 16px; }
  body > .toast-region { bottom: calc(5.4rem + var(--safe-bottom)); }
  .dialog-toast-region { bottom: calc(1rem + var(--safe-bottom)); }
}

@media (max-width: 390px) {
  .brand > span:last-child { font-size: 1rem; }
  .brand-mark-small { width: 2.05rem; height: 2.05rem; }
  .topbar-invite-button { width: 2.75rem; padding: 0; }
  .topbar-invite-label { display: none; }
  .quick-actions { grid-template-columns: 1fr; }
  .quick-action:last-child { grid-column: auto; }
  .calorie-card-heading { gap: .4rem; }
  .coverage-ring { width: 3.75rem; height: 3.75rem; }
  .coverage-ring::before { width: 2.86rem; height: 2.86rem; }
  .calorie-number span { font-size: 3.1rem; }
  .calorie-actions { align-items: stretch; flex-direction: column; gap: .4rem; }
  .receipt-line { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "include name" ". quantity" ". unit" ". price" ". reason"; }
  .dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .invitation-create-form { grid-template-columns: 1fr; }
  .created-invitation-panel { align-items: stretch; flex-direction: column; }
  .auth-link-actions { align-items: stretch; flex-direction: column; }
  .auth-link-actions .button, .auth-link-actions .text-button { width: 100%; min-height: 2.75rem; }
}

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