:root {
  --bg: #f5f6f8;
  --app-bg: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --text: #1f2937;
  --text-main: #1f2937;
  --muted: #697386;
  --text-muted: #697386;
  --text-soft: #94a3b8;
  --line: #dde3ea;
  --border-color: #dde3ea;
  --primary: #b91c2c;
  --primary-dark: #931827;
  --dark: #202938;
  --primary-button: #202938;
  --button-bg: #202938;
  --button-text: #ffffff;
  --green: #16734a;
  --amber: #9a5b00;
  --red: #b42318;
  --shadow: 0 10px 28px rgba(20, 32, 50, 0.08);
  --card-bg: #ffffff;
  --panel-bg: #ffffff;
  --input-bg: #ffffff;
  --sidebar-bg: #ffffff;
  --table-header-bg: #f6f8fb;
  --table-row-hover: rgba(148, 163, 184, .08);
  --modal-bg: #ffffff;
  --tag-bg: #eef2f6;
  --header-divider: linear-gradient(90deg, transparent, rgba(148, 163, 184, .42), transparent);
  --header-sweep: linear-gradient(90deg, transparent, rgba(56, 189, 248, .72), rgba(168, 85, 247, .58), rgba(244, 114, 182, .5), transparent);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  background: var(--app-bg, var(--bg));
  color: var(--text-main, var(--text));
  font-family: "HarmonyOS Sans SC", "MiSans", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
  transition: grid-template-columns 0.2s ease;
  overflow: hidden;
}

body.theme-aurora {
  --bg: #eef8ff;
  --app-bg: #eef8ff;
  --surface: rgba(255, 255, 255, 0.9);
  --panel-bg: rgba(255, 255, 255, 0.92);
  --card-bg: rgba(255, 255, 255, 0.9);
  --input-bg: rgba(255, 255, 255, 0.96);
  --sidebar-bg: rgba(255, 255, 255, 0.88);
  --line: rgba(167, 191, 228, .52);
  --border-color: rgba(167, 191, 228, .52);
  --modal-bg: rgba(255, 255, 255, .92);
  --table-header-bg: rgba(248, 250, 252, .92);
  --table-row-hover: rgba(125, 168, 231, .12);
  --shadow: 0 16px 42px rgba(78, 101, 148, .12);
  --header-divider: linear-gradient(90deg, transparent, rgba(154, 184, 229, .5), transparent);
  --header-sweep: linear-gradient(90deg, transparent, rgba(125, 211, 252, .82), rgba(216, 180, 254, .86), rgba(251, 207, 232, .72), transparent);
  background: radial-gradient(circle at 12% 18%, rgba(255, 248, 235, 0.95), transparent 32%),
    radial-gradient(circle at 82% 20%, rgba(196, 239, 255, 0.88), transparent 34%),
    radial-gradient(circle at 78% 82%, rgba(232, 211, 255, 0.88), transparent 36%),
    linear-gradient(120deg, #dff6ff, #f3efff, #ffeaf3, #e7fff8, #fffaf0);
  background-size: 180% 180%;
  animation: loginGradient 15s ease-in-out infinite;
}

body.theme-zen {
  --bg: #f7f4ee;
  --app-bg: #f7f4ee;
  --surface: #fffdf8;
  --surface-soft: #f4f1ea;
  --panel-bg: #fffdf8;
  --card-bg: #fffdf8;
  --input-bg: #fffefa;
  --sidebar-bg: #fbf8f1;
  --line: #ddd6c9;
  --border-color: #ddd6c9;
  --text: #2f2a25;
  --text-main: #2f2a25;
  --muted: #756d62;
  --text-muted: #756d62;
  --text-soft: #998f82;
  --primary-button: #3f3a34;
  --button-bg: #3f3a34;
  --button-text: #fffdf8;
  --table-header-bg: #f1ede4;
  --table-row-hover: rgba(128, 105, 78, .1);
  --modal-bg: #fffdf8;
  --tag-bg: #eee8dc;
  --shadow: 0 8px 24px rgba(78, 67, 53, .06);
  --header-divider: linear-gradient(90deg, transparent, rgba(156, 136, 106, .38), transparent);
  --header-sweep: linear-gradient(90deg, transparent, rgba(255, 253, 248, .94), rgba(217, 180, 118, .72), transparent);
}

body.theme-midnight {
  --bg: #0f141b;
  --app-bg: #0f141b;
  --surface: #1b2330;
  --surface-soft: #243041;
  --panel-bg: #1b2330;
  --card-bg: #1b2330;
  --input-bg: #243041;
  --sidebar-bg: #111821;
  --text: #f8fafc;
  --text-main: #f8fafc;
  --muted: #cbd5e1;
  --text-muted: #cbd5e1;
  --text-soft: #94a3b8;
  --line: #334155;
  --border-color: #334155;
  --primary-button: #26354a;
  --button-bg: #26354a;
  --button-text: #f8fafc;
  --table-header-bg: #202a38;
  --table-row-hover: rgba(148, 163, 184, .12);
  --modal-bg: #1b2330;
  --tag-bg: #243041;
  --shadow: none;
  --header-divider: linear-gradient(90deg, transparent, rgba(148, 163, 184, .42), transparent);
  --header-sweep: linear-gradient(90deg, transparent, rgba(125, 211, 252, .9), transparent);
}

body.sidebar-collapsed {
  grid-template-columns: 74px minmax(0, 1fr);
}

button,
input,
select,
textarea {
  font: inherit;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
  accent-color: var(--dark);
}

th {
  position: relative;
}

.col-resizer {
  position: absolute;
  top: 0;
  right: -4px;
  width: 10px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  opacity: 0;
  transition: opacity .16s ease;
  z-index: 2;
}

.col-resizer::after {
  content: "";
  position: absolute;
  top: 22%;
  bottom: 22%;
  left: 50%;
  width: 2px;
  border-radius: 999px;
  background: rgba(100, 116, 139, .45);
  transform: translateX(-50%);
}

th:hover > .col-resizer,
th.resizing-col > .col-resizer {
  opacity: 1;
}

th.resized-col,
td.resized-col {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.name-col-standard {
  width: 12em;
  max-width: 12em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button,
.button-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--primary-button, var(--button-bg));
  color: var(--button-text);
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button-link:hover {
  filter: brightness(0.92);
}

.secondary {
  background: var(--surface-soft);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.secondary:hover {
  background: var(--table-row-hover);
}

.danger {
  background: var(--red);
}

.danger-outline {
  background: #fff1f0;
  color: var(--red);
  border: 1px solid #ffd0cc;
}

.small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 13px;
}

.icon-btn {
  width: 38px;
  padding: 0;
  background: var(--primary);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar {
  height: 100vh;
  padding: 18px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  overflow: hidden;
  transition: padding 0.2s ease;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
}

body.theme-aurora .sidebar,
body.theme-aurora .panel,
body.theme-aurora .dash-card,
body.theme-aurora .table-scroll,
body.theme-aurora .inventory-table-wrap {
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-color: rgba(255,255,255,.32);
}

.sidebar.collapsed {
  padding: 18px;
}

.sidebar.collapsed .brand {
  justify-content: center;
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .sidebar-user,
.sidebar.collapsed .menu,
.sidebar.collapsed .settings-menu-wrap {
  display: none;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin: 10px 0 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--panel-bg);
}

.sidebar-user strong {
  display: block;
  font-size: 13px;
  color: var(--text-main);
}

.sidebar-user small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-soft);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  font-weight: 800;
}

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

.avatar-sm {
  width: 34px;
  height: 34px;
}

.avatar-lg {
  width: 72px;
  height: 72px;
  font-size: 28px;
}

.avatar-xl {
  width: 118px;
  height: 118px;
  font-size: 42px;
}

.settings-user-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.account-settings-panel {
  max-width: 860px;
  padding: 42px 56px;
}

.account-settings-title {
  font-size: 22px;
  margin-bottom: 28px;
}

.account-settings-hero {
  align-items: center;
  gap: 28px;
  padding: 0 0 28px;
  border-bottom: 0;
}

.account-settings-hero h3 {
  font-size: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-settings-hero p {
  margin-top: 6px;
  color: var(--text-main);
}

.account-settings-form {
  gap: 18px;
}

.account-settings-form h4 {
  margin-top: 12px;
  font-size: 16px;
}

.avatar-upload-row {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  gap: 26px;
  align-items: center;
  margin: 8px 0 18px;
}

.avatar-upload-preview {
  width: 110px;
  height: 110px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--surface-soft);
  border: 1px solid var(--border-color);
}

.avatar-upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.settings-user-card h3 {
  margin-bottom: 4px;
}

.created-account-box {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface-soft);
}

.account-center-card {
  width: min(980px, calc(100vw - 40px));
  display: grid;
  gap: 18px;
}

