:root {
  --bg: #fff8f6;
  --paper: #fffdfc;
  --ink: #32262a;
  --muted: #89797d;
  --line: #eadedd;
  --rose: #b95f73;
  --rose-dark: #914457;
  --blush: #fae9eb;
  --mauve: #f2e8f2;
  --shadow: 0 12px 32px rgba(70, 35, 43, .08);
  --r: 18px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { position: fixed; inset: 0; color: var(--ink); background: var(--bg); font-family: ui-rounded, "Avenir Next", Avenir, system-ui, sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #e8a9b7; outline-offset: 2px; }

/* Landing — browser only */
.landing-page { position: fixed; inset: 0; display: flex; flex-direction: column; overflow: hidden; padding: calc(22px + env(safe-area-inset-top)) 24px calc(22px + env(safe-area-inset-bottom)); color: #fff; background: #21191d; }
.landing-nav { display: flex; align-items: center; justify-content: space-between; }
.landing-logo { font: 500 22px/1 Georgia, serif; }
.landing-logo em { color: #ec91a6; font-weight: 400; }
.landing-logo span { font: 16px system-ui; }
.beta-chip { padding: 6px 9px; border: 1px solid rgba(255,255,255,.14); border-radius: 99px; color: #f3b2bf; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.landing-main { position: relative; width: 100%; max-width: 470px; margin: auto 0; }
.landing-kicker { margin: 0 0 16px; color: #e896aa; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.landing-main h1 { max-width: 370px; margin: 0; font: 500 clamp(46px, 13vw, 68px)/.96 Georgia, serif; letter-spacing: -.055em; }
.landing-main h1 em { color: #e896aa; font-weight: 400; }
.landing-copy { max-width: 350px; margin: 20px 0 26px; color: #ddcdd1; font-size: 16px; line-height: 1.55; }
.landing-cta { width: 100%; min-height: 55px; border: 0; border-radius: 100px; background: #db7891; box-shadow: 0 14px 30px rgba(0,0,0,.25); color: #fff; font-weight: 800; }
.landing-cta span { margin-left: 7px; font-size: 20px; }
.install-link { display: block; margin: 14px auto 0; border: 0; background: transparent; color: #eab1bd; font-size: 13px; font-weight: 700; }
.landing-private { margin: 13px 0 0; color: #a8999d; text-align: center; font-size: 11px; }
.landing-note { display: flex; gap: 8px; align-items: center; padding: 13px 14px; border: 1px solid rgba(255,255,255,.1); border-radius: 15px; background: rgba(255,255,255,.06); color: #e4d7da; font-size: 12px; }
.landing-note b { color: #f2b3c2; }
.landing-nails { position: absolute; top: -92px; right: 2px; display: flex; gap: 7px; transform: rotate(12deg); pointer-events: none; }
.landing-nails i { display: block; width: 17px; height: 52px; border-radius: 17px 17px 5px 5px; background: linear-gradient(#efadba, #c95f7d); box-shadow: inset 0 -7px #a84e68; }
.landing-nails i:nth-child(2) { height: 39px; margin-top: 10px; background: linear-gradient(#e7c3d4, #b96d9f); }
.landing-nails i:nth-child(3) { height: 61px; margin-top: -5px; background: linear-gradient(#f3c0ae, #d17078); }
.landing-nails i:nth-child(4) { height: 44px; margin-top: 9px; }
.landing-nails i:nth-child(5) { height: 33px; margin-top: 17px; background: linear-gradient(#e7c3d4, #b96d9f); }

/* App shell: this is the only scroll container */
.app-shell { position: fixed; inset: 0; width: min(680px, 100%); height: 100dvh; margin: auto; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; padding: calc(24px + env(safe-area-inset-top)) 20px calc(112px + env(safe-area-inset-bottom)); background: var(--bg); }
.topbar, .toolbar, .section-heading, .notes-heading, .sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand-home { display: block; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; }
.eyebrow, .entry-kind, .detail-hero p, .field-label { margin: 0; color: var(--rose); font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.topbar h1 { margin: 7px 0 0; font: 500 29px/1 Georgia, serif; }
.topbar h1 em { color: var(--rose); font-weight: 400; }
.topbar h1 span { font: 21px system-ui; }
.icon-button { width: 44px; height: 44px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); color: var(--ink); font-size: 20px; }
.intro { position: relative; overflow: hidden; margin: 28px 0 20px; padding: 22px 20px; border: 1px solid #f0dfe1; border-radius: 25px; background: radial-gradient(circle at 92% 10%, #f5dce6 0 9%, transparent 10%), linear-gradient(125deg,#fff7f5,#fdf0f3); box-shadow: 0 10px 26px rgba(185,95,115,.05); }
.intro h2 { position: relative; max-width: 280px; margin: 0; font: 500 clamp(35px, 9vw, 52px)/.98 Georgia, serif; letter-spacing: -.04em; }
.intro p { position: relative; margin: 9px 0 0; color: var(--muted); font-size: 15px; }
.nail-confetti { position: absolute; top: 16px; right: 18px; display: flex; gap: 6px; align-items: flex-end; transform: rotate(-7deg); }
.nail-confetti i { display: block; width: 10px; height: 22px; border-radius: 10px 10px 4px 4px; background: #d47b8e; box-shadow: inset 0 -4px #b95f73; }
.nail-confetti i:nth-child(2) { height: 15px; background: #edb7a8; }
.nail-confetti i:nth-child(3) { height: 26px; background: #c88bad; }
.nail-confetti i:nth-child(4) { height: 18px; }
.nail-confetti i:nth-child(5) { height: 13px; background: #edb7a8; }
.toolbar { align-items: stretch; }
.search { display: flex; flex: 1; align-items: center; gap: 8px; min-width: 0; padding: 0 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.search span { color: var(--muted); font-size: 21px; }
.search input { width: 100%; min-width: 0; padding: 13px 0; border: 0; outline: 0; background: transparent; color: var(--ink); }
.toolbar select { width: 73px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); }
.summary { display: flex; gap: 8px; margin: 16px 0 24px; }
.summary span { padding: 7px 11px; border-radius: 100px; background: #f6eeec; color: var(--muted); font-size: 13px; }
.summary b { color: var(--ink); }
.section-heading { margin: 0 4px 10px; }
.section-heading h3, .data-tools h3 { margin: 0; font: 600 15px Georgia, serif; }
.section-heading span, .muted { color: var(--muted); font-size: 12px; }
.entry-list { display: grid; gap: 10px; }
.entry-card { display: flex; align-items: center; gap: 13px; width: 100%; padding: 15px; border: 1px solid var(--line); border-left: 3px solid #f1c6d0; border-radius: var(--r); background: var(--paper); box-shadow: var(--shadow); color: inherit; text-align: left; }
.entry-icon { display: grid; width: 42px; height: 42px; flex: 0 0 auto; place-items: center; border: 1px solid #f1d9dc; border-radius: 14px; background: var(--blush); font-size: 19px; }
.entry-icon.toes { border-color: #e4d3e7; background: var(--mauve); }
.entry-main { min-width: 0; flex: 1; }
.entry-main h4 { margin: 3px 0 1px; overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.entry-main p, .entry-main small { margin: 0; overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.entry-main small { font-size: 11px; }
.chevron { color: #c5b5b4; font-size: 30px; }
.no-results { padding: 30px; color: var(--muted); text-align: center; }
.empty-state { padding: 58px 25px; text-align: center; }
.empty-state > div { font-size: 46px; }
.empty-state h3 { margin: 10px; font: 500 24px Georgia, serif; }
.empty-state p { max-width: 290px; margin: 0 auto 18px; color: var(--muted); line-height: 1.55; }
.fab, .button.primary { border: 0; background: linear-gradient(135deg,var(--rose),var(--rose-dark)); box-shadow: 0 10px 26px rgba(145,68,87,.25); color: #fff; font-weight: 700; }
.fab { position: fixed; z-index: 20; bottom: max(18px, env(safe-area-inset-bottom)); left: 50%; width: min(400px, calc(100vw - 40px)); height: 54px; transform: translateX(-50%); border-radius: 100px; font-size: 15px; }
#appPage[hidden] ~ .fab { display: none; }
.fab span { font-size: 21px; vertical-align: -1px; }
.button.primary { padding: 13px 20px; border-radius: 100px; }

/* Sheets and dialogs */
dialog { color: var(--ink); }
.sheet { position: fixed; right: 0; bottom: 0; left: 0; width: min(680px, 100%); max-height: min(92dvh, 760px); margin: 0 auto; padding: 0; overflow-y: auto; overscroll-behavior: contain; border: 0; border-radius: 24px 24px 0 0; background: var(--paper); box-shadow: 0 -20px 60px rgba(37,20,22,.18); -webkit-overflow-scrolling: touch; }
.sheet::backdrop, .confirm::backdrop, .install-dialog::backdrop { background: rgba(33,25,29,.62); }
.sheet-head { position: sticky; top: 0; z-index: 2; height: 65px; padding: 0 18px; border-bottom: 1px solid var(--line); background: var(--paper); }
.sheet-head h2 { margin: 0; font: 500 19px Georgia, serif; }
.text-button { padding: 8px 2px; border: 0; background: transparent; color: var(--muted); }
.text-button.strong { color: var(--rose); font-weight: 800; }
.sheet-body { max-width: 620px; margin: auto; padding: 20px; }
.type-toggle { display: flex; gap: 8px; margin: 0 0 21px; padding: 0; border: 0; }
.type-toggle legend { width: 100%; margin-bottom: 7px; font-size: 12px; font-weight: 700; }
.type-toggle label { flex: 1; }
.type-toggle input { position: absolute; opacity: 0; }
.type-toggle span { display: block; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--bg); text-align: center; font-weight: 700; }
.type-toggle input:checked + span { border-color: var(--rose); background: var(--blush); color: var(--rose); }
.field { display: block; margin: 0 0 15px; }
.field > span { display: block; margin: 0 0 6px; font-size: 12px; font-weight: 750; }
.field select, .note-edit textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); outline-color: var(--rose); }
.field select { height: 47px; padding: 0 12px; }
.sizing { margin: 25px 0; }
.sizing-head { display: flex; justify-content: space-between; margin-bottom: 8px; }
.sizing-head span:last-child { color: var(--muted); font-size: 11px; }
.size-group { margin: 10px 0; padding: 12px; border: 1px solid var(--line); border-radius: 15px; background: #fffdfc; }
.size-group legend { padding: 0 4px; color: var(--muted); font-size: 11px; font-weight: 800; }
.size-group > div { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
.size-group label { min-width: 0; color: var(--muted); text-align: center; font-size: 10px; }
.size-input { display: block; width: 100%; margin-top: 5px; padding: 9px 2px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--ink); outline-color: var(--rose); text-align: center; font-weight: 800; }
.notes-editor { padding-top: 18px; border-top: 1px solid var(--line); }
.notes-heading p { max-width: 250px; margin: 4px 0 10px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.small-button, .secondary-button, .danger-button { padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); font-size: 12px; font-weight: 750; white-space: nowrap; }
.note-edit { position: relative; margin: 8px 0; }
.note-edit textarea { display: block; min-height: 88px; padding: 12px 38px 12px 12px; resize: vertical; line-height: 1.45; }
.delete-note { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border: 0; border-radius: 50%; background: #f1e5e4; color: var(--rose); font-size: 20px; line-height: 1; }
.form-error { min-height: 18px; color: #b42333; font-size: 13px; font-weight: 600; }
.detail-hero { display: flex; gap: 14px; align-items: center; padding: 8px 0 21px; }
.detail-hero > span { display: grid; width: 56px; height: 56px; flex: 0 0 auto; place-items: center; border-radius: 17px; background: var(--blush); font-size: 30px; }
.detail-hero h2 { margin: 3px 0; font: 500 27px Georgia, serif; }
.detail-hero h3 { margin: 0; color: var(--muted); font-size: 14px; font-weight: 500; }
.detail-section { margin: 18px 0; }
.detail-section > h3 { margin: 0 0 9px; font: 600 15px Georgia, serif; }
.note-card { margin: 7px 0; padding: 12px; border: 1px solid #f0dfdc; border-radius: 13px; background: #fff5f3; font-size: 14px; line-height: 1.5; }
.number-card { margin: 8px 0; padding: 11px; border: 1px solid var(--line); border-radius: 14px; }
.number-card h4 { margin: 0 0 9px; color: var(--muted); font-size: 11px; }
.number-card > div { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.number-card span { min-width: 0; text-align: center; }
.number-card small { display: block; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.number-card b { font: 500 21px Georgia, serif; }
.detail-actions { padding: 18px 0; }
.detail-actions .secondary-button { border-color: #efc2c8; color: #ad3749; }
.settings-copy, .data-tools p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.settings-section, .data-tools { margin: 25px 0; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 12px 2px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; }
.setting-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.toggle-row i { color: var(--rose); font-size: 11px; font-style: normal; font-weight: 700; }
.mini-danger { padding: 6px 8px; border: 0; border-radius: 8px; background: #feeef0; color: #b42333; font-size: 11px; }
.data-tools > div { display: flex; flex-wrap: wrap; gap: 8px; }
.import-label { display: inline-block; }
.confirm { width: min(360px, calc(100vw - 40px)); margin: auto; padding: 0; border: 0; border-radius: 21px; box-shadow: var(--shadow); }
.confirm > div { padding: 25px; text-align: center; }
.confirm-icon { font-size: 34px; }
.confirm h2 { margin: 9px; font: 500 23px Georgia, serif; }
.confirm p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.confirm-actions { display: flex; gap: 8px; margin-top: 20px; }
.confirm-actions > * { flex: 1; }
.danger-button { border-color: #b42333; background: #b42333; color: #fff; }
.install-dialog { width: min(360px, calc(100vw - 36px)); margin: auto; padding: 0; border: 0; border-radius: 22px; box-shadow: 0 20px 55px rgba(27,11,15,.27); }
.install-dialog > div { position: relative; padding: 28px; text-align: center; }
.install-close { position: absolute; top: 10px; right: 12px; border: 0; background: transparent; color: var(--muted); font-size: 25px; }
.install-icon { font-size: 35px; }
.install-dialog h2 { margin: 9px 0; font: 500 23px Georgia, serif; }
.install-dialog p { margin: 0 0 20px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.install-dialog .landing-cta { font-size: 14px; }

@media (min-width: 700px) {
  .landing-page { padding-right: max(32px, calc((100vw - 680px) / 2)); padding-left: max(32px, calc((100vw - 680px) / 2)); }
  .app-shell { padding-right: 28px; padding-left: 28px; }
}
