/* Eidhak Inventory v12 — premium animated redesign.
   Same class names as v11: app.js logic is untouched. Motion lives here and in fx.js. */
:root {
  --forest: #03463A;      /* brand dark green */
  --forest-2: #0A5A4A;
  --forest-deep: #022C25;
  --leaf: #00722F;        /* brand green */
  --leaf-soft: #E2F1E6;
  --mint: #9ED29B;
  --gold: #E3C76A;
  --paper: #F2F5F2;       /* page ground */
  --paper-2: #F7F9F7;
  --surface: #FFFFFF;
  --ink: #12201A;
  --muted: #56655E;
  --line: #E0E7E2;
  --line-strong: #C6D1CA;
  --berbere: #A93A1F;     /* losses, low stock, overdue */
  --berbere-soft: #F9E8E2;
  --kraft: #8A5A1E;       /* coffee, pending */
  --kraft-soft: #F6EDDD;
  --radius: 18px;
  --radius-sm: 11px;
  --shadow-sm: 0 1px 2px rgba(3, 70, 58, .05), 0 6px 18px -10px rgba(3, 70, 58, .14);
  --shadow: 0 2px 4px rgba(3, 70, 58, .05), 0 18px 40px -18px rgba(3, 70, 58, .28);
  --shadow-lg: 0 40px 90px -30px rgba(2, 30, 24, .55);
  --font: 'Manrope', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --rail: 252px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --spring: cubic-bezier(.2, .9, .25, 1.12);
  --out: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 500 15px/1.5 var(--font); font-feature-settings: 'tnum' 1; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.015em; }
h1 { font-size: 30px; font-weight: 800; letter-spacing: -.025em; }
h2 { font-size: 17px; font-weight: 800; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
a { color: var(--leaf); }
.muted { color: var(--muted); }
.num { text-align: right; white-space: nowrap; }
.neg { color: var(--berbere); }
.pos { color: var(--leaf); }
.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2.5px solid var(--leaf); outline-offset: 2px; }
::selection { background: var(--mint); color: var(--forest-deep); }

/* ---------- motion primitives ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { 0% { transform: scale(.8); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes grow-x { from { transform: scaleX(0); } }
@keyframes grow-y { from { transform: scaleY(0); } }
@keyframes drift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(-40px, 30px, 0) scale(1.15); } }
@keyframes drift-2 { from { transform: translate3d(0, 0, 0) rotate(0); } to { transform: translate3d(50px, -40px, 0) rotate(25deg); } }
@keyframes sheen { from { transform: translateX(-120%) skewX(-18deg); } to { transform: translateX(320%) skewX(-18deg); } }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 var(--ring, rgba(0, 114, 47, .45)); } 70%, 100% { box-shadow: 0 0 0 9px rgba(0, 0, 0, 0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* ---------- buttons & inputs ---------- */
.btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: 700 14px/1 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none; box-shadow: 0 1px 1px rgba(3, 70, 58, .04); transition: transform .18s var(--out), box-shadow .18s var(--out), border-color .18s, background-color .18s; }
.btn:hover { border-color: var(--forest); transform: translateY(-1px); box-shadow: 0 8px 18px -10px rgba(3, 70, 58, .35); }
.btn:active { transform: translateY(0) scale(.975); box-shadow: none; }
.btn-primary { background: var(--forest); border-color: var(--forest); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 10px 20px -12px rgba(3, 70, 58, .8); }
.btn-primary:hover { background: var(--forest-2); border-color: var(--forest-2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 14px 26px -12px rgba(3, 70, 58, .85); }
.btn-primary::after { content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 40%; background: rgba(255, 255, 255, .16); transform: translateX(-120%) skewX(-18deg); pointer-events: none; }
.btn-primary:hover::after { animation: sheen .8s var(--out); }
.btn-danger { color: var(--berbere); }
.btn-danger:hover { border-color: var(--berbere); box-shadow: 0 8px 18px -10px rgba(169, 58, 31, .4); }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn[disabled] { opacity: .6; cursor: progress; transform: none; }
.btn .i { transition: transform .25s var(--spring); }
.btn:hover .i { transform: rotate(90deg); }
.btn:hover .i:has(use[href="#i-out"]) { transform: translateX(2px); }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; transition: background-color .15s, color .15s, transform .2s var(--spring); }
.icon-btn:hover { background: var(--paper); color: var(--ink); transform: scale(1.08); }
.icon-btn:active { transform: scale(.94); }
.link-btn { text-decoration: none; border: 0; background: none; padding: 0; color: var(--leaf); font: inherit; font-weight: 700; cursor: pointer; background-image: linear-gradient(currentColor, currentColor); background-size: 0 1.5px; background-position: 0 100%; background-repeat: no-repeat; transition: background-size .25s var(--out); }
.link-btn:hover { background-size: 100% 1.5px; }
.fx-ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .18; transform: scale(0); pointer-events: none; animation: ripple .55s var(--out) forwards; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 700; color: var(--muted); transition: color .15s; }
.field:focus-within > span { color: var(--leaf); }
input, select, textarea { font: 600 15px/1.3 var(--font); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 10px 12px; min-height: 44px; width: 100%; font-feature-settings: 'tnum' 1; transition: border-color .15s, box-shadow .2s var(--out), background-color .15s; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--leaf); box-shadow: 0 0 0 4px rgba(0, 114, 47, .14); }
input[readonly] { background: var(--paper); color: var(--muted); }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--muted); cursor: pointer; }
.check input { width: 18px; min-height: 18px; height: 18px; accent-color: var(--forest); }
.form-error { color: var(--berbere); background: var(--berbere-soft); padding: 10px 13px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; animation: shake .4s; }
.hint { font-size: 13px; color: var(--muted); }

