:root{
  /* type */
  --text-xs:clamp(0.75rem,0.7rem + 0.25vw,0.875rem);
  --text-sm:clamp(0.875rem,0.8rem + 0.35vw,1rem);
  --text-base:clamp(1rem,0.95rem + 0.25vw,1.125rem);
  --text-lg:clamp(1.125rem,1rem + 0.75vw,1.5rem);
  --text-xl:clamp(1.5rem,1.2rem + 1.25vw,2.25rem);
  --font-display:'Zodiak','Georgia',serif;
  --font-body:'Satoshi','Inter',system-ui,sans-serif;
  /* 4px spacing */
  --space-1:.25rem;--space-2:.5rem;--space-3:.75rem;--space-4:1rem;--space-5:1.25rem;--space-6:1.5rem;--space-8:2rem;--space-10:2.5rem;--space-12:3rem;--space-16:4rem;--space-20:5rem;
  /* pastel purple palette (solid fills, no gradients) */
  --color-bg:oklch(0.975 0.012 305);
  --color-surface:oklch(0.997 0.004 305);
  --color-surface-offset:oklch(0.945 0.03 303);
  --color-surface-offset-2:oklch(0.91 0.045 302);
  --color-pastel:oklch(0.87 0.065 300);
  --color-divider:oklch(0.3 0.05 300 / 0.1);
  --color-border:oklch(0.3 0.05 300 / 0.18);
  --color-text:oklch(0.26 0.045 300);
  --color-text-muted:oklch(0.47 0.04 300);
  --color-text-faint:oklch(0.62 0.03 300);
  --color-text-inverse:oklch(0.98 0.01 305);
  --color-primary:oklch(0.43 0.135 300);
  --color-primary-hover:oklch(0.37 0.13 300);
  --color-primary-active:oklch(0.32 0.12 300);
  --color-primary-highlight:oklch(0.92 0.045 300);
  --color-yes:oklch(0.4 0.09 155);   --color-yes-bg:oklch(0.93 0.05 155);
  --color-no:oklch(0.44 0.14 15);    --color-no-bg:oklch(0.94 0.04 15);
  --radius-sm:.375rem;--radius-md:.625rem;--radius-lg:.875rem;--radius-xl:1.25rem;--radius-full:9999px;
  --shadow-sm:0 1px 2px oklch(0.3 0.08 300 / .07);
  --shadow-md:0 6px 18px oklch(0.3 0.08 300 / .12);
  --shadow-lg:0 14px 36px oklch(0.3 0.08 300 / .18);
  --ease:cubic-bezier(.16,1,.3,1);
  --shell:34rem;
}
html,body{background:var(--color-surface-offset-2)}
#app{position:relative;max-width:var(--shell);min-height:100dvh;margin-inline:auto;background:var(--color-bg);box-shadow:var(--shadow-lg)}
.skip{position:absolute;left:-999px;top:0;background:var(--color-primary);color:var(--color-text-inverse);padding:var(--space-2) var(--space-4);z-index:100;border-radius:0 0 var(--radius-md) 0}
.skip:focus{left:0}
.icon{width:1.25rem;height:1.25rem;stroke-width:2;flex:none}
button .icon,a .icon{pointer-events:none}

/* banner */
.banner{margin:0;padding:var(--space-2) var(--space-4);background:var(--color-surface-offset-2);color:var(--color-text);font-size:var(--text-xs);line-height:1.4;display:flex;gap:var(--space-2);align-items:flex-start}
.banner b{font-weight:700}

/* page */
main{padding:var(--space-5) var(--space-4) calc(6.5rem + env(safe-area-inset-bottom))}
.page-head{margin-bottom:var(--space-4)}
.page-head h1{font-family:var(--font-display);font-weight:600;font-size:var(--text-xl);letter-spacing:-.01em;color:var(--color-text)}
.page-head p{color:var(--color-text-muted);font-size:var(--text-sm);margin-top:var(--space-1)}
h2.sec{font-size:var(--text-sm);font-weight:700;letter-spacing:.02em;text-transform:uppercase;color:var(--color-text-muted);margin:var(--space-6) 0 var(--space-2)}
.muted{color:var(--color-text-muted)}
.small{font-size:var(--text-xs)}

