:root {
  color-scheme: light;
  --canvas: oklch(97% 0.008 45);
  --surface: oklch(99% 0.004 45);
  --surface-2: oklch(94.5% 0.01 45);
  --ink: oklch(22% 0.018 255);
  --muted: oklch(52% 0.016 255);
  --faint: oklch(67% 0.012 255);
  --line: oklch(89% 0.012 45);
  --line-strong: oklch(81% 0.014 45);
  --accent: oklch(62% 0.2 24);
  --accent-hover: oklch(57% 0.2 24);
  --accent-soft: oklch(94% 0.035 24);
  --success: oklch(55% 0.13 150);
  --success-soft: oklch(95% 0.035 150);
  --warning: oklch(66% 0.13 75);
  --warning-soft: oklch(95% 0.04 75);
  --danger: oklch(54% 0.18 25);
  --danger-soft: oklch(95% 0.04 25);
  --shadow: 0 18px 55px oklch(28% 0.025 255 / 0.16);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--canvas);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font-size: 14px;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

body.consumer-app {
  touch-action: pan-x pan-y;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid oklch(62% 0.2 24 / 0.22);
  outline-offset: 2px;
}

h1,
h2,
h3,
p,
dl,
dd {
  margin: 0;
}

.auth-screen {
  width: min(420px, calc(100vw - 40px));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 0 max(40px, env(safe-area-inset-bottom));
}

.auth-mark,
.brand-mark {
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--surface);
  font-weight: 850;
}

.auth-mark {
  width: 52px;
  height: 52px;
  margin-bottom: 28px;
  border-radius: 8px;
  font-size: 22px;
}

.auth-copy h1 {
  font-size: 24px;
  line-height: 1.2;
}

.auth-copy p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.6;
}

.auth-form {
  display: grid;
  gap: 10px;
  margin-top: 34px;
}

.code-form {
  margin-top: 26px;
}

.auth-error {
  margin-top: 8px;
}

.turnstile-slot {
  min-height: 65px;
  overflow: hidden;
}

.code-sent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.code-sent-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.code-sent-row .text-button {
  flex: 0 0 auto;
}

.code-email-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 12px;
}

.auth-foot {
  margin-top: 28px;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.6;
}

.legal-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 3px 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}

.legal-consent input {
  flex: 0 0 auto;
  width: 17px;
  min-height: 17px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.legal-consent span {
  display: inline;
}

.legal-consent a {
  color: var(--accent-hover);
  font-weight: 700;
}

.third-party-notice {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 12px 13px;
}

.third-party-notice strong {
  font-size: 12px;
}

.third-party-notice p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

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

label small {
  color: var(--faint);
  font-size: 12px;
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  outline: none;
  transition: border-color 160ms ease-out, box-shadow 160ms ease-out;
}

textarea {
  min-height: 110px;
  padding: 12px;
  line-height: 1.55;
  resize: vertical;
}

@media (max-width: 767px) {
  /* iOS 会自动放大字号小于 16px 的文本控件。 */
  .consumer-app input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  .consumer-app select,
  .consumer-app textarea {
    font-size: 16px;
  }
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px oklch(62% 0.2 24 / 0.1);
}

input::placeholder,
textarea::placeholder {
  color: var(--faint);
}

.button,
.icon-button,
.text-button {
  border: 0;
  cursor: pointer;
}

.button {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 14px;
  font-weight: 700;
  transition: transform 140ms ease-out, border-color 140ms ease-out, background-color 140ms ease-out;
}

.button:hover {
  border-color: var(--muted);
}

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

.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: oklch(98% 0.006 45);
}

.button.primary:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.button.accent-light {
  border-color: var(--accent-soft);
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.button.subtle {
  border-color: transparent;
  background: var(--surface-2);
}

.button.full {
  width: 100%;
  min-height: 46px;
}

.button.loading {
  color: transparent;
  position: relative;
}

.button.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 16px;
  height: 16px;
  margin: auto;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
  color: var(--ink);
}

