/* Proteina Farms — "green field, ripe mango" */
:root {
  --green: #1E6B3A; --green-2: #2F8A4C; --green-dark: #14502A; --green-soft: #DCEDE1; --green-mist: #E8F2E4;
  --mango: #F2A33A; --mango-dark: #C98318; --mango-soft: #FDEBD3; --mango-ink: #7A4705;
  --ink: #17251B; --muted: #4D5E51; --line: #E3EBE4; --paper: #FFFFFF; --bg: #F3F6EF;
  --red: #E0503A; --red-soft: #FBE1DC; --red-ink: #A3321F;
  --blue: #33408C; --blue-soft: #E6E9F5; --teal: #4FB5B0;
  --r-lg: 26px; --r: 20px; --r-sm: 14px;
  --shadow: 0 2px 12px rgba(23, 37, 27, .06);
  --shadow-lg: 0 18px 50px rgba(23, 37, 27, .28);
  --ease: cubic-bezier(.2, .9, .25, 1);
  --spring: cubic-bezier(.3, 1.45, .5, 1);
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --tab-h: 84px;
  font-size: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { font-family: 'Readex Pro', Tahoma, sans-serif; background: var(--bg); color: var(--ink); overscroll-behavior: none; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--green); }
svg { display: block; flex: 0 0 auto; }
.ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic--sm { width: 20px; height: 20px; }
.ic--lg { width: 28px; height: 28px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--mango); outline-offset: 2px; }

/* ---------------------------------------------------------------- shell */
.shell { min-height: 100dvh; }
.main { min-height: 100dvh; padding-bottom: calc(var(--tab-h) + var(--safe-b) + 16px); outline: none; }
.aside { display: none; }
.rail { display: none; }
.tabbar { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + var(--safe-b)); padding: 0 8px var(--safe-b); background: var(--paper); border-radius: 28px 28px 0 0; box-shadow: 0 -6px 24px rgba(23, 37, 27, .08); display: flex; align-items: center; justify-content: space-around; }
.tab { width: 68px; min-height: 56px; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: none; position: relative; }
.tab.is-on { color: var(--green); font-weight: 700; }
.tab.is-on::after { content: ''; position: absolute; top: 2px; width: 5px; height: 5px; border-radius: 50%; background: var(--mango); animation: pop .4s var(--spring); }
.tab--plus { width: 64px; height: 64px; margin-top: -34px; border-radius: 22px; background: var(--mango); color: var(--ink); box-shadow: 0 8px 20px rgba(242, 163, 58, .45); transition: transform .15s var(--spring); }
.tab--plus:active { transform: scale(.92) rotate(45deg); }
.tab__badge { position: absolute; top: 4px; left: 14px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

/* Screen transitions */
.screen { animation: screen-in .45s var(--ease) both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }
.stagger > * { animation: up .5s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: .03s } .stagger > *:nth-child(2) { animation-delay: .08s } .stagger > *:nth-child(3) { animation-delay: .13s }
.stagger > *:nth-child(4) { animation-delay: .18s } .stagger > *:nth-child(5) { animation-delay: .23s } .stagger > *:nth-child(6) { animation-delay: .28s }
.stagger > *:nth-child(7) { animation-delay: .32s } .stagger > *:nth-child(8) { animation-delay: .36s } .stagger > *:nth-child(n+9) { animation-delay: .4s }
@keyframes up { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }
@keyframes pop { 0% { transform: scale(.3) } 70% { transform: scale(1.2) } 100% { transform: scale(1) } }
@keyframes rise { from { transform: scaleY(0) } to { transform: scaleY(1) } }
@keyframes grow { from { transform: scaleX(0) } to { transform: scaleX(1) } }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 rgba(242, 163, 58, .7) } 70% { box-shadow: 0 0 0 12px rgba(242, 163, 58, 0) } 100% { box-shadow: 0 0 0 0 rgba(242, 163, 58, 0) } }
@keyframes sway { 0%, 100% { transform: rotate(-5deg) } 50% { transform: rotate(5deg) } }
@keyframes shimmer { 0% { background-position: -300px 0 } 100% { background-position: 300px 0 } }