/* inputs */
.field{display:flex;flex-direction:column;gap:var(--space-1);margin-bottom:var(--space-4)}
.field>label,.label{font-size:var(--text-sm);font-weight:700;color:var(--color-text)}
.field .hint{font-size:var(--text-xs);color:var(--color-text-muted)}
.input,select.input,textarea.input{width:100%;min-height:3rem;padding:0 var(--space-4);background:var(--color-surface);border:1px solid var(--color-border);border-radius:var(--radius-lg);font-size:var(--text-base);line-height:1.3}
textarea.input{padding:var(--space-3) var(--space-4);min-height:6rem;resize:vertical}
.input::placeholder{color:var(--color-text-faint)}
.input:focus{outline:none;border-color:var(--color-primary);box-shadow:0 0 0 3px var(--color-primary-highlight)}
.search{position:relative}
.search .icon{position:absolute;left:var(--space-4);top:50%;translate:0 -50%;color:var(--color-text-muted)}
.search .input{padding-left:var(--space-12);min-height:3.25rem;border-radius:var(--radius-xl)}
.row-inputs{display:grid;grid-template-columns:1fr 1fr;gap:var(--space-3)}

/* buttons */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:var(--space-2);min-height:3rem;padding:0 var(--space-5);border-radius:var(--radius-lg);font-weight:700;font-size:var(--text-sm);background:var(--color-primary);color:var(--color-text-inverse);text-align:center}
.btn:hover{background:var(--color-primary-hover)}
.btn:active{background:var(--color-primary-active);transform:scale(.98)}
.btn.block{width:100%}
.btn.secondary{background:var(--color-surface-offset-2);color:var(--color-text)}
.btn.secondary:hover{background:var(--color-pastel)}
.btn.ghost{background:transparent;color:var(--color-primary);border:1px solid var(--color-border)}
.btn.ghost:hover{background:var(--color-primary-highlight)}
.btn.danger{background:var(--color-no-bg);color:var(--color-no)}
.btn.sm{min-height:2.75rem;padding:0 var(--space-4)}
.btn[disabled]{opacity:.45;pointer-events:none}
.icon-btn{display:inline-flex;align-items:center;justify-content:center;width:2.75rem;height:2.75rem;border-radius:var(--radius-full);color:var(--color-text)}
.icon-btn:hover{background:var(--color-surface-offset-2)}

/* chips & segments */
.chips{display:flex;gap:var(--space-2);overflow-x:auto;padding:var(--space-1) 0 var(--space-2);scrollbar-width:none;-webkit-overflow-scrolling:touch}
.chips::-webkit-scrollbar{display:none}
.chips.wrap{flex-wrap:wrap;overflow:visible}
.chip{flex:none;display:inline-flex;align-items:center;gap:var(--space-2);min-height:2.75rem;padding:0 var(--space-4);border-radius:var(--radius-full);background:var(--color-surface);border:1px solid var(--color-border);font-size:var(--text-sm);font-weight:600;color:var(--color-text);white-space:nowrap}
.chip:hover{background:var(--color-surface-offset)}
.chip[aria-pressed='true'],.chip[aria-selected='true']{background:var(--color-primary);border-color:var(--color-primary);color:var(--color-text-inverse)}
.chip .n{font-size:var(--text-xs);opacity:.8;font-variant-numeric:tabular-nums}
.seg{display:grid;grid-auto-flow:column;grid-auto-columns:1fr;gap:var(--space-1);padding:var(--space-1);background:var(--color-surface-offset);border-radius:var(--radius-lg)}
.seg button{min-height:2.75rem;padding:0 var(--space-2);border-radius:var(--radius-md);font-size:var(--text-sm);font-weight:600;color:var(--color-text-muted);line-height:1.2}
.seg button:hover{color:var(--color-text)}
.seg button[aria-pressed='true']{background:var(--color-surface);color:var(--color-text);box-shadow:var(--shadow-sm);font-weight:700}
.seg button[aria-pressed='true'].yes{background:var(--color-yes-bg);color:var(--color-yes)}
.seg button[aria-pressed='true'].no{background:var(--color-no-bg);color:var(--color-no)}
.seg button[aria-pressed='true'].pastel{background:var(--color-pastel);color:var(--color-text)}
.ctl{margin-bottom:var(--space-4)}
.ctl .label{display:block;margin-bottom:var(--space-2)}

