:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eff6ff;
  --text: #182230;
  --text-strong: #101828;
  --muted: #667085;
  --muted-light: #98a2b3;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --nav: #14263d;
  --nav-deep: #0d1d30;
  --nav-surface: #34495e;
  --nav-text: #dbe5f0;
  --nav-muted: #91a4b9;
  --red-row: #fff3f3;
  --red-row-strong: #ffe2e2;
  --gold-row: #fff9e9;
  --gold-row-strong: #ffefbd;
  --green: #16a34a;
  --green-dark: #087443;
  --green-soft: #ecfdf3;
  --green-line: #a7e3bb;
  --metric-quantity: #2563eb;
  --metric-quantity-soft: #f5f8ff;
  --metric-cost: #475569;
  --metric-cost-soft: #f8fafc;
  --metric-revenue: #0f766e;
  --metric-revenue-soft: #f1fbfa;
  --metric-profit: #16a34a;
  --metric-profit-soft: #f3fbf5;
  --metric-receive: #0891b2;
  --metric-receive-soft: #f0f9ff;
  --metric-warning: #b45309;
  --metric-warning-soft: #fffaeb;
  --metric-danger: #dc2626;
  --metric-danger-soft: #fff1f2;
  --metric-analysis: #7c3aed;
  --metric-analysis-soft: #faf5ff;
  --nav-active: #2563eb;
  --nav-active-soft: #eff6ff;
  --nav-divider: rgba(226, 232, 240, .12);
  --nav-guide: rgba(174, 194, 214, .42);
  --nav-group-surface: rgba(255, 255, 255, .035);
  --nav-group-active: rgba(37, 99, 235, .17);
  --nav-subgroup-surface: rgba(255, 255, 255, .035);
  --nav-subgroup-active: rgba(96, 165, 250, .14);
  --nav-link-hover: rgba(255, 255, 255, .08);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, .06);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}

button:hover:not(:disabled) {
  border-color: #b8c4d1;
  background: #f5f8fc;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .18);
  outline-offset: 1px;
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

button.primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 5px rgba(22, 163, 74, .2);
}

button.primary:hover:not(:disabled) {
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: #fff;
}

.ghost {
  background: #fff;
  color: #344054;
}

.ghost:hover:not(:disabled) {
  background: var(--blue-soft);
  border-color: #93c5fd;
  color: var(--blue-dark);
}

.danger {
  background: #fff7f7;
  border-color: #fda4af;
  color: #b42318;
}

.danger:hover:not(:disabled) {
  background: #fff1f2;
  border-color: #f43f5e;
}

button.warning,
.warning {
  border-color: #f2c66d;
  background: #fff7e6;
  color: #9a5700;
  font-weight: 700;
}

button.warning:hover:not(:disabled),
.warning:hover:not(:disabled) {
  border-color: #e4a72c;
  background: #ffedc2;
}

button.success {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  font-weight: 700;
}

button.success:hover:not(:disabled) {
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: #fff;
}

.hidden {
  display: none !important;
}

.eyebrow {
  display: block;
  color: var(--muted-light);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  line-height: 1.3;
  text-transform: uppercase;
}

/* Login */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: #e9eef5;
}

.login-panel {
  width: min(430px, 100%);
  padding: 34px 36px 24px;
  border: 1px solid #d8e0ea;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(15, 23, 42, .12);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.login-logo {
  display: block;
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: 12px;
  background: #111827;
  box-shadow: 0 5px 14px rgba(15, 23, 42, .16);
}

.login-panel h1 {
  margin: 5px 0 0;
  color: var(--text-strong);
  font-size: 24px;
  line-height: 1.25;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 30px;
}

.login-form label {
  gap: 8px;
}

.login-form button {
  width: 100%;
  height: 42px;
  margin-top: 4px;
  font-size: 15px;
}

.login-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #eef1f5;
  color: var(--muted-light);
  font-size: 12px;
}

.login-footer a,
.site-icp-footer a {
  color: inherit;
  text-decoration: none;
}

.login-footer a:hover,
.site-icp-footer a:hover {
  color: var(--blue-dark);
  text-decoration: underline;
}

.site-icp-footer {
  position: fixed;
  right: 18px;
  bottom: 10px;
  z-index: 30;
  color: var(--muted-light);
  font-size: 12px;
  line-height: 1.4;
}

.site-icp-footer a {
  color: inherit;
}

@media (max-width: 640px) {
  .site-icp-footer {
    right: 12px;
    bottom: 8px;
    font-size: 11px;
  }
}

label {
  display: grid;
  gap: 6px;
  color: #475467;
  font-weight: 600;
}

input,
select {
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: none;
  background: #fff;
  color: var(--text);
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

input::placeholder {
  color: #98a2b3;
}

input:hover,
select:hover {
  border-color: #98a2b3;
}

input:focus,
select:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.error-text {
  min-height: 20px;
  margin: 0;
  color: #b42318;
  font-size: 13px;
}

/* Application shell */
.app-shell {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  background: var(--bg);
  transition: grid-template-columns .2s ease;
}

.app-shell.nav-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.side-panel {
  min-width: 0;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--nav);
  border-right: 1px solid #203750;
  transition: opacity .16s ease;
}

.nav-collapsed .side-panel {
  opacity: 0;
  pointer-events: none;
}

.sidebar-backdrop {
  display: none;
}

.side-brand {
  min-height: 82px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 16px 18px;
  border: 0;
  border-bottom: 1px solid rgba(226, 232, 240, .12);
  border-radius: 0;
  background: transparent;
  white-space: nowrap;
}

.brand-mark {
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 10px;
  background: #111827;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.side-brand strong {
  display: block;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
}

.side-brand span {
  display: block;
  margin-top: 4px;
  color: var(--nav-muted);
  font-size: 12px;
}

.side-nav {
  padding: 0 14px 28px;
}

.nav-group {
  margin-bottom: 10px;
}

.business-group {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--nav-divider);
}

.business-group > .nav-group-title {
  background: rgba(37, 99, 235, .14) !important;
  color: #f7fbff !important;
}

.business-group > .nav-group-title:hover,
.business-group > .nav-group-title:focus-visible {
  background: rgba(37, 99, 235, .24) !important;
}

.business-group > .nav-group-items {
  position: relative;
  margin-top: 7px;
  padding: 2px 0 0 8px;
}

.business-group > .nav-group-items::before {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 8px;
  width: 1px;
  background: rgba(169, 187, 206, .38);
  content: "";
}

.business-group > .nav-group-items > .nav-subgroup {
  position: relative;
  padding-left: 7px;
}

.business-group > .nav-group-items > .nav-subgroup::before {
  position: absolute;
  top: 17px;
  left: 0;
  width: 7px;
  height: 1px;
  background: rgba(169, 187, 206, .38);
  content: "";
}

.business-group > .nav-group-items > .nav-subgroup > .nav-subgroup-title {
  color: #e5edf6 !important;
  font-weight: 800;
}

.settings-group {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--nav-divider);
}

.settings-group + .settings-group {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.nav-group-title,
.nav-subgroup-title {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  background: transparent !important;
  color: #d9e5ef !important;
  font-size: 14px;
  font-weight: 800;
  text-align: left;
}

.nav-group-title:hover,
.nav-group-title:focus-visible,
.nav-subgroup-title:hover,
.nav-subgroup-title:focus-visible {
  border-color: transparent;
  background: rgba(255, 255, 255, .07) !important;
  color: #fff !important;
}

.nav-group-title .nav-title-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-group-title > .nav-chevron,
.nav-subgroup-title > .nav-chevron {
  flex: 0 0 7px;
  display: block;
  width: 7px;
  height: 7px;
  border-right: 2px solid #b9cad8;
  border-bottom: 2px solid #b9cad8;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .16s ease;
}

.nav-group.collapsed .nav-group-title > .nav-chevron,
.nav-subgroup.collapsed .nav-subgroup-title > .nav-chevron {
  transform: rotate(-45deg) translate(-1px, 2px);
}

.nav-group.collapsed .nav-group-items,
.nav-subgroup.collapsed .nav-subgroup-items {
  display: none;
}

.nav-group-items {
  display: grid;
  gap: 4px;
  margin-top: 5px;
}

.nav-subgroup {
  display: grid;
  gap: 2px;
}

.nav-subgroup-title {
  min-height: 36px;
  padding: 0 12px 0 20px;
  border-radius: 6px;
  color: var(--nav-muted) !important;
  font-size: 13px;
  font-weight: 700;
}

.nav-subgroup-title > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-subgroup-items {
  display: grid;
  gap: 3px;
  padding-left: 9px;
}

.side-link {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  position: relative;
  padding: 0 14px 0 28px;
  border: 0;
  border-radius: 7px;
  background: transparent !important;
  color: var(--nav-text) !important;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}

.side-link:hover,
.side-link:focus-visible {
  border-color: transparent;
  background: rgba(255, 255, 255, .09) !important;
  color: #fff !important;
}

.side-link.active,
.side-link.active:hover,
.side-link.active:focus-visible {
  background: var(--nav-active) !important;
  color: #fff !important;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(37, 99, 235, .24);
}

.nav-home {
  margin-bottom: 9px;
  padding-left: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  border-radius: 7px 7px 4px 4px;
}

.nav-subgroup-items .side-link {
  min-height: 38px;
  padding-left: 24px;
  font-size: 13px;
  font-weight: 600;
}

.nav-subgroup-items .side-link.active::before {
  left: 5px;
}

.side-link.active::before {
  position: absolute;
  left: 9px;
  width: 4px;
  height: 20px;
  border-radius: 4px;
  background: #fff;
  content: "";
}

/* Navigation hierarchy */
.side-nav {
  padding: 8px 12px 28px;
}

.nav-group {
  margin: 0 0 12px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--nav-divider);
}

