:root {
  --blue: #1677e8;
  --blue-dark: #0f63c7;
  --blue-soft: #eaf3ff;
  --ink: #1e293b;
  --muted: #748094;
  --line: #e6edf5;
  --panel: #ffffff;
  --bg: #f6f9fc;
  --danger: #ef4444;
  --shadow: 0 18px 45px rgba(31, 68, 116, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1120px;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  font-family:
    Inter,
    "PingFang SC",
    "Microsoft YaHei",
    Arial,
    sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(22, 119, 232, 0.12), transparent 35%),
    linear-gradient(315deg, rgba(21, 184, 202, 0.12), transparent 32%),
    #f6f9fc;
}

.login-screen.hidden {
  display: none;
}

.app-shell.auth-hidden {
  display: none;
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) 420px;
  gap: 34px;
  width: min(920px, 100%);
  align-items: center;
}

.login-brand {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

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

.login-brand h1 {
  margin: 0;
  color: #123154;
  font-size: 28px;
  line-height: 1.2;
}

.login-brand p {
  margin: 8px 0 0;
  color: #64748b;
  font-size: 15px;
}

.login-card {
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(31, 68, 116, 0.16);
}

.login-head {
  display: grid;
  gap: 5px;
  margin-bottom: 4px;
}

.login-head strong {
  color: #0f172a;
  font-size: 22px;
}

.login-head span,
.login-card label span {
  color: #64748b;
  font-size: 13px;
}

.login-card label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.login-card input {
  width: 100%;
  height: 42px;
  border: 1px solid #dbe5ef;
  border-radius: 7px;
  background: #fff;
  color: #1e293b;
  outline: 0;
  padding: 0 12px;
}

.login-card input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(22, 119, 232, 0.1);
}

.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 8px;
}

.password-field button,
.login-options button {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 800;
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #475569;
  font-size: 13px;
}

.login-options label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.login-options input {
  width: 15px;
  height: 15px;
}

.login-error {
  min-height: 18px;
  margin: 0;
  color: #ef4444;
  font-size: 13px;
}

.login-submit {
  width: 100%;
  height: 42px;
}

.hidden-by-role {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: 276px minmax(844px, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.2s ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 76px minmax(844px, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f3f8ff 100%);
}

.brand {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 34px;
  gap: 10px;
  align-items: center;
  height: 82px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--line);
}

.brand-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, #0a82ff, #1360ce);
  box-shadow: 0 10px 22px rgba(22, 119, 232, 0.24);
}

.brand-icon svg,
.nav-icon svg,
.bell svg,
.settings-mark svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-icon svg {
  width: 23px;
  height: 23px;
}

.brand h1 {
  margin: 0 0 4px;
  overflow: hidden;
  font-size: 17px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: #64748b;
}

.brand-collapse {
  background: #f0f4f9;
  border: 0;
  font-weight: 700;
}

.nav {
  flex: 1;
  padding: 18px 16px 10px;
  overflow: auto;
}

.nav-link,
.nav-title {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #536172;
  font-size: 14px;
  font-weight: 650;
  text-align: left;
}

.nav-title {
  padding: 0 12px;
  margin-top: 8px;
}

.nav-title > span:first-child,
.nav-link {
  gap: 12px;
}

.nav-title > span:first-child {
  display: inline-flex;
  align-items: center;
}

.nav-link {
  padding: 0 14px;
}

.nav-link:hover,
.nav-title:hover {
  background: #eef6ff;
  color: var(--blue);
}

.nav-link.active {
  background: #dfeeff;
  color: var(--blue);
}

.nav-icon {
  display: inline-grid;
  width: 21px;
  height: 21px;
  place-items: center;
  color: #5f6e7f;
}

.nav-link:hover .nav-icon,
.nav-title:hover .nav-icon,
.nav-link.active .nav-icon {
  color: var(--blue);
}

.nav-children {
  display: grid;
  gap: 4px;
  padding: 4px 0 12px 24px;
}

.nav-group:not(.open) .nav-children {
  display: none;
}

.nav-group:not(.open) .chevron {
  transform: rotate(180deg);
}

.chevron {
  transition: transform 0.16s ease;
}

.tip-card {
  margin: 12px 22px 24px;
  padding: 16px;
  border: 1px solid #d8e9fb;
  border-radius: 8px;
  background: #eaf4ff;
}

.tip-card strong {
  display: block;
  margin-bottom: 12px;
  color: var(--blue);
}

