:root {
  --ink: #111412;
  --muted: #6b716d;
  --paper: #f4f5f1;
  --white: #ffffff;
  --line: #dfe2dc;
  --blue: #155eef;
  --blue-soft: #e9f0ff;
  --lime: #c9f05a;
  --amber: #f5b83b;
  --red: #d74545;
  --green: #177a50;
  --radius: 8px;
  --shadow: 0 18px 45px rgba(20, 25, 22, 0.1);
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "Microsoft YaHei", "Noto Sans SC", sans-serif; letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { color: inherit; }
button, select { cursor: pointer; }

[hidden], .permission-denied { display: none !important; }
.app-shell.is-locked { display: none; }

.auth-screen { width: 100%; max-width: 480px; min-height: 100vh; margin: 0 auto; padding: max(26px, env(safe-area-inset-top)) 22px max(28px, env(safe-area-inset-bottom)); color: #f5f7f3; background: var(--ink); display: flex; flex-direction: column; position: relative; overflow: hidden; }
.auth-screen::before { content: ""; position: absolute; inset: 0; opacity: .14; background-image: linear-gradient(#ffffff18 1px, transparent 1px), linear-gradient(90deg, #ffffff18 1px, transparent 1px); background-size: 34px 34px; pointer-events: none; }
.auth-screen::after { content: "PK / ACCESS"; position: absolute; right: -9px; top: 92px; color: #272d28; font: 900 58px/1 Bahnschrift, sans-serif; writing-mode: vertical-rl; pointer-events: none; }
.auth-masthead, .auth-copy, .login-form, .auth-status { position: relative; z-index: 1; }
.auth-masthead { display: flex; align-items: center; gap: 11px; }
.auth-brand-mark { width: 42px; height: 42px; display: grid; place-items: center; color: var(--ink); background: var(--lime); border-radius: 5px; font: 800 23px/1 Bahnschrift, sans-serif; }
.auth-masthead strong, .auth-masthead small { display: block; }
.auth-masthead strong { font-size: 19px; }
.auth-masthead small { margin-top: 3px; color: #879189; font: 600 9px/1 Bahnschrift, sans-serif; letter-spacing: 1.7px; }
.auth-copy { margin-top: clamp(68px, 15vh, 128px); }
.auth-copy span { color: var(--lime); font: 700 10px/1 Bahnschrift, sans-serif; letter-spacing: 1.6px; }
.auth-copy h1 { max-width: 310px; margin: 13px 0 10px; font-size: 36px; line-height: 1.12; }
.auth-copy p { margin: 0; color: #98a199; font-size: 12px; }
.login-form { margin-top: 34px; padding: 20px; border: 1px solid #343a35; border-radius: var(--radius); background: #1a1f1b; display: grid; gap: 15px; box-shadow: 0 22px 60px rgba(0,0,0,.24); }
.login-form label, .auth-form > label, .auth-form #new-user-fields > label { display: grid; gap: 7px; }
.login-form label span, .auth-form label > span { color: #aab2ac; font-size: 10px; font-weight: 700; }
.login-form input { width: 100%; min-height: 48px; padding: 0 13px; color: #fff; background: #111412; border: 1px solid #353c37; border-radius: 5px; outline: 0; }
.login-form input:focus { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(201,240,90,.1); }
.login-form .submit-button { color: var(--ink); background: var(--lime); }
.form-error { min-height: 16px; margin: -3px 0 0; color: #ff8a82; font-size: 10px; line-height: 1.5; }
.auth-status { margin: auto 0 0; padding-top: 24px; color: #747e77; font-size: 9px; text-align: center; }

@media (min-width: 681px) {
  .auth-screen { max-width: none; padding: 42px clamp(48px, 8vw, 140px); display: grid; grid-template-columns: minmax(360px, 1fr) minmax(360px, 440px); grid-template-rows: auto minmax(520px, 1fr) auto; column-gap: clamp(56px, 10vw, 180px); }
  .auth-screen::after { right: auto; left: clamp(48px, 8vw, 140px); top: auto; bottom: 18px; color: #202521; font-size: clamp(76px, 9vw, 144px); writing-mode: horizontal-tb; }
  .auth-masthead { grid-column: 1 / -1; }
  .auth-copy { grid-column: 1; grid-row: 2; align-self: center; margin: 0; }
  .auth-copy h1 { max-width: 560px; font-size: clamp(46px, 5vw, 72px); }
  .auth-copy p { font-size: 14px; }
  .login-form { grid-column: 2; grid-row: 2; align-self: center; width: 100%; margin: 0; padding: 28px; gap: 18px; }
  .auth-status { grid-column: 2; grid-row: 3; margin: 0; padding: 0; text-align: right; }
}

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: 228px; padding: 24px 18px; color: #f8faf7; background: var(--ink); display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 30px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; color: var(--ink); background: var(--lime); border-radius: 5px; font: 800 21px/1 Bahnschrift, sans-serif; }
.brand strong { display: block; font-size: 19px; }
.brand small { display: block; margin-top: 3px; color: #8f9993; font: 600 9px/1 Bahnschrift, sans-serif; letter-spacing: 1.7px; }
.side-nav { display: grid; gap: 5px; }
.nav-item { height: 46px; padding: 0 12px; border: 0; border-radius: 6px; color: #aeb6b1; background: transparent; display: flex; align-items: center; gap: 12px; text-align: left; transition: .18s ease; }
.nav-item span { width: 22px; font: 700 20px/1 Bahnschrift, sans-serif; text-align: center; }
.nav-item:hover { color: #fff; background: #202521; }
.nav-item.active { color: var(--ink); background: var(--lime); font-weight: 700; }
.sidebar-foot { margin-top: auto; padding: 16px 10px 2px; border-top: 1px solid #2c322e; display: flex; gap: 10px; align-items: center; }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgba(201, 240, 90, .1); }
.sync-dot.syncing { background: var(--amber); animation: sync-pulse 1.1s ease-in-out infinite; }
.sync-dot.failed { background: var(--red); box-shadow: 0 0 0 4px rgba(196, 55, 45, .12); }
.sync-dot.waiting { background: #8e9891; box-shadow: 0 0 0 4px rgba(142, 152, 145, .12); }
.sidebar-foot strong, .sidebar-foot small { display: block; }
.sidebar-foot strong { font-size: 12px; }
.sidebar-foot small { margin-top: 2px; color: #859089; font-size: 10px; }

.main-content { min-height: 100vh; margin-left: 228px; padding: 0 34px 52px; }
.topbar { min-height: 106px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.eyebrow, .section-kicker { margin: 0 0 4px; color: var(--muted); font: 700 10px/1.2 Bahnschrift, sans-serif; text-transform: uppercase; letter-spacing: 1.3px; }
.topbar h1 { margin: 0; font-size: 26px; line-height: 1.25; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.global-search { width: min(280px, 24vw); height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: #e9ebe6; border: 1px solid transparent; border-radius: 6px; }
.global-search:focus-within { background: #fff; border-color: var(--blue); }
.global-search span { font: 700 20px/1 Bahnschrift, sans-serif; }
.global-search input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 13px; }
.icon-button, .user-button, .close-button { border: 0; display: grid; place-items: center; }
.icon-button { width: 42px; height: 42px; border-radius: 6px; background: #fff; border: 1px solid var(--line); font: 800 16px/1 Bahnschrift; }
.icon-button:disabled, .submit-button:disabled, .outline-button:disabled { cursor: wait; opacity: .58; }
.sync-button { color: var(--green); transition: color .2s ease, background .2s ease, transform .2s ease; }
.sync-button.syncing { color: #8a6500; background: #fff8e3; animation: sync-spin 1s linear infinite; }
.sync-button.failed { color: var(--red); background: #fff3f1; }
.sync-button.waiting { color: var(--muted); }
.mobile-search-button { display: none; }
.user-button { width: 42px; height: 42px; border-radius: 50%; color: #fff; background: var(--blue); font-weight: 700; }

.page { display: none; padding-top: 26px; animation: page-in .28s ease both; }
.page.active { display: block; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.hero-strip { min-height: 168px; padding: 28px 30px; color: #f7faf7; background: var(--ink); border-radius: var(--radius); display: flex; justify-content: space-between; align-items: flex-end; position: relative; overflow: hidden; }
.hero-strip::after { content: "PK / 01"; position: absolute; right: 26%; top: 18px; color: #232923; font: 900 70px/1 Bahnschrift, sans-serif; }
.hero-strip > * { position: relative; z-index: 1; }
.status-label { display: inline-block; margin-bottom: 15px; color: var(--lime); font-size: 11px; font-weight: 700; }
.hero-strip h2 { margin: 0 0 8px; font-size: clamp(24px, 3vw, 38px); line-height: 1.1; }
.hero-strip p { margin: 0; color: #aeb7b0; font-size: 13px; }
.primary-button, .submit-button, .outline-button, .text-button { border: 0; border-radius: 6px; font-weight: 700; }
.primary-button { min-height: 42px; padding: 0 16px; background: var(--lime); display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; }
.primary-button.compact { min-height: 34px; padding-inline: 11px; font-size: 11px; }
.primary-button span { font-size: 19px; line-height: 1; }
.primary-button.accent, .submit-button.accent { color: #fff; background: var(--blue); }
.outline-button { min-height: 38px; padding: 0 13px; background: #fff; border: 1px solid var(--line); }
.danger-outline-button { color: var(--red); border-color: #e8b8b3; background: #fff7f6; }
.text-button { padding: 6px 0; color: var(--blue); background: transparent; font-size: 12px; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 14px 0 22px; }
.metric-card { min-height: 118px; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.metric-top span:first-child { color: var(--muted); font-size: 12px; }
.metric-change { padding: 3px 6px; border-radius: 4px; color: var(--green); background: #e9f6ef; font: 700 10px/1.2 Bahnschrift; }
.metric-card strong { display: block; margin-top: 12px; font: 700 25px/1 Bahnschrift, "Microsoft YaHei", sans-serif; }
.metric-card small { display: block; margin-top: 9px; color: #929892; font-size: 10px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 14px; }
.content-block { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.section-head { min-height: 68px; padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.section-head h3 { margin: 0; font-size: 17px; }
.period-pill, .privacy-note { color: var(--muted); font-size: 11px; }
.period-pill { padding: 5px 8px; background: var(--paper); border-radius: 4px; }
.compact-list { padding: 0 18px; }
.stock-row { min-height: 78px; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; border-bottom: 1px solid #eceeea; }
.stock-row:last-child { border-bottom: 0; }
.part-thumb { width: 42px; height: 42px; border-radius: 6px; display: grid; place-items: center; color: #fff; background: var(--ink); font: 800 10px/1 Bahnschrift, sans-serif; }
.part-thumb.gpu { background: var(--blue); }
.part-thumb.cpu { color: var(--ink); background: var(--amber); }
.part-thumb.ram { background: var(--green); }
.part-thumb.notebook { background: #3d5568; }
.part-thumb.monitor { color: var(--ink); background: #efcc62; }
.part-thumb.accessory { background: #8b5e48; }
.part-thumb.assembly { color: var(--ink); background: var(--lime); border: 1px solid #aacb42; }
.stock-info { min-width: 0; }
.stock-info strong, .stock-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stock-info strong { font-size: 13px; }
.stock-info small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.stock-owner { color: var(--muted); font-size: 11px; }
.stock-price { text-align: right; }
.stock-price strong, .stock-price small { display: block; }
.stock-price strong { font: 700 13px/1 Bahnschrift; }
.stock-price small { margin-top: 4px; color: var(--green); font-size: 10px; }
.profit-highlight { padding: 22px 18px; background: var(--blue-soft); border-bottom: 1px solid #d7e2fa; }
.profit-highlight small, .profit-highlight strong, .profit-highlight span { display: block; }
.profit-highlight small { color: #4d638c; font-size: 11px; }
.profit-highlight strong { margin: 7px 0 8px; color: #0c49bb; font: 800 32px/1 Bahnschrift; }
.profit-highlight span { color: var(--green); font-size: 11px; }
.seller-list { padding: 8px 18px 12px; }
.seller-row { min-height: 48px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #eceeea; }
.seller-row:last-child { border-bottom: 0; }
.seller-row span { font-size: 12px; }
.seller-row strong { font: 700 13px/1 Bahnschrift; }
.alert-block { margin-top: 14px; }
.count-badge { min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; color: #fff; background: var(--red); display: grid; place-items: center; font: 700 11px/1 Bahnschrift; }
.alert-list { display: grid; grid-template-columns: repeat(3, 1fr); }
.alert-item { min-height: 78px; padding: 16px 18px; border-right: 1px solid var(--line); display: flex; gap: 11px; align-items: flex-start; }
.alert-item:last-child { border-right: 0; }
.alert-icon { width: 28px; height: 28px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; color: #794a00; background: #fff1d2; font-weight: 800; }
.alert-item strong, .alert-item small { display: block; }
.alert-item strong { font-size: 12px; }
.alert-item small { margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.5; }

.page-actions { min-height: 48px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 7px; }
.filter-chip { min-height: 34px; padding: 0 13px; border-radius: 5px; color: var(--muted); background: transparent; border: 1px solid var(--line); font-size: 12px; }
.filter-chip.active { color: #fff; background: var(--ink); border-color: var(--ink); }
.inventory-summary, .sales-metrics { display: grid; gap: 10px; margin-bottom: 14px; }
.inventory-summary { grid-template-columns: repeat(4, 1fr); }
.sales-metrics { grid-template-columns: repeat(3, 1fr); }
.summary-item, .sales-metric { min-height: 82px; padding: 15px 16px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); }
.summary-item span, .sales-metric span { display: block; color: var(--muted); font-size: 10px; }
.summary-item strong, .sales-metric strong { display: block; margin-top: 8px; font: 700 20px/1 Bahnschrift; }
.inventory-table-wrap { overflow-x: auto; }
.inventory-table { width: 100%; border-collapse: collapse; min-width: 970px; }
.inventory-table th { padding: 13px 14px; color: var(--muted); background: #f9faf7; border-bottom: 1px solid var(--line); font-size: 10px; text-align: left; }
.inventory-table td { padding: 15px 14px; border-bottom: 1px solid #eceeea; font-size: 11px; vertical-align: middle; }
.inventory-table td > small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.inventory-table tr:last-child td { border-bottom: 0; }
.part-cell { min-width: 240px; display: flex; align-items: center; gap: 10px; }
.part-cell strong, .part-cell small, .owner-cell strong, .owner-cell small, .price-cell strong, .price-cell small { display: block; }
.part-cell small, .owner-cell small, .price-cell small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.price-cell small { color: var(--green); }
.package-tag, .status-tag { display: inline-flex; align-items: center; min-height: 24px; padding: 0 7px; border-radius: 4px; white-space: nowrap; font-size: 9px; }
.package-tag { color: #6b4b00; background: #fff2cf; }
.status-tag { color: var(--green); background: #e8f5ed; }
.status-tag.sold { color: #68706b; background: #eceeeb; }
.status-tag.assembled { color: #3f5900; background: #edf8ce; }
.assembly-row { background: #fbfdf5; }
.assembly-components { max-width: 430px; line-height: 1.5; }
.assembly-membership { color: #557300 !important; font-weight: 700; line-height: 1.5; }
.dissolve-button { display: block; margin-top: 6px; color: var(--red); }
.inventory-cards { display: none; }
.empty-state { padding: 34px 20px; color: var(--muted); text-align: center; font-size: 12px; }

.page-note { margin: 0; color: var(--muted); font-size: 12px; }
.workflow-strip { min-height: 66px; margin-bottom: 14px; padding: 14px 20px; display: flex; align-items: center; justify-content: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.workflow-step { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.workflow-step b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: #a4aaa5; font: 700 10px/1 Bahnschrift; }
.workflow-step.active { color: var(--ink); font-weight: 700; }
.workflow-step.active b { color: var(--ink); background: var(--lime); }
.workflow-strip i { width: 60px; height: 1px; background: var(--line); }
.timeline { padding: 8px 18px; }
.timeline-item { display: grid; grid-template-columns: 90px 16px minmax(0, 1fr) auto; gap: 12px; min-height: 76px; align-items: center; }
.timeline-date strong, .timeline-date small { display: block; }
.timeline-date strong { font: 700 12px/1 Bahnschrift; }
.timeline-date small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.timeline-mark { position: relative; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); }
.timeline-mark.assembly { background: #8aad24; box-shadow: 0 0 0 4px #edf8ce; }
.timeline-mark::after { content: ""; position: absolute; left: 4px; top: 14px; width: 1px; height: 58px; background: var(--line); }
.timeline-item:last-child .timeline-mark::after { display: none; }
.timeline-copy strong, .timeline-copy small { display: block; }
.timeline-copy strong { font-size: 12px; }
.timeline-copy small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.timeline-amount { text-align: right; }
.timeline-amount strong, .timeline-amount small { display: block; }
.timeline-amount strong { font: 700 13px/1 Bahnschrift; }
.timeline-amount small { margin-top: 4px; color: var(--muted); font-size: 9px; }

.sales-tabs { padding: 3px; background: #e5e8e2; border-radius: 6px; display: flex; }
.sales-tabs button, .mode-switch button { border: 0; background: transparent; }
.sales-tabs button { min-height: 34px; padding: 0 13px; border-radius: 4px; color: var(--muted); font-size: 11px; }
.sales-tabs button.active { color: var(--ink); background: #fff; box-shadow: 0 1px 4px rgba(20,25,22,.08); font-weight: 700; }
.sales-list { padding: 0 18px; }
.sale-row { min-height: 82px; display: grid; grid-template-columns: 42px minmax(180px, 1.4fr) minmax(120px, .8fr) minmax(120px, .8fr) 90px; gap: 14px; align-items: center; border-bottom: 1px solid #eceeea; }
.sale-row:last-child { border-bottom: 0; }
.sale-kind { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 6px; color: #fff; background: var(--blue); font: 800 10px/1 Bahnschrift; }
.sale-kind.build { color: var(--ink); background: var(--lime); }
.sale-main strong, .sale-main small, .sale-meta strong, .sale-meta small, .sale-profit strong, .sale-profit small { display: block; }
.sale-main strong { font-size: 12px; }
.sale-main small, .sale-meta small, .sale-profit small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.sale-meta strong { font-size: 11px; }
.sale-profit { text-align: right; }
.sale-profit strong { color: var(--green); font: 700 14px/1 Bahnschrift; }
.margin-ring { width: 48px; height: 48px; border-radius: 50%; border: 5px solid var(--blue-soft); border-top-color: var(--blue); display: grid; place-items: center; font: 700 9px/1 Bahnschrift; }

.profile-header { min-height: 140px; margin-bottom: 14px; padding: 26px; display: flex; align-items: center; gap: 18px; color: #fff; background: var(--ink); border-radius: var(--radius); }
.profile-avatar { width: 66px; height: 66px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; color: var(--ink); background: var(--lime); font-size: 24px; font-weight: 800; }
.profile-header h2 { margin: 7px 0 4px; font-size: 24px; }
.profile-header p { margin: 0; color: #aab2ac; font-size: 11px; }
.role-badge { color: var(--lime); font-size: 10px; font-weight: 700; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-list { padding: 4px 18px 10px; }
.settings-list > div { min-height: 54px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #eceeea; font-size: 12px; }
.settings-list > div:last-child { border-bottom: 0; }
.settings-list strong { color: var(--muted); font-size: 10px; }
.toggle { width: 40px; height: 23px; padding: 2px; border: 0; border-radius: 12px; background: #c8cdc8; }
.toggle i { display: block; width: 19px; height: 19px; border-radius: 50%; background: #fff; transition: .2s ease; }
.toggle.active { background: var(--blue); }
.toggle.active i { transform: translateX(17px); }
.data-actions { padding: 20px 18px 10px; display: flex; gap: 9px; flex-wrap: wrap; }
.data-tip { margin: 8px 18px 20px; padding: 12px; color: var(--muted); background: var(--paper); border-radius: 5px; font-size: 10px; line-height: 1.6; }
.account-actions { padding: 12px 18px 18px; display: flex; align-items: center; gap: 10px; }
.danger-text-button { min-height: 38px; padding: 0 12px; border: 0; color: var(--red); background: transparent; font-size: 11px; font-weight: 700; }
.account-admin-block { grid-column: 1 / -1; }
.user-list { padding: 0 16px 8px; }
.user-row { min-height: 72px; padding: 10px 0; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 10px; align-items: center; border-bottom: 1px solid #eceeea; }
.user-row:last-child { border-bottom: 0; }
.user-avatar { width: 38px; height: 38px; border-radius: 5px; display: grid; place-items: center; color: #fff; background: var(--blue); font-weight: 800; }
.user-avatar.warehouse { color: var(--ink); background: var(--amber); }
.user-avatar.sales { color: var(--ink); background: var(--lime); }
.user-info { min-width: 0; }
.user-info strong, .user-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-info strong { font-size: 12px; }
.user-info small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.user-controls { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 5px; }
.role-select { min-height: 32px; max-width: 78px; padding: 0 7px; border: 1px solid var(--line); border-radius: 5px; background: #fff; font-size: 10px; }
.mini-button { min-height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 5px; background: #fff; font-size: 10px; }
.mini-button.danger { color: var(--red); }
.mini-button.enable { color: var(--green); }
.delete-user-button { color: var(--red); border-color: #e8b8b3; background: #fff7f6; }
.delete-user-button:hover { border-color: var(--red); background: #ffefed; }
.user-row.is-disabled { opacity: .55; }

.bottom-nav { display: none; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(9, 12, 10, .48); opacity: 0; pointer-events: none; transition: .2s ease; }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; inset: 0 0 0 auto; z-index: 90; width: min(560px, 100%); background: var(--paper); box-shadow: var(--shadow); transform: translateX(102%); transition: transform .28s ease; overflow-y: auto; }
.drawer.open { transform: none; }
.drawer-head { position: sticky; top: 0; z-index: 2; min-height: 82px; padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; background: rgba(244, 245, 241, .96); border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 21px; }
.close-button { width: 36px; height: 36px; border-radius: 50%; background: #e4e7e1; font-size: 24px; }
.drawer-form { padding: 20px 22px 30px; }
.auth-form { display: grid; gap: 15px; }
.auth-form input, .auth-form select { width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 5px; outline: 0; background: #fff; }
.auth-form input:focus, .auth-form select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.auth-form #new-user-fields { display: grid; gap: 15px; }
.field-hint { margin: -5px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.force-password-note { margin: 0; padding: 11px 12px; color: #694600; background: #fff2cf; border-left: 3px solid var(--amber); font-size: 10px; line-height: 1.5; }
.drawer-form fieldset { margin: 0 0 18px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.drawer-form legend { padding: 0 7px; font-size: 12px; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid label, .standalone-label { display: grid; gap: 6px; min-width: 0; }
.form-grid label.full { grid-column: 1 / -1; }
.form-grid label > span, .standalone-label > span { color: var(--muted); font-size: 10px; font-weight: 700; }
.form-grid input, .form-grid select, .form-grid textarea, .standalone-label input { width: 100%; min-height: 40px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 5px; outline: 0; background: #fff; font-size: 12px; }
.form-grid select:disabled { color: var(--ink); background: #eef0ec; opacity: 1; }
.form-grid textarea { resize: vertical; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus, .standalone-label input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.money-input { min-height: 40px; display: flex; align-items: center; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.money-input:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.money-input b { padding-left: 10px; color: var(--muted); font: 700 12px/1 Bahnschrift; }
.money-input input { border: 0; box-shadow: none !important; }
.form-preview { min-height: 54px; margin-bottom: 12px; padding: 0 15px; display: flex; align-items: center; justify-content: space-between; border-radius: 6px; color: #284008; background: #e9f7c5; }
.form-preview span { font-size: 11px; }
.form-preview strong { font: 800 18px/1 Bahnschrift; }
.numbering-preview { min-height: 60px; margin-bottom: 8px; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px dashed #9ca6a0; border-radius: 6px; background: #fff; }
.numbering-preview span { color: var(--muted); font-size: 10px; white-space: nowrap; }
.numbering-preview strong { color: var(--blue); font: 700 11px/1.5 Bahnschrift, sans-serif; text-align: right; }
.unit-code-group { display: flex !important; flex-wrap: wrap; gap: 4px; white-space: normal !important; overflow: visible !important; }
.unit-code { display: inline-flex; min-height: 20px; padding: 0 5px; align-items: center; border-radius: 3px; color: #174aa6; background: var(--blue-soft); font: 700 9px/1 Bahnschrift, sans-serif; letter-spacing: .2px; }
.unit-code.sold { color: #747b76; background: #eceeeb; text-decoration: line-through; }
.unit-code.assembled { color: #4e6800; background: #edf8ce; border: 1px solid #cfdfa4; }
.unit-number-field { grid-column: 1 / -1; }
.timeline-unit-codes, .sale-unit-codes { color: var(--blue) !important; font-family: Bahnschrift, sans-serif; }
.submit-button { width: 100%; min-height: 48px; color: var(--ink); background: var(--lime); }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 18px; background: #e0e3dd; border-radius: 6px; }
.mode-switch button { min-height: 39px; border-radius: 4px; color: var(--muted); font-size: 12px; }
.mode-switch button.active { color: var(--ink); background: #fff; font-weight: 700; }
.parts-checklist { margin-top: 14px; max-height: 250px; overflow-y: auto; border: 1px solid var(--line); border-radius: 5px; }
.assembly-parts-checklist { max-height: 340px; }
.part-check { min-height: 54px; padding: 8px 10px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #eceeea; }
.part-check:last-child { border-bottom: 0; }
.part-check input { width: 18px; height: 18px; accent-color: var(--blue); }
.part-check span { min-width: 0; flex: 1; }
.part-check strong, .part-check small { display: block; }
.part-check strong { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part-check small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.part-check > b { font: 700 11px/1 Bahnschrift; }
.assembly-card-components { margin-top: 14px; padding: 10px 12px; display: grid; gap: 8px; background: #f4f8e9; border-left: 3px solid #a8ca3e; }
.assembly-card-components > span { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 7px; align-items: center; font-size: 10px; }
.assembly-card-components b { color: #597000; font-size: 9px; }
.assembly-card-components small { color: var(--blue); font: 700 9px/1 Bahnschrift, sans-serif; }
.dissolve-card-button { width: calc(100% - 28px); margin: 14px; color: var(--red); }
.profit-preview-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; }
.profit-preview-grid div { min-height: 64px; padding: 11px; background: #fff; border: 1px solid var(--line); border-radius: 5px; }
.profit-preview-grid span, .profit-preview-grid strong { display: block; }
.profit-preview-grid span { color: var(--muted); font-size: 9px; }
.profit-preview-grid strong { margin-top: 8px; font: 700 15px/1 Bahnschrift; }

.toast { position: fixed; left: 50%; bottom: 26px; z-index: 120; max-width: calc(100vw - 32px); padding: 11px 16px; color: #fff; background: var(--ink); border-radius: 6px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(-50%, 14px); transition: .2s ease; font-size: 12px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes sync-spin { to { transform: rotate(360deg); } }
@keyframes sync-pulse { 50% { opacity: .42; } }

@media (max-width: 960px) {
  .sidebar { width: 76px; padding-inline: 10px; }
  .brand { padding-inline: 9px; }
  .brand > div, .nav-item:not(.active) { color: transparent; }
  .brand > div, .nav-item { overflow: hidden; }
  .nav-item { width: 56px; padding: 0 17px; gap: 20px; white-space: nowrap; }
  .nav-item.active { color: transparent; }
  .nav-item span { color: var(--ink); flex: 0 0 22px; }
  .nav-item:not(.active) span { color: #aeb6b1; }
  .sidebar-foot { display: none; }
  .main-content { margin-left: 76px; padding-inline: 22px; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  body { background: #f5f6f2; }
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 0 14px calc(90px + env(safe-area-inset-bottom)); }
  .topbar { min-height: 78px; gap: 10px; }
  .eyebrow { font-size: 8px; }
  .topbar h1 { font-size: 21px; }
  .global-search { position: absolute; left: 14px; right: 14px; top: 79px; z-index: 2; width: auto; display: none; }
  .global-search.mobile-open { display: flex; }
  .icon-button { width: 38px; height: 38px; }
  .mobile-search-button { display: grid; }
  #notification-button { display: none; }
  .user-button { width: 38px; height: 38px; }
  .page { padding-top: 16px; }
  .hero-strip { min-height: 184px; padding: 22px 18px; align-items: stretch; flex-direction: column; }
  .hero-strip::after { right: 10px; top: 18px; font-size: 51px; }
  .hero-strip h2 { max-width: 250px; font-size: 27px; }
  .hero-strip p { max-width: 270px; line-height: 1.6; }
  .hero-strip .primary-button { width: 100%; margin-top: auto; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
  .metric-card { min-height: 102px; padding: 14px; }
  .metric-card strong { font-size: 20px; }
  .metric-change { display: none; }
  .section-head { min-height: 62px; padding: 14px; }
  .compact-list { padding: 0 14px; }
  .stock-row { grid-template-columns: 39px minmax(0, 1fr) auto; gap: 9px; }
  .part-thumb { width: 39px; height: 39px; }
  .stock-owner { display: none; }
  .alert-list { grid-template-columns: 1fr; }
  .alert-item { border-right: 0; border-bottom: 1px solid var(--line); }
  .alert-item:last-child { border-bottom: 0; }
  .page-actions { align-items: stretch; }
  .page-actions .primary-button { min-width: 44px; padding: 0 11px; }
  .filter-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .filter-chip { flex: 0 0 auto; }
  .inventory-summary, .sales-metrics { gap: 6px; }
  .inventory-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sales-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .summary-item, .sales-metric { min-height: 72px; padding: 12px 10px; }
  .summary-item strong, .sales-metric strong { font-size: 16px; }
  .inventory-table-wrap { display: none; }
  .inventory-cards { display: block; }
  .inventory-card { padding: 15px 14px; border-bottom: 1px solid var(--line); }
  .inventory-card:last-child { border-bottom: 0; }
  .inventory-card-head { display: flex; align-items: center; gap: 10px; }
  .inventory-card-main { min-width: 0; flex: 1; }
  .inventory-card-main strong, .inventory-card-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .inventory-card-main strong { font-size: 12px; }
  .inventory-card-main small { margin-top: 4px; color: var(--muted); font-size: 9px; }
  .inventory-card-profit { text-align: right; }
  .inventory-card-profit strong, .inventory-card-profit small { display: block; }
  .inventory-card-profit strong { font: 700 13px/1 Bahnschrift; }
  .inventory-card-profit small { margin-top: 4px; color: var(--green); font-size: 9px; }
  .inventory-card-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid #eceeea; }
  .inventory-card-meta span { color: var(--muted); font-size: 9px; }
  .inventory-card-meta strong { display: block; margin-top: 4px; font-size: 10px; }
  .page-note { display: none; }
  .workflow-strip { justify-content: flex-start; overflow-x: auto; }
  .workflow-step { flex: 0 0 auto; }
  .workflow-strip i { width: 26px; flex: 0 0 auto; }
  .timeline { padding: 6px 14px; }
  .timeline-item { grid-template-columns: 62px 12px minmax(0, 1fr); gap: 8px; min-height: 82px; }
  .timeline-amount { grid-column: 3; margin-top: -22px; text-align: left; }
  .timeline-amount small { display: none; }
  .sales-tabs { overflow-x: auto; }
  .sales-tabs button { flex: 0 0 auto; padding-inline: 10px; }
  .privacy-note { display: none; }
  .sales-list { padding: 0 14px; }
  .sale-row { grid-template-columns: 38px minmax(0, 1fr) auto; gap: 9px; min-height: 88px; }
  .sale-meta { display: none; }
  .margin-ring { width: 42px; height: 42px; border-width: 4px; }
  .sale-profit { grid-column: 2; margin-top: -25px; text-align: left; }
  .profile-header { padding: 20px 18px; }
  .profile-grid { grid-template-columns: 1fr; }
  .user-row { grid-template-columns: 38px minmax(0, 1fr); align-items: start; }
  .user-controls { grid-column: 1 / -1; padding-left: 48px; justify-content: flex-start; }
  .bottom-nav { position: fixed; inset: auto 0 0; z-index: 60; height: calc(66px + env(safe-area-inset-bottom)); padding: 5px 8px env(safe-area-inset-bottom); background: rgba(255,255,255,.96); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(var(--nav-count, 5), 1fr); box-shadow: 0 -8px 24px rgba(18,22,19,.06); }
  .bottom-nav button { min-width: 0; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #8a908b; }
  .bottom-nav button span { height: 23px; font: 700 20px/1 Bahnschrift; }
  .bottom-nav button small { font-size: 9px; }
  .bottom-nav button.active { color: var(--blue); font-weight: 700; }
  .drawer { inset: auto 0 0; width: 100%; max-height: 92vh; border-radius: 8px 8px 0 0; transform: translateY(102%); }
  .drawer.open { transform: none; }
  .drawer-head { min-height: 72px; padding: 15px 16px; }
  .drawer-form { padding: 16px 14px 26px; }
  .drawer-form fieldset { padding: 14px 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid label.full { grid-column: auto; }
  .profit-preview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .profit-preview-grid div { padding: 10px 8px; }
  .profit-preview-grid strong { font-size: 13px; }
  .toast { bottom: 82px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

@media (max-width: 360px) {
  .topbar h1 { font-size: 19px; }
  .hero-strip h2 { font-size: 24px; }
  .summary-item strong, .sales-metric strong { font-size: 14px; }
  .inventory-card-profit small { max-width: 88px; white-space: normal; }
}