#account-center-password-form {
  grid-template-columns: 1fr;
}

.account-center-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.account-center-head h3 {
  margin-bottom: 4px;
}

.account-center-head p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 3px;
}

.system-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.system-stats div,
.system-panel {
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--panel-bg);
}

.system-stats strong {
  display: block;
  font-size: 26px;
}

.system-stats span {
  color: var(--text-muted);
  font-size: 13px;
}

.system-grid {
  display: grid;
  grid-template-columns: minmax(360px, .85fr) minmax(520px, 1.15fr);
  gap: 16px;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.editor-toolbar label {
  width: auto;
  min-height: 34px;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--input-bg);
}

.editor-toolbar button,
.editor-toolbar select,
.editor-toolbar input[type="color"] {
  width: auto;
  min-height: 34px;
  height: 34px;
}

.editor-toolbar button {
  min-width: 42px;
  justify-content: center;
}

.editor-toolbar button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.editor-toolbar input[type="color"] {
  width: 42px;
  min-width: 42px;
  padding: 3px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--input-bg);
  cursor: pointer;
}

.editor-toolbar input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.editor-toolbar input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 6px;
}

.editor-toolbar input[type="file"] {
  width: 160px;
  height: auto;
  min-height: 0;
}

.rich-editor {
  min-height: 180px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-main);
  overflow: auto;
}

.rich-editor img,
.login-popup-card img,
.notification-body img {
  max-width: 100%;
  border-radius: 8px;
}

.notification-card {
  width: min(1120px, calc(100vw - 48px));
  height: min(76vh, 760px);
  padding: 24px 28px;
  gap: 16px;
  overflow: hidden;
}

.notification-card h3 {
  margin: 0;
  font-size: 24px;
}

.notification-list {
  display: block;
  height: 100%;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--panel-bg);
}

.notification-item {
  border-bottom: 1px solid var(--border-color);
}

.notification-item:last-child {
  border-bottom: 0;
}

.notification-row {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 100px 64px minmax(0, 1fr) 168px;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-main);
  text-align: left;
}

.notification-row:hover {
  background: var(--table-row-hover);
  transform: none;
  filter: none;
}

.notification-row strong {
  display: block;
  min-width: 0;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-row time {
  color: var(--text-muted);
  text-align: right;
  font-size: 13px;
  white-space: nowrap;
}

.notice-type,
.notice-read-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.notice-type {
  color: #1d4ed8;
  background: #dbeafe;
}

.notice-read-state {
  color: #4c5b70;
  background: #eef2f6;
}

.notification-item.unread .notice-read-state {
  color: #9a3412;
  background: #fed7aa;
}

.notification-item.unread .notification-row strong::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 8px;
  border-radius: 999px;
  background: #dc2626;
}

.notification-body {
  margin: 0 16px 14px;
  padding: 16px 18px;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text-main);
}

.notification-collapse {
  width: 34px;
  height: 28px;
  min-height: 28px;
  margin: 12px auto 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--input-bg);
  color: var(--text-muted);
}

.notification-collapse:hover {
  color: var(--text-main);
  background: var(--table-row-hover);
  transform: translateY(-1px);
}

.notification-body h4 {
  margin: 0 0 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
  font-size: 18px;
}

.login-popup-card {
  width: min(680px, calc(100vw - 40px));
  animation: popupEnter .22s ease;
}

@keyframes popupEnter {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.avatar-crop-card {
  width: min(440px, calc(100vw - 40px));
}

#avatar-crop-canvas {
  width: 320px;
  height: 320px;
  max-width: 100%;
  border-radius: 12px;
  cursor: grab;
  justify-self: center;
}

#batch-crop-canvas {
  width: 320px;
  height: 320px;
  max-width: 100%;
  border-radius: 12px;
  cursor: grab;
  justify-self: center;
  background: #f4f7fb;
  border: 1px solid var(--line);
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: .58;
}

button:disabled {
  background: #e5e7eb;
  color: #7b8494;
  border-color: #d1d5db;
  filter: none;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  flex: none;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: 18px;
}

.brand p,
.eyebrow,
.muted,
small,
.panel-head p,
.list-head p {
  color: var(--muted);
  font-size: 13px;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.menu::-webkit-scrollbar {
  width: 6px;
}

.menu::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, .32);
  border-radius: 999px;
}

.menu::-webkit-scrollbar-track {
  background: transparent;
}

.menu-group {
  display: grid;
  gap: 6px;
  margin-top: 4px;
}

.menu-title,
.menu-group-head {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 10px 4px;
}

.menu-group-head {
  width: 100%;
  min-height: 34px;
  justify-content: space-between;
  background: transparent;
  color: var(--text-main);
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0;
  padding: 6px 8px;
}

.menu-group-head:hover {
  background: var(--table-row-hover);
  filter: none;
}

.menu-group-head svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .18s ease;
}

.menu-group.collapsed .menu-group-head svg {
  transform: rotate(-90deg);
}

.menu-group.collapsed .menu-group-items {
  display: none;
}

.menu-group-items {
  display: grid;
  gap: 4px;
}

.menu-item {
  justify-content: flex-start;
  width: 100%;
  background: transparent;
  color: var(--text-muted);
}

.menu-group-items .menu-item {
  padding-left: 18px;
}

.menu-item.active {
  background: var(--table-row-hover);
  color: var(--primary);
  font-weight: 700;
}

.menu-item:hover {
  background: var(--table-row-hover);
  filter: none;
}

.settings-menu {
  gap: 8px;
  color: var(--text-main);
  font-weight: 800;
}

.settings-menu svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-menu-wrap {
  position: relative;
  flex: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.settings-popover {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--modal-bg);
  box-shadow: var(--shadow);
  z-index: 30;
}

.settings-popover-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border-color);
}

.settings-popover-user strong {
  display: block;
  font-size: 13px;
  color: var(--text-main);
}

.settings-popover-user small {
  display: block;
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 11px;
}

.settings-popover button {
  justify-content: flex-start;
  gap: 8px;
  background: transparent;
  color: var(--text-main);
}

.settings-popover button:hover {
  background: var(--table-row-hover);
}

.must-password-dot {
  display: none;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .12);
}

body.needs-password-change .settings-menu::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-radius: 999px;
  background: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .12);
}

body.needs-password-change .must-password-dot {
  display: inline-flex;
}

.main {
  min-width: 0;
  height: 100vh;
  overflow: auto;
  padding: 24px;
}

body.theme-midnight input,
body.theme-midnight select,
body.theme-midnight textarea,
body.theme-midnight .settings-popover,
body.theme-midnight th,
body.theme-midnight td,
body.theme-midnight .secondary {
  background: #242b35;
  color: var(--text);
  border-color: var(--line);
}

.page-head {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  min-height: 52px;
  margin: -4px 0 28px;
  padding-bottom: 14px;
  overflow: hidden;
}

.page-head::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--header-divider);
}

.page-head::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 20%;
  height: 1px;
  background: var(--header-sweep);
  animation: headerLineSweep 7s ease-in-out infinite;
}

@keyframes headerLineSweep {
  0% { transform: translateX(-120%); opacity: 0; }
  15% { opacity: .85; }
  85% { opacity: .85; }
  100% { transform: translateX(520%); opacity: 0; }
}

.page-head > div:first-child {
  min-height: 42px;
  display: grid;
  align-content: center;
}

#page-title {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

.head-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.top-icon-btn,
.refresh-icon-btn {
  background: #ffffff;
  color: #202938;
  border: 1px solid var(--border-color);
  box-shadow: none;
}

.top-icon-btn svg,
.refresh-icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.top-icon-btn:hover,
.refresh-icon-btn:hover {
  background: #ffffff;
  color: #111827;
  filter: none;
  box-shadow: none;
  border-color: rgba(148, 163, 184, .7);
}

#top-search-btn {
  position: relative;
  border: 2px solid transparent;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(90deg, rgba(115,192,232,.96), rgba(174,139,238,.92), rgba(244,161,198,.86), rgba(115,192,232,.96)) border-box;
  background-size: 100% 100%, 320% 320%;
  animation: topSearchBorder 7s ease-in-out infinite;
}

#top-search-btn:hover {
  border-color: transparent;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(90deg, rgba(115,192,232,1), rgba(174,139,238,.98), rgba(244,161,198,.92), rgba(115,192,232,1)) border-box;
  background-size: 100% 100%, 320% 320%;
}

@keyframes topSearchBorder {
  0%, 100% {
    background-position: 0 0, 0% 50%;
    color: #202938;
  }
  50% {
    background-position: 0 0, 100% 50%;
    color: #202938;
  }
}

.top-user-btn {
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--border-color);
}

.top-user-btn:hover {
  background: var(--table-row-hover);
  filter: none;
}