.tip-card p {
  margin: 0 0 14px;
  color: #66758a;
  font-size: 13px;
  line-height: 1.65;
}

.tip-card button,
.collapse-bottom {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 700;
}

.collapse-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 32px 24px;
  color: #64748b;
  font-size: 14px;
  text-align: left;
}

.sidebar-collapsed .brand {
  grid-template-columns: 1fr;
  justify-items: center;
  padding-inline: 18px;
}

.sidebar-collapsed .brand-copy,
.sidebar-collapsed .brand-collapse,
.sidebar-collapsed .nav-text,
.sidebar-collapsed .chevron,
.sidebar-collapsed .nav-children,
.sidebar-collapsed .tip-card,
.sidebar-collapsed .collapse-bottom span {
  display: none;
}

.sidebar-collapsed .nav {
  padding-inline: 12px;
}

.sidebar-collapsed .nav-title,
.sidebar-collapsed .nav-link {
  justify-content: center;
  padding-inline: 0;
}

.sidebar-collapsed .nav-icon svg {
  width: 22px;
  height: 22px;
}

.sidebar-collapsed .nav-title > span:first-child,
.sidebar-collapsed .nav-link {
  gap: 0;
}

.sidebar-collapsed .collapse-bottom {
  justify-content: center;
  padding-inline: 0;
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: 1fr minmax(360px, 460px) 1fr;
  gap: 18px;
  align-items: center;
  height: 78px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
}

.topbar-left {
  display: flex;
  align-items: center;
}

.mobile-menu {
  display: none;
}

.global-search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 42px;
  justify-self: center;
  padding: 0 14px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #fff;
}

.global-search input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
}

.bell {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  background: #fff;
  color: #334155;
}

.bell span {
  position: absolute;
  top: -5px;
  right: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
}

.bell span:not(.has-unread) {
  background: #94a3b8;
}

.topbar-actions {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.account-settings {
  display: inline-flex;
  height: 42px;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 4px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.avatar {
  display: inline-block;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 36%, #58a5ff 0 18%, transparent 19%),
    radial-gradient(circle at 50% 90%, #0969d9 0 36%, transparent 37%),
    #dcecff;
}

.user-name {
  white-space: nowrap;
}

.settings-mark {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: #64748b;
}

.account-menu {
  position: absolute;
  top: 52px;
  right: 0;
  z-index: 40;
  display: none;
  width: 220px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 45px rgba(15, 23, 42, 0.16);
}

.account-menu.show {
  display: block;
}

.account-menu-head {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: center;
  padding: 9px 8px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}

.account-menu-head strong,
.account-menu-head small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-head small {
  color: #64748b;
  font-size: 12px;
}

.account-menu-head em {
  display: inline-flex;
  width: fit-content;
  margin-top: 5px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #eaf4ff;
  color: var(--blue);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.account-badge {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: #f5628f;
  color: #fff;
  font-weight: 800;
}

.account-badge.large {
  width: 54px;
  height: 54px;
  font-size: 20px;
}

.account-menu button {
  display: grid;
  width: 100%;
  grid-template-columns: 34px 1fr;
  align-items: center;
  min-height: 46px;
  border: 0;
  border-radius: 7px;
  background: #fff;
  color: #334155;
  font-size: 16px;
  text-align: left;
}

.account-menu button:hover {
  background: #f4f8fc;
  color: var(--blue);
}

.account-menu button span:first-child {
  color: #64748b;
  text-align: center;
}

.content {
  padding: 26px 28px;
}

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.page-heading h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: #0f172a;
  font-size: 24px;
  line-height: 1.2;
  white-space: nowrap;
}

.page-heading h2 span {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 13px;
  border-radius: 999px;
  background: #d8ebff;
  color: var(--blue);
  font-size: 15px;
}

.page-heading small {
  color: #64748b;
  font-size: 15px;
  font-weight: 500;
}

.heading-actions {
  display: flex;
  gap: 10px;
}

.primary,
.secondary {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 15px;
  border-radius: 7px;
  font-weight: 700;
  font-size: 14px;
}

.primary {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
  box-shadow: 0 10px 20px rgba(22, 119, 232, 0.15);
}

.primary:hover {
  background: var(--blue-dark);
}

.primary.loading {
  position: relative;
  cursor: wait;
  opacity: 0.9;
}

.primary.loading::before {
  content: "";
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.secondary {
  border: 1px solid #dbe5ef;
  background: #fff;
  color: #475569;
}

.danger-lite {
  color: #e05252;
}

.main-grid {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.insight-column {
  display: grid;
  gap: 18px;
}

.info-card,
.filters,
.table-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.info-card {
  padding: 18px;
}

.info-card h3 {
  margin: 0 0 16px;
  color: #334155;
  font-size: 15px;
}

.level-list {
  display: grid;
  gap: 13px;
}

.level-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 11px;
  align-items: center;
}

.level-code {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}

.level-item strong {
  display: block;
  margin-bottom: 2px;
  font-size: 14px;
}

.level-item span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.donut-wrap {
  display: grid;
  place-items: center;
  min-height: 148px;
}

.donut {
  position: relative;
  display: grid;
  width: 128px;
  height: 128px;
  place-items: center;
  border-radius: 50%;
  background: transparent;
}

.donut::after {
  content: none;
}

.donut-svg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.donut-track,
.donut-segment {
  fill: none;
  stroke-width: 28;
}

.donut-track {
  stroke: #e7edf5;
}

.donut-segment {
  cursor: pointer;
  pointer-events: stroke;
  transition: stroke-width 0.16s ease, filter 0.16s ease;
}

.donut-segment:hover {
  filter: drop-shadow(0 6px 10px rgba(15, 23, 42, 0.2));
  stroke-width: 31;
}

.donut span {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  color: #64748b;
}

.donut strong {
  color: var(--ink);
  font-size: 18px;
}

.donut small {
  font-size: 12px;
}

.donut-tooltip {
  position: absolute;
  z-index: 5;
  max-width: 190px;
  padding: 7px 9px;
  border: 1px solid #dbe5ef;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.16);
  color: #334155;
  font-size: 12px;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 10px));
  transition: opacity 0.12s ease;
}

.donut-tooltip.show {
  opacity: 1;
}

.legend {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 12px;
  font-size: 12px;
}

.legend-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  min-width: 0;
  color: #475569;
}

.legend-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.legend-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
  flex: 1 1 auto;
}

