:root {
  color-scheme: light;
  --blue: #0066cc;
  --blue-hover: #0071e3;
  --blue-soft: #eaf3ff;
  --ink: #1d1d1f;
  --ink-soft: #424245;
  --muted: #6e6e73;
  --muted-light: #86868b;
  --canvas: #ffffff;
  --parchment: #f5f5f7;
  --pearl: #fafafc;
  --line: #e5e5e7;
  --line-soft: #f0f0f2;
  --green: #248a3d;
  --green-soft: #eef8f0;
  --red: #d70015;
  --red-soft: #fff1f2;
  --shadow-float: 0 18px 50px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .05);
  color: var(--ink);
  font: 15px/1.47 "SF Pro Text", -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-optical-sizing: auto;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-width: 320px; overflow-x: hidden; background: var(--canvas); }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .52; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3, strong { font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; }
h1 { font-size: 28px; line-height: 1.15; font-weight: 600; }
h2 { font-size: 20px; line-height: 1.25; font-weight: 600; }
small { display: block; }
.ui-icon { width: 17px; height: 17px; flex: 0 0 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(0, 102, 204, .26); outline-offset: 2px; }

.app-shell { min-height: 100vh; display: block; }
.sidebar { position: sticky; top: 0; z-index: 40; width: 100%; height: 52px; border-bottom: 1px solid rgba(0, 0, 0, .08); background: rgba(255, 255, 255, .88); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }
.global-nav-inner { width: min(1440px, 100%); height: 100%; margin: 0 auto; padding: 0 24px; display: grid; grid-template-columns: minmax(300px, 330px) minmax(0, 1fr) auto; align-items: center; gap: 24px; }
.brand { min-width: 0; display: flex; align-items: center; gap: 13px; }
.brand-logo { width: 116px; height: auto; display: block; }
.brand-copy { min-width: 0; padding-left: 13px; border-left: 1px solid #d2d2d7; }
.brand-copy strong { display: block; font-size: 12px; line-height: 1.2; font-weight: 600; white-space: nowrap; }
.brand-copy small { margin-top: 2px; color: var(--muted-light); font-size: 9px; line-height: 1.2; white-space: nowrap; }
.nav-list { height: 100%; display: flex; align-items: center; justify-content: center; gap: 4px; }
.nav-caption { display: none; }
.nav-item { min-width: 68px; height: 36px; padding: 0 13px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-soft); display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; transition: background-color 160ms ease, color 160ms ease, transform 120ms ease; }
.nav-item .ui-icon { width: 15px; height: 15px; flex-basis: 15px; color: var(--muted-light); }
.nav-item span { font-size: 12px; font-weight: 500; }
.nav-item:hover { background: var(--parchment); color: var(--ink); }
.nav-item.active { background: var(--ink); color: #fff; }
.nav-item.active .ui-icon { color: #fff; }
.nav-item:active, .button:active, .icon-button:active, .group-card-main:active, .quick-item:active { transform: scale(.97); }
.global-nav-actions { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.icon-button.nav-tool-button { width: 36px; height: 36px; background: transparent; color: var(--muted); position: relative; }
.nav-tool-button:hover { background: var(--parchment); color: var(--ink); }
.nav-tool-button .ui-icon { width: 15px; height: 15px; flex-basis: 15px; }
.nav-tool-label { display: none; font-size: 11px; font-weight: 500; white-space: nowrap; }
.icon-button.nav-tool-button.show-label { width: auto; padding: 0 12px; border-radius: 999px; display: inline-flex; gap: 6px; }
.nav-tool-button.show-label .nav-tool-label { display: inline; }
.nav-tool-button::after, .user-menu-button::after { content: attr(data-tooltip); position: absolute; top: calc(100% + 8px); right: 0; padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255, 255, 255, .98); color: var(--ink-soft); box-shadow: 0 5px 16px rgba(0, 0, 0, .1); font-size: 10px; font-weight: 500; line-height: 1.2; white-space: nowrap; opacity: 0; pointer-events: none; transform: translateY(-3px); transition: opacity 140ms ease, transform 140ms ease; }
.nav-tool-button:hover::after, .nav-tool-button:focus-visible::after, .user-menu-button:hover::after, .user-menu-button:focus-visible::after { opacity: 1; transform: translateY(0); }
.sidebar-footer { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 8px; color: var(--muted); }
.sidebar-footer > span:not(.status-dot) { max-width: 116px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; flex: 0 0 auto; }
.status-dot.error { background: var(--red); }

.main-area { min-width: 0; }
.section-actions, .dashboard-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.command-search { width: min(310px, 30vw); min-height: 40px; padding: 0 11px 0 14px; border: 0; border-radius: 999px; background: #e9e9ed; color: var(--muted); display: flex; align-items: center; gap: 9px; text-align: left; transition: background-color 160ms ease; }
.command-search:hover { background: #dedee3; }
.command-search span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.command-search kbd { padding: 3px 6px; border: 0; border-radius: 5px; background: rgba(255, 255, 255, .78); color: var(--muted-light); font: 10px/1.2 inherit; white-space: nowrap; }
.content { width: min(1440px, 100%); margin: 0 auto; padding: 48px 32px 88px; }

.eyebrow { color: var(--blue); font-size: 13px; font-weight: 600; }
.page-heading { margin-bottom: 28px; }
.page-back { margin-bottom: 16px; }
.back-button { min-height: 36px; padding: 0; border: 0; background: transparent; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; }
.back-button:hover { color: var(--blue); }
.back-button span { font-size: 20px; line-height: 1; }
.section-head { margin-bottom: 28px; min-height: 62px; display: flex; justify-content: space-between; align-items: flex-end; gap: 28px; }
.section-head .eyebrow { color: var(--ink); font-size: 34px; line-height: 1.15; font-weight: 600; }
.subtle { margin-top: 8px; color: var(--muted); font-size: 14px; line-height: 1.5; }

.button { min-height: 44px; padding: 0 20px; border: 1px solid transparent; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; color: var(--ink); font-size: 14px; font-weight: 500; white-space: nowrap; transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 120ms ease; }
.button.primary { background: var(--blue); color: #fff; }
.button.primary:hover { background: var(--blue-hover); }
.button.secondary, .button.quiet { border-color: #d2d2d7; background: #fff; color: var(--blue); }
.button.secondary:hover, .button.quiet:hover { border-color: #b8b8bd; background: var(--pearl); }
.button.danger { border-color: #f0b8be; background: #fff; color: var(--red); }
.icon-button { width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: #e9e9ed; color: var(--ink-soft); display: inline-grid; place-items: center; font-size: 20px; transition: background-color 160ms ease, transform 120ms ease; }
.icon-button:hover { background: #dcdce1; }
.user-menu-button { width: 36px; height: 36px; flex: 0 0 36px; font-size: 15px; position: relative; }
.text-button { min-height: 36px; padding: 0 8px; border: 0; background: transparent; color: var(--blue); font-size: 13px; font-weight: 500; white-space: nowrap; }
.text-button:hover { color: var(--blue-hover); text-decoration: underline; text-underline-offset: 3px; }
.danger-link { color: var(--red); }

.dashboard-intro { margin-bottom: 28px; display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; }
.dashboard-intro h2 { margin-top: 7px; font-size: 40px; line-height: 1.1; font-weight: 600; }
.dashboard-intro p { margin-top: 9px; color: var(--muted); font-size: 16px; }
.sync-note { margin-right: 4px; color: var(--muted-light); font-size: 11px; white-space: nowrap; }
.sync-note i { width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--green); display: inline-block; }
.dashboard-kpis { margin-bottom: 24px; display: grid; grid-template-columns: minmax(380px, 2fr) repeat(3, minmax(180px, 1fr)); gap: 12px; }
.kpi-card { min-width: 0; min-height: 208px; padding: 26px; border: 1px solid var(--line); border-radius: 18px; background: var(--canvas); position: relative; overflow: hidden; }
.kpi-card.kpi-primary { padding: 28px 30px; border: 0; background: var(--parchment); }
.kpi-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); }
.kpi-label > span { font-size: 14px; font-weight: 500; }
.kpi-icon { min-width: 34px; height: 24px; padding: 0 8px; border-radius: 999px; background: var(--pearl); color: var(--muted-light); display: inline-grid; place-items: center; font-size: 9px; font-style: normal; font-weight: 600; }
.kpi-primary .kpi-icon { background: #fff; color: var(--green); }
.kpi-card > strong { margin-top: 25px; display: block; font-size: 36px; line-height: 1; font-weight: 600; letter-spacing: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-primary > strong { margin-top: 18px; font-size: 58px; }
.kpi-card > small { margin-top: 10px; color: var(--muted-light); font-size: 11px; line-height: 1.4; }
.kpi-alert > strong { color: var(--red); }
.kpi-categories { margin-top: 24px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.kpi-categories button { min-width: 0; min-height: 54px; padding: 9px 12px; border: 0; border-radius: 11px; background: rgba(255, 255, 255, .9); color: var(--ink); text-align: left; }
.kpi-categories span { display: block; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.kpi-categories b { margin-top: 4px; display: block; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-spark { display: none; }
.kpi-alert-line { position: absolute; right: 26px; bottom: 24px; left: 26px; height: 3px; border-radius: 999px; background: var(--red-soft); overflow: hidden; }
.kpi-alert-line span { height: 100%; border-radius: inherit; background: var(--red); display: block; }

.dashboard-layout { margin-bottom: 12px; display: grid; gap: 12px; }
.dashboard-layout-top { grid-template-columns: minmax(0, 1.7fr) minmax(320px, .8fr); }
.dashboard-layout-mid { grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr); }
.dashboard-layout-bottom { grid-template-columns: minmax(0, 1.35fr) minmax(340px, .65fr); }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--canvas); overflow: hidden; }
.panel-head { min-height: 78px; padding: 20px 24px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-head h2 { font-size: 18px; }
.panel-caption { margin-top: 5px; color: var(--muted-light); font-size: 11px; display: block; }
.panel-foot { min-height: 48px; padding: 11px 18px; border-top: 1px solid var(--line-soft); background: var(--pearl); color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 11px; }
.panel-note { color: var(--muted-light); font-size: 11px; }
.chart-panel { min-height: 334px; }
.chart-legend { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 11px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.legend-dot.receipt, .legend-dot.healthy { background: var(--blue); }
.legend-dot.issue { background: var(--ink); }
.legend-dot.zero { background: var(--red); }
.legend-dot.pending { background: #d2d2d7; }
.flow-chart { padding: 18px 24px 2px; }
.flow-chart svg { width: 100%; height: 205px; display: block; overflow: visible; }
.chart-grid-line { stroke: var(--line-soft); stroke-width: 1; }
.chart-axis { stroke: #d2d2d7; stroke-width: 1; }
.flow-bar { transition: opacity 150ms ease; }
.flow-receipt { fill: var(--blue); }
.flow-issue { fill: var(--ink); }
.flow-day:hover .flow-bar { opacity: .7; }
.flow-day text { fill: var(--muted-light); font-size: 10px; }
.chart-foot { min-height: 48px; padding: 10px 24px 16px; color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 11px; }
.chart-foot strong { color: var(--ink); font-size: 12px; font-weight: 600; }
.health-chart-wrap { min-height: 255px; padding: 28px; display: grid; grid-template-columns: 148px minmax(0, 1fr); align-items: center; gap: 28px; }
.health-chart { width: 144px; height: 144px; border-radius: 50%; background: conic-gradient(var(--blue) 0 var(--healthy), var(--red) var(--healthy) calc(var(--healthy) + var(--zero)), #e8e8ed calc(var(--healthy) + var(--zero)) 100%); display: grid; place-items: center; position: relative; }
.health-chart::after { content: ""; position: absolute; width: 98px; height: 98px; border-radius: 50%; background: #fff; }
.health-chart > div { z-index: 1; text-align: center; }
.health-chart strong { display: block; font-size: 28px; font-weight: 600; }
.health-chart span { margin-top: 3px; color: var(--muted); font-size: 10px; display: block; }
.health-legend { display: grid; gap: 15px; }
.health-legend > div { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.health-legend strong { color: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; }
.category-bars { padding: 14px 24px; }
.category-bar-row { width: 100%; min-height: 43px; padding: 0; border: 0; background: transparent; color: var(--ink); display: grid; grid-template-columns: 84px minmax(80px, 1fr) 52px; align-items: center; gap: 14px; text-align: left; }
.category-bar-row:hover .category-bar-name { color: var(--blue); }
.category-bar-name { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.category-bar-track { height: 5px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.category-bar-track i { height: 100%; border-radius: inherit; background: var(--blue); display: block; }
.category-bar-row strong { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.category-shortcuts { padding: 14px 24px 22px; border-top: 1px solid var(--line-soft); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.category-shortcuts button { min-width: 0; min-height: 64px; padding: 10px 12px; border: 0; border-radius: 11px; background: var(--parchment); color: var(--ink); text-align: left; }
.category-shortcuts span { color: var(--muted); font-size: 10px; }
.category-shortcuts strong { margin-top: 5px; display: block; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.activity-list { padding: 5px 24px; }
.activity-row { min-height: 62px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 12px; }
.activity-row:last-child { border-bottom: 0; }
.activity-marker { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 500; }
.activity-marker.receipt { background: var(--blue-soft); color: var(--blue); }
.activity-marker.issue { background: #ededf0; color: var(--ink); }
.activity-copy { flex: 1; min-width: 0; }
.activity-row strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.activity-row span:not(.activity-marker) { margin-top: 3px; color: var(--muted-light); font-size: 10px; display: block; }
.activity-row b { font-size: 12px; }
.positive { color: var(--green); }
.negative { color: var(--red); }
.attention-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.attention-columns > div { min-width: 0; padding: 16px 24px; }
.attention-columns > div + div { border-left: 1px solid var(--line-soft); }
.attention-title { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink-soft); font-size: 11px; font-weight: 500; }
.attention-row { min-height: 52px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.attention-row:last-child { border-bottom: 0; }
.attention-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.attention-row small { margin-top: 3px; color: var(--muted-light); font-size: 9px; }
.attention-row strong { font-size: 12px; font-variant-numeric: tabular-nums; }
.quick-grid { padding: 6px 24px; }
.quick-item { width: 100%; min-height: 64px; padding: 8px 0; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 12px; color: var(--ink); text-align: left; }
.quick-item:last-child { border-bottom: 0; }
.quick-avatar { width: 36px; height: 36px; border-radius: 10px; background: var(--parchment); color: var(--ink); display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.quick-avatar { overflow: hidden; }
.quick-avatar img { width: 100%; height: 100%; object-fit: cover; }
.quick-item strong { display: block; font-size: 12px; }
.quick-item small { margin-top: 3px; color: var(--muted-light); font-size: 9px; }
.quick-item b { font-size: 13px; font-variant-numeric: tabular-nums; }

.inventory-group-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.inventory-group-card { min-width: 0; min-height: 176px; border: 0; border-radius: 18px; background: var(--parchment); color: var(--ink); position: relative; overflow: hidden; transition: background-color 160ms ease; }
.inventory-group-card:hover { background: #ededf0; }
.group-card-main { width: 100%; min-height: 176px; padding: 24px; border: 0; background: transparent; color: inherit; display: grid; grid-template-columns: 72px minmax(0, 1fr) 24px; gap: 18px; align-items: center; text-align: left; transition: transform 120ms ease; }
.group-art { width: 72px; height: 72px; border-radius: 14px; background: #fff; display: grid; place-items: center; overflow: hidden; }
.group-art img, .group-detail-image img, .image-editor-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-placeholder { padding: 8px; color: var(--muted-light); font-size: 9px; line-height: 1.25; text-align: center; }
.group-edit-button { position: absolute; top: 14px; right: 14px; min-height: 30px; padding: 0 10px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .9); color: var(--blue); font-size: 10px; }
.group-edit-button:hover { background: #fff; }
.group-card-copy { min-width: 0; }
.group-card-copy span { color: var(--muted); font-size: 12px; }
.group-card-copy strong { margin-top: 7px; display: block; font-size: 32px; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; }
.group-card-copy small { margin-top: 11px; color: var(--muted-light); font-size: 10px; }
.group-arrow { color: #a1a1a6; font-size: 28px; font-weight: 300; }
.group-detail-banner { margin-bottom: 16px; min-height: 132px; padding: 20px 24px; border-radius: 18px; background: var(--parchment); display: flex; align-items: center; gap: 20px; }
.group-detail-image { width: 92px; height: 92px; flex: 0 0 92px; border-radius: 18px; background: #fff; display: grid; place-items: center; overflow: hidden; }
.group-detail-banner span, .group-detail-banner small { color: var(--muted); font-size: 11px; }
.group-detail-banner strong { margin: 5px 0; display: block; font-size: 32px; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; }
.toolbar { margin-bottom: 16px; min-height: 60px; padding: 8px; border: 0; border-radius: 14px; background: var(--parchment); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-end { margin-left: auto; }
.toolbar-label { padding: 0 12px; color: var(--muted); font-size: 12px; }
.search-field { flex: 1; min-width: 240px; }
.search-field input, .select-control, .field input, .field select, .field textarea, .line-row input, .line-row select, .return-line input { width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid #d2d2d7; border-radius: 11px; background: #fff; color: var(--ink); outline: none; }
.search-field input { border-color: transparent; border-radius: 10px; background: #fff; }
.search-field input::placeholder, .field input::placeholder, .field textarea::placeholder { color: #a1a1a6; }
.search-field input:focus, .select-control:focus, .field input:focus, .field select:focus, .field textarea:focus, .line-row input:focus, .line-row select:focus, .return-line input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 102, 204, .12); }
.select-control { width: auto; min-width: 180px; border-color: transparent; }
.tabs { margin-bottom: 18px; padding: 3px; border: 0; border-radius: 999px; background: #e9e9ed; display: inline-flex; gap: 2px; }
.tabs.two-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tab { min-height: 38px; padding: 0 18px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 500; }
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { height: 50px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--pearl); color: var(--muted); text-align: left; font-size: 11px; font-weight: 500; white-space: nowrap; }
td { height: 66px; padding: 12px 18px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfbfd; }
td strong { font-size: 12px; font-weight: 600; }
td small { margin-top: 4px; color: var(--muted-light); font-size: 9px; }
.number { text-align: right; font-variant-numeric: tabular-nums; }
.number-value { display: inline-flex; align-items: baseline; justify-content: flex-end; gap: 4px; white-space: nowrap; }
.actions-cell { text-align: right; white-space: nowrap; }
.badge { min-height: 24px; padding: 0 9px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); display: inline-flex; align-items: center; font-size: 9px; font-weight: 600; white-space: nowrap; }
.badge.neutral { background: #efeff1; color: var(--muted); }
.badge.danger-badge { background: var(--red-soft); color: var(--red); }
.badge.live-badge { background: var(--green-soft); color: var(--green); }
.sku-cell { display: flex; align-items: center; gap: 12px; }
.sku-thumb { width: 42px; height: 42px; flex: 0 0 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--parchment); display: grid; place-items: center; overflow: hidden; color: var(--muted-light); font-size: 9px; }
.sku-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sku-thumb.large { width: 104px; height: 104px; flex-basis: 104px; border-radius: 18px; }
.sku-detail-head { margin-bottom: 24px; display: flex; align-items: center; gap: 20px; }
.sku-detail-head p { margin-top: 6px; color: var(--muted); }

.stat-grid { margin-bottom: 16px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.two-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat-card { min-height: 150px; padding: 24px; border: 0; border-radius: 18px; background: var(--parchment); position: relative; overflow: hidden; }
.stat-card span { color: var(--muted); font-size: 12px; }
.stat-card strong { margin-top: 16px; display: block; font-size: 32px; line-height: 1.1; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-card small { margin-top: 9px; color: var(--muted-light); font-size: 10px; }
.stat-card.primary-stat { background: var(--ink); color: #fff; }
.stat-card.primary-stat span, .stat-card.primary-stat small { color: #c7c7cc; }
.health-banner { margin-bottom: 16px; padding: 16px 20px; border: 0; border-radius: 14px; background: var(--green-soft); display: flex; align-items: center; gap: 12px; }
.health-banner.error { background: var(--red-soft); }
.health-banner strong { font-size: 12px; }
.health-banner p { margin-top: 3px; color: var(--muted); font-size: 10px; }
.system-grid { margin-bottom: 14px; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 14px; }
.role-grid { padding: 16px 20px; border-bottom: 1px solid var(--line-soft); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.role-card { min-height: 112px; padding: 16px; border: 0; border-radius: 12px; background: var(--parchment); }
.role-card span, .role-card small { color: var(--muted); font-size: 10px; }
.role-card strong { margin: 9px 0; display: block; font-size: 24px; font-weight: 600; }
.key-list { padding: 6px 20px; }
.key-list > div { min-height: 48px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 11px; }
.key-list > div:last-child { border-bottom: 0; }
.key-list span { color: var(--muted); }
.key-list strong { text-align: right; font-variant-numeric: tabular-nums; }
.compact-list { padding: 6px 20px; }
.compact-list > div { min-height: 58px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.compact-list > div:last-child { border-bottom: 0; }
.compact-list span { min-width: 0; overflow-wrap: anywhere; }
.compact-list strong { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.compact-list small { margin-top: 4px; color: var(--muted-light); font-size: 9px; }
.metric-panel { min-height: 220px; padding: 28px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.metric-panel strong { font-size: 36px; font-weight: 600; font-variant-numeric: tabular-nums; }
.metric-panel span { margin: 7px 0 20px; color: var(--muted); }

.modal-backdrop { position: fixed; inset: 0; z-index: 60; padding: 28px; background: rgba(0, 0, 0, .38); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: grid; place-items: center; }
.modal { width: min(820px, 100%); max-height: calc(100vh - 56px); border: 0; border-radius: 20px; background: rgba(255, 255, 255, .98); box-shadow: var(--shadow-float); overflow: auto; }
.modal-head { position: sticky; top: 0; z-index: 2; min-height: 70px; padding: 12px 16px 12px 26px; border-bottom: 1px solid var(--line-soft); background: rgba(255, 255, 255, .9); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { font-size: 20px; }
.modal-body { padding: 26px; }
.modal-foot { position: sticky; bottom: 0; padding: 14px 26px; border-top: 1px solid var(--line-soft); background: rgba(255, 255, 255, .92); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { min-width: 0; display: grid; gap: 7px; color: var(--ink-soft); font-size: 11px; font-weight: 500; }
.field-help { margin-top: 4px; color: var(--muted-light); font-size: 11px; line-height: 1.45; }
.field.full { grid-column: 1 / -1; }
.check-field { min-height: 44px; padding: 0 4px; display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 11px; }
.check-field input { width: 18px; height: 18px; accent-color: var(--blue); }
.field textarea { min-height: 96px; resize: vertical; }
.image-editor { grid-column: 1 / -1; padding: 16px; border-radius: 14px; background: var(--parchment); display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 18px; align-items: center; }
.image-editor-preview { width: 132px; height: 132px; border: 1px solid var(--line); border-radius: 16px; background: #fff; display: grid; place-items: center; overflow: hidden; }
.image-editor-controls { min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.image-editor-controls strong { width: 100%; font-size: 13px; }
.image-editor-controls > span { width: 100%; color: var(--muted); font-size: 10px; line-height: 1.5; }
.image-editor-controls small { width: 100%; min-height: 16px; color: var(--green); font-size: 10px; }
.image-upload-button input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.notice { margin-bottom: 18px; padding: 14px 16px; border: 0; border-radius: 12px; background: var(--parchment); color: var(--ink-soft); font-size: 11px; line-height: 1.6; }
.form-section-head { margin: 24px 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.form-section-head strong { font-size: 12px; }
.document-lines { display: grid; gap: 9px; }
.line-row { padding: 9px; border: 0; border-radius: 13px; background: var(--parchment); display: grid; grid-template-columns: 150px minmax(190px, 1fr) 90px 44px; gap: 9px; align-items: center; }
.detail-grid { margin-bottom: 22px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.detail-grid > div { padding: 16px; border: 0; border-radius: 12px; background: var(--parchment); }
.detail-grid span { margin-bottom: 6px; color: var(--muted); font-size: 10px; display: block; }
.detail-grid strong { overflow-wrap: anywhere; }
.detail-lines, .return-lines { margin-bottom: 16px; display: grid; gap: 8px; }
.detail-line { min-height: 66px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); display: grid; grid-template-columns: minmax(0, 1fr) 120px 120px; gap: 16px; align-items: center; }
.detail-line span, .detail-line small { margin-top: 4px; color: var(--muted-light); font-size: 9px; display: block; }
.return-line { min-height: 64px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); display: grid; grid-template-columns: minmax(0, 1fr) 130px; gap: 16px; align-items: center; }
.return-line small { margin-top: 4px; color: var(--muted-light); }
.calculator-total { margin-top: 22px; padding: 20px; border: 0; border-radius: 14px; background: var(--parchment); text-align: right; color: var(--ink); font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }

.toast-root { position: fixed; right: 22px; bottom: 22px; z-index: 70; display: grid; gap: 9px; }
.toast { max-width: 360px; padding: 14px 17px; border-radius: 12px; background: rgba(29, 29, 31, .94); color: #fff; box-shadow: var(--shadow-float); font-size: 12px; }
.toast.error { background: rgba(215, 0, 21, .94); }
.loading-state, .empty-state, .error-state { min-height: 150px; padding: 28px; color: var(--muted); display: grid; place-content: center; gap: 12px; text-align: center; font-size: 12px; }
.error-state { border-radius: 18px; background: var(--parchment); }
.error-state strong { color: var(--ink); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

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

@media (max-width: 1180px) {
  .global-nav-inner { grid-template-columns: 240px minmax(0, 1fr) auto; gap: 12px; }
  .brand-copy, .sidebar-footer > span:not(.status-dot) { display: none; }
  .nav-item { min-width: 58px; padding: 0 10px; }
  .content { padding-left: 24px; padding-right: 24px; }
  .dashboard-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-primary { grid-column: 1 / -1; }
  .dashboard-layout-top, .dashboard-layout-mid, .dashboard-layout-bottom { grid-template-columns: 1fr; }
  .inventory-group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .system-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  body { padding-bottom: 68px; }
  .sidebar { position: fixed; top: auto; bottom: 0; height: 68px; border-top: 1px solid rgba(0, 0, 0, .09); border-bottom: 0; background: rgba(250, 250, 252, .92); }
  .global-nav-inner { width: 100%; padding: 0 8px env(safe-area-inset-bottom); display: block; }
  .brand { display: none; }
  .global-nav-actions { position: fixed; top: 10px; right: 14px; z-index: 50; display: flex; gap: 8px; }
  .global-nav-actions .nav-tool-button, .global-nav-actions .user-menu-button { width: 34px; height: 34px; flex-basis: 34px; }
  .global-nav-actions .nav-tool-button.show-label { width: auto; flex-basis: auto; padding: 0 10px; }
  .global-nav-actions .sidebar-footer { display: none; }
  .nav-list { width: 100%; height: 100%; display: flex; gap: 2px; }
  .nav-item { min-width: 0; height: 58px; padding: 6px 2px 5px; border-radius: 10px; flex: 1 1 0; flex-direction: column; gap: 3px; }
  .nav-item .ui-icon { width: 19px; height: 19px; flex-basis: 19px; }
  .nav-item span { max-width: 100%; overflow: hidden; font-size: 9px; text-overflow: ellipsis; }
  .nav-item.active { background: transparent; color: var(--blue); }
  .nav-item.active .ui-icon { color: var(--blue); }
  .command-search { width: min(260px, 38vw); }
  .content { padding: 68px 18px 54px; }
  .dashboard-intro { align-items: flex-start; }
  .sync-note { display: none; }
  .dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-primary { grid-column: 1 / -1; }
  .inventory-group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .line-row { grid-template-columns: 126px minmax(160px, 1fr) 76px 44px; overflow-x: auto; }
}

@media (max-width: 620px) {
  .command-search { width: 40px; padding: 0; justify-content: center; }
  .command-search span, .command-search kbd { display: none; }
  .dashboard-intro { align-items: flex-start; flex-direction: column; gap: 18px; }
  .dashboard-intro h2 { font-size: 34px; }
  .dashboard-intro p { font-size: 14px; }
  .dashboard-actions, .section-actions { width: 100%; }
  .dashboard-actions .button, .section-actions .button { flex: 1 1 120px; }
  .dashboard-kpis { grid-template-columns: 1fr; gap: 10px; }
  .kpi-primary { grid-column: auto; }
  .kpi-card { min-height: 154px; padding: 22px; }
  .kpi-card.kpi-primary { padding: 24px; }
  .kpi-card > strong { margin-top: 18px; font-size: 32px; }
  .kpi-primary > strong { font-size: 48px; }
  .kpi-categories { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-head { align-items: flex-start; flex-direction: column; gap: 18px; }
  .section-head .eyebrow { font-size: 30px; }
  .inventory-group-grid { grid-template-columns: 1fr; }
  .inventory-group-card, .group-card-main { min-height: 142px; }
  .health-chart-wrap { grid-template-columns: 126px minmax(0, 1fr); padding: 20px; }
  .health-chart { width: 118px; height: 118px; }
  .health-chart::after { width: 78px; height: 78px; }
  .health-chart strong { font-size: 22px; }
  .category-shortcuts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .attention-columns { grid-template-columns: 1fr; }
  .attention-columns > div + div { border-left: 0; border-top: 1px solid var(--line-soft); }
  .toolbar { align-items: stretch; }
  .search-field, .select-control { width: 100%; min-width: 0; }
  .toolbar-end { width: 100%; margin-left: 0; }
  .tabs { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tab { padding: 0 6px; }
  .two-stat-grid, .role-grid { grid-template-columns: 1fr; }
  .table-wrap { overflow: visible; }
  .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { width: 100%; display: block; }
  .responsive-table thead { display: none; }
  .responsive-table tr { padding: 10px 16px; border-bottom: 1px solid var(--line-soft); }
  .responsive-table tbody tr:last-child { border-bottom: 0; }
  .responsive-table td { min-height: 40px; height: auto; padding: 8px 0; border: 0; display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; align-items: center; text-align: right; white-space: normal; overflow-wrap: anywhere; }
  .responsive-table td::before { content: attr(data-label); color: var(--muted); text-align: left; font-size: 10px; }
  .responsive-table td > small { grid-column: 2; }
  .responsive-table .actions-cell { white-space: normal; }
  .sku-cell { justify-content: flex-end; text-align: left; }
  .panel-foot { align-items: flex-start; flex-direction: column; gap: 5px; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { width: 100%; max-height: 94vh; border-radius: 20px 20px 0 0; }
  .modal-body { padding: 22px 18px; }
  .modal-foot { padding: 13px 18px calc(13px + env(safe-area-inset-bottom)); }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .image-editor { grid-template-columns: 1fr; justify-items: center; }
  .image-editor-controls { width: 100%; justify-content: center; text-align: center; }
  .image-editor .field { width: 100%; }
  .line-row { padding: 9px 0; border-radius: 0; background: transparent; grid-template-columns: minmax(0, 1fr) 72px 44px; overflow: visible; }
  .line-row [data-line-group] { grid-column: 1 / -1; }
  .detail-line { grid-template-columns: 1fr; gap: 6px; }
  .detail-line .number { text-align: left; }
  .toast-root { right: 14px; bottom: 82px; left: 14px; }
  .toast { max-width: none; }
}

@media (max-width: 400px) {
  .content { padding-left: 14px; padding-right: 14px; }
  .dashboard-intro h2 { font-size: 31px; }
  .category-shortcuts { grid-template-columns: 1fr; }
  .health-chart-wrap { grid-template-columns: 1fr; justify-items: center; }
  .health-legend { width: 100%; }
  .category-bar-row { grid-template-columns: 64px minmax(60px, 1fr) 42px; gap: 8px; }
  .quick-item { grid-template-columns: 34px minmax(0, 1fr) auto; }
}