.button.primary.loading::after {
  color: oklch(98% 0.006 45);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 8px;
  font-size: 13px;
  font-weight: 700;
}

.icon-button:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.text-button {
  min-height: 32px;
  background: transparent;
  color: var(--accent-hover);
  padding: 0;
  font-weight: 700;
}

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

.form-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
}

.user-shell {
  width: min(720px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--surface);
}

.account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(18px, env(safe-area-inset-top)) 20px 18px;
  border-bottom: 1px solid var(--line);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 7px;
  font-size: 17px;
}

.brand-lockup div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.brand-lockup strong {
  font-size: 17px;
}

.brand-lockup span:not(.brand-mark) {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions,
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.service-strip {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.8fr;
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.service-strip > div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 15px 18px;
  background: var(--surface);
}

.service-strip span {
  color: var(--muted);
  font-size: 11px;
}

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

.state-inline {
  display: flex;
  align-items: center;
  gap: 6px;
}

.state-inline i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
}

.state-inline.running i {
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-soft);
}

.renewal-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 14px 16px 0;
  padding: 13px 14px;
  border: 1px solid oklch(88% 0.06 75);
  border-radius: 7px;
  background: var(--warning-soft);
}

.compliance-strip {
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.renewal-banner > div {
  display: grid;
  gap: 3px;
}

.renewal-banner strong {
  font-size: 13px;
}

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

.product-section {
  padding: 22px 20px 0;
}

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

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

.section-toolbar h2 {
  font-size: 16px;
}

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

.product-list {
  display: grid;
}

.product-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
}

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

.product-title-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.product-title-line h3 {
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.product-title-line > strong {
  color: var(--ink);
  font-size: 15px;
  white-space: nowrap;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 7px;
  color: var(--faint);
  font-size: 11px;
}

.product-status-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 9px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 0 8px;
  font-size: 11px;
  font-weight: 750;
}

.status-badge.success {
  background: var(--success-soft);
  color: var(--success);
}

.status-badge.warning {
  background: var(--warning-soft);
  color: oklch(53% 0.12 75);
}

.status-badge.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.product-error {
  max-width: 100%;
  color: var(--danger);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.product-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.delete-button {
  color: var(--faint);
  font-size: 11px;
}

.switch {
  display: inline-block;
  position: relative;
  font-size: 0;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch span {
  display: block;
  width: 40px;
  height: 23px;
  border-radius: 999px;
  background: oklch(83% 0.012 255);
  cursor: pointer;
  transition: background-color 160ms ease-out;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 2px 7px oklch(25% 0.02 255 / 0.22);
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.switch input:checked + span {
  background: var(--accent);
}

.switch input:checked + span::after {
  transform: translateX(17px);
}

.switch input:focus-visible + span {
  outline: 3px solid oklch(62% 0.2 24 / 0.2);
  outline-offset: 2px;
}

.empty-state {
  display: grid;
  justify-items: center;
  padding: 54px 24px;
  text-align: center;
}

.empty-symbol {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 15px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--accent);
  font-size: 23px;
}

.empty-state strong {
  font-size: 15px;
}

.empty-state p {
  max-width: 280px;
  margin: 7px 0 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.bottom-spacer {
  height: 102px;
}

.monitor-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  width: min(720px, 100%);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 16px;
  align-items: center;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 -12px 36px oklch(28% 0.025 255 / 0.08);
}

.monitor-summary {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.monitor-summary span {
  font-size: 13px;
  font-weight: 750;
}

.monitor-summary small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.monitor-button {
  min-height: 46px;
}

.monitor-button.stop {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--danger);
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: oklch(18% 0.02 255 / 0.36);
}

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 50;
  width: min(620px, 100%);
  max-height: min(82vh, 760px);
  overflow-y: auto;
  transform: translateX(-50%);
  border-radius: 8px 8px 0 0;
  background: var(--surface);
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow);
}

/* 产品少时抽屉按内容收缩，超出屏幕时只滚动目录列表。 */
#productSheet {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#productSheet > .sheet-head {
  flex: 0 0 auto;
}