.legend-copy strong {
  color: #334155;
  font-size: 12px;
  line-height: 1.2;
}

.legend-copy small {
  color: #64748b;
  font-size: 11px;
  line-height: 1.25;
}

.legend-item em {
  flex: 0 0 auto;
  color: #475569;
  font-style: normal;
  font-weight: 700;
  line-height: 1.2;
}

.product-panel {
  min-width: 0;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) repeat(4, minmax(118px, 0.72fr)) auto auto;
  gap: 12px;
  align-items: end;
  padding: 20px;
  margin-bottom: 18px;
}

.filters label {
  display: grid;
  gap: 7px;
  color: #475569;
  font-size: 13px;
  font-weight: 650;
}

.filters input,
.filters select,
.form-grid input,
.form-grid select,
.pagination select {
  width: 100%;
  height: 38px;
  border: 1px solid #dbe5ef;
  border-radius: 7px;
  background: #fff;
  color: #1f2937;
  outline: 0;
}

.filters input,
.form-grid input {
  padding: 0 12px;
}

.filters select,
.form-grid select,
.pagination select {
  padding: 0 32px 0 12px;
}

.search-field {
  position: relative;
}

.search-field span {
  position: absolute;
  right: 12px;
  bottom: 8px;
  color: #475569;
  font-size: 22px;
}