/* ---------- sign-in ---------- */
.gate { position: relative; overflow: hidden; isolation: isolate; min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 440px); align-items: center; gap: 56px; padding: 40px clamp(20px, 7vw, 110px); background: radial-gradient(120% 120% at 0% 0%, #0B5A49 0%, var(--forest) 42%, var(--forest-deep) 100%); }
.gate-art { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.gate-art span { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; }
.gate-art span:nth-child(1) { width: 520px; height: 520px; left: -140px; top: -160px; background: #1C8A5C; animation: drift 16s ease-in-out infinite alternate; }
.gate-art span:nth-child(2) { width: 420px; height: 420px; right: -120px; bottom: -140px; background: #7A5A1E; opacity: .4; animation: drift-2 20s ease-in-out infinite alternate; }
.gate-art span:nth-child(3) { width: 300px; height: 300px; left: 38%; top: 55%; background: #9ED29B; opacity: .22; animation: drift 24s ease-in-out infinite alternate-reverse; }
.gate-art svg { position: absolute; fill: none; stroke: rgba(255, 255, 255, .13); stroke-width: 1.2; }
.gate-art svg:nth-of-type(1) { width: 380px; height: 380px; left: -40px; bottom: -70px; animation: drift-2 26s ease-in-out infinite alternate; }
.gate-art svg:nth-of-type(2) { width: 220px; height: 220px; right: 34%; top: 6%; animation: drift 22s ease-in-out infinite alternate; }
.gate-copy { color: #fff; max-width: 560px; animation: rise .8s var(--out) both; }
.gate-copy .eyebrow { display: inline-flex; align-items: center; gap: 9px; font-size: 12.5px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--mint); margin-bottom: 18px; }
.gate-copy .eyebrow i { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); --ring: rgba(158, 210, 155, .6); animation: pulse-ring 2s infinite; }
.gate-copy h2 { font-size: clamp(34px, 4.6vw, 58px); font-weight: 800; line-height: 1.04; letter-spacing: -.035em; }
.gate-copy h2 em { font-style: normal; color: var(--mint); }
.gate-copy p { margin-top: 18px; font-size: 17px; line-height: 1.55; color: #CFE3DA; max-width: 460px; }
.gate-copy ul { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 12px; }
.gate-copy li { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 600; color: #E8F3EE; animation: rise .7s var(--out) both; }
.gate-copy li:nth-child(1) { animation-delay: .25s; } .gate-copy li:nth-child(2) { animation-delay: .35s; } .gate-copy li:nth-child(3) { animation-delay: .45s; }
.gate-copy li .i { width: 30px; height: 30px; padding: 6px; border-radius: 10px; background: rgba(255, 255, 255, .1); color: var(--mint); border: 1px solid rgba(255, 255, 255, .12); }
.gate-card { width: 100%; max-width: 440px; justify-self: end; background: var(--surface); border-radius: 26px; padding: 34px 30px 30px; box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, .12); animation: rise .8s var(--spring) .12s both; }
.gate-card form { display: flex; flex-direction: column; gap: 15px; }
.gate-card form > * { animation: rise .5s var(--out) both; }
.gate-card form > *:nth-child(2) { animation-delay: .05s; } .gate-card form > *:nth-child(3) { animation-delay: .1s; } .gate-card form > *:nth-child(4) { animation-delay: .15s; } .gate-card form > *:nth-child(n+5) { animation-delay: .2s; }
.gate-card h1 { font-size: 23px; }
.gate-card .btn-primary { min-height: 48px; font-size: 15px; border-radius: 13px; }
.gate-logo { display: block; width: 176px; margin: 0 auto 24px; animation: float 5s ease-in-out infinite; }
.gate-wait { display: flex; align-items: center; justify-content: center; gap: 12px; text-align: center; color: var(--muted); padding: 14px 0; font-weight: 600; }
.gate-wait::before { content: ''; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--leaf-soft); border-top-color: var(--leaf); animation: spin .8s linear infinite; flex: none; }

/* ---------- shell ---------- */
.app { min-height: 100vh; }
.rail { position: fixed; inset: 0 auto 0 0; width: var(--rail); background: linear-gradient(180deg, var(--forest) 0%, var(--forest-deep) 100%); color: #DCEBE4; display: flex; flex-direction: column; padding: 18px 14px 16px; z-index: 20; overflow: hidden; isolation: isolate; }
.rail::before { content: ''; position: absolute; width: 340px; height: 340px; left: -160px; bottom: -120px; border-radius: 50%; background: radial-gradient(closest-side, rgba(158, 210, 155, .2), transparent 70%); z-index: -1; animation: drift-2 18s ease-in-out infinite alternate; }
.rail-logo { display: block; background: #fff; border-radius: 16px; padding: 12px 16px; margin: 0 2px 24px; box-shadow: 0 12px 24px -14px rgba(0, 0, 0, .6); transition: transform .3s var(--spring); }
.rail-logo:hover { transform: translateY(-2px) scale(1.02); }
.rail-logo img { width: 100%; max-width: 150px; display: block; margin: 0 auto; }
.rail-nav { display: flex; flex-direction: column; gap: 3px; }
.rail-nav a { position: relative; overflow: hidden; display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 12px; color: #CFE3DA; text-decoration: none; font-weight: 650; transition: background-color .2s, color .2s, transform .2s var(--out); }
.rail-nav a::before { content: ''; position: absolute; left: 0; top: 50%; width: 3.5px; height: 0; border-radius: 0 4px 4px 0; background: var(--mint); transform: translateY(-50%); transition: height .28s var(--spring); }
.rail-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; transform: translateX(2px); }
.rail-nav a .i { transition: transform .3s var(--spring); }
.rail-nav a:hover .i { transform: scale(1.14) rotate(-6deg); }
.rail-nav a[aria-current="page"] { background: rgba(255, 255, 255, .12); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.rail-nav a[aria-current="page"]::before { height: 22px; }
.rail-nav a[aria-current="page"] .i { color: var(--mint); animation: pop .4s var(--out); }
.rail-nav a[aria-current="page"] .badge { background: var(--mint); color: var(--forest-deep); }
.badge { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 99px; background: var(--gold); color: #3E2C05; font-size: 12px; font-weight: 800; text-align: center; animation: pop .4s var(--out); }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding: 14px 4px 0; border-top: 1px solid rgba(255, 255, 255, .12); }
.me { display: flex; align-items: center; gap: 10px; }
.me-text { min-width: 0; flex: 1; font-size: 14px; font-weight: 700; line-height: 1.3; color: #fff; }
.me-text .muted { font-weight: 500; font-size: 12.5px; }
.rail .muted, .rail .sync { color: #A9C8BB; }
.rail .icon-btn { color: #CFE3DA; }
.rail .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.avatar { width: 36px; height: 36px; border-radius: 12px; background: var(--leaf-soft); color: var(--forest); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.rail .avatar { background: var(--mint); color: var(--forest-deep); }
.sync { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--muted); padding: 0 4px; }
.sync .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); flex: none; transition: background-color .3s; }
.sync[data-state="saved"] .dot { background: #3FBF6B; --ring: rgba(63, 191, 107, .55); animation: pulse-ring 2.4s infinite; }
.sync[data-state="saving"] .dot { background: #E0B93A; --ring: rgba(224, 185, 58, .6); animation: pulse-ring .9s infinite; }
.sync[data-state="offline"] .dot, .sync[data-state="error"] .dot { background: #E0603F; }
.topbar, .tabbar { display: none; }
.main { margin-left: var(--rail); padding: 34px 40px 64px; max-width: calc(var(--rail) + 1220px); }

.page:not([hidden]) { animation: rise .45s var(--out) both; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { margin-top: 6px; font-size: 14.5px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.search { position: relative; display: flex; align-items: center; width: 280px; max-width: 100%; }
.search .i { position: absolute; left: 13px; color: var(--muted); transition: color .15s, transform .25s var(--spring); }
.search:focus-within .i { color: var(--leaf); transform: scale(1.12); }
.search input { padding-left: 40px; min-height: 42px; border-radius: 99px; }
.seg { display: inline-flex; background: #E4EAE5; border-radius: 13px; padding: 4px; }
.seg button { position: relative; overflow: hidden; border: 0; background: transparent; padding: 9px 18px; border-radius: 10px; font: 700 14px var(--font); color: var(--muted); cursor: pointer; transition: color .2s, background-color .25s var(--out), box-shadow .25s; }
.seg button:hover { color: var(--ink); }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--forest); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 6px 14px -8px rgba(3, 70, 58, .35); }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chips button { position: relative; overflow: hidden; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 99px; padding: 8px 15px; font: 700 13.5px var(--font); color: var(--ink); cursor: pointer; transition: transform .18s var(--out), background-color .2s, border-color .2s, color .2s, box-shadow .2s; }
.chips button:hover { border-color: var(--forest); transform: translateY(-1px); }
.chips button[aria-pressed="true"] { background: var(--forest); border-color: var(--forest); color: #fff; box-shadow: 0 10px 18px -12px rgba(3, 70, 58, .8); }
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.quick .btn { min-height: 58px; border-radius: 16px; justify-content: flex-start; padding: 0 16px; gap: 12px; font-size: 14.5px; border-color: var(--line); box-shadow: var(--shadow-sm); }
.quick .btn:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.quick .btn .i { width: 32px; height: 32px; padding: 7px; border-radius: 11px; background: var(--leaf-soft); color: var(--forest); }
.quick .btn-primary .i { background: rgba(255, 255, 255, .16); color: #fff; }

/* ---------- panels & lists ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 18px 20px 6px; }
.panel-body { padding: 8px 20px 18px; }
.empty { padding: 54px 20px 48px; text-align: center; color: var(--muted); }
.empty::before { content: ''; display: block; width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 22px; background: var(--leaf-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2303463A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 19c0-8 5-14 15-15-1 10-7 15-15 15zM5 19l7-7'/%3E%3C/svg%3E") center / 30px no-repeat; animation: float 4s ease-in-out infinite; }
.empty h2 { color: var(--ink); margin-bottom: 6px; }
.empty p { max-width: 420px; margin: 0 auto; }
.empty .btn { margin-top: 16px; }

.panel:has(> .table) { overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 13px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--paper-2); }
.table th.num { text-align: right; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; transition: background-color .18s; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr[data-open] { cursor: pointer; }
.table tbody tr[data-open]:hover td { background: #F3F8F4; }
.table tbody tr[data-open] td:first-child { transition: background-color .18s, box-shadow .22s var(--out); }
.table tbody tr[data-open]:hover td:first-child { box-shadow: inset 3px 0 0 var(--leaf); }
.t-name { font-weight: 700; }
.t-sub { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.swatch { display: inline-block; width: 11px; height: 11px; border-radius: 4px; margin-right: 9px; vertical-align: 0; box-shadow: 0 0 0 3px rgba(0, 0, 0, .05); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-paid { background: var(--leaf-soft); color: var(--leaf); }
.pill-pending { background: var(--kraft-soft); color: var(--kraft); }
.pill-overdue { background: var(--berbere-soft); color: var(--berbere); }
.pill-overdue::before { --ring: rgba(169, 58, 31, .5); animation: pulse-ring 1.6s infinite; }
.pill-plain { background: var(--paper); color: var(--muted); }
.low { color: var(--berbere); font-weight: 700; }

/* ---------- overview ---------- */
.stock { position: relative; overflow: hidden; isolation: isolate; background: radial-gradient(130% 150% at 0% 0%, #0C5E4C 0%, var(--forest) 46%, var(--forest-deep) 100%); color: #fff; border-radius: 24px; padding: 30px 32px 28px; margin-bottom: 20px; box-shadow: 0 34px 60px -34px rgba(3, 70, 58, .75); --mx: 78%; --my: 0%; }
.stock::before { content: ''; position: absolute; width: 460px; height: 460px; right: -120px; top: -220px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 0 0 46px rgba(255, 255, 255, .03), 0 0 0 110px rgba(255, 255, 255, .025); z-index: -1; animation: drift 18s ease-in-out infinite alternate; }
.stock::after { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(420px circle at var(--mx) var(--my), rgba(158, 210, 155, .22), transparent 62%); transition: opacity .3s; }
.stock-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.stock-label { display: inline-flex; align-items: center; gap: 9px; font-size: 12.5px; color: #BFDCCF; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.stock-label::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--mint); --ring: rgba(158, 210, 155, .6); animation: pulse-ring 2.2s infinite; }
.stock-value { font-size: 52px; font-weight: 800; letter-spacing: -.035em; line-height: 1.05; margin-top: 8px; }
.stock-value small { font-size: 20px; font-weight: 700; color: #BFDCCF; margin-right: 8px; letter-spacing: 0; }
.stock-bar { position: relative; display: flex; height: 12px; border-radius: 99px; overflow: hidden; margin: 24px 0 20px; background: rgba(255, 255, 255, .12); gap: 3px; }
.stock-bar span { display: block; min-width: 4px; border-radius: 99px; transform-origin: left; }
.stock-bar::after { content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 26%; background: rgba(255, 255, 255, .5); filter: blur(6px); transform: translateX(-120%) skewX(-18deg); animation: sheen 2.6s var(--out) 1.1s; }
.stock-legend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stock-legend button { text-align: left; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); border-radius: 16px; color: #fff; padding: 14px 16px; cursor: pointer; font: inherit; transition: transform .22s var(--out), background-color .2s, border-color .2s; }
.stock-legend button:hover { background: rgba(255, 255, 255, .13); border-color: rgba(255, 255, 255, .22); transform: translateY(-3px); }
.stock-legend span { display: block; }
.stock-legend .k { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: #D4E7DD; font-weight: 600; }
.stock-legend .k i { width: 10px; height: 10px; border-radius: 4px; }
.stock-legend .v { font-size: 21px; font-weight: 800; margin-top: 4px; letter-spacing: -.02em; }
.stock-legend .s { font-size: 13px; color: #B5D3C6; }
.c-raw { background: var(--mint); }
.c-blend { background: var(--gold); }
.c-coffee { background: #C98A54; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; margin-bottom: 20px; }
.figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 8px 20px 8px; }
.figure { background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; transition: transform .2s var(--out), box-shadow .2s; min-width: 0; }
.figure:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.figure .k { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.figure .v { font-size: 20px; font-weight: 800; margin-top: 2px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart { padding: 8px 20px 18px; }
.chart svg { width: 100%; height: 160px; display: block; overflow: visible; }
.chart svg rect { transform-box: fill-box; transform-origin: bottom; transition: opacity .15s; }
.chart svg g:hover rect { opacity: .78; }
.chart-key { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); margin-top: 8px; font-weight: 600; }
.chart-key i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.attn { list-style: none; margin: 0; padding: 0; }
.attn li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.attn li:first-child { border-top: 0; }
.attn .mark { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--kraft); }
.attn .mark.bad { background: var(--berbere); --ring: rgba(169, 58, 31, .5); animation: pulse-ring 1.6s infinite; }
.attn .txt { flex: 1; min-width: 0; font-size: 14.5px; }
.attn .txt .t-sub { display: block; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.feed li:first-child { border-top: 0; }
.feed time { color: var(--muted); font-size: 12.5px; padding-top: 2px; font-weight: 600; }
.feed .who { color: var(--muted); font-size: 13px; }
.day { font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 20px 20px 6px; }

/* ---------- coffee ---------- */
.batches { display: grid; gap: 14px; }
.batch { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); transition: transform .25s var(--out), box-shadow .25s var(--out), border-color .2s; }
.batch:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.batch-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.batch-head h3 { font-size: 17.5px; font-weight: 800; }
.stages { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; margin: 16px 0 14px; }
.stage { position: relative; padding: 11px 13px 10px; border-radius: 12px; background: var(--paper); border-top: 3px solid var(--line-strong); min-width: 0; transition: transform .2s var(--out); }
.stage:hover { transform: translateY(-2px); }
.stage.done { background: var(--kraft-soft); border-top-color: var(--kraft); }
.stage.done::after { content: ''; position: absolute; top: 12px; right: 12px; width: 9px; height: 5px; border-left: 2px solid var(--kraft); border-bottom: 2px solid var(--kraft); transform: rotate(-45deg); }
.stage.now { background: #fff; border: 1px solid var(--kraft); border-top-width: 3px; box-shadow: 0 10px 22px -14px rgba(138, 90, 30, .7); }
.stage.now::after { content: ''; position: absolute; top: 12px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--kraft); --ring: rgba(138, 90, 30, .5); animation: pulse-ring 1.8s infinite; }
.stage .n { font-size: 12.5px; font-weight: 700; color: var(--muted); padding-right: 18px; }
.stage.done .n, .stage.now .n { color: var(--kraft); }
.stage .q { font-weight: 800; font-size: 15.5px; }
.stage .c { font-size: 12px; color: var(--muted); }
.batch-figs { display: flex; gap: 26px; flex-wrap: wrap; font-size: 14px; padding-top: 12px; border-top: 1px dashed var(--line-strong); }
.batch-figs b { display: block; font-size: 15.5px; }
.batch-figs span { color: var(--muted); font-size: 12.5px; font-weight: 600; }

/* ---------- drawer & sheet ---------- */
.scrim { position: fixed; inset: 0; background: rgba(4, 26, 21, .5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); z-index: 40; animation: fade .25s var(--out); }
.drawer { position: fixed; top: 10px; right: 10px; bottom: 10px; width: min(540px, calc(100% - 20px)); background: var(--surface); z-index: 41; border-radius: 22px; transform: translateX(calc(100% + 20px)); transition: transform .42s var(--out), visibility 0s .42s; visibility: hidden; overflow-y: auto; box-shadow: var(--shadow-lg); }
.drawer.open { transform: none; visibility: visible; transition: transform .42s var(--out); }
.sheet { position: fixed; z-index: 51; left: 50%; top: 4vh; transform: translate(-50%, 26px) scale(.96); width: min(780px, calc(100% - 32px)); max-height: 92vh; background: var(--surface); border-radius: 24px; display: flex; flex-direction: column; overflow: hidden; opacity: 0; pointer-events: none; visibility: hidden; transition: opacity .22s var(--out), transform .34s var(--spring), visibility 0s .34s; box-shadow: var(--shadow-lg); }
.sheet.open { opacity: 1; pointer-events: auto; visibility: visible; transform: translate(-50%, 0) scale(1); transition: opacity .22s var(--out), transform .34s var(--spring); }
.scrim[data-scrim="sheet"] { z-index: 50; }
[data-sheet-body], [data-sheet-body] > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.s-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
.s-head h2 { font-size: 20px; }
.s-head p { font-size: 14px; color: var(--muted); margin-top: 4px; }
.s-body { padding: 20px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.sheet.open .s-body > * { animation: rise .4s var(--out) both; }
.sheet.open .s-body > *:nth-child(2) { animation-delay: .04s; } .sheet.open .s-body > *:nth-child(3) { animation-delay: .08s; } .sheet.open .s-body > *:nth-child(4) { animation-delay: .12s; } .sheet.open .s-body > *:nth-child(n+5) { animation-delay: .16s; }
.s-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--line); background: var(--paper-2); }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.group { border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--paper-2); }
.group-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 800; font-size: 14.5px; }
.lines { display: flex; flex-direction: column; gap: 8px; }
.line { display: grid; gap: 8px; align-items: center; animation: rise .3s var(--out) both; }
.line-cost { grid-template-columns: minmax(0, 1fr) 130px 38px; }
.line-recipe { grid-template-columns: minmax(0, 1fr) 110px 70px 38px; }
.line-inv { grid-template-columns: minmax(0, 1fr) 100px 120px 38px; }
.line .calc { font-size: 13px; color: var(--muted); text-align: right; white-space: nowrap; }
.line-head { font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); animation: none; }
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; background: var(--forest); color: #fff; border-radius: 16px; padding: 14px 16px; box-shadow: 0 16px 30px -20px rgba(3, 70, 58, .8); }
.totals .k { font-size: 12.5px; color: #BFDCCF; font-weight: 600; }
.totals .v { font-size: 17px; font-weight: 800; }
.totals .v.neg { color: #FFB39E; }
.totals .v.pos { color: var(--mint); }
.note { font-size: 13.5px; color: var(--muted); }
.warn { font-size: 13.5px; color: var(--berbere); font-weight: 600; }
.d-head { position: sticky; top: 0; background: rgba(255, 255, 255, .86); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); padding: 22px 24px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; z-index: 1; }
.d-head h2 { font-size: 23px; letter-spacing: -.02em; }
.d-body { padding: 20px 24px 32px; display: flex; flex-direction: column; gap: 20px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.kv > div { background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.kv .k { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.kv .v { font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
.drawer .table th, .drawer .table td { padding: 10px 10px; }
.drawer .table th:first-child, .drawer .table td:first-child { padding-left: 12px; }
.dl { display: flex; flex-direction: column; }
.dl div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.dl div:first-child { border-top: 0; }
.dl div.total { font-weight: 800; border-top: 1.5px solid var(--ink); }
.d-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.list-link { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; font-size: 14.5px; background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; text-align: left; font-family: inherit; color: inherit; transition: padding .2s var(--out); }
.list-link:hover { padding-left: 6px; }
.list-link:hover .t-name { color: var(--leaf); }
.picker { display: grid; gap: 10px; }
.picker button { position: relative; overflow: hidden; text-align: left; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 16px; padding: 16px 44px 16px 18px; cursor: pointer; font: inherit; transition: transform .2s var(--out), border-color .2s, box-shadow .2s, background-color .2s; }
.picker button::after { content: ''; position: absolute; right: 18px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-top: 2px solid var(--muted); transform: translateY(-50%) rotate(45deg); transition: transform .25s var(--spring), border-color .2s; }
.picker button:hover { border-color: var(--forest); transform: translateY(-2px); box-shadow: var(--shadow); background: var(--paper-2); }
.picker button:hover::after { transform: translate(4px, -50%) rotate(45deg); border-color: var(--forest); }
.picker b { display: block; font-size: 15.5px; }
.picker span { color: var(--muted); font-size: 13.5px; }

.toasts { position: fixed; bottom: calc(22px + var(--safe-b)); left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100% - 32px); }
.toast { display: flex; align-items: center; gap: 10px; background: rgba(18, 32, 26, .94); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: #fff; padding: 12px 18px 12px 14px; border-radius: 99px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); animation: toast-in .4s var(--spring), toast-out .3s ease-in 2.85s forwards; }
.toast::before { content: ''; width: 20px; height: 20px; border-radius: 50%; flex: none; background: #3FBF6B url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 13px no-repeat; animation: pop .45s var(--out) .1s both; }
.toast.err { background: rgba(140, 44, 22, .96); animation: toast-in .4s var(--spring), toast-out .3s ease-in 5.65s forwards; border-radius: 16px; }
.toast.err::before { background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A93A1F' stroke-width='3.2' stroke-linecap='round'%3E%3Cpath d='M12 6v7M12 17.5v.5'/%3E%3C/svg%3E") center / 14px no-repeat; }

.settings { display: grid; gap: 20px; max-width: 780px; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.user-row:first-child { border-top: 0; }
.user-row .grow { flex: 1; min-width: 160px; }

.m-only, .m-only-block { display: none; }

/* ---------- entrance choreography (class set by fx.js on navigation only) ---------- */
.fx-enter .quick .btn, .fx-enter .stock, .fx-enter .grid-2 > *, .fx-enter [data-region] > .panel, .fx-enter .batch, .fx-enter .settings > *, .fx-enter .toolbar { animation: rise .55s var(--out) both; }
.fx-enter .quick .btn:nth-child(2) { animation-delay: .05s; } .fx-enter .quick .btn:nth-child(3) { animation-delay: .1s; } .fx-enter .quick .btn:nth-child(4) { animation-delay: .15s; }
.fx-enter .stock { animation-delay: .12s; }
.fx-enter .grid-2 > *:nth-child(1) { animation-delay: .22s; } .fx-enter .grid-2 > *:nth-child(2) { animation-delay: .3s; }
.fx-enter [data-region="home"] > .panel { animation-delay: .38s; }
.fx-enter .batch:nth-child(2), .fx-enter .settings > *:nth-child(2) { animation-delay: .07s; } .fx-enter .batch:nth-child(3), .fx-enter .settings > *:nth-child(3) { animation-delay: .14s; } .fx-enter .batch:nth-child(n+4) { animation-delay: .2s; }
.fx-enter .stock-bar span { animation: grow-x .9s var(--out) .45s both; }
.fx-enter .stock-bar span:nth-child(2) { animation-delay: .58s; } .fx-enter .stock-bar span:nth-child(3) { animation-delay: .7s; }
.fx-enter .stock-legend button { animation: rise .5s var(--out) both; animation-delay: .4s; }
.fx-enter .stock-legend button:nth-child(2) { animation-delay: .48s; } .fx-enter .stock-legend button:nth-child(3) { animation-delay: .56s; }
.fx-enter .chart svg rect { animation: grow-y .7s var(--out) both; animation-delay: .5s; }
.fx-enter .chart svg g:nth-child(2) rect { animation-delay: .56s; } .fx-enter .chart svg g:nth-child(3) rect { animation-delay: .62s; } .fx-enter .chart svg g:nth-child(4) rect { animation-delay: .68s; } .fx-enter .chart svg g:nth-child(5) rect { animation-delay: .74s; } .fx-enter .chart svg g:nth-child(6) rect { animation-delay: .8s; }
.fx-enter .table tbody tr, .fx-enter .attn li, .fx-enter .feed li, .fx-enter .user-row { animation: rise .42s var(--out) both; }
.fx-enter .table tbody tr:nth-child(1), .fx-enter .attn li:nth-child(1), .fx-enter .feed li:nth-child(1) { animation-delay: .3s; }
.fx-enter .table tbody tr:nth-child(2), .fx-enter .attn li:nth-child(2), .fx-enter .feed li:nth-child(2) { animation-delay: .34s; }
.fx-enter .table tbody tr:nth-child(3), .fx-enter .attn li:nth-child(3), .fx-enter .feed li:nth-child(3) { animation-delay: .38s; }
.fx-enter .table tbody tr:nth-child(4), .fx-enter .attn li:nth-child(4), .fx-enter .feed li:nth-child(4) { animation-delay: .42s; }
.fx-enter .table tbody tr:nth-child(5), .fx-enter .attn li:nth-child(5), .fx-enter .feed li:nth-child(5) { animation-delay: .46s; }
.fx-enter .table tbody tr:nth-child(6), .fx-enter .attn li:nth-child(6), .fx-enter .feed li:nth-child(6) { animation-delay: .5s; }
.fx-enter .table tbody tr:nth-child(7), .fx-enter .attn li:nth-child(7), .fx-enter .feed li:nth-child(7) { animation-delay: .54s; }
.fx-enter .table tbody tr:nth-child(n+8), .fx-enter .feed li:nth-child(n+8) { animation-delay: .58s; }
.fx-enter .stage { animation: rise .45s var(--out) both; animation-delay: .25s; }
.fx-enter .stage:nth-child(2) { animation-delay: .32s; } .fx-enter .stage:nth-child(3) { animation-delay: .39s; } .fx-enter .stage:nth-child(4) { animation-delay: .46s; }

/* ---------- phones & small tablets ---------- */
@media (max-width: 1100px) {
  .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .gate { grid-template-columns: minmax(0, 1fr); gap: 26px; padding: 28px 16px calc(28px + var(--safe-b)); align-content: center; }
  .gate-copy { text-align: center; margin: 0 auto; }
  .gate-copy h2 { font-size: 32px; }
  .gate-copy p, .gate-copy ul { display: none; }
  .gate-copy .eyebrow { margin-bottom: 12px; }
  .gate-card { justify-self: center; padding: 28px 22px 24px; border-radius: 24px; }
  .rail { display: none; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 20; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); background: rgba(255, 255, 255, .82); -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4); border-bottom: 1px solid transparent; transition: border-color .25s, box-shadow .25s; }
  .fx-scrolled .topbar { border-bottom-color: var(--line); box-shadow: 0 10px 24px -18px rgba(3, 70, 58, .5); }
  .topbar-logo { height: 32px; }
  .topbar .sync { background: var(--paper); border-radius: 99px; padding: 6px 11px; font-weight: 600; }
  .topbar .sync-text { display: none; }
  .topbar .sync[data-state="offline"] .sync-text, .topbar .sync[data-state="error"] .sync-text, .topbar .sync[data-state="saving"] .sync-text { display: inline; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 10px; right: 10px; bottom: calc(10px + var(--safe-b)); z-index: 30; background: rgba(255, 255, 255, .88); -webkit-backdrop-filter: blur(18px) saturate(1.5); backdrop-filter: blur(18px) saturate(1.5); border: 1px solid rgba(3, 70, 58, .1); border-radius: 24px; padding: 6px 4px; box-shadow: 0 18px 40px -16px rgba(2, 30, 24, .45); animation: rise .5s var(--spring) .1s both; }
  .tabbar a { position: relative; isolation: isolate; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px 6px; font-size: 11px; font-weight: 700; color: var(--muted); text-decoration: none; transition: color .2s; }
  .tabbar a::before { content: ''; position: absolute; z-index: -1; top: 3px; left: 50%; width: 54px; height: 32px; border-radius: 99px; background: var(--leaf-soft); transform: translateX(-50%) scale(.4); opacity: 0; transition: transform .32s var(--spring), opacity .2s; }
  .tabbar a .i { width: 22px; height: 22px; transition: transform .3s var(--spring); }
  .tabbar a:active .i { transform: scale(.86); }
  .tabbar a[aria-current="page"] { color: var(--forest); }
  .tabbar a[aria-current="page"]::before { transform: translateX(-50%) scale(1); opacity: 1; }
  .tabbar a[aria-current="page"] .i { transform: translateY(-1px) scale(1.08); }
  .tabbar .badge { position: absolute; top: 2px; left: 56%; margin: 0; min-width: 18px; padding: 0 5px; font-size: 11px; background: var(--berbere); color: #fff; box-shadow: 0 0 0 2px #fff; }
  .main { margin-left: 0; padding: 18px 16px calc(112px + var(--safe-b)); }
  h1 { font-size: 25px; }
  .page-head { align-items: flex-start; margin-bottom: 16px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .quick { gap: 10px; }
  .quick .btn { min-height: 54px; padding: 0 12px; gap: 10px; font-size: 13.5px; white-space: normal; text-align: left; line-height: 1.2; }
  .search { width: 100%; }
  .toolbar .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; width: calc(100% + 32px); }
  .toolbar .chips::-webkit-scrollbar { display: none; }
  .toolbar .chips button { flex: none; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
  .stock { padding: 24px 20px 20px; border-radius: 22px; margin-bottom: 16px; }
  .stock-value { font-size: 38px; }
  .stock-value small { font-size: 17px; }
  .stock-legend { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .stock-legend button { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; padding: 12px 14px; }
  .stock-legend .v { font-size: 16px; text-align: right; margin-top: 0; }
  .stock-legend .s { grid-column: 1 / -1; }
  /* list tables become stacked rows */
  .table.list thead { display: none; }
  .table.list, .table.list tbody, .table.list tr, .table.list td { display: block; }
  .table.list tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); transition: background-color .15s; }
  .table.list tr[data-open]:active { background: #F0F6F1; }
  .table.list tbody tr:last-child { border-bottom: 0; }
  .table.list td { padding: 0; border: 0; background: none !important; box-shadow: none !important; }
  .table.list td.m-hide { display: none; }
  .m-only { display: inline; }
  .m-only-block { display: block; }
  .table.list td.m-main { grid-column: 1; }
  .table.list td.m-side { grid-column: 2; grid-row: 1 / span 2; text-align: right; align-self: center; }
  .table.list td.m-meta { grid-column: 1; font-size: 13px; color: var(--muted); text-align: left; }
  .figures { grid-template-columns: minmax(0, 1fr); gap: 8px; padding-left: 16px; padding-right: 16px; }
  .figure { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
  .figure .v { font-size: 17px; margin-top: 0; }
  .panel-head, .panel-body, .chart { padding-left: 16px; padding-right: 16px; }
  .batch { padding: 16px; }
  .batch:hover { transform: none; }
  .batch-figs { gap: 16px 22px; }
  .sheet { top: auto; bottom: 0; left: 0; width: 100%; max-height: 94vh; max-height: 94dvh; transform: translateY(100%); opacity: 1; border-radius: 26px 26px 0 0; padding-bottom: var(--safe-b); transition: transform .42s var(--out), visibility 0s .42s; }
  .sheet.open { transform: none; transition: transform .42s var(--out); }
  .sheet::before { content: ''; display: block; width: 42px; height: 5px; border-radius: 99px; background: var(--line-strong); margin: 9px auto 0; flex: none; }
  .s-head { padding-top: 14px; }
  .s-head, .s-body, .s-foot { padding-left: 16px; padding-right: 16px; }
  .s-foot .btn { flex: 1; min-height: 46px; }
  .row, .row-3 { grid-template-columns: minmax(0, 1fr); }
  .line-cost { grid-template-columns: minmax(0, 1fr) 110px 38px; }
  .line-recipe { grid-template-columns: minmax(0, 1fr) 90px 38px; }
  .line-recipe .calc { display: none; }
  .line-inv { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 38px; }
  .line-inv select { grid-column: 1 / -1; }
  .line-head { display: none; }
  .stages { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feed li { grid-template-columns: 64px minmax(0, 1fr); }
  .drawer { top: auto; right: 0; bottom: 0; left: 0; width: 100%; max-height: 92vh; max-height: 92dvh; border-radius: 26px 26px 0 0; transform: translateY(100%); padding-bottom: var(--safe-b); }
  .d-head, .d-body { padding-left: 16px; padding-right: 16px; }
  .d-actions .btn { flex: 1; }
  .drawer .table { display: block; overflow-x: auto; font-size: 13.5px; }
  .drawer .table th, .drawer .table td { padding: 9px 7px; }
  .drawer .table th { letter-spacing: .03em; }
  .chart svg { height: auto; }
  .toasts { bottom: calc(96px + var(--safe-b)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