.avatar-xs {
  width: 34px;
  height: 34px;
  font-size: 12px;
}

#top-notify-btn {
  position: relative;
}

body.has-unread-notifications #top-notify-btn::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #dc2626;
  box-shadow: 0 0 0 3px rgba(220,38,38,.16);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel,
.settings-panel,
.table-scroll,
.inventory-table-wrap {
  background: var(--panel-bg);
}

.theme-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.theme-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.72);
  cursor: pointer;
}

.theme-card:has(input:checked) {
  border-color: var(--primary-button);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.theme-card input {
  width: 16px;
  height: 16px;
}

.settings-panel {
  box-shadow: none;
  border: 0;
  border-bottom: 1px solid #eceef3;
  border-radius: 0;
  padding: 32px;
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.settings-tabs button {
  background: #eef2f6;
  color: #2f3a4c;
}

.settings-tabs button.active {
  background: var(--dark);
  color: #fff;
}

.settings-section {
  display: none;
}

.settings-section.active {
  display: block;
}

.option-manager,
.option-list-inner {
  display: grid;
  gap: 12px;
}

.option-group {
  padding: 14px 0;
  border-bottom: 1px solid #eceef3;
}

.option-group-head {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.option-group-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.option-add-line,
.option-edit-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.option-add-line {
  margin-bottom: 10px;
  width: 100%;
}

.option-add-line input {
  flex: 1;
  min-width: 220px;
}

.option-edit-row input {
  width: min(360px, 100%);
}

.about-page {
  background: #fff;
  padding: 32px;
  border-bottom: 1px solid #eceef3;
  line-height: 1.8;
}

.narrow {
  max-width: 760px;
  margin-bottom: 18px;
}

.grid-two {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) 390px;
  gap: 18px;
  align-items: start;
}

.panel-head {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}

.form-section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 16px;
}

.form-section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.form-section h4 {
  margin-bottom: 12px;
  font-size: 15px;
}

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

label {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
  color: #526075;
  font-size: 13px;
}

input,
select {
  width: 100%;
  min-height: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: var(--input-bg);
  color: var(--text-main);
}

textarea {
  width: 100%;
  min-height: 120px;
  height: 120px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: var(--input-bg);
  color: var(--text-main);
  font: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(185, 28, 44, 0.16);
  border-color: var(--primary);
}

.field-error input,
.field-error select {
  border-color: var(--red);
  background: #fff7f7;
}

.error-text {
  color: var(--red);
  font-weight: 600;
}

.simple-form {
  display: grid;
  gap: 14px;
}

.inline-form,
.upload-form,
.form-actions,
.head-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.page-head .head-actions {
  flex-wrap: nowrap;
}

.inline-form input {
  max-width: 320px;
}

.tags {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.option-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(4, auto);
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.option-row input {
  min-height: 34px;
}

.option-row button:disabled {
  opacity: 0.45;
  cursor: default;
}

.calc-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.calc-strip span {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: #4d5b70;
  font-size: 13px;
}

.form-actions {
  margin-top: 18px;
}

.import-box {
  display: grid;
  gap: 14px;
}

.result-box {
  margin-top: 14px;
  padding: 12px;
  border-radius: 6px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  line-height: 1.7;
}

.inventory-metrics {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.inventory-metrics article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.inventory-metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.inventory-metrics strong {
  font-size: 24px;
}

.inventory-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  height: calc(100vh - 320px);
  min-height: 360px;
}

.inventory-table {
  min-width: 1420px;
}

.inventory-table th,
.inventory-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-table th:nth-child(1),
.inventory-table td:nth-child(1) {
  width: 52px;
  padding-left: 8px;
  padding-right: 8px;
  text-align: center;
}

.inventory-table th:nth-child(2),
.inventory-table td:nth-child(2) {
  width: 150px;
}

.inventory-table th:nth-child(3),
.inventory-table td:nth-child(3) {
  width: 150px;
}

.inventory-table th:nth-child(4),
.inventory-table td:nth-child(4) {
  width: 300px;
}

.wide-cell {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.inventory-badge.safe {
  background: #dcfce7;
  color: var(--green);
}

.inventory-badge.need {
  background: #fef3c7;
  color: var(--amber);
}

.inventory-badge.urgent {
  background: #fecaca;
  color: var(--red);
}

.inventory-badge.nosales {
  background: #e5e7eb;
  color: #4c5b70;
}

.help-dot,
.sort-link {
  min-height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #edf1f5;
  color: #2e3a4d;
  font-size: 12px;
}

.sort-link {
  border-radius: 4px;
  font-weight: 700;
}

.import-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 12px;
}

.inventory-import-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.inventory-import-card p,
.unmatched-list {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

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

.inventory-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.inventory-actions select {
  width: 130px;
}

.counter {
  color: var(--muted);
  font-size: 13px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(5, minmax(120px, 170px));
  gap: 10px;
  margin-bottom: 16px;
}

#inventory-status .filters {
  grid-template-columns: minmax(220px, 1fr) repeat(5, minmax(110px, 160px));
}

.product-groups {
  --product-group-columns: 34px 72px 150px minmax(180px, 1.1fr) 120px 120px minmax(140px, .9fr) 90px 92px 240px;
  --product-child-columns: 72px 150px 140px minmax(200px, 1.2fr) 96px 96px 120px 92px 240px;
  display: grid;
  gap: 10px;
  height: auto;
  min-height: auto;
  overflow: visible;
  padding-right: 2px;
}

.group-header {
  display: grid;
  grid-template-columns: var(--product-group-columns);
  gap: 8px;
  align-items: center;
  padding: 12px;
  color: #5b687b;
  font-size: 13px;
  font-weight: 700;
  background: #f7f9fb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.group-summary {
  display: grid;
  grid-template-columns: var(--product-group-columns);
  gap: 8px;
  align-items: center;
  padding: 12px;
  background: #fbfcfd;
  cursor: pointer;
  transition: background .16s ease;
}

.group-summary:hover,
.child-row:hover {
  background: var(--table-row-hover);
}

.group-header > *,
.group-summary > * {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-header > :nth-child(2),
.group-summary > :nth-child(2),
.group-header > :nth-child(8),
.group-summary > :nth-child(8),
.group-header > :nth-child(9),
.group-summary > :nth-child(9) {
  justify-self: center;
  text-align: center;
}

.group-header > :nth-child(3),
.group-summary > :nth-child(3),
.group-header > :nth-child(4),
.group-summary > :nth-child(4),
.group-header > :nth-child(5),
.group-summary > :nth-child(5),
.group-header > :nth-child(6),
.group-summary > :nth-child(6),
.group-header > :nth-child(7),
.group-summary > :nth-child(7) {
  justify-self: start;
  text-align: left;
}

.group-header > :last-child,
.group-summary > :last-child {
  justify-self: stretch;
  text-align: center;
  overflow: visible;
}

.group-summary > :last-child {
  justify-content: center;
}

.expand-btn {
  width: 30px;
  min-height: 30px;
  padding: 0;
  background: #edf1f5;
  color: #2e3a4d;
}

.summary-name {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  white-space: nowrap;
}

.children {
  border-top: 1px solid var(--line);
  overflow-x: auto;
}

.child-grid-table {
  min-width: 1206px;
}

.product-child-grid {
  display: grid;
  grid-template-columns: var(--product-child-columns);
  gap: 8px;
  align-items: center;
}

.child-header {
  min-height: 48px;
  padding: 10px 12px;
  background: var(--table-header-bg);
  color: #5b687b;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid var(--line);
}

.child-row {
  min-height: 82px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .16s ease;
}

.child-header > *,
.child-row > * {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.child-header > :nth-child(1),
.child-row > :nth-child(1),
.child-header > :nth-child(5),
.child-row > :nth-child(5),
.child-header > :nth-child(6),
.child-row > :nth-child(6),
.child-header > :nth-child(8),
.child-row > :nth-child(8) {
  justify-self: center;
  text-align: center;
}

.child-header > :last-child,
.child-row > :last-child {
  justify-self: stretch;
  text-align: center;
  overflow: visible;
}

.sku-expand {
  width: 28px;
  min-height: 28px;
}

.sku-detail {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
  padding: 12px;
  background: #fbfcfd;
  border-bottom: 1px solid var(--line);
}

.sku-detail div {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

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

.sku-detail strong {
  font-size: 13px;
  font-weight: 600;
  white-space: normal;
}

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

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  font-size: 13px;
}

th {
  background: var(--table-header-bg);
  color: var(--text-muted);
}

.inventory-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.children table {
  width: max(100%, 1220px);
  min-width: 1220px;
  table-layout: fixed !important;
}

.children th:nth-child(1),
.children td:nth-child(1) { width: 66px; min-width: 66px; max-width: 66px; }
.children th:nth-child(2),
.children td:nth-child(2) { width: 145px; min-width: 145px; max-width: 145px; }
.children th:nth-child(3),
.children td:nth-child(3) { width: 126px; min-width: 126px; max-width: 126px; }
.children th:nth-child(4),
.children td:nth-child(4) { width: 12em; min-width: 12em; max-width: 12em; }
.children th:nth-child(5),
.children td:nth-child(5) { width: 92px; min-width: 92px; max-width: 92px; }
.children th:nth-child(6),
.children td:nth-child(6) { width: 92px; min-width: 92px; max-width: 92px; }
.children th:nth-child(7),
.children td:nth-child(7) { width: 126px; min-width: 126px; max-width: 126px; }
.children th:nth-child(8),
.children td:nth-child(8) { width: 90px; min-width: 90px; max-width: 90px; }
.children th:nth-child(9),
.children td:nth-child(9) { width: 220px; min-width: 220px; max-width: 220px; }

.children th:nth-child(1),
.children td:nth-child(1),
.children th:nth-child(5),
.children td:nth-child(5),
.children th:nth-child(6),
.children td:nth-child(6),
.children th:nth-child(8),
.children td:nth-child(8) {
  text-align: center;
}

.children th:nth-child(9),
.children td:nth-child(9) {
  text-align: center;
}

.children td {
  overflow: hidden;
  text-overflow: ellipsis;
  height: 82px;
  vertical-align: middle;
}

.children th {
  height: 48px;
}

.children .child-row .row-actions {
  height: 100%;
  width: 100%;
}

.children td.row-actions {
  display: table-cell;
  text-align: right;
  vertical-align: middle;
}

.children td.row-actions button {
  margin-left: 6px;
}

.children td.row-actions button:first-child {
  margin-left: 0;
}

.children .sku-detail-row td {
  height: auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge.ok {
  background: #e8f6ee;
  color: var(--green);
}

.badge.warn {
  background: #fff2d9;
  color: var(--amber);
}

.badge.neutral {
  background: #eef2f6;
  color: #4c5b70;
}

.hidden {
  display: none !important;
}

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

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.35);
}

#command-dialog::backdrop {
  background: rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.dialog-card,
.command-card {
  position: relative;
}

.dialog-card {
  width: min(420px, calc(100vw - 32px));
  padding: 18px;
  display: grid;
  gap: 14px;
  color: var(--text-main);
  background: var(--modal-bg);
}

dialog .account-center-card {
  width: min(944px, calc(100vw - 48px));
  max-height: min(88vh, 980px);
  overflow: auto;
  padding: 24px 28px;
  gap: 18px;
}

dialog .notification-card {
  width: min(1056px, calc(100vw - 56px));
  height: min(53vh, 532px);
  padding: 22px 28px;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

#widget-dialog .dialog-card {
  width: min(760px, calc(100vw - 48px));
}

#purchase-import-dialog .dialog-card,
#shipment-import-dialog .dialog-card {
  width: min(720px, calc(100vw - 48px));
}

.dialog-x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  min-height: 32px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  z-index: 2;
  cursor: pointer;
}

.dialog-x:hover {
  background: #eef2f6;
  color: var(--text);
}

.dialog-x svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.wide-dialog {
  width: min(980px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.export-dialog-card {
  width: min(1100px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.export-section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 12px 0 8px;
}

.export-check-list,
.export-field-list {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-soft);
}

.export-check-list label,
.export-field-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.export-check-list input,
.export-field-list input {
  width: auto;
  min-height: auto;
}

.formula-popover {
  position: fixed;
  z-index: 9999;
  max-width: 360px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 13px;
  line-height: 1.6;
}

.dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.refresh-icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .28s ease;
}

.refresh-icon-btn:hover svg {
  transform: rotate(90deg);
}

.refresh-icon-btn.is-refreshing svg {
  animation: refreshSpin .8s linear infinite;
}

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

#toast {
  position: fixed;
  left: 50%;
  top: 22px;
  max-width: 460px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #1e5b7a;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -10px);
  transition: 0.2s ease;
  z-index: 12000;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .16);
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

#toast.info {
  background: #25637f;
}