.search-field input {
  padding-right: 42px;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.tabs {
  display: flex;
  gap: 22px;
}

.tabs button {
  border: 0;
  background: transparent;
  color: #334155;
  font-size: 14px;
  font-weight: 750;
}

.tabs button.active {
  color: var(--blue);
}

.select-tools {
  display: flex;
  align-items: center;
  gap: 14px;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #475569;
  white-space: nowrap;
}

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

.table-card {
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
  text-align: left;
  vertical-align: middle;
}

th {
  height: 50px;
  background: #f8fafc;
  color: #475569;
  font-weight: 800;
}

.sort-head {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: 800;
  padding: 0;
}

.sort-head span {
  color: #94a3b8;
  font-size: 13px;
}

.sort-head.active,
.sort-head.active span {
  color: var(--blue);
}

th:nth-child(1) {
  width: 38%;
}

th:nth-child(2) {
  width: 14%;
}

th:nth-child(3) {
  width: 14%;
}

th:nth-child(4),
th:nth-child(5) {
  width: 9%;
}

th:nth-child(6) {
  width: 12%;
}

th:nth-child(7) {
  width: 6%;
  text-align: center;
}

td:nth-child(7) {
  text-align: center;
}

.employee-mode th:nth-child(6),
.employee-mode td:nth-child(6) {
  display: none;
}

tbody tr:hover {
  background: #fbfdff;
}

.product-info {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.product-thumb {
  display: grid;
  width: 48px;
  height: 64px;
  place-items: center;
  overflow: hidden;
  border: 1px solid #eef2f6;
  border-radius: 7px;
  background: #f8fafc;
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.fallback-thumb {
  width: 28px;
  height: 46px;
  border-radius: 8px 8px 5px 5px;
  background: linear-gradient(180deg, #ffffff 0 14%, var(--thumb-color, #e23f3f) 14% 82%, #f8fafc 82% 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.product-name {
  display: block;
  margin-bottom: 6px;
  color: #162033;
  font-size: 14px;
}

.product-meta {
  display: grid;
  gap: 3px;
  color: #64748b;
  font-size: 12px;
}

.category-lines {
  display: grid;
  gap: 5px;
  color: #475569;
  font-size: 13px;
}

.level-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 104px;
  height: 32px;
  justify-content: center;
  border-radius: 7px;
  font-weight: 800;
  font-size: 13px;
}

.level-pill strong {
  font-size: 15px;
}

.price {
  font-weight: 800;
}

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

.row-actions button {
  min-width: 50px;
  height: 32px;
  border-radius: 7px;
  background: #fff;
  font-weight: 750;
  font-size: 13px;
}

.edit-btn {
  border: 1px solid #cfe3fa;
  color: var(--blue);
}

.delete-btn {
  border: 1px solid #fde1e1;
  color: var(--danger);
}

.view-only-tag {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.view-only-dot {
  color: #94a3b8;
  font-weight: 800;
}

.empty-state {
  display: none;
  padding: 48px;
  color: #64748b;
  text-align: center;
}

.table-card.empty table {
  display: none;
}

.table-card.empty .empty-state {
  display: block;
}

.pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  align-items: center;
  padding: 18px 8px 0;
  color: #475569;
}

.pagination label {
  justify-self: end;
}

.pager {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pager button,
.pager-ellipsis {
  display: inline-grid;
  min-width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 7px;
}

.pager button {
  border: 0;
  background: transparent;
  color: #0f172a;
  font-size: 18px;
}

.pager-page.active {
  border-radius: 14px;
  background: #eaf4ff;
  color: var(--blue);
  font-weight: 800;
}

.pager-arrow {
  color: #8a94a3;
  font-size: 34px;
  font-weight: 700;
}

.pager-arrow:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pager-ellipsis {
  color: #0f172a;
}

.page-size-control {
  display: inline-flex;
  height: 48px;
  align-items: center;
  gap: 6px;
  padding: 0 14px 0 18px;
  border-radius: 14px;
  background: #f5f5f5;
  color: #0f172a;
  white-space: nowrap;
}

.page-size-control select {
  width: 52px;
  height: 34px;
  border: 0;
  background: transparent;
  color: #0f172a;
  font-size: 16px;
  outline: 0;
  padding: 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.42);
}

.modal-backdrop.show {
  display: grid;
}

.modal {
  width: min(760px, 100%);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.25);
}

.wide-modal {
  width: min(980px, 100%);
}

.image-modal {
  width: min(900px, calc(100vw - 48px));
  height: min(680px, 82vh);
  max-height: 82vh;
  overflow: hidden;
}

.image-modal .modal-header {
  height: 64px;
  padding: 0 22px;
  flex: 0 0 auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.modal-header h3 {
  margin: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 24px 26px;
}

.form-grid label {
  display: grid;
  gap: 8px;
  color: #475569;
  font-weight: 700;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 26px 26px;
}

.image-settings,
.purchase-body {
  display: grid;
  gap: 14px;
  padding: 18px 22px;
}

.image-settings {
  height: calc(100% - 64px);
  max-height: none;
  overflow: auto;
}

.drop-zone {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  min-height: 74px;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 12px;
  border: 2px dashed #b9d6f5;
  border-radius: 8px;
  background: #f5faff;
  color: #475569;
  text-align: left;
}

.drop-zone.dragover {
  border-color: var(--blue);
  background: #eaf4ff;
}

.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: #dbeeff;
  color: var(--blue);
  font-size: 18px;
  font-weight: 800;
}

.drop-zone strong {
  align-self: center;
  font-size: 13px;
  line-height: 1.2;
}

.drop-zone span {
  grid-column: 2 / 4;
  grid-row: 2;
  align-self: center;
  min-width: 0;
  font-size: 11px;
  line-height: 1.25;
}

.drop-zone button {
  grid-column: 3;
  grid-row: 1;
  min-height: 32px;
  padding: 0 12px;
}

.drop-zone span,
.image-actions p,
.export-text-panel span {
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}

.image-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.image-actions p {
  margin: 5px 0 0;
}

.image-mode-tools {
  display: flex;
  align-items: end;
  gap: 10px;
  flex: 0 0 auto;
}

.image-mode-tools label {
  display: grid;
  gap: 6px;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
}

.image-mode-tools select {
  height: 34px;
  min-width: 142px;
  border: 1px solid #dbe5ef;
  border-radius: 7px;
  background: #fff;
  padding: 0 10px;
}

.image-preview-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.image-preview-item {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.image-preview-item img {
  width: 46px;
  height: 46px;
  border-radius: 7px;
  object-fit: contain;
  background: #f8fafc;
}

.image-preview-item strong,
.image-preview-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-preview-item strong {
  font-size: 13px;
}

.image-preview-item span {
  color: #64748b;
  font-size: 11px;
}

.image-preview-actions {
  display: flex;
  gap: 8px;
  margin: 5px 0;
}

.image-preview-actions a,
.image-preview-actions button {
  display: inline-flex;
  height: 24px;
  align-items: center;
  padding: 0 7px;
  border: 1px solid #dbe5ef;
  border-radius: 6px;
  background: #fff;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.image-url-input {
  width: 100%;
  height: 28px;
  padding: 0 8px;
  border: 1px solid #dbe5ef;
  border-radius: 6px;
  outline: 0;
  font-size: 11px;
}

.purchase-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.purchase-meta label {
  display: grid;
  gap: 7px;
  color: #475569;
  font-weight: 700;
}

.purchase-meta input,
.purchase-qty,
.export-text-panel textarea {
  width: 100%;
  border: 1px solid #dbe5ef;
  border-radius: 7px;
  background: #fff;
  color: #1f2937;
  outline: 0;
}

.purchase-meta input,
.purchase-qty {
  height: 38px;
  padding: 0 10px;
}

.purchase-table-wrap {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.purchase-table th,
.purchase-table td {
  padding: 12px;
}

.purchase-table th:nth-child(1) {
  width: 70px;
}

.purchase-table th:nth-child(2) {
  width: auto;
}

.purchase-table th:nth-child(3),
.purchase-table th:nth-child(4),
.purchase-table th:nth-child(5),
.purchase-table th:nth-child(6) {
  width: 110px;
}

.purchase-img {
  width: 46px;
  height: 46px;
  border-radius: 7px;
  object-fit: contain;
  background: #f8fafc;
  border: 1px solid #edf2f7;
}

.export-text-panel {
  display: grid;
  gap: 10px;
}

.export-text-panel textarea {
  min-height: 140px;
  padding: 12px;
  resize: vertical;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 12px;
  line-height: 1.55;
}

.account-modal {
  width: min(760px, 100%);
}

.import-body,
.records-body {
  display: grid;
  gap: 14px;
  padding: 20px 26px;
  max-height: calc(100vh - 160px);
  overflow: auto;
}

.import-body p,
.records-body p {
  margin: 0;
  color: #64748b;
  line-height: 1.6;
}

.import-body textarea {
  width: 100%;
  min-height: 220px;
  padding: 12px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  outline: 0;
  resize: vertical;
  font-family: Consolas, "Microsoft YaHei", monospace;
}

.import-result {
  display: inline-flex;
  width: fit-content;
  min-height: 34px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid #b9d6f5;
  border-radius: 7px;
  background: #f5faff;
  color: #1677e8;
  font-size: 13px;
  font-weight: 800;
}

.file-line {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #475569;
  font-weight: 700;
}

.record-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.record-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fbff;
}

.record-head span {
  color: #64748b;
  font-size: 13px;
}

.record-table {
  min-width: 820px;
}

.record-table th,
.record-table td {
  padding: 10px 12px;
  font-size: 13px;
}

.compact-record {
  overflow: visible;
}

.compact-record .record-head {
  background: #fbfdff;
}

.compact-record .record-head span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
}

.record-metrics {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.record-metrics b {
  min-width: 70px;
  padding: 6px 9px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #15803d;
  font-size: 12px;
  text-align: center;
}

.record-metrics b.danger {
  background: #fff1f2;
  color: #e11d48;
}

.record-preview {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
}

.record-product {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) minmax(150px, 0.65fr);
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid #edf2f7;
  border-radius: 7px;
  background: #fff;
}

.record-product span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  background: #eaf4ff;
  color: var(--blue);
  font-weight: 800;
}

.record-product strong,
.record-product em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-product strong {
  color: #1e293b;
  font-size: 13px;
}

.record-product em {
  color: #64748b;
  font-size: 12px;
  font-style: normal;
}

.record-failures {
  display: grid;
  gap: 6px;
  padding: 0 14px 12px;
}

.record-failures span {
  padding: 7px 9px;
  border-radius: 7px;
  background: #fff7ed;
  color: #c2410c;
  font-size: 12px;
}

.record-restore-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #edf2f7;
  background: #fff7ed;
}