/* ---------------------------------------------------------------- headers */
.hero { background: var(--green); color: #fff; border-radius: 0 0 32px 32px; padding: calc(var(--safe-t) + 22px) 20px 22px; display: flex; flex-direction: column; gap: 14px; position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; left: -60px; top: -50px; width: 200px; height: 200px; border-radius: 50%; border: 2px solid rgba(255,255,255,.1); box-shadow: 0 0 0 30px rgba(255,255,255,.04); }
.hero__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: relative; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand__logo { width: 40px; height: 40px; border-radius: 14px; background: var(--mango); color: var(--ink); display: flex; align-items: center; justify-content: center; animation: sway 4s ease-in-out infinite; transform-origin: 50% 90%; }
.hero h1 { margin: 0; font-size: 30px; line-height: 1.3; font-weight: 700; }
.hero p { margin: 2px 0 0; opacity: .85; }
.hero-actions { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; position: relative; }
.bell { position: relative; }
.bell .tab__badge { top: -4px; left: -4px; animation: pulse-ring 2s infinite; background: var(--mango); color: var(--ink); }

.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: calc(var(--safe-t) + 14px) 20px 12px; background: linear-gradient(var(--bg) 70%, rgba(243,246,239,0)); }
.bar h1 { margin: 0; font-size: 26px; font-weight: 700; flex: 1; min-width: 0; }
.bar p { margin: 0; color: var(--muted); font-size: 14px; }
.bar__titles { flex: 1; min-width: 0; }
.bar__titles h1 { flex: none; }

