:root {
  --primary: #4086f5; --primary-dark: #2d6fd4; --primary-light: #6ea2f8; --primary-soft: #ecf4ff;
  --blue: var(--primary); --blue-weak: var(--primary-soft); --ink: #222; --muted: #999; --text-2: #666;
  --line: #eee; --bg: #f5f7f9; --card: #fff; --green: #52c41a; --orange: #ff9500; --red: #f53f3f;
  --radius: 12px; --shell-max: 448px; --tabbar-h: 64px;
  --cta-gradient: linear-gradient(90deg, var(--primary-light), var(--primary-dark));
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif; -webkit-tap-highlight-color: transparent; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; outline: none; }
.phone { width: 100%; max-width: var(--shell-max); height: 100vh; height: 100dvh; margin: 0 auto; background: var(--bg); overflow: hidden; display: flex; flex-direction: column; position: relative; }
.topbar { min-height: 64px; flex: 0 0 64px; padding: 12px 16px 8px; background: rgba(255,255,255,.98); display: flex; align-items: center; justify-content: space-between; gap: 8px; position: relative; z-index: 30; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; }
.brandmark { display: none; }
.top-action { width: 40px; height: 32px; padding: 6px 10px; border: 0; background: transparent; color: #333; display: grid; place-items: center; }
.topbar > div[style*="border-radius:999px"] { height: 32px !important; border: 1px solid var(--line) !important; background: #fff !important; box-shadow: 0 3px 10px rgba(0,0,0,.05); }
.topbar > div[style*="border-radius:999px"] .top-action + .top-action { border-left: 1px solid var(--line); }
.content { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 16px calc(24px + var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); -webkit-overflow-scrolling: touch; }
.screen { display: none; min-height: 0; }
.screen.active { display: flex; flex: 1; min-height: 0; flex-direction: column; overflow: hidden; animation: fade .15s ease-out; }
.screen.content.active { display: block; flex: 1; overflow-y: auto; }
.view { position: absolute; inset: 0; background: var(--bg); z-index: 60; display: none; flex-direction: column; }
.view.active { display: flex; animation: slide .2s ease-out; }
.view .topbar { border-bottom: 1px solid var(--line); }
.view .topbar > b { position: absolute; left: 50%; transform: translateX(-50%); font-size: 16px; }
.view .content { padding-bottom: 28px; }
.card, .list-card { background: #fff; border: 1px solid rgba(0,0,0,.03); border-radius: var(--radius); box-shadow: none; }
.section-title { font-size: 14px; font-weight: 700; margin: 4px 0 12px; }
.subtle { font-size: 12px; color: var(--muted); }
.grid2 { display: flex; flex-direction: column; gap: 12px; }
#portal { padding-top: 14px; }
#portal > .subtle { font-size: 13px; line-height: 1.5; margin: 0 0 12px; }
.portal-card { width: 100%; min-height: 72px; border: 0; padding: 12px; background: #fff; border-radius: 14px; display: flex; flex-direction: row; align-items: center; gap: 10px; color: var(--ink); text-align: left; box-shadow: none; position: relative; }
.portal-card::after { content: "›"; margin-left: auto; color: #cbd5e1; font-size: 24px; font-weight: 300; }
.portal-icon { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px; background: var(--primary); color: #fff; display: grid; place-items: center; box-shadow: none; }
.portal-icon svg { width: 22px; height: 22px; }
.portal-card b { font-size: 16px; font-weight: 700; }
.toolbar { background: var(--bg); padding: 8px 16px; display: flex; align-items: center; gap: 8px; }
.toolbar + .toolbar { padding-top: 4px; }
.toolbar .segmented { flex: 1; }
.segmented { display: flex; gap: 8px; padding: 0; background: transparent; overflow-x: auto; }
.segmented button, .chips button { border: 0; color: var(--ink); white-space: nowrap; }
.segmented button { flex: 1; min-height: 36px; padding: 8px 12px; border-radius: 999px; font-size: 14px; font-weight: 500; background: #fff; }
.segmented button.active { background: var(--primary-soft); color: var(--primary); box-shadow: none; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { padding: 6px 10px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 12px; }
.chips button.active { background: var(--primary-soft); color: var(--primary); border-color: rgba(64,134,245,.2); }
.search { height: 40px; background: #fff; border: 1px solid rgba(0,0,0,.03); border-radius: 12px; display: flex; align-items: center; gap: 8px; padding: 0 12px; margin-bottom: 10px; }
.search input { border: 0; outline: 0; background: transparent; min-width: 0; width: 100%; font-size: 13px; color: var(--ink); }
.list { display: flex; flex-direction: column; gap: 12px; }
.list-card { width: 100%; text-align: left; padding: 14px 16px; color: inherit; }
.list-card:active, .portal-card:active, .menu-item:active { transform: scale(.99); filter: brightness(.985); }
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.gap8 { gap: 8px; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mb10 { margin-bottom: 10px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.title14 { font-size: 14px; font-weight: 700; }
.text12 { font-size: 12px; }
.text11 { font-size: 11px; }
.muted { color: var(--muted); }
.tag { display: inline-flex; align-items: center; padding: 3px 7px; border-radius: 4px; font-size: 10px; font-weight: 600; white-space: nowrap; }
.tag::before { display: none; }
.tag-blue { background: rgba(64,134,245,.1); color: var(--primary); }
.tag-green { background: rgba(82,196,26,.1); color: #3ea20f; }
.tag-orange { background: rgba(255,149,0,.1); color: #e18400; }
.tag-red { background: #fff0f0; color: var(--red); }
.tag-gray { background: rgba(17,24,39,.07); color: #7b8491; }
.material-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); }
.material-line:first-child { border-top: 0; }
.material-meta { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mat-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex: 0 0 auto; }
.qty { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.source-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.source { font-size: 10px; padding: 3px 7px; border-radius: 999px; border: 1px solid rgba(64,134,245,.12); background: var(--primary-soft); color: var(--primary); }
.btn { height: 38px; border-radius: 20px; border: 1px solid var(--line); background: #fff; color: #4f5c6d; padding: 0 15px; font-size: 13px; font-weight: 600; }
.btn-primary { background: var(--cta-gradient); color: #fff; border-color: transparent; box-shadow: none; }
.btn-danger { color: var(--red); border-color: rgba(245,63,63,.2); background: #fff; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
.bottom-nav { height: var(--tabbar-h); flex: 0 0 var(--tabbar-h); background: #fff; border-top: 0; display: flex; z-index: 35; padding-bottom: env(safe-area-inset-bottom, 0px); }
.bottom-nav button { flex: 1; border: 0; background: transparent; color: #8f959e; font-size: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; }
.bottom-nav button.active { color: var(--primary); font-weight: 600; }
.bottom-nav svg { width: 21px; height: 21px; stroke-width: 1.7; }
.stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.stat { padding: 13px 12px; background: #fff; border: 1px solid rgba(0,0,0,.03); border-radius: 12px; text-align: center; }
.stat b { font-size: 18px; display: block; margin-top: 5px; }
.stat span { font-size: 11px; color: var(--muted); }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-top: 1px solid var(--line); }
.info-grid div { padding: 12px; border-bottom: 1px solid var(--line); }
.info-grid div:nth-child(odd) { border-right: 1px solid var(--line); }
.info-grid span, .info-row span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.info-grid b, .info-row b { font-size: 13px; font-weight: 600; }
.info-row { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.timeline { padding: 4px 3px; }
.timeline-item { display: grid; grid-template-columns: 12px 1fr; gap: 9px; position: relative; padding-bottom: 16px; }
.timeline-item::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); margin-top: 5px; z-index: 1; }
.timeline-item:not(:last-child)::after { content: ""; position: absolute; left: 3px; top: 12px; bottom: 0; width: 1px; background: #dbe4ef; }
.timeline-item b { font-size: 12px; }
.timeline-item p { font-size: 10px; color: var(--muted); margin: 3px 0 0; }
.sheet-mask, .modal-mask { position: absolute; inset: 0; background: rgba(18,28,42,.43); z-index: 90; display: none; }
.sheet-mask.open, .modal-mask.open { display: flex; }
.sheet-mask { align-items: flex-end; }
.sheet { width: 100%; max-height: 88%; background: #fff; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; animation: up .25s ease-out; box-shadow: 0 -12px 32px rgba(0,0,0,.18); }
.sheet-head { height: 56px; padding: 0 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.sheet-body { padding: 16px; overflow: auto; }
.sheet-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom,0px)); border-top: 1px solid var(--line); background: #fff; }
.form-item { margin-bottom: 14px; }
.form-item label { font-size: 12px; color: var(--text-2); font-weight: 600; display: block; margin-bottom: 7px; }
.control { width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 0 12px; font-size: 13px; outline: none; }
.control:focus { border-color: rgba(64,134,245,.5); box-shadow: 0 0 0 3px rgba(64,134,245,.08); }
.textarea { height: 86px; padding-top: 10px; resize: none; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--primary); }
.modal-mask { align-items: center; justify-content: center; padding: 24px; }
.modal { width: 100%; background: #fff; border-radius: 16px; padding: 20px; }
.toast { position: absolute; left: 50%; top: 72px; transform: translateX(-50%) translateY(-8px); background: #222; color: #fff; border-radius: 8px; padding: 9px 14px; font-size: 12px; z-index: 120; opacity: 0; pointer-events: none; transition: .2s; white-space: nowrap; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.help-btn { position: absolute; right: 16px; bottom: 78px; width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; z-index: 70; box-shadow: 0 8px 20px rgba(64,134,245,.28); }
#worker-app .help-btn { bottom: 16px; }
.help-sheet { max-height: 82%; }
.prd-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; }
.prd-tabs button { border: 0; border-radius: 8px; background: var(--bg); color: var(--text-2); padding: 6px 9px; font-size: 10px; white-space: nowrap; }
.prd-tabs button.active { background: var(--primary-soft); color: var(--primary); }
.prd-table { width: 100%; border-collapse: collapse; font-size: 10px; margin: 7px 0 14px; }
.prd-table th, .prd-table td { border: 1px solid var(--line); padding: 7px; text-align: left; vertical-align: top; }
.prd-table th { background: var(--bg); color: var(--text-2); }
.prd-block h4 { font-size: 12px; margin: 13px 0 7px; }
.empty { text-align: center; padding: 42px 10px; color: var(--muted); font-size: 12px; }
.avatar { width: 54px; height: 54px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 20px; font-weight: 700; }
.menu-list { display: flex; flex-direction: column; gap: 0; background: #fff; border-radius: 12px; overflow: hidden; }
.menu-item { min-height: 48px; padding: 0 14px; background: #fff; border: 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 11px; font-size: 14px; text-align: left; }
.menu-item:last-child { border-bottom: 0; }
.menu-item i { color: var(--primary); font-style: normal; }
.chev { margin-left: auto; color: #cbd5e1; }
.safe-bottom { padding-bottom: calc(14px + env(safe-area-inset-bottom,0px)); }
#admin-app #profile { position: relative; padding-top: 92px; }
#admin-app #profile::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 150px; background: linear-gradient(165deg, var(--primary-light), var(--primary) 48%, var(--primary-dark)); border-radius: 0 0 50% 50% / 0 0 22px 22px; box-shadow: 0 14px 32px rgba(64,134,245,.2); }
#admin-app #profile > * { position: relative; z-index: 2; }
#admin-app #profile > .card { border-color: rgba(0,0,0,.04); }
@keyframes fade { from { opacity: .4; } to { opacity: 1; } }
@keyframes slide { from { transform: translateX(10px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@media (min-width: 800px) { .phone { border-left: 1px solid rgba(0,0,0,.04); border-right: 1px solid rgba(0,0,0,.04); } }
