:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --text: #17221f;
  --muted: #697975;
  --line: #dde6e3;
  --primary: #176b57;
  --primary-2: #0e5342;
  --primary-soft: #dff1eb;
  --danger: #bd3f4a;
  --danger-soft: #fbe7e9;
  --warning: #a86813;
  --warning-soft: #fff1d7;
  --shadow: 0 10px 32px rgba(21, 51, 43, .08);
  --radius: 18px;
  --nav-height: 76px;
  --tg-safe-top: 0px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; max-width: 100%; overflow-x: hidden; background: var(--bg); color: var(--text); }
body { overscroll-behavior: none; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.app-icon { display: inline-block; width: 1em; height: 1em; background: currentColor; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
.shell { min-height: 100vh; padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom)); }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: calc(14px + max(env(safe-area-inset-top), var(--tg-safe-top))) 18px 12px; background: rgba(244,247,246,.88); backdrop-filter: blur(18px); }
.topbar,.content,.fab { transition: opacity .18s ease, transform .18s ease; }
.view-leaving { opacity: 0; transform: translateY(5px); }
.view-enter { opacity: 0; transform: translateY(5px); }
.eyebrow { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.topbar h1 { margin: 3px 0 0; font-size: 22px; letter-spacing: -.025em; }
.avatar { display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--primary); color: white; font-size: 22px; }
.content { width: min(100%, 960px); margin: 0 auto; padding: 6px 16px calc(var(--nav-height) + env(safe-area-inset-bottom) + 36px); }
.hero { color: white; border-radius: 24px; padding: 22px; background: linear-gradient(145deg,#176b57,#0d493b); box-shadow: 0 14px 32px rgba(23,107,87,.22); overflow: hidden; position: relative; }
.hero:after { content: ''; position: absolute; width: 180px; height: 180px; border: 32px solid rgba(255,255,255,.08); border-radius: 50%; right: -72px; top: -78px; }
.hero small { opacity: .75; }
.hero h2 { margin: 8px 0 4px; font-size: 30px; letter-spacing: -.04em; }
.hero p { margin: 0; opacity: .85; font-size: 14px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 24px 2px 12px; }
.section-head h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.section-head button { border: 0; background: transparent; color: var(--primary); font-weight: 650; padding: 6px; }
.quick-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.quick { min-height: 105px; padding: 16px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); text-align: left; box-shadow: 0 4px 15px rgba(21,51,43,.035); }
.quick:active { transform: scale(.98); }
.quick-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); font-size: 20px; margin-bottom: 14px; }
.quick strong { display: block; font-size: 15px; }
.quick span { color: var(--muted); font-size: 12px; }
.stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; margin-top: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 14px 12px; }
.stat strong { display: block; font-size: 22px; letter-spacing: -.04em; }
.stat span { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 15px rgba(21,51,43,.03); }
.list { overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 66px; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.list-row:last-child { border-bottom: 0; }
.thumb { flex: none; display: grid; place-items: center; width: 44px; height: 44px; overflow: hidden; border-radius: 12px; background: var(--surface-2); color: var(--primary); font-size: 20px; font-weight: 750; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.grow { flex: 1; min-width: 0; }
.grow strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.qty { font-size: 14px; font-weight: 700; white-space: nowrap; }
.qty.low { color: var(--danger); }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; font-size: 11px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.badge.draft { background: var(--warning-soft); color: var(--warning); }
.badge.approved { background: #e5efff; color: #3465a4; }
.badge.ordered { background: #eee8ff; color: #6951a8; }
.badge.partial { background: var(--warning-soft); color: var(--warning); }
.badge.received { background: var(--primary-soft); color: var(--primary); }
.badge.cancelled { background: var(--danger-soft); color: var(--danger); }
.search { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 0 13px; margin-bottom: 12px; }
.search input { width: 100%; height: 46px; border: 0; outline: 0; background: transparent; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 14px; padding: 0 16px; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 13px; color: var(--muted); font-size: 13px; }
.chip.active { background: var(--primary); border-color: var(--primary); color: white; }
.fab { position: fixed; right: 18px; bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 28px); z-index: 15; width: 56px; height: 56px; border-radius: 18px; border: 0; background: var(--primary); color: #fff; font-size: 28px; box-shadow: 0 10px 24px rgba(23,107,87,.3); }
.bottom-nav { position: fixed; z-index: 30; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom)); width: min(calc(100% - 24px),720px); height: var(--nav-height); padding: 8px 6px 7px; display: grid; grid-template-columns: repeat(5,1fr); background: #101412; border: 1px solid rgba(255,255,255,.06); border-radius: 22px; box-shadow: 0 13px 34px rgba(13,25,21,.24); transform: translateX(-50%); isolation: isolate; }
.bottom-nav::before { content: ''; position: absolute; z-index: 0; top: -28px; left: var(--active-position); width: 72px; height: 58px; border-radius: 50%; background: var(--bg); transform: translateX(-50%); transition: left .32s cubic-bezier(.4,0,.2,1); }
.nav-active-bubble { position: absolute; z-index: 1; top: -20px; left: var(--active-position); width: 58px; height: 58px; border: 6px solid var(--bg); border-radius: 50%; background: #101412; box-shadow: 0 8px 20px rgba(13,25,21,.22); transform: translateX(-50%); transition: left .32s cubic-bezier(.4,0,.2,1); }
.nav-btn { position: relative; z-index: 1; min-width: 0; border: 0; background: transparent; color: #727b78; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px; padding: 4px 1px; font-size: 10px; transition: color .2s ease; }
.nav-icon-wrap { position: relative; z-index: 2; display: grid; place-items: center; width: 25px; height: 25px; transition: transform .22s ease,color .2s ease; }
.nav-icon { width: 22px; height: 22px; }
.nav-label { overflow: hidden; max-width: 100%; text-overflow: ellipsis; white-space: nowrap; }
.nav-btn.active { color: #fff; font-weight: 750; }
.nav-btn.active .nav-icon-wrap { color: #fff; transform: translateY(-25px); }
.empty { padding: 32px 18px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); margin-bottom: 6px; }
.modal-backdrop { position: fixed; z-index: 100; inset: 0; background: rgba(16,31,27,.42); display: flex; align-items: flex-end; animation: fade .18s ease; }
.modal { width: 100%; max-width: 100%; min-width: 0; max-height: 92vh; overflow-x: hidden; overflow-y: auto; background: var(--bg); border-radius: 26px 26px 0 0; padding: 12px 18px calc(24px + env(safe-area-inset-bottom)); animation: rise .22s ease; }
.modal-handle { width: 38px; height: 4px; border-radius: 4px; background: #c6cfcc; margin: 0 auto 14px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h2 { margin: 0; font-size: 21px; }
.icon-btn { border: 0; background: var(--surface-2); width: 36px; height: 36px; border-radius: 11px; }
.form-grid { display: grid; gap: 14px; }
#check-items { width: 100%; min-width: 0; overflow: hidden; }
#check-items .list-row { min-width: 0; overflow: hidden; }
#check-items [data-check-material] { flex: 0 0 70px; width: 70px; min-width: 0; max-width: 70px; padding: 8px 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); text-align: center; }
.field label { display: block; margin: 0 0 7px 2px; color: var(--muted); font-size: 12px; font-weight: 650; }
.field input,.field select,.field textarea { width: 100%; border: 1px solid var(--line); outline: 0; background: var(--surface); border-radius: 13px; padding: 12px 13px; color: var(--text); }
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus,.field select:focus,.field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn { width: 100%; min-height: 48px; border: 0; border-radius: 14px; padding: 12px 16px; font-weight: 700; }
.btn.primary { background: var(--primary); color: white; }
.btn.secondary { background: var(--surface-2); color: var(--primary); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn:disabled { opacity: .5; }
.actions { display: grid; gap: 10px; margin-top: 18px; }
.photo-pick { min-height: 130px; border: 1.5px dashed #b7c8c3; border-radius: 16px; background: var(--surface); display: grid; place-items: center; text-align: center; color: var(--muted); overflow: hidden; }
.photo-pick img { width: 100%; max-height: 220px; object-fit: contain; }
.detail-photo { width: 100%; max-height: 260px; object-fit: contain; background: white; border-radius: 18px; margin-bottom: 14px; }
.stock-grid { display: grid; gap: 8px; margin-top: 14px; }
.stock-line { display: flex; justify-content: space-between; padding: 12px 13px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.segmented { display: grid; grid-template-columns: repeat(2,1fr); gap: 6px; padding: 5px; background: var(--surface-2); border-radius: 14px; margin-bottom: 16px; }
.segment { border: 0; border-radius: 10px; padding: 9px; background: transparent; color: var(--muted); }
.segment.active { background: white; color: var(--text); box-shadow: 0 2px 8px rgba(21,51,43,.08); font-weight: 700; }
.request-item { padding: 14px; border-bottom: 1px solid var(--line); }
.request-item:last-child { border-bottom: 0; }
.request-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.request-heading { display: flex; align-items: center; gap: 10px; min-width: 0; }
.request-heading > span { min-width: 0; }
.request-heading .meta { display: block; }
.request-heading input,.receipt-row input { flex: 0 0 auto; width: 19px; height: 19px; accent-color: var(--primary); }
.request-items { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.request-material { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; font-size: 13px; }
.request-material span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.request-material b { flex: none; white-space: nowrap; }
.order-builder { position: sticky; z-index: 12; top: calc(78px + var(--tg-safe-top)); display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.94); box-shadow: var(--shadow); backdrop-filter: blur(15px); }
.order-builder span { min-width: 0; }
.order-builder b,.order-builder small { display: block; }
.order-builder small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.order-builder .btn { flex: 0 0 auto; width: auto; min-height: 42px; }
.text-danger { margin-top: 10px; padding: 5px 0; border: 0; background: transparent; color: var(--danger); font-size: 12px; }
.supplier-order .request-title { align-items: flex-start; }
.order-material { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; padding: 10px 0; border-bottom: 1px solid var(--line); }
.order-material:last-child { border-bottom: 0; }
.order-material b,.order-material small { display: block; }
.order-material small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.order-material > strong { flex: none; white-space: nowrap; font-size: 13px; }
.order-preview,.receipt-picker { min-width: 0; overflow: hidden; padding: 0 13px; }
.receipt-row { justify-content: flex-start; }
.request-form { min-width: 0; }
.request-picker { width: 100%; min-width: 0; overflow: hidden; }
.request-row { min-width: 0; overflow: hidden; gap: 9px; padding: 10px 11px; }
.request-row input[type="checkbox"] { flex: 0 0 auto; width: 18px; height: 18px; accent-color: var(--primary); }
.request-row [data-qty] { flex: 0 0 68px; width: 68px; min-width: 0; max-width: 68px; padding: 8px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); text-align: center; }
.request-submit-bar { position: sticky; z-index: 5; bottom: 0; margin-top: 2px; padding: 10px 0 2px; background: linear-gradient(to bottom,rgba(244,247,246,0),var(--bg) 22%); }
.pagination { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 18px 0 0; }
.page-btn { min-width: 38px; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--muted); font-weight: 700; }
.page-btn.active { color: white; background: var(--primary); border-color: var(--primary); }
.page-btn:disabled { opacity: .35; }
.page-btn.arrow { font-size: 21px; line-height: 1; }
.page-gap { color: var(--muted); }
.page-caption { margin-top: 8px; color: var(--muted); font-size: 11px; text-align: center; }
.more-grid { display: grid; gap: 10px; }
.profile-card { display: flex; align-items: center; gap: 13px; width: 100%; margin-bottom: 16px; padding: 15px 16px; border-color: var(--line); text-align: left; color: var(--text); }
.profile-card strong { display: block; margin: 5px 0 1px; font-size: 18px; }
.profile-avatar { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 15px; background: var(--primary); color: white; font-size: 19px; font-weight: 800; }
.profile-arrow { flex: none; color: var(--muted); font-size: 28px; line-height: 1; }
.more-btn { display: flex; align-items: center; gap: 13px; width: 100%; min-height: 62px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); padding: 12px 14px; text-align: left; }
.more-btn i { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--primary-soft); font-style: normal; }
.more-btn i .app-icon { width: 21px; height: 21px; color: var(--primary); }
.more-btn b { display: block; }
.more-btn small { color: var(--muted); }
.toast { position: fixed; z-index: 200; left: 50%; bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 34px); max-width: calc(100% - 32px); transform: translate(-50%,20px); padding: 12px 16px; border-radius: 13px; background: #17221f; color: white; opacity: 0; pointer-events: none; transition: .2s; box-shadow: var(--shadow); font-size: 13px; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
.toast.error { background: var(--danger); }
.splash { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; color: var(--muted); }
.splash strong { color: var(--text); font-size: 20px; }
.splash span { font-size: 13px; }
.brand-mark { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 22px; background: var(--primary); color: white; font-size: 28px; font-weight: 800; box-shadow: 0 12px 30px rgba(23,107,87,.25); }
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; text-align: center; }
.error-page .card { max-width: 420px; padding: 28px; }
.error-page h1 { font-size: 22px; }
.error-page p { color: var(--muted); line-height: 1.5; }
.loading { opacity: .65; pointer-events: none; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(30px); } }
@media (min-width: 720px) {
  .quick-grid { grid-template-columns: repeat(4,1fr); }
  .modal-backdrop { align-items: center; justify-content: center; padding: 24px; }
  .modal { max-width: 620px; border-radius: 26px; max-height: 88vh; }
  .fab { right: calc((100vw - 960px)/2 + 24px); }
}
