/* ===== Base&Clean Warehouse OS — brand: #0AADEB (blue-primary), #0891C5, #066F99, #B8E8F8 ===== */
:root {
  --brand: #0AADEB; --brand-2: #0891C5; --brand-deep: #066F99; --brand-light: #B8E8F8; --brand-pale: #E8F7FC;
  --bg: #050b16; --bg-2: #0a1424; --panel: rgba(12, 24, 44, .68); --panel-2: rgba(16, 32, 56, .55);
  --line: rgba(10, 173, 235, .16); --line-2: rgba(184, 232, 248, .08);
  --text: #E8F1F8; --muted: #8B9AAA; --dim: #64748B;
  --ok: #22C55E; --warn: #FFB020; --bad: #FF4D6D; --violet: #7C5CFF; --pink: #F472B6;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Playfair Display", Georgia, serif;
  --radius: 18px; --radius-sm: 12px;
  --shadow: 0 20px 60px rgba(0,0,0,.45), 0 0 0 1px var(--line);
  --glow: 0 0 40px rgba(10,173,235,.25);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; }
body { font-family: var(--font-sans); background: var(--bg); color: var(--text); min-height: 100vh; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
.serif { font-family: var(--font-serif); font-weight: 700; letter-spacing: -.01em; }
.muted { color: var(--muted); } .dim { color: var(--dim); }
.hidden { display: none !important; }
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- ambient background ---------- */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: radial-gradient(1200px 800px at 80% -10%, rgba(10,173,235,.16), transparent 60%), radial-gradient(900px 700px at -10% 100%, rgba(124,92,255,.12), transparent 60%), var(--bg); }
.bg .grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(184,232,248,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(184,232,248,.045) 1px, transparent 1px); background-size: 48px 48px; mask-image: radial-gradient(ellipse at 50% 0%, #000 20%, transparent 75%); }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .55; animation: drift 24s ease-in-out infinite alternate; }
.o1 { width: 520px; height: 520px; background: #0AADEB; top: -160px; right: -100px; }
.o2 { width: 420px; height: 420px; background: #066F99; bottom: -140px; left: 10%; animation-delay: -8s; }
.o3 { width: 300px; height: 300px; background: #7C5CFF; top: 40%; left: 55%; opacity: .25; animation-delay: -15s; }
@keyframes drift { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(-40px, 30px, 0) scale(1.08); } }

/* ---------- glass ---------- */
.glass { background: var(--panel); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card { background: var(--panel); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; position: relative; overflow: hidden; }
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(184,232,248,.5), transparent); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3 { font-size: 15px; font-weight: 700; letter-spacing: .01em; }
.card-head .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; position: relative; z-index: 1; }
#login, #modal-root, #toasts { position: relative; z-index: 2; }
.login { z-index: 40; }
.sidebar { position: fixed; top: 14px; left: 14px; bottom: 14px; width: 250px; height: auto; margin: 0; padding: 18px 14px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; z-index: 20; }
.sidebar::-webkit-scrollbar { display: none; }
.shell { grid-template-columns: 264px 1fr; }
nav { flex: 1 0 auto; }
/* short screens (iPad landscape, small laptops): tighter sidebar so everything fits without scrolling */
@media (min-width: 861px) and (max-height: 860px) {
  .sidebar { gap: 10px; padding: 12px 12px; }
  .logo { padding: 2px 6px; } .logo .mark { width: 36px; height: 36px; font-size: 13px; border-radius: 10px; } .logo-text strong { font-size: 15px; } .logo-text small { font-size: 10px; }
  nav { gap: 2px; } nav a { padding: 7px 11px; font-size: 13px; border-radius: 10px; } nav a svg { width: 17px; height: 17px; }
  .whoami { padding: 7px 8px; } .sync { font-size: 11px; }
}
@media (min-width: 861px) and (max-height: 700px) { nav a { padding: 5px 10px; font-size: 12.5px; } .sidebar { gap: 8px; } }
.logo { display: flex; align-items: center; gap: 12px; padding: 6px 8px; color: var(--text); }
.logo .mark { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-family: var(--font-serif); font-weight: 700; font-size: 15px; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-deep)); box-shadow: var(--glow); flex: none; }
.logo.big { justify-content: center; margin-bottom: 8px; } .logo.big .mark { width: 64px; height: 64px; font-size: 22px; border-radius: 18px; }
.logo-text { display: flex; flex-direction: column; line-height: 1.1; } .logo-text strong { font-size: 17px; } .logo-text small { font-size: 11px; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: var(--muted); font-weight: 500; font-size: 14px; transition: .18s; position: relative; }
nav a svg { width: 19px; height: 19px; flex: none; }
nav a:hover { color: var(--text); background: rgba(10,173,235,.07); }
nav a.active { color: #fff; background: linear-gradient(90deg, rgba(10,173,235,.22), rgba(10,173,235,.05)); box-shadow: inset 0 0 0 1px rgba(10,173,235,.28); }
nav a.active::before { content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--brand); box-shadow: 0 0 12px var(--brand); }
nav .badge { margin-left: auto; }
.sidebar-foot { display: flex; flex-direction: column; gap: 12px; }
.unit-toggle { display: grid; grid-template-columns: 1fr 1fr; background: rgba(0,0,0,.25); border: 1px solid var(--line-2); border-radius: 12px; padding: 4px; }
.unit-toggle button { border: 0; background: transparent; color: var(--muted); padding: 8px; border-radius: 9px; font-size: 12px; font-weight: 600; cursor: pointer; }
.unit-toggle button.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 6px 18px rgba(10,173,235,.35); }
.sync { font-size: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 8px; }
.sync > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.sync .version { font-variant-numeric: tabular-nums; color: var(--dim); letter-spacing: .04em; }
.sync .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