/* tags */
.tags{display:flex;flex-wrap:wrap;gap:var(--space-1) var(--space-2);margin-top:var(--space-2)}
.tag{display:inline-flex;align-items:center;gap:var(--space-1);padding:2px var(--space-2);border-radius:var(--radius-full);font-size:var(--text-xs);font-weight:600;background:var(--color-surface-offset);color:var(--color-text-muted);line-height:1.5}
.tag.yes{background:var(--color-yes-bg);color:var(--color-yes)}
.tag.no{background:var(--color-no-bg);color:var(--color-no)}
.tag.pastel{background:var(--color-pastel);color:var(--color-text)}
.tag .icon{width:.8rem;height:.8rem}

/* lists */
.list{display:flex;flex-direction:column;gap:var(--space-2)}
.item{display:flex;gap:var(--space-3);align-items:center;width:100%;text-align:left;padding:var(--space-3) var(--space-4);background:var(--color-surface);border:1px solid var(--color-divider);border-radius:var(--radius-lg);box-shadow:var(--shadow-sm);min-height:3.5rem}
button.item:hover{border-color:var(--color-border);background:oklch(from var(--color-surface) l c h)}
button.item:active{background:var(--color-surface-offset)}
.item .grow{flex:1;min-width:0}
.item .t{font-weight:700;font-size:var(--text-base);line-height:1.25;overflow-wrap:anywhere}
.item .s{font-size:var(--text-sm);color:var(--color-text-muted);margin-top:2px;overflow-wrap:anywhere}
.item .chev{color:var(--color-text-faint)}
.item.static{cursor:default}
.item .side{flex:none}
.group-label{font-size:var(--text-xs);font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--color-text-muted);margin:var(--space-4) 0 var(--space-2)}

/* summary strip */
.strip{display:flex;flex-wrap:wrap;gap:var(--space-2) var(--space-4);padding:var(--space-3) var(--space-4);background:var(--color-surface-offset);border-radius:var(--radius-lg);font-size:var(--text-sm);margin:var(--space-3) 0 var(--space-2)}
.strip b{font-variant-numeric:tabular-nums}

/* cards */
.card{background:var(--color-surface);border:1px solid var(--color-divider);border-radius:var(--radius-xl);padding:var(--space-4);box-shadow:var(--shadow-sm);margin-bottom:var(--space-4)}
.where{background:var(--color-surface-offset);border-radius:var(--radius-xl);padding:var(--space-4);margin-bottom:var(--space-5)}
.where .k{font-size:var(--text-xs);font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--color-text-muted)}
.where .big{font-family:var(--font-display);font-size:var(--text-lg);font-weight:600;line-height:1.25;margin-top:var(--space-1);overflow-wrap:anywhere}
.where .sub{font-size:var(--text-sm);color:var(--color-text-muted);margin-top:var(--space-1)}

/* empty */
.empty{display:flex;flex-direction:column;align-items:center;text-align:center;padding:var(--space-12) var(--space-6) var(--space-8);color:var(--color-text-muted)}
.empty>.icon{width:2.5rem;height:2.5rem;color:var(--color-text-faint);margin-bottom:var(--space-4)}
.empty h3{font-size:var(--text-lg);color:var(--color-text);margin-bottom:var(--space-2);font-weight:700}
.empty p{max-width:34ch;margin-bottom:var(--space-5);font-size:var(--text-sm)}
.empty .actions{display:flex;flex-direction:column;gap:var(--space-2);width:100%;max-width:18rem}