.record-restore-bar span {
  color: #9a3412;
  font-size: 12px;
  font-weight: 700;
}

.restore-record-btn {
  min-height: 30px;
  padding: 0 11px;
  font-size: 12px;
}

.message-modal {
  width: min(680px, calc(100vw - 32px));
}

.message-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.message-toolbar span {
  color: #475569;
  font-size: 13px;
  font-weight: 800;
}

.message-list {
  display: grid;
  gap: 10px;
  max-height: min(520px, calc(100vh - 220px));
  overflow: auto;
  padding: 16px 20px 20px;
}

.message-list p {
  margin: 0;
  color: #64748b;
}

.message-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  padding: 13px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.message-item.unread {
  border-color: #b9d6f5;
  background: #f5faff;
}

.message-state {
  display: grid;
  width: 44px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.message-item.unread .message-state {
  background: #1677e8;
  color: #fff;
}

.message-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.message-head strong {
  color: #1e293b;
  font-size: 14px;
}

.message-head time {
  flex: 0 0 auto;
  color: #94a3b8;
  font-size: 12px;
}

.message-main p {
  margin: 6px 0 0;
  color: #475569;
  font-size: 13px;
  line-height: 1.5;
}

.message-main ul {
  display: grid;
  gap: 5px;
  margin: 9px 0 0;
  padding: 0;
  list-style: none;
}

.message-main li {
  padding: 6px 8px;
  border-radius: 6px;
  background: #fff7ed;
  color: #c2410c;
  font-size: 12px;
}

.account-tabs {
  display: flex;
  gap: 8px;
  padding: 14px 26px 0;
}

.account-tabs button {
  height: 36px;
  padding: 0 14px;
  border: 1px solid #dbe5ef;
  border-radius: 7px;
  background: #fff;
  color: #475569;
  font-weight: 700;
}

.account-tabs button.active {
  border-color: var(--blue);
  background: #eaf4ff;
  color: var(--blue);
}

.account-panel {
  display: none;
  padding: 22px 26px 4px;
}

.account-panel.active {
  display: block;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 18px;
  background: #f8fbff;
}

.profile-main {
  min-width: 0;
  flex: 1 1 auto;
}

.profile-head strong,
.profile-head span {
  display: block;
}

.profile-head span {
  color: #64748b;
  margin-top: 3px;
}

.profile-head small {
  display: block;
  margin-top: 5px;
  color: #94a3b8;
  font-size: 12px;
}

.role-badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 999px;
  background: #eaf4ff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.role-badge.employee {
  background: #ecfdf5;
  color: #15803d;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 4px;
}

