:root {
  color-scheme: light;
  --ink: #293a30;
  --muted: #626c62;
  --green: #304a3d;
  --green-hover: #20382c;
  --paper: #f7f6f0;
  --surface: #fffef9;
  --line: #d8ddd2;
  --soft: #eaf0e5;
  --danger: #9b352d;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 18px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
img { max-width: 100%; height: auto; }
.stack > * { min-width: 0; }
body { margin: 0; min-height: 100dvh; font-size: 18px; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
button, a, input { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #ac7129; outline-offset: 4px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(28px, 5vw, 36px); line-height: 1.4; letter-spacing: -.025em; margin-bottom: 14px; }
h2 { font-size: 24px; line-height: 1.5; margin-bottom: 12px; }
h3 { font-size: 22px; margin-bottom: 8px; }
p { margin-bottom: 16px; overflow-wrap: anywhere; }
.helper, .muted { color: var(--muted); font-size: 18px; }
.helper:last-child { margin-bottom: 0; }
.skip-link { position: fixed; top: -100px; left: 12px; padding: 12px 24px; background: white; z-index: 20; }
.skip-link:focus { top: 12px; }
.app-header { max-width: 880px; margin: auto; padding: 24px 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 650; flex-shrink: 0; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 13px; background: var(--green); color: #fffef8; font-size: 25px; font-weight: 600; }
.brand-mark.large { width: 70px; height: 70px; font-size: 40px; border-radius: 21px; }
.person-switch { min-height: 48px; min-width: 88px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); max-width: 52%; overflow: hidden; }
.person-switch select { appearance: none; border: 0; border-radius: inherit; background: transparent; min-height: 48px; padding: 8px 18px; font-size: 20px; text-align: center; text-align-last: center; cursor: pointer; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.app-main { max-width: 760px; margin: auto; padding: 30px 28px calc(130px + env(safe-area-inset-bottom)); }
.page-heading { margin-bottom: 30px; }
.eyebrow { color: var(--muted); margin-bottom: 14px; font-size: 18px; }
.stack { display: grid; gap: 22px; }
.button { min-height: 60px; padding: 14px 24px; border-radius: 16px; border: 1px solid transparent; font-size: 20px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; text-align: center; }
.primary { background: var(--green); color: #fff; }
.primary:hover:enabled { background: var(--green-hover); }
.secondary { background: var(--surface); border-color: var(--line); color: var(--green); }
.secondary:hover:enabled { background: var(--soft); }
.button:disabled { color: #626c62; background: #e7e9e2; border-color: #d8ddd2; }
.field { display: grid; gap: 10px; }
.field label { font-size: 20px; font-weight: 500; }
input:not([type="hidden"]) { width: 100%; min-height: 56px; border: 1px solid #939f91; background: var(--surface); color: var(--ink); border-radius: 12px; padding: 12px 16px; font-size: 20px; }
input::placeholder { color: #707a70; }
.error-text { color: var(--danger); margin: 0; font-size: 18px; }
.error-text:empty { display: none; }
.error-box { color: var(--danger); padding: 16px; border: 1px solid #c17c70; background: #fff1e9; border-radius: 12px; }
.errorlist { margin: 0; padding: 0; list-style: none; }
.messages { padding: 16px 20px; margin-bottom: 24px; background: var(--soft); border: 1px solid #acbca5; border-radius: 14px; }
.messages p { margin: 0; }
.welcome-page { background: var(--paper); }
.welcome-main { min-height: 100dvh; display: grid; place-items: center; padding: 36px 24px; }
.login-card { width: 100%; max-width: 460px; }
.welcome-brand { text-align: center; }
.welcome-brand p { margin: 20px 0 28px; color: var(--muted); font-size: 18px; }
.login-card h1 { text-align: center; font-size: 36px; margin-bottom: 36px; }
.login-card .helper { text-align: center; }
.password-toggle { justify-self: end; min-height: 52px; border: 0; background: transparent; padding: 10px 8px; color: var(--green); text-decoration: underline; text-underline-offset: 5px; }
.profile-grid { display: grid; gap: 18px; }
.profile-card { width: 100%; min-height: 104px; padding: 22px; display: flex; align-items: center; gap: 22px; text-align: left; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; font-size: 24px; overflow-wrap: anywhere; }
.profile-card.selected { border: 2px solid var(--green); background: var(--soft); }
.person-initial { display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 50%; background: #ede7d9; flex-shrink: 0; }
.profile-card:nth-child(3n) .person-initial { background: #dce5d6; }
.profile-check { margin-left: auto; }
.home-actions { display: grid; gap: 16px; }
.hero-action { min-height: 76px; font-size: 24px; }
.availability-note { text-align: center; }
.recent-section { margin: 28px 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.section-heading h2 { margin: 0; }
.empty-state { text-align: center; padding: 40px 20px; margin-top: 20px; border: 1px dashed #b8c1b3; border-radius: 22px; background: #f1f3eb; }
.empty-symbol { font-size: 34px; color: #788b72; margin-bottom: 12px; }
.location-note { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 24px 0; border-top: 1px solid var(--line); }
.location-note > span { font-size: 30px; }
.location-note p { margin: 0; font-size: 20px; font-weight: 600; }
.text-action { min-height: 52px; display: flex; align-items: center; gap: 8px; margin-left: auto; }
.menu-card, .location-card { background: var(--surface); padding: 22px; border: 1px solid var(--line); border-radius: 18px; }
.menu-card { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 80px; font-size: 20px; }
.menu-card span span { margin-right: 12px; }
.location-card .helper { margin-top: 14px; }
.badge { padding: 5px 14px; border-radius: 99px; background: var(--soft); font-size: 18px; }
.back-link { display: inline-flex; align-items: center; min-height: 56px; margin-bottom: 18px; }
.logout-section { border-top: 1px solid var(--line); padding-top: 28px; margin-top: 48px; }
.logout-section .button { width: auto; min-width: 180px; }
.bottom-nav { position: fixed; z-index: 10; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 820px); display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0; background: var(--surface); padding: 10px 8px calc(10px + env(safe-area-inset-bottom)); }
.bottom-nav > a, .bottom-nav > .nav-unavailable { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 68px; border-radius: 12px; line-height: 1.4; padding: 5px 0; gap: 2px; font-size: 18px; }
.bottom-nav span span, .bottom-nav a span { font-size: 26px; }
.bottom-nav [aria-current="page"] { color: var(--green); background: var(--soft); font-weight: 650; }
.nav-unavailable { color: #747d72; }
.error-page { max-width: 520px; padding: 20px 0; }
@media (max-width: 420px) {
  .app-header { padding: 18px 18px; gap: 10px; }
  .brand { font-size: 20px; gap: 8px; }
  .brand-mark { width: 38px; height: 38px; }
  .person-switch { padding: 8px 12px; gap: 8px; }
  .app-main { padding: 24px 20px calc(124px + env(safe-area-inset-bottom)); }
  .welcome-main { padding: 28px 24px; }
}
@media (prefers-reduced-motion: no-preference) {
  .button, .profile-card, .menu-card { transition: background-color .15s ease, border-color .15s ease; }
}

textarea, select { font: inherit; width: 100%; min-width: 0; min-height: 56px; padding: 12px 16px; border: 1px solid #939f91; border-radius: 12px; background: var(--surface); color: var(--ink); }
textarea { resize: vertical; }
.section-space { margin-top: 28px; }
.box-heading { padding: 24px; border: 1px solid var(--line); border-radius: 22px; background: var(--soft); margin-bottom: 24px; }
.box-number { font-size: 56px; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; margin-bottom: 20px; }
.box-heading p:last-child { margin-bottom: 0; }
.box-card { display: grid; grid-template-columns: 88px minmax(0,1fr); gap: 18px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.box-card img, .card-placeholder { width: 88px; height: 100px; object-fit: cover; border-radius: 12px; }
.card-placeholder { background: var(--soft); display: grid; place-items: center; font-size: 38px; }
.box-card p { margin: 0; }
.photo-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin-bottom: 20px; }
.photo-grid > [data-empty-photos] { grid-column: 1/-1; }
.photo-card { min-width: 0; overflow-wrap: anywhere; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.photo-thumbnail { display: block; position: relative; width: 100%; padding: 0; border: 0; border-radius: 8px; background: var(--soft); overflow: hidden; color: var(--ink); min-height: 100px; }
.photo-thumbnail img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: contain; background: var(--soft); }
.photo-number { position: absolute; left: 7px; bottom: 7px; padding: 3px 7px; border-radius: 6px; background: rgb(28 42 35 / 68%); color: #fff; font-size: 13px; font-weight: 700; line-height: 1.25; }
.photo-card p { margin: 10px 0; }
.photo-card button { margin-top: 12px; }
.text-link { min-height: 56px; display: flex; align-items: center; text-decoration: underline; text-underline-offset: 4px; }
.upload-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.file-picker { position: relative; cursor: pointer; overflow: hidden; }
.file-picker input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-picker:focus-within { outline: 3px solid #ac7129; outline-offset: 4px; }
.panel { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; margin: 24px 0; }
summary { cursor: pointer; min-height: 56px; padding: 10px 0; font-size: 20px; }
.panel[open] summary { margin-bottom: 18px; }
details:not([open]) > :not(summary) { display: none; }
form textarea, form select { font: inherit; max-width: 100%; }
form input:not([type=hidden]):not([type=checkbox]), form textarea, form select { width: 100%; min-width: 0; min-height: 56px; }
form label { display: block; }
.note-card { padding: 20px; border-left: 4px solid #a5b29a; background: var(--surface); margin-bottom: 22px; }
.note-text { overflow-wrap: anywhere; margin-bottom: 12px; }
.note-card p { margin-bottom: 0; }
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px; margin-top: 28px; }
.pagination .button { width: auto; }
.saved-heading { text-align: center; padding: 30px 0; }
.success-mark { display: grid; place-items: center; width: 76px; height: 76px; border-radius: 50%; background: var(--soft); font-size: 44px; margin: 0 auto 26px; }
.text-action { width: auto; min-height: 44px; padding: 8px 12px; border: 0; background: transparent; color: var(--ink); font: inherit; text-decoration: underline; cursor: pointer; }
.ai-tools { margin-top: 20px; }
.confirmation-dialog { box-sizing: border-box; width: min(560px, calc(100% - 32px)); max-height: 85dvh; overflow: auto; padding: 24px; border: 1px solid #a5b29a; border-radius: 20px; background: var(--surface); color: var(--ink); }
.confirmation-dialog::backdrop { background: rgb(0 0 0 / 45%); }
.confirmation-dialog > button { margin-top: 16px; }
@media (max-width: 420px) {
  .photo-grid { gap: 10px; }
  .photo-card { padding: 8px; }
  .box-card { grid-template-columns: 64px minmax(0,1fr); gap: 12px; padding: 16px; }
  .box-card img, .card-placeholder { width: 64px; height: 82px; }
}
.bottom-nav { grid-template-columns: repeat(3, 1fr); }
.home-heading { margin-bottom: 20px; }
.home-heading h1 { font-size: 30px; }
.content-dialog { width: min(760px, calc(100% - 24px)); max-height: 90dvh; padding: 22px; overflow: auto; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--ink); }
.content-dialog::backdrop { background: rgb(0 0 0 / 45%); }
.dialog-close { display: block; position: sticky; top: 0; z-index: 1; background: var(--surface); margin-left: auto; min-height: 48px; }
.content-dialog h1 { font-size: 28px; }
.content-dialog textarea { min-height: 180px; }
.note-text, [data-note-text] { white-space: pre-wrap; }
.ai-photo-result { padding: 12px 0; border-bottom: 1px solid var(--line); }
.draft-card { overflow-wrap: anywhere; }
.packing-meta, .upload-heading, .ai-photo-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; }
.packing-meta p, .upload-heading p, .upload-heading h2, .ai-photo-meta p { margin: 0; }
.packing-meta { margin-bottom: 12px; }
.box-state { color: var(--muted); }
.packing-heading .box-number { margin-bottom: 0; }
.upload-heading { margin-bottom: 12px; }
.photo-grid[hidden] { display: none; }
.ai-photo-meta .text-action { margin-left: 0; flex-shrink: 0; }
.ai-photo-result { padding: 0; }
.ai-photo-result summary { font-size: 18px; overflow-wrap: anywhere; }
.ai-photo-result a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: underline; }
.ai-photo-retry { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 4px 8px; }
.ai-photo-retry .text-action { min-height: 36px; padding: 5px 8px; font-size: 14px; font-weight: 600; opacity: .78; }
[data-draft-status]:empty, [data-ai-state]:empty, [data-ai-connection]:empty { display: none; }
@media (max-width: 600px) {
  .app-header { padding: 12px 16px; gap: 10px; }
  .app-main { padding: 12px 16px calc(100px + env(safe-area-inset-bottom)); }
  .brand { font-size: 20px; gap: 8px; }
  .brand-mark { width: 36px; height: 36px; }
  .person-switch { max-width: calc(100% - 150px); padding: 8px 10px; }
  .back-link { min-height: 44px; margin-bottom: 12px; }
  .box-heading { padding: 16px; margin-bottom: 18px; border-radius: 16px; }
  .box-number { font-size: 44px; margin-bottom: 12px; }
  .section-space { margin-top: 20px; }
  .stack { gap: 16px; }
  .button { min-height: 56px; padding: 10px 12px; font-size: 18px; gap: 6px; }
  .hero-action { min-height: 60px; font-size: 22px; }
  .upload-actions { gap: 10px; }
  .upload-actions .button { white-space: nowrap; }
  .bottom-nav { padding-top: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  .bottom-nav > a { min-height: 56px; }
  .content-dialog { padding: 16px; }
  .page-heading { margin-bottom: 20px; }
  .panel { padding: 16px; margin: 18px 0; }
}

.photo-viewer { width: min(960px, 100%); height: min(92dvh, 900px); max-width: none; max-height: none; padding: 0; border: 0; border-radius: 16px; background: #111; color: white; overflow: hidden; }
.photo-viewer::backdrop { background: rgb(0 0 0 / 82%); }
.photo-viewer-toolbar { height: 58px; display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 7px 10px; background: #111; }
.photo-viewer-toolbar button { display: grid; place-items: center; width: 44px; height: 44px; margin: 0; padding: 0; border: 1px solid #666; border-radius: 50%; background: #252525; color: white; font-size: 28px; line-height: 1; }
.photo-viewer-stage { position: relative; height: calc(100% - 58px); overflow: auto; overscroll-behavior: contain; background: #111; }
.photo-viewer-stage [data-photo-image] { display: block; width: 100%; max-width: none; min-height: 100%; object-fit: contain; margin: auto; transition: width .12s ease; }
.photo-delete { position: absolute; z-index: 1; right: 14px; top: 14px; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: rgb(20 20 20 / 78%); color: white; font-size: 22px; box-shadow: 0 1px 8px rgb(0 0 0 / 45%); }
.add-photos { margin-top: 8px; }
[data-edit-section][open] > summary { margin-bottom: 12px; }
[data-ai-url][hidden] { display: none; }

.saved-result { color: inherit; text-decoration-thickness: 2px; text-underline-offset: .2em; display: inline-block; padding: 12px 0; }
.add-photo-tile { width: 100%; min-height: 120px; aspect-ratio: 1; border: 2px dashed #819086; border-radius: 16px; background: #f1f5f0; color: #304a3d; font: inherit; font-size: 48px; cursor: pointer; }
.photo-picker-dialog { width: min(440px, calc(100% - 32px)); border: 0; border-radius: 20px; padding: 24px; }
.photo-picker-dialog::backdrop { background: rgb(0 0 0 / .4); }
.photo-picker-dialog .upload-actions { clear: both; padding-top: 16px; }

.search-filters > summary { min-height: 48px; padding: 10px 0; }
.search-filters > .stack { padding-top: 12px; }