/* ---------------------------------------------------------------- buttons */
.btn { min-height: 52px; padding: 0 20px; border: 0; border-radius: 18px; font-size: 17px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; transition: transform .12s, background .2s, box-shadow .2s; white-space: nowrap; }
.btn:active { transform: scale(.96); }
.btn--green { background: var(--green); color: #fff; }
.btn--mango { background: var(--mango); color: var(--ink); box-shadow: 0 5px 0 var(--mango-dark); }
.btn--mango:active { box-shadow: 0 2px 0 var(--mango-dark); transform: translateY(3px); }
.btn--ghost { background: transparent; border: 2px solid var(--line); color: var(--ink); }
.btn--glass { background: rgba(255,255,255,.16); color: #fff; }
.btn--dark { background: var(--ink); color: #fff; }
.btn--danger { background: var(--red-soft); color: var(--red-ink); }
.btn--sm { min-height: 44px; padding: 0 14px; font-size: 15px; border-radius: 14px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn { width: 48px; height: 48px; flex: 0 0 48px; border: 0; border-radius: 16px; background: var(--paper); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; transition: transform .12s; text-decoration: none; position: relative; }
.icon-btn:active { transform: scale(.92); }
.icon-btn--glass { background: rgba(255,255,255,.14); color: #fff; }
.icon-btn--green { background: var(--green); color: #fff; }

/* ---------------------------------------------------------------- content */
.pad { padding: 4px 20px 8px; display: flex; flex-direction: column; gap: 12px; }
.h2 { margin: 8px 0 0; font-size: 18px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; }
.h2 a, .h2 button { font-size: 14px; font-weight: 600; color: var(--green); background: none; border: 0; text-decoration: none; }
.card { background: var(--paper); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); }
.row { background: var(--paper); border-radius: var(--r); padding: 12px 14px; display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); border: 0; width: 100%; text-align: inherit; box-shadow: var(--shadow); transition: transform .15s; }
.row:active { transform: scale(.98); }
.row__ic { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 16px; display: flex; align-items: center; justify-content: center; background: var(--green-soft); color: var(--green); }
.row__t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row__t b { font-size: 16px; font-weight: 600; }
.row__t small { font-size: 14px; color: var(--muted); }
.row__end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.chev { color: var(--muted); transform: scaleX(-1); }
.tone-red { background: var(--red-soft); color: var(--red-ink); }
.tone-orange { background: var(--mango-soft); color: #9A5A06; }
.tone-green { background: var(--green-soft); color: var(--green); }
.tone-blue { background: var(--blue-soft); color: var(--blue); }
.tone-dark { background: var(--ink); color: var(--mango); }
.tone-teal { background: #DDF1EF; color: #1F6E69; }
.empty { padding: 30px 10px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .ic { width: 44px; height: 44px; opacity: .5; }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile { background: var(--paper); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); border: 0; text-align: inherit; }
.tile small { font-size: 14px; color: var(--muted); }
.tile b { font-size: 28px; font-weight: 700; line-height: 1.2; }
.tile b span { font-size: 15px; font-weight: 600; }
.tile em { font-style: normal; font-size: 13px; font-weight: 600; color: var(--green); }
.stat { border-radius: 16px; padding: 10px; display: flex; flex-direction: column; gap: 1px; background: var(--bg); }
.stat small { font-size: 12px; opacity: .85; }
.stat b { font-size: 18px; font-weight: 700; }

.spark { display: flex; align-items: flex-end; gap: 6px; height: 64px; }
.spark span { width: 12px; border-radius: 6px; background: var(--green-soft); transform-origin: bottom; animation: rise .9s var(--spring) both; }
.spark span:last-child { background: var(--green); }
.gain-card { background: var(--paper); color: var(--ink); border-radius: 24px; padding: 16px 18px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; text-decoration: none; position: relative; }
.gain-card small { font-size: 14px; font-weight: 600; color: var(--muted); }
.gain-card b { display: block; font-size: 40px; line-height: 1.1; color: var(--green); }
.gain-card b span { font-size: 17px; font-weight: 600; }
.gain-card em { font-style: normal; font-size: 14px; font-weight: 600; color: var(--green); }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 4px; }
.chips::-webkit-scrollbar { display: none; }
.chip { text-decoration: none; flex: 0 0 auto; min-height: 44px; padding: 0 16px; border-radius: 22px; border: 0; background: var(--paper); color: var(--ink); font-size: 15px; font-weight: 600; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; transition: background .2s, color .2s, transform .12s; box-shadow: var(--shadow); }
.chip small { font-size: 12px; font-weight: 500; }
.chip.is-on { background: var(--ink); color: #fff; }
.chip:active { transform: scale(.95); }
.chip--tall { min-height: 56px; min-width: 78px; border-radius: 18px; }

.search { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 16px; border-radius: 18px; background: var(--paper); box-shadow: var(--shadow); }
.search input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 17px; min-width: 0; }

.badge { padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.bar-track { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: var(--green); transform-origin: right; animation: grow 1s var(--ease) both; }

/* herd cards */
.cow { background: var(--paper); border-radius: var(--r); padding: 12px 14px; display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: transform .15s, box-shadow .2s; }
.cow:active { transform: scale(.98); }
.cow.is-sel { box-shadow: 0 0 0 2.5px var(--green), var(--shadow); }
.cow__pic { position: relative; width: 56px; height: 56px; flex: 0 0 56px; border-radius: 18px; display: flex; align-items: center; justify-content: center; }
.cow__num { position: absolute; bottom: -6px; left: -6px; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 14px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; }
.cow__t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cow__top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.cow__top b { font-size: 17px; }
.cow__t small { font-size: 14px; color: var(--muted); }

.batch-card { background: var(--ink); color: #fff; border-radius: 22px; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; }
.batch-card small { font-size: 13px; opacity: .8; }
.batch-card b { display: block; font-size: 22px; }
.batch-card .mango { color: var(--mango); }

/* detail header */
.detail-hero { background: var(--green); color: #fff; border-radius: 0 0 32px 32px; padding: calc(var(--safe-t) + 16px) 20px 18px; display: flex; flex-direction: column; gap: 12px; }
.detail-hero h1 { margin: 0; font-size: 26px; }
.detail-hero p { margin: 0; font-size: 14px; opacity: .85; }
.detail-hero .big { font-size: 44px; font-weight: 700; line-height: 1; }
.curve path.line { stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: draw 1.6s var(--ease) forwards; }
.curve .area { opacity: 0; animation: fade .8s .8s forwards; }
.curve circle { animation: pop .5s 1.5s var(--spring) both; transform-box: fill-box; transform-origin: center; }
@keyframes draw { to { stroke-dashoffset: 0 } }
@keyframes fade { to { opacity: 1 } }
.timeline { list-style: none; margin: 0; padding: 0; background: var(--paper); border-radius: var(--r); box-shadow: var(--shadow); }
.timeline li { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); align-items: center; }
.timeline li:last-child { border-bottom: 0; }
.timeline .row__ic { width: 40px; height: 40px; flex-basis: 40px; border-radius: 14px; }

/* money */
.money-card { background: var(--ink); color: #fff; border-radius: 26px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.money-card .net { font-size: 36px; font-weight: 700; color: var(--mango); line-height: 1.15; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 110px; }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bars .pair { display: flex; gap: 3px; align-items: flex-end; height: 86px; }
.bars .pair span { width: 10px; border-radius: 5px; transform-origin: bottom; animation: rise .9s var(--spring) both; }
.bars .in { background: #7CC48F; } .bars .out { background: #F08A74; }
.bars small { font-size: 11px; opacity: .8; }
.seg { display: flex; gap: 6px; background: var(--line); border-radius: 16px; padding: 4px; }
.seg button { flex: 1; min-height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-weight: 600; transition: all .2s; }
.seg button.is-on { background: var(--paper); color: var(--ink); box-shadow: 0 2px 6px rgba(23,37,27,.12); }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 6px; }

/* stock */
.tank { width: 44px; height: 64px; flex: 0 0 44px; border-radius: 12px; background: var(--bg); display: flex; align-items: flex-end; overflow: hidden; }
.tank span { display: block; width: 100%; transform-origin: bottom; animation: rise 1.1s var(--ease) both; }
.blink { animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }

/* worker home */
.ring { transition: stroke-dasharray .6s var(--ease); }
.task { min-height: 68px; border-radius: 20px; border: 0; padding: 12px 14px; display: flex; align-items: center; gap: 12px; background: var(--paper); color: var(--ink); width: 100%; text-align: inherit; box-shadow: var(--shadow); transition: background .3s; }
.task.is-done { background: var(--green-mist); box-shadow: none; }
.task__box { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 12px; border: 2.5px solid #9DB3A3; display: flex; align-items: center; justify-content: center; transition: all .25s; }
.task.is-done .task__box { background: var(--green); border-color: var(--green); }
.task.is-done .task__box svg { animation: pop .35s var(--spring); }
.task__t { flex: 1; display: flex; flex-direction: column; }
.task__t b { font-size: 16px; font-weight: 600; transition: color .3s; }
.task.is-done .task__t b { color: var(--muted); text-decoration: line-through; }
.task__t small { font-size: 13px; color: var(--muted); }

/* ---------------------------------------------------------------- sheets & dialogs */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(10, 22, 14, .5); animation: fade-in .25s both; }
.scrim.is-out { animation: fade-out .25s both; }
@keyframes fade-in { from { opacity: 0 } to { opacity: 1 } }
@keyframes fade-out { from { opacity: 1 } to { opacity: 0 } }
.sheet { position: fixed; z-index: 61; left: 0; right: 0; bottom: 0; max-height: 92dvh; background: var(--bg); border-radius: 30px 30px 0 0; padding: 12px 20px calc(var(--safe-b) + 20px); display: flex; flex-direction: column; gap: 14px; overflow-y: auto; animation: sheet-in .45s var(--ease) both; box-shadow: var(--shadow-lg); }
.sheet.is-out { animation: sheet-out .3s ease-in both; }
@keyframes sheet-in { from { transform: translateY(100%) } to { transform: none } }
@keyframes sheet-out { from { transform: none } to { transform: translateY(100%) } }
.sheet__grip { align-self: center; width: 48px; height: 5px; border-radius: 3px; background: #C5D2C8; flex: 0 0 auto; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet__head h2 { margin: 0; font-size: 24px; }

.qa-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.qa { min-height: 108px; border-radius: 24px; border: 0; background: var(--paper); padding: 14px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; text-align: inherit; color: var(--ink); animation: tile-in .45s var(--spring) both; transition: transform .12s; box-shadow: var(--shadow); }
.qa:active { transform: scale(.95); }
.qa b { font-size: 17px; font-weight: 700; }
.qa__ic { width: 52px; height: 52px; border-radius: 18px; display: flex; align-items: center; justify-content: center; }
@keyframes tile-in { 0% { opacity: 0; transform: scale(.6) translateY(20px) } 70% { transform: scale(1.04) } 100% { opacity: 1; transform: none } }
.qa-voice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* forms */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label, .field > .label { font-size: 15px; font-weight: 600; }
.field .hint { font-size: 13px; color: var(--muted); }
.input { min-height: 54px; border-radius: 16px; border: 2px solid var(--line); background: var(--paper); padding: 0 14px; font-size: 18px; outline: none; width: 100%; transition: border-color .2s; }
.input:focus { border-color: var(--green); }
textarea.input { padding: 12px 14px; min-height: 90px; resize: vertical; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { min-height: 48px; padding: 0 16px; border-radius: 16px; border: 2px solid var(--line); background: var(--paper); font-size: 16px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; transition: all .18s; }
.opt.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }
.opt:active { transform: scale(.96); }
.opt--num { min-width: 56px; justify-content: center; padding: 0 10px; }
.opt--num.tone-ready { border-color: var(--mango); }
.opts--scroll { max-height: 200px; overflow-y: auto; padding: 2px; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 14px; direction: ltr; background: var(--paper); border-radius: 22px; padding: 14px; }
.stepper button { width: 60px; height: 60px; border-radius: 20px; border: 0; font-size: 32px; font-weight: 600; transition: transform .1s; }
.stepper button:active { transform: scale(.9); }
.stepper .minus { background: var(--line); color: var(--ink); }
.stepper .plus { background: var(--green); color: #fff; }
.stepper input { width: 140px; text-align: center; font-size: 44px; font-weight: 700; color: var(--green); border: 0; background: transparent; outline: none; }
.stepper__unit { text-align: center; font-weight: 600; margin-top: -8px; }
.photo-pick { display: flex; gap: 10px; align-items: center; }
.photo-pick img { width: 72px; height: 72px; object-fit: cover; border-radius: 14px; }
.form-err { color: var(--red-ink); background: var(--red-soft); padding: 10px 14px; border-radius: 14px; font-weight: 600; }
.calc { background: var(--green-mist); color: var(--green-dark); border-radius: 16px; padding: 12px 14px; font-weight: 600; }

/* success burst */
.done { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 30px 10px; text-align: center; }
.done__ring { width: 120px; height: 120px; border-radius: 50%; background: var(--green); display: flex; align-items: center; justify-content: center; animation: pop .45s var(--spring) both; position: relative; }
.done__ring::after { content: ''; position: absolute; inset: -8px; border-radius: 50%; border: 3px solid var(--green); opacity: 0; animation: ring-out 1s .2s ease-out both; }
@keyframes ring-out { from { transform: scale(.8); opacity: .8 } to { transform: scale(1.4); opacity: 0 } }
.done__ring path { stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw-check .5s .25s ease-out forwards; }
@keyframes draw-check { to { stroke-dashoffset: 0 } }
.done h2 { margin: 0; font-size: 26px; }
.done p { margin: 0; color: var(--muted); font-size: 17px; }

/* anything you can tap to edit */
[data-edit][role=button] { cursor: pointer; transition: background .15s, transform .12s; }
.timeline li[data-edit]:active, .row[data-edit]:active { background: var(--green-mist); transform: scale(.99); }
@media (hover: hover) { .timeline li[data-edit]:hover { background: var(--bg); } }

/* offline / waiting-to-send strip */
.netbar { position: fixed; z-index: 80; top: calc(var(--safe-t) + 8px); left: 0; right: 0; margin: 0 auto; width: fit-content; max-width: calc(100% - 24px); padding: 8px 16px; border-radius: 20px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow-lg); white-space: nowrap; animation: toast-in .4s var(--spring) both; }
.netbar.is-off { background: var(--mango); color: var(--ink); }
.netbar .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: blink 1.4s infinite; }

/* toast */
.toasts { position: fixed; z-index: 90; top: calc(var(--safe-t) + 12px); left: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; align-items: center; }
.toast { pointer-events: auto; max-width: 480px; width: 100%; padding: 14px 16px; border-radius: 18px; background: var(--green); color: #fff; font-weight: 600; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; animation: toast-in .4s var(--spring) both; }
.toast.is-err { background: var(--red); }
.toast.is-out { animation: toast-out .3s ease-in both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-20px) scale(.95) } to { opacity: 1; transform: none } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-20px) } }

/* ---------------------------------------------------------------- voice + scan overlay */
.full { position: fixed; inset: 0; z-index: 70; background: var(--ink); color: #fff; display: flex; flex-direction: column; animation: fade-in .3s both; padding: calc(var(--safe-t) + 14px) 20px calc(var(--safe-b) + 24px); gap: 18px; overflow-y: auto; }
.full.is-out { animation: fade-out .25s both; }
.full__bar { display: flex; align-items: center; gap: 12px; }
.full__bar h1 { margin: 0; font-size: 24px; flex: 1; }
.examples { display: flex; flex-direction: column; gap: 8px; }
.examples p { margin: 0; padding: 12px 14px; border-radius: 16px; background: rgba(255,255,255,.08); font-size: 16px; }
.mic-wrap { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.mic { position: relative; width: 120px; height: 120px; border-radius: 50%; border: 0; background: var(--mango); color: var(--ink); display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 30px rgba(242,163,58,.4); }
.mic .ic { width: 48px; height: 48px; stroke-width: 2.2; }
.mic.is-live::before, .mic.is-live::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--mango); z-index: -1; animation: ripple 1.8s ease-out infinite; }
.mic.is-live::after { animation-delay: .6s; }
@keyframes ripple { from { transform: scale(1); opacity: .5 } to { transform: scale(2.1); opacity: 0 } }
.waves { display: flex; align-items: center; justify-content: center; gap: 8px; height: 70px; }
.waves span { width: 10px; height: 60px; border-radius: 5px; background: var(--mango); animation: wave .9s ease-in-out infinite; }
.waves span:nth-child(2) { animation-delay: .15s } .waves span:nth-child(3) { animation-delay: .3s } .waves span:nth-child(4) { animation-delay: .45s } .waves span:nth-child(5) { animation-delay: .6s }
@keyframes wave { 0%, 100% { transform: scaleY(.3) } 50% { transform: scaleY(1) } }
.transcript { font-size: 22px; font-weight: 600; text-align: center; line-height: 1.6; min-height: 70px; }
.understood { background: var(--bg); color: var(--ink); border-radius: 26px; padding: 18px; display: flex; flex-direction: column; gap: 12px; animation: up .5s var(--ease) both; }
.scan-frame { position: relative; border-radius: 24px; overflow: hidden; background: #22302A; min-height: 300px; display: flex; align-items: center; justify-content: center; }
.scan-frame img { width: 100%; max-height: 52dvh; object-fit: contain; display: block; }
.scan-line { position: absolute; left: 6%; right: 6%; height: 4px; border-radius: 2px; background: var(--mango); box-shadow: 0 0 18px 4px rgba(242,163,58,.7); animation: scan 2s ease-in-out infinite; }
@keyframes scan { 0% { top: 6% } 50% { top: 92% } 100% { top: 6% } }
.progress { height: 8px; border-radius: 4px; background: rgba(255,255,255,.15); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--mango); transition: width .3s; }

/* ---------------------------------------------------------------- login */
.login { min-height: 100dvh; background: var(--green); color: #fff; display: flex; flex-direction: column; }
.login__top { padding: calc(var(--safe-t) + 48px) 24px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.login__logo { width: 76px; height: 76px; border-radius: 26px; background: var(--mango); color: var(--ink); display: flex; align-items: center; justify-content: center; animation: sway 4s ease-in-out infinite; transform-origin: 50% 90%; }
.login h1 { margin: 4px 0 0; font-size: 28px; }
.people { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; padding: 0 16px; }
.person { width: 100px; min-height: 120px; border-radius: 22px; border: 2px solid rgba(255,255,255,.25); background: transparent; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; transition: all .25s; }
.person.is-on { border-color: var(--mango); background: rgba(255,255,255,.14); transform: translateY(-3px); }
.person__av { width: 48px; height: 48px; border-radius: 50%; background: #fff; color: var(--ink); font-size: 22px; font-weight: 700; display: flex; align-items: center; justify-content: center; transition: background .25s; }
.person.is-on .person__av { background: var(--mango); }
.person small { font-size: 12px; opacity: .8; }
.pinpad { flex: 1; margin-top: 22px; background: var(--bg); color: var(--ink); border-radius: 32px 32px 0 0; padding: 22px 28px calc(var(--safe-b) + 24px); display: flex; flex-direction: column; align-items: center; gap: 16px; }
.dots { display: flex; gap: 16px; direction: ltr; }
.dots span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #9DB3A3; transition: all .2s; }
.dots span.is-on { background: var(--green); border-color: var(--green); animation: pop .3s var(--spring); }
.dots.is-shake { animation: shake .4s; }
@keyframes shake { 0%, 100% { transform: none } 20%, 60% { transform: translateX(-10px) } 40%, 80% { transform: translateX(10px) } }
.keys { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: 100%; max-width: 360px; direction: ltr; }
.key { min-height: 64px; border-radius: 20px; border: 0; background: var(--paper); color: var(--ink); font-size: 28px; font-weight: 600; box-shadow: 0 3px 0 #DCE5DD; transition: transform .1s; }
.key:active { transform: scale(.94); }
.key--flat { background: transparent; box-shadow: none; color: var(--muted); }

/* ---------------------------------------------------------------- map frame */
.map-frame { position: fixed; inset: 0 0 calc(var(--tab-h) + var(--safe-b) - 28px) 0; border: 0; width: 100%; height: calc(100dvh - var(--tab-h) - var(--safe-b) + 28px); background: #14201A; z-index: 1; }
.is-map .main { padding: 0; }

/* ---------------------------------------------------------------- Galaxy Fold open / tablets */
@media (min-width: 700px) {
  :root { --tab-h: 0px; font-size: 17px; }
  .shell { display: grid; grid-template-columns: 96px minmax(0, 1fr); }
  .shell.has-aside { grid-template-columns: 96px minmax(0, 1fr) minmax(0, 1fr); }
  .tabbar { display: none; }
  .rail { display: flex; position: sticky; top: 0; height: 100dvh; flex-direction: column; align-items: center; gap: 6px; padding: calc(var(--safe-t) + 16px) 8px 16px; background: var(--paper); box-shadow: -4px 0 20px rgba(23,37,27,.05); z-index: 30; }
  .rail .tab { width: 80px; min-height: 64px; border-radius: 18px; }
  .rail .tab.is-on { background: var(--green-mist); }
  .rail .tab.is-on::after { display: none; }
  .rail .tab--plus { margin: 4px 0 8px; height: 64px; width: 64px; }
  .rail .brand__logo { margin-bottom: 12px; }
  .rail__spacer { flex: 1; }
  .main { padding-bottom: 24px; min-width: 0; height: 100dvh; overflow-y: auto; }
  .aside { display: block; height: 100dvh; overflow-y: auto; border-inline-start: 1px solid var(--line); background: var(--bg); min-width: 0; }
  .shell:not(.has-aside) .aside { display: none; }
  .aside .detail-hero { border-radius: 0 0 32px 32px; }
  .hero { border-radius: 0 0 36px 36px; }
  .home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
  .sheet { left: 50%; right: auto; width: min(560px, 92vw); bottom: auto; top: 50%; transform: translate(-50%, -50%); border-radius: 30px; max-height: 88dvh; animation: dialog-in .4s var(--spring) both; }
  .sheet.is-out { animation: dialog-out .25s ease-in both; }
  .sheet__grip { display: none; }
  .qa-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .map-frame { position: static; height: 100dvh; inset: auto; }
  .is-map .main { height: 100dvh; overflow: hidden; }
  .full { left: 50%; right: auto; width: min(560px, 100vw); transform: translateX(-50%); }
  .toasts { left: auto; right: 24px; width: 420px; }
}
@keyframes dialog-in { from { opacity: 0; transform: translate(-50%, -46%) scale(.94) } to { opacity: 1; transform: translate(-50%, -50%) } }
@keyframes dialog-out { to { opacity: 0; transform: translate(-50%, -48%) scale(.96) } }
@media (min-width: 1100px) { .shell.has-aside { grid-template-columns: 96px minmax(0, 1.1fr) minmax(0, .9fr); } }

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