#productSheet > .catalog-picker {
  flex: 0 1 auto;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

#productSheet .catalog-options {
  align-content: start;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#productSheet > .custom-product-section {
  flex: 0 0 auto;
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.sheet-head h2 {
  margin-top: 3px;
  font-size: 19px;
}

.sheet-kicker {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.close-sheet {
  font-size: 24px;
  font-weight: 400;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.notification-modes {
  display: grid;
  gap: 8px;
  margin: 18px 0 0;
  border: 0;
  padding: 0;
}

.notification-modes legend {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.mode-option {
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 9px 11px;
  cursor: pointer;
}

.mode-option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.mode-option input {
  width: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.mode-option span {
  display: grid;
  gap: 2px;
}

.mode-option strong {
  color: var(--ink);
  font-size: 13px;
}

.mode-option small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.alert-fields {
  margin-top: 16px;
}

#volumeField {
  grid-column: 1 / -1;
  grid-template-columns: 1fr auto;
  align-items: center;
}

#volumeField input {
  grid-column: 1;
  min-height: 28px;
  padding: 0;
}

#volumeField output {
  grid-column: 2;
  grid-row: 2;
  min-width: 30px;
  color: var(--ink);
  text-align: right;
}

.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}

.sheet-actions + .text-button {
  margin-top: 13px;
}

.catalog-picker,
.custom-product-section {
  display: grid;
  gap: 14px;
}

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

.catalog-picker-head strong {
  font-size: 14px;
}

.catalog-picker-head small {
  color: var(--muted);
  font-size: 11px;
}

.catalog-options {
  display: grid;
  border-top: 1px solid var(--line);
}

.catalog-option {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  border-bottom: 1px solid var(--line);
  padding: 9px 2px;
  cursor: pointer;
}