#toast.success {
  background: #19705c;
}

#toast.error {
  background: var(--red);
}

@media (max-width: 1180px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    height: 100vh;
  }

  .grid-two,
  .form-grid,
  .filters,
  .inventory-metrics,
  .import-grid,
  .option-row,
  .group-header,
  .group-summary {
    grid-template-columns: 1fr;
  }

  .group-summary {
    align-items: start;
  }
}

body.auth-pending .sidebar,
body.auth-pending .main,
body.login-locked .sidebar,
body.login-locked .main {
  display: none;
}

.login-screen {
  display: none;
}

body.auth-pending .login-screen {
  display: none;
}

body.login-locked .login-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  grid-template-rows: 156px auto;
  align-content: center;
  row-gap: 38px;
  background: radial-gradient(circle at 12% 18%, rgba(255, 248, 235, 0.95), transparent 32%),
    radial-gradient(circle at 82% 20%, rgba(196, 239, 255, 0.88), transparent 34%),
    radial-gradient(circle at 78% 82%, rgba(232, 211, 255, 0.88), transparent 36%),
    linear-gradient(120deg, #dff6ff, #f3efff, #ffeaf3, #e7fff8, #fffaf0);
  background-size: 180% 180%;
  animation: loginGradient 15s ease-in-out infinite;
}

@keyframes loginGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.login-card {
  width: min(420px, calc(100vw - 36px));
  display: grid;
  gap: 18px;
  padding: 12px;
  border-radius: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  justify-self: center;
  align-self: start;
}

.login-welcome {
  align-self: end;
  min-height: 156px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0;
  text-align: center;
  font-size: clamp(34px, 5.4vw, 68px);
  line-height: 1.15;
  font-weight: 720;
  font-family: "HarmonyOS Sans SC", "MiSans", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
  color: rgba(23, 34, 51, 0.86);
  text-shadow: 0 12px 36px rgba(255, 255, 255, 0.72);
  transition: opacity 0.36s ease, transform 0.36s ease;
}

.login-welcome.changing {
  opacity: 0;
  transform: translateY(10px);
}

.login-card h1 {
  font-size: 26px;
  text-shadow: 0 1px 12px rgba(255, 255, 255, 0.58);
}

.login-card p {
  color: rgba(31, 41, 55, 0.72);
}

.login-card button {
  background: var(--primary-button);
  border-radius: 0;
}

.password-wrap,
.login-input-wrap {
  position: relative;
  margin: 0;
}

.password-wrap input,
.login-input-wrap input {
  width: 100%;
  padding-left: 42px;
  padding-right: 46px;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(12px);
}

.login-field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #7b8494;
  z-index: 1;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.login-field-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.password-wrap button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 0;
  filter: none;
}

.password-wrap button:hover {
  background: rgba(123, 132, 148, .12);
  filter: none;
}

.password-eye {
  width: 19px;
  height: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #7b8494;
}

.password-eye svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.eye-open {
  display: none;
}

#toggle-password.is-visible .eye-open {
  display: inline-flex;
}

#toggle-password.is-visible .eye-closed {
  display: none;
}

.login-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 22px;
  text-align: center;
  font-size: 12px;
  line-height: 1.7;
  color: rgba(31, 41, 55, 0.7);
}

#login-error {
  min-height: 18px;
  color: var(--red);
}

.dashboard-grid {
  display: grid;
  gap: 18px;
}

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

.stats-grid article {
  min-height: 86px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
}

.stats-grid article span {
  color: var(--muted);
  font-size: 13px;
}

.stats-grid article strong {
  font-size: 24px;
  line-height: 1;
  color: var(--text);
}

.dash-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  padding: 18px;
}

.dash-card {
  min-height: 260px;
  display: flex;
  flex-direction: column;
}

.dashboard-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 4px 0 2px;
}

.dashboard-hero h2 {
  font-size: 34px;
}

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

.widget-S,
.widget-M,
.widget-L,
.widget-XL {
  height: 392px;
}

.widget-S { grid-column: span 3; }
.widget-M { grid-column: span 4; }
.widget-L { grid-column: span 6; }
.widget-XL { grid-column: span 12; }

.widget {
  min-height: 0;
  overflow: hidden;
}

.widget .dash-list {
  flex: 1;
  overflow: hidden;
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 242px;
}

.widget .dash-list button:nth-of-type(n+6) {
  display: none;
}

.widget-grid.editing .widget {
  border: 2px solid transparent;
  background:
    linear-gradient(var(--card-bg), var(--card-bg)) padding-box,
    linear-gradient(90deg, rgba(115,192,232,.98), rgba(174,139,238,.94), rgba(244,161,198,.9), rgba(115,192,232,.98)) border-box;
  background-size: 100% 100%, 360% 360%;
  animation: searchGlow 16s ease-in-out infinite;
  box-shadow: 0 0 0 4px rgba(168, 216, 255, .18), var(--shadow);
}

