:root {
  color-scheme: light;
  --bg: #f4f7f8;
  --panel: #ffffff;
  --panel-soft: #eef4f2;
  --text: #17211f;
  --muted: #63716e;
  --line: #d8e2df;
  --accent: #0a7c72;
  --accent-strong: #075d56;
  --danger: #bc3b3b;
  --good: #147940;
  --warn: #ac7417;
  --shadow: 0 18px 45px rgba(23, 33, 31, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #edf3f1;
}

.auth-ready .login-screen {
  display: none;
}

.auth-pending .app-shell,
.auth-required .app-shell {
  display: none;
}

.login-panel {
  display: grid;
  gap: 16px;
  width: min(400px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-panel h1,
.login-panel p {
  margin: 0;
}

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

.login-panel p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.login-panel label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}

.login-panel input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
}

.login-panel .login-error {
  min-height: 20px;
  color: var(--danger);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topbar-user > span {
  color: var(--muted);
  font-size: 13px;
}

.android-download-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
}

.android-download-popover {
  position: absolute;
  z-index: 1200;
  top: calc(100% + 10px);
  right: 0;
  display: grid;
  justify-items: center;
  gap: 7px;
  width: 188px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.android-download-popover::before {
  position: absolute;
  top: -6px;
  right: 24px;
  width: 10px;
  height: 10px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: #fff;
  content: "";
  transform: rotate(45deg);
}

.android-download-btn:hover .android-download-popover,
.android-download-btn:focus-visible .android-download-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.android-download-popover strong {
  font-size: 13px;
}

.android-download-popover img {
  display: block;
  width: 142px;
  height: 142px;
  border: 1px solid #eef2f0;
  background: #fff;
}

.android-download-popover small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}

.user-admin-modal {
  width: min(1220px, 100%);
}

.user-admin-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.new-user-form {
  display: grid;
  grid-template-columns: auto minmax(130px, 1fr) minmax(150px, 1fr) 110px auto 190px 110px auto;
  align-items: end;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f7faf9;
}

.new-user-form label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.new-user-form input,
.new-user-form select,
.user-admin-table-wrap input,
.user-admin-table-wrap select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 8px;
  background: #fff;
}

.new-user-form input[type="checkbox"],
.user-admin-table-wrap input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
}

.new-user-form > label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  align-self: center;
  gap: 5px;
  white-space: nowrap;
}

.user-admin-message {
  min-height: 20px;
  margin: 0;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.user-admin-table-wrap {
  overflow-x: auto;
}

.user-admin-table-wrap table {
  width: 100%;
  min-width: 1050px;
  border-collapse: collapse;
}

.user-admin-table-wrap th,
.user-admin-table-wrap td {
  border-bottom: 1px solid var(--line);
  padding: 8px 6px;
  text-align: left;
}

.user-admin-table-wrap input[type="datetime-local"] {
  min-width: 180px;
}

.user-admin-table-wrap input[type="number"] {
  width: 86px;
}

.account-enabled {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.account-actions {
  white-space: nowrap;
}

.account-actions button {
  min-height: 32px;
  margin-right: 5px;
}

.user-admin-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.global-alert {
  position: fixed;
  z-index: 1000;
  top: 14px;
  left: 50%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  width: min(760px, calc(100% - 28px));
  min-height: 70px;
  transform: translateX(-50%);
  border: 2px solid var(--danger);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff0ed;
  box-shadow: 0 14px 35px rgba(104, 23, 23, 0.3);
  animation: global-alert-in 0.22s ease-out, global-alert-flash 0.9s steps(2, end) infinite;
}

.global-alert.hidden {
  display: none;
}

.global-alert-mark {
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--danger);
  color: white;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.global-alert-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.global-alert-copy strong,
.global-alert-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-alert-copy strong {
  font-size: 15px;
}

.global-alert-copy span {
  color: #7d3d38;
  font-size: 13px;
}

.global-alert button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--danger);
  font-size: 24px;
  line-height: 1;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.mobile-dock {
  display: none;
}

.app-shell {
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0 22px;
}

.alert-board {
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.alert-board-head div {
  display: grid;
  gap: 3px;
}

.alert-board-head span,
.alert-tile span,
.alert-tile em {
  color: var(--muted);
  font-size: 12px;
}

.alert-board-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.alert-tile {
  position: relative;
  display: grid;
  gap: 4px;
  min-height: 78px;
  border: 1px solid #e09a9a;
  border-radius: 8px;
  padding: 9px;
  background: #fff2f0;
  color: var(--text);
  text-align: left;
  box-shadow: 0 8px 18px rgba(188, 59, 59, 0.12);
}

.alert-tile-main {
  display: grid;
  gap: 4px;
  width: 100%;
  min-width: 0;
  border: 0;
  padding: 0 44px 0 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.alert-tile-dismiss {
  position: absolute;
  top: 7px;
  right: 7px;
  min-height: 28px;
  border: 1px solid #d99a9a;
  border-radius: 7px;
  padding: 0 8px;
  background: #fff;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
}

.alert-tile-dismiss:hover {
  background: #ffe8e5;
}

.alert-tile strong,
.alert-tile span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-tile em {
  font-style: normal;
}

.product-alert-tile strong {
  font-size: 16px;
}

.product-alert-tile span {
  color: #7d2a2a;
}

.product-alert-detail-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.product-alert-detail-title button {
  flex: 0 0 auto;
  min-height: 30px;
  border: 1px solid #d99a9a;
  border-radius: 7px;
  padding: 0 10px;
  background: #fff6f6;
  color: var(--danger);
  font-weight: 700;
}

.alert-board-empty {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
}

.alert-stats-board {
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
}

.post-analysis-stats {
  margin-top: 14px;
}

.page-bottom-stats {
  margin-top: 18px;
  margin-bottom: 18px;
  scroll-margin-top: 10px;
}

.dismiss-period-modal {
  width: min(430px, 100%);
}

.dismiss-period-body {
  display: grid;
  gap: 9px;
  padding: 14px;
}

.dismiss-period-body p {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 13px;
}

.dismiss-period-body button {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.dismiss-period-body button:hover {
  border-color: #d99a9a;
  background: #fff6f6;
}

.dismiss-period-body button span {
  color: var(--muted);
  font-size: 12px;
}

.alert-stats-head,
.alert-stats-group-head,
.alert-stats-actions {
  display: flex;
  align-items: center;
}

.alert-stats-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.alert-stats-head h2 {
  margin: 0 0 3px;
  font-size: 18px;
}

.alert-stats-head span,
.alert-stats-group-head span {
  color: var(--muted);
  font-size: 12px;
}

.alert-stats-actions {
  gap: 10px;
}

.alert-stats-actions label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.alert-stats-actions select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 9px;
  background: #fff;
}

.danger-outline-btn {
  min-height: 34px;
  border: 1px solid #d99b9b;
  border-radius: 7px;
  padding: 0 11px;
  background: #fff;
  color: var(--danger);
  font-weight: 700;
}

.alert-stats-group + .alert-stats-group {
  margin-top: 14px;
}

.alert-stats-group-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}

.alert-stats-categories {
  display: grid;
  gap: 12px;
}

.alert-stats-category {
  min-width: 0;
}

.alert-stats-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.alert-stats-category-head strong {
  color: var(--text);
  font-size: 14px;
}

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

.product-stat-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.product-stat-item.has-count {
  border-color: #e4aaa3;
}

.product-stat-name {
  display: block;
  padding: 8px 9px 6px;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-stat-values {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.product-stat-values > span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px;
  min-width: 0;
  padding: 6px;
}

.product-stat-values > span + span {
  border-left: 1px solid var(--line);
}

.product-stat-values em {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  white-space: nowrap;
}

.product-stat-values b {
  justify-self: end;
  font-size: 16px;
}

.product-stat-values small {
  color: var(--muted);
  font-size: 10px;
}

.product-stat-values > span.has-count {
  background: #fff0ed;
}

.product-stat-values > span.has-count em,
.product-stat-values > span.has-count small {
  color: #9d3b31;
}

.product-stat-values > span.has-count b {
  color: var(--danger);
}

.alert-stats-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.alert-stat-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: baseline;
  gap: 4px;
  min-height: 42px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px 9px;
  background: #fff;
}

.alert-stat-item span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-stat-item strong {
  font-size: 17px;
}

.alert-stat-item em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.alert-stat-item.has-count {
  border-color: #e4aaa3;
  background: #fff0ed;
}

.alert-stat-item.has-count strong {
  color: var(--danger);
}

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

/* 预警次数统计：每个品种一行，全部合约/相邻价差各四类 */
.stat-product-list {
  display: grid;
  gap: 8px;
}

.stat-product-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.stat-product-title {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}

.stat-product-title strong {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-product-title span {
  color: var(--muted);
  font-size: 11px;
}

.stat-scope-block {
  min-width: 0;
  border-left: 1px solid var(--line);
  padding-left: 12px;
}

.stat-scope-full {
  border-left: 0;
  padding-left: 0;
}

.stat-scope-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}

.stat-scope-head strong {
  font-size: 12px;
}

.stat-scope-head span {
  color: var(--muted);
  font-size: 11px;
}

.stat-cat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.stat-cat-grid > span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 1px 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 7px;
  background: #fafcfb;
}

.stat-cat-grid em {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  white-space: nowrap;
}

.stat-cat-grid b {
  justify-self: end;
  font-size: 16px;
}

.stat-cat-grid small {
  color: var(--muted);
  font-size: 10px;
}

.stat-cat-grid > span.has-count {
  border-color: #e4aaa3;
  background: #fff0ed;
}

.stat-cat-grid > span.has-count b {
  color: var(--danger);
}

@media (max-width: 720px) {
  .stat-product-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .stat-scope-block {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 8px;
  }
  .stat-cat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.page-bottom-industry {
  margin-top: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(26px, 3vw, 42px);
  letter-spacing: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: 18px;
}

h3 {
  margin-bottom: 10px;
  font-size: 16px;
}

.status-strip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--muted);
  white-space: nowrap;
}

.pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 0 rgba(20, 121, 64, 0.45);
  animation: pulse 1.6s infinite;
}

.dashboard {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

.rule-panel,
.market-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.rule-panel {
  display: none;
}

.market-panel {
  min-width: 0;
  padding: 18px;
}

.panel-head,
.toolbar,
.alerts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.toolbar p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.toolbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-title h2 {
  margin: 0;
}

.toolbar-title .ghost-btn {
  min-height: 34px;
  padding: 0 11px;
}

.toolbar-actions,
.quick-examples,
.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.active-indicators {
  margin: 0 0 16px;
  border: 1px solid #c9ded9;
  border-radius: 8px;
  padding: 12px;
  background: #f1f8f6;
}

.backend-version-warning {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
  border: 1px solid #d85c50;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff0ed;
  color: #8d211b;
}

.backend-version-warning span {
  font-size: 13px;
}

.product-alert-detail-body {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.product-alert-detail-body article {
  display: grid;
  gap: 5px;
  border: 1px solid #e2a29a;
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff7f5;
}

.product-alert-detail-body article strong {
  color: var(--danger);
}

.product-alert-detail-body article span {
  line-height: 1.55;
}

.product-alert-detail-body article em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.product-memo {
  display: grid;
  gap: 10px;
  margin: 12px 0 16px;
  border: 1px solid #d8dfdd;
  border-radius: 8px;
  padding: 13px 14px;
  background: #fff;
}

.product-memo-head,
.product-memo-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.product-memo-head > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.product-memo h3 {
  margin: 0;
  font-size: 16px;
}

.product-memo-head span,
.product-memo-message,
.product-memo-loading,
.product-memo-empty,
.product-memo-error {
  color: var(--muted);
  font-size: 12px;
}

.product-memo-content {
  color: var(--text);
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.product-memo-form {
  display: grid;
  gap: 9px;
}

.product-memo-form textarea {
  width: 100%;
  min-height: 116px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 11px;
  background: #fff;
  color: var(--text);
  font: inherit;
  line-height: 1.6;
}

.product-memo-form textarea:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 18%, transparent);
}

.product-memo-actions {
  justify-content: flex-end;
}

.product-memo-message {
  margin-right: auto;
  color: var(--danger);
}

.product-memo-error {
  color: var(--danger);
}

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

.indicator-heading div {
  display: grid;
  gap: 4px;
}

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

.indicator-count {
  white-space: nowrap;
}

.indicator-list {
  display: grid;
  gap: 8px;
}

.indicator-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.inline-alert-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  margin: 10px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.inline-form-title,
.inline-alert-form .wide,
.inline-form-actions {
  grid-column: 1 / -1;
}

.inline-form-title {
  display: grid;
  gap: 4px;
}

.inline-form-title span {
  color: var(--muted);
  font-size: 12px;
}

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

.alert-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 28, 25, 0.46);
}