.catalog-option input {
  width: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.catalog-option span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.catalog-option strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-option small,
.catalog-option em,
.catalog-empty {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 500;
}

.catalog-empty {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.custom-product-section {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.preview-block {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

#productForm {
  display: grid;
  gap: 16px;
}

.preview-block > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.preview-block > strong {
  display: block;
  margin-top: 7px;
  font-size: 16px;
  line-height: 1.45;
}

.preview-block dl {
  margin: 14px 0 18px;
}

.preview-block dl > div {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.preview-block dt {
  color: var(--muted);
  font-size: 12px;
}

.preview-block dd {
  overflow-wrap: anywhere;
  font-size: 12px;
  text-align: right;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 80;
  max-width: min(420px, calc(100vw - 32px));
  transform: translateX(-50%);
  border-radius: 6px;
  background: var(--ink);
  color: var(--surface);
  padding: 11px 14px;
  box-shadow: var(--shadow);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

/* C 端强调状态和核心操作，使用轻量分隔减少移动端的卡片堆叠感。 */
.consumer-app {
  background: var(--canvas);
  box-shadow: inset 0 4px 0 var(--surface-2);
}

.consumer-app .auth-screen {
  width: min(392px, calc(100vw - 40px));
  justify-content: center;
  padding-top: max(28px, env(safe-area-inset-top));
  padding-bottom: max(28px, env(safe-area-inset-bottom));
}

.consumer-app .auth-copy {
  position: relative;
  padding-top: 18px;
}

.consumer-app .auth-copy::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 32px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}

.consumer-app .auth-copy h1 {
  font-size: 22px;
  line-height: 1.25;
}

.consumer-app .auth-copy p {
  margin-top: 7px;
  font-size: 13px;
  line-height: 1.55;
}

.consumer-app .auth-form {
  gap: 11px;
  margin-top: 26px;
}

.consumer-app .code-form {
  margin-top: 22px;
}

.consumer-app .auth-form > label:not(.legal-consent) {
  color: var(--ink);
  font-size: 12px;
}

.consumer-app .auth-form > input {
  min-height: 50px;
  border-color: var(--line);
  background: var(--surface);
  box-shadow: 0 1px 0 oklch(28% 0.02 255 / 0.03);
}

.consumer-app .auth-form .button.full {
  min-height: 48px;
}

.consumer-app .turnstile-slot {
  display: grid;
  min-height: 46px;
  align-items: center;
  overflow: visible;
}

.consumer-app .turnstile-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.consumer-app .turnstile-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.consumer-app .turnstile-slot.loaded .turnstile-loading,
.consumer-app .turnstile-slot.load-error .turnstile-loading {
  display: none;
}

.consumer-app .turnstile-slot.loaded {
  min-height: 65px;
}

.consumer-app .turnstile-slot.loaded.compact {
  min-height: 0;
}

.consumer-app .turnstile-slot.loaded.compact > div {
  height: 0;
  min-height: 0;
  overflow: hidden;
}

.consumer-app .code-sent-row {
  align-items: flex-start;
  padding: 10px 0 2px;
  border-top: 1px solid var(--line);
}

.consumer-app .legal-consent {
  margin-top: 1px;
}

.consumer-app .auth-error:empty {
  min-height: 0;
  margin-top: 0;
}

.consumer-app .third-party-notice {
  margin-top: 18px;
  border: 0;
  border-left: 2px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  padding: 1px 0 1px 12px;
}

.consumer-app .third-party-notice strong {
  color: var(--muted);
  font-size: 11px;
}

.consumer-app .third-party-notice p {
  margin-top: 3px;
  color: var(--faint);
  line-height: 1.55;
}

.consumer-app .auth-foot {
  margin-top: 12px;
  line-height: 1.5;
}

.consumer-app .user-shell {
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.consumer-app .account-bar {
  min-height: 68px;
  padding-top: max(14px, env(safe-area-inset-top));
  padding-bottom: 14px;
  background: var(--surface);
}

.consumer-app .brand-lockup strong {
  font-size: 16px;
}

.consumer-app .brand-lockup span:not(.brand-mark) {
  max-width: 420px;
}

.consumer-app .header-actions {
  gap: 2px;
}

.consumer-app .header-actions .button.subtle {
  background: transparent;
}

.consumer-app .service-strip {
  grid-template-columns: 1.3fr 1fr 0.7fr;
  gap: 0;
  border-bottom: 0;
  background: var(--surface-2);
  padding: 0 20px;
}

.consumer-app .service-strip > div {
  position: relative;
  gap: 6px;
  padding: 16px 14px;
  background: transparent;
}

.consumer-app .service-strip > div:first-child {
  padding-left: 0;
}

.consumer-app .service-strip > div:last-child {
  padding-right: 0;
}

.consumer-app .service-strip > div + div::before {
  content: "";
  position: absolute;
  top: 16px;
  bottom: 16px;
  left: 0;
  width: 1px;
  background: var(--line);
}

.consumer-app .service-strip span {
  color: var(--faint);
  font-size: 10px;
}

.consumer-app .service-strip strong {
  font-size: 13px;
}

.consumer-app .state-inline i {
  width: 6px;
  height: 6px;
}

.consumer-app .compliance-strip {
  padding-top: 9px;
  padding-bottom: 9px;
  border-bottom: 0;
  background: var(--surface);
  color: var(--faint);
  font-size: 10px;
}

.consumer-app .renewal-banner {
  margin-right: 20px;
  margin-left: 20px;
}

.consumer-app .product-section {
  padding-top: 18px;
}

.consumer-app .section-toolbar {
  padding-bottom: 13px;
}

.consumer-app .section-toolbar h2 {
  font-size: 15px;
}

.consumer-app .section-toolbar .accent-light {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.consumer-app .product-row {
  min-height: 112px;
  align-items: center;
  padding: 18px 0;
}

.consumer-app .product-title-line h3 {
  font-size: 14px;
}

.consumer-app .product-title-line > strong {
  color: var(--accent-hover);
  font-size: 14px;
}

.consumer-app .product-meta {
  margin-top: 6px;
}

.consumer-app .status-badge {
  min-height: 22px;
  border-radius: 5px;
  padding: 0 7px;
}

.consumer-app .product-controls {
  min-width: 92px;
  justify-content: flex-end;
}

.consumer-app .delete-button {
  min-width: 40px;
}

.consumer-app .empty-state {
  min-height: 320px;
  align-content: center;
  padding-top: 34px;
  padding-bottom: 44px;
}

.consumer-app .empty-symbol {
  width: 40px;
  height: 40px;
  margin-bottom: 13px;
  border-radius: 7px;
  background: var(--surface-2);
  font-size: 20px;
}

.consumer-app .monitor-bar {
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 14px;
  padding-top: 10px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 28px oklch(28% 0.025 255 / 0.07);
}

.consumer-app .monitor-summary span {
  font-size: 12px;
}

.consumer-app .monitor-button {
  min-height: 44px;
}

.consumer-app .sheet {
  padding-top: 18px;
}

.consumer-app .sheet-head {
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.consumer-app .sheet-head h2 {
  font-size: 18px;
}

.consumer-app .mode-option.selected {
  border-color: oklch(78% 0.09 24);
}

@media (max-width: 760px) {
  .consumer-app .user-shell {
    border-right: 0;
    border-left: 0;
  }

  .consumer-app .service-strip {
    padding-right: 16px;
    padding-left: 16px;
  }

  .consumer-app .product-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .consumer-app .product-controls {
    min-width: 42px;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
  }
}

@media (max-width: 480px) {
  .consumer-app .auth-screen {
    width: calc(100vw - 32px);
  }

  .consumer-app .code-sent-row {
    display: grid;
  }

  .consumer-app .code-email-actions {
    width: 100%;
    justify-content: space-between;
  }

  .consumer-app .account-bar {
    padding-right: 12px;
    padding-left: 16px;
  }

  .consumer-app .service-strip {
    grid-template-columns: 1.22fr 1fr 0.66fr;
  }

  .consumer-app .service-strip > div {
    padding-right: 9px;
    padding-left: 9px;
  }

  .consumer-app .service-strip strong {
    font-size: 11px;
  }

  .consumer-app .renewal-banner {
    margin-right: 16px;
    margin-left: 16px;
  }

  .consumer-app .product-title-line {
    grid-template-columns: minmax(0, 1fr) minmax(62px, auto);
  }

  .consumer-app .monitor-bar {
    grid-template-columns: minmax(0, 1fr) 120px;
    gap: 10px;
  }

  .consumer-app .monitor-summary small {
    max-width: none;
  }
}

/* 管理端采用桌面数据密度，窄屏时保持表格可横向查看。 */
.admin-body {
  background: oklch(96% 0.007 255);
  font-size: 13px;
}

.admin-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid oklch(87% 0.01 255);
  background: oklch(20% 0.018 255);
  color: oklch(94% 0.006 255);
  padding: 22px 16px;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 26px;
}

.admin-brand .brand-mark {
  background: var(--accent);
}

.admin-brand strong {
  font-size: 15px;
}

.admin-nav {
  display: grid;
  gap: 4px;
}

.admin-nav button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: oklch(73% 0.012 255);
  padding: 0 10px;
  text-align: left;
  cursor: pointer;
}

.admin-nav button.active,
.admin-nav button:hover {
  background: oklch(28% 0.02 255);
  color: oklch(96% 0.006 255);
}

.admin-logout {
  margin-top: auto;
  color: oklch(73% 0.012 255);
}

.admin-content {
  min-width: 0;
  padding: 28px 32px 48px;
}

.admin-head,
.admin-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.admin-head h1 {
  font-size: 21px;
}

.admin-head p {
  margin-top: 5px;
  color: var(--muted);
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  margin-top: 24px;
  border: 1px solid oklch(87% 0.01 255);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.metric-strip > div {
  display: grid;
  gap: 7px;
  padding: 17px;
  border-right: 1px solid oklch(87% 0.01 255);
}

.metric-strip > div:last-child {
  border-right: 0;
}

.metric-strip span {
  color: var(--muted);
  font-size: 11px;
}

.metric-strip strong {
  font-size: 20px;
}

.admin-section {
  margin-top: 26px;
}

.admin-section-head h2 {
  font-size: 16px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.filter-row input {
  width: 240px;
}

.filter-row select {
  width: 130px;
}

.table-wrap {
  margin-top: 12px;
  overflow-x: auto;
  border: 1px solid oklch(87% 0.01 255);
  border-radius: 8px;
  background: var(--surface);
}

.admin-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid oklch(90% 0.008 255);
  text-align: left;
  white-space: nowrap;
}

.admin-table th {
  background: oklch(97% 0.006 255);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

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

.admin-table tbody tr:hover {
  background: oklch(98% 0.006 24);
}

/* 日志级别同时使用文字和颜色，避免只靠颜色判断事件严重性。 */
.log-level {
  display: inline-flex;
  min-width: 42px;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background: oklch(94% 0.008 255);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.log-level.warning {
  background: oklch(93% 0.045 75);
  color: oklch(43% 0.09 70);
}

.log-level.error {
  background: oklch(94% 0.035 25);
  color: var(--danger);
}

.log-table {
  min-width: 980px;
}

.monitoring-table {
  min-width: 980px;
}

.catalog-table {
  min-width: 1020px;
}

.catalog-actions {
  display: flex;
  gap: 12px;
}

/* 最近查询使用主次两行，额度优先、时间弱化。 */
.catalog-query-cell {
  display: grid;
  gap: 3px;
}

.catalog-query-cell strong {
  color: var(--ink);
  font-size: 13px;
}

.catalog-query-cell small,
.catalog-query-empty {
  color: var(--muted);
  font-size: 11px;
}

.monitoring-detail-row td {
  padding: 0;
  background: oklch(97% 0.006 255);
}

.monitoring-user-list {
  display: grid;
}

.monitoring-user-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(150px, 1fr) minmax(170px, 1fr);
  gap: 16px;
  align-items: center;
  padding: 11px 14px 11px 34px;
  border-bottom: 1px solid oklch(90% 0.008 255);
}

.monitoring-user-row:last-child {
  border-bottom: 0;
}

.monitoring-user-row span {
  color: var(--muted);
  font-size: 12px;
}

.log-table .log-summary {
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 12px;
  color: var(--muted);
}

.pagination > div {
  display: flex;
  gap: 6px;
}

.pagination .icon-button {
  min-width: 36px;
  min-height: 36px;
  font-size: 20px;
}

.table-link {
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  font-weight: 750;
  cursor: pointer;
}

.admin-panel {
  max-width: 760px;
  margin-top: 18px;
  border: 1px solid oklch(87% 0.01 255);
  border-radius: 8px;
  background: var(--surface);
  padding: 20px;
}

.settings-block {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

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

.settings-block-head h2 {
  font-size: 16px;
}

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

.quick-days {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

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

.password-grid {
  margin-top: 16px;
}

.admin-form-grid .full-row {
  grid-column: 1 / -1;
}

.setting-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  cursor: pointer;
}

.setting-toggle input {
  flex: 0 0 auto;
  width: 18px;
  min-height: 18px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.setting-toggle span {
  display: grid;
  gap: 4px;
}

.setting-toggle strong {
  color: var(--ink);
}

.admin-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  width: min(520px, 100%);
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--surface);
  padding: 24px;
  box-shadow: var(--shadow);
}

.code-output {
  width: 100%;
  min-height: 180px;
  margin-top: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.detail-block {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.detail-block h3 {
  margin-bottom: 10px;
  font-size: 13px;
}

.detail-list {
  display: grid;
  gap: 9px;
}

.detail-list > div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
}

.detail-list dt {
  color: var(--muted);
}

.detail-list dd {
  min-width: 0;
  overflow-wrap: anywhere;
}

.notification-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.notification-row small {
  color: var(--muted);
}

.log-detail-list dd {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.log-detail-list code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

/* 协议页采用无干扰的长文档布局，便于手机阅读和核对条款。 */
.legal-body {
  background: var(--canvas);
}

.legal-shell {
  width: min(760px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 30px 0 calc(48px + env(safe-area-inset-bottom));
}

.legal-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

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

.legal-head p,
.legal-head span {
  color: var(--muted);
  font-size: 11px;
}

.legal-head h1 {
  font-size: 21px;
}

.legal-summary {
  margin: 22px 0;
  border: 1px solid oklch(86% 0.05 75);
  border-radius: 7px;
  background: var(--warning-soft);
  padding: 14px 16px;
}

.legal-summary strong {
  font-size: 13px;
}

.legal-summary p {
  margin-top: 5px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.7;
}

.legal-content {
  border-top: 1px solid var(--line);
}

.legal-content section {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.legal-content h2 {
  margin-bottom: 10px;
  font-size: 16px;
}

.legal-content p,
.legal-content li {
  color: oklch(36% 0.015 255);
  font-size: 13px;
  line-height: 1.8;
}

.legal-content p + p {
  margin-top: 9px;
}

.legal-content ul {
  margin: 10px 0;
  padding-left: 22px;
}

.privacy-no-list {
  padding: 12px 12px 12px 32px !important;
  border-radius: 6px;
  background: var(--success-soft);
}

.legal-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 22px;
}

.legal-footer .button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

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

@media (max-width: 760px) {
  .account-bar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .product-section {
    padding-left: 16px;
    padding-right: 16px;
  }

  .compliance-strip {
    padding-left: 16px;
    padding-right: 16px;
  }

  .service-strip > div {
    padding: 13px 12px;
  }

  .product-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
  }

  .product-controls {
    justify-content: space-between;
  }

  .monitor-bar {
    grid-template-columns: minmax(0, 1fr) 132px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .admin-shell {
    display: block;
  }

  .admin-sidebar {
    position: sticky;
    z-index: 30;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 10px 14px;
  }

  .admin-brand {
    padding: 0;
  }

  .admin-brand .brand-mark {
    width: 34px;
    height: 34px;
  }

  .admin-nav {
    display: flex;
    margin-left: auto;
    overflow-x: auto;
  }

  .admin-nav button {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 0 8px;
  }

  .admin-logout {
    margin: 0 0 0 4px;
  }

  .admin-content {
    padding: 22px 16px 40px;
  }

  .metric-strip {
    grid-template-columns: repeat(5, 130px);
    overflow-x: auto;
  }

  .filter-row {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-top: 12px;
  }

  .filter-row input {
    width: 100%;
    grid-column: 1 / -1;
  }

  .filter-row select {
    width: 100%;
  }

  .admin-section-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  /* 窄屏优先保留导航操作，品牌名称由图形标识承担。 */
  .admin-brand strong {
    display: none;
  }

  .admin-nav button {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .brand-lockup strong {
    font-size: 15px;
  }

  .header-actions .subtle {
    min-width: 40px;
    padding: 0 10px;
  }

  .service-strip {
    grid-template-columns: 1.15fr 1fr 0.75fr;
  }

  .service-strip > div {
    padding-left: 10px;
    padding-right: 8px;
  }

  .service-strip strong {
    font-size: 12px;
  }

  .renewal-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-toolbar {
    align-items: flex-start;
  }

  .toolbar-actions {
    flex-shrink: 0;
  }

  .product-title-line {
    grid-template-columns: minmax(0, 1fr) 74px;
  }

  .product-title-line > strong {
    overflow: hidden;
    text-align: right;
    text-overflow: ellipsis;
  }

  .field-grid,
  .sheet-actions,
  .admin-form-grid {
    grid-template-columns: 1fr;
  }

  #volumeField,
  .admin-form-grid .full-row {
    grid-column: auto;
  }

  .monitor-summary small {
    max-width: 180px;
  }

}

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