.edit-mode-label {
  color: var(--muted);
  font-size: 14px;
}

.widget-tools {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-bottom: 10px;
  min-height: 32px;
  align-items: center;
}

.add-widget {
  grid-column: span 4;
  height: 392px;
  display: grid;
  gap: 10px;
  place-content: center;
  justify-items: center;
  border: 1px dashed var(--line);
  background: rgba(255,255,255,.35);
  color: var(--muted);
  font-size: 44px;
  line-height: 1;
}

.add-widget span {
  font-size: 14px;
  line-height: 1.2;
}

.global-search {
  height: 52px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border-radius: 999px;
  border: 2px solid transparent;
  background:
    linear-gradient(rgba(255,255,255,.88), rgba(255,255,255,.88)) padding-box,
    linear-gradient(90deg, rgba(115,192,232,.98), rgba(174,139,238,.94), rgba(244,161,198,.9), rgba(255,255,255,.96), rgba(115,192,232,.98)) border-box;
  background-size: 100% 100%, 360% 360%;
  animation: searchGlow 16s ease-in-out infinite;
  box-shadow: 0 12px 34px rgba(112, 126, 180, .14);
  cursor: pointer;
}

.search-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #62748d;
}

.search-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.global-search:hover,
.global-search:focus-within {
  box-shadow: 0 0 0 4px rgba(168, 216, 255, .34), 0 14px 38px rgba(112, 126, 180, .17);
}

@keyframes searchGlow {
  0%, 100% { background-position: 0 0, 0% 50%; }
  50% { background-position: 0 0, 100% 50%; }
}

.global-search strong {
  color: var(--muted);
  font-weight: 500;
}

.global-search kbd {
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2f6;
  color: #64748b;
}

.quick-actions,
.dash-card-head,
.dash-metrics {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

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

.quick-actions {
  margin-top: 0;
  align-items: center;
}

.quick-actions button,
.quick-actions-wrap > button,
.icon-edit {
  min-height: 38px;
  height: 38px;
  padding: 0 14px;
  align-items: center;
}

.icon-edit {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 6px;
}

.icon-edit svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn:hover,
.icon-edit:hover,
.expand-btn:hover,
.help-dot:hover,
.sort-link:hover,
.thumb-btn:hover {
  background: #e7edf4;
  cursor: pointer;
}

.dash-card-head {
  justify-content: space-between;
  min-height: 30px;
  margin-top: 0;
  margin-bottom: 12px;
}

.widget > h3 {
  min-height: 30px;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
}

.widget > h3 + .dash-metrics {
  margin-top: 0;
}

.dash-card-head button,
.dash-list button,
.dash-metrics button {
  background: var(--surface-soft);
  color: var(--text-main);
}

.dash-metrics button {
  flex: 1;
  min-width: 132px;
  min-height: 78px;
  display: grid;
  gap: 4px;
}

.dash-metrics strong {
  font-size: 24px;
}

.dash-list {
  display: grid;
  gap: 8px;
  flex: 1;
  align-content: start;
}

.dash-list button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  min-height: 42px;
  overflow: hidden;
  text-align: left;
  justify-items: stretch;
}

.dash-list .dash-text {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  justify-self: start;
  overflow: hidden;
}

.dash-list .dash-text > span {
  display: block;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.dash-list .biz-badge,
.biz-badge,
.badge {
  flex: 0 0 auto;
  justify-self: end;
  max-width: max-content;
  white-space: nowrap;
  word-break: keep-all;
  line-height: 1;
}

.dash-footer {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.dash-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  margin-top: auto;
  padding-top: 12px;
}

.dash-card-foot button {
  min-height: 36px;
  background: var(--primary-button);
  color: #fff;
}

.business-dialog-card {
  width: min(860px, calc(100vw - 48px));
  height: min(760px, calc(100vh - 48px));
  overflow: auto;
}

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

.business-dialog-card textarea {
  min-height: 120px;
  resize: vertical;
}

.span-full,
.business-items,
.form-actions {
  grid-column: 1 / -1;
}

.span-2 {
  grid-column: span 2;
}

.business-items {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.item-picker {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) auto;
  gap: 10px;
}

.business-filters {
  grid-template-columns: minmax(220px, 1fr) 170px 170px auto;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table-scroll table,
.inventory-table-wrap table,
.export-check-list table,
.business-table {
  table-layout: auto;
  min-width: max-content;
}

.table-scroll th,
.inventory-table-wrap th,
.children th,
.business-table th {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

.table-scroll td,
.business-table td {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.business-table th,
.business-table td {
  min-width: 120px;
}

.business-table th:last-child,
.business-table td:last-child {
  min-width: 150px;
}

.hidden,
[hidden] {
  display: none !important;
}

.purchase-stats {
  margin: 14px 0;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.purchase-stats article {
  box-shadow: none;
}

.purchase-filters {
  grid-template-columns: minmax(240px, 1fr) 170px 190px 170px auto;
  align-items: end;
}

.status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 8px 0 12px;
  border-bottom: 1px solid var(--line);
}

.status-tabs button {
  position: relative;
  background: transparent;
  color: var(--text);
  border: 0;
  min-height: 42px;
  padding: 0 2px;
  border-radius: 0;
  font-weight: 700;
  box-shadow: none;
}

.status-tabs button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  transform: scaleX(0);
  transform-origin: center;
  background: linear-gradient(90deg, #73c0e8, #ae8bee, #f4a1c6);
  transition: transform .22s ease;
}

.status-tabs button:hover::after {
  transform: scaleX(.55);
}

.status-tabs button.active {
  background: transparent;
  color: var(--text);
}

.status-tabs button.active::after {
  transform: scaleX(1);
}

.profit-stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.profit-workspace-card,
.panel-like {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 18px;
  margin-top: 14px;
}

.profit-report-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  color: var(--text-muted);
}

.profit-report-meta strong {
  color: var(--text-main);
  font-size: 18px;
}

.profit-mini-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.profit-mini-grid article {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
}

.profit-mini-grid span,
.profit-source-card small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
}

.profit-mini-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--text-main);
  font-size: 22px;
}

.profit-preview-grid {
  margin-top: 14px;
}

.profit-wizard {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.profit-wizard-step {
  min-width: 142px;
  min-height: 58px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px 8px 38px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  position: relative;
}

.profit-wizard-step span {
  position: absolute;
  left: 10px;
  top: 12px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-bg);
  color: var(--text-main);
  font-size: 12px;
}

.profit-wizard-step small {
  color: var(--text-soft);
  font-size: 12px;
}

.profit-wizard-step.current {
  color: var(--button-text);
  background: var(--button-bg);
  border-color: transparent;
}

.profit-wizard-step.current small,
.profit-wizard-step.current span {
  color: var(--button-text);
}

.profit-wizard-step.done {
  border-color: rgba(16, 185, 129, .35);
  background: rgba(16, 185, 129, .08);
  color: var(--text-main);
}

.profit-wizard-step.error {
  border-color: rgba(239, 68, 68, .45);
  background: rgba(239, 68, 68, .08);
}

.profit-wizard-flow {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin: 16px 0 24px;
  overflow-x: auto;
  padding: 4px 2px 10px;
}

.profit-flow-step {
  min-width: 132px;
  flex: 1 0 132px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  padding: 6px 12px;
  position: relative;
  text-align: center;
}

.profit-flow-step::after {
  content: "";
  position: absolute;
  left: 32px;
  right: 0;
  top: 21px;
  height: 2px;
  background: var(--border-color);
  transform: translateX(50%);
  z-index: 0;
}

.profit-flow-step:last-child::after {
  display: none;
}

.profit-flow-step.done::after {
  background: linear-gradient(90deg, var(--button-bg), rgba(16, 185, 129, .6));
}

.profit-flow-index {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 800;
  position: relative;
  z-index: 1;
}

.profit-flow-step.current .profit-flow-index {
  background: var(--button-bg);
  border-color: var(--button-bg);
  color: var(--button-text);
}

.profit-flow-step.done .profit-flow-index {
  background: rgba(16, 185, 129, .14);
  border-color: rgba(16, 185, 129, .45);
  color: #059669;
}

.profit-flow-step.error .profit-flow-index {
  background: rgba(239, 68, 68, .12);
  border-color: rgba(239, 68, 68, .45);
  color: #dc2626;
}

.profit-flow-text {
  display: grid;
  gap: 3px;
  min-width: 0;
  position: relative;
  z-index: 1;
  background: transparent;
  padding: 0;
}

.profit-flow-text strong,
.profit-flow-text small {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.35;
}