.nav-group:last-of-type {
  padding-bottom: 0;
  border-bottom: 0;
}

.business-group {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--nav-divider);
}

.settings-group {
  margin-top: 0;
  padding-top: 12px;
  border-top: 0;
}

.settings-group + .settings-group {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.nav-group-title {
  position: relative;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--nav-group-surface) !important;
  color: #f1f5f9 !important;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .01em;
}

.nav-group-title::before {
  position: absolute;
  left: 12px;
  top: 13px;
  width: 3px;
  height: 18px;
  border-radius: 3px;
  background: rgba(174, 194, 214, .48);
  content: "";
}

.nav-group-title:hover,
.nav-group-title:focus-visible {
  background: var(--nav-link-hover) !important;
}

.nav-group-title .nav-title-label {
  padding-left: 12px;
}

.nav-group.is-active-parent > .nav-group-title,
.business-group.is-active-parent > .nav-group-title {
  background: var(--nav-group-active) !important;
  color: #fff !important;
  box-shadow: inset 3px 0 0 #60a5fa;
}

.nav-group.is-active-parent > .nav-group-title::before,
.business-group.is-active-parent > .nav-group-title::before {
  background: #60a5fa;
}

.business-group > .nav-group-title {
  background: var(--nav-group-surface) !important;
}

.business-group > .nav-group-items,
.nav-group-items {
  position: relative;
  gap: 6px;
  margin-top: 8px;
  padding: 2px 0 0 14px;
}

.business-group > .nav-group-items::before,
.nav-group-items::before {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 6px;
  width: 1px;
  background: var(--nav-guide);
  content: "";
}

.business-group > .nav-group-items > .nav-subgroup,
.nav-subgroup {
  position: relative;
  gap: 4px;
  padding-left: 10px;
}

.business-group > .nav-group-items > .nav-subgroup::before,
.nav-subgroup::before {
  position: absolute;
  top: 18px;
  left: -1px;
  width: 9px;
  height: 1px;
  background: var(--nav-guide);
  content: "";
}

.nav-subgroup-title {
  min-height: 38px;
  padding: 0 10px 0 12px;
  border-radius: 7px;
  background: var(--nav-subgroup-surface) !important;
  color: #b9c9d9 !important;
  font-size: 13px;
  font-weight: 800;
}

.nav-subgroup-title:hover,
.nav-subgroup-title:focus-visible {
  background: var(--nav-link-hover) !important;
  color: #fff !important;
}

.nav-subgroup.is-active-parent > .nav-subgroup-title {
  background: var(--nav-subgroup-active) !important;
  color: #eff6ff !important;
  box-shadow: inset 3px 0 0 #60a5fa;
}

.nav-subgroup.is-active-parent > .nav-subgroup-title > .nav-chevron {
  border-color: #bfdbfe;
}

.nav-subgroup-items {
  position: relative;
  gap: 3px;
  padding: 2px 0 2px 14px;
}

.nav-subgroup-items::before {
  position: absolute;
  top: 1px;
  bottom: 1px;
  left: 7px;
  width: 1px;
  background: rgba(174, 194, 214, .28);
  content: "";
}

.nav-subgroup-items .side-link {
  min-height: 37px;
  padding-left: 19px;
  border-radius: 6px;
  color: #cbd6e2 !important;
  font-size: 13px;
  font-weight: 600;
}

.nav-subgroup-items .side-link:hover,
.nav-subgroup-items .side-link:focus-visible {
  background: var(--nav-link-hover) !important;
  color: #fff !important;
}

.nav-subgroup-items .side-link:not(.active)::before {
  position: absolute;
  left: 6px;
  width: 6px;
  height: 1px;
  border-radius: 1px;
  background: rgba(174, 194, 214, .6);
  content: "";
}

.nav-group > .nav-group-items > .side-link {
  min-height: 38px;
  padding-left: 19px;
  font-size: 13px;
}