.main { grid-column: 2; padding: 22px 26px 60px; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 15; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: -22px -26px 18px; padding: 22px 26px 14px; background: linear-gradient(180deg, rgba(5,11,22,.92) 0%, rgba(5,11,22,.78) 70%, rgba(5,11,22,0) 100%); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); -webkit-mask-image: linear-gradient(180deg, #000 78%, transparent 100%); mask-image: linear-gradient(180deg, #000 78%, transparent 100%); }
.topbar-actions { position: relative; z-index: 1; }
.topbar h1 { font-size: 30px; } .crumb { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 4px; }
.topbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.view { animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.grid-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.row { display: grid; gap: 18px; margin-bottom: 18px; }
.row.c2 { grid-template-columns: 1.4fr 1fr; } .row.c2e { grid-template-columns: 1fr 1fr; } .row.c3 { grid-template-columns: 1fr 1fr 1fr; }
.row.cards { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
#capacity.row.cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); }

/* ---------- KPI tiles ---------- */
.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.kpi .label { font-size: 12px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kpi .label svg { width: 15px; height: 15px; color: var(--brand); }
.kpi .value { font-size: 32px; font-weight: 800; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: 14px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.kpi .foot { font-size: 12px; color: var(--muted); }
.kpi.accent .value { color: var(--brand-light); text-shadow: 0 0 24px rgba(10,173,235,.45); }
.kpi.bad .value { color: var(--bad); text-shadow: 0 0 24px rgba(255,77,109,.4); }
.kpi.warn .value { color: var(--warn); }
.kpi.ok .value { color: var(--ok); }
.kpi .spark { position: absolute; right: -10px; bottom: -10px; width: 120px; height: 60px; opacity: .35; }

/* ---------- capacity cards ---------- */
.capacity { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: center; }
.capacity > div:last-child { min-width: 0; }
.ring { width: 132px; height: 132px; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.ring .track { stroke: rgba(184,232,248,.08); }
.ring .bar { stroke: url(#ringGrad); filter: drop-shadow(0 0 8px rgba(10,173,235,.7)); transition: stroke-dashoffset 1s cubic-bezier(.2,.8,.2,1); }
.ring .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .center b { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.ring .center small { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.capacity h4 { font-size: 18px; margin-bottom: 4px; }
.capacity .bottleneck { font-size: 13px; color: var(--muted); margin: 6px 0 12px; }
.capacity .bottleneck b { color: var(--warn); }
.mini-bars { display: flex; flex-direction: column; gap: 6px; }
.mini-bar { display: grid; grid-template-columns: minmax(70px, 130px) 1fr 44px; gap: 10px; align-items: center; font-size: 12px; }
.mini-bar > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-bar .track { height: 6px; border-radius: 6px; background: rgba(184,232,248,.08); overflow: hidden; }
.mini-bar .fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--brand-deep), var(--brand)); }
.mini-bar .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

/* ---------- stock health ---------- */
.health { display: flex; flex-direction: column; gap: 10px; }
.health-item { display: grid; grid-template-columns: 12px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: rgba(0,0,0,.18); border: 1px solid var(--line-2); transition: .2s; }
.health-item:hover { border-color: var(--line); transform: translateX(2px); }
.health-item .swatch { width: 12px; height: 12px; border-radius: 4px; box-shadow: 0 0 10px currentColor; }
.health-item .name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.health-item .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.health-item .track { margin-top: 8px; height: 6px; border-radius: 6px; background: rgba(184,232,248,.08); overflow: hidden; position: relative; }
.health-item .fill { height: 100%; border-radius: 6px; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.health-item .fill.ok { background: linear-gradient(90deg, var(--brand-deep), var(--brand)); }
.health-item .fill.low { background: linear-gradient(90deg, #b57a12, var(--warn)); }
.health-item .fill.critical, .health-item .fill.out { background: linear-gradient(90deg, #a5203a, var(--bad)); }
.health-item .rp { position: absolute; top: -3px; width: 2px; height: 12px; background: #fff; opacity: .6; }
.health-item .qty { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.health-item .qty small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; }

/* ---------- pills / badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border: 1px solid transparent; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.pill.ok { color: var(--ok); background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.25); }
.pill.low { color: var(--warn); background: rgba(255,176,32,.1); border-color: rgba(255,176,32,.3); }
.pill.critical, .pill.out { color: var(--bad); background: rgba(255,77,109,.1); border-color: rgba(255,77,109,.3); }
.pill.info, .pill.ordered { color: var(--brand); background: rgba(10,173,235,.1); border-color: rgba(10,173,235,.3); }
.pill.received { color: var(--ok); background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.25); }
.pill.cancelled { color: var(--dim); background: rgba(100,116,139,.12); border-color: rgba(100,116,139,.3); }
.pill.violet { color: var(--violet); background: rgba(124,92,255,.12); border-color: rgba(124,92,255,.3); }
.badge { background: var(--bad); color: #fff; font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 99px; box-shadow: 0 0 12px rgba(255,77,109,.6); }
.badge.zero { display: none; }
.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 6px; background: rgba(184,232,248,.08); color: var(--brand-light); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: rgba(184,232,248,.06); color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; transition: .18s; white-space: nowrap; }
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: rgba(184,232,248,.12); border-color: rgba(10,173,235,.4); transform: translateY(-1px); }
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; color: #fff; box-shadow: 0 8px 24px rgba(10,173,235,.35); }
.btn.primary:hover { box-shadow: 0 10px 30px rgba(10,173,235,.5); filter: brightness(1.05); }
.btn.danger { color: var(--bad); border-color: rgba(255,77,109,.3); } .btn.danger:hover { background: rgba(255,77,109,.12); }
.btn.ok { color: var(--ok); border-color: rgba(34,197,94,.3); } .btn.ok:hover { background: rgba(34,197,94,.12); }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 9px; } .btn.sm svg { width: 14px; height: 14px; }
.btn.icon { padding: 7px; } .btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -22px -22px; padding: 0 22px 22px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s; } tbody tr:hover { background: rgba(10,173,235,.05); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .name { font-weight: 600; display: flex; align-items: center; gap: 10px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; box-shadow: 0 0 8px currentColor; flex: none; }
.empty { padding: 36px; text-align: center; color: var(--muted); font-size: 14px; }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 6px; }

/* ---------- forms ---------- */
.form { display: grid; gap: 14px; }
.form .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form .grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
label.field { display: block; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; line-height: 1.4; }
label.field > input, label.field > select, label.field > textarea, label.field > .input-group { margin-top: 6px; display: block; }
label.field > .input-group { display: grid; }
input, select, textarea { width: 100%; background: rgba(0,0,0,.28); border: 1px solid var(--line-2); border-radius: 11px; padding: 10px 12px; color: var(--text); font-size: 14px; transition: .18s; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(10,173,235,.18); }
select { appearance: none; -webkit-appearance: none; padding: 10px 40px 10px 14px; min-height: 44px; line-height: 1.4; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23B8E8F8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; }
select:disabled { opacity: .6; cursor: default; }
input { min-height: 44px; }
select option { background: #0a1424; color: var(--text); }
.line select[name=unit] { min-width: 96px; }
.line select[name=item] { min-width: 160px; }
.topbar-actions select { min-width: 170px; }
textarea { min-height: 70px; resize: vertical; }
.input-group { display: grid; grid-template-columns: 1fr auto; gap: 0; } .input-group input { border-radius: 11px 0 0 11px; } .input-group select { width: auto; border-radius: 0 11px 11px 0; border-left: 0; min-width: 96px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; color: var(--text); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.lines { display: flex; flex-direction: column; gap: 8px; }
.line { display: grid; grid-template-columns: 1.6fr 1fr auto 1fr auto; gap: 8px; align-items: center; }
.line.recipe { grid-template-columns: 1.6fr 1fr auto auto; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.5; }
.error { color: var(--bad); font-size: 13px; min-height: 18px; margin-top: 8px; }
.total-line { display: flex; justify-content: space-between; padding: 12px 14px; background: rgba(10,173,235,.08); border-radius: 12px; font-weight: 700; }

/* ---------- preview (production) ---------- */
.preview-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,.18); border: 1px solid var(--line-2); font-size: 13px; align-items: center; }
.preview-row.short { border-color: rgba(255,77,109,.4); background: rgba(255,77,109,.06); }
.preview-row .n { font-variant-numeric: tabular-nums; text-align: right; }
.big-number { font-size: 56px; font-weight: 800; letter-spacing: -.03em; line-height: 1; background: linear-gradient(135deg, #fff, var(--brand-light)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(3,8,18,.7); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; z-index: 50; animation: fade .2s; }
.modal { width: min(720px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 26px; animation: pop .25s cubic-bezier(.2,.8,.2,1); }
.modal.wide { width: min(900px, 100%); }
@keyframes pop { from { transform: translateY(14px) scale(.98); opacity: 0 } to { transform: none; opacity: 1 } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; gap: 12px; }
.modal-head h2 { font-size: 22px; } .modal-head p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }

/* ---------- toasts ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast { padding: 12px 16px; border-radius: 12px; background: rgba(12,24,44,.92); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 10px; animation: pop .25s; max-width: 380px; }
.toast.ok { border-color: rgba(34,197,94,.4); } .toast.err { border-color: rgba(255,77,109,.5); }
.toast .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 10px currentColor; flex: none; }
.toast.ok .dot { background: var(--ok); } .toast.err .dot { background: var(--bad); }

/* ---------- misc ---------- */
.chart-box { position: relative; height: 280px; } .chart-box.tall { height: 340px; }
.feed { display: flex; flex-direction: column; gap: 4px; max-height: 420px; overflow: auto; }
.feed-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; padding: 10px 8px; border-radius: 10px; align-items: center; font-size: 13px; }
.feed-item:hover { background: rgba(10,173,235,.05); }
.feed-item .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(184,232,248,.07); } .feed-item .ico svg { width: 16px; height: 16px; }
.feed-item .ico.in { color: var(--ok); } .feed-item .ico.out { color: var(--brand); } .feed-item .ico.adj { color: var(--violet); }
.feed-item .when { font-size: 11px; color: var(--muted); white-space: nowrap; }
.feed-item .d { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; } .feed-item .d.pos { color: var(--ok); } .feed-item .d.neg { color: var(--brand-light); }
.reorder { display: flex; flex-direction: column; gap: 8px; }
.reorder-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 12px; border-radius: 12px; border: 1px solid rgba(255,176,32,.25); background: linear-gradient(90deg, rgba(255,176,32,.08), transparent); align-items: center; }
.reorder-item.critical, .reorder-item.out { border-color: rgba(255,77,109,.35); background: linear-gradient(90deg, rgba(255,77,109,.1), transparent); }
.reorder-item b { display: block; font-size: 14px; } .reorder-item small { color: var(--muted); font-size: 12px; }
.reorder-item .buy { text-align: right; font-weight: 800; font-size: 15px; color: var(--brand-light); } .reorder-item .buy small { display: block; font-weight: 500; }
.tabs { display: inline-flex; gap: 4px; background: rgba(0,0,0,.25); border: 1px solid var(--line-2); padding: 4px; border-radius: 12px; }
.tabs button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; }
.tabs button.active { background: rgba(10,173,235,.18); color: #fff; }
.product-card .recipe-table td { padding: 8px 10px; white-space: nowrap; }
.product-card .recipe-table th { padding: 8px 10px; }
.product-card .table-wrap { margin: 0; padding: 0; }
.product-card .table-wrap table { min-width: 420px; }
#products-grid.row.cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); }
.product-card .top { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.product-card .make { text-align: right; } .product-card .make b { font-size: 34px; font-weight: 800; display: block; line-height: 1; color: var(--brand-light); text-shadow: 0 0 20px rgba(10,173,235,.4); } .product-card .make small { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stat-row { display: flex; gap: 20px; flex-wrap: wrap; margin: 14px 0; } .stat-row div { font-size: 12px; color: var(--muted); } .stat-row div b { display: block; font-size: 16px; color: var(--text); margin-top: 2px; }
.setting-row { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line-2); } .setting-row:last-child { border-bottom: 0; }
.setting-row b { display: block; font-size: 14px; } .setting-row small { color: var(--muted); font-size: 12px; }
code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: rgba(0,0,0,.3); padding: 2px 6px; border-radius: 6px; }

/* ---------- login ---------- */
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; z-index: 40; }
.login-card { width: min(380px, 100%); padding: 34px 30px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { font-size: 28px; } .login-card input { text-align: center; }

/* ---------- responsive ---------- */
.mobile-top { display: none; }
.drawer-backdrop { display: none; }
@media (max-width: 860px) { .drawer-backdrop { display: block; } }
@media (max-width: 1100px) { .row.c2, .row.c2e, .row.c3 { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .capacity { grid-template-columns: 1fr; justify-items: center; text-align: center; } .capacity .mini-bars { width: 100%; } .capacity .mini-bar { text-align: left; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; } .main { grid-column: 1; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; width: min(300px, 86vw); margin: 0; border-radius: 0 22px 22px 0; padding: 18px 14px calc(18px + env(safe-area-inset-bottom)); z-index: 60; transform: translateX(-105%); transition: transform .28s cubic-bezier(.2,.8,.2,1); overflow-y: auto; }
  .sidebar.open { transform: none; }
  .drawer-backdrop { position: fixed; inset: 0; background: rgba(3,8,18,.6); backdrop-filter: blur(4px); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .25s; }
  .drawer-backdrop.show { opacity: 1; pointer-events: auto; }
  .mobile-top { position: sticky; top: 0; z-index: 16; display: flex; align-items: center; gap: 10px; margin: -14px -16px 0; padding: calc(10px + env(safe-area-inset-top)) 16px 8px; background: rgba(5,11,22,.9); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
  .topbar { top: calc(58px + env(safe-area-inset-top)); margin: 0 -16px 14px; padding: 10px 16px 12px; }
  .mobile-top .logo { padding: 0; } .mobile-top .logo .mark { width: 36px; height: 36px; font-size: 13px; border-radius: 10px; } .mobile-top .logo-text strong { font-size: 15px; } .mobile-top .logo-text small { font-size: 10px; }
  .mobile-top #menu-btn { width: 42px; height: 42px; }
  .main { padding: 14px 16px 40px; } .topbar h1 { font-size: 24px; }
  .form .grid2, .form .grid3, .line, .line.recipe { grid-template-columns: 1fr; }
  .table-wrap { margin: 0 -16px -16px; padding: 0 16px 16px; } .card { padding: 16px; }
  .grid-kpi, .grid-kpi.small { grid-template-columns: 1fr 1fr; }
}
}

/* ---------- dashboard component tiles (bags) ---------- */
.grid-kpi.small { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid-kpi.small .kpi { min-height: 108px; padding: 16px 18px; } .grid-kpi.small .kpi .value { font-size: 28px; }
.comp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.comp { padding: 14px 16px; border-radius: 14px; background: rgba(0,0,0,.2); border: 1px solid var(--line-2); position: relative; overflow: hidden; transition: .2s; }
.comp::after { content: ""; position: absolute; inset: auto -30px -30px auto; width: 90px; height: 90px; border-radius: 50%; background: var(--c); opacity: .12; filter: blur(20px); }
.comp:hover { transform: translateY(-2px); border-color: var(--line); }
.comp.low { border-color: rgba(255,176,32,.35); } .comp.critical, .comp.out { border-color: rgba(255,77,109,.4); }
.comp-top { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.comp-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comp-num { font-size: 34px; font-weight: 800; letter-spacing: -.02em; line-height: 1; margin: 12px 0 10px; color: var(--c); text-shadow: 0 0 18px color-mix(in srgb, var(--c) 45%, transparent); font-variant-numeric: tabular-nums; }
.comp-num small { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 5px; text-shadow: none; }
.comp .track { height: 6px; border-radius: 6px; background: rgba(184,232,248,.08); overflow: visible; position: relative; }
.comp .fill { height: 100%; border-radius: 6px; background: var(--c); box-shadow: 0 0 10px var(--c); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.comp .rp { position: absolute; top: -3px; width: 2px; height: 12px; background: #fff; opacity: .6; }
.comp-foot { font-size: 11px; color: var(--muted); margin-top: 8px; }

/* ---------- amazon settings ---------- */
.howto { margin-top: 18px; border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 16px; background: rgba(0,0,0,.18); }
.howto summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--brand-light); }
.howto ol { margin: 12px 0 8px 18px; font-size: 13px; line-height: 1.7; color: var(--text); } .howto li { margin-bottom: 4px; } .howto p { font-size: 12px; line-height: 1.6; margin-top: 8px; }

/* ---------- branding ---------- */
.logo .mark.img { background: rgba(255,255,255,.06); box-shadow: none; padding: 4px; overflow: hidden; }
.logo .mark.img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-grid { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
.brand-preview { padding: 18px; border-radius: 14px; background: rgba(0,0,0,.2); border: 1px solid var(--line-2); display: flex; flex-direction: column; align-items: flex-start; }
.brand-preview .logo { padding: 0; }
.brand-preview .logo .mark { width: 56px; height: 56px; font-size: 18px; border-radius: 14px; }
@media (max-width: 860px) { .brand-grid { grid-template-columns: 1fr; } }

.danger-zone { border-color: rgba(255,77,109,.3); } .danger-zone::before { background: linear-gradient(90deg, transparent, rgba(255,77,109,.6), transparent); }

/* ---------- batch sheet rows ---------- */
.preview-row.sheet { grid-template-columns: 1fr auto minmax(120px, auto); padding: 12px 14px; }
.preview-row.sheet .weigh { font-size: 20px; font-weight: 800; letter-spacing: -.01em; color: var(--brand-light); }
.preview-row.sheet .swatch { vertical-align: middle; }

/* ---------- how you buy it ---------- */
.buy-box { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: rgba(10,173,235,.05); display: grid; gap: 12px; }
.buy-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; flex-wrap: wrap; }
.buy-result { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,.22); }
.buy-result .per { color: var(--brand-light); font-size: 15px; }
input:disabled { opacity: .55; }

/* ---------- ingredient cards ---------- */
.ing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.ing { position: relative; overflow: hidden; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.ing::after { content: ""; position: absolute; width: 180px; height: 180px; right: -70px; top: -70px; border-radius: 50%; background: var(--c); opacity: .13; filter: blur(30px); pointer-events: none; }
.ing.low { border-color: rgba(255,176,32,.35); } .ing.critical, .ing.out { border-color: rgba(255,77,109,.4); }
.ing-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ing-top .name { font-family: var(--font-serif); font-size: 19px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.ing-top .name .swatch { width: 12px; height: 12px; }
.ing-top .sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.ing-mid { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; }
.ing-num { font-size: 38px; font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.ing-num small { font-size: 14px; color: var(--muted); font-weight: 600; margin-left: 6px; }
.ing-num + .meta { font-size: 12px; color: var(--muted); margin-top: 6px; }
.ing-num-wrap .bagsline { font-size: 13px; margin-top: 8px; color: var(--brand-light); font-weight: 600; }
.ring.sm { width: 92px; height: 92px; } .ring.sm circle { stroke-width: 9; } .ring.sm .center b { font-size: 17px; } .ring.sm .center small { font-size: 9px; }
.ring .bar.low { stroke: var(--warn); filter: drop-shadow(0 0 8px rgba(255,176,32,.6)); } .ring .bar.critical, .ring .bar.out { stroke: var(--bad); filter: drop-shadow(0 0 8px rgba(255,77,109,.6)); }
.ing-bar { height: 8px; border-radius: 8px; background: rgba(184,232,248,.08); position: relative; overflow: visible; }
.ing-bar .fill { height: 100%; border-radius: 8px; background: var(--c); box-shadow: 0 0 12px var(--c); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.ing-bar .rp { position: absolute; top: -4px; width: 2px; height: 16px; background: #fff; opacity: .7; } .ing-bar .rp::after { content: "reorder"; position: absolute; top: 18px; left: -18px; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ing-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.ing-facts b { display: block; color: var(--text); font-size: 13px; font-weight: 600; }
.ing-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }
.ing-actions .btn { flex: 1; }
.summary-strip { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.summary-strip .chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.summary-strip .chip b { font-size: 15px; }

.line .conv { grid-column: 1 / -1; font-size: 12px; color: var(--brand-light); padding: 0 4px 4px; margin-top: -2px; }
.line .conv:empty { display: none; }

/* ---------- profit flow ---------- */
.sankey { width: 100%; height: auto; display: block; }
.sankey .sk-link { transition: opacity .2s; } .sankey .sk-link:hover { opacity: .85; filter: brightness(1.3); }
.sankey text { fill: var(--text); font-family: var(--font-sans); }
.sankey .sk-title { font-size: 13px; fill: var(--muted); letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }
.sankey .sk-big { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.sankey .sk-sub { font-size: 12px; fill: var(--muted); }
.sankey .sk-label { font-size: 14px; } .sankey .sk-name { font-weight: 600; } .sankey .sk-val { font-weight: 800; fill: var(--brand-light); } .sankey .sk-pct { fill: var(--muted); font-size: 12px; }
.line.xc { grid-template-columns: 1.6fr .8fr auto auto; }
@media (max-width: 860px) { .sankey .sk-label { font-size: 18px; } .sankey .sk-sub { font-size: 15px; } .sankey .sk-title { font-size: 15px; } .sankey .sk-big { font-size: 30px; } }

/* ---------- security card ---------- */
.sec-grid { display: flex; flex-direction: column; }
.sec-row { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.sec-row:last-child { border-bottom: 0; } .sec-row b { display: block; font-size: 14px; } .sec-row small { color: var(--muted); font-size: 12px; line-height: 1.5; }

/* ---------- current user in sidebar ---------- */
.whoami { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 10px; border-radius: 12px; background: rgba(0,0,0,.22); border: 1px solid var(--line-2); }
.whoami .who b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.whoami .who small { font-size: 11px; color: var(--muted); text-transform: capitalize; }
.login-card input { text-align: left; }

/* ---------- installed web app (home screen): respect the notch / status bar ---------- */
@media (display-mode: standalone) {
  .main { padding-top: calc(22px + env(safe-area-inset-top)); }
  .sidebar { top: calc(14px + env(safe-area-inset-top)); left: calc(14px + env(safe-area-inset-left)); bottom: calc(14px + env(safe-area-inset-bottom)); }
  @media (max-width: 860px) { .sidebar { top: 0; bottom: 0; left: 0; padding-top: calc(18px + env(safe-area-inset-top)); } .main { padding-top: calc(14px + env(safe-area-inset-top)); } }
  .login { padding-top: env(safe-area-inset-top); }
}