.profit-flow-text small {
  color: var(--text-soft);
  font-size: 12px;
}

.profit-step-panel {
  margin-top: 14px;
  padding: 24px;
}

.profit-step-title {
  margin-bottom: 22px;
}

.profit-step-title h4 {
  margin: 0 0 8px;
}

.profit-step-title p {
  margin: 0;
  color: var(--text-muted);
}

.profit-report-filters {
  display: grid !important;
  grid-template-columns: minmax(360px, 1fr) 180px 180px 150px;
  gap: 12px;
  align-items: center;
  width: 100%;
  margin: 16px 0 20px;
}

.profit-report-filters input,
.profit-report-filters select,
.profit-report-filters button {
  width: 100%;
  min-width: 0;
}

.profit-report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(390px, 1fr));
  gap: 18px;
}

.profit-report-card {
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  padding: 22px;
  border-radius: var(--card-radius);
  display: grid;
  gap: 18px;
  cursor: pointer;
  min-height: 268px;
}

.profit-report-card:hover {
  border-color: color-mix(in srgb, var(--button-bg) 38%, var(--border-color));
}

.profit-report-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.profit-report-card-head strong,
.profit-report-card-head span {
  display: block;
}

.profit-report-card-head strong {
  font-size: 18px;
  line-height: 1.35;
  word-break: break-word;
}

.profit-report-period {
  color: var(--text-muted);
  font-size: 14px;
}

.profit-report-card dl,
.profit-report-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.profit-report-card dl {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profit-report-card dt,
.profit-report-card small {
  color: var(--text-soft);
  font-size: 12px;
}

.profit-report-card dd {
  margin: 3px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profit-report-card-metrics span {
  background: var(--input-bg);
  padding: 12px;
  border-radius: 8px;
}

.profit-report-card-metrics b {
  display: block;
  margin-top: 4px;
}

.profit-report-card .biz-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 12px;
  line-height: 1;
  white-space: nowrap;
  flex: 0 0 auto;
}

.profit-new-head {
  align-items: flex-start;
  gap: 18px;
}

.profit-new-actions {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: flex-end;
  min-width: min(620px, 100%);
}

.profit-stage-status {
  position: relative;
  overflow: hidden;
  min-height: 44px;
  padding: 7px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-main);
  font-weight: 800;
}

.profit-stage-status::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-120%);
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .45), transparent);
  animation: topRuleSweep 5.5s linear infinite;
  pointer-events: none;
}

.profit-stage-status small,
.profit-switcher span {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.profit-switcher {
  display: flex;
  align-items: center;
  min-width: min(360px, 42vw);
}

.profit-report-select {
  width: 100%;
  min-width: 0;
  height: 44px;
}

.profit-abandon-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  white-space: nowrap;
}

.profit-abandon-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 1180px) {
  .profit-new-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    width: 100%;
  }

  .profit-switcher {
    flex: 1 1 280px;
    min-width: min(280px, 100%);
  }

  .profit-report-filters {
    grid-template-columns: minmax(260px, 1fr) 160px 160px 140px;
  }

  .profit-report-grid {
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  }
}

@media (max-width: 820px) {
  .profit-report-filters {
    grid-template-columns: 1fr;
  }
}

.profit-step-actions {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  margin: 0 0 16px;
}

.profit-inline-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.parse-progress {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 0 0 16px;
  display: grid;
  gap: 6px;
  background: var(--input-bg);
}

.parse-progress.running {
  border-color: rgba(59, 130, 246, .35);
  background: rgba(59, 130, 246, .08);
}

.parse-progress.success {
  border-color: rgba(16, 185, 129, .35);
  background: rgba(16, 185, 129, .08);
}

.parse-progress.failed,
.parse-progress.error {
  border-color: rgba(239, 68, 68, .35);
  background: rgba(239, 68, 68, .08);
}

.profit-file-state {
  min-width: 0;
}

.profit-file-state.success {
  border: 1px solid color-mix(in srgb, #16a34a 22%, var(--border-color));
  background: color-mix(in srgb, #16a34a 9%, var(--card-bg));
  border-radius: 8px;
  padding: 9px 10px;
}

.profit-file-state.empty {
  border: 1px dashed var(--border-color);
  border-radius: 8px;
  padding: 9px 10px;
}

.profit-file-state span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profit-upload-card:has(.profit-file-state span:not(:empty)) .profit-file-state {
  border-radius: 8px;
}

.modal-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 0 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title-row h3 {
  margin: 0;
}

.dialog-close.icon-only {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  border: 0;
}

.dialog-close.icon-only:hover {
  background: var(--input-bg);
  color: var(--text-main);
}

.dialog-close.icon-only svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.advanced-settings {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  background: var(--input-bg);
}

.advanced-settings summary {
  cursor: pointer;
  font-weight: 700;
}

.advanced-settings .form-grid {
  margin-top: 12px;
}

.profit-upload-form,
.profit-data-tools {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) repeat(3, minmax(130px, 1fr)) minmax(220px, 1.4fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.profit-data-tools {
  grid-template-columns: minmax(360px, 1fr) auto minmax(220px, .45fr) minmax(150px, .25fr) auto;
  gap: 18px;
  margin-top: 22px;
  margin-bottom: 22px;
}

.profit-product-import-row,
.profit-product-filter-row {
  display: grid;
  gap: 10px;
  align-items: center;
  margin: 12px 0;
}

.profit-product-import-row {
  grid-template-columns: minmax(280px, 1fr) auto;
  max-width: 720px;
}

.profit-product-filter-row {
  grid-template-columns: minmax(260px, 1fr) 180px auto auto;
}

.profit-product-filter-row .record-count {
  justify-self: end;
  color: var(--text-muted);
  white-space: nowrap;
}

.profit-product-table {
  max-height: min(58vh, 620px);
}

.ellipsis-cell {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profit-source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.profit-source-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--input-bg);
}

.profit-source-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profit-upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}

.profit-upload-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--card-bg);
  padding: 14px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.profit-upload-card strong {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profit-upload-card em {
  font-style: normal;
  font-size: 12px;
  color: #b45309;
  background: rgba(245, 158, 11, .14);
  border-radius: 999px;
  padding: 2px 8px;
}

.profit-upload-card p,
.profit-file-state small {
  color: var(--text-muted);
  margin: 4px 0 0;
}

.profit-file-state span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-main);
  font-weight: 700;
}

.profit-upload-card-form {
  display: grid;
  gap: 8px;
}

.profit-upload-advanced {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--input-bg) 65%, transparent);
}

.profit-upload-advanced summary {
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 700;
}

.profit-upload-advanced input {
  width: 100%;
  margin-top: 8px;
}

.profit-upload-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.profit-upload-actions input[type="file"] {
  min-width: 0;
  width: 100%;
}

.danger-soft {
  color: #b42318 !important;
  border-color: color-mix(in srgb, #ef4444 35%, var(--border-color)) !important;
  background: color-mix(in srgb, #ef4444 8%, var(--card-bg)) !important;
}

.profit-config-dialog-card {
  width: min(980px, calc(100vw - 48px));
  max-height: min(86vh, 860px);
  overflow: auto;
}

.profit-dialog-body {
  display: grid;
  gap: 12px;
}

.profit-dialog-section {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-bg);
}

.profit-dialog-section h4 {
  margin: 0 0 10px;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.checkbox-line,
.check-grid label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.formula-preview,
.muted-box {
  color: var(--text-muted);
  background: var(--input-bg);
}

.profit-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  margin-bottom: 18px;
}

.profit-tabs button {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.profit-tabs button.active {
  background: var(--button-bg);
  border-color: transparent;
  color: var(--button-text);
}

.profit-data-table {
  max-height: 520px;
  overflow: auto;
  margin-top: 14px;
}

.profit-data-table table {
  min-width: 1200px;
}

.profit-table.compact {
  max-height: 280px;
  overflow: auto;
}

@media (max-width: 1366px) {
  .profit-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .profit-upload-form,
  .profit-data-tools {
    grid-template-columns: 1fr 1fr;
  }
}

.purchase-table-wrap {
  max-height: 560px;
  overflow-y: auto;
}

.purchase-table th,
.purchase-table td {
  white-space: nowrap;
}

.purchase-table .num,
.purchase-table th.num,
.purchase-table td.num {
  text-align: right;
}

.purchase-detail-row td {
  background: #f8fafc;
}

.purchase-detail-row .table-scroll {
  max-height: 280px;
  overflow-y: auto;
}

.purchase-dialog-card {
  width: min(1180px, 96vw);
}

.purchase-items-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 8px;
}

.purchase-items-head h4 {
  margin: 0;
}

.purchase-items-scroll {
  max-height: 360px;
  overflow-y: auto;
}

.purchase-edit-table input {
  width: 120px;
  min-width: 0;
}

.purchase-edit-table td:nth-child(3) input,
.purchase-edit-table td:nth-child(4) input {
  width: 180px;
}

.po-picker {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  gap: 8px;
}

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef2f6;
  font-size: 12px;
}