.workspace {
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.icon-button {
  flex: 0 0 38px;
  display: inline-grid;
  place-content: center;
  gap: 4px;
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #667085;
}

.icon-button:hover {
  background: #f2f4f7;
  color: var(--text-strong);
}

.icon-button span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.header-current {
  min-width: 0;
  flex: 1;
}

.header-location {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.breadcrumb {
  overflow: hidden;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-current h1 {
  margin: 2px 0 0;
  color: var(--text-strong);
  font-size: 19px;
  line-height: 1.25;
}

.header-current p {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#serverTime {
  margin-left: 12px;
  color: var(--muted-light);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-version-link {
  min-height: 30px;
  padding: 5px 9px;
  border-color: transparent;
  background: transparent;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.header-version-link:hover:not(:disabled) {
  border-color: #bfdbfe;
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #344054;
  font-weight: 700;
  white-space: nowrap;
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid #bfdbfe;
  border-radius: 50%;
  background: #eff6ff;
  color: var(--blue);
  font-size: 13px;
}

.header-actions button,
.toolbar button,
.bottom-bar button {
  min-width: 84px;
  height: 36px;
  padding: 0 14px;
}

.open-tabs {
  min-height: 44px;
  display: flex;
  align-items: stretch;
  gap: 4px;
  padding: 0 18px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.open-tab {
  min-width: 108px;
  display: inline-flex;
  align-items: center;
  border-top: 2px solid transparent;
  border-right: 1px solid transparent;
  border-left: 1px solid transparent;
  background: transparent;
}

.open-tab:hover {
  background: #f8fafc;
}

.open-tab.active {
  border-color: var(--blue) var(--line) transparent;
  background: var(--blue-soft);
}

.tab-label,
.tab-close {
  min-height: 40px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.tab-label {
  flex: 1;
  min-width: 0;
  padding: 0 10px;
  overflow: hidden;
  color: #667085;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.open-tab.active .tab-label {
  color: var(--blue-dark);
  font-weight: 800;
}

.tab-close {
  width: 28px;
  color: #98a2b3;
  font-size: 17px;
}

.tab-close:hover {
  color: #b42318;
  background: #fff1f2;
}

.page-stage {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px;
}

.page {
  position: relative;
  display: none;
  min-height: calc(100% - 1px);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.page.active {
  display: block;
}

.page.is-loading {
  pointer-events: none;
}

.page.is-loading::after {
  position: absolute;
  top: 18px;
  right: 22px;
  padding: 5px 9px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  content: "加载中...";
  font-size: 12px;
  font-weight: 700;
}

.toolbar {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--muted);
}

.toolbar.wrap {
  flex-wrap: wrap;
}

.toolbar > strong {
  margin-right: 8px;
  color: var(--text-strong);
  font-size: 18px;
  line-height: 1.3;
}

.toolbar input {
  max-width: 250px;
}

.toolbar select {
  max-width: 190px;
}

.hint-text {
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.table-wrap.compact {
  max-height: 330px;
}

.table-wrap.compact table {
  min-width: 0;
}

.table-wrap.compact th,
.table-wrap.compact td {
  padding-right: 10px;
  padding-left: 10px;
}

.two-cols .table-wrap.compact table {
  table-layout: fixed;
}

.two-cols .table-wrap.compact th,
.two-cols .table-wrap.compact td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  height: 44px;
  padding: 7px 12px;
  border-bottom: 1px solid #eef1f4;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 42px;
  border-bottom-color: var(--line);
  background: #f8fafc;
  color: #344054;
  font-size: 12px;
  font-weight: 800;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #f8fbff;
}

tr.red td {
  background: var(--red-row);
}

tr.red.group-start td {
  background: var(--red-row-strong);
}

tr.gold td {
  background: var(--gold-row);
}

tr.gold.group-start td {
  background: var(--gold-row-strong);
}

tr.low td {
  box-shadow: inset 3px 0 0 #ef4444;
}

tr.red:hover td,
tr.gold:hover td {
  filter: brightness(.985);
}

.stock-total {
  color: var(--text-strong);
  font-size: 16px;
}

.account-stock-cell {
  min-width: 88px;
  text-align: center;
}

.stock-warning,
.stock-ok,
.stock-out {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-top: 3px;
  padding: 2px 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.stock-warning {
  border-color: #f7d48b;
  background: var(--metric-warning-soft);
  color: var(--metric-warning);
}

.stock-ok {
  border-color: var(--green-line);
  background: var(--green-soft);
  color: var(--green-dark);
}

.stock-out {
  border-color: #fda4af;
  background: var(--metric-danger-soft);
  color: var(--metric-danger);
}

.trend {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.trend-up {
  background: var(--green-soft);
  color: var(--green-dark);
}

.trend-down {
  background: var(--metric-danger-soft);
  color: var(--metric-danger);
}

.trend-flat {
  background: var(--metric-cost-soft);
  color: var(--muted);
}

td input[type="number"] {
  max-width: 170px;
  min-height: 34px;
}

.components-select {
  min-width: 230px;
  min-height: 72px;
  padding: 6px;
}

.inline-check {
  display: inline-flex;
  width: auto;
  align-items: center;
  gap: 6px;
  color: var(--text);
  white-space: nowrap;
}

input[type="checkbox"] {
  width: 17px;
  min-height: 17px;
  accent-color: var(--blue);
}

.bottom-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 2px 0;
}

.bottom-bar strong {
  margin-left: auto;
  color: #475467;
  font-size: 13px;
}

.bottom-bar strong + strong {
  margin-left: 10px;
}

.money {
  color: var(--text-strong);
}

.value-quantity,
.value-receive {
  color: var(--metric-quantity);
  font-weight: 700;
}

.value-receive {
  color: var(--metric-receive);
}

.value-danger {
  color: var(--metric-danger);
  font-weight: 800;
}

.value-cost {
  color: var(--metric-cost);
  font-weight: 700;
}

.value-revenue {
  color: var(--metric-revenue);
  font-weight: 700;
}

.value-profit,
.value-profit-rate {
  color: var(--metric-profit);
  font-weight: 800;
}

.value-warning {
  color: var(--metric-warning);
  font-weight: 700;
}

.value-profit.is-negative,
.value-profit-rate.is-negative {
  color: var(--metric-danger);
}

.value-profit.is-neutral,
.value-profit-rate.is-neutral {
  color: var(--muted);
}

.value-profit.is-positive,
.value-profit-rate.is-positive {
  color: var(--metric-profit);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.summary-grid > div {
  position: relative;
  overflow: hidden;
  min-height: 94px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.summary-grid > div::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--metric-accent, var(--blue));
  content: "";
}

.summary-grid > div[data-metric] {
  background: var(--metric-surface, #fff);
}

.summary-grid > div[data-metric="orders"],
.summary-grid > div[data-metric="quantity"] {
  --metric-accent: var(--metric-quantity);
  --metric-surface: var(--metric-quantity-soft);
}

.summary-grid > div[data-metric="cost"] {
  --metric-accent: var(--metric-cost);
  --metric-surface: var(--metric-cost-soft);
}

.summary-grid > div[data-metric="revenue"],
.summary-grid > div[data-metric="inventory"] {
  --metric-accent: var(--metric-revenue);
  --metric-surface: var(--metric-revenue-soft);
}

.summary-grid > div[data-metric="profit"],
.summary-grid > div[data-metric="profit-rate"] {
  --metric-accent: var(--metric-profit);
  --metric-surface: var(--metric-profit-soft);
}

.summary-grid > div[data-metric="receive"] {
  --metric-accent: var(--metric-receive);
  --metric-surface: var(--metric-receive-soft);
}

.summary-grid > div[data-metric="warning"] {
  --metric-accent: var(--metric-warning);
  --metric-surface: var(--metric-warning-soft);
}

.summary-grid > div[data-metric="analysis"] {
  --metric-accent: var(--metric-analysis);
  --metric-surface: var(--metric-analysis-soft);
}

.summary-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.summary-grid strong {
  display: block;
  margin-top: 10px;
  color: var(--text-strong);
  font-size: 23px;
  line-height: 1;
}

.summary-grid > div[data-metric] strong {
  color: var(--metric-accent, var(--text-strong));
}

.summary-grid > div[data-metric] strong.value-profit.is-negative,
.summary-grid > div[data-metric] strong.value-profit-rate.is-negative {
  color: var(--metric-danger);
}

.summary-grid > div[data-metric] strong.value-profit.is-neutral,
.summary-grid > div[data-metric] strong.value-profit-rate.is-neutral {
  color: var(--muted);
}

.overview-control-bar {
  min-height: 62px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 18px;
  padding: 10px 0 13px;
  border-bottom: 1px solid var(--line);
}

.overview-control-bar > div:first-child { display: grid; gap: 3px; margin-right: auto; }
.overview-control-bar > div:first-child strong { color: var(--text-strong); font-size: 17px; }

.period-segments {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid #d7deea;
  border-radius: 7px;
  background: #f5f7fa;
}

.period-segments button {
  min-width: 58px;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
}

.period-segments button:hover:not(:disabled) { background: #fff; color: var(--blue-dark); }
.period-segments button.active { background: var(--blue); color: #fff; box-shadow: 0 1px 3px rgba(37, 99, 235, .24); }
.period-segments[aria-busy="true"] { opacity: .68; }
.overview-control-bar input[type="date"] { width: 150px; }
.overview-control-bar .hint-text { min-width: 176px; text-align: right; }

.dashboard-section-heading { margin: 0 0 10px; }
.dashboard-metrics { grid-template-columns: repeat(6, minmax(135px, 1fr)); margin-bottom: 20px; }
.dashboard-metrics > div { min-height: 104px; }
.summary-grid .metric-trend,
.summary-grid .overview-trend {
  display: block;
  margin-top: 9px;
  font-size: 11px;
  font-weight: 700;
}
.summary-grid .metric-trend:empty { display: none; }

.inventory-balance-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.45fr) repeat(2, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.inventory-balance-grid > div {
  min-height: 86px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--metric-revenue);
  border-radius: 7px;
  background: #fff;
}

.inventory-balance-grid span,
.inventory-balance-grid small { color: var(--muted); font-size: 12px; }
.inventory-balance-grid strong { color: var(--text-strong); font-size: 18px; }
.inventory-balance-grid b { color: var(--metric-warning); }
.inventory-balance-grid > div[data-risk="shortage"] { border-left-color: var(--metric-warning); background: var(--metric-warning-soft); }
.inventory-balance-grid > div[data-risk="account"] { border-left-color: var(--metric-analysis); background: var(--metric-analysis-soft); }
.inventory-balance-grid[data-risk="danger"] > div[data-risk="availability"] { border-left-color: var(--metric-danger); background: var(--metric-danger-soft); }
.inventory-balance-grid[data-risk="warning"] > div[data-risk="availability"] { border-left-color: var(--metric-warning); background: var(--metric-warning-soft); }

.quick-actions {
  margin: 0 0 20px;
  padding: 15px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 3px 0 0;
  font-size: 16px;
}

.quick-action-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.quick-action {
  position: relative;
  min-height: 68px;
  display: grid;
  justify-items: start;
  align-content: center;
  gap: 5px;
  padding: 10px 13px;
  border-color: var(--line-strong);
  background: #fff;
  color: var(--text-strong);
  text-align: left;
}

.quick-action::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--quick-accent, var(--blue));
  content: "";
}

.quick-action strong {
  color: var(--quick-accent, var(--blue-dark));
  font-size: 14px;
}

.quick-action[data-tone="quantity"] {
  --quick-accent: var(--metric-quantity);
  --quick-soft: var(--metric-quantity-soft);
}

.quick-action[data-tone="receive"] {
  --quick-accent: var(--metric-receive);
  --quick-soft: var(--metric-receive-soft);
}

.quick-action[data-tone="inventory"] {
  --quick-accent: var(--metric-revenue);
  --quick-soft: var(--metric-revenue-soft);
}

.quick-action[data-tone="analysis"] {
  --quick-accent: var(--metric-analysis);
  --quick-soft: var(--metric-analysis-soft);
}

.quick-action span {
  color: var(--muted);
  font-size: 12px;
}

.quick-action:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--quick-soft, var(--blue-soft));
  box-shadow: 0 4px 12px rgba(16, 24, 40, .08);
}

.dashboard-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, .72fr) minmax(0, 1.35fr);
  gap: 16px;
}

.dashboard-columns > div {
  min-width: 0;
}

.dashboard-columns > div > h2 {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #fff;
  color: var(--text-strong);
  font-size: 15px;
}

.dashboard-columns .table-wrap {
  border-radius: 0 0 8px 8px;
}

.pending-list {
  min-height: 330px;
  padding: 18px 16px;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  background: #fff;
}

.pending-item {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.pending-item:last-child { border-bottom: 0; }
.pending-item span { padding: 3px 6px; border-radius: 4px; background: #f2f4f7; color: #475467; font-size: 11px; font-weight: 800; text-align: center; }
.pending-item strong { min-width: 0; color: var(--text-strong); font-size: 12px; line-height: 1.55; }
.pending-item.danger span { background: var(--metric-danger-soft); color: var(--metric-danger); }
.pending-item.warning span { background: var(--metric-warning-soft); color: var(--metric-warning); }
.pending-item.safe span { background: var(--metric-profit-soft); color: var(--metric-profit); }

.pending-summary {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #b54708;
  font-size: 14px;
}

.pending-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #f79009;
  box-shadow: 0 0 0 4px #fffaeb;
}

.pending-list p {
  margin: 18px 0 8px;
  color: #475467;
  font-size: 13px;
  line-height: 1.7;
}

.pending-empty {
  display: grid;
  gap: 8px;
  color: var(--blue-dark);
}

.pending-empty span {
  color: var(--muted);
  font-size: 12px;
}

.two-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.two-cols > div {
  min-width: 0;
}

.two-cols > div > h2,
.two-cols > div > .chart-box {
  margin-left: 0;
  margin-right: 0;
}

.two-cols > div > h2 {
  margin-top: 0;
  margin-bottom: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #fff;
  color: var(--text-strong);
  font-size: 15px;
}

.two-cols > div > h2 + .table-wrap,
.two-cols > div > h2 + .chart-box {
  border-radius: 0 0 8px 8px;
}

.extra-stats {
  margin-top: 18px;
}

.settings-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.shipping-context {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin: -4px 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: #f8fafc;
}

.shipping-context label {
  display: grid;
  gap: 5px;
  min-width: 150px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.shipping-context #shipAccountStatus {
  align-self: center;
  color: #344054;
  font-weight: 700;
}

.gift-account-context {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 12px 0 0;
  padding: 11px 14px;
  border: 1px solid #f1cf79;
  border-left: 4px solid #d99b00;
  border-radius: 7px;
  background: #fffaf0;
}

.gift-account-context > div {
  display: grid;
  gap: 2px;
  min-width: 230px;
}

.gift-account-context > div span,
.gift-account-context > span { color: #725a16; font-size: 12px; }
.gift-account-context label { display: flex; align-items: center; gap: 8px; color: #694f0a; font-size: 12px; font-weight: 800; }
.gift-account-context select { min-width: 230px; background: #fff; }
.gift-account-context > strong { color: #8a6100; }
.gift-account-context.is-short { border-color: #ef9a9a; border-left-color: var(--danger); background: #fff5f5; }

.settings-strip label {
  width: 220px;
}

.account-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.account-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border: 1px solid #d9e1ec;
  border-radius: 6px;
  background: rgba(255, 255, 255, .82);
  color: #344054;
  font-size: 12px;
}

.inventory-cost-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(145px, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.inventory-cost-card {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-left: 4px solid #98a2b3;
  border-radius: 7px;
  background: #fff;
}

.inventory-cost-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.inventory-cost-card strong {
  color: var(--text-strong);
  font-size: 16px;
}

.inventory-cost-card b {
  color: #344054;
  font-size: 14px;
}

.inventory-cost-card.total { border-left-color: #475467; background: #f8fafc; }
.inventory-cost-card.battle-red { border-left-color: #c62828; background: #fff5f5; }
.inventory-cost-card.new-red { border-left-color: #ef6c75; background: #fffafb; }
.inventory-cost-card.battle-gold { border-left-color: #d49a00; background: #fff9e8; }
.inventory-cost-card.new-gold { border-left-color: #e5bd45; background: #fffdf4; }
.value-inventory-cost { color: #475467; font-weight: 800; }

.quality-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 5px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid #d7dee8;
  border-radius: 7px;
  background: #f6f8fb;
}

.quality-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 92px;
  min-height: 36px;
  padding: 0 13px;
  border-color: transparent;
  background: transparent;
  color: #344054;
  font-weight: 800;
  white-space: nowrap;
}

.quality-tab:hover {
  border-color: #b8c6d9;
  background: #fff;
}

.quality-tab.active {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
  box-shadow: 0 2px 5px rgba(37, 99, 235, .2);
}

.quality-tab > span {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: #e4e7ec;
  color: #475467;
  font-size: 12px;
  font-weight: 800;
}

.quality-tab.active > span {
  background: rgba(255, 255, 255, .22);
  color: #fff;
}

.quality-tab[data-draft-color="red"] {
  border-color: #f1a6aa;
  background: #fff0f1;
  color: #9f2330;
}

.quality-tab[data-draft-color="gold"] {
  border-color: #ecc95d;
  background: #fff6d9;
  color: #8a5b00;
}

.quality-tab.active[data-draft-color="red"] {
  border-color: #c92e3b;
  background: #c92e3b;
  color: #fff;
  box-shadow: 0 2px 6px rgba(201, 46, 59, .25);
}

.quality-tab.active[data-draft-color="gold"] {
  border-color: #bc8500;
  background: #bc8500;
  color: #fff;
  box-shadow: 0 2px 6px rgba(188, 133, 0, .24);
}

.quality-tab > span[data-draft-color="red"] { background: #f9d8db; color: #a62431; }
.quality-tab > span[data-draft-color="gold"] { background: #f9e7a8; color: #805400; }

.bottom-bar .bottom-quality-tabs {
  flex: 0 0 auto;
  gap: 4px;
  margin: 0;
  padding: 3px;
}

.bottom-bar .bottom-quality-tabs .quality-tab {
  min-width: 76px;
  min-height: 34px;
  padding: 0 9px;
}

.ship-price-quality {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: -4px 0 12px;
  color: #475467;
  font-size: 13px;
  font-weight: 800;
}

.ship-price-quality button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid #d0d5dd;
  background: #fff;
  color: #344054;
}

.ship-price-quality button.active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.ship-group-row td {
  padding: 0 !important;
  border-top: 1px solid #cbd5e1;
  border-bottom: 1px solid #d8dee8;
  background: #eef2f7 !important;
}

.ship-group-row button {
  display: flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #1f2937;
  font-weight: 800;
  text-align: left;
}

.ship-group-row button:hover { background: #e4eaf2; }
.ship-group-row button span { color: #2563eb; }
.ship-group-row button strong { font: inherit; }
.ship-group-counts {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 2px;
  font-style: normal;
}
.ship-group-row button .ship-group-count {
  min-width: 24px;
  padding: 2px 8px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .09);
}
.ship-group-row button .ship-group-count-red { border-color: #ef9fa7; background: #ffe1e4; color: #a6212f; }
.ship-group-row button .ship-group-count-gold { border-color: #e9c85e; background: #fff0bd; color: #805400; }

.gift-badge {
  display: block;
  width: fit-content;
  margin-top: 4px;
  padding: 2px 6px;
  border: 1px solid #f3c768;
  border-radius: 4px;
  background: #fff8e6;
  color: #9a6700;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.inventory-quantity {
  display: flex;
  min-width: 240px;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 7px;
}

.inventory-quantity > label,
.external-fields label {
  display: grid;
  gap: 5px;
  margin: 0;
  color: #475467;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.inventory-quantity input { width: 74px; min-width: 74px; }
.external-toggle {
  min-height: 32px;
  padding: 0 9px;
  border-color: #b8c6d9;
  background: #f8fafc;
  color: #344054;
  font-size: 12px;
}

.external-fields {
  display: flex;
  flex-basis: 100%;
  flex-wrap: wrap;
  align-items: end;
  gap: 9px;
  padding: 7px;
  border: 1px solid #d8e0ea;
  border-radius: 5px;
  background: #fff;
}

.external-fields input { width: 82px; min-width: 82px; }
.external-fields small { flex-basis: 100%; max-width: none; color: #667085; line-height: 1.4; white-space: normal; }

.source-cost,
.source-quantities {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
}

.source-cost > span,
.source-none {
  font-size: 12px;
  font-weight: 700;
  color: #475467;
  white-space: nowrap;
}

.source-cost label,
.source-quantities label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  color: #475467;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.source-cost input {
  width: 98px;
  min-width: 98px;
}

.source-quantities input {
  width: 68px;
  min-width: 68px;
}

.quality-row-label {
  display: inline-block;
  min-width: 250px;
  font-weight: 700;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .quality-tabs { width: 100%; }
  .quality-tab { min-width: 88px; flex: 1 0 auto; }
  .source-cost,
  .source-quantities { min-width: 190px; }
  .quality-row-label { min-width: 210px; }
  .ship-price-quality { width: 100%; flex-wrap: wrap; }
  .inventory-quantity { min-width: 220px; }
  .gift-account-context { align-items: stretch; }
  .gift-account-context label { display: grid; }
  .gift-account-context select { width: 100%; min-width: 0; }
}

@media (max-width: 1100px) {
  .inventory-cost-summary { grid-template-columns: repeat(3, minmax(145px, 1fr)); }
}

@media (max-width: 700px) {
  .inventory-cost-summary { grid-template-columns: repeat(2, minmax(135px, 1fr)); }
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(90px, 1fr));
  gap: 6px 12px;
  min-width: 220px;
}

.permission-grid label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
}

.tenant-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid #d7dee9;
  border-radius: 8px;
  background: #f4f6f9;
}

.tenant-switch {
  min-height: 38px;
  display: grid;
  place-content: center;
  gap: 1px;
  min-width: 112px;
  padding: 5px 12px;
  border: 1px solid transparent;
  background: transparent;
  color: #475467;
  font-weight: 800;
}

.tenant-switch small { font-size: 10px; font-weight: 700; }
.tenant-switch.tenant-blue.active { border-color: #79a9ff; background: #eaf2ff; color: #174ea6; }
.tenant-switch.tenant-orange.active { border-color: #f0a45e; background: #fff0df; color: #9a4b08; }
.tenant-switch:not(.active):hover { border-color: #c7d0dc; background: #fff; }

body[data-tenant-theme="blue"] .app-header { box-shadow: inset 0 -3px 0 #3b82f6; }
body[data-tenant-theme="orange"] .app-header { box-shadow: inset 0 -3px 0 #ed8a32; }
body.tenant-loading .page-stage { opacity: .72; pointer-events: none; }

.ship-tenant-badge {
  padding: 6px 9px;
  border: 1px solid #cdd5df;
  border-radius: 6px;
  background: #fff;
  color: #344054;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
body[data-tenant-theme="blue"] .ship-tenant-badge { border-color: #9cc0ff; background: #eff5ff; color: #174ea6; }
body[data-tenant-theme="orange"] .ship-tenant-badge { border-color: #f2b77d; background: #fff3e8; color: #984807; }

.multi-overview-summary { grid-template-columns: repeat(4, minmax(155px, 1fr)); margin: 0 0 12px; }
.multi-overview-summary > div { min-height: 106px; }
.multi-overview-summary small { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; }
.overview-availability { font-size: 17px !important; line-height: 1.2 !important; }
.overview-signal-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 18px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.overview-signal-strip > div { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-right: 1px solid var(--line); }
.overview-signal-strip > div:last-child { border-right: 0; }
.overview-signal-strip span { color: var(--muted); font-size: 11px; font-weight: 700; }
.overview-signal-strip strong { min-width: 0; overflow: hidden; color: var(--text-strong); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.overview-signal-strip .danger strong { color: var(--metric-danger); }
.overview-signal-strip .warning strong { color: var(--metric-warning); }
.overview-signal-strip .safe strong { color: var(--metric-profit); }
.multi-store-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.multi-store-panel { overflow: hidden; border: 1px solid var(--line); border-top: 4px solid #3b82f6; border-radius: 8px; background: #fff; }
.multi-store-panel.tenant-orange { border-top-color: #ed8a32; }
.multi-store-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 16px; border-bottom: 1px solid var(--line); background: #f8fafc; }
.multi-store-panel.tenant-orange > header { background: #fff8f1; }
.multi-store-panel header span { color: var(--muted); font-size: 11px; }
.multi-store-panel header h2 { margin: 2px 0 0; font-size: 18px; }
.store-metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.store-metric-grid > div { position: relative; min-height: 105px; display: grid; align-content: center; gap: 5px; padding: 14px 16px 14px 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.store-metric-grid > div::before { position: absolute; inset: 13px auto 13px 0; width: 3px; background: var(--metric-accent, #94a3b8); content: ""; }
.store-metric-grid > div[data-metric="quantity"] { --metric-accent: var(--metric-quantity); }
.store-metric-grid > div[data-metric="revenue"] { --metric-accent: var(--metric-revenue); }
.store-metric-grid > div[data-metric="cost"] { --metric-accent: var(--metric-cost); }
.store-metric-grid > div[data-metric="profit"] { --metric-accent: var(--metric-profit); }
.store-metric-grid > div[data-metric="receive"] { --metric-accent: var(--metric-receive); }
.store-metric-grid > div[data-metric="warning"] { --metric-accent: var(--metric-warning); }
.store-metric-grid > div:nth-child(2n) { border-right: 0; }
.store-metric-grid > div:nth-last-child(-n+2) { border-bottom: 0; }
.store-metric-grid span, .store-metric-grid small { color: var(--muted); font-size: 12px; }
.store-metric-grid strong { color: var(--text-strong); font-size: 17px; }
.overview-trend.increase { color: var(--success); }
.overview-trend.decrease { color: var(--danger); }
.overview-trend.flat { color: var(--muted); }
.overview-trend.cost-increase { color: var(--metric-warning); }
.overview-trend.cost-decrease { color: var(--metric-revenue); }
.store-stock-balance { display: grid; grid-template-columns: 1.15fr 1.35fr .75fr; border-top: 1px solid var(--line); background: #fbfcfe; }
.store-stock-balance > div { min-width: 0; display: grid; gap: 4px; padding: 12px 14px; border-right: 1px solid var(--line); }
.store-stock-balance > div:last-child { border-right: 0; }
.store-stock-balance span { color: var(--muted); font-size: 11px; }
.store-stock-balance strong { min-width: 0; overflow: hidden; color: var(--text-strong); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.permission-grid.readonly span { padding: 3px 6px; border: 1px solid #d8dee8; background: #f8fafc; color: #475467; font-size: 11px; }
.shared-user-row { background: #f8fafc; }

@media (max-width: 1180px) {
  .app-header { flex-wrap: wrap; }
  .header-current { min-width: 320px; }
  .tenant-switcher { order: 3; }
  .dashboard-metrics { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .multi-overview-summary { grid-template-columns: repeat(2, minmax(155px, 1fr)); }
}

@media (max-width: 820px) {
  .tenant-switcher { width: 100%; order: 4; }
  .tenant-switch { flex: 1; min-width: 0; }
  .multi-store-comparison { grid-template-columns: 1fr; }
  .overview-control-bar { align-items: stretch; }
  .overview-control-bar > div:first-child { width: 100%; }
  .period-segments { width: 100%; overflow-x: auto; }
  .period-segments button { flex: 1 0 auto; }
  .overview-control-bar .hint-text { width: 100%; text-align: left; }
  .dashboard-metrics { grid-template-columns: repeat(2, minmax(135px, 1fr)); }
  .inventory-balance-grid { grid-template-columns: 1fr; }
  .overview-signal-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-signal-strip > div:nth-child(2) { border-right: 0; }
  .overview-signal-strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .overview-signal-strip > div { align-items: flex-start; flex-direction: column; }
  .overview-signal-strip strong { overflow: visible; text-overflow: clip; white-space: normal; overflow-wrap: anywhere; }
  .store-metric-grid { grid-template-columns: 1fr; }
  .store-metric-grid > div { border-right: 0; }
  .store-metric-grid > div:nth-last-child(2) { border-bottom: 1px solid var(--line); }
  .store-stock-balance { grid-template-columns: 1fr; }
  .store-stock-balance > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .store-stock-balance > div:last-child { border-bottom: 0; }
}

.chart-box {
  min-height: 250px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.chart-box svg {
  display: block;
  width: 100%;
  height: 230px;
}

.chart-axis {
  stroke: #d0d5dd;
  stroke-width: 1;
}

.chart-line {
  fill: none;
  stroke-width: 3;
}

.chart-dot {
  fill: #fff;
  stroke-width: 2;
}

.chart-line.chart-profit,
.chart-dot.chart-profit {
  stroke: var(--metric-profit);
}

.chart-line.chart-sales,
.chart-dot.chart-sales {
  stroke: var(--metric-quantity);
}

.chart-label {
  fill: var(--muted);
  font-size: 13px;
}

.form-grid {
  display: grid;
  max-width: 440px;
  gap: 14px;
}

.compact-form {
  max-width: none;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

h2 {
  margin: 0 0 10px;
  color: var(--text-strong);
  font-size: 17px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

.button-link:hover {
  background: #dbeafe;
}

.compact-button {
  min-width: 0 !important;
  min-height: 32px;
  height: 32px !important;
  padding: 0 10px !important;
  font-size: 12px;
}

.drilldown-row,
.detail-result-row {
  cursor: pointer;
}

.drilldown-row td:first-child strong {
  color: var(--blue-dark);
}

.table-detail-button {
  min-width: 0;
  min-height: 30px;
  height: 30px;
  padding: 0 9px;
  border-color: #bfdbfe;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 700;
}

.table-detail-button:hover:not(:disabled) {
  border-color: #93c5fd;
  background: #dbeafe;
}

.record-canceled td {
  background: #fff7f7;
  color: #7f1d1d;
}

.record-canceled td:not(.value-profit):not(.value-cost):not(.value-revenue) {
  opacity: .82;
}

.record-corrected td {
  background: #fffbeb;
  color: #7c4a03;
}

.record-corrected td:not(.value-profit):not(.value-cost):not(.value-revenue) {
  opacity: .9;
}

.log-message {
  max-width: 520px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-pager,
.drawer-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 12px;
}

.detail-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  width: 100%;
  height: 100%;
  min-height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(15, 23, 42, .4);
}

.detail-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 41;
  width: min(1040px, 92vw);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line-strong);
  background: #fff;
  box-shadow: -18px 0 44px rgba(15, 23, 42, .16);
}

.detail-drawer-header {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.detail-drawer-header h2 {
  margin: 3px 0 0;
  font-size: 20px;
}

.icon-close {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 6px;
  color: #475467;
  font-size: 24px;
  line-height: 1;
}

.detail-drawer-body {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 18px 20px 28px;
  background: #f8fafc;
}

.drawer-loading {
  padding: 48px 20px;
  color: var(--muted);
  text-align: center;
}

.drawer-summary,
.drawer-actions,
.drawer-filters,
.record-fields {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-bottom: 14px;
}

.drawer-summary {
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 7px;
  background: #fff;
}

.drawer-summary span,
.record-fields span {
  color: var(--muted);
  font-size: 13px;
}

.drawer-summary strong,
.record-fields strong {
  margin-left: 4px;
  color: var(--text-strong);
}

.drawer-filters input,
.drawer-filters select {
  width: 160px;
  max-width: 100%;
}

.drawer-table {
  max-height: calc(100vh - 250px);
}

.drawer-table table {
  min-width: 1160px;
}

.record-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 1px;
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--line);
}

.record-meta > div {
  min-height: 70px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  padding: 11px 14px;
  background: #fff;
}

.record-meta span {
  color: var(--muted);
  font-size: 12px;
}

.record-meta strong {
  color: var(--text-strong);
  font-size: 15px;
}

.record-fields {
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.drawer-section {
  margin-top: 20px;
}

.drawer-section h3 {
  margin: 0 0 9px;
  color: var(--text-strong);
  font-size: 15px;
}

.impact-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
}

.impact-list > div {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.cancel-note {
  display: grid;
  gap: 5px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #fecaca;
  border-left: 4px solid var(--metric-danger);
  border-radius: 7px;
  background: var(--metric-danger-soft);
  color: #991b1b;
}

.cancel-note p {
  margin: 0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid #d0d5dd;
  border-radius: 999px;
  background: #f8fafc;
  color: #475467;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge.success {
  border-color: var(--green-line);
  background: var(--green-soft);
  color: var(--green-dark);
}

.status-badge.warning {
  border-color: #f7d48b;
  background: #fffaeb;
  color: #b54708;
}

.status-badge.danger {
  border-color: #fda29b;
  background: #fff1f0;
  color: #b42318;
}

.status-badge.info {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.status-stack,
.stacked-action {
  display: grid;
  justify-items: start;
  gap: 7px;
}

.history-sku-identity { display: inline-grid; gap: 4px; min-width: 0; }
.history-sku-identity > span { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.history-sku-identity > b { color: #27364a; font-size: 12px; font-weight: 750; white-space: normal; }
.log-shipment-summary { display: grid; gap: 5px; min-width: 260px; }
.log-shipment-item { display: block; }
.deduction-lines { display: grid; gap: 6px; min-width: min(390px, 100%); }
.deduction-line {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: #27364a;
}
.deduction-line > i { color: #667085; font-style: normal; font-size: 15px; font-weight: 900; }
.deduction-line > strong { min-width: 0; color: #27364a; font-size: 12px; font-weight: 800; }
.deduction-account {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 2px 9px;
  border: 1px solid #93bde9;
  border-radius: 999px;
  background: #edf6ff;
  color: #174f8f;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.deduction-line-gift .deduction-account { border-color: #e4c55d; background: #fff6ce; color: #765300; }
.deduction-line-external .deduction-account,
.deduction-line-none .deduction-account { border-color: #cbd5e1; background: #f8fafc; color: #475467; }
.deduction-item-tags { display: inline-flex; align-items: center; gap: 4px; }
.deduction-history-note { color: #667085; font-size: 12px; font-weight: 700; }

.usage-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.usage-pills span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 25px;
  padding: 2px 7px;
  border: 1px solid #e4e7ec;
  border-radius: 6px;
  background: #f8fafc;
  color: #667085;
  font-size: 11px;
}

.usage-pills strong {
  color: var(--text-strong);
}

.stacked-action {
  min-width: 150px;
}

.empty-row td {
  height: 100px;
  color: var(--muted-light);
  text-align: center;
}

.warn-text {
  color: #b45309;
  font-size: 12px;
}

.release-toolbar {
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.release-toolbar > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.release-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.release-filter {
  min-height: 32px;
  padding: 5px 14px;
}

.release-filter.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-weight: 700;
}

.release-timeline {
  width: min(920px, 100%);
  margin: 18px auto 0;
}

.release-entry {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
}

.release-rail {
  position: relative;
}

.release-rail::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 8px;
  width: 2px;
  background: #dbe4ef;
  content: "";
}

.release-rail span {
  position: absolute;
  top: 23px;
  left: 3px;
  z-index: 1;
  width: 12px;
  height: 12px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 1px #93c5fd;
}

.release-entry[data-scope="web"] .release-rail span {
  background: var(--green);
  box-shadow: 0 0 0 1px #86efac;
}

.release-entry[data-scope="both"] .release-rail span {
  background: #7c3aed;
  box-shadow: 0 0 0 1px #c4b5fd;
}

.release-card {
  margin: 0 0 14px;
  padding: 17px 20px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.release-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.release-meta > strong {
  color: var(--text-strong);
  font-size: 15px;
}

.release-scope,
.release-status {
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
}

.release-scope.desktop {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.release-scope.web {
  background: var(--green-soft);
  color: var(--green-dark);
}

.release-scope.both {
  background: #f5f3ff;
  color: #6d28d9;
}

.release-status.stable {
  background: #f2f4f7;
  color: #475467;
}

.release-status.withdrawn {
  background: #fff1f2;
  color: #be123c;
}

.release-card h3 {
  margin: 9px 0 8px;
  color: var(--text-strong);
  font-size: 16px;
}

.release-card ul {
  margin: 0;
  padding-left: 20px;
  color: #475467;
  line-height: 1.75;
}

.release-empty {
  padding: 70px 20px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  top: 76px;
  right: 22px;
  bottom: auto;
  z-index: 20;
  max-width: min(420px, calc(100vw - 44px));
  max-height: calc(100vh - 176px);
  overflow: auto;
  padding: 12px 15px;
  padding-right: 42px;
  border: 1px solid #344054;
  border-radius: 8px;
  background: #182230;
  color: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .2);
  overflow-wrap: anywhere;
}

.toast.toast-rich {
  display: grid;
  gap: 5px;
  min-width: min(370px, calc(100vw - 44px));
  max-width: min(520px, calc(100vw - 44px));
  border-color: #18743d;
  background: #123b28;
  line-height: 1.45;
}
.toast.toast-rich > strong { color: #d9ffe8; font-size: 14px; }
.toast.toast-rich b { color: #fff; }
.toast-message { display: block; white-space: pre-wrap; }
.toast-close {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  width: 28px;
  height: 28px;
  min-height: 0;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: 18px;
  line-height: 1;
}
.toast-close:hover { border-color: rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .18); }

@media (max-width: 640px) {
  .toast {
    top: 62px;
    right: 10px;
    left: 10px;
    width: auto;
    min-width: 0;
    max-width: none;
    max-height: calc(100vh - 174px);
  }
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .page-stage {
    padding: 16px;
  }

  .page {
    padding: 18px;
  }

  .header-user {
    display: none;
  }

  .header-version-link {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .quick-action-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-columns > div:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .app-shell,
  .app-shell.nav-collapsed {
    width: 100%;
    height: auto;
    min-height: 100vh;
    display: block;
  }

  .side-panel,
  .nav-collapsed .side-panel {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 10;
    width: 252px;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
    box-shadow: 12px 0 28px rgba(15, 23, 42, .18);
  }

  .nav-collapsed .side-panel {
    transform: translateX(-102%);
    pointer-events: none;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9;
    display: block;
    width: 100%;
    height: 100%;
    min-height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(15, 23, 42, .36);
    opacity: 1;
  }

  .nav-collapsed .sidebar-backdrop {
    opacity: 0;
    pointer-events: none;
  }

  .workspace {
    min-height: 100vh;
  }

  .app-header {
    position: sticky;
    top: 0;
    z-index: 5;
    min-height: 66px;
    padding: 10px 14px;
  }

  .open-tabs {
    padding: 0 10px;
  }

  .page-stage {
    min-height: calc(100vh - 110px);
    padding: 10px;
  }

  .page {
    padding: 14px;
    border-radius: 8px;
  }

  .two-cols {
    grid-template-columns: 1fr;
  }

  .dashboard-columns {
    grid-template-columns: 1fr;
  }

  .dashboard-columns > div:last-child {
    grid-column: auto;
  }

  .quick-action-list {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .toolbar,
  .settings-strip,
  .bottom-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar > strong {
    margin-right: 0;
  }

  .toolbar input,
  .toolbar select,
  .settings-strip label {
    width: 100%;
    max-width: none;
  }

  .bottom-bar strong,
  .bottom-bar strong + strong {
    margin-left: 0;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-drawer {
    width: 100%;
  }

  .detail-drawer-body {
    padding: 14px;
  }

  .record-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .drawer-filters {
    align-items: stretch;
    flex-direction: column;
  }

  .drawer-filters input,
  .drawer-filters select,
  .drawer-filters button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .login-shell {
    padding: 14px;
  }

  .login-panel {
    padding: 26px 22px 20px;
  }

  .login-brand {
    gap: 12px;
  }

  .login-logo {
    width: 58px;
    height: 58px;
  }

  .login-panel h1 {
    font-size: 20px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .header-current h1 {
    font-size: 17px;
  }
}

.sync-status {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-left: 10px;
  padding: 1px 7px;
  border-radius: 3px;
  color: #166534;
  background: #dcfce7;
  font-size: 11px;
  font-weight: 700;
}

.sync-status.is-stale {
  color: #991b1b;
  background: #fee2e2;
}

.reconciliation-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.reconciliation-summary > div {
  padding: 14px 18px;
  border-right: 1px solid var(--line);
}

.reconciliation-summary > div:last-child { border-right: 0; }
.reconciliation-summary span { display: block; color: var(--muted); font-size: 12px; }
.reconciliation-summary strong { display: block; margin-top: 4px; color: var(--text); font-size: 23px; }
.reconciliation-summary strong.is-positive { color: #15803d; }
.reconciliation-summary strong.is-negative { color: #b91c1c; }

.reconciliation-table-wrap { max-height: 520px; scroll-margin-top: 78px; }
.reconciliation-table-wrap input { width: 100px; text-align: center; font-weight: 700; }
.reconciliation-row.has-difference { background: #fff7ed; }
.reconciliation-row.has-shortage { background: #fff1f2; }
.reconciliation-delta { font-weight: 800; }
.inventory-change-tabs {
  display: inline-flex;
  gap: 4px;
  margin: 0 0 12px;
  padding: 4px;
  border: 1px solid #d8e0ea;
  border-radius: 9px;
  background: #f5f7fa;
}
.inventory-change-tabs button {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #475467;
  font-size: 12px;
  font-weight: 800;
}
.inventory-change-tabs button:hover { background: #fff; color: #1d2939; }
.inventory-change-tabs button.active { border-color: #a9c6f8; background: #eaf2ff; color: #174ea6; box-shadow: 0 1px 2px rgba(37, 99, 235, .1); }
.inventory-change-pane { min-width: 0; }
.inventory-change-pane-reconciliation { padding-bottom: 56px; }
.inventory-change-pane-reconciliation .reconciliation-toolbar {
  position: sticky;
  top: 0;
  z-index: 6;
  margin-top: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 3px 10px rgba(15, 23, 42, .06);
}
.reconciliation-submit-bar { position: sticky; bottom: 0; z-index: 6; box-shadow: 0 -5px 16px rgba(15, 23, 42, .08); }
.reconciliation-submit-bar input { flex: 1; min-width: 260px; }

.audit-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.audit-item { padding: 15px 18px; border-right: 1px solid var(--line); }
.audit-item:last-child { border-right: 0; }
.audit-item span { display: block; color: var(--muted); font-size: 12px; }
.audit-item strong { display: block; margin-top: 5px; font-size: 22px; }
.audit-item.is-danger strong { color: #b91c1c; }
.audit-item.is-warning strong { color: #c2410c; }
.audit-item.is-ok strong { color: #15803d; }

@media (max-width: 820px) {
  .reconciliation-summary,
  .audit-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reconciliation-summary > div:nth-child(2),
  .audit-item:nth-child(2) { border-right: 0; }
  .reconciliation-submit-bar input { min-width: 0; }
  .inventory-change-tabs { display: flex; width: 100%; }
  .inventory-change-tabs button { flex: 1 1 0; padding-inline: 8px; }
}

/* v1.0.40 business workspace */
.catalog-tools {
  min-height: 48px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
}

.catalog-search {
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #344054;
  font-size: 12px;
  white-space: nowrap;
}

.catalog-search input { width: min(280px, 32vw); min-height: 34px; }
.catalog-filters { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid #d8dee8; border-radius: 7px; background: #fff; }
.catalog-filters button { min-height: 30px; padding: 0 11px; border: 0; background: transparent; color: #667085; font-size: 12px; font-weight: 700; }
.catalog-filters button:hover { background: #f2f4f7; color: #344054; }
.catalog-filters button.active { background: var(--blue); color: #fff; }
.catalog-count { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.compact-tools { margin-top: 2px; }

.sku-name-cell { min-width: 210px; display: flex; align-items: center; gap: 8px; }
.sku-name-cell > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sku-name-copy { min-width: 0; display: grid; justify-items: start; gap: 4px; }
.sku-name-copy > span:last-child { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.sku-name-copy .quality-row-label { min-width: 0; }
.sku-thumbnail-button { flex: 0 0 48px; width: 48px; height: 48px; padding: 0; overflow: hidden; border: 1px solid #cfd7e3; border-radius: 6px; background: #fff; cursor: zoom-in; box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }
.sku-thumbnail-button:hover { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(37, 99, 235, .12); }
.sku-thumbnail-button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.sku-thumbnail-button img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sku-image-preview { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 24px; background: rgba(15, 23, 42, .78); }
.sku-image-preview[hidden] { display: none; }
.sku-image-preview-panel { position: relative; width: min(640px, calc(100vw - 48px)); overflow: hidden; border: 1px solid rgba(255, 255, 255, .28); border-radius: 8px; background: #0f172a; box-shadow: 0 24px 70px rgba(0, 0, 0, .42); }
.sku-image-preview-panel img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; background: #000; }
.sku-image-preview-panel strong { display: block; padding: 12px 52px 13px 15px; color: #fff; font-size: 14px; }
.sku-image-preview-close { position: absolute; right: 10px; bottom: 8px; z-index: 1; width: 36px; height: 36px; padding: 0; border: 1px solid rgba(255, 255, 255, .32); border-radius: 50%; background: rgba(15, 23, 42, .82); color: #fff; font-size: 25px; line-height: 1; }
.quality-badge { flex: 0 0 auto; display: inline-flex; min-height: 21px; align-items: center; padding: 1px 7px; border: 1px solid transparent; border-radius: 4px; font-size: 11px; font-weight: 800; }
.quality-badge-battle { border-color: #fecaca; background: #fff1f2; color: #b42318; }
.quality-badge-historic { border-color: #f6d38a; background: #fffaeb; color: #a15c00; }
.quality-badge-new { border-color: #99dfcf; background: #ecfdf7; color: #08745f; }
.quality-badge-shared { border-color: #c7d2fe; background: #f3f5ff; color: #4338ca; }
.quality-badge-legacy { border-color: #d0d5dd; background: #f2f4f7; color: #475467; }

tr.sku-row td { background: #fff; }
tr.sku-row.quality-battle td { background: #fffafa; }
tr.sku-row.quality-historic td { background: #fffdf7; }
tr.sku-row.quality-new td { background: #f7fcfb; }
tr.sku-row.quality-shared td { background: #fafbff; }
tr.sku-row.color-red td:first-child { box-shadow: inset 4px 0 0 #d85c68; }
tr.sku-row.color-gold td:first-child { box-shadow: inset 4px 0 0 #d6a21f; }
tr.sku-row.low td:first-child { box-shadow: inset 4px 0 0 var(--metric-danger); }
tr.sku-row:hover td { background: #f5f9ff; filter: none; }
.catalog-empty-row td { height: 92px; color: var(--muted); text-align: center; white-space: normal; }

#ship .bottom-bar {
  position: sticky;
  bottom: -22px;
  z-index: 4;
  margin: 14px -22px -22px;
  padding: 13px 22px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 -8px 20px rgba(15, 23, 42, .07);
}

.operation-panel { max-width: 980px; padding: 22px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.operation-title { display: grid; gap: 4px; margin-bottom: 18px; color: var(--text-strong); font-size: 18px; font-weight: 800; }
.operation-title small { color: var(--muted); font-size: 12px; font-weight: 500; }
.operation-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 14px; }
.operation-grid .wide { grid-column: span 2; }
.operation-preview { min-height: 48px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin: 16px 0; padding: 10px 12px; border: 1px solid #d8e0ea; border-left: 4px solid var(--blue); border-radius: 6px; background: #f8fafc; color: var(--muted); }
.operation-preview strong { color: var(--text-strong); }
.operation-preview b { margin-left: auto; color: var(--blue-dark); }
.operation-preview.is-danger { border-color: #fecaca; border-left-color: var(--metric-danger); background: #fff5f5; color: #991b1b; }
.operation-preview.is-danger b { color: var(--metric-danger); }
.tenant-switch[aria-busy="true"]::after { display: inline-block; margin-left: 4px; content: "同步中"; font-size: 9px; font-weight: 600; opacity: .72; }

/* v1.0.44: inventory color owns the row; appearance is an inline capsule. */
.sku-name-cell { min-width: 300px; white-space: nowrap; }
.sku-name-copy { min-width: max-content; }
.sku-name-line { display: inline-flex; min-width: 0; align-items: center; gap: 7px; white-space: nowrap; }
.sku-name-copy > .sku-name-line, .sku-name-cell > .sku-name-line { flex: 0 0 auto; max-width: none; overflow: visible; text-overflow: clip; }
.sku-name-text { overflow: visible; color: var(--text-strong); font-weight: 700; text-overflow: clip; white-space: nowrap; }
.visual-badge { display: inline-flex; min-height: 22px; align-items: center; padding: 1px 9px; border: 1px solid transparent; border-radius: 999px; font-size: 11px; font-weight: 800; line-height: 1.25; white-space: nowrap; }
.visual-badge-red { border-color: #f0b7bd; background: #fff0f1; color: #a83240; }
.visual-badge-gold { border-color: #ead18b; background: #fff8df; color: #8d6100; }
.visual-badge-yellow { border-color: #ead771; background: #fff9d8; color: #856000; }
.visual-badge-green { border-color: #a6d9b2; background: #edf9f0; color: #1f7441; }
.visual-badge-black-red { border-color: #d2b9bf; background: #f5f1f2; color: #902c3d; }
.visual-badge-black { border-color: #c8ced7; background: #f1f3f6; color: #46515f; }
.visual-badge-white { border-color: #cbd5e1; background: #fff; color: #64748b; }
.visual-badge-purple { border-color: #d0bceb; background: #f5effd; color: #7047a3; }
.visual-badge-neutral { border-color: #d0d5dd; background: #f2f4f7; color: #475467; }
.sku-name-copy { align-content: start; }
.theme-inline { display: inline-flex; max-width: 100%; align-items: center; margin: 1px 5px 1px 0; padding: 2px 5px; border-radius: 4px; background: rgba(255, 255, 255, .56); font-size: 12px; font-weight: 700; vertical-align: middle; }
.record-item-themes { white-space: normal; }
tr.color-red > td, tr.sku-row.color-red > td { background: #fff1f2 !important; }
tr.color-red > td:first-child, tr.sku-row.color-red > td:first-child { box-shadow: inset 4px 0 0 #c44853; }
tr.color-gold > td, tr.sku-row.color-gold > td { background: #fff8df !important; }
tr.color-gold > td:first-child, tr.sku-row.color-gold > td:first-child { box-shadow: inset 4px 0 0 #b57600; }
tr.color-red:hover > td, tr.sku-row.color-red:hover > td { background: #ffe8eb !important; }
tr.color-gold:hover > td, tr.sku-row.color-gold:hover > td { background: #fff1c7 !important; }

@media (max-width: 900px) {
  .sku-thumbnail-button { flex-basis: 42px; width: 42px; height: 42px; }
  .sku-image-preview { padding: 14px; }
  .sku-image-preview-panel { width: calc(100vw - 28px); }
  .catalog-search { width: 100%; min-width: 0; }
  .catalog-search input { width: 100%; }
  .catalog-filters { max-width: 100%; overflow-x: auto; }
  .catalog-count { margin-left: 0; }
  .operation-grid { grid-template-columns: 1fr; }
  .operation-grid .wide { grid-column: auto; }
  #ship .bottom-bar { bottom: -14px; margin: 12px -14px -14px; padding: 12px 14px; }
}

/* v1.0.45: quality and appearance are separate, compact identity rows. */
.sku-name-stack { min-width: 0; display: grid; gap: 3px; }
.sku-quality-line { display: inline-flex; align-items: center; gap: 5px; min-height: 22px; white-space: nowrap; }
.quality-color-badge,
.appearance-badge { display: inline-flex; min-height: 22px; align-items: center; padding: 1px 9px; border: 1px solid; border-radius: 999px; font-size: 11px; font-weight: 800; line-height: 1.2; white-space: nowrap; box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }
.quality-color-badge-red { border-color: #d86b75; background: #ffdfe3; color: #9f1d2b; }
.quality-color-badge-gold { border-color: #d4a52b; background: #ffe9a8; color: #805800; }
.appearance-badge-yellow { border-color: #d8b52d; background: #ffe98f; color: #745400; }
.appearance-badge-green { border-color: #45a866; background: #c9f1d2; color: #176534; }
.appearance-badge-black-red { border-color: #aa5260; background: #eadcdf; color: #7b1e2c; }
.appearance-badge-black { border-color: #7b8794; background: #e4e8ed; color: #344054; }
.appearance-badge-white { border-color: #aab5c2; background: #fff; color: #52606d; }
.appearance-badge-purple { border-color: #9b72c5; background: #eadcff; color: #633c91; }
.appearance-badge-red { border-color: #d86b75; background: #ffdfe3; color: #9f1d2b; }
.appearance-badge-gold { border-color: #d4a52b; background: #ffe9a8; color: #805800; }
.sku-name-line { gap: 6px; overflow: visible; }
.sku-name-copy { min-width: 0; }
.sku-name-text { flex: 0 0 auto; }
.record-item-with-image { display: inline-flex; align-items: center; gap: 5px; margin: 1px 5px 1px 0; }
.record-item-with-image .sku-thumbnail-button { width: 28px; height: 28px; flex-basis: 28px; }
#ship .table-wrap { overflow-x: auto; }
#ship table { min-width: 980px; }
#ship table th:nth-child(1), #ship table td:nth-child(1) { min-width: 300px; }
#ship table th:nth-child(2), #ship table td:nth-child(2) { min-width: 150px; }
#ship table th:nth-child(3), #ship table td:nth-child(3) { min-width: 78px; }
#ship table th:nth-child(4), #ship table td:nth-child(4) { min-width: 92px; }
#ship table th:nth-child(5), #ship table td:nth-child(5) { min-width: 210px; }
#ship table th:nth-child(6), #ship table td:nth-child(6), #ship table th:nth-child(7), #ship table td:nth-child(7) { min-width: 100px; }

/* v1.0.52: per-account shipment usage statistics. */
.shipping-stats-toolbar { align-items: center; gap: 12px; }
.shipping-stats-toolbar > div:first-child { display: grid; gap: 3px; margin-right: auto; }
.shipping-stats-toolbar label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.shipping-stats-toolbar input { width: 150px; }
.shipping-stats-summary { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.shipping-stats-summary > div { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.shipping-stats-summary span { color: var(--muted); font-size: 12px; font-weight: 700; }
.shipping-stats-summary strong { color: var(--text-strong); font-size: 24px; }
.shipping-stats-table td:nth-child(n+4):nth-child(-n+6),
.shipping-stats-table th:nth-child(n+4):nth-child(-n+6) { text-align: center; }
.shipping-stats-table td:nth-child(2) .hint-text { margin-left: 7px; white-space: nowrap; }

@media (max-width: 820px) {
  .shipping-stats-toolbar { align-items: stretch; }
  .shipping-stats-toolbar > div:first-child { width: 100%; }
  .shipping-stats-toolbar label { flex: 1; }
  .shipping-stats-toolbar input { width: 100%; }
  .shipping-stats-summary { grid-template-columns: 1fr; }
  .shipping-stats-summary > div { min-height: 56px; }
  .shipping-stats-table { min-width: 780px; }
}