/* tab bar */
.tabbar{position:fixed;bottom:0;left:50%;translate:-50% 0;width:100%;max-width:var(--shell);z-index:10;display:grid;grid-template-columns:1fr 1fr auto 1fr 1fr;align-items:end;padding:var(--space-2) var(--space-2) calc(var(--space-2) + env(safe-area-inset-bottom));background:var(--color-surface);border-top:1px solid var(--color-divider)}
.tab{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;min-height:3.25rem;font-size:var(--text-xs);font-weight:600;color:var(--color-text-muted);border-radius:var(--radius-md)}
.tab[aria-current='page']{color:var(--color-primary)}
.tab[aria-current='page'] .icon{stroke-width:2.5}
.fab{display:flex;align-items:center;justify-content:center;width:3.5rem;height:3.5rem;margin:-1.5rem var(--space-3) var(--space-1);border-radius:var(--radius-full);background:var(--color-primary);color:var(--color-text-inverse);box-shadow:var(--shadow-md);border:4px solid var(--color-surface)}
.fab:hover{background:var(--color-primary-hover)}
.fab:active{transform:scale(.95)}
.fab .icon{width:1.5rem;height:1.5rem;stroke-width:2.5}

/* sheets */
.sheet{position:fixed;inset:0;z-index:20;display:flex;flex-direction:column;width:100%;max-width:var(--shell);margin-inline:auto;background:var(--color-bg);animation:sheetIn 280ms var(--ease) both}
@keyframes sheetIn{from{opacity:0;transform:translateY(24px)}to{opacity:1;transform:none}}
.sheet-head{display:flex;align-items:center;gap:var(--space-2);padding:var(--space-2) var(--space-2) var(--space-2) var(--space-2);background:var(--color-bg);border-bottom:1px solid var(--color-divider);min-height:3.5rem}
.sheet-head h2{flex:1;font-weight:700;overflow-wrap:anywhere;line-height:1.2}
.sheet-body{flex:1;overflow-y:auto;padding:var(--space-4) var(--space-4) var(--space-8);-webkit-overflow-scrolling:touch;overscroll-behavior:contain}
.sheet-foot{padding:var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom));background:var(--color-bg);border-top:1px solid var(--color-divider);display:flex;gap:var(--space-2)}
.saved{font-size:var(--text-xs);font-weight:700;color:var(--color-yes);opacity:0;transition:opacity 200ms}
.saved.on{opacity:1}
.menu{position:absolute;right:var(--space-3);top:3.25rem;z-index:5;min-width:12rem;background:var(--color-surface);border:1px solid var(--color-border);border-radius:var(--radius-lg);box-shadow:var(--shadow-md);padding:var(--space-1)}
.menu button{display:flex;width:100%;gap:var(--space-2);align-items:center;min-height:2.75rem;padding:0 var(--space-3);border-radius:var(--radius-md);font-weight:600;font-size:var(--text-sm);text-align:left}
.menu button:hover{background:var(--color-surface-offset)}
.menu button.danger{color:var(--color-no)}

/* flash */
.flash{width:max-content;position:fixed;left:50%;bottom:calc(5.75rem + env(safe-area-inset-bottom));translate:-50% 0;z-index:40;max-width:calc(100% - 2rem);padding:var(--space-2) var(--space-4);background:var(--color-text);color:var(--color-text-inverse);border-radius:var(--radius-full);font-size:var(--text-sm);font-weight:600;box-shadow:var(--shadow-md);animation:flashIn 220ms var(--ease) both}
@keyframes flashIn{from{opacity:0;translate:-50% 8px}to{opacity:1;translate:-50% 0}}