.tag-chip button {
  min-height: 18px;
  width: 18px;
  padding: 0;
  border-radius: 50%;
}

.biz-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
}

.biz-badge.ok,
.biz-badge.green {
  background: #e8f6ee;
  color: var(--green);
}

.biz-badge.warn,
.biz-badge.yellow {
  background: #fff2d9;
  color: var(--amber);
}

.biz-badge.neutral,
.biz-badge.gray {
  background: #eef2f6;
  color: #4c5b70;
}

.biz-badge.blue {
  background: #dbeafe;
  color: #1d4ed8;
}

.biz-badge.orange {
  background: #fed7aa;
  color: #9a3412;
}

.biz-badge.red {
  background: #fecaca;
  color: #991b1b;
}

.biz-badge.purple {
  background: #ddd6fe;
  color: #5b21b6;
}

.success-outline {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}

.quick-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.quick-options label,
.toggle-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.planner-settings-form {
  align-items: end;
}

.planner-checks {
  display: flex;
  gap: 22px;
  justify-content: flex-start;
  align-items: center;
  padding: 4px 0;
}

.small-upload {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 6px;
  background: #eef2f6;
  color: #2f3a4c;
  cursor: pointer;
  font-weight: 700;
}

.compact-dialog {
  width: min(560px, calc(100vw - 48px));
}

#ui-settings-form {
  display: grid;
  gap: 16px;
  align-items: start;
}

#ui-settings-form .toggle-line,
#ui-settings-form .color-setting {
  font-size: 15px;
}

.color-setting {
  display: grid;
  gap: 10px;
  color: #526075;
}

.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.color-swatches button {
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--swatch);
  box-shadow: 0 0 0 1px var(--line);
}

.color-swatches button.active {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .24), 0 0 0 1px var(--line);
}

#ui-settings-form button {
  justify-self: start;
}

.thumb-btn {
  width: 54px;
  height: 54px;
  min-height: 54px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f3f6f9;
  border-radius: 4px;
}

.thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-placeholder {
  display: inline-block;
  width: 54px;
  height: 54px;
  border: 1px dashed #cbd5e1;
  background: #f1f5f9;
  border-radius: 4px;
}

.image-preview {
  display: inline-flex;
  margin-top: 8px;
  align-items: center;
}

.image-delete-btn {
  margin-top: 8px;
  margin-left: 10px;
  vertical-align: top;
}

.image-dialog-card {
  width: min(760px, calc(100vw - 48px));
}

.image-dialog-card img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.evidence-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.evidence-thumb {
  display: grid;
  gap: 6px;
  justify-items: center;
}