.alert-modal {
  width: min(1160px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 22px 70px rgba(17, 28, 25, 0.28);
}

.alert-modal-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.alert-modal-head button[data-alert-modal-close] {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border: 0;
  border-radius: 50%;
  background: #edf3f1;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}

.alert-modal .inline-alert-form {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.batch-alert-modal {
  width: min(520px, 100%);
}

.sound-settings-modal {
  width: min(540px, 100%);
}

.sound-settings-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.sound-choice {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.sound-choice:has(input:checked) {
  border-color: #72b59d;
  background: #f0faf6;
}

.sound-choice input {
  width: 18px;
  height: 18px;
}

.sound-choice span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.sound-choice em {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sound-upload {
  display: grid;
  gap: 7px;
  border: 1px dashed #9bbdb3;
  border-radius: 8px;
  padding: 12px;
  background: #f8fbfa;
  font-size: 13px;
  font-weight: 700;
}

.sound-upload-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sound-upload-head button {
  min-height: 38px;
}

.sound-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.sound-selected-file {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.sound-selected-file.has-file {
  border-color: #72b59d;
  background: #f0faf6;
  color: var(--accent-strong);
  font-weight: 700;
}

.sound-save-button {
  width: 100%;
  min-height: 42px;
}

.sound-upload small,
.sound-settings-message {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
}

.sound-settings-message {
  min-height: 18px;
  margin: 0;
}

.sound-settings-error {
  color: var(--danger);
}

.sound-settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sound-settings-actions button {
  min-height: 40px;
}

.batch-alert-form {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.batch-alert-form p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.batch-alert-form label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}

.batch-alert-form input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
}

.batch-alert-form .batch-alert-note {
  margin: 0;
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}

.batch-alert-options {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.batch-alert-options > strong {
  font-size: 13px;
}

.batch-alert-form label.batch-option-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.batch-alert-form label.batch-option-check input {
  width: 16px;
  min-height: 16px;
  height: 16px;
}

.batch-alert-form label.batch-option-number input {
  width: 110px;
  min-height: 34px;
}

.batch-boll-options {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: #f2faf6;
}

.batch-boll-options > strong {
  font-size: 13px;
}

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

.batch-boll-grid label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
}

.batch-boll-grid label input {
  width: 100%;
  min-height: 34px;
}

@media (max-width: 640px) {
  .batch-boll-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.alert-scope-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.alert-scope-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.alert-scope-head span {
  color: var(--muted);
  font-size: 12px;
}

.alert-scope-actions {
  display: flex;
  gap: 6px;
}

.alert-scope-actions button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.alert-scope-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.alert-scope-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.alert-scope-item input {
  width: 16px;
  height: 16px;
}

.alert-scope-item span {
  display: grid;
  gap: 2px;
}

.alert-scope-item em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.fine-alert-table {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.fine-alert-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.fine-alert-head span {
  color: var(--muted);
  font-size: 12px;
}

.fine-alert-scroll {
  overflow-x: auto;
}

.fine-alert-table table {
  width: 100%;
  min-width: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.fine-alert-table th,
.fine-alert-table td {
  padding: 7px 6px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.fine-alert-table td:first-child {
  min-width: 145px;
}

.fine-alert-table td:first-child em {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.fine-alert-table input[type="number"] {
  width: 92px;
  min-height: 34px;
}

.fine-alert-table input.fine-alert-note-input {
  width: 170px;
  min-height: 34px;
}

.fine-alert-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.bulk-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bulk-cell input[type="number"] {
  width: 78px;
}

.bulk-cell button {
  white-space: nowrap;
}

.fine-alert-bulk {
  background: #eef8f5;
}

.fine-alert-unavailable {
  background: #f3f5f4;
  color: var(--muted);
}

.fine-alert-unavailable input {
  cursor: not-allowed;
  background: #e9edeb;
  color: var(--muted);
}

.fine-alert-unavailable td:first-child em {
  color: #9a554c;
  font-weight: 700;
}

.fine-alert-bulk button {
  min-height: 28px;
  margin-right: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

@media (max-width: 980px) {
  .alert-stats-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .alert-stats-grid,
  .cross-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .fine-alert-table table {
    min-width: 900px;
  }
}

@media (min-width: 981px) and (max-width: 1250px) {
  .product-stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.rule-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0 14px;
}

.hidden-field {
  display: none;
}

.force-hidden {
  display: none !important;
}

.focus-board {
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

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

.focus-head h2 {
  margin: 0;
  font-size: 18px;
}

.focus-head span,
.focus-item span {
  color: var(--muted);
  font-size: 13px;
}

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

.focus-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.focus-item > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.focus-item strong,
.focus-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.focus-values {
  display: grid;
  gap: 3px;
  text-align: right;
}

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

.focus-action {
  color: var(--teal);
}

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

.section-title.compact {
  margin-bottom: 10px;
}

.section-title.compact h3 {
  margin-bottom: 0;
}

.section-title.compact span {
  color: var(--muted);
  font-size: 12px;
}

.watchlist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.watchlist-note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.watch-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px 0 10px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.watch-chip button {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--danger);
  font-size: 18px;
  line-height: 1;
}

.add-product-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fbfdfc;
  color: var(--text);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 124, 114, 0.14);
}

.wide {
  grid-column: 1 / -1;
}

.primary-btn,
.ghost-btn,
.quick-examples button,
.tab-btn {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  font-weight: 700;
}

.primary-btn {
  background: var(--accent);
  color: white;
}

.primary-btn:hover {
  background: var(--accent-strong);
}

.ghost-btn,
.quick-examples button,
.tab-btn {
  border-color: var(--line);
  background: #fbfdfc;
  color: var(--text);
}

.ghost-btn:hover,
.quick-examples button:hover,
.tab-btn:hover,
.tab-btn.active {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.sound-enabled {
  border-color: #3c9a58;
  background: #edf8ef;
  color: #216a34;
}

.sound-needs-unlock {
  border-color: #d99d32;
  background: #fff5dc;
  color: #7b5200;
  animation: sound-unlock-pulse 1.5s ease-in-out infinite;
}

@keyframes sound-unlock-pulse {
  50% {
    filter: brightness(0.94);
  }
}

.tab-btn.active {
  background: #e5f2f0;
}

.tab-btn {
  position: relative;
}

.tab-btn.tab-alert {
  border-color: #d35f5f;
  background: #fff4f2;
  color: #8f2424;
}

.tab-btn.config-0 {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
}

.tab-btn.config-1 {
  border-color: #a9d3b3;
  background: #eef8f0;
  color: #245f35;
}

.tab-btn.config-2 {
  border-color: #67a878;
  background: #cfe8d5;
  color: #174d28;
}

.tab-btn.tab-alert.config-0,
.tab-btn.tab-alert.config-1,
.tab-btn.tab-alert.config-2 {
  border-color: #d35f5f;
  background: #fff4f2;
  color: #8f2424;
}

.tab-alert-badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  line-height: 1;
}

.quick-examples {
  margin-bottom: 16px;
}

.quick-examples button {
  flex: 1 1 170px;
  font-size: 13px;
}

.rules-list,
.alerts-list {
  display: grid;
  gap: 10px;
}

.task-item,
.alert-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.task-item {
  display: grid;
  gap: 6px;
  background: var(--panel-soft);
}

.task-alarmed {
  border-color: var(--danger);
  background: #fff1ef;
  box-shadow: 0 0 0 3px rgba(188, 59, 59, 0.14);
  animation: task-flash 0.9s steps(2, end) infinite;
}

.task-alarmed::before {
  content: "已触发";
  width: max-content;
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 800;
}

.task-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

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

.task-actions button {
  border: 0;
  background: transparent;
  font-weight: 700;
}

.task-hit-details {
  display: grid;
  gap: 5px;
  border-top: 1px solid rgba(188, 59, 59, 0.22);
  padding-top: 8px;
  color: #7d2a2a;
  font-size: 13px;
}

.compact-indicators .task-item {
  padding: 10px 12px;
}

.task-hit-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.task-hit-pills span {
  border-radius: 999px;
  padding: 3px 8px;
  background: #ffe1dd;
  color: #8f2424;
  font-size: 12px;
  font-weight: 700;
}

.task-hit-pills span.recent {
  border: 1px solid #e6b96c;
  background: #fff8e8;
  color: #7b5315;
}

.alert-trigger-summary {
  display: grid;
  gap: 8px;
  border: 1px solid #e2a29a;
  border-radius: 8px;
  padding: 12px;
  background: #fff7f5;
}

.alert-trigger-summary-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.alert-trigger-summary-head span {
  color: var(--muted);
  font-size: 12px;
}

.alert-trigger-summary > div:not(.alert-trigger-summary-head) {
  display: grid;
  grid-template-columns: minmax(130px, auto) minmax(240px, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-top: 1px solid rgba(188, 59, 59, 0.16);
  padding-top: 8px;
}

.alert-trigger-summary > div.current {
  color: var(--danger);
}

.alert-trigger-summary em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  white-space: nowrap;
}

.task-hit-details strong {
  color: var(--danger);
}

.task-actions button:first-child {
  color: var(--accent-strong);
}

.task-actions button:last-child {
  color: var(--danger);
}

.task-row strong {
  font-size: 15px;
}

.task-row button {
  border: 0;
  background: transparent;
  color: var(--danger);
  font-weight: 700;
}

.task-text,
.alert-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.tabs {
  display: grid;
  gap: 9px;
  margin: 18px 0 14px;
}

.category-row {
  display: grid;
  grid-template-columns: 54px 1fr;
  align-items: start;
  gap: 10px;
}

.category-name {
  padding-top: 10px;
  color: var(--accent-strong);
  font-size: 13px;
  white-space: nowrap;
}

.category-items {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.category-items .tab-btn {
  min-height: 34px;
  padding: 0 11px;
  font-size: 13px;
}

.industry-board {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fbfa;
}

.industry-board-head,
.industry-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.industry-board-head > div {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.industry-board-head h3 {
  margin: 0;
  font-size: 17px;
}

.industry-board-head span,
.industry-panel-title span,
.industry-panel-title a {
  color: var(--muted);
  font-size: 12px;
}

.industry-board-head button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  background: #fff;
  cursor: pointer;
}

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

.industry-metrics > section,
.industry-news {
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.industry-panel-title {
  margin-bottom: 8px;
}

.industry-series {
  display: grid;
  gap: 3px;
}

.industry-series > div {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 56px;
  align-items: center;
  min-height: 28px;
  border-bottom: 1px solid #e7eeec;
  font-size: 12px;
}

.industry-series strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.industry-series strong small {
  margin-left: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
}

.industry-series em {
  text-align: right;
  font-style: normal;
}

.industry-series-label,
.industry-note {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.industry-market-samples {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 8px;
  margin-top: 8px;
}

.industry-market-samples span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
}

.industry-market-samples strong {
  color: var(--text);
}

.industry-cost-clues,
.industry-news-grid {
  display: grid;
  gap: 7px;
}

.industry-cost-clues {
  margin-top: 8px;
}

.industry-cost-clues a,
.industry-news-item {
  display: grid;
  gap: 3px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.industry-cost-clues a {
  border-bottom: 1px solid #e7eeec;
  padding-bottom: 6px;
}

.industry-cost-clues strong,
.industry-news-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.industry-cost-clues span,
.industry-news-item span {
  color: var(--muted);
  font-size: 11px;
}

.industry-news-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.industry-news-item {
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: #fff;
}

.industry-news-item:hover {
  border-color: var(--accent);
}

.industry-news-item em {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.industry-empty,
.industry-loading {
  display: grid;
  place-items: center;
  min-height: 90px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.industry-loading {
  gap: 5px;
  margin-top: 14px;
  min-height: 130px;
  background: #f8fbfa;
}

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

.industry-load-error {
  color: var(--danger);
}

.industry-errors {
  color: var(--muted);
  font-size: 11px;
}

.category-settings-modal {
  width: min(1040px, 100%);
}

.category-settings-body {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.category-settings-actions,
.product-library-form,
.category-edit-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.category-edit-list {
  display: grid;
  gap: 10px;
}

.category-edit-row,
.product-library-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 12px;
}

.category-edit-head {
  justify-content: space-between;
  margin-bottom: 10px;
}

.category-edit-head input {
  min-height: 34px;
  width: min(220px, 100%);
  font-weight: 700;
}

.category-edit-head button,
.category-edit-pill button,
.product-library-form button {
  min-height: 30px;
}

.category-edit-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-edit-items em {
  color: var(--muted);
  font-size: 13px;
}

.category-edit-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
}

.category-edit-pill button {
  width: 24px;
  border: 0;
  background: #eef8f5;
  cursor: pointer;
}

.product-library-box h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.product-library-form label {
  display: grid;
  gap: 5px;
  min-width: 180px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.product-library-form select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.analysis-board {
  display: grid;
  gap: 18px;
  min-width: 0;
}

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

.custom-spread-editor {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  margin: 4px 0 10px;
  padding: 10px;
  border: 1px solid #c9ded9;
  border-radius: 8px;
  background: #f1f8f6;
}

.custom-spread-editor.hidden-field {
  display: none;
}

.custom-spread-editor select {
  min-width: 145px;
}

.custom-spread-editor select:first-child {
  min-width: 170px;
}

.table-action {
  border: 0;
  background: transparent;
  font-weight: 700;
  cursor: pointer;
}

.table-action.row-triggered {
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--danger);
  color: #fff;
}

.danger-action {
  color: var(--danger);
}

.table-empty {
  padding: 18px;
  color: var(--muted);
  text-align: center !important;
}

.section-band {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.section-title p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

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

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #fbfdfc;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: #f2f7f6;
}

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

tr.hit-row td {
  background: #fff8e7;
}

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

.down {
  color: var(--good);
  font-weight: 800;
}

.alerts-head {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 6px;
}

.alert-item {
  background: #fffaf0;
  border-color: #eed9ad;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 9px rgba(20, 121, 64, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(20, 121, 64, 0);
  }
}

@keyframes task-flash {
  50% {
    background: #ffe0db;
    transform: translateY(-2px);
  }
}

@keyframes global-alert-in {
  from {
    opacity: 0;
    transform: translate(-50%, -12px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes global-alert-flash {
  50% {
    filter: brightness(1.08);
  }
}

@media (max-width: 640px) {
  .global-alert {
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    padding: 9px;
  }

  .global-alert-copy strong {
    font-size: 13px;
  }

  .global-alert-copy span {
    font-size: 11px;
  }
}

@media (max-width: 1050px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .rule-panel {
    position: static;
  }

  .industry-metrics {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  body {
    padding-bottom: 72px;
  }

  .app-shell {
    width: min(100% - 20px, 1500px);
    padding-top: 12px;
  }

  .topbar {
    gap: 12px;
    padding: 8px 0 14px;
  }

  .topbar h1 {
    margin: 0;
    font-size: 22px;
    line-height: 1.3;
  }

  .topbar-user {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
  }

  .topbar-user > span {
    grid-column: 1 / -1;
  }

  .topbar-user button {
    min-width: 0;
    padding: 8px 6px;
  }

  .alert-modal-backdrop {
    place-items: end center;
    padding: 6px;
  }

  .alert-modal {
    width: 100%;
    max-height: calc(100dvh - 12px);
  }

  .alert-modal-head {
    padding: 11px 12px;
  }

  .alert-modal .inline-alert-form,
  .batch-alert-form,
  .category-settings-body,
  .sound-settings-body {
    padding: 12px;
  }

  .inline-form-actions,
  .sound-settings-actions,
  .product-memo-actions,
  .category-settings-actions,
  .product-library-form,
  .category-edit-head,
  .alert-scope-head,
  .fine-alert-head {
    align-items: stretch;
    flex-direction: column;
  }

  .inline-form-actions button,
  .sound-settings-actions button,
  .sound-upload-head button,
  .sound-save-button,
  .category-settings-actions button,
  .product-library-form button,
  .product-memo-actions button {
    width: 100%;
    min-height: 42px;
  }

  .sound-upload-head {
    align-items: stretch;
    flex-direction: column;
  }

  .product-library-form label {
    width: 100%;
    min-width: 0;
  }

  .category-edit-head input {
    width: 100%;
  }

  .alert-scope-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fine-alert-scroll,
  .table-wrap {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .custom-spread-editor {
    display: grid;
    grid-template-columns: 1fr;
  }

  .custom-spread-editor > span {
    display: none;
  }

  .custom-spread-editor select,
  .custom-spread-editor select:first-child,
  .custom-spread-editor button {
    width: 100%;
    min-width: 0;
    min-height: 42px;
  }

  .table-action {
    min-height: 34px;
    padding: 0 7px;
  }

  .section-title > button {
    width: 100%;
    min-height: 40px;
  }

  .alert-board,
  .alert-stats-board,
  .focus-board {
    scroll-margin-top: 10px;
  }

  .alert-board-grid {
    grid-template-columns: 1fr;
  }

  .alert-tile {
    min-height: 70px;
  }

  .alert-stats-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .alert-stats-actions label,
  .alert-stats-actions select,
  .danger-outline-btn {
    width: 100%;
  }

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

  .alert-stats-categories {
    max-height: 430px;
    overflow-y: auto;
    padding-right: 2px;
  }

  .product-stats-grid {
    grid-template-columns: 1fr;
  }

  .product-stat-values > span {
    padding: 7px;
  }

  .dashboard {
    display: flex;
    flex-direction: column;
  }

  .market-panel {
    order: 1;
    scroll-margin-top: 10px;
  }

  .rule-panel {
    order: 2;
    scroll-margin-top: 10px;
  }

  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: thin;
  }

  .tabs button {
    flex: 0 0 auto;
  }

  .topbar,
  .toolbar,
  .panel-head,
  .alerts-head,
  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .status-strip {
    justify-content: center;
  }

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

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

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

  .alert-trigger-summary > div:not(.alert-trigger-summary-head) {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .alert-trigger-summary em {
    white-space: normal;
  }

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

  .category-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .category-name {
    padding-top: 0;
  }

  .toolbar-actions {
    width: 100%;
  }

  .toolbar-actions button {
    flex: 1;
  }

  .industry-board-head,
  .industry-panel-title,
  .product-memo-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .product-memo-head > div {
    display: grid;
    gap: 3px;
  }

  .product-memo-head button {
    width: 100%;
  }

  .industry-news-grid,
  .industry-market-samples {
    grid-template-columns: 1fr;
  }

  .page-bottom-industry {
    margin-top: 18px;
    scroll-margin-top: 10px;
  }

  .mobile-dock {
    position: fixed;
    z-index: 1200;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 7px max(8px, env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 -8px 22px rgba(23, 33, 31, 0.12);
  }

  .mobile-dock button {
    min-height: 42px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    font-weight: 700;
  }

  .mobile-dock button.active {
    background: #e8f5f1;
    color: var(--accent-strong);
  }
}

/* ===== AI 助手浮窗：沿用原系统配色与组件风格 ===== */
.hidden { display: none !important; }

.ai-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 1500;
  display: flex; align-items: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 10px 16px 10px 10px;
  background: var(--accent); color: #fff;
  box-shadow: 0 10px 28px rgba(10, 124, 114, 0.35);
  font-size: 13px; font-weight: 700;
}
.ai-fab:hover { background: var(--accent-strong); }
.ai-fab-icon {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.2); display: grid; place-items: center; font-size: 12px;
}
.ai-fab-badge {
  position: absolute; top: -6px; right: -4px; min-width: 18px; height: 18px;
  border-radius: 9px; background: var(--danger); color: #fff;
  font-size: 10px; line-height: 18px; text-align: center; padding: 0 5px;
}

.ai-panel {
  position: fixed; right: 22px; bottom: 80px; z-index: 1501;
  width: 380px; height: min(560px, calc(100vh - 110px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow);
}
.ai-panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--panel-soft);
}
.ai-panel-head strong { font-size: 14px; }
.ai-panel-head span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.ai-panel-head .ghost-btn { padding: 4px 10px; font-size: 11px; }
.ai-tabs { display: flex; border-bottom: 1px solid var(--line); }
.ai-tab {
  flex: 1; border: 0; background: #fff; color: var(--muted);
  padding: 9px; font-size: 12px; border-bottom: 2px solid transparent;
}
.ai-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.ai-tab-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.ai-chat-body { flex: 1; overflow-y: auto; padding: 12px 14px; }
.ai-msg { margin-bottom: 12px; }
.ai-msg-label { font-size: 10px; color: var(--muted); margin-bottom: 3px; }
.ai-msg.user { text-align: right; }
.ai-bubble {
  display: inline-block; max-width: 92%; padding: 8px 11px; border-radius: 8px;
  background: #f1f5f4; font-size: 12px; line-height: 1.65;
  white-space: pre-wrap; text-align: left;
}
.ai-msg.user .ai-bubble { background: var(--accent); color: #fff; }
.ai-rule-inline {
  margin-top: 6px; padding: 6px 9px; border-radius: 6px;
  background: var(--panel-soft); color: var(--accent); font-size: 11px;
}
.ai-quick { display: flex; gap: 6px; padding: 0 12px 8px; flex-wrap: wrap; }
.ai-quick button {
  border: 1px solid var(--line); background: #fff; color: var(--accent);
  border-radius: 12px; padding: 3px 9px; font-size: 10px;
}
.ai-chat-form { display: flex; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line); }
.ai-chat-form input {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font-size: 12px; outline: none;
}
.ai-chat-form input:focus { border-color: var(--accent); }
.ai-chat-form button {
  border: 0; background: var(--accent); color: #fff;
  border-radius: 8px; padding: 0 14px; font-size: 12px;
}

.ai-voice-box {
  margin: 0 12px 8px; padding: 9px 10px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--panel-soft);
}
.ai-voice-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  margin-bottom: 8px;
}
.ai-voice-head strong { font-size: 12px; color: var(--text); }
.ai-voice-head span { font-size: 10px; color: var(--muted); text-align: right; }
.ai-voice-main { display: flex; align-items: stretch; gap: 8px; }
.ai-voice-btn {
  flex: 0 0 auto; min-width: 92px; border: 1px solid var(--accent);
  background: #fff; color: var(--accent); border-radius: 8px;
  padding: 6px 8px; font-size: 11px; line-height: 1.35;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.ai-voice-mic {
  width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px;
}
.ai-voice-btn.listening { background: var(--accent); color: #fff; }
.ai-voice-btn.listening .ai-voice-mic { background: #fff; color: var(--accent); animation: aiVoicePulse 1.1s ease-in-out infinite; }
.ai-voice-btn:disabled { opacity: 0.55; cursor: not-allowed; }
@keyframes aiVoicePulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(10, 124, 114, 0.35); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(10, 124, 114, 0); }
}
.ai-voice-text {
  flex: 1; min-width: 0; min-height: 40px; max-height: 76px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  padding: 6px 8px; font-size: 11px; line-height: 1.55; color: var(--text);
  outline: none; white-space: pre-wrap;
}
.ai-voice-text:empty::before {
  content: attr(data-placeholder); color: var(--muted);
}
.ai-voice-text:focus { border-color: var(--accent); }
.ai-voice-actions { display: flex; gap: 6px; margin-top: 7px; }
.ai-voice-actions button {
  border-radius: 6px; padding: 4px 10px; font-size: 10px;
}
.ai-voice-send { border: 0; background: var(--accent); color: #fff; }
.ai-voice-send:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }
.ai-voice-clear { border: 1px solid var(--line); background: #fff; color: var(--muted); }

.ai-rule-toolbar {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-bottom: 1px solid var(--line); font-size: 11px; color: var(--muted);
}
.ai-rule-toolbar span { margin-right: auto; }
.ai-rule-toolbar label { display: inline-flex; align-items: center; gap: 3px; cursor: pointer; }
.ai-rule-list { flex: 1; overflow-y: auto; padding: 10px 12px; }
.ai-rule-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; }
.ai-rule-card.off { opacity: 0.55; }
.arc-top { display: flex; justify-content: space-between; gap: 6px; }
.arc-title { font-size: 12px; font-weight: 700; }
.arc-title b { color: var(--accent); }
.arc-id { font-size: 10px; color: var(--muted); }
.arc-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.arc-meta span {
  font-size: 10px; padding: 2px 6px; border-radius: 4px;
  background: var(--panel-soft); color: var(--accent);
}
.arc-actions { display: flex; gap: 6px; margin-top: 8px; }
.arc-actions button {
  border: 1px solid var(--line); background: #fff; color: var(--accent);
  border-radius: 5px; padding: 2px 8px; font-size: 10px;
}
.arc-actions button.danger { color: var(--danger); border-color: #e9c4c4; }
.ai-empty { color: var(--muted); font-size: 11px; text-align: center; padding: 22px 0; }
.ai-event-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 12px; border-top: 1px solid var(--line); font-size: 11px; font-weight: 700;
}
.ai-event-list { max-height: 150px; overflow-y: auto; padding: 0 12px 10px; }
.ai-event { padding: 7px 0; border-bottom: 1px dashed var(--line); }
.ae-title { font-size: 11px; font-weight: 700; }
.ae-detail { font-size: 10px; color: var(--muted); margin-top: 2px; }
.ae-time { font-size: 9px; color: var(--muted); margin-top: 2px; }

/* 线索收集 */
.ai-clue-toolbar { display: flex; gap: 6px; padding: 10px 12px 6px; }
.ai-clue-toolbar input {
  flex: 1; min-width: 0; padding: 7px 9px; font-size: 12px;
  border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--text);
}
.ai-clue-toolbar input:focus { border-color: var(--accent); outline: none; }
.ai-clue-toolbar button {
  border: 0; background: var(--accent); color: #fff; font-size: 12px;
  border-radius: 7px; padding: 0 12px; white-space: nowrap; cursor: pointer;
}
.ai-clue-toolbar button:disabled { opacity: 0.6; cursor: wait; }
.ai-clue-types {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 0 12px 8px; font-size: 11px; color: var(--muted);
}
.ai-clue-types label { display: inline-flex; align-items: center; gap: 3px; cursor: pointer; }
.ai-clue-status { margin-left: auto; font-size: 10px; }
.ai-clue-summary {
  margin: 0 12px 8px; padding: 9px 10px; background: var(--panel-soft);
  border-radius: 8px; font-size: 11px; line-height: 1.65; white-space: pre-wrap;
  max-height: 180px; overflow-y: auto;
}
.ai-clue-list { flex: 1; overflow-y: auto; padding: 0 12px 10px; }
.ai-clue-card {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 9px; margin-bottom: 8px;
}
.acc-top { display: flex; align-items: center; gap: 6px; font-size: 10px; }
.acc-type { color: #fff; background: var(--accent); border-radius: 4px; padding: 1px 6px; }
.acc-type.t-spot { background: #a8761b; }
.acc-type.t-inventory { background: #3567a8; }
.acc-type.t-cost { background: #7a4fa8; }
.acc-product { color: var(--accent-strong); font-weight: 700; }
.acc-date { margin-left: auto; color: var(--muted); }
.acc-title { font-size: 12px; font-weight: 600; line-height: 1.5; margin-top: 5px; }
.acc-title a { color: var(--text); text-decoration: none; }
.acc-title a:hover { color: var(--accent); }
.acc-detail { font-size: 10px; color: var(--muted); line-height: 1.6; margin-top: 4px; }
.acc-source { font-size: 9px; color: var(--muted); margin-top: 4px; }
.ai-clue-inline {
  margin-top: 8px; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px; max-height: 340px; overflow-y: auto; background: var(--panel-soft);
}
.ai-clue-inline .ai-clue-card { background: #fff; margin-bottom: 6px; }
.aci-head { font-size: 10px; color: var(--accent-strong); font-weight: 700; margin-bottom: 6px; }

/* AI 引擎设置 */
.ai-setting-intro { padding: 10px 12px 4px; font-size: 11px; color: var(--muted); line-height: 1.6; }
.ai-preset-row { display: flex; gap: 5px; padding: 6px 12px 8px; flex-wrap: wrap; }
.ai-preset-row button {
  border: 1px solid var(--line); background: #fff; color: var(--accent-strong);
  border-radius: 6px; padding: 4px 9px; font-size: 11px; cursor: pointer;
}
.ai-preset-row button:hover { background: var(--accent-soft); }
.ai-setting-fields { padding: 0 12px; }
.ai-setting-fields label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.ai-setting-fields label select, .ai-setting-fields label input {
  display: block; width: 100%; margin-top: 4px; padding: 7px 9px; font-size: 12px;
  border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--text);
}
.ai-setting-fields label select:focus, .ai-setting-fields label input:focus { border-color: var(--accent); outline: none; }
.ai-setting-hint {
  margin: 2px 12px 8px; padding: 8px 10px; background: var(--panel-soft);
  border-radius: 7px; font-size: 11px; line-height: 1.6; color: var(--accent-strong);
}
.ai-setting-actions { display: flex; gap: 6px; padding: 0 12px 6px; }
.ai-setting-actions button { flex: 1; border-radius: 7px; padding: 7px 10px; font-size: 12px; }
.ai-setting-actions button:not(.ghost-btn) { border: 0; background: var(--accent); color: #fff; cursor: pointer; }
.ai-setting-actions button:disabled { opacity: 0.6; cursor: wait; }
.ai-setting-result { padding: 0 12px 12px; font-size: 11px; line-height: 1.6; min-height: 16px; }
.ai-setting-result.ok { color: var(--good); }
.ai-setting-result.err { color: var(--danger); }

.ai-remind-modal {
  position: fixed; inset: 0; z-index: 2100;
  background: rgba(23, 33, 31, 0.45); display: grid; place-items: center; padding: 20px;
}
.ai-remind-card { width: min(400px, 100%); background: #fff; border-radius: 12px; padding: 22px; box-shadow: var(--shadow); }
.ai-remind-kicker { font-size: 12px; color: var(--danger); font-weight: 700; }
.ai-remind-card h3 { margin: 8px 0 10px; font-size: 15px; }
.ai-remind-card p { margin: 0; font-size: 12px; line-height: 1.7; }
.ai-remind-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 18px; font-size: 10px; color: var(--muted);
}
.ai-remind-foot button {
  border: 0; background: var(--accent); color: #fff;
  border-radius: 7px; padding: 7px 16px; font-size: 12px;
}
.ai-toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(12px);
  z-index: 2200; background: var(--text); color: #fff;
  padding: 9px 15px; border-radius: 7px; font-size: 12px;
  opacity: 0; pointer-events: none; transition: 0.2s;
}
.ai-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 640px) {
  .mobile-dock { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .ai-dock-btn { background: var(--accent) !important; color: #fff !important; font-weight: 700; }
  .ai-fab { right: 14px; bottom: 76px; padding: 8px 12px 8px 8px; }
  .ai-fab-label { display: none; }
  .ai-panel { left: 8px; right: 8px; bottom: 68px; width: auto; height: min(68vh, 560px); }
}

/* 预警设置弹窗：紧凑排版，沿用原青绿色模板，仅缩小文字与内容框 */
.alert-editor-modal { width: min(1060px, 100%); max-height: min(680px, calc(100vh - 32px)); }
.alert-editor-modal .alert-modal-head { padding: 9px 14px; }
.alert-editor-modal .alert-modal-head strong { font-size: 14px; }
.alert-editor-modal .inline-alert-form { grid-template-columns: repeat(6, minmax(92px, 1fr)); gap: 7px 9px; padding: 10px; margin: 0; }
.alert-editor-modal .inline-form-title strong { font-size: 13px; }
.alert-editor-modal .inline-form-title span { font-size: 11px; line-height: 1.45; }
.alert-editor-modal label { font-size: 11px; gap: 3px; font-weight: 600; }
.alert-editor-modal input,
.alert-editor-modal select { min-height: 28px; padding: 3px 7px; font-size: 12px; border-radius: 6px; }
.alert-editor-modal .fine-alert-table { padding: 8px; gap: 6px; }
.alert-editor-modal .fine-alert-head span { font-size: 11px; }
.alert-editor-modal .fine-alert-table th,
.alert-editor-modal .fine-alert-table td { padding: 4px 5px; font-size: 12px; }
.alert-editor-modal .fine-alert-table td:first-child { min-width: 118px; }
.alert-editor-modal .fine-alert-table td:first-child em { font-size: 10px; margin-top: 1px; }
.alert-editor-modal .fine-alert-table input[type="number"] { width: 62px; min-height: 26px; }
.alert-editor-modal .fine-alert-table input.fine-alert-note-input { width: 118px; min-height: 26px; }
.alert-editor-modal .fine-alert-table input[type="checkbox"] { width: 14px; height: 14px; }
.alert-editor-modal .bulk-cell { gap: 4px; }
.alert-editor-modal .bulk-cell input[type="number"] { width: 54px; min-height: 26px; }
.alert-editor-modal .bulk-cell button { min-height: 24px; padding: 0 6px; font-size: 11px; }
.alert-editor-modal .alert-scope-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.alert-editor-modal .alert-scope-item { padding: 5px 7px; }
.alert-editor-modal .alert-scope-item em { font-size: 10px; }
.alert-editor-modal .primary-btn,
.alert-editor-modal .ghost-btn { min-height: 30px; font-size: 12px; padding: 0 12px; }
.alert-modal-head-actions { display: flex; align-items: center; gap: 8px; }
.boll-shortcut-btn {
  width: auto; min-width: 0; height: 30px; min-height: 30px;
  padding: 0 12px; border: 1px solid var(--accent); border-radius: 7px;
  background: #e8f5f1; color: var(--accent-strong); font-size: 12px; font-weight: 700;
  line-height: 1.2; white-space: nowrap; cursor: pointer; flex: 0 0 auto;
}
.boll-shortcut-btn:hover { background: var(--accent); color: #fff; }

/* ===== 成交列表（持仓盯盘） ===== */
.positions-board {
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

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

.positions-head h2 { margin: 0; font-size: 18px; }

.positions-head > div:first-child > span {
  color: var(--muted);
  font-size: 12px;
}

.positions-head-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.position-list { display: grid; gap: 8px; }

.position-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.6fr) auto auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

.position-row-alert { border-color: #e2a29a; background: #fff7f5; }

.position-main { display: grid; gap: 3px; min-width: 0; }
.position-main strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.position-sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.position-note { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.position-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.position-metrics > div { display: grid; gap: 2px; }
.position-metrics span { color: var(--muted); font-size: 11px; }
.position-metrics b { font-size: 13px; }

.position-status {
  display: grid;
  gap: 2px;
  justify-items: center;
  min-width: 92px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.position-status small { color: var(--muted); font-size: 10px; font-weight: 400; }
.position-status-alert { color: var(--danger); }

.position-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

.position-form { grid-template-columns: repeat(4, minmax(120px, 1fr)); }
.position-form .wide { grid-column: span 4; }
.position-spread-fields { display: contents; }
.position-form-hint { grid-column: span 4; color: var(--muted); font-size: 11px; line-height: 1.5; }

.position-sound-body { padding: 14px; display: grid; gap: 10px; }
.position-sound-body .position-form-hint { margin: 0; }
.position-sound-row { display: flex; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; }
.position-sound-row > span { display: grid; gap: 2px; }
.position-sound-row em { color: var(--muted); font-size: 11px; font-style: normal; }
.position-sound-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pos-file-btn { position: relative; display: inline-flex; align-items: center; }

@media (max-width: 900px) {
  .positions-head { flex-direction: column; align-items: flex-start; }
  .position-row { grid-template-columns: 1fr; gap: 8px; }
  .position-actions { justify-content: flex-start; }
  .position-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .position-form .wide, .position-form-hint { grid-column: span 2; }
}

/* 预警指标模板工具栏 */
.template-toolbar-band { padding: 0; }
.template-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; padding: 12px 14px; border: 1px solid var(--line, #d8e6e1);
  border-radius: 10px; background: linear-gradient(135deg, #eef7f4, #f7fbf9);
}
.template-toolbar > div { display: flex; flex-direction: column; gap: 3px; }
.template-toolbar strong { color: var(--accent-strong, #1f7a63); font-size: 14px; }
.template-toolbar span { color: var(--muted, #6b7d78); font-size: 12px; }
.template-toolbar .ghost-btn { white-space: nowrap; }
@media (max-width: 640px) {
  .template-toolbar { flex-direction: column; align-items: stretch; }
  .template-toolbar .ghost-btn { width: 100%; }
}