/* scanner */
.scan{position:relative;background:#000;border-radius:var(--radius-xl);overflow:hidden;aspect-ratio:3/4;max-height:60dvh;width:100%}
.scan video{width:100%;height:100%;object-fit:cover}
.scan .shade{position:absolute;inset:0;pointer-events:none;box-shadow:inset 0 0 0 9999px rgb(0 0 0 / .45)}
.scan .roi{position:absolute;left:8%;right:8%;top:38%;height:24%;border:3px solid oklch(0.9 0.08 300);border-radius:var(--radius-lg);background:transparent;box-shadow:0 0 0 9999px rgb(0 0 0 / .5)}
.scan .shade{display:none}
.scan .cap{position:absolute;left:0;right:0;bottom:var(--space-3);text-align:center;color:#fff;font-size:var(--text-sm);font-weight:600;padding:0 var(--space-3);text-shadow:0 1px 3px rgb(0 0 0 / .7)}

/* skeleton */
@keyframes shimmer{0%{background-position:-200% 0}100%{background-position:200% 0}}
.skeleton{background:linear-gradient(90deg,var(--color-surface-offset) 25%,var(--color-surface-offset-2) 50%,var(--color-surface-offset) 75%);background-size:200% 100%;animation:shimmer 1.5s ease-in-out infinite;border-radius:var(--radius-lg)}

/* misc */
.notice{display:flex;gap:var(--space-3);padding:var(--space-3) var(--space-4);background:var(--color-surface-offset);border-radius:var(--radius-lg);font-size:var(--text-sm);margin-bottom:var(--space-4)}
.notice .icon{color:var(--color-primary);margin-top:2px}
.kv{display:flex;justify-content:space-between;gap:var(--space-4);padding:var(--space-2) 0;border-bottom:1px solid var(--color-divider);font-size:var(--text-sm)}
.kv:last-child{border:0}
.stepper{display:inline-flex;align-items:center;gap:var(--space-2)}
.stepper button{width:2.75rem;height:2.75rem;border-radius:var(--radius-full);background:var(--color-surface-offset-2);font-size:var(--text-lg);font-weight:700}
.stepper output{min-width:2rem;text-align:center;font-weight:700;font-variant-numeric:tabular-nums}
.pgrid{display:grid;grid-template-columns:1fr auto;gap:var(--space-1) var(--space-3);align-items:center}
.ph{display:flex;justify-content:space-between;gap:var(--space-3);padding:var(--space-3) 0;border-bottom:1px solid var(--color-divider)}
.ph:last-child{border:0}
.ph .a{min-width:0}
.ph .b{font-weight:700;overflow-wrap:anywhere}
.ph .c{font-size:var(--text-sm);color:var(--color-text-muted);overflow-wrap:anywhere}
.ph .p{font-weight:700;text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
@media (min-width:600px){#app{margin-block:0}}

/* sheet animation only on creation; dialogs */
.sheet{animation:none}
.sheet.enter{animation:sheetIn 280ms var(--ease) both}
.scrim{position:fixed;inset:0;z-index:30;display:flex;align-items:flex-end;justify-content:center;background:oklch(0.2 0.05 300 / .45)}
.dialog{width:100%;max-width:var(--shell);background:var(--color-surface);border-radius:var(--radius-xl) var(--radius-xl) 0 0;padding:var(--space-5) var(--space-4) calc(var(--space-5) + env(safe-area-inset-bottom));box-shadow:var(--shadow-lg)}
.sheet-head{position:relative}
.sheet-head .saved{margin-right:var(--space-1)}
[hidden]{display:none !important}
.sheet-head h2{font-size:var(--text-base);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.stickyf{position:sticky;top:calc(var(--space-4) * -1);z-index:3;background:var(--color-bg);margin:0 calc(var(--space-4) * -1) var(--space-2);padding:var(--space-2) var(--space-4) 0;border-bottom:1px solid var(--color-divider)}