.batch-toolbar {
  display: grid;
  grid-template-columns: auto auto minmax(140px, 1fr) minmax(140px, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.batch-section,
.planner-block {
  display: grid;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.batch-fields {
  display: grid;
  gap: 18px;
}

.batch-field-group {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.batch-field-group:first-child {
  padding-top: 0;
  border-top: 0;
}

.batch-field-group h5 {
  margin: 0;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 800;
}

.batch-field-grid {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
}

.batch-fields .batch-field span {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.disabled-field,
input:disabled,
select:disabled {
  background: #f1f5f9;
  color: #64748b;
  cursor: not-allowed;
}

.batch-sku-list table {
  min-width: 920px;
}

.pending-thumb {
  position: relative;
  display: inline-flex;
}

.pending-thumb::after {
  content: "待上传";
  position: absolute;
  right: -8px;
  bottom: -6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #fff7ed;
  color: #c2410c;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid #fed7aa;
}

.compact-actions {
  justify-content: flex-start;
}

.planner-block:first-of-type {
  border-top: 0;
}

.planner-block-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.planner-settings {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 10px;
}

.planner-settings article {
  padding: 12px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.planner-settings span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.weight-total {
  font-weight: 700;
}

.weight-total.ok {
  color: var(--green);
}

.weight-total.bad {
  color: var(--red);
}

.planner-table {
  min-width: 2300px;
}

.planner-table-wrap {
  max-height: calc(100vh - 330px);
  overflow: auto;
}

.planner-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.planner-table input {
  width: 96px;
}

.planner-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-counter {
  padding: 10px 2px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.fixed-table,
.inventory-table-wrap,
.planner-table-wrap {
  max-height: calc(100vh - 320px);
}

.fixed-table,
.inventory-table-wrap,
.planner-table-wrap {
  overflow: auto;
}

.planner-summary {
  display: none;
}

.planner-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 3;
  background: #fff;
  font-weight: 700;
  border-top: 2px solid #d9dde7;
  box-shadow: 0 -4px 12px rgba(15, 23, 42, .04);
}

body.theme-midnight .planner-table tfoot td {
  background: #1d222b;
}

.widget-library {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.widget-library button {
  min-height: 98px;
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  justify-items: stretch;
  text-align: left;
  gap: 12px;
  padding: 14px;
  background: #f8fafc;
  color: var(--text);
  border: 1px solid var(--line);
  cursor: pointer;
}

.widget-library button * {
  pointer-events: none;
}

.widget-option-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e8eef7;
  color: #334155;
  font-weight: 700;
}

.widget-option-text {
  display: grid;
  gap: 3px;
}

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

.link-widget,
.banner-widget {
  display: grid;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.link-widget img {
  width: 28px;
  height: 28px;
}

.quick-link-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-content: start;
  gap: 14px 10px;
}

.quick-link-head {
  justify-content: space-between;
  flex-wrap: nowrap;
}

.quick-link-head h3 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-link-app {
  position: relative;
  min-width: 0;
  display: grid;
  justify-items: center;
}

.quick-link-app a,
.quick-link-add {
  width: 100%;
  min-height: 96px;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 8px;
  padding: 4px;
  border-radius: 8px;
  color: var(--text-main);
  text-decoration: none;
  background: transparent;
}

.quick-link-app a:hover,
.quick-link-add:hover {
  background: var(--table-row-hover);
  filter: none;
}

.quick-link-icon,
.quick-link-add span {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .06);
}

.quick-link-icon img {
  width: 31px;
  height: 31px;
  object-fit: contain;
}

.quick-link-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
}

.quick-link-emoji.fallback {
  display: none;
}

.quick-link-app strong,
.quick-link-add strong {
  max-width: 100%;
  min-height: 34px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-align: center;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

@media (max-width: 1366px) {
  .quick-link-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 2560px) {
  .quick-link-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.quick-link-add {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.quick-link-add * {
  pointer-events: none;
}

.quick-link-add span {
  border-radius: 999px;
  font-size: 24px;
  color: var(--primary-button);
}

.quick-link-tools {
  display: none;
  gap: 4px;
  justify-content: center;
  margin-top: -2px;
}

.widget-grid.editing .quick-link-tools {
  display: flex;
}

.quick-link-tools button {
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border-radius: 999px;
  background: var(--panel-bg);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  font-size: 12px;
}

.banner-widget img {
  width: 100%;
  height: 170px;
  object-fit: cover;
  border-radius: 8px;
}

#command-dialog {
  width: min(1040px, calc(100vw - 40px));
  margin: clamp(28px, 8vh, 86px) auto auto;
  background: transparent;
  box-shadow: none;
}

.command-card {
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.command-search {
  display: grid;
  grid-template-columns: auto 1fr 150px auto;
  gap: 10px;
  align-items: center;
  min-height: 56px;
  padding: 0 10px 0 18px;
  border: 2px solid transparent;
  border-radius: 999px;
  background:
    linear-gradient(rgba(255,250,255,.82), rgba(255,250,255,.82)) padding-box,
    linear-gradient(90deg, rgba(115,192,232,1), rgba(174,139,238,.98), rgba(244,161,198,.96), rgba(255,255,255,1), rgba(115,192,232,1)) border-box;
  background-size: 100% 100%, 360% 360%;
  animation: searchGlow 16s ease-in-out infinite;
  box-shadow: 0 16px 42px rgba(82, 92, 128, .16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.command-search input,
.command-search select {
  border: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
}

.command-search input {
  font-size: 18px;
}

.command-search input:focus,
.command-search select:focus {
  outline: 0;
  box-shadow: none;
}

.command-search select {
  color: var(--muted);
  min-height: 36px;
  padding-left: 2px;
}

.command-close {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
}

.command-close:hover {
  background: rgba(148,163,184,.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  filter: none;
}

.command-results {
  max-height: 62vh;
  overflow: auto;
  margin-top: 14px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: 0 24px 64px rgba(82, 92, 128, .18);
}

.command-results:empty {
  display: none;
}

.command-results section {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.command-results button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  justify-content: stretch;
  text-align: left;
  background: rgba(248,250,252,.72);
  color: var(--text);
  border-radius: 12px;
  padding: 14px 16px;
}

.result-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.result-main strong,
.result-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-main small {
  color: var(--muted);
  font-size: 13px;
}

.result-status {
  justify-self: end;
  align-self: center;
  min-width: 74px;
  display: flex;
  justify-content: flex-end;
}

.command-results button:hover {
  background: rgba(148,163,184,.12);
}

tr:hover td,
.dash-list button:hover,
.widget-library button:hover,
.theme-card:hover,
.upload-form:hover {
  background-color: var(--table-row-hover);
}

body.theme-aurora .global-search:hover {
  box-shadow: 0 12px 34px rgba(124, 58, 237, .12), 0 0 0 1px rgba(255,255,255,.38);
}

body.theme-aurora .sidebar,
body.theme-aurora .panel,
body.theme-aurora .dash-card,
body.theme-aurora .table-scroll,
body.theme-aurora .inventory-table-wrap,
body.theme-aurora .settings-panel {
  background: var(--panel-bg);
  border-color: rgba(161, 183, 226, .46);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.theme-aurora .dialog-card {
  background:
    linear-gradient(var(--modal-bg), var(--modal-bg)) padding-box,
    linear-gradient(110deg, rgba(115,192,232,.55), rgba(174,139,238,.42), rgba(244,161,198,.38), rgba(115,192,232,.55)) border-box;
  border: 1px solid transparent;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.theme-aurora input,
body.theme-aurora select,
body.theme-aurora textarea {
  background: var(--input-bg);
}

body.theme-aurora button:hover {
  box-shadow: 0 0 0 3px rgba(125, 168, 231, .12);
}

body.theme-zen .badge {
  filter: saturate(.72);
}

body.theme-zen .theme-card,
body.theme-zen .widget-library button,
body.theme-zen .dash-list button,
body.theme-zen .dash-metrics button,
body.theme-zen .quick-link-icon {
  background: #f4f1ea;
  border-color: #ddd6c9;
}

body.theme-midnight .main,
body.theme-midnight .sidebar {
  color: var(--text-main);
}

body.theme-midnight .panel,
body.theme-midnight .dash-card,
body.theme-midnight .table-scroll,
body.theme-midnight .inventory-table-wrap,
body.theme-midnight .settings-panel,
body.theme-midnight .theme-card,
body.theme-midnight .widget-library button,
body.theme-midnight .dialog-card,
body.theme-midnight .settings-popover,
body.theme-midnight .command-results {
  background: var(--panel-bg);
  color: var(--text-main);
  border-color: var(--border-color);
}

body.theme-midnight input,
body.theme-midnight select,
body.theme-midnight textarea,
body.theme-midnight .dash-list button,
body.theme-midnight .dash-metrics button,
body.theme-midnight .quick-link-icon,
body.theme-midnight .quick-link-tools button,
body.theme-midnight .secondary {
  background: var(--input-bg);
  color: var(--text-main);
  border-color: var(--border-color);
}

body.theme-midnight th,
body.theme-midnight .inventory-table thead th,
body.theme-midnight .planner-table thead th {
  background: var(--table-header-bg);
  color: var(--text-muted);
  border-color: var(--border-color);
}

body.theme-midnight td,
body.theme-midnight .purchase-detail-row td,
body.theme-midnight .sku-detail-row td {
  background: var(--panel-bg);
  color: var(--text-main);
  border-color: var(--border-color);
}

body.theme-midnight tr:hover td {
  background: var(--table-row-hover);
}

body.theme-midnight .muted,
body.theme-midnight small,
body.theme-midnight .panel-head p,
body.theme-midnight .list-head p,
body.theme-midnight .dash-footer,
body.theme-midnight .table-counter,
body.theme-midnight .result-main small,
body.theme-midnight .global-search strong,
body.theme-midnight .menu-title {
  color: var(--text-soft);
}

body.theme-midnight .menu-item {
  color: var(--text-muted);
}

body.theme-midnight .menu-item.active {
  background: #243041;
  color: #f8fafc;
  box-shadow: inset 3px 0 0 #60a5fa;
}

body.theme-midnight .global-search,
body.theme-midnight .command-search {
  background:
    linear-gradient(#1b2330, #1b2330) padding-box,
    linear-gradient(90deg, rgba(94, 234, 212, .42), rgba(96, 165, 250, .42), rgba(244, 114, 182, .34), rgba(94, 234, 212, .42)) border-box;
  color: var(--text-main);
}

body.theme-midnight .command-search input,
body.theme-midnight .command-search select {
  background: transparent;
}

body.theme-midnight .badge.ok {
  background: rgba(22, 115, 74, .24);
  color: #86efac;
}

body.theme-midnight .badge.warn {
  background: rgba(154, 91, 0, .26);
  color: #facc15;
}

body.theme-midnight .badge.neutral {
  background: #334155;
  color: #cbd5e1;
}

body.theme-midnight button:disabled,
body.theme-midnight input:disabled,
body.theme-midnight select:disabled,
body.theme-midnight textarea:disabled {
  opacity: .62;
  color: var(--text-soft);
}

body.no-card-shadow .dashboard-hero,
body.no-card-shadow .dash-card,
body.no-card-shadow .panel,
body.no-card-shadow .inventory-metrics article {
  box-shadow: none;
}

body.square-cards .dashboard-hero,
body.square-cards .dash-card,
body.square-cards .panel,
body.square-cards .table-scroll,
body.square-cards .inventory-table-wrap,
body.square-cards .settings-panel {
  border-radius: 0;
}

.row-highlight {
  animation: rowFlash 1.6s ease;
}

@keyframes rowFlash {
  0%, 70% { background: #fff7d6; }
  100% { background: transparent; }
}

.option-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.gift-option-row {
  grid-template-columns: 120px minmax(160px, 1fr) minmax(120px, 1fr) auto auto auto;
}

@media (max-width: 1180px) {
  .dashboard-hero {
    display: grid;
  }

  .widget-S,
  .widget-M,
  .widget-L {
    grid-column: span 6;
  }

  .purchase-stats,
  .widget-library {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .business-filters,
  .item-picker {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }
}

@media (max-width: 900px) {
  .batch-field-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }
}

@media (max-width: 640px) {
  .batch-field-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1100px) and (max-width: 1400px) {
  body {
    grid-template-columns: 220px minmax(0, 1fr);
  }
}

@media (min-width: 900px) and (max-width: 1100px) {
  body {
    grid-template-columns: 74px minmax(0, 1fr);
  }
  .sidebar .brand {
    justify-content: center;
  }
  .sidebar .brand-text,
  .sidebar .menu {
    display: none;
  }
}

@media (max-width: 900px) {
  body,
  body.sidebar-collapsed {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 80;
    width: min(280px, 84vw);
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  .sidebar:not(.collapsed) {
    transform: translateX(0);
  }
  .main {
    padding: 18px;
  }
}

@media (max-width: 760px) {
  .widget-S,
  .widget-M,
  .widget-L,
  .widget-XL,
  .add-widget {
    grid-column: span 12;
  }
  .theme-cards,
  .widget-library {
    grid-template-columns: 1fr;
  }
  .purchase-stats {
    grid-template-columns: 1fr;
  }
  .command-results button {
    grid-template-columns: 1fr;
  }
}

.v2-workspace-tabs button {
  min-width: 120px;
}

.stage-a-overview article strong {
  font-size: 20px;
}

.profit-section-block {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.profit-section-block h4 {
  margin: 0 0 12px;
}

.quality-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quality-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  background: #eef2f7;
  color: #475569;
}

.quality-pill.ok {
  background: #dcfce7;
  color: #166534;
}

.quality-pill.bad {
  background: #fee2e2;
  color: #b91c1c;
}

.profit-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-width: min(520px, 100%);
  flex: 1 1 420px;
}

.profit-search-wrap input {
  flex: 1;
  min-width: 0;
  padding-right: 104px;
}

.profit-search-icon-button,
.profit-search-clear {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.profit-search-icon-button {
  right: 8px;
}

.profit-search-clear {
  right: 54px;
  font-size: 20px;
  line-height: 1;
}

.profit-search-icon-button:hover,
.profit-search-clear:hover {
  color: var(--text-main);
  background: rgba(148, 163, 184, .14);
  border-radius: 8px;
}

.profit-search-icon-button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.profit-clear-search-button {
  min-height: 44px;
  white-space: nowrap;
}

.profit-clear-search-button:disabled {
  opacity: .48;
  cursor: not-allowed;
}

.profit-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.profit-pagination input {
  width: 76px;
  height: 38px;
  text-align: center;
}