.profile-stats span {
  display: grid;
  gap: 4px;
  min-height: 66px;
  align-content: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.profile-stats strong {
  overflow: hidden;
  color: #1e293b;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-stats small {
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
}

.admin-modal {
  width: min(1760px, calc(100vw - 56px));
  max-height: min(940px, calc(100vh - 56px));
  overflow: hidden;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.04fr);
  gap: 20px;
  max-height: calc(100vh - 112px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px 28px 28px;
  background: #f8fbff;
}

.admin-section {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.admin-section-head > div {
  min-width: 0;
}

.admin-section-head .secondary {
  min-width: 128px;
  flex: 0 0 auto;
  padding-inline: 18px;
  white-space: nowrap;
}

.admin-section-head h4 {
  margin: 0;
  color: #1e293b;
  font-size: 16px;
}

.admin-section-head p {
  margin: 5px 0 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}

.admin-account-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 14px;
  padding: 14px 18px 18px;
  border: 1px solid #edf2f7;
  border-radius: 8px;
  background: #fbfdff;
}

.admin-account-form label,
.admin-image-tools label {
  display: grid;
  gap: 6px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.admin-account-form input,
.admin-account-form select,
.admin-image-tools input,
.admin-image-tools select {
  width: 100%;
  height: 36px;
  border: 1px solid #dbe5ef;
  border-radius: 7px;
  background: #fff;
  color: #1f2937;
  outline: 0;
  padding: 0 10px;
}

.admin-account-form .inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-top: 18px;
}

.admin-account-form .inline-check input,
.admin-tool-line .inline-check input {
  width: 16px;
  height: 16px;
}

.admin-account-form button {
  align-self: end;
}

.admin-account-list {
  display: grid;
  gap: 8px;
  max-height: 440px;
  overflow: auto;
}

.admin-account-list p,
.admin-system-stats p,
.admin-status {
  margin: 0;
  color: #64748b;
  font-size: 13px;
}

.admin-account-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content max-content max-content max-content;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #edf2f7;
  border-radius: 8px;
  background: #fff;
}

