:root {
  --ink: #171817;
  --ink-2: #212321;
  --ink-3: #2b2e2b;
  --paper: #f3f0e8;
  --paper-2: #e7e2d6;
  --muted: #a7aaa3;
  --line: rgba(243, 240, 232, 0.14);
  --line-dark: rgba(23, 24, 23, 0.14);
  --amber: #e8b84c;
  --amber-soft: #f8e7b6;
  --red: #ce6f62;
  --green: #83aa83;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.22);
  --radius: 18px;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--ink); color: var(--paper); font-family: var(--sans); font-size: 16px; line-height: 1.55; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; background: var(--amber); color: var(--ink); padding: .7rem 1rem; border-radius: 8px; font-weight: 800; }
.skip-link:focus { top: 1rem; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 270px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 1.4rem 1rem; border-right: 1px solid var(--line); background: #131413; display: flex; flex-direction: column; gap: 1.75rem; }
.brand { display: flex; align-items: center; gap: .8rem; padding: 0 .55rem; }
.brand-mark { color: var(--amber); font-size: .85rem; transform: rotate(45deg); }
.brand strong { display: block; font-family: var(--serif); font-size: 1.25rem; font-weight: 500; }
.brand small { display: block; color: var(--muted); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; }
.sidebar nav { display: grid; gap: .3rem; }
.nav-item { width: 100%; border: 0; border-radius: 10px; background: transparent; color: #b9bcb5; padding: .74rem .8rem; display: flex; gap: .8rem; align-items: center; text-align: left; font-size: .92rem; transition: background .18s ease, color .18s ease; }
.nav-item span { color: #656963; font-size: .68rem; letter-spacing: .12em; }
.nav-item:hover { background: rgba(255,255,255,.045); color: var(--paper); }
.nav-item.active { background: var(--paper); color: var(--ink); font-weight: 750; }
.nav-item.active span { color: #7c704e; }
.privacy-note { margin-top: auto; border: 1px solid rgba(232,184,76,.3); border-radius: 12px; padding: .9rem; background: rgba(232,184,76,.07); }
.privacy-note strong, .privacy-note span { display: block; }
.privacy-note strong { color: var(--amber); font-size: .78rem; margin-bottom: .25rem; }
.privacy-note span { color: #aeb0aa; font-size: .75rem; line-height: 1.45; }

.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 10; min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.15rem clamp(1rem, 4vw, 4.5rem); border-bottom: 1px solid var(--line); background: rgba(23,24,23,.88); backdrop-filter: blur(18px); }
.topbar h1 { margin: 0; font-family: var(--serif); font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 500; }
.eyebrow { margin: 0 0 .25rem; color: #858981; font-size: .7rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow.amber { color: #b98c2d; }
.top-actions, .button-row, .export-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; }
.save-state { color: #92968e; font-size: .78rem; }
main { max-width: 1260px; margin: 0 auto; padding: clamp(1.3rem, 3.5vw, 3.5rem) clamp(1rem, 4vw, 4.5rem) 5rem; }
.page { display: none; animation: reveal .22s ease; }
.page.active { display: block; }
@keyframes reveal { from { opacity: .35; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.button { border: 1px solid transparent; border-radius: 999px; padding: .7rem 1rem; min-height: 44px; font-size: .86rem; font-weight: 800; transition: transform .15s ease, background .15s ease, border-color .15s ease; }
.button:hover { transform: translateY(-1px); }
.button:focus-visible, .nav-item:focus-visible, .add-card:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(232,184,76,.5); outline-offset: 2px; }
.button.primary { background: var(--amber); color: #171817; }
.button.secondary { background: var(--paper); color: var(--ink); }
.button.ghost { color: var(--paper); border-color: var(--line); background: transparent; }
.button.ghost.light { color: var(--ink); border-color: var(--line-dark); }
.button.subtle { background: rgba(255,255,255,.07); color: var(--paper); }
.button.language-toggle { min-width: 64px; background: rgba(232,184,76,.12); border-color: rgba(232,184,76,.36); color: var(--amber); }
.button.language-toggle.light { background: rgba(153,107,16,.09); border-color: rgba(153,107,16,.3); color: #74500e; }
.button.danger { background: rgba(206,111,98,.14); color: #efb0a6; border-color: rgba(206,111,98,.28); }
.button.small { padding: .45rem .75rem; min-height: 36px; font-size: .75rem; }
.file-label input { position: absolute; opacity: 0; pointer-events: none; }

.overview-grid { display: grid; gap: 2.25rem; }
.intro-card { min-height: 400px; display: grid; grid-template-columns: minmax(0,1.3fr) minmax(250px,.7fr); overflow: hidden; border-radius: 24px; background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
.intro-copy { padding: clamp(2rem, 5vw, 4.5rem); align-self: center; position: relative; z-index: 1; }
.intro-copy h2 { max-width: 720px; margin: .4rem 0 1rem; font-family: var(--serif); font-size: clamp(2.4rem, 5vw, 4.9rem); line-height: .98; font-weight: 500; letter-spacing: -.04em; }
.intro-copy > p:not(.eyebrow):not(.review-line) { max-width: 610px; color: #555951; font-size: 1.03rem; }
.intro-copy .button-row { margin-top: 1.6rem; }
.review-line { margin-top: 1.7rem; color: #757970; font-size: .78rem; }
.cat-art { width: 100%; height: 100%; min-height: 400px; object-fit: contain; object-position: center bottom; align-self: end; filter: drop-shadow(0 18px 15px rgba(0,0,0,.18)); }
.section-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: end; margin-bottom: 1rem; }
.section-heading h2, .export-panel h2, .page-intro h2, .pet-hero h2 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: clamp(1.55rem, 3vw, 2.25rem); }
.count-pill, .priority-tag { border-radius: 999px; padding: .4rem .7rem; font-size: .7rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.count-pill { background: rgba(255,255,255,.07); color: #aeb1aa; }
.priority-tag { background: var(--amber); color: var(--ink); }
.readiness-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.readiness-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; background: var(--ink-2); display: grid; gap: .75rem; }
.readiness-card .status-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.status-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; font-size: .85rem; font-weight: 900; }
.status-icon.ready { background: rgba(131,170,131,.15); color: #a4c8a4; }
.status-icon.missing { background: rgba(232,184,76,.12); color: var(--amber); }
.readiness-card h3 { margin: 0; font-size: 1rem; }
.readiness-card p { margin: 0; color: #a8aba4; font-size: .84rem; }
.text-link { border: 0; background: transparent; color: var(--amber); padding: 0; font-weight: 800; font-size: .78rem; text-align: left; }
.export-panel { display: grid; grid-template-columns: minmax(0,1fr) minmax(280px,.75fr); gap: 1.5rem 3rem; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.4rem, 3vw, 2.2rem); }
.export-panel p { max-width: 680px; margin: .55rem 0 0; color: #a9aca5; }
.export-panel .small-note { grid-column: 1/-1; padding-top: .8rem; border-top: 1px solid var(--line); font-size: .76rem; }
.export-status { grid-column: 1/-1; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .7rem; }
.export-status > div { display: grid; grid-template-columns: minmax(130px,.55fr) minmax(150px,1fr) auto; align-items: center; gap: .65rem; padding: .75rem .85rem; border-radius: 11px; background: rgba(255,255,255,.035); font-size: .78rem; }
.export-status span { color: #92968e; }
.export-status em { justify-self: end; border-radius: 999px; padding: .25rem .55rem; font-style: normal; font-size: .68rem; font-weight: 800; }
.export-status .stale { color: var(--amber); background: rgba(232,184,76,.1); }
.export-status .current { color: #a4c8a4; background: rgba(131,170,131,.12); }

.page-intro, .pet-hero { display: flex; justify-content: space-between; align-items: start; gap: 2rem; margin-bottom: 1.5rem; }
.page-intro p, .pet-hero p { max-width: 720px; color: #a6aaa2; margin: .55rem 0 0; }
.form-stack { display: grid; gap: 1rem; }
.form-card, .entry-card, .pet-card { border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.15rem, 2.5vw, 1.7rem); background: var(--ink-2); }
.card-title { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.2rem; }
.card-title > div { display: flex; align-items: center; gap: .75rem; }
.card-title h3 { margin: 0; font-family: var(--serif); font-size: 1.3rem; font-weight: 500; }
.number { color: var(--amber); font-size: .68rem; font-weight: 850; letter-spacing: .14em; }
.required-note, .optional { color: #8f938b; font-size: .72rem; font-weight: 500; }
.field-grid { display: grid; gap: 1rem; }
.field-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
label { display: grid; gap: .42rem; color: #bec1ba; font-size: .78rem; font-weight: 750; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: .72rem .8rem; background: #171917; color: var(--paper); min-height: 44px; }
textarea { resize: vertical; min-height: 78px; }
input::placeholder, textarea::placeholder { color: #666b64; }
select { cursor: pointer; }
.check-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .8rem; }
.check-item { grid-template-columns: 22px 1fr; align-items: start; gap: .75rem; border: 1px solid var(--line); border-radius: 12px; padding: .95rem; background: rgba(255,255,255,.025); color: #c7cac3; font-size: .86rem; font-weight: 600; }
.check-item input { width: 20px; min-height: 20px; height: 20px; margin: .1rem 0 0; accent-color: var(--amber); }
.handoff-date { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.cloud-card { border-color: rgba(232,184,76,.3); }
.cloud-state { color: var(--amber); font-size: .72rem; font-weight: 800; }
.cloud-explainer { color: #a6aaa2; margin: 0 0 1rem; }
.share-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: .65rem; align-items: center; }
.share-row .button { white-space: nowrap; }
.cloud-card .small-note { color: #858981; font-size: .75rem; }

.pet-hero { border-bottom: 1px solid var(--line); padding-bottom: 1.5rem; }
.pet-status-control { min-width: 260px; }
.notice { margin: 1rem 0; border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; color: #afb2ab; background: rgba(255,255,255,.035); font-size: .84rem; }
.notice.yellow { border-color: rgba(232,184,76,.28); background: rgba(232,184,76,.07); color: #ddc88f; }
.notice.danger { border-color: rgba(206,111,98,.28); background: rgba(206,111,98,.07); color: #e4aba2; }
.pet-list, .entry-list { display: grid; gap: 1rem; }
.pet-card { position: relative; overflow: hidden; }
.pet-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--amber); }
.pet-card .field-grid { margin-top: 1rem; }
.care-confirm { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.add-card { width: 100%; min-height: 110px; margin-top: 1rem; border: 1px dashed rgba(232,184,76,.38); border-radius: var(--radius); color: var(--paper); background: rgba(232,184,76,.035); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .18rem; }
.add-card span { color: var(--amber); font-size: 1.4rem; }
.add-card small { color: #858981; }
.entry-card .entry-header { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.entry-card .entry-header strong { font-family: var(--serif); font-size: 1.15rem; font-weight: 500; }
.empty-state { margin-top: 1rem; min-height: 150px; border: 1px dashed var(--line); border-radius: var(--radius); display: grid; place-content: center; text-align: center; padding: 1rem; }
.empty-state strong, .empty-state span { display: block; }
.empty-state span { margin-top: .35rem; color: #7e827a; font-size: .82rem; max-width: 540px; }

.preview-shell { min-height: 100vh; background: var(--paper); color: var(--ink); }
.preview-toolbar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: .8rem clamp(1rem,4vw,3rem); background: #dbd6ca; border-bottom: 1px solid var(--line-dark); }
.preview-actions { display: flex; gap: .65rem; align-items: center; }
.preview-toolbar strong, .preview-toolbar span { display: block; }
.preview-toolbar span { color: #656960; font-size: .72rem; }
.survivor { max-width: 1050px; margin: 0 auto; padding: clamp(2rem,6vw,6rem) clamp(1rem,4vw,3rem); }
.survivor-cover { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(230px,.6fr); align-items: center; min-height: 420px; border-bottom: 1px solid var(--line-dark); }
.survivor-cover h1 { max-width: 760px; margin: .4rem 0 1rem; font-family: var(--serif); font-size: clamp(3rem,8vw,6.4rem); line-height: .9; font-weight: 500; letter-spacing: -.05em; }
.survivor-cover p { max-width: 650px; color: #64685f; }
.survivor-cover img { width: 100%; max-height: 430px; object-fit: contain; align-self: end; }
.survivor-meta { display: flex; flex-wrap: wrap; gap: .6rem 1.5rem; margin-top: 1.5rem; color: #6e7269; font-size: .78rem; }
.survivor-section { padding: 2.5rem 0; border-bottom: 1px solid var(--line-dark); }
.survivor-section h2 { font-family: var(--serif); font-size: clamp(1.7rem,4vw,2.6rem); font-weight: 500; margin: 0 0 1rem; }
.urgent-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1rem; }
.survivor-card { border: 1px solid var(--line-dark); border-radius: 14px; padding: 1.15rem; background: #faf8f2; }
.survivor-card.alert { border-color: #c49635; box-shadow: inset 0 3px 0 var(--amber); }
.survivor-card h3 { margin: 0 0 .8rem; font-size: 1rem; }
.survivor-card dl { display: grid; gap: .7rem; margin: 0; }
.survivor-card dt { color: #777b72; font-size: .68rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.survivor-card dd { margin: .15rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.survivor-card .missing { color: #966a16; font-weight: 800; }
.survivor-list { display: grid; gap: .8rem; }
.survivor-row { display: grid; grid-template-columns: minmax(160px,.4fr) minmax(0,1fr); gap: 1rem; padding: 1rem 0; border-top: 1px solid var(--line-dark); }
.survivor-row h3 { margin: 0; font-size: .98rem; }
.survivor-row p { margin: .15rem 0; color: #555a51; white-space: pre-wrap; overflow-wrap: anywhere; }
.legal-disclaimer { margin-top: 2rem; border: 1px solid var(--line-dark); border-radius: 12px; padding: 1rem; color: #64685f; font-size: .78rem; }

.toast { position: fixed; left: 50%; bottom: 1.5rem; z-index: 100; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--paper); color: var(--ink); border-radius: 999px; padding: .7rem 1rem; box-shadow: var(--shadow); font-size: .82rem; font-weight: 800; transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 92px 1fr; }
  .sidebar { padding-inline: .55rem; }
  .brand { justify-content: center; }
  .brand > div, .privacy-note { display: none; }
  .nav-item { justify-content: center; font-size: 0; padding: .85rem .3rem; }
  .nav-item span { font-size: .72rem; color: #a5a89f; }
  .nav-item.active span { color: var(--ink); }
  .intro-card { grid-template-columns: 1fr 280px; }
  .urgent-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app-shell { display: block; padding-bottom: 72px; }
  .sidebar { position: fixed; inset: auto 0 0 0; height: 68px; z-index: 30; border: 0; border-top: 1px solid var(--line); padding: .4rem .55rem; display: block; overflow-x: auto; }
  .brand, .privacy-note { display: none; }
  .sidebar nav { display: flex; min-width: max-content; gap: .25rem; }
  .nav-item { width: 62px; min-height: 54px; padding: .4rem; }
  .nav-item span { font-size: .72rem; }
  .topbar { min-height: 78px; }
  .save-state { display: none; }
  .intro-card, .export-panel, .survivor-cover { grid-template-columns: 1fr; }
  .intro-card { min-height: 0; }
  .intro-copy { padding-bottom: .5rem; }
  .intro-copy h2 { font-size: clamp(2.5rem,12vw,4.3rem); }
  .cat-art { min-height: 280px; max-height: 390px; }
  .readiness-grid { grid-template-columns: 1fr; }
  .export-panel .small-note { grid-column: 1; }
  .field-grid.two, .care-confirm { grid-template-columns: 1fr; }
  .check-grid, .export-status { grid-template-columns: 1fr; }
  .share-row { grid-template-columns: 1fr; }
  .export-status > div { grid-template-columns: 1fr auto; }
  .export-status > div span { grid-column: 1/-1; }
  .page-intro, .pet-hero { display: grid; }
  .pet-status-control { min-width: 0; width: 100%; }
  .survivor-cover img { max-height: 320px; }
  .survivor-row { grid-template-columns: 1fr; gap: .2rem; }
  .preview-toolbar { align-items: start; }
  .preview-actions { flex-wrap: wrap; justify-content: flex-end; }
}

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

@media print {
  body { background: white; color: black; }
  .preview-toolbar, .sidebar, .topbar, .toast { display: none !important; }
  .preview-shell { display: block !important; }
  .survivor { max-width: none; padding: 0; }
  .survivor-cover { min-height: 0; page-break-after: always; }
  .survivor-card, .survivor-row { break-inside: avoid; }
}
.auth-dialog {
  width: min(92vw, 30rem);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .35);
}
.auth-dialog::backdrop { background: rgba(15, 16, 15, .72); }
.auth-dialog form { display: grid; gap: 1rem; padding: 1.5rem; }
.auth-dialog h2, .auth-dialog p { margin: 0; }
.auth-dialog .button-row { justify-content: flex-end; }