.admin-account-card strong,
.admin-account-card span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-account-card strong {
  color: #1e293b;
}

.admin-account-card span {
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
}

.admin-account-card em {
  min-width: 44px;
  color: #15803d;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  text-align: center;
}

.admin-account-card em.disabled {
  color: #94a3b8;
}

.admin-account-card button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.admin-stat-card {
  display: grid;
  gap: 5px;
  min-height: 86px;
  align-content: center;
  padding: 14px 18px;
  border: 1px solid #edf2f7;
  border-radius: 8px;
  background: #fbfdff;
}

.admin-stat-card strong {
  overflow: visible;
  color: #0f172a;
  font-size: 17px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: normal;
  word-break: keep-all;
}

.admin-stat-card span {
  color: #64748b;
  font-size: 12px;
}

.admin-stat-card small {
  color: #1677e8;
  font-size: 12px;
  font-weight: 800;
}

.admin-image-tools {
  display: grid;
  gap: 12px;
}

.admin-tool-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, max-content) minmax(150px, max-content);
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid #edf2f7;
  border-radius: 8px;
  background: #fff;
}

.admin-tool-line strong,
.admin-tool-line span {
  display: block;
}

.admin-tool-line span {
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}

.admin-tool-line .inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #475569;
  white-space: nowrap;
}

.admin-tool-line .secondary,
.admin-tool-line .primary {
  min-width: 132px;
  padding-inline: 18px;
  white-space: nowrap;
}

.replace-line {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(150px, max-content);
}

.replace-line input[type="file"] {
  min-width: 0;
}

.admin-status {
  min-height: 22px;
  white-space: normal;
}

.toast {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 70;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: 7px;
  background: #152238;
  color: #fff;
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1320px) {
  body {
    min-width: 1010px;
  }

  .main-grid {
    grid-template-columns: 252px minmax(0, 1fr);
    gap: 18px;
  }

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

  .search-field {
    grid-column: 1 / -1;
  }

  .admin-modal {
    width: min(1180px, calc(100vw - 40px));
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-account-list {
    max-height: none;
  }
}

@media (max-width: 920px) {
  body {
    min-width: 0;
  }

  .login-panel {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .login-brand,
  .login-card {
    padding: 20px;
  }

  .login-brand h1 {
    font-size: 22px;
  }

  .app-shell,
  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-100%);
    width: 300px;
    transition: transform 0.2s ease;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .mobile-menu {
    display: inline-grid;
  }

  .topbar {
    grid-template-columns: auto 1fr;
    height: auto;
    min-height: 76px;
    padding: 14px;
  }

  .global-search,
  .topbar-actions {
    display: none;
  }

  .content {
    padding: 18px;
  }

  .page-heading,
  .table-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .heading-actions,
  .select-tools,
  .tabs {
    flex-wrap: wrap;
  }

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

  .filters {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .table-card {
    overflow-x: auto;
  }

  table {
    min-width: 980px;
  }

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

  .pagination label {
    justify-self: start;
  }

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