/* ===== Global Reset & Dark Theme ===== */
:root {
  --bg-primary: #0b0d17;
  --bg-card: #12152a;
  --bg-card-hover: #181c36;
  --bg-surface: #0e1122;
  --border: #1e2240;
  --border-glow: rgba(110,140,255,0.12);
  --text-primary: #e2e4f0;
  --text-secondary: #7c80a8;
  --text-muted: #4a4e6e;
  --accent-blue: #6e8cff;
  --accent-purple: #9b8cff;
  --accent-green: #4ae3a8;
  --accent-yellow: #ffd666;
  --accent-red: #ff6b6b;
  --accent-orange: #ffaa5c;
  --accent-cyan: #5ce0d8;
  --accent-pink: #ff79c6;
  /* Electric accent for key data */
  --electric-cyan: #00f5d4;
  --neon-lime: #b5ff2b;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4), 0 0 0 1px var(--border);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-display: 'Outfit', 'Noto Sans SC', system-ui, sans-serif;
  --font-body: 'Plus Jakarta Sans', 'Noto Sans SC', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
}

/* ===== Theme transition reveal ===== */
:root {
  --theme-transition-x: 50vw;
  --theme-transition-y: 50vh;
  --theme-transition-radius: 0px;
  --theme-soft-duration: 220ms;
  --theme-soft-ease: cubic-bezier(0.22, 0.8, 0.2, 1);
}

:root.theme-transition-view-active {
  view-transition-name: root;
}

:root.theme-transition-view-active.theme-transition-suppress-element-transitions *,
:root.theme-transition-view-active.theme-transition-suppress-element-transitions *::before,
:root.theme-transition-view-active.theme-transition-suppress-element-transitions *::after {
  transition-duration: 0s !important;
  transition-delay: 0s !important;
  animation-duration: 0s !important;
  animation-delay: 0s !important;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

:root.theme-transition-view-active::view-transition-group(root),
:root.theme-transition-view-active::view-transition-image-pair(root),
:root.theme-transition-view-active::view-transition-old(root) {
  animation: none;
}

:root.theme-transition-view-active::view-transition-old(root) {
  z-index: 1;
  opacity: 1;
}

:root.theme-transition-view-active::view-transition-new(root) {
  z-index: 2;
  opacity: 1;
  animation: theme-view-reveal 560ms cubic-bezier(0.76, 0.02, 0.24, 1) both;
  clip-path: circle(0px at var(--theme-transition-x) var(--theme-transition-y));
  will-change: clip-path;
  backface-visibility: hidden;
}

@keyframes theme-view-reveal {
  0% {
    clip-path: circle(0px at var(--theme-transition-x) var(--theme-transition-y));
  }
  28% {
    clip-path: circle(calc(var(--theme-transition-radius) * 0.14) at var(--theme-transition-x) var(--theme-transition-y));
  }
  100% {
    clip-path: circle(var(--theme-transition-radius) at var(--theme-transition-x) var(--theme-transition-y));
  }
}

@supports not (view-transition-name: root) {
  :root.theme-transition-view-active {
    view-transition-name: none;
  }
}

/* ===== Light Theme Override ===== */
[data-theme="light"] {
  --bg-primary: #f0f2f5;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f9fa;
  --bg-surface: #f5f5f5;
  --border: #d4d8e0;
  --border-glow: rgba(74,108,247,0.15);
  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --accent-blue: #4a6cf7;
  --accent-purple: #7c5cfc;
  --accent-green: #10b981;
  --accent-yellow: #f59e0b;
  --accent-red: #ef4444;
  --accent-orange: #f97316;
  --accent-cyan: #06b6d4;
  --accent-pink: #ec4899;
  --electric-cyan: #0891b2;
  --neon-lime: #65a30d;
  --shadow: 0 2px 8px rgba(0,0,0,0.06), 0 0 0 1px var(--border);
}

/* Body: light background + subtle gradients */
[data-theme="light"] body {
  background-color: var(--bg-primary);
  background-image:
    radial-gradient(ellipse 90% 60% at 10% 5%, rgba(74,108,247,0.04) 0%, transparent 55%),
    radial-gradient(ellipse 40% 30% at 92% 88%, rgba(6,182,212,0.03) 0%, transparent 50%);
}

[data-theme="light"] body::before {
  display: none;
}

/* Top bar: white glass */
[data-theme="light"] .top-bar {
  background: linear-gradient(135deg, rgba(255,255,255,0.78) 0%, rgba(248,249,250,0.72) 100%);
  border-bottom: 1px solid var(--border);
  border-image: linear-gradient(90deg, transparent 5%, var(--accent-blue), var(--accent-purple), var(--accent-cyan), transparent 95%) 1;
  backdrop-filter: blur(12px) saturate(1.3);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  box-shadow: 0 2px 16px rgba(0,0,0,0.08);
}
[data-theme="light"] .top-bar::before {
  background: linear-gradient(90deg, transparent, rgba(74,108,247,0.12), rgba(6,182,212,0.08), transparent);
}
[data-theme="light"] .top-bar-left h1 {
  color: #06b6d4;
  filter: drop-shadow(0 0 8px rgba(74,108,247,0.12));
}
[data-theme="light"] .clock {
  background: rgba(6,182,212,0.06);
  border-color: rgba(6,182,212,0.12);
  text-shadow: 0 0 8px rgba(6,182,212,0.2);
}
[data-theme="light"] .clock-date {
  color: var(--text-secondary);
}

/* 中部状态栏: 浅色主题 */
[data-theme="light"] .header-weather-notice .notice-tip,
[data-theme="light"] .header-weather-notice .notice-minutely,
[data-theme="light"] .header-weather-notice .notice-hourly {
  color: rgba(45, 55, 72, 0.88);
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
[data-theme="light"] .header-weather-notice .notice-minutely {
  background: rgba(92, 224, 216, 0.12);
  border-color: rgba(92, 224, 216, 0.22);
}
[data-theme="light"] .header-weather-notice .notice-hourly {
  background: rgba(110, 140, 255, 0.10);
  border-color: rgba(110, 140, 255, 0.20);
}
[data-theme="light"] .middle-status-bar {
  background: rgba(255,255,255,0.85);
  border-bottom: 1px solid var(--border);
}

/* Status dot: solid green, no glow */
[data-theme="light"] .status-dot {
  background: var(--accent-green);
  box-shadow: 0 0 0 2px rgba(16,185,129,0.2);
  animation: none;
}

/* Buttons: light style */
[data-theme="light"] .btn-icon {
  background: rgba(245,245,245,0.8);
  border-color: var(--border);
  color: var(--text-primary);
}
[data-theme="light"] .btn-icon:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-blue);
  box-shadow: 0 0 8px rgba(74,108,247,0.1);
}

.topbar-action-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 12px;
  flex: 0 0 36px;
  position: relative;
}

.auth-admin-top-btn {
  overflow: visible;
}

.topbar-action-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  pointer-events: none;
}

.topbar-action-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-admin-top-btn.has-pending {
  border-color: rgba(250, 204, 21, 0.34);
  background: rgba(250, 204, 21, 0.14);
  color: var(--accent-yellow);
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.12), 0 8px 24px rgba(250, 204, 21, 0.08);
}

.topbar-action-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  background: linear-gradient(135deg, #f97316 0%, #ef4444 100%);
  border: 2px solid var(--bg-primary);
}

[data-theme="light"] .auth-admin-top-btn.has-pending {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.28);
}

.card-front-manage-btn {
  font-size: 16px;
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  border-radius: 999px !important;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
  transform: translateY(-0.5px);
  aspect-ratio: 1 / 1;
  flex: 0 0 30px;
}

.card-front-manage-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.14);
}

.card-front-manage-btn:disabled {
  opacity: 0.5;
}

.card-front-manage-btn .topbar-action-icon,
.card-front-manage-btn > svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.card-front-manage-btn .topbar-action-icon svg,
.card-front-manage-btn > svg {
  display: block;
}

.card-front-manage-btn--compact {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  flex: 0 0 28px;
}

.card-front-manage-btn--compact .topbar-action-icon,
.card-front-manage-btn--compact > svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.panel-manage-btn {
  font-size: 16px;
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
  transform: translateY(-0.5px);
  aspect-ratio: 1 / 1;
  flex: 0 0 30px;
}

.panel-manage-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.14);
}

.panel-manage-btn:disabled {
  opacity: 0.5;
}

.panel-manage-btn .topbar-action-icon,
.panel-manage-btn > svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.panel-manage-btn .topbar-action-icon svg,
.panel-manage-btn > svg {
  display: block;
}
[data-theme="light"] .card-front-manage-btn {
  background: #ffffff;
  color: var(--text-secondary);
  border-color: rgba(212,216,224,0.9);
}

[data-theme="light"] .card-front-manage-btn:hover {
  background: #f5f7fb;
  color: var(--text-primary);
}

[data-theme="light"] .panel-manage-btn {
  background: #ffffff;
  color: var(--text-secondary);
  border-color: rgba(212,216,224,0.9);
}

[data-theme="light"] .panel-manage-btn:hover {
  background: #f5f7fb;
  color: var(--text-primary);
}

.auth-admin-hidden-shell {
  display: none !important;
}

.auth-admin-modal {
  position: fixed;
  inset: 0;
  z-index: 10030;
  isolation: isolate;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.auth-admin-modal.hidden {
  display: none;
}

.auth-admin-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.auth-admin-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 18, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 0;
}

.auth-admin-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(1040px, calc(100vw - 32px));
  max-width: 1040px;
  height: min(84vh, 860px);
  max-height: 84vh;
  margin: max(24px, 6vh) auto;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.45);
  border-radius: 22px;
  transform: translate3d(0, 10px, 0) scale(0.985);
  opacity: 0.98;
  transition: transform 180ms cubic-bezier(0.22, 0.8, 0.2, 1), opacity 180ms ease;
  contain: layout paint style;
  will-change: transform, opacity;
}

.auth-admin-modal.is-open .auth-admin-modal-dialog {
  transform: translate3d(0, 0, 0) scale(1);
  opacity: 1;
}

.auth-admin-modal-content {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body.auth-admin-modal-open {
  overflow: hidden;
  overscroll-behavior: none;
}

body.auth-admin-modal-open .auth-admin-underlay-frozen {
  pointer-events: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  touch-action: none !important;
}

.xiaomi-hotsearch-config-modal {
  position: fixed;
  inset: 0;
  z-index: 10020;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 160ms ease, visibility 160ms ease;
}

.xiaomi-hotsearch-config-modal.hidden {
  display: none;
}

.xiaomi-hotsearch-config-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.xiaomi-hotsearch-config-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 18, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.xiaomi-hotsearch-config-dialog {
  position: relative;
  width: min(920px, 90vw);
  height: min(84vh, 760px);
  margin: max(24px, 6vh) auto;
  overflow: hidden;
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  transform: translate3d(0, 10px, 0) scale(0.986);
  transition: transform 160ms cubic-bezier(0.22, 0.8, 0.2, 1);
}

.xiaomi-hotsearch-config-modal.is-open .xiaomi-hotsearch-config-dialog {
  transform: translate3d(0, 0, 0) scale(1);
}

.xiaomi-hotsearch-config-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.xiaomi-hotsearch-config-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.xiaomi-hotsearch-config-header h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.xiaomi-hotsearch-config-subtitle {
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-secondary);
}

.xiaomi-hotsearch-config-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px 20px 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.38) transparent;
}

.xiaomi-hotsearch-config-body::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.xiaomi-hotsearch-config-body::-webkit-scrollbar-track {
  background: transparent;
}

.xiaomi-hotsearch-config-body::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.36);
  border-radius: 999px;
}

.xiaomi-hotsearch-config-body::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.52);
}

.xiaomi-hotsearch-config-body::-webkit-scrollbar-corner {
  background: transparent;
}

.xiaomi-hotsearch-config-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.xiaomi-hotsearch-config-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.xiaomi-hotsearch-config-field-wide {
  margin-top: 7px;
}

.xiaomi-hotsearch-config-textarea {
  min-height: 42px;
  resize: vertical;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.xiaomi-hotsearch-config-status {
  min-height: 18px;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.xiaomi-hotsearch-config-status.is-success {
  color: #22c55e;
}

.xiaomi-hotsearch-config-status.is-error {
  color: #f87171;
}

.xiaomi-hotsearch-config-status.is-info {
  color: #60a5fa;
}

.xiaomi-hotsearch-config-base-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 30px;
  margin-bottom: 8px;
  padding: 6px 9px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.08);
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.xiaomi-hotsearch-config-base-status-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xiaomi-hotsearch-config-base-status-note {
  flex: 0 0 auto;
  font-size: 11px;
  color: inherit;
  opacity: 0.78;
  white-space: nowrap;
}

.xiaomi-hotsearch-config-base-status.is-primary {
  border-color: rgba(34, 197, 94, 0.24);
  background: rgba(34, 197, 94, 0.1);
  color: #15803d;
}

.xiaomi-hotsearch-config-base-status.is-backup {
  border-color: rgba(251, 146, 60, 0.28);
  background: rgba(251, 146, 60, 0.13);
  color: #c2410c;
}

.xiaomi-hotsearch-config-base-status.is-empty {
  color: #64748b;
}

.xiaomi-hotsearch-config-toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(-18px) scale(0.98);
  width: fit-content;
  min-width: 0;
  max-width: min(420px, calc(100vw - 24px));
  padding: 10px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(245, 245, 247, 0.72);
  color: #1f2937;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255,255,255,0.32);
  backdrop-filter: blur(18px) saturate(1.16);
  -webkit-backdrop-filter: blur(18px) saturate(1.16);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
  opacity: 0;
  transition: opacity 220ms ease, transform 220ms ease;
  z-index: 9999;
  pointer-events: none;
}

.xiaomi-hotsearch-config-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.xiaomi-hotsearch-config-toast.is-success,
.xiaomi-hotsearch-config-toast.is-error,
.xiaomi-hotsearch-config-toast.is-info {
  color: inherit;
  border-color: rgba(255, 255, 255, 0.18);
}

.xiaomi-hotsearch-config-actions {
  position: sticky;
  bottom: -20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 18px -20px -20px;
  padding: 12px 20px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(15, 23, 42, 0.94);
}

.xiaomi-hotsearch-config-error {
  color: #f87171;
  font-size: 13px;
}

body.xiaomi-hotsearch-config-open {
  overflow: hidden;
  overscroll-behavior: none;
}

.xiaomi-hotsearch-config-modal {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.xiaomi-hotsearch-config-backdrop {
  background: rgba(245, 247, 251, 0.42);
  backdrop-filter: blur(6px) saturate(1.04);
  -webkit-backdrop-filter: blur(6px) saturate(1.04);
}

.xiaomi-hotsearch-config-dialog {
  width: min(920px, 90vw);
  height: auto;
  max-height: min(90vh, 820px);
  margin: 0;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 249, 252, 0.98) 100%);
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
}

.xiaomi-hotsearch-config-dialog.card {
  width: min(920px, 90vw) !important;
  height: auto;
}

.xiaomi-hotsearch-config-panel {
  max-height: min(90vh, 820px);
}

.xiaomi-hotsearch-config-header {
  padding: 11px 16px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(244, 247, 251, 0.92) 100%);
}

.xiaomi-hotsearch-config-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: #1e293b;
}

.xiaomi-hotsearch-config-header [data-hotsearch-config-close] {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  border-radius: 11px;
}

.xiaomi-hotsearch-config-header [data-hotsearch-config-close] svg {
  width: 21px;
  height: 21px;
}

.xiaomi-hotsearch-config-body {
  padding: 8px 12px 0;
}

.xiaomi-hotsearch-config-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr)) minmax(260px, 1.25fr);
  gap: 8px;
}

.xiaomi-hotsearch-global-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 7px;
  min-width: 0;
}

.xiaomi-hotsearch-config-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.xiaomi-hotsearch-field-with-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 6px;
  align-items: stretch;
}

.xiaomi-hotsearch-field-with-action > .stock-manager-input {
  min-width: 0;
}

.xiaomi-hotsearch-url-test {
  height: 32px;
  align-self: end;
  border: 1px solid rgba(59, 130, 246, 0.24);
  border-radius: 9px;
  background: rgba(59, 130, 246, 0.08);
  color: #2563eb;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.xiaomi-hotsearch-url-test:disabled {
  opacity: 0.58;
  cursor: wait;
}

.xiaomi-hotsearch-config-access {
  margin: 0 0 8px;
  padding: 7px 10px;
  border: 1px solid rgba(59, 130, 246, 0.18);
  border-radius: 10px;
  background: rgba(239, 246, 255, 0.76);
  color: #2563eb;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.xiaomi-hotsearch-config-access.is-admin {
  border-color: rgba(34, 197, 94, 0.2);
  background: rgba(240, 253, 244, 0.78);
  color: #15803d;
}

.xiaomi-hotsearch-config-access.is-readonly {
  border-color: rgba(148, 163, 184, 0.24);
  background: rgba(248, 250, 252, 0.82);
  color: #64748b;
}

.xiaomi-hotsearch-config-textarea.is-compact {
  min-height: 44px;
}

.xiaomi-hotsearch-keyword-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.xiaomi-hotsearch-keyword-editor {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.64);
}

.xiaomi-hotsearch-keyword-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.xiaomi-hotsearch-keyword-editor-head small {
  flex: 0 0 auto;
  color: var(--text-tertiary, var(--text-secondary));
  font-size: 11px;
  font-weight: 800;
}

.xiaomi-hotsearch-keyword-head-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.xiaomi-hotsearch-keyword-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-left: 3px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
  font-size: 10px;
  line-height: 1;
  vertical-align: 1px;
}

.xiaomi-hotsearch-keyword-items {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-height: 29px;
  max-height: 68px;
  overflow: hidden;
}

.xiaomi-hotsearch-keyword-editor[data-expanded="1"] .xiaomi-hotsearch-keyword-items {
  max-height: 118px;
  overflow: auto;
  padding-right: 2px;
}

.xiaomi-hotsearch-keyword-chip {
  display: inline-flex;
  align-items: center;
  max-width: 132px;
  min-height: 25px;
  padding: 0 7px;
  border: 1px solid rgba(59, 130, 246, 0.16);
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.08);
  color: #1e40af;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.xiaomi-hotsearch-keyword-chip > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xiaomi-hotsearch-keyword-chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 3px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.14);
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.14s ease, transform 0.14s ease, background 0.14s ease;
}

.xiaomi-hotsearch-keyword-chip:hover button,
.xiaomi-hotsearch-keyword-chip:focus-within button {
  opacity: 1;
  transform: scale(1);
}

.xiaomi-hotsearch-keyword-chip button:hover {
  background: rgba(239, 68, 68, 0.14);
  color: #dc2626;
}

.xiaomi-hotsearch-keyword-add,
.xiaomi-hotsearch-keyword-more,
.xiaomi-hotsearch-keyword-toggle,
.xiaomi-hotsearch-keyword-inline-add button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 25px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.88);
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.xiaomi-hotsearch-keyword-add {
  width: 25px;
  border-color: rgba(16, 185, 129, 0.28);
  background: rgba(16, 185, 129, 0.1);
  color: #047857;
  font-size: 17px;
}

.xiaomi-hotsearch-keyword-more {
  padding: 0 9px;
  color: #64748b;
}

.xiaomi-hotsearch-keyword-toggle {
  width: 20px;
  padding: 0;
  font-size: 15px;
  line-height: 1;
}

.xiaomi-hotsearch-keyword-inline-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: min(100%, 254px);
  min-height: 25px;
}

.xiaomi-hotsearch-keyword-inline-add input {
  width: 112px;
  height: 25px;
  min-width: 84px;
  padding: 0 8px;
  border: 1px solid rgba(16, 185, 129, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  font-size: 12px;
  font-weight: 700;
  outline: none;
}

.xiaomi-hotsearch-keyword-inline-add input:focus {
  border-color: rgba(16, 185, 129, 0.58);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.xiaomi-hotsearch-keyword-inline-add button {
  padding: 0 8px;
  border-color: rgba(16, 185, 129, 0.22);
  background: rgba(16, 185, 129, 0.09);
  color: #047857;
}

.xiaomi-hotsearch-keyword-inline-add button:last-child {
  width: 25px;
  padding: 0;
  border-color: rgba(239, 68, 68, 0.16);
  background: rgba(239, 68, 68, 0.06);
  color: #ef4444;
}

.xiaomi-hotsearch-source-section {
  margin-top: 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
  overflow: hidden;
}

.xiaomi-hotsearch-source-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  font-size: 12px;
  font-weight: 800;
  color: var(--text-secondary);
}

.xiaomi-hotsearch-source-tools {
  display: flex;
  align-items: center;
  gap: 7px;
}

.xiaomi-hotsearch-source-add {
  height: 26px;
  padding: 0 10px;
  border: 1px solid rgba(59, 130, 246, 0.24);
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.08);
  color: #2563eb;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.xiaomi-hotsearch-source-head-row {
  display: grid;
  grid-template-columns: 44px minmax(72px, 0.55fr) minmax(116px, 1fr) 56px 56px 50px 64px minmax(150px, 1.05fr) 54px 32px 62px;
  gap: 5px;
  align-items: center;
  padding: 6px 8px 4px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  color: var(--text-tertiary, var(--text-secondary));
  font-size: 10px;
  font-weight: 800;
}

.xiaomi-hotsearch-source-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 184px;
  overflow: auto;
  padding: 6px 8px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.38) transparent;
}

.xiaomi-hotsearch-source-list::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.xiaomi-hotsearch-source-list::-webkit-scrollbar-track {
  background: transparent;
}

.xiaomi-hotsearch-source-list::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.36);
  border-radius: 999px;
}

.xiaomi-hotsearch-source-list::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.52);
}

.xiaomi-hotsearch-source-list::-webkit-scrollbar-corner {
  background: transparent;
}

.xiaomi-hotsearch-source-row {
  display: grid;
  grid-template-columns: 44px minmax(72px, 0.55fr) minmax(116px, 1fr) 56px 56px 50px 64px minmax(150px, 1.05fr) 54px 32px 62px;
  gap: 5px;
  align-items: center;
}

.xiaomi-hotsearch-source-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 30px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.82);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 800;
}

.xiaomi-hotsearch-source-toggle input {
  width: 13px;
  height: 13px;
  accent-color: #10b981;
}

.xiaomi-hotsearch-source-toggle.is-off {
  color: #94a3b8;
}

.xiaomi-hotsearch-source-toggle.is-off input {
  accent-color: #94a3b8;
}

.xiaomi-hotsearch-source-inherit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 30px;
  border: 1px solid rgba(100, 116, 139, 0.22);
  border-radius: 8px;
  background: rgba(100, 116, 139, 0.08);
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.xiaomi-hotsearch-source-inherit input {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: #64748b;
}

.xiaomi-hotsearch-source-inherit:has(input:not(:checked)) {
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(248, 250, 252, 0.72);
  color: #94a3b8;
}

.xiaomi-hotsearch-source-row .stock-manager-input {
  height: 30px;
  min-height: 30px;
  padding: 0 7px;
  border-radius: 8px;
  font-size: 11px;
}

.xiaomi-hotsearch-source-row .xiaomi-hotsearch-source-time {
  padding: 0 5px;
}

.xiaomi-hotsearch-source-row .xiaomi-hotsearch-source-interval,
.xiaomi-hotsearch-source-row .xiaomi-hotsearch-source-phone-label {
  padding: 0 6px;
}

.xiaomi-hotsearch-source-extra-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.xiaomi-hotsearch-source-extra-group.has-scope-select {
  grid-template-columns: minmax(0, 1fr) 72px;
}

.xiaomi-hotsearch-source-extra-scope-select {
  min-width: 0;
  padding: 0 18px 0 6px !important;
  border-radius: 8px !important;
  background-color: rgba(248, 250, 252, 0.84) !important;
  color: var(--text-primary);
  font-size: 10px !important;
  font-weight: 800;
  cursor: pointer;
}

.xiaomi-hotsearch-source-row .xiaomi-hotsearch-source-interval,
#xiaomi-hotsearch-interval {
  text-align: center;
  padding-right: 6px;
  -webkit-appearance: none;
  -moz-appearance: textfield;
  appearance: textfield;
}

.xiaomi-hotsearch-source-row .xiaomi-hotsearch-source-interval::-webkit-outer-spin-button,
.xiaomi-hotsearch-source-row .xiaomi-hotsearch-source-interval::-webkit-inner-spin-button,
#xiaomi-hotsearch-interval::-webkit-outer-spin-button,
#xiaomi-hotsearch-interval::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
}

.xiaomi-hotsearch-source-row .xiaomi-hotsearch-source-phone-color {
  padding: 3px;
}

.xiaomi-hotsearch-source-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.xiaomi-hotsearch-source-remove,
.xiaomi-hotsearch-source-test {
  width: 28px;
  height: 30px;
  flex: 0 0 28px;
  padding: 0;
}

.xiaomi-hotsearch-source-test {
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.07);
  color: #2563eb;
}

.xiaomi-hotsearch-source-remove {
  border: 1px solid rgba(239, 68, 68, 0.16);
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.06);
  color: #ef4444;
}

.xiaomi-hotsearch-source-test:disabled,
.xiaomi-hotsearch-source-remove:disabled {
  opacity: 0.56;
  cursor: wait;
}

.xiaomi-hotsearch-config-actions {
  position: sticky;
  bottom: 0;
  margin: 8px -12px 0;
  padding: 8px 12px;
  background: rgba(248, 250, 252, 0.94);
}

.xiaomi-hotsearch-config-btn {
  min-width: 92px;
  height: 38px;
  padding: 0 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.xiaomi-hotsearch-config-btn:hover {
  transform: translateY(-1px);
}

.xiaomi-hotsearch-config-btn.is-cancel {
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(255, 255, 255, 0.92);
  color: #334155;
}

.xiaomi-hotsearch-config-actions-spacer {
  flex: 1 1 auto;
}

.strip-config-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin-left: 2px;
  border: 1px solid rgba(99, 102, 241, 0.26);
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.11);
  color: #a5b4fc;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.middle-status-bar:hover .strip-config-btn,
#info-strip:hover .strip-config-btn {
  opacity: 1;
  pointer-events: auto;
}

.strip-config-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(99, 102, 241, 0.45);
  background: rgba(99, 102, 241, 0.18);
  color: #c7d2fe;
}

.info-strip-config-modal {
  position: fixed;
  inset: 0;
  z-index: 10018;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 160ms ease, visibility 160ms ease;
}

.info-strip-config-modal.hidden {
  display: none;
}

.info-strip-config-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.info-strip-config-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(245, 247, 251, 0.42);
  backdrop-filter: blur(6px) saturate(1.04);
  -webkit-backdrop-filter: blur(6px) saturate(1.04);
}

.info-strip-config-dialog {
  position: relative;
  width: min(920px, 90vw);
  max-height: min(90vh, 820px);
  margin: 0;
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 249, 252, 0.98) 100%);
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
  transform: translate3d(0, 10px, 0) scale(0.986);
  transition: transform 160ms cubic-bezier(0.22, 0.8, 0.2, 1);
}

.info-strip-config-dialog.card {
  width: min(920px, 90vw) !important;
}

.info-strip-config-modal.is-open .info-strip-config-dialog {
  transform: translate3d(0, 0, 0) scale(1);
}

.info-strip-config-panel {
  display: flex;
  flex-direction: column;
  max-height: min(90vh, 820px);
  min-height: 0;
}

.info-strip-config-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 16px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(244, 247, 251, 0.92) 100%);
}

.info-strip-config-header h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
  font-weight: 800;
  color: #1e293b;
}

.info-strip-config-subtitle {
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-secondary);
}

.info-strip-config-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 10px 12px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.38) transparent;
}

.info-strip-config-body::-webkit-scrollbar,
.info-strip-pickup-list::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.info-strip-config-body::-webkit-scrollbar-track,
.info-strip-pickup-list::-webkit-scrollbar-track {
  background: transparent;
}

.info-strip-config-body::-webkit-scrollbar-thumb,
.info-strip-pickup-list::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.36);
  border-radius: 999px;
}

.info-strip-config-status {
  min-height: 18px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.info-strip-config-status.is-success {
  color: #16a34a;
}

.info-strip-config-status.is-error {
  color: #dc2626;
}

.info-strip-config-status.is-info {
  color: #2563eb;
}

#info-strip-save-btn.is-saving {
  cursor: wait;
  opacity: 0.86;
}

#info-strip-save-btn.is-saved {
  border-color: rgba(22, 163, 74, 0.28);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.95), rgba(21, 128, 61, 0.95));
  color: #fff;
}

.info-strip-config-section {
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.74);
}

.info-strip-config-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: #1e293b;
  font-size: 13px;
  font-weight: 800;
}

.info-strip-config-section-head small {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.info-strip-source-head-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.info-strip-config-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.info-strip-config-grid.is-pickup {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.info-strip-config-workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
}

.info-strip-config-order-stack {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.info-strip-config-column {
  min-width: 0;
}

.info-strip-config-column.is-order,
.info-strip-config-column.is-phone,
.info-strip-config-column.is-sources {
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.42);
}

.info-strip-config-column.is-order {
  background: rgba(255, 255, 255, 0.5);
}

.info-strip-config-column.is-phone {
  background: rgba(255, 255, 255, 0.5);
}

.info-strip-config-column.is-sources {
  grid-column: auto;
}

.info-strip-config-order {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.info-strip-config-order-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-width: 0;
  padding: 5px;
  border: 1px solid rgba(59, 130, 246, 0.14);
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.78);
}

.info-strip-config-order .info-strip-config-order-row,
.info-strip-config-order-row.is-phone-group {
  grid-template-columns: 18px minmax(0, 1fr) auto;
  flex: 0 0 auto;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
}

.info-strip-config-order .info-strip-order-index,
.info-strip-config-order-row.is-phone-group .info-strip-order-index {
  width: 18px;
  height: 18px;
  font-size: 9px;
}

.info-strip-config-order .info-strip-config-check,
.info-strip-config-order-row.is-phone-group .info-strip-config-check {
  min-height: 24px;
  padding: 4px 6px;
  gap: 5px;
  justify-content: flex-start;
}

.info-strip-config-order .info-strip-order-actions,
.info-strip-config-order-row.is-phone-group .info-strip-order-actions {
  gap: 2px;
}

.info-strip-config-order .info-strip-order-btn,
.info-strip-config-order-row.is-phone-group .info-strip-order-btn {
  width: 21px;
  height: 21px;
  min-width: 21px;
  min-height: 21px;
  border-radius: 8px;
}

.info-strip-order-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
  font-size: 10px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.info-strip-order-actions {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 3px;
}

.btn-icon.info-strip-order-btn,
.info-strip-order-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  border-radius: 9px;
  border: 1px solid rgba(59, 130, 246, 0.18);
  background: rgba(239, 246, 255, 0.76);
  color: #2563eb;
  line-height: 1;
  overflow: visible;
  appearance: none;
}

.info-strip-order-btn svg {
  display: block;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin: auto;
  color: currentColor;
  stroke: currentColor;
  opacity: 1;
  visibility: visible;
  pointer-events: none;
}

.info-strip-order-btn svg path {
  stroke: currentColor;
}

[data-theme="light"] .info-strip-order-btn,
html[data-theme="light"] .info-strip-order-btn {
  color: #2563eb;
}

[data-theme="light"] .info-strip-order-btn svg,
html[data-theme="light"] .info-strip-order-btn svg,
[data-theme="dark"] .info-strip-order-btn svg,
html[data-theme="dark"] .info-strip-order-btn svg,
[data-theme="light"] .info-strip-order-btn svg path,
html[data-theme="light"] .info-strip-order-btn svg path,
[data-theme="dark"] .info-strip-order-btn svg path,
html[data-theme="dark"] .info-strip-order-btn svg path {
  color: currentColor;
  stroke: currentColor;
  opacity: 1;
  visibility: visible;
}

.info-strip-order-btn:disabled {
  opacity: 0.38;
  cursor: default;
  transform: none;
}

.info-strip-config-subsection {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.info-strip-config-subsection.is-phone {
  margin-top: 10px;
}

.info-strip-config-subsection.is-sources {
  margin-top: 10px;
  padding-top: 10px;
}

.info-strip-config-preview {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid rgba(20, 184, 166, 0.18);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(240, 253, 250, 0.7) 0%, rgba(240, 249, 255, 0.58) 100%);
}

.info-strip-config-preview-mock {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 9px;
}

.info-strip-config-preview-surface {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.info-strip-config-preview-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #0f766e;
  font-size: 10.5px;
  font-weight: 850;
}

.info-strip-config-preview-label .info-strip-source-sim-toggle {
  min-height: 20px;
  padding: 1px 6px;
}

.middle-status-bar.info-strip-config-preview-strip {
  min-height: 40px;
  padding: 7px 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  animation: none;
}

.middle-status-bar.info-strip-config-preview-strip.is-web-preview {
  cursor: grab;
  scroll-behavior: auto;
  touch-action: pan-y;
}

.middle-status-bar.info-strip-config-preview-strip.is-web-wrap-preview {
  flex-wrap: wrap;
  align-content: flex-start;
  overflow: visible;
  cursor: default;
}

.middle-status-bar.info-strip-config-preview-strip.is-web-preview.is-preview-dragging {
  cursor: grabbing;
  user-select: none;
}

.middle-status-bar.info-strip-config-preview-strip.is-phone-preview {
  width: min(420px, 100%);
  max-width: 100%;
  position: relative;
}

.middle-status-bar.info-strip-config-preview-strip .interactive-chip {
  cursor: default;
}

.middle-status-bar.info-strip-config-preview-strip.is-inline-preview {
  min-height: 34px;
  padding: 5px 6px;
  overflow: visible;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(18,21,42,0.72) 0%, rgba(25,30,55,0.72) 100%);
}

.middle-status-bar.info-strip-config-preview-strip.is-inline-preview .strip-chip {
  max-width: 100%;
  padding: 4px 10px;
  font-size: 12px;
}

.middle-status-bar.info-strip-config-preview-strip .strip-chip.is-preview-over-limit {
  opacity: 0.46;
}

.middle-status-bar.info-strip-config-preview-strip.is-phone-preview .interactive-chip {
  order: var(--phone-expanded-order, 0);
}

.middle-status-bar.info-strip-config-preview-strip.is-phone-preview.strip-collapsed .interactive-chip {
  order: var(--phone-collapsed-order, var(--phone-expanded-order, 0));
}

.middle-status-bar.info-strip-config-preview-strip.is-phone-preview.strip-collapsed .strip-chip.is-preview-over-limit {
  display: none;
}

.middle-status-bar.info-strip-config-preview-strip.is-phone-preview.strip-collapsed .interactive-chip.is-phone-default-collapsed {
  display: none;
}

.middle-status-bar.info-strip-config-preview-strip.strip-collapsed {
  max-height: 40px;
}

.middle-status-bar.info-strip-config-preview-strip.is-phone-preview:not(.strip-collapsed) {
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  height: auto;
  max-height: none;
  padding-right: 58px;
  overflow-x: visible;
  overflow-y: visible;
}

.middle-status-bar.info-strip-config-preview-strip.is-phone-preview:not(.strip-collapsed)::after {
  display: none;
}

.info-strip-config-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: #0f766e;
  font-size: 12px;
  font-weight: 850;
}

.info-strip-config-preview-head small {
  color: #64748b;
  font-size: 10.5px;
  font-weight: 760;
}

.info-strip-config-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.info-strip-config-preview-grid.is-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.info-strip-config-preview-card {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(20, 184, 166, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.64);
}

.info-strip-config-preview-card strong {
  display: block;
  margin-bottom: 6px;
  color: #0f766e;
  font-size: 11px;
  font-weight: 850;
}

.info-strip-config-preview-card small {
  display: block;
  margin-top: 6px;
  color: #64748b;
  font-size: 10px;
  font-weight: 720;
  line-height: 1.4;
}

.info-strip-config-preview-pill,
.info-strip-config-preview-empty {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 22px;
  margin: 0 4px 4px 0;
  padding: 3px 7px;
  border-radius: 8px;
  line-height: 1.25;
  font-size: 10.5px;
  font-weight: 780;
  vertical-align: top;
}

.info-strip-config-preview-pill {
  border: 1px solid rgba(20, 184, 166, 0.18);
  background: rgba(204, 251, 241, 0.56);
  color: #0f766e;
}

.info-strip-config-preview-pill.is-wide {
  display: flex;
  width: fit-content;
}

.info-strip-config-preview-empty {
  color: #94a3b8;
  background: rgba(241, 245, 249, 0.76);
}

.info-strip-config-section-head.is-small {
  min-height: 24px;
  margin-bottom: 8px;
  font-size: 12px;
}

.info-strip-config-section-head.is-phone-head {
  align-items: center;
}

.xiaomi-hotsearch-config-field.is-phone-limit .stock-manager-input {
  width: 100%;
  min-width: 0;
}

.info-strip-config-inline-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.info-strip-config-inline-checks .info-strip-config-order-row {
  flex: 1 1 100%;
}

.info-strip-source-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.info-strip-source-group {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.58);
}

.info-strip-source-group[open] {
  background: rgba(255, 255, 255, 0.66);
}

.info-strip-source-group.is-muted {
  opacity: 0.62;
}

.info-strip-source-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: -2px -2px 7px;
  padding: 4px 5px;
  border-radius: 9px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.info-strip-source-group-title::-webkit-details-marker {
  display: none;
}

.info-strip-source-group-title::before {
  content: '';
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  opacity: 0.55;
  transition: transform 0.16s ease;
}

.info-strip-source-group[open] > .info-strip-source-group-title::before {
  transform: rotate(45deg);
}

.info-strip-source-group-title span {
  flex: 1 1 auto;
  min-width: 0;
}

.info-strip-source-group-title small {
  color: #94a3b8;
  font-size: 10px;
  font-weight: 700;
}

.info-strip-source-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 7px;
}

.info-strip-source-group[data-info-strip-source-group="other"] .info-strip-source-items {
  grid-template-columns: 1fr;
}

.info-strip-source-group[data-info-strip-source-group="alert"] .info-strip-source-items {
  grid-template-columns: 1fr;
}

.info-strip-source-card {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(220px, 1.4fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(14, 165, 233, 0.16);
  border-radius: 10px;
  background: rgba(240, 249, 255, 0.66);
}

.info-strip-source-card.is-hidden-source {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(248, 250, 252, 0.72);
}

.info-strip-source-card.is-loading-catalog {
  cursor: progress;
  opacity: 0.82;
}

.info-strip-source-card.is-loading-catalog .info-strip-source-card-title::after {
  content: " · 读取设备目录";
  color: #0f766e;
  font-size: 10px;
  font-weight: 760;
}

.info-strip-source-card.is-hidden-source .info-strip-source-card-title,
.info-strip-source-card.is-hidden-source .info-strip-source-toggle {
  color: #64748b;
}

.info-strip-source-card-settings {
  grid-column: 1 / -1;
  min-width: 0;
  padding-top: 7px;
  border-top: 1px solid rgba(14, 165, 233, 0.14);
}

.info-strip-source-inline-preview {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.info-strip-source-inline-preview > span {
  color: #0f766e;
  font-size: 10.5px;
  font-weight: 850;
}

.info-strip-source-inline-preview.is-disabled {
  opacity: 0.5;
}

.info-strip-source-sim-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 2px 6px;
  border: 1px solid rgba(20, 184, 166, 0.18);
  border-radius: 999px;
  background: rgba(240, 253, 250, 0.58);
  color: #0f766e;
  font-size: 10px;
  font-weight: 820;
  white-space: nowrap;
}

.info-strip-source-sim-toggle input {
  width: 11px;
  height: 11px;
  margin: 0;
  accent-color: #0f766e;
}

.info-strip-source-inline-preview.is-simulated .info-strip-source-sim-toggle {
  border-color: rgba(37, 99, 235, 0.26);
  background: rgba(219, 234, 254, 0.68);
  color: #1d4ed8;
}

.info-strip-source-card-settings > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 26px;
  padding: 3px 6px;
  border-radius: 8px;
  color: #0f766e;
  cursor: pointer;
  list-style: none;
}

.info-strip-source-card-settings > summary::-webkit-details-marker {
  display: none;
}

.info-strip-source-card-settings > summary::before {
  content: '';
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  opacity: 0.55;
  transition: transform 0.16s ease;
}

.info-strip-source-card-settings[open] > summary::before {
  transform: rotate(45deg);
}

.info-strip-source-card-settings > summary span {
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 850;
}

.info-strip-source-card-settings > summary small {
  flex: 1 1 auto;
  min-width: 0;
  color: #64748b;
  font-size: 10px;
  font-weight: 720;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-strip-source-card-settings-body {
  display: flex;
  flex-flow: row wrap;
  align-items: flex-start;
  gap: 7px;
  padding-top: 7px;
}

.info-strip-source-card-settings-body > .info-strip-source-setting,
.info-strip-source-card-settings-body > .info-strip-source-inline-settings,
.info-strip-source-card-settings-body > .info-strip-source-number-grid {
  flex: 1 1 260px;
}

.info-strip-source-card-settings-body > .info-strip-source-option,
.info-strip-source-card-settings-body > .info-strip-source-empty {
  flex: 0 0 auto;
}

.info-strip-source-inline-settings {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.info-strip-source-inline-settings .info-strip-source-setting {
  min-width: 0;
}

.info-strip-source-inline-settings.is-presence .info-strip-source-setting {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  gap: 6px;
  flex: 1 1 300px;
}

.info-strip-source-inline-settings.is-presence .info-strip-source-setting-head,
.info-strip-source-inline-settings.is-presence .info-strip-source-setting-options {
  min-width: 0;
}

.info-strip-source-inline-settings.is-presence .info-strip-source-setting-head {
  display: inline-flex;
  flex: 0 1 auto;
  margin: 0;
  gap: 6px;
}

.info-strip-source-inline-settings.is-presence .info-strip-source-setting-options {
  flex: 1 1 180px;
}

.info-strip-source-inline-settings.is-compact-options .info-strip-source-option,
.info-strip-source-inline-settings.is-presence > .info-strip-source-option {
  flex: 0 0 auto;
}

.info-strip-source-card-main {
  min-width: 0;
}

.info-strip-source-card-title {
  display: block;
  color: #0369a1;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
}

.info-strip-source-card-main small {
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
}

.info-strip-source-toggle {
  display: grid;
  grid-template-columns: auto 96px;
  align-items: center;
  gap: 6px;
  color: #0369a1;
  font-size: 11px;
  font-weight: 800;
}

.info-strip-source-toggle .stock-manager-input {
  min-height: 28px;
  padding: 4px 7px;
  font-size: 11px;
}

.info-strip-source-setting {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.info-strip-source-setting-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.info-strip-source-setting-title {
  color: #0f766e;
  font-size: 10px;
  font-weight: 850;
}

.info-strip-source-setting-tools {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.info-strip-source-search {
  width: 86px;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid rgba(20, 184, 166, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: #0f766e;
  font-size: 10.5px;
  outline: none;
}

.info-strip-source-search:focus {
  border-color: rgba(20, 184, 166, 0.42);
  box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.08);
}

.info-strip-source-tool {
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid rgba(20, 184, 166, 0.2);
  border-radius: 8px;
  background: rgba(240, 253, 250, 0.72);
  color: #0f766e;
  font-size: 10.5px;
  font-weight: 820;
  cursor: pointer;
}

.info-strip-source-tool:hover {
  border-color: rgba(20, 184, 166, 0.38);
  background: rgba(204, 251, 241, 0.72);
}

.info-strip-source-setting-options {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.info-strip-source-setting.is-entity-picker {
  flex-basis: 100%;
}

.info-strip-source-entity-dropdown {
  min-width: 0;
}

.info-strip-source-entity-dropdown > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
  padding: 5px 8px;
  border: 1px solid rgba(20, 184, 166, 0.18);
  border-radius: 8px;
  background: rgba(240, 253, 250, 0.62);
  color: #0f766e;
  cursor: pointer;
  list-style: none;
}

.info-strip-source-entity-dropdown > summary::-webkit-details-marker {
  display: none;
}

.info-strip-source-entity-dropdown > summary span {
  font-size: 10.5px;
  font-weight: 850;
}

.info-strip-source-entity-dropdown > summary small {
  color: #64748b;
  font-size: 10px;
  font-weight: 760;
}

.info-strip-entity-dropdown-arrow {
  flex: 0 0 auto;
  color: currentColor;
  stroke: currentColor;
  opacity: 0.7;
  transition: transform 0.2s ease;
  margin-left: auto;
}

.info-strip-source-entity-dropdown[open] > summary .info-strip-entity-dropdown-arrow {
  transform: rotate(180deg);
}

.info-strip-source-setting-tools.is-dropdown-tools {
  justify-content: flex-start;
  margin-top: 6px;
}

.info-strip-source-setting-options.is-grouped {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px;
  margin-top: 6px;
}

.info-strip-source-option-group {
  min-width: 0;
  padding: 6px;
  border: 1px solid rgba(20, 184, 166, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
}

.info-strip-source-option-group-title {
  margin-bottom: 5px;
  color: #0369a1;
  font-size: 10px;
  font-weight: 850;
}

.info-strip-source-option-group-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.info-strip-source-option.is-entity-option {
  max-width: 100%;
  min-width: 0;
}

.info-strip-source-option.is-entity-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-strip-source-option.is-entity-option small {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 9.5px;
  font-weight: 760;
}

.info-strip-source-entity-aliases {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  margin-top: 6px;
}

.info-strip-source-entity-alias-row {
  display: grid;
  grid-template-columns: 20px minmax(104px, 0.9fr) auto minmax(150px, 1.1fr) auto;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.info-strip-source-entity-alias-row.has-condition {
  grid-template-columns: 20px minmax(68px, 0.52fr) auto minmax(62px, 0.38fr) auto minmax(58px, 0.32fr) auto auto minmax(74px, 0.48fr) auto;
  gap: 4px;
}

.info-strip-entity-order-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.12);
  color: #0f766e;
  font-size: 9px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.info-strip-entity-order-actions {
  display: inline-flex;
  justify-content: flex-end;
  gap: 2px;
}

.info-strip-entity-order-actions .info-strip-order-btn {
  width: 21px;
  height: 21px;
  min-width: 21px;
  min-height: 21px;
  padding: 0;
  border-radius: 8px;
}

.info-strip-source-condition-label {
  justify-self: end;
  color: #0f766e;
  font-size: 9.5px;
  font-weight: 820;
  white-space: nowrap;
}

.info-strip-source-condition-mode {
  display: inline-grid;
  grid-template-columns: auto minmax(150px, 220px);
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 7px;
  border: 1px solid rgba(20, 184, 166, 0.16);
  border-radius: 8px;
  background: rgba(240, 253, 250, 0.58);
  color: #0f766e;
  font-size: 10.5px;
  font-weight: 820;
}

.info-strip-source-condition-mode .stock-manager-input {
  min-height: 26px;
  padding: 3px 7px;
  font-size: 10.5px;
}

.info-strip-source-condition-negate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 24px;
  padding: 2px 5px;
  border: 1px solid rgba(20, 184, 166, 0.18);
  border-radius: 8px;
  background: rgba(240, 253, 250, 0.62);
  color: #0f766e;
  font-size: 9.5px;
  font-weight: 820;
  white-space: nowrap;
}

.info-strip-source-condition-negate input {
  width: 12px;
  height: 12px;
  margin: 0;
  accent-color: #0f766e;
}

.info-strip-source-state-map {
  min-width: 0;
}

.info-strip-source-entity-alias-row > span {
  min-width: 0;
  overflow: hidden;
  color: #64748b;
  font-size: 10px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-strip-source-entity-alias-row > .info-strip-entity-order-index {
  color: #0f766e;
}

.info-strip-source-entity-alias-row .stock-manager-input {
  min-height: 26px;
  padding: 4px 7px;
  font-size: 10.5px;
}

.info-strip-source-entity-alias-row.has-condition .stock-manager-input {
  min-width: 0;
  min-height: 24px;
  padding: 3px 6px;
  font-size: 10px;
}

.info-strip-custom-device-details {
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px dashed rgba(15, 118, 110, 0.16);
}

.info-strip-custom-chip-config {
  display: grid;
  gap: 8px;
  flex: 1 1 100%;
  min-width: 0;
}

.info-strip-custom-chip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #0f766e;
  font-size: 11px;
  font-weight: 820;
}

.info-strip-custom-chip-list {
  display: grid;
  gap: 6px;
}

.info-strip-custom-chip-add-top {
  display: flex;
  justify-content: flex-end;
  padding: 2px 0;
}

.info-strip-custom-chip-add-top .info-strip-source-tool {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 6px;
  background: rgba(15, 118, 110, 0.08);
  color: #0f766e;
  border: 1px dashed rgba(15, 118, 110, 0.3);
  cursor: pointer;
  transition: background 0.15s;
}

.info-strip-custom-chip-add-top .info-strip-source-tool:hover {
  background: rgba(15, 118, 110, 0.16);
}

.info-strip-custom-chip-empty {
  padding: 8px 10px;
  border: 1px dashed rgba(15, 118, 110, 0.28);
  border-radius: 8px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.5;
  background: rgba(240, 253, 250, 0.68);
}

.info-strip-custom-chip-row {
  display: grid;
  gap: 6px;
  padding: 6px;
  border: 1px solid rgba(20, 184, 166, 0.16);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.72);
}

.info-strip-custom-chip-summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  cursor: pointer;
  list-style: none;
}

.info-strip-custom-chip-summary::-webkit-details-marker {
  display: none;
}

.info-strip-custom-chip-summary::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  color: #0f766e;
  flex-shrink: 0;
  transition: transform 0.16s ease;
}

.info-strip-custom-chip-row[open] > .info-strip-custom-chip-summary::before {
  transform: rotate(45deg);
}

.info-strip-custom-chip-summary > .info-strip-entity-order-index {
  flex-shrink: 0;
}

.info-strip-custom-chip-summary-text {
  display: grid;
  gap: 1px;
  flex: 0 0 160px;
  min-width: 0;
}

.info-strip-custom-chip-summary-text strong,
.info-strip-custom-chip-summary-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-strip-custom-chip-summary-text strong {
  color: #0f766e;
  font-size: 11px;
  font-weight: 850;
  flex-shrink: 0;
}

.info-strip-custom-chip-summary-text small {
  color: #64748b;
  font-size: 10px;
  font-weight: 720;
  flex-shrink: 1;
  min-width: 0;
}

.info-strip-custom-chip-summary-actions {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  margin-left: auto;
}

.info-strip-custom-chip-summary-actions .info-strip-order-btn,
.info-strip-custom-chip-summary-actions .info-strip-custom-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  padding: 0;
  line-height: 1;
  overflow: visible;
  appearance: none;
}

.info-strip-custom-chip-summary-actions .info-strip-custom-chip-remove:hover,
html[data-theme="light"] .info-strip-custom-chip-summary-actions .info-strip-custom-chip-remove:hover {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  padding: 0;
  box-shadow: none;
}

.info-strip-custom-chip-summary-actions .info-strip-custom-chip-remove svg {
  display: block;
  color: currentColor;
  stroke: currentColor;
  opacity: 1;
  visibility: visible;
  pointer-events: none;
}

.info-strip-custom-chip-summary-actions .info-strip-order-btn svg,
.info-strip-custom-chip-summary-actions .info-strip-custom-chip-remove svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin: auto;
}

.info-strip-custom-chip-summary-preview {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1 1 auto;
}

.info-strip-custom-chip-summary-preview .info-strip-source-inline-preview {
  width: 100%;
}

.info-strip-custom-chip-content {
  display: grid;
  gap: 6px;
}

.info-strip-custom-chip-main {
  display: grid;
  grid-template-columns: minmax(70px, 0.42fr) minmax(36px, 0.18fr) minmax(58px, 0.24fr) minmax(62px, 0.24fr) minmax(92px, 0.36fr) minmax(150px, 1fr) auto auto;
  align-items: center;
  gap: 4px;
}

[data-info-strip-custom-alert-row] .info-strip-custom-chip-main {
  grid-template-columns: minmax(70px, 0.42fr) minmax(36px, 0.18fr) minmax(58px, 0.24fr) minmax(62px, 0.24fr);
}

.info-strip-custom-chip-row .stock-manager-input {
  min-width: 0;
  min-height: 24px;
  padding: 3px 6px;
  font-size: 10px;
}

.info-strip-custom-chip-device-note {
  color: #64748b;
  font-size: 10.5px;
  line-height: 1.35;
}

.info-strip-custom-chip-entities {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 6px;
  border: 1px dashed rgba(15, 118, 110, 0.2);
  border-radius: 8px;
  background: rgba(240, 253, 250, 0.48);
}

.info-strip-custom-chip-entities.is-empty {
  color: #64748b;
  font-size: 11px;
}

.info-strip-custom-chip-entities > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  color: #0f766e;
  font-size: 11px;
  font-weight: 820;
}

.info-strip-custom-chip-entities > summary small {
  color: #64748b;
  font-weight: 720;
}

.info-strip-custom-chip-entity-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.info-strip-source-option {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 4px 7px;
  border: 1px solid rgba(20, 184, 166, 0.18);
  border-radius: 8px;
  background: rgba(240, 253, 250, 0.62);
  color: #0f766e;
  font-size: 10.5px;
  font-weight: 780;
}

.info-strip-source-option.is-inline {
  width: fit-content;
}

.info-strip-source-option input {
  width: 12px;
  height: 12px;
  margin: 0;
  accent-color: #0f766e;
}

.info-strip-source-empty {
  color: #94a3b8;
  font-size: 10.5px;
  font-weight: 700;
}

.info-strip-source-number-grid {
  display: flex;
  flex-flow: row wrap;
  gap: 6px;
}

.info-strip-source-number {
  display: inline-grid;
  grid-template-columns: auto 62px;
  align-items: center;
  gap: 4px;
  flex: 1 1 130px;
  min-width: 126px;
  color: #0f766e;
  font-size: 10px;
  font-weight: 820;
}

.info-strip-source-number .stock-manager-input {
  min-height: 28px;
  padding: 4px 7px;
  font-size: 11px;
}

.info-strip-config-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 5px 8px;
  border: 1px solid rgba(59, 130, 246, 0.18);
  border-radius: 10px;
  background: rgba(239, 246, 255, 0.76);
  color: #2563eb;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.info-strip-config-check.is-compact {
  justify-content: center;
  padding: 5px 7px;
}

.info-strip-config-check.is-source {
  min-height: 28px;
  padding: 5px 8px;
  border-color: rgba(14, 165, 233, 0.16);
  background: rgba(240, 249, 255, 0.72);
  color: #0369a1;
  font-size: 11px;
}

.info-strip-config-check input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #2563eb;
}

.info-strip-pickup-head,
.info-strip-pickup-row {
  display: grid;
  grid-template-columns: 62px minmax(76px, 1fr) minmax(100px, 1.2fr) minmax(100px, 1fr) minmax(100px, 1.1fr) minmax(88px, 1fr) 76px 40px;
  gap: 7px;
  align-items: center;
  min-width: 820px;
}

.info-strip-pickup-field-visibility {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 6px 0 4px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.04);
  border: 1px solid rgba(99, 102, 241, 0.1);
  font-size: 11px;
}

.info-strip-pickup-embedded {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.info-strip-pickup-embedded-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(248, 250, 252, 0.78);
}

.info-strip-pickup-embedded-head strong {
  display: block;
  color: #0f172a;
  font-size: 12px;
  line-height: 1.2;
}

.info-strip-pickup-embedded-head small {
  display: block;
  margin-top: 2px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.35;
}

.info-strip-source-card-settings-body .info-strip-config-grid.is-pickup {
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 8px;
}

.info-strip-source-card-settings-body .info-strip-pickup-list {
  max-width: 100%;
}

.info-strip-source-card-settings-body .info-strip-pickup-head,
.info-strip-source-card-settings-body .info-strip-pickup-row {
  min-width: 760px;
}

[data-theme="dark"] .info-strip-pickup-embedded-head {
  border-color: rgba(71, 85, 105, 0.42);
  background: rgba(15, 23, 42, 0.72);
}

[data-theme="dark"] .info-strip-pickup-embedded-head strong {
  color: #e2e8f0;
}

[data-theme="dark"] .info-strip-pickup-embedded-head small {
  color: #94a3b8;
}
.info-strip-pickup-fv-label {
  color: #64748b;
  font-weight: 600;
  font-size: 11px;
  margin-right: 2px;
}
[data-theme="dark"] .info-strip-pickup-field-visibility {
  background: rgba(99, 102, 241, 0.06);
  border-color: rgba(99, 102, 241, 0.15);
}

.info-strip-pickup-head {
  margin: 2px 0 6px;
  padding: 0 2px;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.info-strip-pickup-list {
  display: grid;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.info-strip-pickup-row {
  padding: 7px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.info-strip-pickup-remove {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(239, 68, 68, 0.16);
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.06);
  color: #ef4444;
}

body.info-strip-config-open {
  overflow: hidden;
  overscroll-behavior: none;
}

.xiaomi-hotsearch-config-btn.is-secondary {
  min-width: 72px;
  height: 32px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(99, 102, 241, 0.24);
  background: rgba(99, 102, 241, 0.06);
  color: #4f46e5;
}

.xiaomi-hotsearch-config-btn.is-secondary:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.36);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

[data-theme="dark"] .xiaomi-hotsearch-config-btn.is-secondary {
  border-color: rgba(129, 140, 248, 0.28);
  background: rgba(129, 140, 248, 0.08);
  color: #a5b4fc;
}

[data-theme="dark"] .xiaomi-hotsearch-config-btn.is-secondary:hover {
  background: rgba(129, 140, 248, 0.16);
}

.xiaomi-hotsearch-config-btn.is-danger {
  border: 1px solid rgba(239, 68, 68, 0.28);
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
}

.xiaomi-hotsearch-config-btn.is-danger:hover {
  background: rgba(239, 68, 68, 0.12);
  box-shadow: 0 8px 18px rgba(239, 68, 68, 0.14);
}

.xiaomi-hotsearch-config-btn.is-save {
  border: 1px solid #10b981;
  background: linear-gradient(180deg, #34d399 0%, #10b981 100%);
  color: #fff;
  box-shadow: 0 8px 18px rgba(16, 185, 129, 0.22);
}

.xiaomi-hotsearch-config-btn:disabled {
  opacity: 0.56;
  cursor: wait;
  transform: none;
}

[data-theme="dark"] .xiaomi-hotsearch-config-backdrop {
  background: rgba(2, 6, 23, 0.58);
  backdrop-filter: blur(10px) saturate(1.08);
  -webkit-backdrop-filter: blur(10px) saturate(1.08);
}

[data-theme="dark"] .xiaomi-hotsearch-config-dialog {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.985) 0%, rgba(10, 15, 28, 0.985) 100%);
  border-color: rgba(71, 85, 105, 0.52);
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .xiaomi-hotsearch-config-header {
  border-bottom-color: rgba(71, 85, 105, 0.42);
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.96) 0%, rgba(15, 23, 42, 0.94) 100%);
}

[data-theme="dark"] .xiaomi-hotsearch-config-header h3 {
  color: #e2e8f0;
}

[data-theme="dark"] .xiaomi-hotsearch-config-toast {
  background: rgba(28, 28, 30, 0.72);
  color: rgba(255,255,255,0.94);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255,255,255,0.08);
}

[data-theme="dark"] .xiaomi-hotsearch-config-toast.is-success {
  color: #86efac;
}

[data-theme="dark"] .xiaomi-hotsearch-config-toast.is-error {
  color: #fca5a5;
}

[data-theme="dark"] .xiaomi-hotsearch-config-toast.is-info {
  color: #93c5fd;
}

[data-theme="dark"] .xiaomi-hotsearch-config-base-status {
  border-color: rgba(71, 85, 105, 0.5);
  background: rgba(30, 41, 59, 0.68);
  color: #cbd5e1;
}

[data-theme="dark"] .xiaomi-hotsearch-config-base-status.is-primary {
  border-color: rgba(34, 197, 94, 0.26);
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
}

[data-theme="dark"] .xiaomi-hotsearch-config-base-status.is-backup {
  border-color: rgba(251, 146, 60, 0.3);
  background: rgba(251, 146, 60, 0.14);
  color: #fdba74;
}

[data-theme="dark"] .xiaomi-hotsearch-source-section {
  border-color: rgba(71, 85, 105, 0.42);
  background: rgba(15, 23, 42, 0.62);
}

[data-theme="dark"] .xiaomi-hotsearch-source-section-head {
  border-bottom-color: rgba(71, 85, 105, 0.34);
}

[data-theme="dark"] .xiaomi-hotsearch-source-toggle,
[data-theme="dark"] .xiaomi-hotsearch-config-btn.is-cancel,
[data-theme="dark"] .xiaomi-hotsearch-url-test,
[data-theme="dark"] .xiaomi-hotsearch-source-test {
  border-color: rgba(71, 85, 105, 0.56);
  background: rgba(30, 41, 59, 0.96);
  color: #cbd5e1;
}

[data-theme="dark"] .xiaomi-hotsearch-config-access {
  border-color: rgba(96, 165, 250, 0.28);
  background: rgba(30, 41, 59, 0.82);
  color: #93c5fd;
}

[data-theme="dark"] .xiaomi-hotsearch-config-access.is-admin {
  border-color: rgba(74, 222, 128, 0.24);
  background: rgba(20, 83, 45, 0.22);
  color: #86efac;
}

[data-theme="dark"] .xiaomi-hotsearch-config-access.is-readonly {
  border-color: rgba(71, 85, 105, 0.52);
  background: rgba(15, 23, 42, 0.72);
  color: #94a3b8;
}

[data-theme="dark"] .xiaomi-hotsearch-source-inherit:has(input:not(:checked)) {
  border-color: rgba(71, 85, 105, 0.48);
  background: rgba(15, 23, 42, 0.74);
  color: #94a3b8;
}

[data-theme="dark"] .xiaomi-hotsearch-source-extra-scope-select {
  color-scheme: dark;
  border-color: rgba(71, 85, 105, 0.58) !important;
  background-color: rgba(15, 23, 42, 0.94) !important;
  color: #e2e8f0 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .xiaomi-hotsearch-source-extra-scope-select:hover,
[data-theme="dark"] .xiaomi-hotsearch-source-extra-scope-select:focus {
  border-color: rgba(96, 165, 250, 0.58) !important;
  background-color: rgba(17, 24, 39, 0.98) !important;
}

[data-theme="dark"] .xiaomi-hotsearch-source-extra-scope-select option {
  background: #0f172a;
  color: #e2e8f0;
}

[data-theme="dark"] .xiaomi-hotsearch-keyword-editor {
  border-color: rgba(71, 85, 105, 0.42);
  background: rgba(15, 23, 42, 0.62);
}

[data-theme="dark"] .xiaomi-hotsearch-keyword-editor-head {
  color: #e2e8f0;
}

[data-theme="dark"] .xiaomi-hotsearch-keyword-chip {
  border-color: rgba(96, 165, 250, 0.22);
  background: rgba(37, 99, 235, 0.18);
  color: #bfdbfe;
}

[data-theme="dark"] .xiaomi-hotsearch-keyword-chip button {
  background: rgba(96, 165, 250, 0.18);
  color: #bfdbfe;
}

[data-theme="dark"] .xiaomi-hotsearch-keyword-add,
[data-theme="dark"] .xiaomi-hotsearch-keyword-more,
[data-theme="dark"] .xiaomi-hotsearch-keyword-toggle,
[data-theme="dark"] .xiaomi-hotsearch-keyword-inline-add button {
  border-color: rgba(71, 85, 105, 0.58);
  background: rgba(30, 41, 59, 0.78);
  color: #cbd5e1;
}

[data-theme="dark"] .xiaomi-hotsearch-keyword-inline-add input {
  border-color: rgba(52, 211, 153, 0.34);
  background: rgba(15, 23, 42, 0.86);
  color: #e2e8f0;
}

[data-theme="dark"] .xiaomi-hotsearch-config-actions {
  border-top-color: rgba(71, 85, 105, 0.42);
  background: rgba(15, 23, 42, 0.94);
}

[data-theme="dark"] .strip-config-btn {
  border-color: rgba(129, 140, 248, 0.28);
  background: rgba(67, 56, 202, 0.22);
  color: #c4b5fd;
}

[data-theme="dark"] .strip-config-btn:hover {
  border-color: rgba(129, 140, 248, 0.48);
  background: rgba(67, 56, 202, 0.32);
  color: #ddd6fe;
}

[data-theme="dark"] .info-strip-config-backdrop {
  background: rgba(2, 6, 23, 0.58);
  backdrop-filter: blur(10px) saturate(1.08);
  -webkit-backdrop-filter: blur(10px) saturate(1.08);
}

[data-theme="dark"] .info-strip-config-dialog {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.985) 0%, rgba(10, 15, 28, 0.985) 100%);
  border-color: rgba(71, 85, 105, 0.52);
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .info-strip-config-header {
  border-bottom-color: rgba(71, 85, 105, 0.42);
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.96) 0%, rgba(15, 23, 42, 0.94) 100%);
}

[data-theme="dark"] .info-strip-config-header h3,
[data-theme="dark"] .info-strip-config-section-head {
  color: #e2e8f0;
}

[data-theme="dark"] .info-strip-config-status.is-success {
  color: #86efac;
}

[data-theme="dark"] .info-strip-config-status.is-error {
  color: #fca5a5;
}

[data-theme="dark"] .info-strip-config-status.is-info {
  color: #93c5fd;
}

[data-theme="dark"] .info-strip-config-section {
  border-color: rgba(71, 85, 105, 0.42);
  background: rgba(15, 23, 42, 0.62);
}

[data-theme="dark"] .info-strip-config-subsection {
  border-top-color: rgba(71, 85, 105, 0.34);
}

[data-theme="dark"] .info-strip-config-preview {
  border-color: rgba(45, 212, 191, 0.24);
  background: linear-gradient(180deg, rgba(20, 184, 166, 0.12) 0%, rgba(12, 74, 110, 0.16) 100%);
}

[data-theme="dark"] .info-strip-config-preview-head,
[data-theme="dark"] .info-strip-config-preview-label,
[data-theme="dark"] .info-strip-config-preview-card strong {
  color: #5eead4;
}

[data-theme="dark"] .info-strip-config-preview-head small,
[data-theme="dark"] .info-strip-config-preview-card small {
  color: #94a3b8;
}

[data-theme="dark"] .info-strip-config-preview-card {
  border-color: rgba(45, 212, 191, 0.2);
  background: rgba(15, 23, 42, 0.56);
}

[data-theme="dark"] .info-strip-config-preview-pill {
  border-color: rgba(45, 212, 191, 0.24);
  background: rgba(20, 184, 166, 0.14);
  color: #99f6e4;
}

[data-theme="dark"] .info-strip-config-preview-empty {
  background: rgba(30, 41, 59, 0.64);
  color: #64748b;
}

[data-theme="dark"] .info-strip-source-group {
  border-color: rgba(71, 85, 105, 0.36);
  background: rgba(15, 23, 42, 0.56);
}

[data-theme="dark"] .info-strip-source-group[open] {
  background: rgba(15, 23, 42, 0.66);
}

[data-theme="dark"] .info-strip-source-group-title {
  color: #cbd5e1;
}

[data-theme="dark"] .info-strip-source-group-title small {
  color: #64748b;
}

[data-theme="dark"] .info-strip-config-check {
  border-color: rgba(96, 165, 250, 0.28);
  background: rgba(30, 41, 59, 0.82);
  color: #93c5fd;
}

[data-theme="dark"] .info-strip-config-column.is-order,
[data-theme="dark"] .info-strip-config-column.is-sources,
[data-theme="dark"] .info-strip-config-order-row {
  border-color: rgba(71, 85, 105, 0.34);
  background: rgba(15, 23, 42, 0.44);
}

[data-theme="dark"] .info-strip-order-index {
  background: rgba(96, 165, 250, 0.16);
  color: #93c5fd;
}

[data-theme="dark"] .info-strip-order-btn {
  border-color: rgba(96, 165, 250, 0.28);
  background: rgba(30, 41, 59, 0.82);
  color: #93c5fd;
}

[data-theme="dark"] .info-strip-config-check.is-source {
  border-color: rgba(56, 189, 248, 0.24);
  background: rgba(12, 74, 110, 0.24);
  color: #bae6fd;
}

[data-theme="dark"] .info-strip-source-card {
  border-color: rgba(56, 189, 248, 0.22);
  background: rgba(12, 74, 110, 0.2);
}

[data-theme="dark"] .info-strip-source-card.is-hidden-source {
  border-color: rgba(71, 85, 105, 0.36);
  background: rgba(15, 23, 42, 0.58);
}

[data-theme="dark"] .info-strip-source-card.is-loading-catalog .info-strip-source-card-title::after {
  color: #5eead4;
}

[data-theme="dark"] .info-strip-source-card.is-hidden-source .info-strip-source-card-title,
[data-theme="dark"] .info-strip-source-card.is-hidden-source .info-strip-source-toggle {
  color: #94a3b8;
}

[data-theme="dark"] .info-strip-source-card-title,
[data-theme="dark"] .info-strip-source-toggle {
  color: #bae6fd;
}

[data-theme="dark"] .info-strip-source-card-main small {
  color: #94a3b8;
}

[data-theme="dark"] .info-strip-source-sim-toggle {
  border-color: rgba(45, 212, 191, 0.22);
  background: rgba(20, 184, 166, 0.12);
  color: #99f6e4;
}

[data-theme="dark"] .info-strip-source-inline-preview.is-simulated .info-strip-source-sim-toggle {
  border-color: rgba(96, 165, 250, 0.32);
  background: rgba(37, 99, 235, 0.18);
  color: #bfdbfe;
}

[data-theme="dark"] .info-strip-source-card-settings {
  border-top-color: rgba(56, 189, 248, 0.2);
}

[data-theme="dark"] .info-strip-source-inline-preview > span {
  color: #5eead4;
}

[data-theme="dark"] .info-strip-source-card-settings > summary {
  color: #5eead4;
}

[data-theme="dark"] .info-strip-source-card-settings > summary small {
  color: #94a3b8;
}

[data-theme="dark"] .info-strip-source-setting-title {
  color: #5eead4;
}

[data-theme="dark"] .info-strip-source-option {
  border-color: rgba(45, 212, 191, 0.24);
  background: rgba(20, 184, 166, 0.12);
  color: #99f6e4;
}

[data-theme="dark"] .info-strip-custom-chip-row {
  border-color: rgba(45, 212, 191, 0.18);
  background: rgba(15, 23, 42, 0.42);
}

[data-theme="dark"] .info-strip-custom-chip-summary::before,
[data-theme="dark"] .info-strip-custom-chip-summary-text strong {
  color: #5eead4;
}

[data-theme="dark"] .info-strip-custom-chip-summary-text small {
  color: #94a3b8;
}

[data-theme="dark"] .info-strip-custom-chip-device-note,
[data-theme="dark"] .info-strip-custom-chip-entities.is-empty,
[data-theme="dark"] .info-strip-custom-chip-entities > summary small {
  color: #94a3b8;
}

[data-theme="dark"] .info-strip-custom-chip-entities {
  border-color: rgba(45, 212, 191, 0.2);
  background: rgba(20, 184, 166, 0.08);
}

[data-theme="dark"] .info-strip-custom-chip-entities > summary {
  color: #5eead4;
}

[data-theme="dark"] .info-strip-source-entity-dropdown > summary,
[data-theme="dark"] .info-strip-source-option-group {
  border-color: rgba(45, 212, 191, 0.22);
  background: rgba(15, 23, 42, 0.52);
  color: #99f6e4;
}

[data-theme="dark"] .info-strip-source-entity-dropdown > summary small,
[data-theme="dark"] .info-strip-source-option.is-entity-option small,
[data-theme="dark"] .info-strip-source-entity-alias-row > span {
  color: #94a3b8;
}

[data-theme="dark"] .info-strip-source-condition-label,
[data-theme="dark"] .info-strip-source-condition-mode,
[data-theme="dark"] .info-strip-source-condition-negate {
  color: #99f6e4;
}

[data-theme="dark"] .info-strip-source-condition-mode,
[data-theme="dark"] .info-strip-source-condition-negate {
  border-color: rgba(45, 212, 191, 0.22);
  background: rgba(15, 23, 42, 0.52);
}

[data-theme="dark"] .info-strip-custom-chip-head {
  color: #99f6e4;
}

[data-theme="dark"] .info-strip-custom-chip-summary-preview {
  opacity: 0.92;
}

[data-theme="dark"] .info-strip-custom-chip-empty {
  border-color: rgba(94, 234, 212, 0.28);
  color: #94a3b8;
  background: rgba(20, 184, 166, 0.1);
}

[data-theme="dark"] .info-strip-source-option-group-title {
  color: #7dd3fc;
}

[data-theme="dark"] .info-strip-source-search,
[data-theme="dark"] .info-strip-source-tool {
  border-color: rgba(45, 212, 191, 0.24);
  background: rgba(15, 23, 42, 0.62);
  color: #99f6e4;
}

[data-theme="dark"] .info-strip-source-tool:hover {
  border-color: rgba(45, 212, 191, 0.42);
  background: rgba(20, 184, 166, 0.18);
}

[data-theme="dark"] .info-strip-source-empty {
  color: #64748b;
}

[data-theme="dark"] .info-strip-source-number {
  color: #99f6e4;
}

[data-theme="dark"] .info-strip-config-check input {
  accent-color: #60a5fa;
}

[data-theme="dark"] .info-strip-pickup-head {
  color: #94a3b8;
}

[data-theme="dark"] .info-strip-pickup-row {
  border-color: rgba(71, 85, 105, 0.42);
  background: rgba(15, 23, 42, 0.72);
}

[data-theme="dark"] .info-strip-pickup-remove {
  border-color: rgba(248, 113, 113, 0.34);
  background: rgba(127, 29, 29, 0.24);
  color: #fecaca;
}

[data-theme="dark"] .xiaomi-hotsearch-config-btn.is-danger {
  border-color: rgba(248, 113, 113, 0.34);
  background: rgba(127, 29, 29, 0.24);
  color: #fecaca;
}

@media (max-width: 760px) {
  .xiaomi-hotsearch-config-modal {
    padding: 10px;
  }
  .xiaomi-hotsearch-config-grid,
  .info-strip-config-grid,
  .info-strip-config-workspace,
  .info-strip-config-order-stack,
  .info-strip-config-order,
  .info-strip-config-preview-grid,
  .info-strip-source-grid,
  .xiaomi-hotsearch-config-columns,
  .xiaomi-hotsearch-keyword-editor-grid {
    grid-template-columns: 1fr;
  }
  .info-strip-config-modal {
    padding: 10px;
  }
  .info-strip-config-dialog,
  .info-strip-config-dialog.card {
    width: min(100%, 760px) !important;
  }
  .info-strip-config-section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
  .info-strip-config-section-head.is-phone-head {
    align-items: flex-start;
  }
  .info-strip-source-card,
  .info-strip-source-inline-preview,
	  .info-strip-source-toggle,
	  .info-strip-source-entity-alias-row,
		  .info-strip-source-entity-alias-row.has-condition,
		  .info-strip-custom-chip-main,
		  .info-strip-source-condition-mode {
		    grid-template-columns: 1fr;
		  }
  .info-strip-entity-order-actions {
    justify-content: flex-start;
  }
  .info-strip-source-condition-label {
    justify-self: start;
  }
  .xiaomi-hotsearch-source-head-row,
  .xiaomi-hotsearch-source-row {
    grid-template-columns: 50px 90px 150px 62px 62px 58px 70px 168px 64px 38px 64px;
    min-width: 976px;
  }
}

/* ===== Auth admin switch card ===== */
.auth-admin-switch-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  width: 100%;
  height: 100%;
  min-height: 100%;
  perspective: 1400px;
  -webkit-perspective: 1400px;
  contain: layout paint;
}

.auth-admin-switch-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.auth-admin-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 620ms cubic-bezier(0.22, 0.8, 0.2, 1);
  will-change: transform;
}

.auth-admin-panel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: transparent;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  overflow: hidden;
}

.auth-admin-panel-front {
  z-index: 2;
  transform: rotateY(0deg) translateZ(1px);
}

.auth-admin-panel-manager {
  z-index: 1;
  transform: rotateY(-180deg) translateZ(1px);
  pointer-events: none;
}

.auth-admin-switch-card.is-manager-view .auth-admin-flip-inner {
  transform: rotateY(180deg);
}

.auth-admin-switch-card.is-manager-view .auth-admin-panel-manager {
  pointer-events: auto;
}

.auth-admin-switch-card.is-manager-view .auth-admin-panel-front {
  pointer-events: none;
}

.auth-admin-panel-front > .card-header,
.auth-admin-panel-manager > .auth-admin-manager-shell-fixed > .card-header {
  flex-shrink: 0;
  padding-left: 14px;
  padding-right: 14px;
  padding-top: 14px;
  padding-bottom: 10px;
}

.auth-admin-panel-front > .card-body,
.auth-admin-manager-body-fixed {
  flex: 1;
  min-height: 0;
  height: 100%;
}

.auth-admin-panel-front > .card-body {
  padding: 0 14px 14px;
}

.auth-admin-manager-shell-fixed {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.auth-admin-manager-body-fixed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 14px 14px;
  overflow: hidden;
  min-height: 0;
  height: 100%;
}

.auth-admin-manager-header-fixed {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  background: linear-gradient(180deg, rgba(12,18,32,0.98) 0%, rgba(12,18,32,0.94) 72%, rgba(12,18,32,0.75) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.auth-admin-header-main,
.auth-admin-header-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.auth-admin-header-main {
  flex: 1;
}

.auth-admin-header-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 22px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.auth-admin-header-copy h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.auth-admin-priority-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(250px, 0.72fr);
  gap: 12px;
  align-items: stretch;
  min-height: 0;
  height: 100%;
}

.auth-admin-primary-column,
.auth-admin-summary-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  min-height: 0;
}

.auth-admin-primary-column {
  align-self: stretch;
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-right: 2px;
}

.auth-admin-primary-column::-webkit-scrollbar {
  display: none;
}

.auth-admin-primary-column > .auth-admin-summary-panel,
.auth-admin-primary-column > .auth-section-card-priority {
  flex: 0 0 auto;
}

.auth-admin-primary-column > .auth-section-card:last-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  flex: 0 0 auto;
  overflow: visible;
}

.auth-admin-primary-column > .auth-section-card:last-child .auth-list-wrap-devices {
  min-height: 0;
  flex: 0 0 auto;
  overflow: visible;
  max-height: none;
  padding-right: 2px;
}

.auth-admin-primary-column > .auth-section-card:last-child > .auth-section-head,
.auth-admin-primary-column > .auth-section-card:last-child > .auth-section-subtitle {
  flex: 0 0 auto;
}

.auth-admin-secondary-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  opacity: .96;
}

.auth-admin-secondary-scroll {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  height: 100%;
  flex: 1 1 auto;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-right: 2px;
}

.auth-admin-secondary-scroll::-webkit-scrollbar {
  display: none;
}

.auth-section-card-priority {
  border-color: rgba(250, 204, 21, 0.24);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.auth-log-card {
  opacity: 0.97;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 0 0 auto;
}

.auth-log-collapsible {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 0 0 auto;
}

.auth-log-summary {
  list-style: none;
  cursor: pointer;
  margin: 0;
  padding: 12px;
}

.auth-log-summary::-webkit-details-marker {
  display: none;
}

.auth-log-summary-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-log-summary-tip {
  font-size: 11px;
  color: rgba(185, 192, 224, 0.76);
}

[data-theme="light"] .auth-log-summary-tip {
  color: #66758f;
}

.auth-log-collapsible .auth-log-list {
  padding: 0 12px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.auth-log-collapsible:not([open]) .auth-log-list {
  display: none;
}

.auth-manager-topline-fixed {
  flex-shrink: 0;
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(100, 124, 255, 0.10) 0%, rgba(255,255,255,0.055) 100%);
  border: 1px solid rgba(122, 146, 255, 0.18);
  color: rgba(214, 220, 244, 0.82);
  font-size: 11px;
  line-height: 1.5;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

[data-theme="light"] .auth-manager-topline-fixed {
  background: linear-gradient(180deg, rgba(74,108,247,0.08) 0%, rgba(255,255,255,0.96) 100%);
  border-color: rgba(148, 163, 184, 0.22);
  color: #5b667d;
}

.auth-admin-priority-layout.viewer-scope .auth-manager-topline-fixed,
.auth-admin-priority-layout.viewer-scope ~ .auth-manager-topline-fixed,
.auth-admin-body-viewer .auth-manager-topline-fixed {
  font-size: 10px;
  line-height: 1.45;
  letter-spacing: 0.005em;
}

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

.auth-front-stat,
.auth-summary-card,
.auth-stat-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.05) 100%);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

[data-theme="light"] .auth-front-stat,
[data-theme="light"] .auth-summary-card,
[data-theme="light"] .auth-stat-box {
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(246,248,252,0.98) 100%);
  border-color: rgba(203, 213, 225, 0.88);
  box-shadow: 0 8px 24px rgba(15,23,42,0.04), inset 0 1px 0 rgba(255,255,255,0.95);
}

.auth-front-stat strong,
.auth-summary-card strong,
.auth-stat-box strong {
  font-size: 20px;
  line-height: 1.1;
  color: var(--text-primary);
}

.auth-admin-priority-layout .auth-summary-card strong,
.auth-admin-priority-layout .auth-stat-box strong {
  font-size: 18px;
}

.auth-front-stat-label,
.auth-summary-label,
.auth-stat-label,
.auth-stat-sub,
.auth-summary-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.auth-front-stat.is-pending,
.auth-summary-card.is-pending {
  border-color: rgba(250, 204, 21, 0.22);
  background: rgba(250, 204, 21, 0.08);
}

.auth-front-bridge,
.auth-bridge-card,
.auth-section-card {
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(25, 31, 58, 0.92) 0%, rgba(18, 23, 45, 0.88) 100%);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

[data-theme="light"] .auth-front-bridge,
[data-theme="light"] .auth-bridge-card,
[data-theme="light"] .auth-section-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.99) 0%, rgba(247,249,253,0.98) 100%);
  border-color: rgba(203, 213, 225, 0.82);
  box-shadow: 0 10px 28px rgba(15,23,42,0.045), inset 0 1px 0 rgba(255,255,255,0.95);
}

.auth-front-bridge.tone-ok,
.auth-bridge-card.tone-ok {
  border-color: rgba(74, 227, 168, 0.24);
  background: linear-gradient(180deg, rgba(74, 227, 168, 0.12) 0%, rgba(30, 38, 56, 0.86) 100%);
}

.auth-front-bridge.tone-warn,
.auth-bridge-card.tone-warn {
  border-color: rgba(250, 204, 21, 0.24);
  background: linear-gradient(180deg, rgba(250, 204, 21, 0.12) 0%, rgba(30, 38, 56, 0.86) 100%);
}

.auth-front-bridge.tone-down,
.auth-bridge-card.tone-down {
  border-color: rgba(255, 107, 107, 0.24);
  background: linear-gradient(180deg, rgba(255, 107, 107, 0.12) 0%, rgba(30, 38, 56, 0.86) 100%);
}

[data-theme="light"] .auth-front-bridge.tone-ok,
[data-theme="light"] .auth-bridge-card.tone-ok {
  background: linear-gradient(180deg, rgba(16,185,129,0.10) 0%, rgba(255,255,255,0.98) 100%);
}

[data-theme="light"] .auth-front-bridge.tone-warn,
[data-theme="light"] .auth-bridge-card.tone-warn {
  background: linear-gradient(180deg, rgba(245,158,11,0.10) 0%, rgba(255,255,255,0.98) 100%);
}

[data-theme="light"] .auth-front-bridge.tone-down,
[data-theme="light"] .auth-bridge-card.tone-down {
  background: linear-gradient(180deg, rgba(239,68,68,0.10) 0%, rgba(255,255,255,0.98) 100%);
}

.auth-front-headline,
.auth-title-badges,
.auth-field-grid,
.auth-front-bridge-row,
.auth-bridge-title-row,
.auth-bridge-topline,
.auth-section-head,
.auth-list-title-row,
.auth-log-head,
.auth-front-actions,
.auth-chip-row,
.auth-list-submeta,
.auth-log-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-bridge-topline,
.auth-section-head,
.auth-log-head,
.auth-list-title-row {
  justify-content: space-between;
}

.auth-section-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.auth-bridge-meta,
.auth-front-bridge-meta,
.auth-front-bridge-sub,
.auth-front-entry-title,
.auth-list-meta,
.auth-list-submeta,
.auth-log-detail,
.auth-log-meta,
.auth-field-label,
.auth-hint-item {
  font-size: 11px;
  color: rgba(191, 198, 228, 0.78);
}

[data-theme="light"] .auth-bridge-meta,
[data-theme="light"] .auth-front-bridge-meta,
[data-theme="light"] .auth-front-bridge-sub,
[data-theme="light"] .auth-front-entry-title,
[data-theme="light"] .auth-list-meta,
[data-theme="light"] .auth-list-submeta,
[data-theme="light"] .auth-log-detail,
[data-theme="light"] .auth-log-meta,
[data-theme="light"] .auth-field-label,
[data-theme="light"] .auth-hint-item {
  color: #66758f;
}

.auth-admin-priority-layout .auth-bridge-meta,
.auth-admin-priority-layout .auth-front-bridge-meta,
.auth-admin-priority-layout .auth-front-bridge-sub,
.auth-admin-priority-layout .auth-list-meta,
.auth-admin-priority-layout .auth-list-submeta,
.auth-admin-priority-layout .auth-log-detail,
.auth-admin-priority-layout .auth-log-meta,
.auth-admin-priority-layout .auth-field-label,
.auth-admin-priority-layout .auth-hint-item,
.auth-admin-priority-layout .auth-log-summary-tip,
.auth-admin-priority-layout .auth-section-subtitle,
.auth-admin-priority-layout .auth-log-subtitle,
.auth-admin-priority-layout .auth-action-disabled-reason {
  font-size: 10.5px;
}

.auth-admin-priority-layout.viewer-scope .auth-bridge-meta,
.auth-admin-priority-layout.viewer-scope .auth-front-bridge-meta,
.auth-admin-priority-layout.viewer-scope .auth-front-bridge-sub,
.auth-admin-priority-layout.viewer-scope .auth-list-meta,
.auth-admin-priority-layout.viewer-scope .auth-list-submeta,
.auth-admin-priority-layout.viewer-scope .auth-log-detail,
.auth-admin-priority-layout.viewer-scope .auth-log-meta,
.auth-admin-priority-layout.viewer-scope .auth-field-label,
.auth-admin-priority-layout.viewer-scope .auth-hint-item,
.auth-admin-priority-layout.viewer-scope .auth-log-summary-tip,
.auth-admin-priority-layout.viewer-scope .auth-section-subtitle,
.auth-admin-priority-layout.viewer-scope .auth-log-subtitle,
.auth-admin-priority-layout.viewer-scope .auth-action-disabled-reason {
  font-size: 10px;
  line-height: 1.45;
}

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

.auth-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
}

.auth-status-pill.tone-ok,
.auth-log-dot.tone-ok {
  background: rgba(74, 227, 168, 0.15);
  color: var(--accent-green);
}

.auth-status-pill.tone-warn,
.auth-log-dot.tone-warn {
  background: rgba(250, 204, 21, 0.15);
  color: var(--accent-yellow);
}

.auth-status-pill.tone-down,
.auth-log-dot.tone-down {
  background: rgba(255, 107, 107, 0.15);
  color: var(--accent-red);
}

.auth-status-pill.tone-muted,
.auth-log-dot.tone-muted {
  background: rgba(255,255,255,0.08);
  color: var(--text-secondary);
}

.auth-inline-alert,
.auth-empty {
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.075) 0%, rgba(255,255,255,0.045) 100%);
  border: 1px solid rgba(255,255,255,0.11);
  color: rgba(200, 208, 236, 0.82);
  font-size: 12px;
  line-height: 1.5;
}

[data-theme="light"] .auth-inline-alert,
[data-theme="light"] .auth-empty {
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(246,248,252,0.98) 100%);
  border-color: rgba(203, 213, 225, 0.88);
  color: #5b667d;
}

.auth-admin-priority-layout .auth-inline-alert,
.auth-admin-priority-layout .auth-empty {
  font-size: 11px;
}

.auth-admin-priority-layout.viewer-scope .auth-inline-alert,
.auth-admin-priority-layout.viewer-scope .auth-empty,
.auth-admin-body-viewer > .auth-inline-alert {
  font-size: 10px;
  line-height: 1.5;
}

.auth-inline-alert {
  background: rgba(255, 107, 107, 0.1);
  border-color: rgba(255, 107, 107, 0.18);
  color: #fecaca;
}

.auth-list-wrap,
.auth-log-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-list-item,
.auth-log-row {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.045) 100%);
  border: 1px solid rgba(255,255,255,0.10);
}

[data-theme="light"] .auth-list-item,
[data-theme="light"] .auth-log-row {
  background: linear-gradient(180deg, rgba(255,255,255,0.99) 0%, rgba(248,250,253,0.98) 100%);
  border-color: rgba(214, 222, 233, 0.92);
  box-shadow: 0 6px 20px rgba(15,23,42,0.03);
}

.auth-list-item.is-highlight {
  border-color: rgba(110,140,255,0.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.auth-device-card.is-compacted-local {
  border-color: rgba(74, 227, 168, 0.18);
  background:
    linear-gradient(180deg, rgba(74, 227, 168, 0.08) 0%, rgba(255,255,255,0.04) 100%),
    rgba(255,255,255,0.035);
}

[data-theme="light"] .auth-device-card.is-compacted-local {
  border-color: rgba(16, 185, 129, 0.22);
  background:
    linear-gradient(180deg, rgba(16, 185, 129, 0.08) 0%, rgba(255,255,255,0.98) 100%),
    #ffffff;
}

.auth-list-main,
.auth-log-content {
  flex: 1;
  min-width: 0;
}

.auth-list-title,
.auth-log-action,
.auth-section-head h4,
.auth-front-entry-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.auth-admin-priority-layout .auth-section-head h4,
.auth-admin-priority-layout .auth-list-title,
.auth-admin-priority-layout .auth-log-action,
.auth-admin-priority-layout .auth-front-entry-title {
  font-size: 12px;
  font-weight: 650;
}

.auth-admin-priority-layout.viewer-scope .auth-section-head h4,
.auth-admin-priority-layout.viewer-scope .auth-list-title,
.auth-admin-priority-layout.viewer-scope .auth-log-action,
.auth-admin-priority-layout.viewer-scope .auth-front-entry-title {
  font-size: 11px;
  font-weight: 620;
}

.auth-mini-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-secondary);
  font-size: 11px;
}

.auth-log-dot {
  width: 10px;
  height: 10px;
  min-width: 10px;
  border-radius: 50%;
  margin-top: 5px;
}

.auth-log-time {
  font-size: 11px;
  color: var(--text-muted);
}

.auth-front-headline {
  justify-content: space-between;
  margin-bottom: 12px;
}

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

.auth-field-pill {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  min-width: 0;
}

.auth-field-label {
  font-size: 11px;
}

.auth-field-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
}

.auth-admin-priority-layout .auth-field-value {
  font-size: 11.5px;
  font-weight: 550;
}

.auth-admin-priority-layout.viewer-scope .auth-field-value {
  font-size: 10.5px;
  font-weight: 520;
}

.auth-item-actions-wrap {
  margin-top: 12px;
  width: 100%;
}

.auth-device-primary-actions .auth-item-actions-wrap {
  margin-top: 0;
}

.auth-item-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-section-head-devices {
  align-items: flex-start;
  gap: 12px;
}

.auth-section-head-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-device-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
  margin-left: 0;
}

.auth-toolbar-hint {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(74, 227, 168, 0.18);
  background: rgba(74, 227, 168, 0.08);
  color: var(--accent-green);
  font-size: 11px;
  font-weight: 600;
}

.auth-device-search {
  display: inline-flex;
  flex: 1 1 280px;
  align-items: center;
  gap: 8px;
  min-width: min(100%, 320px);
  padding: 0 10px;
  min-height: 36px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
}

.auth-device-search-icon {
  color: var(--text-muted);
  font-size: 12px;
}

.auth-device-search input {
  width: 100%;
  min-width: 160px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font-size: 12px;
}

.auth-device-search input::placeholder {
  color: var(--text-muted);
}

.auth-toolbar-btn {
  min-height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
}

.auth-list-wrap-devices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: none;
  min-height: 0;
  height: 100%;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-right: 2px;
  align-content: flex-start;
  overflow-anchor: none;
}

.auth-list-wrap-devices::-webkit-scrollbar {
  display: none;
}

.auth-device-list-more {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px dashed rgba(255,255,255,0.13);
  border-radius: 10px;
  background: rgba(255,255,255,0.045);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.auth-device-list-more .auth-toolbar-btn {
  flex: 0 0 auto;
}

.auth-diagnostics-card {
  margin-bottom: 10px;
  border-style: dashed;
}

.auth-diagnostics-card .auth-field-grid {
  margin-top: 8px;
}

.auth-device-card {
  padding: 12px;
}

.auth-device-card.is-revoked {
  opacity: 0.92;
}

.auth-device-primary-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.auth-device-primary-row-stacked {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.auth-device-primary-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-device-primary-main-full {
  width: 100%;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.auth-device-primary-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.auth-device-primary-actions-row {
  width: 100%;
  justify-content: flex-start;
}

.auth-device-browser-summary {
  width: 100%;
  padding: 9px 11px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0.045) 0%, rgba(255,255,255,0.025) 100%);
  border: 1px solid rgba(255,255,255,0.06);
  font-size: 12px;
  line-height: 1.55;
  color: rgba(205, 213, 240, 0.84);
  overflow-wrap: anywhere;
  word-break: break-word;
}

[data-theme="light"] .auth-device-browser-summary {
  color: #526074;
  background: linear-gradient(180deg, rgba(255,255,255,0.99) 0%, rgba(244,247,251,0.98) 100%);
  border-color: rgba(214, 222, 233, 0.9);
}

.auth-device-secondary-row {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-device-priority-strip-inline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.auth-device-priority-strip-inline .auth-device-priority-item {
  min-width: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0.075) 0%, rgba(255,255,255,0.04) 100%);
  border: 1px solid rgba(255,255,255,0.10);
}

.auth-device-priority-strip-inline .auth-device-priority-label {
  margin-bottom: 4px;
}

.auth-device-priority-strip-inline .auth-device-priority-item strong {
  display: block;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-primary);
}

.auth-device-priority-strip-with-actions {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto;
  column-gap: 10px;
  align-items: stretch;
}

.auth-device-priority-item-expiry {
  min-width: 0;
  flex: 1 1 auto;
}

.auth-device-priority-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 0 1 auto;
}

.auth-device-primary-actions-inline {
  margin-left: auto;
  justify-content: flex-end;
  flex-wrap: wrap;
  row-gap: 6px;
}

.auth-device-primary-actions-inline .auth-action-btn {
  flex: 0 0 auto;
}

[data-theme="light"] .auth-device-priority-strip-inline .auth-device-priority-item {
  background: linear-gradient(180deg, rgba(255,255,255,0.99) 0%, rgba(244,247,251,0.98) 100%);
  border-color: rgba(214, 222, 233, 0.9);
}

@media (max-width: 860px) {
  .auth-device-priority-strip-inline,
  .auth-device-priority-strip-with-actions {
    grid-template-columns: 1fr;
  }

  .auth-device-primary-actions-inline,
  .auth-device-primary-actions-inline .auth-item-actions-wrap,
  .auth-device-primary-actions-inline .auth-item-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

.auth-device-secondary-row.is-collapsed .auth-field-grid {
  display: none;
}

.auth-device-secondary-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-inline-meta {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.10);
  font-size: 11px;
  color: rgba(191, 198, 228, 0.82);
  max-width: 100%;
}

[data-theme="light"] .auth-inline-meta {
  background: rgba(241, 245, 249, 0.9);
  border-color: rgba(203, 213, 225, 0.82);
  color: #5b667d;
}

.auth-admin-priority-layout .auth-inline-meta,
.auth-admin-priority-layout .auth-mini-chip,
.auth-admin-priority-layout .auth-status-pill {
  font-size: 10.5px;
}

.auth-admin-priority-layout.viewer-scope .auth-inline-meta,
.auth-admin-priority-layout.viewer-scope .auth-mini-chip,
.auth-admin-priority-layout.viewer-scope .auth-status-pill {
  font-size: 9.5px;
}

.auth-field-grid-compact {
  margin-top: 0;
}

.auth-action-disabled-reason {
  margin-top: 8px;
  font-size: 11px;
  color: rgba(164, 173, 206, 0.82);
}

[data-theme="light"] .auth-action-disabled-reason {
  color: #7a869c;
}

.auth-action-btn {
  border: 1px solid rgba(152, 170, 255, 0.26);
  background: linear-gradient(180deg, rgba(110,140,255,0.20) 0%, rgba(86,108,214,0.14) 100%);
  color: #f3f6ff;
  min-height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.10), 0 10px 22px rgba(38, 56, 125, 0.18);
  transition: background var(--transition), border-color var(--transition), transform var(--transition), opacity var(--transition), box-shadow var(--transition), filter var(--transition);
}

.auth-action-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(126,156,255,0.30) 0%, rgba(96,118,224,0.20) 100%);
  border-color: rgba(164, 181, 255, 0.38);
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), 0 14px 28px rgba(38, 56, 125, 0.24);
}

.auth-action-btn:active:not(:disabled) {
  transform: translateY(0);
  filter: brightness(0.98);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 6px 14px rgba(38, 56, 125, 0.18);
}

.auth-action-btn:disabled {
  opacity: 0.42;
  filter: saturate(0.55) grayscale(0.18);
  box-shadow: none;
  cursor: not-allowed;
}

.auth-device-card.is-revoked .auth-action-btn:disabled {
  opacity: 0.34;
}

.auth-admin-tooltip {
  position: fixed;
  z-index: 10020;
  max-width: min(280px, calc(100vw - 24px));
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.96);
  color: #f8fafc;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.28);
  border: 1px solid rgba(148, 163, 184, 0.20);
  transform: translate(-50%, calc(-100% - 6px));
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
}

.auth-admin-tooltip.is-visible {
  opacity: 1;
}

[data-theme="light"] .auth-admin-tooltip {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(148, 163, 184, 0.18);
}

.auth-action-btn.is-success {
  border-color: rgba(74, 227, 168, 0.30);
  color: #d9fff0;
  background: linear-gradient(180deg, rgba(74, 227, 168, 0.22) 0%, rgba(26, 111, 83, 0.18) 100%);
}

.auth-action-btn.is-success:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(74, 227, 168, 0.28) 0%, rgba(30, 130, 96, 0.22) 100%);
}

.auth-action-btn.is-warn {
  border-color: rgba(250, 204, 21, 0.30);
  color: #fff4c7;
  background: linear-gradient(180deg, rgba(250, 204, 21, 0.22) 0%, rgba(143, 101, 7, 0.18) 100%);
}

.auth-action-btn.is-warn:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(250, 204, 21, 0.28) 0%, rgba(162, 115, 9, 0.22) 100%);
}

.auth-action-btn.is-danger {
  border-color: rgba(255, 107, 107, 0.28);
  color: #ffe0e0;
  background: linear-gradient(180deg, rgba(255, 107, 107, 0.20) 0%, rgba(140, 43, 43, 0.18) 100%);
}

.auth-action-btn.is-danger:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(255, 107, 107, 0.26) 0%, rgba(160, 48, 48, 0.22) 100%);
}

.auth-action-btn.is-neutral {
  border-color: rgba(110,140,255,0.30);
  color: #e3e9ff;
  background: linear-gradient(180deg, rgba(110,140,255,0.22) 0%, rgba(67, 86, 184, 0.18) 100%);
}

.auth-action-btn.is-neutral:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(110,140,255,0.30) 0%, rgba(78, 98, 204, 0.22) 100%);
}

[data-theme="light"] .auth-action-btn {
  border-color: rgba(74,108,247,0.18);
  background: linear-gradient(180deg, rgba(74,108,247,0.14) 0%, rgba(74,108,247,0.08) 100%);
  color: #2740a3;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.95), 0 10px 20px rgba(74,108,247,0.10);
}

[data-theme="light"] .auth-action-btn:hover:not(:disabled) {
  border-color: rgba(74,108,247,0.28);
  background: linear-gradient(180deg, rgba(74,108,247,0.20) 0%, rgba(74,108,247,0.12) 100%);
  color: #1f3485;
}

[data-theme="light"] .auth-action-btn:active:not(:disabled) {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.85), 0 4px 10px rgba(74,108,247,0.10);
}

[data-theme="light"] .auth-action-btn:disabled {
  opacity: 0.45;
  filter: grayscale(0.18);
  color: #94a3b8;
  background: rgba(241,245,249,0.95);
  border-color: rgba(203,213,225,0.82);
}

[data-theme="light"] .auth-action-btn.is-success {
  color: #0f7a57;
  background: linear-gradient(180deg, rgba(16,185,129,0.14) 0%, rgba(16,185,129,0.08) 100%);
  border-color: rgba(16,185,129,0.22);
}

[data-theme="light"] .auth-action-btn.is-warn {
  color: #9a6700;
  background: linear-gradient(180deg, rgba(245,158,11,0.16) 0%, rgba(245,158,11,0.09) 100%);
  border-color: rgba(245,158,11,0.24);
}

[data-theme="light"] .auth-action-btn.is-danger {
  color: #b42318;
  background: linear-gradient(180deg, rgba(239,68,68,0.14) 0%, rgba(239,68,68,0.08) 100%);
  border-color: rgba(239,68,68,0.20);
}

[data-theme="light"] .auth-action-btn.is-neutral {
  color: #2740a3;
}

.auth-guidance-card {
  border-style: dashed;
}

.auth-hint-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-inline-alert.is-success {
  background: rgba(74, 227, 168, 0.12);
  border-color: rgba(74, 227, 168, 0.22);
  color: #bbf7d0;
}

.auth-inline-alert.is-muted {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.55;
}

.auth-inline-alert.is-danger {
  background: rgba(255, 107, 107, 0.1);
  border-color: rgba(255, 107, 107, 0.18);
  color: #fecaca;
}

.auth-front-actions {
  margin-top: 12px;
  justify-content: flex-end;
}

.auth-device-heading-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-device-heading-row .auth-list-title {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.auth-device-badges {
  gap: 6px;
}

.auth-device-priority-strip {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.auth-device-priority-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 88px;
  padding: 6px 8px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0.075) 0%, rgba(255,255,255,0.04) 100%);
  border: 1px solid rgba(255,255,255,0.10);
}

[data-theme="light"] .auth-device-priority-item {
  background: linear-gradient(180deg, rgba(255,255,255,0.99) 0%, rgba(244,247,251,0.98) 100%);
  border-color: rgba(214, 222, 233, 0.9);
}

.auth-device-priority-label {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.auth-device-priority-item strong {
  font-size: 12px;
  line-height: 1.25;
  color: var(--text-primary);
  font-weight: 600;
}

.auth-admin-priority-layout.viewer-scope .auth-device-priority-item {
  min-width: 80px;
  padding: 5px 7px;
}

.auth-admin-priority-layout.viewer-scope .auth-device-priority-label {
  font-size: 9px;
  letter-spacing: 0.015em;
}

.auth-admin-priority-layout.viewer-scope .auth-device-priority-item strong {
  font-size: 10.5px;
  font-weight: 560;
}

.auth-log-target {
  font-size: 12px;
  line-height: 1.35;
  color: rgba(220, 226, 246, 0.92);
  font-weight: 600;
}

[data-theme="light"] .auth-log-target {
  color: #334155;
}

.auth-admin-priority-layout .auth-log-target {
  font-size: 11px;
  font-weight: 550;
}

.auth-admin-priority-layout.viewer-scope .auth-log-target {
  font-size: 10px;
  font-weight: 520;
  color: rgba(214, 220, 244, 0.84);
}

[data-theme="light"] .auth-admin-priority-layout.viewer-scope .auth-log-target {
  color: #475569;
}

.auth-log-subhead {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.auth-admin-priority-layout.viewer-scope .auth-log-subhead {
  gap: 6px;
  margin-top: 3px;
}

.auth-log-detail {
  margin-top: 5px;
  line-height: 1.55;
}

.auth-admin-priority-layout.viewer-scope .auth-log-detail {
  margin-top: 4px;
  opacity: 0.88;
}

.auth-section-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-section-head-main-stacked {
  align-items: flex-start;
}

.auth-section-subtitle,
.auth-log-subtitle {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.5;
  color: rgba(170, 179, 212, 0.78);
}

[data-theme="light"] .auth-section-subtitle,
[data-theme="light"] .auth-log-subtitle {
  color: #74839a;
}

@media (max-width: 1024px) {
  .auth-admin-modal-dialog {
    width: min(960px, calc(100vw - 24px));
    max-width: 960px;
  }

  .auth-admin-priority-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .auth-admin-primary-column,
  .auth-admin-primary-column > .auth-section-card:last-child,
  .auth-list-wrap-devices {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .auth-admin-secondary-column {
    order: 3;
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .auth-admin-modal {
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: pan-y;
  }

  .auth-admin-modal-dialog {
    width: min(100vw, 100%);
    height: 100dvh;
    max-height: 100dvh;
    min-height: 100dvh;
    margin: 0;
    border-radius: 18px 18px 0 0;
    overflow: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  .auth-admin-modal-content {
    height: 100%;
    max-height: 100%;
    overflow: hidden;
  }

  .auth-admin-modal-panel,
  .auth-admin-switch-viewport,
  .auth-admin-flip-inner,
  .auth-admin-panel-front,
  .auth-admin-panel-manager,
  .auth-admin-manager-shell-fixed {
    display: block;
    position: static;
    min-height: 100%;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
  }

  .auth-admin-header {
    padding: 12px 14px 8px;
  }

  .auth-admin-header-main {
    align-items: flex-start;
    gap: 8px;
  }

  .auth-admin-header-copy {
    min-width: 0;
  }

  .auth-admin-manager-header-fixed {
    padding: 12px 12px 10px;
    gap: 8px;
  }

  .auth-admin-manager-body-fixed {
    display: block;
    position: relative;
    padding: 0 12px calc(18px + env(safe-area-inset-bottom, 0px));
    height: calc(100dvh - 72px);
    max-height: calc(100dvh - 72px);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .auth-admin-priority-layout {
    grid-template-columns: 1fr;
    gap: 12px;
    min-height: 0;
    height: auto;
  }

  .auth-admin-primary-column,
  .auth-admin-secondary-column {
    min-width: 0;
    max-width: none;
    height: auto;
    overflow: visible;
  }

  .auth-admin-secondary-column {
    order: 3;
    opacity: 0.92;
    display: block;
    position: static;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  .auth-admin-secondary-scroll {
    display: block;
    position: static;
    height: auto;
    min-height: 0;
    overflow: visible;
    padding-right: 0;
    gap: 12px;
  }

  .auth-admin-secondary-column .auth-section-card,
  .auth-admin-secondary-column .auth-log-card,
  .auth-admin-secondary-column .auth-log-collapsible {
    opacity: 0.9;
  }

  .auth-admin-secondary-column .auth-log-collapsible {
    border-style: dashed;
  }

  .auth-admin-secondary-column .auth-section-card:not(:first-child) {
    margin-top: 6px;
  }

  .auth-admin-secondary-column .auth-log-summary {
    padding: 9px 11px;
    border-top: 1px solid rgba(148, 163, 184, 0.14);
    margin-top: 8px;
  }

  .auth-admin-secondary-column .auth-section-subtitle,
  .auth-admin-secondary-column .auth-field-hint,
  .auth-admin-secondary-column .auth-empty-tip {
    font-size: 11px;
    line-height: 1.4;
    color: var(--text-muted);
  }

  .auth-summary-grid,
  .auth-front-summary-grid,
  .auth-bridge-stats,
  .auth-field-grid {
    grid-template-columns: 1fr;
  }

  .auth-admin-header-summary {
    gap: 4px;
    font-size: 10px;
    line-height: 1.35;
    min-height: 0;
    margin-top: 4px;
  }

  .auth-admin-header-summary > :nth-child(n+2) {
    display: none;
  }

  .auth-section-head,
  .auth-section-head-devices,
  .auth-device-primary-row,
  .auth-device-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-section-head-main {
    gap: 5px;
  }

  .auth-section-subtitle {
    font-size: 11px;
    line-height: 1.4;
  }

  .auth-device-toolbar,
  .auth-device-primary-actions,
  .auth-item-actions,
  .auth-item-actions-wrap {
    width: 100%;
    margin-left: 0;
  }

  .auth-device-primary-actions,
  .auth-item-actions {
    gap: 8px;
    flex-wrap: wrap;
  }

  .auth-device-primary-actions > *,
  .auth-item-actions > * {
    flex: 1 1 calc(50% - 8px);
    min-width: 140px;
  }

  .auth-device-primary-actions .btn,
  .auth-device-primary-actions button,
  .auth-item-actions .btn,
  .auth-item-actions button,
  .auth-toolbar-btn {
    min-height: 38px;
    width: 100%;
  }

  .auth-device-search {
    width: 100%;
    min-width: 0;
  }

  .auth-device-row,
  .auth-device-primary-item,
  .auth-device-priority-item {
    border-radius: 14px;
  }

  .auth-log-card,
  .auth-log-collapsible {
    max-height: none;
  }

  .auth-admin-modal-panel {
    overflow: visible;
    -webkit-overflow-scrolling: touch;
  }

  .auth-mobile-more-card {
    display: block;
    position: static;
    width: 100%;
    height: auto;
    min-height: 0;
    margin-top: 8px;
    overflow: visible;
    z-index: auto;
    clear: both;
    align-self: auto;
  }

  .auth-mobile-more-card > summary {
    position: static;
    display: flex;
    width: 100%;
  }

  .auth-mobile-more-card > *:not(summary) {
    position: static;
  }

  .auth-mobile-more-summary {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  }

  .auth-mobile-more-card[open] {
    margin-bottom: 12px;
  }

  .auth-mobile-more-card[open] .auth-mobile-more-summary {
    margin-bottom: 10px;
  }

  .auth-mobile-more-card .auth-guidance-card,
  .auth-mobile-more-card .auth-log-card {
    position: static;
    margin-top: 8px;
  }

  .auth-admin-mobile-afterlog {
    order: 4;
    margin-top: 14px;
  }
}

[data-theme="light"] .auth-front-stat,
[data-theme="light"] .auth-summary-card,
[data-theme="light"] .auth-stat-box,
[data-theme="light"] .auth-front-bridge,
[data-theme="light"] .auth-bridge-card,
[data-theme="light"] .auth-section-card,
[data-theme="light"] .auth-list-item,
[data-theme="light"] .auth-log-row,
[data-theme="light"] .auth-manager-topline-fixed,
[data-theme="light"] .auth-empty,
[data-theme="light"] .auth-field-pill {
  background: rgba(255,255,255,0.9);
  border-color: rgba(212,216,224,0.92);
}

[data-theme="light"] .auth-inline-alert {
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.16);
  color: #b91c1c;
}

[data-theme="light"] .auth-device-search,
[data-theme="light"] .auth-toolbar-btn,
[data-theme="light"] .auth-inline-meta {
  background: rgba(255,255,255,0.94);
  border-color: rgba(212,216,224,0.92);
}

@media (max-width: 900px) {
  .auth-front-summary-grid,
  .auth-summary-grid,
  .auth-bridge-stats,
  .auth-field-grid {
    grid-template-columns: 1fr;
  }
}

.modal-action-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 10px;
  flex: 0 0 28px;
}

[data-theme="light"] .modal-action-btn {
  background: #ffffff;
  color: var(--text-secondary);
  border-color: rgba(212,216,224,0.9);
}

[data-theme="light"] .modal-action-btn:hover {
  background: #f5f7fb;
  color: var(--text-primary);
}

#todo-refresh-btn {
  border-radius: 999px !important;
  aspect-ratio: 1 / 1;
  padding: 0 !important;
}

#todo-refresh-btn svg {
  flex: 0 0 auto;
}

.inline-action-btn {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(148,163,184,0.28);
  background: rgba(248,250,252,0.9);
  color: #64748b;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.inline-action-btn:hover {
  background: rgba(255,255,255,0.98);
  color: #334155;
  border-color: rgba(148,163,184,0.34);
}

.inline-action-btn:active {
  transform: translateY(0.5px);
}

.inline-action-btn.is-danger,
.inline-action-btn.fp-delete-btn {
  color: #dc2626;
}

.inline-action-btn.is-danger:hover,
.inline-action-btn.fp-delete-btn:hover {
  background: rgba(254,242,242,0.95);
  color: #dc2626;
  border-color: rgba(248,113,113,0.35);
}

/* Info strip chips */
[data-theme="light"] .strip-chip {
  background: #ffffff;
  border-color: var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
[data-theme="light"] .strip-chip:hover {
  background: #f5f5f5;
  border-color: var(--border-glow);
  box-shadow: none;
}
/* Override .middle-status-bar .strip-chip specificity */
[data-theme="light"] .middle-status-bar .strip-chip {
  background: #ffffff;
  border-color: var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
[data-theme="light"] .middle-status-bar .strip-chip:hover {
  background: #f5f5f5;
  border-color: var(--border-glow);
  box-shadow: none;
}

/* Cards: white with soft shadow, no neon glow */
[data-theme="light"] .card,
[data-theme="light"] .widget {
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: none;
}
[data-theme="light"] .card:hover,
[data-theme="light"] .widget:hover {
  border-color: rgba(74,108,247,0.2);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08), 0 0 0 1px var(--border);
}
[data-theme="light"] .card.card-core {
  border-color: rgba(74,108,247,0.12);
}
[data-theme="light"] .card.card-core:hover {
  border-color: rgba(74,108,247,0.25);
  box-shadow: 0 4px 20px rgba(74,108,247,0.08), 0 0 0 1px var(--border);
}
[data-theme="light"] .card.card-activity {
  box-shadow: var(--shadow);
}

/* Card header: light separator */
[data-theme="light"] .card-header {
  background: rgba(245,245,245,0.5);
  border-bottom: 1px solid var(--border);
}

/* Scrollbar: hidden globally for dashboard cards */
.scroll-y {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scroll-y::-webkit-scrollbar {
  display: none;
}

* { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior: smooth; }
html {
  overflow-x: hidden;
  width: 100%;
  height: 100%;
  scrollbar-gutter: stable;
}
body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  width: 100%;
  height: 100%;
  -webkit-overflow-scrolling: touch;
  /* Asymmetric ambient glow: large top-left blue + small bottom-right cyan */
  background-image:
    radial-gradient(ellipse 90% 60% at 10% 5%, rgba(110,140,255,0.08) 0%, transparent 55%),
    radial-gradient(ellipse 40% 30% at 92% 88%, rgba(0,245,212,0.05) 0%, transparent 50%),
    radial-gradient(ellipse 35% 25% at 60% 40%, rgba(155,140,255,0.03) 0%, transparent 60%);
  background-attachment: fixed;
}

/* ===== Staggered Reveal Animations ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.animate-item {
  opacity: 0;
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: calc(var(--delay, 0) * 0.12s);
}
/* 动画完成后由 JS 移除 animate-item 类，此处确保最终状态 */
.grid-stack-item:not(.animate-item) {
  opacity: 1;
  transform: none;
}
.top-bar {
  animation: slideDown 0.5s ease forwards;
}

/* ===== Top Bar ===== */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background:
    linear-gradient(135deg, rgba(18,21,42,0.72) 0%, rgba(30,34,64,0.68) 40%, rgba(22,25,50,0.74) 100%);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  border-image: linear-gradient(90deg, transparent 5%, var(--accent-blue), var(--accent-purple), var(--accent-cyan), transparent 95%) 1;
  position: sticky;
  will-change: transform;
  top: 0;
  z-index: 100;
  gap: 16px;
  box-shadow: 0 4px 30px rgba(0,0,0,0.3), 0 1px 0 rgba(110,140,255,0.06) inset;
}
/* Subtle top-edge highlight for depth */
.top-bar::before {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(110,140,255,0.15), rgba(155,140,255,0.1), transparent);
  pointer-events: none;
}
.top-bar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
}
.top-bar-left h1 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  white-space: nowrap;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
  filter: drop-shadow(0 0 12px rgba(92,224,216,0.2));
  cursor: help;
  user-select: none;
}

.dashboard-help-modal {
  --help-backdrop: rgba(2, 6, 23, 0.58);
  --help-dialog-border: rgba(71, 85, 105, 0.48);
  --help-dialog-bg: linear-gradient(180deg, rgba(15, 23, 42, 0.99), rgba(10, 15, 28, 0.99));
  --help-dialog-shadow: 0 30px 82px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --help-header-border: rgba(71, 85, 105, 0.42);
  --help-header-bg: linear-gradient(180deg, rgba(17, 24, 39, 0.98), rgba(15, 23, 42, 0.94));
  --help-content-bg: rgba(10, 15, 28, 0.24);
  --help-tabs-bg: rgba(15, 23, 42, 0.62);
  --help-tabs-border: rgba(71, 85, 105, 0.38);
  --help-title: #e2e8f0;
  --help-heading: #f8fafc;
  --help-text: #cbd5e1;
  --help-muted: #94a3b8;
  --help-list: #b6c2d2;
  --help-tab-bg: rgba(30, 41, 59, 0.62);
  --help-tab-border: rgba(71, 85, 105, 0.48);
  --help-tab-text: #cbd5e1;
  --help-tab-active-bg: rgba(37, 99, 235, 0.24);
  --help-tab-active-border: rgba(96, 165, 250, 0.52);
  --help-tab-active-text: #dbeafe;
  --help-card-bg: rgba(15, 23, 42, 0.58);
  --help-card-border: rgba(71, 85, 105, 0.38);
  --help-kicker-bg: rgba(20, 184, 166, 0.12);
  --help-kicker-border: rgba(45, 212, 191, 0.28);
  --help-kicker-text: #99f6e4;
  --help-code-bg: rgba(2, 6, 23, 0.38);
  --help-code-border: rgba(96, 165, 250, 0.22);
  --help-code-text: #bfdbfe;
  --help-empty-bg: rgba(127, 29, 29, 0.16);
  --help-empty-border: rgba(248, 113, 113, 0.32);
  --help-empty-text: #fecaca;
  --help-scrollbar-thumb: rgba(148, 163, 184, 0.32);
  --help-scrollbar-thumb-hover: rgba(148, 163, 184, 0.48);
  position: fixed;
  inset: 0;
  z-index: 2600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}

.dashboard-help-modal.hidden {
  display: none;
}

.dashboard-help-backdrop {
  position: absolute;
  inset: 0;
  background: var(--help-backdrop);
  backdrop-filter: blur(12px) saturate(1.08);
  -webkit-backdrop-filter: blur(12px) saturate(1.08);
}

.dashboard-help-dialog {
  position: relative;
  width: min(1080px, calc(100vw - 34px));
  height: min(86vh, 820px);
  min-height: min(620px, calc(100vh - 44px));
  max-height: calc(100vh - 44px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--help-dialog-border);
  border-radius: 16px;
  background: var(--help-dialog-bg);
  color: var(--text-primary);
  box-shadow: var(--help-dialog-shadow);
  opacity: 0;
  transform: translateY(10px) scale(0.985);
  transition: opacity .18s ease, transform .18s ease;
}

.dashboard-help-modal.is-open .dashboard-help-dialog {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.dashboard-help-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--help-header-border);
  background: var(--help-header-bg);
}

.dashboard-help-eyebrow {
  margin-bottom: 5px;
  color: var(--accent-cyan);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .08em;
}

.dashboard-help-header h2 {
  margin: 0;
  color: var(--help-title);
  font-size: 20px;
  line-height: 1.2;
}

.dashboard-help-header p {
  margin: 7px 0 0;
  color: var(--help-muted);
  font-size: 12px;
  line-height: 1.5;
}

.dashboard-help-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  overflow: hidden;
}

.dashboard-help-tabs {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 14px;
  border-right: 1px solid var(--help-tabs-border);
  background: var(--help-tabs-bg);
  overflow-y: auto;
}

.dashboard-help-tab {
  width: 100%;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--help-tab-border);
  border-radius: 8px;
  background: var(--help-tab-bg);
  color: var(--help-tab-text);
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.dashboard-help-tab:hover,
.dashboard-help-tab.is-active {
  border-color: var(--help-tab-active-border);
  background: var(--help-tab-active-bg);
  color: var(--help-tab-active-text);
}

.dashboard-help-content {
  min-height: 0;
  height: 100%;
  overflow: auto;
  padding: 18px 20px 22px;
  background: var(--help-content-bg);
  scrollbar-width: thin;
  scrollbar-color: var(--help-scrollbar-thumb) transparent;
}

.dashboard-help-content::-webkit-scrollbar,
.dashboard-help-tabs::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.dashboard-help-content::-webkit-scrollbar-track,
.dashboard-help-tabs::-webkit-scrollbar-track {
  background: transparent;
}

.dashboard-help-content::-webkit-scrollbar-thumb,
.dashboard-help-tabs::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--help-scrollbar-thumb);
}

.dashboard-help-content::-webkit-scrollbar-thumb:hover,
.dashboard-help-tabs::-webkit-scrollbar-thumb:hover {
  background: var(--help-scrollbar-thumb-hover);
}

.dashboard-help-content::-webkit-scrollbar-corner,
.dashboard-help-tabs::-webkit-scrollbar-corner {
  background: transparent;
}

.dashboard-help-content-head {
  margin-bottom: 16px;
}

.dashboard-help-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid var(--help-kicker-border);
  border-radius: 999px;
  background: var(--help-kicker-bg);
  color: var(--help-kicker-text);
  font-size: 11px;
  font-weight: 850;
}

.dashboard-help-content h3 {
  margin: 10px 0 8px;
  color: var(--help-heading);
  font-size: 20px;
  line-height: 1.25;
}

.dashboard-help-content p {
  margin: 0;
  color: var(--help-text);
  font-size: 13px;
  line-height: 1.65;
}

.dashboard-help-section,
.dashboard-help-card {
  border: 1px solid var(--help-card-border);
  border-radius: 10px;
  background: var(--help-card-bg);
}

.dashboard-help-section {
  padding: 14px 15px;
  margin-top: 12px;
}

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

.dashboard-help-card {
  padding: 13px 14px;
}

.dashboard-help-section h4,
.dashboard-help-card h4 {
  margin: 0 0 9px;
  color: var(--help-title);
  font-size: 14px;
  line-height: 1.35;
}

.dashboard-help-list {
  margin: 0;
  padding-left: 18px;
  color: var(--help-list);
  font-size: 12px;
  line-height: 1.72;
}

.dashboard-help-list li + li {
  margin-top: 4px;
}

.dashboard-help-content code {
  display: inline-flex;
  max-width: 100%;
  padding: 1px 5px;
  border: 1px solid var(--help-code-border);
  border-radius: 6px;
  background: var(--help-code-bg);
  color: var(--help-code-text);
  font-family: var(--font-mono);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.dashboard-help-examples {
  display: grid;
  gap: 8px;
}

.dashboard-help-examples code {
  display: block;
  padding: 8px 10px;
}

.dashboard-help-empty {
  padding: 24px;
  border: 1px solid var(--help-empty-border);
  border-radius: 10px;
  background: var(--help-empty-bg);
  color: var(--help-empty-text);
  font-size: 13px;
}

body.dashboard-help-open {
  overflow: hidden;
}

html[data-theme="light"] .dashboard-help-modal {
  --help-backdrop: rgba(15, 23, 42, 0.36);
  --help-dialog-border: rgba(203, 213, 225, 0.96);
  --help-dialog-bg: linear-gradient(180deg, #ffffff, #f8fafc);
  --help-dialog-shadow: 0 28px 72px rgba(15, 23, 42, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.95);
  --help-header-border: rgba(203, 213, 225, 0.86);
  --help-header-bg: #ffffff;
  --help-content-bg: #f8fafc;
  --help-tabs-bg: #f1f5f9;
  --help-tabs-border: rgba(203, 213, 225, 0.88);
  --help-title: #0f172a;
  --help-heading: #0f172a;
  --help-text: #475569;
  --help-muted: #64748b;
  --help-list: #475569;
  --help-tab-bg: #ffffff;
  --help-tab-border: rgba(203, 213, 225, 0.96);
  --help-tab-text: #334155;
  --help-tab-active-bg: #eff6ff;
  --help-tab-active-border: rgba(37, 99, 235, 0.42);
  --help-tab-active-text: #1d4ed8;
  --help-card-bg: #ffffff;
  --help-card-border: rgba(203, 213, 225, 0.88);
  --help-kicker-bg: #ecfdf5;
  --help-kicker-border: rgba(13, 148, 136, 0.28);
  --help-kicker-text: #0f766e;
  --help-code-bg: #eef2ff;
  --help-code-border: rgba(37, 99, 235, 0.20);
  --help-code-text: #1e40af;
  --help-scrollbar-thumb: rgba(100, 116, 139, 0.24);
  --help-scrollbar-thumb-hover: rgba(100, 116, 139, 0.42);
}

html[data-theme="light"][data-theme-variant="warm"] .dashboard-help-modal {
  --help-backdrop: rgba(83, 52, 30, 0.34);
  --help-dialog-border: rgba(229, 212, 197, 0.98);
  --help-dialog-bg: linear-gradient(180deg, #fffdf9, #fff7ed);
  --help-header-border: rgba(229, 212, 197, 0.94);
  --help-header-bg: #fffaf4;
  --help-content-bg: #fff7ed;
  --help-tabs-bg: #f8ede2;
  --help-title: #2f241d;
  --help-heading: #2f241d;
  --help-text: #6b5548;
  --help-muted: #8f735f;
  --help-list: #755f50;
  --help-tab-bg: #fffaf4;
  --help-tab-border: rgba(229, 212, 197, 0.98);
  --help-tab-text: #6f5748;
  --help-tab-active-bg: #ffedd5;
  --help-tab-active-border: rgba(199, 118, 74, 0.42);
  --help-tab-active-text: #b45309;
  --help-card-bg: #fffaf4;
  --help-card-border: rgba(229, 212, 197, 0.94);
  --help-kicker-bg: #fff1e2;
  --help-kicker-border: rgba(199, 118, 74, 0.28);
  --help-kicker-text: #9a3412;
  --help-code-bg: #ffedd5;
  --help-code-border: rgba(199, 118, 74, 0.24);
  --help-code-text: #9a3412;
}

html[data-theme="light"][data-theme-variant="cool"] .dashboard-help-modal {
  --help-backdrop: rgba(15, 61, 82, 0.34);
  --help-dialog-border: rgba(205, 221, 234, 0.98);
  --help-dialog-bg: linear-gradient(180deg, #ffffff, #edf7fc);
  --help-header-border: rgba(205, 221, 234, 0.94);
  --help-header-bg: #fafdff;
  --help-content-bg: #edf5fb;
  --help-tabs-bg: #eaf3f9;
  --help-title: #102534;
  --help-heading: #102534;
  --help-text: #536d80;
  --help-muted: #6f899c;
  --help-list: #5b7487;
  --help-tab-bg: #fafdff;
  --help-tab-border: rgba(205, 221, 234, 0.98);
  --help-tab-text: #455f72;
  --help-tab-active-bg: #e0f2fe;
  --help-tab-active-border: rgba(8, 145, 178, 0.40);
  --help-tab-active-text: #0e7490;
  --help-card-bg: #fafdff;
  --help-card-border: rgba(205, 221, 234, 0.94);
  --help-kicker-bg: #ecfeff;
  --help-kicker-border: rgba(8, 145, 178, 0.28);
  --help-kicker-text: #0f766e;
  --help-code-bg: #e0f2fe;
  --help-code-border: rgba(8, 145, 178, 0.22);
  --help-code-text: #075985;
}

html[data-theme="light"][data-theme-variant="contrast"] .dashboard-help-modal {
  --help-backdrop: rgba(2, 6, 23, 0.50);
  --help-dialog-border: rgba(100, 116, 139, 0.62);
  --help-dialog-bg: linear-gradient(180deg, #ffffff, #f1f5f9);
  --help-header-border: rgba(100, 116, 139, 0.46);
  --help-tabs-border: rgba(100, 116, 139, 0.42);
  --help-card-border: rgba(100, 116, 139, 0.38);
  --help-tab-border: rgba(100, 116, 139, 0.46);
  --help-tab-active-bg: #dbeafe;
  --help-tab-active-border: rgba(37, 99, 235, 0.58);
  --help-tab-active-text: #1e3a8a;
}

html[data-theme="dark"][data-theme-variant="midnight"] .dashboard-help-modal {
  --help-backdrop: rgba(2, 8, 23, 0.64);
  --help-dialog-border: rgba(32, 58, 92, 0.72);
  --help-dialog-bg: linear-gradient(180deg, rgba(9, 20, 38, 0.99), rgba(5, 13, 28, 0.99));
  --help-header-border: rgba(32, 58, 92, 0.60);
  --help-header-bg: linear-gradient(180deg, rgba(13, 26, 45, 0.98), rgba(9, 20, 38, 0.94));
  --help-content-bg: rgba(5, 13, 28, 0.30);
  --help-tabs-bg: rgba(9, 20, 38, 0.70);
  --help-title: #e6f0ff;
  --help-heading: #f5f9ff;
  --help-text: #c5d5ee;
  --help-muted: #90a7c7;
  --help-list: #b0c2dd;
  --help-tab-bg: rgba(18, 34, 58, 0.72);
  --help-tab-border: rgba(48, 78, 120, 0.58);
  --help-tab-active-bg: rgba(59, 130, 246, 0.24);
  --help-tab-active-border: rgba(125, 183, 255, 0.54);
  --help-card-bg: rgba(9, 20, 38, 0.64);
  --help-card-border: rgba(32, 58, 92, 0.58);
}

html[data-theme="dark"][data-theme-variant="amoled"] .dashboard-help-modal {
  --help-backdrop: rgba(0, 0, 0, 0.72);
  --help-dialog-border: rgba(148, 163, 184, 0.20);
  --help-dialog-bg: linear-gradient(180deg, rgba(5, 6, 8, 0.99), rgba(0, 0, 0, 0.99));
  --help-dialog-shadow: 0 30px 82px rgba(0, 0, 0, 0.78), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --help-header-border: rgba(148, 163, 184, 0.18);
  --help-header-bg: linear-gradient(180deg, rgba(10, 12, 16, 0.98), rgba(5, 6, 8, 0.94));
  --help-content-bg: rgba(0, 0, 0, 0.28);
  --help-tabs-bg: rgba(5, 6, 8, 0.82);
  --help-card-bg: rgba(5, 6, 8, 0.74);
  --help-card-border: rgba(148, 163, 184, 0.16);
  --help-tab-bg: rgba(10, 12, 16, 0.82);
  --help-tab-border: rgba(148, 163, 184, 0.18);
  --help-tab-active-bg: rgba(34, 245, 212, 0.12);
  --help-tab-active-border: rgba(101, 230, 223, 0.42);
  --help-tab-active-text: #ccfbf1;
}

html[data-theme="dark"][data-theme-variant="indigo"] .dashboard-help-modal {
  --help-backdrop: rgba(13, 8, 28, 0.66);
  --help-dialog-border: rgba(82, 64, 135, 0.70);
  --help-dialog-bg: linear-gradient(180deg, rgba(26, 21, 48, 0.99), rgba(18, 13, 31, 0.99));
  --help-header-border: rgba(82, 64, 135, 0.58);
  --help-header-bg: linear-gradient(180deg, rgba(35, 28, 63, 0.98), rgba(26, 21, 48, 0.94));
  --help-content-bg: rgba(18, 13, 31, 0.30);
  --help-tabs-bg: rgba(26, 21, 48, 0.70);
  --help-title: #efe8ff;
  --help-heading: #f7f0ff;
  --help-text: #d5caef;
  --help-muted: #a798cf;
  --help-list: #c2b6df;
  --help-tab-bg: rgba(35, 28, 63, 0.72);
  --help-tab-border: rgba(82, 64, 135, 0.56);
  --help-tab-active-bg: rgba(167, 139, 250, 0.22);
  --help-tab-active-border: rgba(177, 140, 255, 0.54);
  --help-card-bg: rgba(26, 21, 48, 0.64);
  --help-card-border: rgba(82, 64, 135, 0.54);
  --help-kicker-bg: rgba(115, 223, 255, 0.10);
  --help-kicker-border: rgba(115, 223, 255, 0.24);
  --help-kicker-text: #c4b5fd;
  --help-code-bg: rgba(18, 13, 31, 0.48);
  --help-code-border: rgba(177, 140, 255, 0.26);
  --help-code-text: #ddd6fe;
}

@media (max-width: 760px) {
  .dashboard-help-modal {
    padding: 10px;
    align-items: stretch;
  }

  .dashboard-help-dialog {
    width: 100%;
    height: calc(100vh - 20px);
    min-height: 0;
    max-height: calc(100vh - 20px);
    border-radius: 14px;
  }

  .dashboard-help-header {
    padding: 15px 14px 13px;
  }

  .dashboard-help-header h2 {
    font-size: 18px;
  }

  .dashboard-help-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .dashboard-help-tabs {
    flex-direction: row;
    overflow-x: auto;
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid var(--help-tabs-border);
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.30) transparent;
  }

  .dashboard-help-tab {
    width: auto;
    flex: 0 0 auto;
    min-width: 76px;
    text-align: center;
  }

  .dashboard-help-content {
    padding: 15px 13px 18px;
  }

  .dashboard-help-card-grid {
    grid-template-columns: 1fr;
  }
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green), 0 0 16px rgba(74,227,168,0.3);
  animation: statusBreath 2.2s ease-in-out infinite;
  transition: background 0.5s, box-shadow 0.5s;
  transform-origin: center;
}
/* ===== Health Dropdown Panel ===== */
.health-panel-backdrop {
  display: none;
}
.health-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 10px;
  margin-top: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px var(--border);
  padding: 14px 16px;
  min-width: 340px;
  width: min(420px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: min(80vh, 720px);
  overflow-y: auto;
  overflow-x: hidden;
  -ms-overflow-style: none;
  scrollbar-width: none !important;
  scrollbar-color: transparent transparent;
  z-index: 1300;
  font-size: 12px;
  color: var(--text-primary);
  animation: panelSlideDown 0.2s ease;
}

.health-panel,
.health-panel * {
  scrollbar-width: none;
}

.health-panel::-webkit-scrollbar,
.health-panel::-webkit-scrollbar:vertical,
.health-panel::-webkit-scrollbar:horizontal {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
  background: transparent;
}

.health-panel::-webkit-scrollbar-thumb,
.health-panel::-webkit-scrollbar-track,
.health-panel::-webkit-scrollbar-corner {
  background: transparent;
}
.health-panel.is-refreshing .hp-overall-badge::after {
  content: '更新中';
  display: inline-flex;
  align-items: center;
  min-height: 16px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--accent-blue) 12%, transparent);
}
@keyframes panelSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes statusBreath {
  0%, 100% {
    transform: scale(1);
    opacity: 0.88;
    box-shadow: 0 0 8px var(--accent-green), 0 0 16px rgba(74,227,168,0.22);
  }
  50% {
    transform: scale(1.18);
    opacity: 1;
    box-shadow: 0 0 12px var(--accent-green), 0 0 28px rgba(74,227,168,0.52);
  }
}
/* ── 总体状态行 ── */
.hp-overall {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.hp-overall-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.hp-overall-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-secondary);
}
.hp-status-icon,
.hp-meta-icon {
  flex: 0 0 auto;
  color: var(--accent-green);
}
.hp-status-icon {
  width: 15px;
  height: 15px;
}
.hp-meta-icon {
  width: 12px;
  height: 12px;
}
.hp-status-icon.tone-warn,
.hp-meta-icon.tone-warn {
  color: var(--accent-yellow);
}
.hp-status-icon.tone-alert,
.hp-meta-icon.tone-alert {
  color: var(--accent-red);
}
.hp-meta-network {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.hp-meta-separator {
  color: var(--text-muted);
  opacity: 0.72;
}
/* ── 分组标题 ── */
.hp-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 8px 0 4px 0;
}
.hp-group-label:first-of-type { margin-top: 0; }
.hp-group-label-with-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.hp-group-summary {
  font-size: 10px;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text-secondary);
  font-weight: 600;
}
/* ── 分组网格 ── */
.hp-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 6px;
}
/* ── 单个数据源卡片 ── */
.hp-card {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid transparent;
  transition: border-color 0.2s;
}
.hp-card:hover { border-color: var(--border); }
.hp-card .hp-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.hp-card .hp-dot.green { background: var(--accent-green); box-shadow: 0 0 4px var(--accent-green); }
.hp-card .hp-dot.yellow { background: var(--accent-yellow); box-shadow: 0 0 4px var(--accent-yellow); }
.hp-card .hp-dot.red { background: var(--accent-red); box-shadow: 0 0 4px var(--accent-red); }
.hp-card .hp-dot.gray { background: var(--text-muted); }
.hp-card-info {
  flex: 1;
  min-width: 0;
}
.hp-card-name {
  font-size: 11px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hp-card-time {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}
.hp-stale-tag {
  font-size: 9px;
  color: var(--accent-yellow);
  font-weight: 600;
  white-space: nowrap;
}
/* ── Cron 区域 ── */
.hp-jobs {
  border-top: 1px solid var(--border);
  margin-top: 10px;
  padding-top: 10px;
}
.hp-cron-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
}
.hp-script-list {
  grid-template-columns: 1fr;
}
.hp-cron-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 7px 8px;
  border-radius: 8px;
  background: var(--bg-surface);
  font-size: 11px;
  min-width: 0;
}
.hp-cron-item .hp-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.hp-cron-item .hp-dot.green { background: var(--accent-green); box-shadow: 0 0 3px var(--accent-green); }
.hp-cron-item .hp-dot.yellow { background: var(--accent-yellow); box-shadow: 0 0 3px var(--accent-yellow); }
.hp-cron-item .hp-dot.red { background: var(--accent-red); box-shadow: 0 0 3px var(--accent-red); }
.hp-cron-item .hp-dot.gray { background: var(--text-muted); }
.hp-cron-main {
  flex: 1;
  min-width: 0;
}
.hp-cron-top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.hp-cron-name {
  flex: 1;
  color: var(--text-primary);
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hp-cron-kind {
  flex-shrink: 0;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
}
.hp-cron-meta {
  margin-top: 3px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  color: var(--text-muted);
  font-size: 10px;
}
.hp-cron-age { color: var(--text-secondary); font-size: 10px; }
.hp-cron-reason {
  color: var(--text-muted);
  font-size: 10px;
  margin-top: 2px;
  line-height: 1.35;
}
.hp-cron-err { color: var(--accent-red); font-size: 10px; margin-top: 2px; }
/* ── Light theme overrides ── */
[data-theme="light"] .health-panel {
  background: var(--bg-card);
  border-color: var(--border);
  box-shadow: 0 8px 32px rgba(0,0,0,0.15), 0 0 0 1px var(--border);
}
[data-theme="light"] .hp-card { background: var(--bg-surface); }
[data-theme="light"] .hp-cron-item { background: var(--bg-surface); }
[data-theme="light"] .hp-cron-kind {
  background: rgba(15, 23, 42, 0.06);
  color: var(--text-secondary);
}
/* ===== Stale / Fallback Indicators ===== */
.stale-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--accent-yellow);
  color: #1a1a2e;
  font-weight: 600;
  margin-left: 8px;
  vertical-align: middle;
  animation: fadeIn 0.3s ease;
}
[data-theme="light"] .stale-badge {
  background: var(--accent-orange);
  color: #fff;
}
.notice-stale {
  display: inline-block;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 6px;
  background: var(--accent-yellow);
  color: #1a1a2e;
  font-weight: 600;
  margin-left: 4px;
}
[data-theme="light"] .notice-stale {
  background: var(--accent-orange);
  color: #fff;
}
.cache-fallback-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 18px;
  min-width: 18px;
  max-width: 18px;
  height: 18px;
  min-height: 18px;
  max-height: 18px;
  aspect-ratio: 1 / 1;
  padding: 0;
  line-height: 1;
  margin-left: 7px;
  border: 1px solid rgba(245, 158, 11, 0.58);
  border-radius: 999px;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.13);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.08), 0 4px 12px rgba(245, 158, 11, 0.13);
  vertical-align: middle;
  pointer-events: auto;
  animation: fadeIn 0.22s ease;
}
.cache-fallback-indicator svg {
  flex: 0 0 13px;
  width: 13px;
  min-width: 13px;
  max-width: 13px;
  height: 13px;
  min-height: 13px;
  max-height: 13px;
  aspect-ratio: 1 / 1;
  display: block;
}
[data-theme="light"] .cache-fallback-indicator,
html[data-theme="light"] .cache-fallback-indicator {
  color: #b45309;
  background: rgba(251, 191, 36, 0.18);
  border-color: rgba(217, 119, 6, 0.45);
  box-shadow: 0 0 0 1px rgba(217, 119, 6, 0.08), 0 4px 12px rgba(217, 119, 6, 0.1);
}
.header-weather .cache-fallback-indicator,
.xiaomi-hotsearch-header .cache-fallback-indicator {
  margin-left: 6px;
  transform: translateY(1px);
}
.mobile-home-summary-card__header .cache-fallback-indicator,
.mobile-home-manage-card__title-row .cache-fallback-indicator,
.mobile-home-hotsearch__title-row .cache-fallback-indicator,
.mobile-home-hero__weather .cache-fallback-indicator {
  width: 17px;
  min-width: 17px;
  max-width: 17px;
  height: 17px;
  min-height: 17px;
  max-height: 17px;
  margin-left: 6px;
}
.mobile-home-summary-card__header > div {
  min-width: 0;
}
.mobile-home-summary-card__header h3,
.mobile-home-hotsearch__title-row,
.mobile-home-manage-card__title-row,
.mobile-home-hero__weather-main,
.mobile-home-hero__weather-backhead {
  min-width: 0;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
/* ===== Header Weather (inline) ===== */
.header-weather {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 4px;
  padding: 3px 10px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: default;
  position: relative;
  margin-left: 4px;
  flex: 1 1 560px;
  min-width: 0;
  max-width: clamp(380px, calc(100vw - 620px), 660px);
}
.header-weather-icon {
  font-size: 20px;
  line-height: 1;
}
.header-weather-temp {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  margin-right: 2px;
}
.header-weather-desc {
  color: var(--text-secondary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 2px;
}
.header-weather-notice {
  font-size: 11px;
  flex: 1 1 100%;
  min-width: 0;
  max-width: 100%;
  order: 4;
  margin-top: 0;
  text-align: left;
  white-space: normal;
  line-height: 1.4;
  display: inline-flex;
  align-items: center;
  align-content: center;
  flex-wrap: wrap;
  gap: 4px;
  overflow: visible;
}
.header-weather-notice .notice-tip,
.header-weather-notice .notice-minutely,
.header-weather-notice .notice-hourly {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-width: 0;
  max-width: none;
  padding: 1px 7px;
  border-radius: 999px;
  line-height: 1.35;
  color: rgba(232, 238, 248, 0.9);
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.08);
  white-space: nowrap;
  overflow: visible;
  text-overflow: unset;
  overflow-wrap: normal;
}
.header-weather-notice .notice-minutely {
  background: rgba(92, 224, 216, 0.09);
  border-color: rgba(92, 224, 216, 0.14);
}
.header-weather-notice .notice-hourly {
  background: rgba(110, 140, 255, 0.09);
  border-color: rgba(110, 140, 255, 0.14);
}
.header-weather-loc {
  color: var(--text-muted);
  font-size: 12px;
  margin-left: 2px;
  flex: 0 1 72px;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.header-weather-tip {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 420px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 0;
  border-radius: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: 0 22px 48px rgba(0,0,0,0.28), 0 0 0 1px rgba(255,255,255,0.03);
  z-index: 999;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.55;
  overflow: hidden;
}
.header-weather:hover .header-weather-tip,
.header-weather.is-tip-pinned .header-weather-tip {
  display: block;
  animation: fadeInUp .2s ease;
}

.weather-tip-panel {
  padding: 12px 14px 10px;
}

.weather-tip-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.weather-tip-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.weather-tip-title-wrap {
  min-width: 0;
}

.weather-tip-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.weather-tip-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  min-width: 0;
}

.weather-tip-pin-badge {
  display: none;
  flex: 0 0 auto;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: rgba(255,255,255,0.72);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.08);
}

.header-weather.is-tip-pinned .weather-tip-pin-badge {
  display: inline-flex;
  align-items: center;
}

.weather-tip-subtitle {
  margin-top: 3px;
  font-size: 10.5px;
  color: rgba(124, 128, 168, 0.9);
  line-height: 1.35;
}

.weather-tip-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.weather-tip-status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
}

.weather-tip-status-chip.is-stale {
  background: rgba(255, 214, 102, 0.12);
  border-color: rgba(255, 214, 102, 0.24);
  color: var(--accent-yellow);
}

.weather-tip-status-chip.is-low {
  color: #8fd7be;
  border-color: rgba(83,220,166,0.18);
  background: rgba(83,220,166,0.08);
}

.weather-tip-status-chip.is-medium {
  color: #ffd36e;
  border-color: rgba(255,199,106,0.22);
  background: rgba(255,199,106,0.1);
}

.weather-tip-status-chip.is-high {
  color: #ff9cab;
  border-color: rgba(255,133,150,0.22);
  background: rgba(255,133,150,0.1);
}

.weather-tip-header-merged {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 11px;
  border-radius: 13px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}

.weather-tip-header-merged.is-medium {
  border-color: rgba(255,199,106,0.22);
}

.weather-tip-header-merged.is-high {
  border-color: rgba(255,133,150,0.22);
}

.weather-tip-header-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  max-width: 38%;
  flex: 0 0 auto;
}

.weather-tip-highlight-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  max-width: 100%;
}

.weather-tip-highlight-chip,
.weather-tip-reminder-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
}

.weather-tip-highlight-chip.is-low,
.weather-tip-reminder-tag.is-low {
  color: #8fd7be;
  border-color: rgba(83,220,166,0.18);
}

.weather-tip-highlight-chip.is-medium,
.weather-tip-reminder-tag.is-medium {
  color: #ffd36e;
  border-color: rgba(255,199,106,0.22);
}

.weather-tip-highlight-chip.is-high,
.weather-tip-reminder-tag.is-high {
  color: #ff9cab;
  border-color: rgba(255,133,150,0.22);
}

.weather-tip-reminders {
  margin-bottom: 10px;
}

.weather-tip-reminder-list {
  display: grid;
  gap: 6px;
}

.weather-tip-reminder-item {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.weather-tip-reminder-text {
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-secondary);
}


.weather-tip-forecast-block {
  margin-bottom: 2px;
}

.weather-tip-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.weather-tip-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  min-width: 0;
  padding: 7px 8px 6px;
  border-radius: 10px;
  background: rgba(255,255,255,0.028);
  border: 1px solid rgba(255,255,255,0.045);
  text-align: left;
}

.weather-tip-card.is-medium {
  border-color: rgba(255,199,106,0.16);
}

.weather-tip-card.is-high {
  border-color: rgba(255,133,150,0.18);
}

.weather-tip-card.is-today {
  background: color-mix(in srgb, var(--accent-blue) 11%, rgba(255,255,255,0.028));
  border-color: color-mix(in srgb, var(--accent-blue) 62%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-blue) 18%, transparent);
}

.weather-tip-card-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  text-align: center;
}

.weather-tip-day {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.15;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.weather-tip-day.is-today {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.weather-tip-date {
  display: none;
}

.weather-tip-icon {
  display: none;
}

.weather-tip-weather {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  max-width: 100%;
  min-width: 0;
}

.weather-tip-weather-icon {
  flex: 0 0 auto;
  font-size: 13px;
  line-height: 1;
}

.weather-tip-text {
  display: inline-block;
  font-size: 10px;
  line-height: 1.25;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.weather-tip-summary {
  display: none;
}

.weather-tip-grid {
  position: relative;
  align-items: stretch;
}

.weather-tip-temp-band {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 5px;
  margin-top: auto;
}

.weather-tip-delta {
  font-size: 10px;
  line-height: 1.2;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.weather-tip-card-detail {
  margin-top: 4px;
  font-size: 10px;
  line-height: 1.3;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="light"] .weather-tip-trend-gridline {
  stroke: rgba(148,163,184,0.3);
}

.weather-tip-temp-band--solo {
  grid-template-columns: 1fr;
  gap: 0;
}

.weather-tip-temp-low,
.weather-tip-temp-high {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.weather-tip-temp-low {
  color: #85c8ff;
  text-shadow: 0 1px 10px rgba(64, 148, 255, 0.16);
}

.weather-tip-temp-high {
  color: #ffbe73;
  text-shadow: 0 1px 10px rgba(255, 172, 85, 0.16);
}

.weather-tip-temp-track {
  position: relative;
  height: 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}

.weather-tip-temp-track.is-empty {
  opacity: 0.4;
}

.weather-tip-temp-range {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(107,183,255,0.94) 0%, rgba(255,172,85,0.96) 100%);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.07), 0 0 12px rgba(107, 183, 255, 0.12);
}

[data-theme="light"] .weather-tip-temp-low {
  color: #3b82f6;
  text-shadow: 0 1px 6px rgba(255,255,255,0.78);
}

[data-theme="light"] .weather-tip-temp-high {
  color: #f59e0b;
  text-shadow: 0 1px 6px rgba(255,255,255,0.78);
}

[data-theme="light"] .weather-tip-temp-track {
  background: rgba(148,163,184,0.26);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5);
}

[data-theme="light"] .weather-tip-temp-range {
  box-shadow: 0 0 0 1px rgba(255,255,255,0.72), 0 0 10px rgba(59,130,246,0.1);
}

[data-theme="light"] .weather-tip-text,
[data-theme="light"] .weather-tip-delta,
[data-theme="light"] .weather-tip-card-detail {
  color: #64748b;
}

[data-theme="light"] .weather-tip-summary {
  color: #0f172a;
}

@media (min-width: 769px) and (max-width: 1180px) {
  .header-weather-tip {
    min-width: min(420px, calc(100vw - 32px));
    max-width: min(640px, calc(100vw - 32px));
  }

  .weather-tip-grid {
    grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  }
}

.weather-tip-empty {
  padding: 18px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px dashed rgba(255,255,255,0.12);
  color: var(--text-muted);
  text-align: center;
}

.weather-tip-meta {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.weather-tip-meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.weather-tip-meta-line,
.weather-tip-meta-chip {
  font-size: 11.5px;
  color: rgba(226, 228, 240, 0.74);
  line-height: 1.45;
}

.weather-tip-meta-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}

.header-weather.is-tip-pinned .header-weather-tip {
  box-shadow: 0 24px 54px rgba(0,0,0,0.32), 0 0 0 1px rgba(255,255,255,0.035), 0 0 0 1px rgba(110,140,255,0.06);
}

[data-theme="light"] .weather-tip-pin-badge {
  color: rgba(15, 23, 42, 0.72);
  background: rgba(74,108,247,0.08);
  border-color: rgba(74,108,247,0.12);
}

[data-theme="light"] .weather-tip-status-chip.is-low,
[data-theme="light"] .weather-tip-highlight-chip.is-low,
[data-theme="light"] .weather-tip-reminder-tag.is-low {
  color: #15803d;
}

[data-theme="light"] .weather-tip-status-chip.is-medium,
[data-theme="light"] .weather-tip-highlight-chip.is-medium,
[data-theme="light"] .weather-tip-reminder-tag.is-medium {
  color: #b45309;
}

[data-theme="light"] .weather-tip-status-chip.is-high,
[data-theme="light"] .weather-tip-highlight-chip.is-high,
[data-theme="light"] .weather-tip-reminder-tag.is-high {
  color: #be123c;
}

[data-theme="light"] .weather-tip-header-merged {
  background: rgba(255,255,255,0.82);
  border-color: rgba(148,163,184,0.16);
}

[data-theme="light"] .weather-tip-reminder-text,
[data-theme="light"] .weather-tip-subtitle {
  color: #475569;
}

[data-theme="light"] .weather-tip-meta-line,
[data-theme="light"] .weather-tip-meta-chip,
[data-theme="light"] .weather-tip-subtitle {
  color: rgba(71, 85, 105, 0.88);
}

[data-theme="light"] .weather-tip-meta-chip {
  background: rgba(255,255,255,0.72);
  border-color: rgba(148,163,184,0.16);
}

[data-theme="light"] .weather-tip-card {
  background: rgba(255,255,255,0.68);
  border-color: rgba(148,163,184,0.14);
}

[data-theme="light"] .weather-tip-card.is-today {
  background: color-mix(in srgb, var(--accent-blue) 8%, rgba(255,255,255,0.78));
  border-color: color-mix(in srgb, var(--accent-blue) 58%, rgba(148,163,184,0.14));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-blue) 16%, transparent);
}

[data-theme="light"] .header-weather.is-tip-pinned .header-weather-tip {
  box-shadow: 0 18px 38px rgba(15,23,42,0.12), 0 0 0 1px rgba(74,108,247,0.08);
}
.weather-sheet-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.42);
  backdrop-filter: blur(6px);
  z-index: 1998;
}
.weather-sheet {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1999;
  background: var(--bg-card);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  border: 1px solid var(--border);
  border-bottom: none;
  box-shadow: 0 -18px 40px rgba(0,0,0,0.28);
  padding: 10px 14px 18px;
  max-height: 72vh;
  transform: translateY(100%);
  transition: transform .22s ease;
}
.weather-sheet.active,
.weather-sheet-backdrop.active {
  display: block;
}
.weather-sheet.active {
  transform: translateY(0);
}
.weather-sheet-handle {
  width: 42px;
  height: 5px;
  border-radius: 999px;
  background: var(--border);
  margin: 2px auto 10px;
}
.weather-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.weather-sheet-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.weather-sheet-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.weather-sheet-subtitle {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
}
.weather-sheet-relocate,
.weather-sheet-close {
  padding: 6px 10px;
}
.weather-sheet-relocate {
  font-size: 13px;
}
.weather-sheet-body {
  overflow-y: auto;
  max-height: calc(72vh - 64px);
  -webkit-overflow-scrolling: touch;
}
.weather-sheet-body .hw-row {
  padding: 10px 0;
}
.hw-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}
.hw-row:last-of-type {
  border-bottom: none;
}
.hw-day {
  display: flex;
  align-items: center;
  gap: 6px;
}
.hw-temp {
  font-variant-numeric: tabular-nums;
}
.hw-tip-text {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}
.top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
}
.top-bar-right .btn-refresh {
  flex: 0 0 auto;
}
.top-bar-right .theme-toggle {
  flex: 0 0 auto;
}
.clock {
  font-size: clamp(16px, 2vw, 24px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  letter-spacing: 0.08em;
  text-shadow: 0 0 16px rgba(92,224,216,0.4), 0 0 4px rgba(92,224,216,0.2);
  padding: 4px clamp(8px, 1.2vw, 14px);
  background: rgba(92,224,216,0.06);
  border: 1px solid rgba(92,224,216,0.1);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  visibility: visible;
  opacity: 1;
  min-height: 1.8em;
}
.clock-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  visibility: visible;
  opacity: 1;
}
.clock-date {
  font-size: clamp(10px, 1.1vw, 12px);
  color: var(--text-secondary);
  padding: 0 clamp(8px, 1.2vw, 14px);
  font-weight: 400;
  min-height: 1.2em;
  text-align: right;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: break-word;
  writing-mode: horizontal-tb;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  visibility: visible;
  opacity: 1;
}
.clock-date[data-mode="compact"] {
  letter-spacing: 0.01em;
}
.btn-icon {
  background: rgba(14,17,34,0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  cursor: pointer;
  font-size: 14px;
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
  color: var(--text-primary);
}
.btn-icon:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-blue);
  box-shadow: 0 0 12px rgba(110,140,255,0.15);
}

/* ===== 中部状态栏 ===== */
.middle-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 24px;
  background: linear-gradient(135deg, rgba(18,21,42,0.8) 0%, rgba(25,30,55,0.8) 100%);
  border-bottom: 1px solid var(--border);
  border-top: 1px solid rgba(255,255,255,0.03);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  animation: slideDown 0.5s ease forwards;
  min-height: 42px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.middle-status-bar::-webkit-scrollbar { display:none; }

body[data-dashboard-tier="phone"] #info-strip.middle-status-bar {
  display: none !important;
}

[data-theme="light"] .middle-status-bar {
  background: linear-gradient(135deg, rgba(240,242,245,0.95) 0%, rgba(230,233,238,0.95) 100%);
}

.middle-status-bar .strip-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  background: rgba(14,17,34,0.7);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.middle-status-bar .strip-chip:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glow);
}
.middle-status-bar .strip-chip .chip-icon { font-size: 14px; }
.middle-status-bar .strip-chip .chip-label { color: var(--text-secondary); }
.middle-status-bar .strip-chip .chip-value { color: var(--text-primary); font-weight: 600; }
.middle-status-bar .strip-chip.chip-ok { border-color: rgba(74,227,168,0.25); }
.middle-status-bar .strip-chip.chip-ok .chip-value { color: var(--accent-green); }
.middle-status-bar .strip-chip.chip-warn { border-color: rgba(255,214,102,0.25); }
.middle-status-bar .strip-chip.chip-warn .chip-value { color: var(--accent-yellow); }
.middle-status-bar .strip-chip.chip-alert { border-color: rgba(255,107,107,0.25); }
.middle-status-bar .strip-chip.chip-alert .chip-value { color: var(--accent-red); }
.middle-status-bar .strip-chip.chip-muted {
  border-color: rgba(148, 163, 184, 0.22);
  opacity: 0.62;
}
.middle-status-bar .strip-chip.chip-muted .chip-value { color: var(--text-secondary); }

/* ── Interactive chip: dismiss, edit, drag ── */
.middle-status-bar .interactive-chip {
  position: relative;
  cursor: grab;
  user-select: none;
}
.middle-status-bar .interactive-chip:active { cursor: grabbing; }
.middle-status-bar .chip-body {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.middle-status-bar .chip-actions {
  position: absolute;
  top: -8px;
  right: -8px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 2;
}
.middle-status-bar .interactive-chip:hover .chip-actions { opacity: 1; }
.middle-status-bar .chip-actions button {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  font-size: 10px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.middle-status-bar .chip-action-icon {
  width: 10px;
  height: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.middle-status-bar .chip-action-icon svg {
  width: 10px;
  height: 10px;
  display: block;
}
.middle-status-bar .chip-close {
  background: rgba(255,107,107,0.85);
  color: #fff;
}
.middle-status-bar .chip-edit {
  background: rgba(99,144,255,0.85);
  color: #fff;
}
.middle-status-bar .interactive-chip.chip-dragging {
  opacity: 0.4;
  transform: scale(0.95);
}
.middle-status-bar .interactive-chip.chip-drag-over {
  border-color: var(--accent-blue) !important;
  box-shadow: 0 0 8px rgba(99,144,255,0.4);
}

/* ── Code Panel ── */
#chip-code-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: min(600px, 90vw);
  max-height: 50vh;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: codePanelIn 0.2s ease;
}
@keyframes codePanelIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.code-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
}
.code-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.code-panel-close {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(255,107,107,0.7);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.code-panel-body {
  flex: 1;
  overflow: auto;
  padding: 12px 14px;
  margin: 0;
  font-family: 'SF Mono', 'Fira Code', 'Menlo', monospace;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre;
  tab-size: 2;
}
.code-panel-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
}
.code-panel-widen {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card-hover);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
}
.code-panel-widen:hover { border-color: var(--accent-blue); color: var(--accent-blue); }
.code-panel-link {
  font-size: 12px;
  color: var(--accent-blue);
  text-decoration: none;
  margin-left: auto;
}
.code-panel-link:hover { text-decoration: underline; }
.middle-status-bar .strip-divider {
  width: 1px;
  height: 20px;
  background: linear-gradient(180deg, transparent, var(--border), transparent);
  flex-shrink: 0;
}

/* Strip collapse: fade + more button on mobile */
.middle-status-bar.strip-collapsed {
  position: relative;
  max-height: 42px;
  overflow: hidden;
}
body[data-dashboard-tier="phone"] .middle-status-bar.strip-collapsed .interactive-chip.is-phone-default-collapsed {
  display: none;
}
body[data-dashboard-tier="phone"] .middle-status-bar .interactive-chip {
  order: var(--phone-expanded-order, 0);
}
body[data-dashboard-tier="phone"] .middle-status-bar.strip-collapsed .interactive-chip {
  order: var(--phone-collapsed-order, var(--phone-expanded-order, 0));
}
.middle-status-bar.strip-collapsed::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 60px;
  background: linear-gradient(90deg, transparent, rgba(18,21,42,0.95));
  pointer-events: none;
  z-index: 2;
}
[data-theme="light"] .middle-status-bar.strip-collapsed::after {
  background: linear-gradient(90deg, transparent, rgba(240,242,245,0.95));
}
.strip-expand-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.strip-expand-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-blue);
  color: var(--text-primary);
}

/* ===== 小米热搜滚动栏 ===== */
/* ===== 小米热搜卡片翻页栏 ===== */
.xiaomi-hotsearch-bar {
  position: relative;
  background: linear-gradient(135deg, rgba(255,103,0,0.06) 0%, rgba(255,153,0,0.06) 100%);
  border-bottom: 1px solid rgba(255,103,0,0.12);
  overflow: hidden;
  padding: 6px 24px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  gap: 12px;
}
.xiaomi-hotsearch-bar::before,
.xiaomi-hotsearch-bar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 12px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.62;
  will-change: opacity, transform, filter;
}
.xiaomi-hotsearch-bar::before {
  top: 0;
  background: linear-gradient(to bottom,
    rgba(255, 120, 18, 0.34) 0%,
    rgba(255, 150, 38, 0.16) 46%,
    rgba(255, 168, 72, 0.05) 72%,
    transparent 100%);
  transform-origin: center top;
  animation: xiaomi-hotsearch-glow-top 6.2s ease-in-out infinite;
}
.xiaomi-hotsearch-bar::after {
  bottom: 0;
  background: linear-gradient(to top,
    rgba(255, 108, 10, 0.22) 0%,
    rgba(255, 146, 32, 0.11) 44%,
    rgba(255, 166, 68, 0.04) 72%,
    transparent 100%);
  transform-origin: center bottom;
  animation: xiaomi-hotsearch-glow-bottom 7.1s ease-in-out infinite;
  animation-delay: -1.8s;
}
.xiaomi-hotsearch-bar > * {
  position: relative;
  z-index: 1;
}
[data-theme="light"] .xiaomi-hotsearch-bar {
  background: linear-gradient(135deg, rgba(248,250,252,0.97) 0%, rgba(250,251,253,0.97) 100%);
  border-bottom-color: rgba(148,163,184,0.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72), inset 0 10px 18px rgba(15,23,42,0.035), inset 0 -10px 18px rgba(15,23,42,0.028);
}
[data-theme="light"] .xiaomi-hotsearch-bar::before,
[data-theme="light"] .xiaomi-hotsearch-bar::after {
  display: none;
}
@keyframes xiaomi-hotsearch-glow-top {
  0%, 100% {
    opacity: 0.44;
    transform: translateY(0) scaleY(0.98);
  }
  50% {
    opacity: 0.7;
    transform: translateY(0) scaleY(1.05);
  }
}
@keyframes xiaomi-hotsearch-glow-bottom {
  0%, 100% {
    opacity: 0.34;
    transform: translateY(0) scaleY(0.97);
  }
  50% {
    opacity: 0.56;
    transform: translateY(0) scaleY(1.04);
  }
}
.xiaomi-hotsearch-header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  flex-shrink: 0;
  min-width: 56px;
  padding: 2px 0;
}
.header-row-top {
  display: flex;
  align-items: center;
  gap: 4px;
}
.header-row-top .bar-icon {
  font-size: 14px;
}
.header-row-top .bar-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}
.header-row-top .bar-label.xiaomi-hotsearch-title-action {
  cursor: pointer;
  border-radius: 6px;
  outline-offset: 3px;
}

.header-row-top .bar-label.xiaomi-hotsearch-title-action:hover {
  color: var(--accent-orange, #ff7a1a);
}
.xiaomi-hotsearch-updated {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  opacity: 0.82;
}
.header-row-bottom {
  display: flex;
  align-items: center;
  gap: 6px;
}
.xiaomi-hotsearch-count {
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(255,103,0,0.1);
  padding: 2px 6px;
  border-radius: 8px;
  white-space: nowrap;
}
.xiaomi-hotsearch-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.xiaomi-hotsearch-page-indicator {
  display: flex;
  gap: 3px;
}
.xiaomi-hotsearch-page-dot {
  width: 5px;
  height: 5px;
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.3;
  transition: opacity 0.3s, transform 0.3s, background 0.3s, width 0.3s, border-radius 0.3s;
  cursor: pointer;
}
.xiaomi-hotsearch-page-dot:hover,
.xiaomi-hotsearch-page-dot:focus-visible {
  opacity: 0.72;
  transform: scale(1.18);
  outline: none;
}
.xiaomi-hotsearch-page-dot.active {
  opacity: 1;
  background: #ff6700;
  height: 12px;
  border-radius: 3px;
  width: 5px;
  transform: none;
}
/* 热搜卡片网格 */
.xiaomi-hotsearch-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
  width: 100%;
  align-items: stretch;
  overflow: hidden;
}
.xiaomi-hotsearch-grid-measure {
  width: auto !important;
  flex: none !important;
  overflow: visible !important;
}
.xiaomi-hotsearch-card-shell {
  position: relative;
  display: inline-flex;
  width: max-content;
  min-width: max-content;
  flex: 0 0 auto;
  overflow: visible;
}
.xiaomi-hotsearch-card-shell .xiaomi-hotsearch-card {
  padding-right: 18px;
}
.xiaomi-hotsearch-card {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  background: rgba(255,103,0,0.04);
  border: 1px solid rgba(255,103,0,0.08);
  border-radius: 8px;
  font-size: 12px;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  min-height: 28px;
  width: max-content;
  min-width: max-content;
  max-width: none;
  flex: 0 0 auto;
  overflow: hidden;
}
.xiaomi-hotsearch-card-delete {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 2;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(255,107,107,0.85);
  color: #fff;
  box-shadow: none;
  opacity: 0;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
  transition: opacity 0.2s;
}
.xiaomi-hotsearch-card-delete .chip-action-icon {
  width: 10px;
  height: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.xiaomi-hotsearch-card-shell:hover .xiaomi-hotsearch-card-delete,
.xiaomi-hotsearch-card-shell:focus-within .xiaomi-hotsearch-card-delete {
  opacity: 1;
  pointer-events: auto;
}
.xiaomi-hotsearch-card-delete:hover,
.xiaomi-hotsearch-card-delete:focus-visible {
  background: rgba(255,107,107,0.95);
  color: #fff;
  outline: none;
}
.xiaomi-hotsearch-card-delete:disabled {
  cursor: wait;
  opacity: 0.62;
  pointer-events: none;
}
.xiaomi-hotsearch-card--measure {
  transition: none !important;
  transform: none !important;
}
.xiaomi-hotsearch-card:hover {
  background: rgba(255,103,0,0.1);
  border-color: rgba(255,103,0,0.2);
  transform: translateY(-1px);
}
.xiaomi-hotsearch-rank {
  font-size: 11px;
  font-weight: 700;
  min-width: 16px;
  text-align: center;
  padding-top: 1px;
  flex-shrink: 0;
}
/* 前3名特殊颜色 */
.xiaomi-hotsearch-rank.rank-1 { color: #ff4444; }
.xiaomi-hotsearch-rank.rank-2 { color: #ff8800; }
.xiaomi-hotsearch-rank.rank-3 { color: #ffaa00; }
.xiaomi-hotsearch-rank.rank-other { color: var(--text-muted); }
.xiaomi-hotsearch-card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.xiaomi-hotsearch-card-title-row {
  display: flex;
  align-items: center;
  min-width: 0;
}
.xiaomi-hotsearch-card-source-rank {
  color: #ff6700;
  font-weight: 600;
  font-size: 10px;
  background: rgba(255,103,0,0.1);
  padding: 1px 5px;
  border-radius: 6px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.xiaomi-hotsearch-trend-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  flex: 0 0 14px;
}
.xiaomi-hotsearch-trend-badge.is-up {
  color: #ef4444;
  background: rgba(239,68,68,0.14);
}
.xiaomi-hotsearch-trend-badge.is-down {
  color: #22c55e;
  background: rgba(34,197,94,0.16);
}
.xiaomi-hotsearch-trend-badge.is-same {
  color: var(--text-muted);
  background: rgba(148,163,184,0.14);
  font-size: 13px;
  font-weight: 900;
}
.xiaomi-hotsearch-trend-badge.is-new {
  color: var(--accent-blue);
  background: color-mix(in srgb, var(--accent-blue) 16%, transparent);
  font-size: 9px;
}
.xiaomi-hotsearch-card-title {
  color: var(--text-primary);
  font-weight: 500;
  line-height: 1.3;
  display: inline-block;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  word-break: keep-all;
  flex: 0 0 auto;
}
.xiaomi-hotsearch-card-meta {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.xiaomi-hotsearch-card-hot {
  color: #ff6700;
  font-weight: 600;
  font-size: 10px;
  background: rgba(255,103,0,0.1);
  padding: 1px 5px;
  border-radius: 6px;
  white-space: nowrap;
}
.xiaomi-hotsearch-card-source {
  font-size: 10px;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.06);
  padding: 1px 5px;
  border-radius: 6px;
  white-space: nowrap;
}
[data-theme="light"] .xiaomi-hotsearch-count {
  background: rgba(148,163,184,0.1);
  color: #64748b;
}
[data-theme="light"] .xiaomi-hotsearch-page-dot {
  background: #cbd5e1;
  opacity: 0.5;
}
[data-theme="light"] .xiaomi-hotsearch-page-dot.active {
  background: #ff6700;
  opacity: 1;
}

[data-theme="light"] .xiaomi-hotsearch-card {
  background: rgba(255,255,255,0.88);
  border-color: rgba(226,232,240,0.95);
  box-shadow: 0 1px 2px rgba(15,23,42,0.03);
}

[data-theme="light"] .xiaomi-hotsearch-card:hover {
  background: #f8fafc;
  border-color: rgba(148,163,184,0.22);
  box-shadow: 0 4px 12px rgba(15,23,42,0.06);
}

[data-theme="light"] .xiaomi-hotsearch-card-delete {
  background: rgba(255,107,107,0.85);
  color: #fff;
  box-shadow: none;
}

[data-theme="light"] .xiaomi-hotsearch-card-delete:hover,
[data-theme="light"] .xiaomi-hotsearch-card-delete:focus-visible {
  background: rgba(255,107,107,0.95);
  color: #fff;
}

[data-theme="light"] .xiaomi-hotsearch-rank.rank-other {
  color: #94a3b8;
}

[data-theme="light"] .xiaomi-hotsearch-card-hot {
  background: rgba(148,163,184,0.12);
  color: #475569;
}

[data-theme="light"] .xiaomi-hotsearch-card-source {
  background: rgba(148,163,184,0.1);
  color: #64748b;
}
[data-theme="light"] .xiaomi-hotsearch-card-source-rank {
  background: rgba(148,163,184,0.12);
  color: #475569;
}
[data-theme="light"] .xiaomi-hotsearch-trend-badge.is-up {
  background: rgba(239,68,68,0.12);
}
[data-theme="light"] .xiaomi-hotsearch-trend-badge.is-down {
  background: rgba(34,197,94,0.14);
}
[data-theme="light"] .xiaomi-hotsearch-trend-badge.is-same {
  background: rgba(148,163,184,0.16);
  color: #64748b;
}
[data-theme="light"] .xiaomi-hotsearch-trend-badge.is-new {
  background: color-mix(in srgb, var(--accent-blue) 13%, transparent);
}
/* 翻页动画 */
.xiaomi-hotsearch-grid.fade-in {
  animation: fadeInCard 0.4s ease-out;
}
@keyframes fadeInCard {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.xiaomi-hotsearch-empty {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 10px;
}

/* ===== Dashboard Container ===== */
.dashboard-container {
  padding: 0;
  width: 100%;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
}

/* ===== Cards ===== */
.card,
.widget {
  background: linear-gradient(145deg, rgba(18,21,42,0.95), rgba(12,14,30,0.98));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 100% !important;
  height: 100%;
  min-width: 0;
  transition: border-color var(--transition), box-shadow var(--transition);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  contain: layout paint style;
  box-sizing: border-box;
}
/* Subtle glow on hover — no float */
.card:hover {
  border-color: rgba(110,140,255,0.2);
  box-shadow: var(--shadow), 0 0 24px rgba(110,140,255,0.04);
}

/* Core cards: accent border 15% */
.card.card-core {
  border-color: rgba(110,140,255,0.15);
}
.card.card-core:hover {
  border-color: rgba(110,140,255,0.3);
  box-shadow: var(--shadow), 0 0 32px rgba(110,140,255,0.06);
}

/* Secondary cards: accent border 5% */
.card.card-secondary {
  border-color: rgba(110,140,255,0.05);
}

/* Activity cards: inner glow */
.card.card-activity {
  box-shadow: var(--shadow), inset 0 0 40px rgba(110,140,255,0.03);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(14,17,34,0.3);
}
.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.03em;
  font-family: var(--font-display);
}
.card-body {
  padding: 16px 18px;
  flex: 1;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}

/* 允许 .scroll-y 容器内部滚动 */
.card-body.scroll-y {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  backface-visibility: hidden;
  contain: layout paint style;
  scrollbar-gutter: stable;
}

/* ===== Internal Grids (fill card width) ===== */
.ha-grid,
.card-body > .grid,
.card-body > .list,
.card-body > .table-wrap {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.scroll-y {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  contain: layout paint style;
  scrollbar-gutter: stable;
}
.scroll-y::-webkit-scrollbar { width: 4px; }
.scroll-y::-webkit-scrollbar-track { background: transparent; }
.scroll-y::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.scroll-y::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.scroll-y > .stock-item,
.scroll-y > .todo-item,
.scroll-y .cal-event,
.scroll-y .stock-manager-item,
.scroll-y .calendar-manager-item,
.scroll-y .uptime-row,
.scroll-y .uptime-group,
.scroll-y .appliance-item,
.stock-manager-scroll-area > .stock-manager-item,
.calendar-manager-body-fixed .calendar-manager-item,
.uptime-scroll-wrap .uptime-row,
.uptime-scroll-wrap .uptime-group,
.appliance-scroll-manual .appliance-item {
  content-visibility: auto;
  contain: layout paint style;
  contain-intrinsic-size: auto 64px;
}

.uptime-scroll-track .uptime-row,
.uptime-scroll-track .uptime-group,
.appliance-scroll-track .appliance-item {
  content-visibility: visible;
  contain: layout paint style;
  contain-intrinsic-size: auto;
}

html[data-dashboard-scrolling="1"] .scroll-y *,
html[data-dashboard-scrolling="1"] .stock-manager-body-fixed *,
html[data-dashboard-scrolling="1"] .stock-manager-scroll-area *,
html[data-dashboard-scrolling="1"] .calendar-manager-body-fixed *,
html[data-dashboard-scrolling="1"] .uptime-scroll-wrap *,
html[data-dashboard-scrolling="1"] .appliance-scroll-manual *,
html[data-dashboard-scrolling="1"] .card,
html[data-dashboard-scrolling="1"] .btn-icon,
html[data-dashboard-scrolling="1"] .header-weather,
html[data-dashboard-scrolling="1"] .auth-admin-flip-inner {
  transition-duration: 0s !important;
  animation-play-state: paused !important;
}

html[data-dashboard-scrolling="1"] .uptime-scroll-track,
html[data-dashboard-scrolling="1"] .appliance-scroll-track,
html[data-dashboard-scrolling="1"] .appliance-info-track,
html[data-dashboard-scrolling="1"] .price-animate,
html[data-dashboard-scrolling="1"] .xiaomi-hotsearch-bar::before,
html[data-dashboard-scrolling="1"] .xiaomi-hotsearch-bar::after,
html[data-dashboard-scrolling="1"] .cal-now-pulse,
html[data-dashboard-scrolling="1"] .uptime-row-dot.dot-down {
  animation-play-state: paused !important;
  will-change: auto !important;
}

html[data-dashboard-scrolling="1"] .stock-item:hover,
html[data-dashboard-scrolling="1"] .todo-item:hover,
html[data-dashboard-scrolling="1"] .cal-event:hover,
html[data-dashboard-scrolling="1"] .uptime-row:hover,
html[data-dashboard-scrolling="1"] .appliance-item:hover {
  transform: none !important;
  filter: none !important;
  box-shadow: none !important;
}

html[data-dashboard-scrolling="1"] .card:hover,
html[data-dashboard-scrolling="1"] .card.card-core:hover {
  box-shadow: var(--shadow) !important;
}

html[data-dashboard-scrolling="1"] .top-bar {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  transition-duration: 0s !important;
}

html[data-dashboard-scrolling="1"] body::before {
  opacity: 0;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

/* ===== Electric Accent Utilities ===== */
.text-electric { color: var(--electric-cyan); }
.text-neon { color: var(--neon-lime); }
.glow-electric { text-shadow: 0 0 8px rgba(0,245,212,0.4); }

/* ===== Badge ===== */
.badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 0 8px rgba(155,140,255,0.3);
}
.badge:empty { display: none; }
.badge.offline-badge {
  background: linear-gradient(135deg, #ff6b6b, #ee5a24) !important;
  box-shadow: 0 0 8px rgba(255,107,107,0.4) !important;
}

/* ===== Gridstack Overrides ===== */
/* Firefox + Chrome 兼容：强制 grid-stack 容器宽度 100% */
.grid-stack {
  width: 100% !important;
  box-sizing: border-box;
  /* 强制设置列宽变量，确保 GridStack 布局正确 */
  --gs-column-width: 8.3333333333%;
}
.grid-stack-item {
  contain: layout style;
}
.grid-stack-item-content {
  border-radius: var(--radius) !important;
  height: 100%;
  box-sizing: border-box;
  cursor: grab;
  contain: layout style;
  backface-visibility: hidden;
  /* touch-action: none 会导致电脑端触控板双指滑动被拦截 */
  /* 不设置 touch-action，让浏览器自行处理滑动手势 */
}
.grid-stack-item-content:active {
  cursor: grabbing;
}
.grid-stack-item .card-header {
  cursor: grab;
}
.grid-stack > .grid-stack-item > .grid-stack-item-content {
  overflow: hidden;
  left: 0 !important;
  top: 0 !important;
}

/* ===== Tablet desktop mode: touch scroll first =====
   Tablet keeps the desktop/GridStack layout, but a normal finger gesture must
   remain a page/list scroll. GridStack drag is limited to the explicit handle
   that core.js adds to each card header. */
body[data-dashboard-tier="tablet"] .dashboard-container,
body[data-dashboard-tier="tablet"] #dashboard-grid,
body[data-dashboard-tier="tablet"] #dashboard-grid > .grid-stack-item,
body[data-dashboard-tier="tablet"] #dashboard-grid > .grid-stack-item > .grid-stack-item-content,
body[data-dashboard-tier="tablet"] #dashboard-grid > .grid-stack-item > .grid-stack-item-content > .card {
  touch-action: pan-y;
}

body[data-dashboard-tier="tablet"] #dashboard-grid > .grid-stack-item > .grid-stack-item-content,
body[data-dashboard-tier="tablet"] #dashboard-grid > .grid-stack-item > .grid-stack-item-content:active,
body[data-dashboard-tier="tablet"] #dashboard-grid .card-header {
  cursor: default;
}

body[data-dashboard-tier="tablet"] #dashboard-grid .card-header {
  touch-action: pan-y;
}

body[data-dashboard-tier="tablet"] #dashboard-grid button,
body[data-dashboard-tier="tablet"] #dashboard-grid a,
body[data-dashboard-tier="tablet"] #dashboard-grid [role="button"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

body[data-dashboard-tier="tablet"] #dashboard-grid .card-body.scroll-y,
body[data-dashboard-tier="tablet"] #dashboard-grid .appliance-scroll-manual {
  touch-action: pan-y;
  overscroll-behavior-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* The strip is a horizontal scroller, while still allowing a vertical gesture
   started on an empty area to continue scrolling the page. */
body[data-dashboard-tier="tablet"] #info-strip {
  touch-action: pan-x pan-y;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

/* Deliberate tablet-only GridStack drag affordance. */
body[data-dashboard-tier="tablet"] .grid-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  margin-left: 2px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -3px;
  line-height: 1;
  text-align: center;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  opacity: 0.62;
}

body[data-dashboard-tier="tablet"] .grid-drag-handle:active {
  color: var(--accent-blue);
  background: color-mix(in srgb, var(--accent-blue) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent-blue) 22%, transparent);
  cursor: grabbing;
  opacity: 1;
}

[data-theme="light"] body[data-dashboard-tier="tablet"] .grid-drag-handle {
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  body[data-dashboard-tier="phone"] .grid-stack > .grid-stack-item > .grid-stack-item-content {
    overflow: hidden !important;
  }
  .card-body.scroll-y {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .header-weather {
    gap: 3px 6px;
    flex: 1 1 auto;
    max-width: 100%;
    padding: 4px 8px;
    align-items: center;
  }

  .header-weather-desc {
    white-space: nowrap;
    max-width: 64px;
    font-size: 12px;
  }

  .header-weather-notice {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    order: 4;
    margin-top: 0;
    gap: 5px;
    line-height: 1.35;
    display: inline-flex;
    justify-content: flex-start;
    align-items: center;
    align-content: center;
    flex-wrap: wrap;
    white-space: normal;
    overflow: visible;
  }

  .header-weather-notice .notice-tip,
  .header-weather-notice .notice-minutely,
  .header-weather-notice .notice-hourly {
    padding: 1px 7px;
    line-height: 1.35;
    font-size: 10px;
  }

  .header-weather-loc {
    flex: 0 1 48px;
    max-width: 48px;
    font-size: 11px;
  }
}

.grid-stack-placeholder > .placeholder-content {
  background: rgba(110,140,255,0.06) !important;
  border: 2px dashed rgba(110,140,255,0.3) !important;
  border-radius: var(--radius) !important;
}
.grid-stack-item.ui-draggable-dragging {
  opacity: 0.85;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 0 2px var(--accent-blue) !important;
}

/* ===== Noise texture overlay (subtle) ===== */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  background-repeat: repeat;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}
body > * { position: relative; z-index: 1; }

/* ===== Shrimp Watermark (P3 personalization) ===== */
.shrimp-watermark {
  position: fixed;
  bottom: 16px;
  right: 20px;
  font-size: 28px;
  opacity: 0.08;
  pointer-events: none;
  z-index: 0;
  filter: grayscale(0.5);
  user-select: none;
}

/* ===== Refresh Button ===== */
.btn-refresh svg {
  transition: transform 0.5s ease;
}
.btn-refresh:hover svg {
  transform: rotate(360deg);
}
.btn-refresh:active svg {
  transform: rotate(720deg);
  transition: transform 0.3s ease;
}

/* ===== Responsive ===== */
@keyframes panelSlideUpMobile {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
  .health-panel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(11, 13, 23, 0.42);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1290;
  }

  .health-panel {
    position: fixed;
    left: 12px;
    right: 12px;
    top: auto;
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: auto;
    min-width: 0;
    max-width: none;
    max-height: min(72vh, 680px);
    margin: 0;
    padding: 14px 14px 16px;
    border-radius: 18px;
    box-shadow: 0 18px 48px rgba(0,0,0,0.38), 0 0 0 1px rgba(255,255,255,0.06);
    animation: panelSlideUpMobile 0.22s ease;
  }

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

  .hp-cron-list {
    grid-template-columns: 1fr;
  }

  .top-bar {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
    position: static;
    top: auto;
  }
  .top-bar::before { display: none; }
  .top-bar-left h1 {
    font-size: 18px;
    letter-spacing: 0.04em;
  }
  .top-bar-left {
    flex-wrap: wrap;
    width: 100%;
    min-width: 0;
  }
  .clock-group {
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    min-width: 0;
    max-width: 100%;
    flex-basis: auto;
  }
  .clock {
    font-size: 18px;
    padding: 2px 8px;
  }
  .clock-date {
    font-size: 11px;
    padding: 0 8px;
    white-space: normal;
    line-height: 1.35;
    text-align: left;
    min-width: 0;
  }
  .top-bar-right {
    width: 100%;
    gap: 6px;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: flex-end;
  }
  .top-bar-right .btn-icon {
    margin-left: 0;
    order: 1;
  }
  .top-bar-right .btn-refresh {
    margin-left: auto;
    order: 1;
  }
  .top-bar-right .clock-group {
    order: 2;
    width: 100%;
    align-items: flex-start;
    min-width: 0;
    max-width: 100%;
    flex: 1 1 auto;
  }
  .header-weather {
    flex-wrap: wrap;
    align-items: center;
    text-align: right;
    width: 100%;
    order: 5;
    padding: 8px 12px;
    background: transparent;
    box-shadow: none;
    border: none;
  }
  .header-weather-icon {
    font-size: 18px;
  }
  .header-weather-temp {
    font-size: 14px;
  }
  .header-weather-desc {
    font-size: 12px;
  }
  .header-weather-loc {
    margin-left: auto;
    flex-shrink: 0;
    display: inline;
    text-align: right;
    font-size: 12px;
    order: 2;
  }
  .header-weather-notice {
    flex: 0 1 auto;
    min-width: 0;
    margin-top: 0;
    order: 4;
    white-space: normal;
    text-overflow: clip;
    font-size: 11px;
    text-align: right;
    align-self: center;
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    align-content: center;
    flex-wrap: wrap;
    gap: 4px;
    overflow: visible;
  }
  .header-weather-loc {
    max-width: 120px;
  }
  .header-weather-notice .notice-tip,
  .header-weather-notice .notice-minutely,
  .header-weather-notice .notice-hourly {
    display: inline-block;
    padding: 2px 6px;
    margin: 2px 0;
    border-radius: 4px;
    background: rgba(255,255,255,0.08);
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    max-width: 100%;
    word-break: break-word;
  }
  .header-weather-tip,
  .header-weather:hover .header-weather-tip,
  .header-weather-tip.active {
    display: none !important;
  }
  .weather-sheet {
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }
  .weather-sheet-body .hw-row {
    gap: 12px;
    align-items: flex-start;
  }
  .weather-sheet-body .hw-day,
  .weather-sheet-body .hw-temp {
    font-size: 13px;
    line-height: 1.5;
  }
  .weather-sheet-body .hw-day {
    flex: 1;
    min-width: 0;
    word-break: break-word;
  }
  .weather-sheet-body .hw-temp {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .weather-sheet-body .weather-tip-panel {
    padding: 0;
  }
  .weather-sheet-body .weather-tip-header {
    margin-bottom: 12px;
  }
  .weather-sheet-body .weather-tip-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .weather-sheet-body .weather-tip-card {
    align-items: center;
    text-align: center;
  }
  .weather-sheet-body .weather-tip-card-top {
    align-items: center;
  }
  .dashboard-container { padding: 10px 9px; }
  .card-body { padding: 12px 14px; }
  .middle-status-bar {
    padding: 6px 12px;
    flex-wrap: wrap;
    gap: 5px;
  }
  .middle-status-bar .strip-chip {
    font-size: 12px;
    padding: 4px 10px;
  }
  body[data-dashboard-tier="phone"] .xiaomi-hotsearch-bar {
    padding: 5px 12px;
    gap: 8px;
  }
  body[data-dashboard-tier="phone"] .xiaomi-hotsearch-header {
    min-width: 48px;
    gap: 3px;
  }
  /* 移动端：改为横向滚动列表 */
  body[data-dashboard-tier="phone"] .xiaomi-hotsearch-grid {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-shrink: 1;
    min-width: 0;
    padding-bottom: 2px;
  }
  body[data-dashboard-tier="phone"] .xiaomi-hotsearch-grid::-webkit-scrollbar {
    display: none;
  }
  body[data-dashboard-tier="phone"] .xiaomi-hotsearch-card {
    padding: 4px 8px;
    font-size: 11px;
    min-height: 26px;
    flex-shrink: 0;
    min-width: 140px;
    max-width: 200px;
  }
  /* 移动端隐藏翻页指示器 */
  body[data-dashboard-tier="phone"] .xiaomi-hotsearch-page-indicator {
    display: none !important;
  }
  /* 移动端自动滚动时用户触摸暂停 */
  body[data-dashboard-tier="phone"] .xiaomi-hotsearch-grid.user-scrolling {
    scroll-snap-type: x mandatory;
  }
  body[data-dashboard-tier="phone"] .xiaomi-hotsearch-grid.user-scrolling .xiaomi-hotsearch-card {
    scroll-snap-align: start;
  }
  .btn-icon {
    min-height: 44px;
    min-width: 44px;
    padding: 8px 12px;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
  }
  body::before { display: none; }
  .card-header { padding: 12px 14px 10px; }
  .card-header h3 { font-size: 0.9rem; }
  .card, .widget { border-radius: 12px; }
  body[data-dashboard-tier="phone"] .grid-stack-item-content { border-radius: 12px !important; touch-action: pan-y !important; overflow: hidden !important; top: 0 !important; bottom: 0 !important; left: 0 !important; right: 0 !important; }
  body[data-dashboard-tier="phone"] .grid-stack > .grid-stack-item { left: 9px !important; width: calc(100% - 18px) !important; }
  /* 移动端隐藏编辑按钮 */
  .btn-edit { display: none !important; }
}


/* 隐藏缩放手柄 — 已禁用缩放功能 */
.ui-resizable-handle { display: none !important; }

/* ===== Compact Mode (小卡片自适应) ===== */
.card.compact .card-body { font-size: 0.85em; }
.card.compact .card-header h3 { font-size: 0.95em; }
.card.compact .card-header { padding: 10px 14px 8px; }

/* 股票行情 compact：只显示股票名+涨跌幅，隐藏详情 */
.compact .stock-meta { display: none; }
.compact .stock-chg-amt { display: none; }
.compact .stock-item { padding: 6px 10px !important; }

/* 服务监控 compact：只显示状态图标+名称，隐藏详情 */
.compact .uptime-bar-wrap { display: none; }
.compact .uptime-pct { font-size: 0.9em; }
.compact .uptime-row { padding: 4px 8px !important; }
.compact .uptime-summary { padding: 8px 12px !important; }

/* 待办事项 compact：只显示标题，隐藏时间等详情 */
.compact .todo-meta { display: none; }
.todo-summary {
  margin: 8px 14px 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(148,163,184,0.16);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
}

.compact .todo-item { padding: 5px 8px !important; }

/* 今日日程 compact：只显示事件名，隐藏时间段 */
.compact .cal-time { display: none; }
.compact .cal-event { padding: 5px 10px !important; }

/* 设备状态 compact：只显示名称+状态，隐藏开关等详情 */
.compact .appliance-detail-line { display: none; }
.compact .appliance-item { padding: 5px 10px !important; }

/* 户型图 compact：不要整体缩放容器，避免底部留下大块空白 */
.compact .floor-plan { transform: none; }
.compact .card-body.scroll-y { padding: 10px 12px !important; }



@media (max-width: 768px) {
  .health-panel-backdrop.active {
    display: block !important;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(4px);
    z-index: 1998;
  }
  .health-panel {
    position: fixed;
    left: 12px;
    right: 12px;
    top: auto;
    bottom: calc(12px + env(safe-area-inset-bottom));
    margin-top: 0;
    min-width: 0;
    max-width: none;
    max-height: min(70vh, 560px);
    z-index: 1999;
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(0,0,0,0.35);
    animation: fadeInUp .2s ease;
  }
}
.auth-role-picker-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-role-picker-inline select {
  min-width: 120px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(148,163,184,0.24);
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  padding: 0 10px;
}

[data-theme="light"] .auth-role-picker-inline select {
  background: #fff;
  border-color: rgba(203,213,225,0.92);
}

.auth-readonly-bypass-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-readonly-form {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.auth-readonly-toggle,
.auth-readonly-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 650;
}

.auth-readonly-toggle {
  flex-direction: row;
  align-items: center;
}

.auth-readonly-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-green);
}

.auth-readonly-field textarea {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,0.24);
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  padding: 9px 10px;
  font-size: 12px;
  line-height: 1.45;
  outline: none;
}

.auth-readonly-field textarea:focus {
  border-color: rgba(74, 227, 168, 0.42);
  box-shadow: 0 0 0 3px rgba(74, 227, 168, 0.10);
}

.auth-readonly-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-readonly-hint {
  flex: 1 1 180px;
  min-width: 0;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.45;
}

.auth-readonly-save:disabled {
  opacity: 0.58;
  cursor: wait;
}

[data-theme="light"] .auth-readonly-field textarea {
  background: #fff;
  border-color: rgba(203,213,225,0.92);
}



/* ===== Android 客户端密钥 ===== */
.auth-android-key-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.auth-android-key-row .stock-manager-input {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}
.auth-android-key-card .auth-readonly-hint {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  opacity: 0.7;
}
/* ===== Light Theme Variant Tokens ===== */
html[data-theme="light"] {
  --surface-base: #ffffff;
  --surface-elevated: #fbfcff;
  --surface-muted: #f5f7fb;
  --surface-overlay: rgba(255,255,255,0.86);
  --surface-overlay-strong: rgba(255,255,255,0.94);
  --surface-panel: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(247,249,253,0.98) 100%);
  --surface-panel-muted: linear-gradient(180deg, rgba(248,250,252,0.98) 0%, rgba(241,245,249,0.96) 100%);
  --surface-panel-tint: linear-gradient(180deg, rgba(74,108,247,0.08) 0%, rgba(255,255,255,0.98) 100%);
  --surface-statusbar: rgba(255,255,255,0.82);
  --surface-chip: rgba(255,255,255,0.94);
  --surface-chip-hover: #f5f7fb;
  --surface-button: rgba(255,255,255,0.94);
  --surface-button-hover: #f5f7fb;
  --surface-button-active: #eef3ff;
  --surface-badge: rgba(248,250,252,0.96);
  --surface-badge-hover: rgba(241,245,249,0.98);
  --surface-modal: linear-gradient(180deg, rgba(255,255,255,0.99) 0%, rgba(245,247,252,0.99) 100%);
  --surface-modal-backdrop: rgba(15,23,42,0.52);
  --surface-theme-panel: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(245,248,252,0.97) 100%);
  --border-strong: rgba(148,163,184,0.32);
  --border-soft: rgba(212,216,224,0.92);
  --border-tint: rgba(74,108,247,0.18);
  --border-hover: rgba(74,108,247,0.26);
  --shadow-color: rgba(15,23,42,0.08);
  --shadow-soft: 0 8px 24px rgba(15,23,42,0.06);
  --shadow-medium: 0 16px 40px rgba(15,23,42,0.10);
  --shadow-floating: 0 20px 52px rgba(15,23,42,0.16);
  --topbar-shadow: 0 8px 28px rgba(15,23,42,0.08);
  --card-shadow: 0 10px 26px rgba(15,23,42,0.06), 0 0 0 1px rgba(212,216,224,0.9);
  --card-shadow-hover: 0 18px 38px rgba(15,23,42,0.10), 0 0 0 1px rgba(74,108,247,0.12);
  --focus-ring: 0 0 0 3px rgba(74,108,247,0.14);
  --body-grad-1: rgba(74,108,247,0.05);
  --body-grad-2: rgba(6,182,212,0.035);
  --body-grad-3: rgba(124,92,252,0.03);
  --topbar-grad-start: rgba(255,255,255,0.84);
  --topbar-grad-mid: rgba(248,249,250,0.78);
  --topbar-grad-end: rgba(245,247,252,0.78);
  --topbar-highlight: linear-gradient(90deg, transparent, rgba(74,108,247,0.14), rgba(6,182,212,0.08), transparent);
  --topbar-title: #0f7c9d;
  --clock-bg: rgba(6,182,212,0.08);
  --clock-border: rgba(6,182,212,0.14);
  --statusbar-divider: rgba(148,163,184,0.20);
  --card-header-bg: rgba(245,247,251,0.70);
  --semantic-ok-bg: rgba(16,185,129,0.12);
  --semantic-ok-border: rgba(16,185,129,0.22);
  --semantic-warn-bg: rgba(245,158,11,0.14);
  --semantic-warn-border: rgba(245,158,11,0.24);
  --semantic-danger-bg: rgba(239,68,68,0.12);
  --semantic-danger-border: rgba(239,68,68,0.20);
  --semantic-info-bg: rgba(74,108,247,0.12);
  --semantic-info-border: rgba(74,108,247,0.22);
  --semantic-muted-bg: rgba(148,163,184,0.14);
  --semantic-muted-border: rgba(148,163,184,0.22);
}

html[data-theme="light"][data-theme-variant="warm"] {
  --bg-primary: #f7efe6;
  --bg-card: #fffaf4;
  --bg-card-hover: #fff3e6;
  --bg-surface: #f8ede2;
  --border: #e5d4c5;
  --border-glow: rgba(199,118,74,0.18);
  --text-primary: #2f241d;
  --text-secondary: #7a6254;
  --text-muted: #ab8e7b;
  --surface-base: #fffaf4;
  --surface-elevated: #fffdf9;
  --surface-muted: #f8ede2;
  --surface-overlay: rgba(255,250,244,0.88);
  --surface-overlay-strong: rgba(255,250,244,0.95);
  --surface-panel: linear-gradient(180deg, rgba(255,251,247,0.99) 0%, rgba(250,240,231,0.98) 100%);
  --surface-panel-muted: linear-gradient(180deg, rgba(250,240,231,0.98) 0%, rgba(245,232,221,0.96) 100%);
  --surface-panel-tint: linear-gradient(180deg, rgba(215,141,93,0.10) 0%, rgba(255,250,244,0.98) 100%);
  --surface-statusbar: rgba(255,249,242,0.84);
  --surface-chip: rgba(255,251,247,0.95);
  --surface-chip-hover: #fff1e2;
  --surface-button: rgba(255,250,244,0.95);
  --surface-button-hover: #fff0df;
  --surface-button-active: #ffe6cc;
  --surface-badge: rgba(252,243,235,0.96);
  --surface-badge-hover: rgba(249,236,224,0.98);
  --surface-modal: linear-gradient(180deg, rgba(255,252,248,0.995) 0%, rgba(247,236,225,0.99) 100%);
  --surface-theme-panel: linear-gradient(180deg, rgba(255,251,247,0.99) 0%, rgba(247,236,225,0.97) 100%);
  --border-strong: rgba(197,154,122,0.34);
  --border-soft: rgba(229,212,197,0.94);
  --border-tint: rgba(199,118,74,0.18);
  --border-hover: rgba(199,118,74,0.28);
  --shadow-soft: 0 10px 26px rgba(122,76,44,0.08);
  --shadow-medium: 0 18px 42px rgba(122,76,44,0.12);
  --shadow-floating: 0 24px 56px rgba(122,76,44,0.18);
  --topbar-shadow: 0 10px 30px rgba(122,76,44,0.10);
  --card-shadow: 0 10px 28px rgba(122,76,44,0.08), 0 0 0 1px rgba(229,212,197,0.92);
  --card-shadow-hover: 0 18px 42px rgba(122,76,44,0.12), 0 0 0 1px rgba(199,118,74,0.14);
  --focus-ring: 0 0 0 3px rgba(215,141,93,0.16);
  --body-grad-1: rgba(215,141,93,0.10);
  --body-grad-2: rgba(245,158,11,0.06);
  --body-grad-3: rgba(236,72,153,0.035);
  --topbar-grad-start: rgba(255,252,248,0.86);
  --topbar-grad-mid: rgba(250,242,234,0.80);
  --topbar-grad-end: rgba(247,236,225,0.78);
  --topbar-highlight: linear-gradient(90deg, transparent, rgba(215,141,93,0.18), rgba(245,158,11,0.10), transparent);
  --topbar-title: #b45309;
  --clock-bg: rgba(245,158,11,0.10);
  --clock-border: rgba(245,158,11,0.18);
  --card-header-bg: rgba(251,241,231,0.72);
}

html[data-theme="light"][data-theme-variant="cool"] {
  --bg-primary: #edf5fb;
  --bg-card: #fafdff;
  --bg-card-hover: #eef7fd;
  --bg-surface: #eaf3f9;
  --border: #cdddea;
  --border-glow: rgba(14,116,144,0.18);
  --text-primary: #102534;
  --text-secondary: #5b7487;
  --text-muted: #8199aa;
  --surface-base: #fafdff;
  --surface-elevated: #ffffff;
  --surface-muted: #eaf3f9;
  --surface-overlay: rgba(250,253,255,0.86);
  --surface-overlay-strong: rgba(250,253,255,0.95);
  --surface-panel: linear-gradient(180deg, rgba(252,254,255,0.995) 0%, rgba(238,246,251,0.98) 100%);
  --surface-panel-muted: linear-gradient(180deg, rgba(239,247,252,0.98) 0%, rgba(231,242,249,0.96) 100%);
  --surface-panel-tint: linear-gradient(180deg, rgba(8,145,178,0.10) 0%, rgba(250,253,255,0.98) 100%);
  --surface-statusbar: rgba(249,252,255,0.84);
  --surface-chip: rgba(251,254,255,0.95);
  --surface-chip-hover: #eaf5fb;
  --surface-button: rgba(250,253,255,0.95);
  --surface-button-hover: #eaf5fb;
  --surface-button-active: #dceef8;
  --surface-badge: rgba(239,247,252,0.96);
  --surface-badge-hover: rgba(231,242,249,0.98);
  --surface-modal: linear-gradient(180deg, rgba(253,254,255,0.995) 0%, rgba(235,244,250,0.99) 100%);
  --surface-theme-panel: linear-gradient(180deg, rgba(252,254,255,0.99) 0%, rgba(235,244,250,0.97) 100%);
  --border-strong: rgba(112,148,176,0.34);
  --border-soft: rgba(205,221,234,0.94);
  --border-tint: rgba(8,145,178,0.18);
  --border-hover: rgba(8,145,178,0.28);
  --shadow-soft: 0 10px 26px rgba(22,78,99,0.08);
  --shadow-medium: 0 18px 42px rgba(22,78,99,0.12);
  --shadow-floating: 0 24px 56px rgba(22,78,99,0.18);
  --topbar-shadow: 0 10px 30px rgba(22,78,99,0.10);
  --card-shadow: 0 10px 28px rgba(22,78,99,0.08), 0 0 0 1px rgba(205,221,234,0.92);
  --card-shadow-hover: 0 18px 42px rgba(22,78,99,0.12), 0 0 0 1px rgba(8,145,178,0.14);
  --focus-ring: 0 0 0 3px rgba(8,145,178,0.16);
  --body-grad-1: rgba(8,145,178,0.08);
  --body-grad-2: rgba(59,130,246,0.05);
  --body-grad-3: rgba(14,165,233,0.04);
  --topbar-grad-start: rgba(252,254,255,0.86);
  --topbar-grad-mid: rgba(239,247,252,0.80);
  --topbar-grad-end: rgba(233,243,250,0.78);
  --topbar-highlight: linear-gradient(90deg, transparent, rgba(8,145,178,0.18), rgba(59,130,246,0.10), transparent);
  --topbar-title: #0f766e;
  --clock-bg: rgba(8,145,178,0.10);
  --clock-border: rgba(8,145,178,0.18);
  --card-header-bg: rgba(236,246,251,0.74);
}

html[data-theme="light"][data-theme-variant="contrast"] {
  --bg-primary: #eef2f7;
  --bg-card: #ffffff;
  --bg-card-hover: #f3f6fb;
  --bg-surface: #e9eef5;
  --border: #b8c4d3;
  --border-glow: rgba(37,99,235,0.22);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --surface-base: #ffffff;
  --surface-elevated: #ffffff;
  --surface-muted: #edf2f8;
  --surface-overlay: rgba(255,255,255,0.92);
  --surface-overlay-strong: rgba(255,255,255,0.98);
  --surface-panel: linear-gradient(180deg, rgba(255,255,255,1) 0%, rgba(243,247,251,0.99) 100%);
  --surface-panel-muted: linear-gradient(180deg, rgba(242,246,250,0.99) 0%, rgba(233,239,246,0.97) 100%);
  --surface-panel-tint: linear-gradient(180deg, rgba(37,99,235,0.10) 0%, rgba(255,255,255,0.99) 100%);
  --surface-statusbar: rgba(255,255,255,0.90);
  --surface-chip: rgba(255,255,255,0.98);
  --surface-chip-hover: #eef4ff;
  --surface-button: rgba(255,255,255,0.98);
  --surface-button-hover: #eef4ff;
  --surface-button-active: #dbeafe;
  --surface-badge: rgba(243,247,251,0.98);
  --surface-badge-hover: rgba(233,239,246,1);
  --surface-modal: linear-gradient(180deg, rgba(255,255,255,1) 0%, rgba(240,244,249,1) 100%);
  --surface-theme-panel: linear-gradient(180deg, rgba(255,255,255,1) 0%, rgba(240,244,249,0.99) 100%);
  --surface-modal-backdrop: rgba(2,6,23,0.62);
  --border-strong: rgba(71,85,105,0.34);
  --border-soft: rgba(184,196,211,0.96);
  --border-tint: rgba(37,99,235,0.22);
  --border-hover: rgba(37,99,235,0.34);
  --shadow-soft: 0 10px 24px rgba(15,23,42,0.08);
  --shadow-medium: 0 20px 44px rgba(15,23,42,0.13);
  --shadow-floating: 0 28px 64px rgba(15,23,42,0.20);
  --topbar-shadow: 0 10px 34px rgba(15,23,42,0.12);
  --card-shadow: 0 10px 28px rgba(15,23,42,0.08), 0 0 0 1px rgba(184,196,211,0.96);
  --card-shadow-hover: 0 20px 44px rgba(15,23,42,0.12), 0 0 0 1px rgba(37,99,235,0.16);
  --focus-ring: 0 0 0 3px rgba(37,99,235,0.18);
  --body-grad-1: rgba(37,99,235,0.06);
  --body-grad-2: rgba(14,165,233,0.04);
  --body-grad-3: rgba(15,23,42,0.035);
  --topbar-grad-start: rgba(255,255,255,0.92);
  --topbar-grad-mid: rgba(245,248,252,0.88);
  --topbar-grad-end: rgba(238,243,249,0.86);
  --topbar-highlight: linear-gradient(90deg, transparent, rgba(37,99,235,0.20), rgba(14,165,233,0.10), transparent);
  --topbar-title: #1d4ed8;
  --clock-bg: rgba(37,99,235,0.10);
  --clock-border: rgba(37,99,235,0.18);
  --statusbar-divider: rgba(100,116,139,0.24);
  --card-header-bg: rgba(239,244,250,0.82);
  --semantic-ok-bg: rgba(22,163,74,0.12);
  --semantic-ok-border: rgba(22,163,74,0.24);
  --semantic-warn-bg: rgba(217,119,6,0.14);
  --semantic-warn-border: rgba(217,119,6,0.28);
  --semantic-danger-bg: rgba(220,38,38,0.12);
  --semantic-danger-border: rgba(220,38,38,0.24);
  --semantic-info-bg: rgba(37,99,235,0.12);
  --semantic-info-border: rgba(37,99,235,0.24);
  --semantic-muted-bg: rgba(100,116,139,0.14);
  --semantic-muted-border: rgba(100,116,139,0.24);
}

html[data-theme="dark"][data-theme-variant="midnight"] {
  --bg-primary: #07111f;
  --bg-card: #0d1a2d;
  --bg-card-hover: #12223a;
  --bg-surface: #091426;
  --border: #18304d;
  --border-glow: rgba(96, 165, 250, 0.18);
  --text-primary: #e6f0ff;
  --text-secondary: #90a7c7;
  --text-muted: #61799a;
  --accent-blue: #7db7ff;
  --accent-purple: #8da2ff;
  --accent-green: #4be4c1;
  --accent-yellow: #ffd479;
  --accent-red: #ff7c8f;
  --accent-orange: #ffac73;
  --accent-cyan: #63d9ff;
  --accent-pink: #ff82cc;
  --electric-cyan: #5be7ff;
  --neon-lime: #bdfb63;
  --shadow: 0 8px 28px rgba(1, 10, 24, 0.56), 0 0 0 1px var(--border);
}

html[data-theme="dark"][data-theme-variant="amoled"] {
  --bg-primary: #000000;
  --bg-card: #050608;
  --bg-card-hover: #0a0c10;
  --bg-surface: #010203;
  --border: #11151d;
  --border-glow: rgba(148, 163, 184, 0.12);
  --text-primary: #f5f7fb;
  --text-secondary: #9aa4b2;
  --text-muted: #697382;
  --accent-blue: #8ab4ff;
  --accent-purple: #b39cff;
  --accent-green: #5af0b5;
  --accent-yellow: #ffd86f;
  --accent-red: #ff7b7b;
  --accent-orange: #ffb36b;
  --accent-cyan: #65e6df;
  --accent-pink: #ff8cd6;
  --electric-cyan: #22f5d4;
  --neon-lime: #bbff39;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.72), 0 0 0 1px var(--border);
}

html[data-theme="dark"][data-theme-variant="indigo"] {
  --bg-primary: #120d1f;
  --bg-card: #1a1530;
  --bg-card-hover: #231c3f;
  --bg-surface: #161128;
  --border: #30264f;
  --border-glow: rgba(167, 139, 250, 0.18);
  --text-primary: #efe8ff;
  --text-secondary: #a798cf;
  --text-muted: #77689d;
  --accent-blue: #8f8cff;
  --accent-purple: #b18cff;
  --accent-green: #56e7b3;
  --accent-yellow: #ffd36d;
  --accent-red: #ff7fa1;
  --accent-orange: #ffad76;
  --accent-cyan: #73dfff;
  --accent-pink: #ff8ddf;
  --electric-cyan: #52e7ff;
  --neon-lime: #c2ff55;
  --shadow: 0 8px 28px rgba(13, 8, 28, 0.58), 0 0 0 1px var(--border);
}

html[data-theme="light"] body {
  background-color: var(--bg-primary);
  background-image:
    radial-gradient(ellipse 90% 60% at 10% 5%, var(--body-grad-1) 0%, transparent 55%),
    radial-gradient(ellipse 40% 30% at 92% 88%, var(--body-grad-2) 0%, transparent 50%),
    radial-gradient(ellipse 35% 25% at 60% 40%, var(--body-grad-3) 0%, transparent 60%);
}

html[data-theme="light"] .top-bar {
  background: linear-gradient(135deg, var(--topbar-grad-start) 0%, var(--topbar-grad-mid) 42%, var(--topbar-grad-end) 100%);
  border-bottom: 1px solid var(--border-soft);
  box-shadow: var(--topbar-shadow);
}

html[data-theme="light"] .top-bar::before {
  background: var(--topbar-highlight);
}

html[data-theme="light"] .top-bar-left h1 {
  color: var(--topbar-title);
}

html[data-theme="light"] .clock {
  background: var(--clock-bg);
  border-color: var(--clock-border);
}

html[data-theme="light"] .middle-status-bar {
  background: var(--surface-statusbar);
  border-bottom: 1px solid var(--statusbar-divider);
}

html[data-theme="light"] .middle-status-bar .strip-chip,
html[data-theme="light"] .strip-chip {
  background: var(--surface-chip);
  border-color: var(--border-soft);
  box-shadow: 0 1px 4px var(--shadow-color);
}

html[data-theme="light"] .middle-status-bar .strip-chip:hover,
html[data-theme="light"] .strip-chip:hover {
  background: var(--surface-chip-hover);
  border-color: var(--border-hover);
}

html[data-theme="light"] .strip-config-btn {
  border-color: rgba(37, 99, 235, 0.22);
  background: rgba(239, 246, 255, 0.82);
  color: #2563eb;
  box-shadow: 0 1px 4px var(--shadow-color);
}

html[data-theme="light"] .strip-config-btn:hover {
  border-color: rgba(37, 99, 235, 0.36);
  background: rgba(219, 234, 254, 0.94);
  color: #1d4ed8;
}

html[data-theme="light"] .btn-icon,
html[data-theme="light"] .topbar-action-btn,
html[data-theme="light"] .modal-action-btn,
html[data-theme="light"] .card-front-manage-btn,
html[data-theme="light"] .panel-manage-btn {
  background: var(--surface-button);
  color: var(--text-secondary);
  border-color: var(--border-soft);
  box-shadow: 0 2px 8px rgba(15,23,42,0.04);
}

html[data-theme="light"] .btn-icon:hover,
html[data-theme="light"] .topbar-action-btn:hover,
html[data-theme="light"] .modal-action-btn:hover,
html[data-theme="light"] .card-front-manage-btn .topbar-action-icon,
.panel-manage-btn .topbar-action-icon,
.uptime-refresh-btn .topbar-action-icon {
  width: 14px;
  height: 14px;
}

.card-front-manage-btn .topbar-action-icon svg,
.panel-manage-btn .topbar-action-icon svg,
.uptime-refresh-btn .topbar-action-icon svg {
  stroke-width: 1.85;
}

.card-front-manage-btn:hover,
html[data-theme="light"] .panel-manage-btn:hover {
  background: var(--surface-button-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
  box-shadow: var(--focus-ring);
}

html[data-theme="light"] .btn-icon:active,
html[data-theme="light"] .topbar-action-btn:active,
html[data-theme="light"] .modal-action-btn:active,
html[data-theme="light"] .card-front-manage-btn:active,
html[data-theme="light"] .panel-manage-btn:active {
  background: var(--surface-button-active);
}

html[data-theme="light"] .card,
html[data-theme="light"] .widget,
html[data-theme="light"] .health-panel,
html[data-theme="light"] .fp-modal,
html[data-theme="light"] .fp-modal-sidebar,
html[data-theme="light"] .mobile-home-manage-panel,
html[data-theme="light"] .theme-panel,
html[data-theme="light"] [data-theme-panel] {
  background: var(--surface-panel);
  border-color: var(--border-soft);
  box-shadow: var(--card-shadow);
}

html[data-theme="light"] .card:hover,
html[data-theme="light"] .widget:hover {
  border-color: var(--border-hover);
  box-shadow: var(--card-shadow-hover);
}

html[data-theme="light"] .card-header,
html[data-theme="light"] .fp-modal-header,
html[data-theme="light"] .mobile-home-manage-panel__header,
html[data-theme="light"] .theme-panel__header,
html[data-theme="light"] [data-theme-panel] .panel-header {
  background: var(--card-header-bg);
  border-bottom-color: var(--border-soft);
}

html[data-theme="light"] .badge,
html[data-theme="light"] .auth-status-pill,
html[data-theme="light"] .auth-mini-chip,
html[data-theme="light"] .auth-inline-meta,
html[data-theme="light"] .mobile-home-summary-card__badge {
  background: var(--surface-badge);
  border-color: var(--border-soft);
  color: var(--text-secondary);
}

html[data-theme="light"] .badge:hover,
html[data-theme="light"] .auth-mini-chip:hover,
html[data-theme="light"] .auth-inline-meta:hover {
  background: var(--surface-badge-hover);
}

html[data-theme="light"] .badge.is-ok,
html[data-theme="light"] .auth-status-pill.tone-ok,
html[data-theme="light"] .chip-ok,
html[data-theme="light"] .mobile-home-hero__chip.is-ok {
  background: var(--semantic-ok-bg);
  border-color: var(--semantic-ok-border);
}

html[data-theme="light"] .badge.is-warn,
html[data-theme="light"] .auth-status-pill.tone-warn,
html[data-theme="light"] .chip-warn,
html[data-theme="light"] .mobile-home-hero__chip.is-warn {
  background: var(--semantic-warn-bg);
  border-color: var(--semantic-warn-border);
}

html[data-theme="light"] .badge.is-danger,
html[data-theme="light"] .auth-status-pill.tone-down,
html[data-theme="light"] .chip-alert,
html[data-theme="light"] .mobile-home-hero__chip.is-alert {
  background: var(--semantic-danger-bg);
  border-color: var(--semantic-danger-border);
}

html[data-theme="light"] .chip-muted {
  background: rgba(241, 245, 249, 0.86);
  border-color: rgba(148, 163, 184, 0.28);
}

html[data-theme="light"] .badge.is-info,
html[data-theme="light"] .mobile-home-summary-card__link,
html[data-theme="light"] .mobile-home-manage-profiles__status.is-info {
  background: var(--semantic-info-bg);
  border-color: var(--semantic-info-border);
}

html[data-theme="light"] .badge.is-muted,
html[data-theme="light"] .auth-status-pill.tone-muted,
html[data-theme="light"] .offline-badge,
html[data-theme="light"] .mobile-home-hero__chip.is-empty {
  background: var(--semantic-muted-bg);
  border-color: var(--semantic-muted-border);
}

html[data-theme="light"] .auth-admin-modal-backdrop,
html[data-theme="light"] .fp-modal-overlay {
  background: var(--surface-modal-backdrop);
}

html[data-theme="light"] .auth-admin-modal-dialog,
html[data-theme="light"] .auth-admin-switch-card,
html[data-theme="light"] .auth-front-bridge,
html[data-theme="light"] .auth-bridge-card,
html[data-theme="light"] .auth-section-card,
html[data-theme="light"] .auth-list-item,
html[data-theme="light"] .auth-log-row,
html[data-theme="light"] .auth-manager-topline-fixed,
html[data-theme="light"] .auth-empty,
html[data-theme="light"] .auth-field-pill {
  background: var(--surface-panel);
  border-color: var(--border-soft);
}

html[data-theme="light"] .auth-manager-topline-fixed,
html[data-theme="light"] .mobile-home-manage-card,
html[data-theme="light"] .mobile-home-manage-profile-card,
html[data-theme="light"] .theme-panel,
html[data-theme="light"] [data-theme-panel] {
  background: var(--surface-theme-panel);
}

.calendar-notes-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
}

.calendar-notes-trigger {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.5);
  font-size: 9px;
  font-style: normal;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  transform: translateY(1px);
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}

.calendar-notes-trigger:hover,
.calendar-notes-trigger:focus-visible,
.calendar-notes-wrap.is-open .calendar-notes-trigger,
.calendar-notes-wrap.is-pinned .calendar-notes-trigger {
  filter: brightness(1.05);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.12) inset;
  outline: none;
}

.calendar-notes-trigger:active {
  transform: translateY(2px);
}

.calendar-notes-tooltip-layer {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}

.calendar-notes-tooltip-layer.is-visible {
  pointer-events: none;
}

.calendar-notes-tooltip {
  position: absolute;
  width: fit-content;
  max-width: min(220px, calc(100vw - 48px));
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(12,18,34,0.96);
  border: 1px solid rgba(148,163,184,0.24);
  box-shadow: 0 10px 28px rgba(0,0,0,0.28);
  color: rgba(241,245,249,0.96);
  font-size: 11px;
  line-height: 1.45;
  white-space: normal;
  word-break: break-word;
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
  pointer-events: auto;
}

.calendar-notes-tooltip-layer .calendar-notes-tooltip-floating {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-2px);
}

.calendar-notes-tooltip-layer.is-visible .calendar-notes-tooltip-floating {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.calendar-notes-tooltip::before {
  content: '';
  position: absolute;
  left: 12px;
  top: -5px;
  width: 9px;
  height: 9px;
  background: rgba(12,18,34,0.96);
  border-left: 1px solid rgba(148,163,184,0.24);
  border-top: 1px solid rgba(148,163,184,0.24);
  transform: rotate(45deg);
}

[data-theme="light"] .calendar-notes-trigger {
  background: rgba(15,23,42,0.05);
  color: rgba(15,23,42,0.5);
}

[data-theme="light"] .calendar-notes-trigger:hover,
[data-theme="light"] .calendar-notes-trigger:focus-visible,
[data-theme="light"] .calendar-notes-wrap.is-open .calendar-notes-trigger,
[data-theme="light"] .calendar-notes-wrap.is-pinned .calendar-notes-trigger {
  box-shadow: 0 0 0 1px rgba(15,23,42,0.12) inset;
}

[data-theme="light"] .calendar-notes-tooltip {
  background: rgba(12,18,34,0.96);
  border-color: rgba(148,163,184,0.24);
  color: rgba(241,245,249,0.96);
  box-shadow: 0 10px 28px rgba(0,0,0,0.28);
}

[data-theme="light"] .calendar-notes-tooltip::before {
  background: rgba(12,18,34,0.96);
  border-left-color: rgba(148,163,184,0.24);
  border-top-color: rgba(148,163,184,0.24);
}

.stock-kline-month-marker line {
  stroke: #64748b;
  stroke-opacity: 0.9;
  stroke-width: 1.35;
  stroke-dasharray: 2.4 2.2;
  stroke-linecap: round;
}

.stock-kline-month-marker text {
  fill: rgba(255, 255, 255, 0.98);
  font-size: 8.6px;
  font-weight: 900;
  letter-spacing: 0.15px;
}

.stock-sparkline-break-label {
  fill: rgba(226, 232, 240, 0.96);
}

.stock-sparkline-break-label-bg {
  fill: rgba(15, 23, 42, 0.72);
  stroke: rgba(148, 163, 184, 0.18);
  stroke-width: 0.8;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.stock-sparkline-break-marker:hover .stock-sparkline-break-label-bg,
.stock-sparkline-break-marker:focus-within .stock-sparkline-break-label-bg {
  opacity: 1;
}

[data-theme="light"] .stock-kline-month-marker line {
  stroke: #64748b;
  stroke-opacity: 0.9;
}

[data-theme="light"] .stock-kline-month-marker text {
  fill: rgba(15, 23, 42, 0.96);
}

#info-strip-config-modal .info-strip-condition-state-input.is-condition-empty {
  border-color: rgba(100, 116, 139, 0.32);
  background: rgba(248, 250, 252, 0.86);
  color: #64748b;
  -webkit-text-fill-color: #64748b;
}

#info-strip-config-modal .info-strip-condition-state-input.is-condition-pass {
  border-color: rgba(21, 128, 61, 0.42);
  background: rgba(220, 252, 231, 0.74);
  color: #14532d;
  -webkit-text-fill-color: #14532d;
}

#info-strip-config-modal .info-strip-condition-state-input.is-condition-fail {
  border-color: rgba(127, 29, 29, 0.42);
  background: rgba(254, 226, 226, 0.72);
  color: #7f1d1d;
  -webkit-text-fill-color: #7f1d1d;
}

#info-strip-config-modal .info-strip-condition-state-input.is-condition-empty:focus,
#info-strip-config-modal .info-strip-condition-state-input.is-condition-pass:focus,
#info-strip-config-modal .info-strip-condition-state-input.is-condition-fail:focus {
  box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.12);
}

[data-theme="dark"] #info-strip-config-modal .info-strip-condition-state-input.is-condition-empty {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.5);
  color: #94a3b8;
  -webkit-text-fill-color: #94a3b8;
}

[data-theme="dark"] #info-strip-config-modal .info-strip-condition-state-input.is-condition-pass {
  border-color: rgba(34, 197, 94, 0.42);
  background: rgba(20, 83, 45, 0.34);
  color: #86efac;
  -webkit-text-fill-color: #86efac;
}

[data-theme="dark"] #info-strip-config-modal .info-strip-condition-state-input.is-condition-fail {
  border-color: rgba(153, 27, 27, 0.52);
  background: rgba(69, 10, 10, 0.35);
  color: #fca5a5;
  -webkit-text-fill-color: #fca5a5;
}

/* ===== 自定义告警 UI 样式 ===== */

.stock-manager-input.is-compact {
  min-width: 0;
  width: auto;
  flex: 0 0 auto;
  padding: 3px 6px;
  font-size: 10px;
  height: 24px;
}

.info-strip-alert-device-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.info-strip-alert-device-picker .stock-manager-input.is-wide {
  flex: 1;
  min-width: 0;
}

.info-strip-alert-conditions-panel {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  background: rgba(241, 245, 249, 0.45);
}

[data-theme="dark"] .info-strip-alert-conditions-panel {
  border-color: rgba(71, 85, 105, 0.35);
  background: rgba(30, 41, 59, 0.45);
}

.info-strip-alert-conditions-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

[data-theme="dark"] .info-strip-alert-conditions-header {
  color: #94a3b8;
}

.info-strip-alert-conditions-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-strip-alert-entity-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.info-strip-alert-entity-picker .info-strip-alert-field-wrap {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.info-strip-alert-entity-picker .info-strip-alert-field-wrap > small {
  flex-shrink: 0;
}

.info-strip-alert-entity-picker .stock-manager-input.is-compact,
.info-strip-alert-entity-picker .stock-manager-input {
  font-size: 10px;
  height: 24px;
  min-height: 24px;
  padding: 3px 6px;
  box-sizing: border-box;
}

.info-strip-alert-entity-picker [data-info-strip-alert-picker-device] {
  max-width: 160px;
  min-width: 100px;
}

.info-strip-alert-entity-picker [data-info-strip-alert-picker-entity] {
  max-width: 160px;
  min-width: 100px;
}

.info-strip-alert-condition-entity-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(14, 165, 233, 0.15);
  font-size: 10px;
  flex-shrink: 1;
  min-width: 0;
  max-width: 200px;
  overflow: hidden;
  white-space: nowrap;
}

.info-strip-alert-condition-entity-tag b {
  font-size: 10px;
  font-weight: 600;
  color: #0369a1;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
  flex-shrink: 1;
  min-width: 0;
}

.info-strip-alert-condition-entity-tag small {
  font-size: 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40px;
  flex-shrink: 1;
  min-width: 0;
}

[data-theme="dark"] .info-strip-alert-condition-entity-tag {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.2);
}

[data-theme="dark"] .info-strip-alert-condition-entity-tag b {
  color: #38bdf8;
}

.info-strip-alert-entity-conditions {
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] .info-strip-alert-entity-conditions {
  border-color: rgba(71, 85, 105, 0.3);
  background: rgba(15, 23, 42, 0.4);
}

.info-strip-alert-entity-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.info-strip-alert-entity-label {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-theme="dark"] .info-strip-alert-entity-label {
  color: #cbd5e1;
}

.info-strip-alert-actual-state {
  font-size: 11px;
  color: #64748b;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.12);
}

[data-theme="dark"] .info-strip-alert-actual-state {
  color: #94a3b8;
  background: rgba(71, 85, 105, 0.25);
}

.info-strip-alert-condition-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-strip-alert-condition-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow: hidden;
}

.info-strip-alert-condition-row .info-strip-alert-field-wrap:first-of-type {
  margin-left: auto;
}

.info-strip-alert-condition-row [data-info-strip-alert-condition-field="deviceId"] {
  max-width: 110px;
  min-width: 80px;
  flex-shrink: 1;
}

.info-strip-alert-condition-row [data-info-strip-alert-condition-field="entityId"] {
  max-width: 160px;
  min-width: 100px;
  flex-shrink: 1;
}

.info-strip-alert-condition-row .is-entity-alias {
  max-width: 100px;
  min-width: 60px;
  flex-shrink: 1;
  font-size: 11px;
  color: #64748b;
}

.info-strip-alert-condition-row [data-info-strip-alert-condition-field="value"] {
  max-width: 56px;
  min-width: 36px;
  flex-shrink: 1;
}

.info-strip-alert-condition-row [data-info-strip-alert-condition-field="mapping"] {
  max-width: 64px;
  min-width: 40px;
  flex-shrink: 1;
}

.info-strip-alert-field-wrap {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 1;
  min-width: 0;
}

.info-strip-alert-field-wrap > small {
  font-size: 9px;
  color: #94a3b8;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
}

[data-theme="dark"] .info-strip-alert-field-wrap > small {
  color: #64748b;
}

.info-strip-alert-field-wrap > select,
.info-strip-alert-field-wrap > input {
  width: 100%;
}

.info-strip-alert-field-wrap > select[data-info-strip-alert-condition-field="op"] {
  width: 64px;
  min-width: 64px;
  max-width: 64px;
}

.info-strip-alert-actual-state {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
}

.info-strip-alert-actual-state > small {
  font-size: 9px;
  color: #94a3b8;
  line-height: 1.2;
  white-space: nowrap;
}

.info-strip-alert-actual-state > b {
  font-size: 11px;
  font-weight: 600;
  color: #3b82f6;
  white-space: nowrap;
}

[data-theme="dark"] .info-strip-alert-actual-state > b {
  color: #60a5fa;
}

.info-strip-alert-actual-inline {
  font-weight: 600;
  color: #3b82f6;
  margin-left: 4px;
  font-size: 10px;
}

[data-theme="dark"] .info-strip-alert-actual-inline {
  color: #60a5fa;
}

.info-strip-alert-field-wrap > select option {
  font-size: 12px;
}

.info-strip-alert-condition-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.info-strip-alert-condition-actions .info-strip-order-btn.is-small {
  width: 22px;
  height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.info-strip-alert-condition-actions .info-strip-order-btn.is-small:hover,
html[data-theme="light"] .info-strip-alert-condition-actions .info-strip-order-btn.is-small:hover,
html[data-theme="dark"] .info-strip-alert-condition-actions .info-strip-order-btn.is-small:hover {
  width: 22px;
  height: 24px;
  padding: 0;
  box-shadow: none;
  min-width: 22px;
  min-height: 24px;
}

.info-strip-alert-condition-actions .info-strip-order-btn.is-small svg {
  display: block;
  margin: auto;
}

.info-strip-alert-actual-state {
  font-size: 10px;
  color: #94a3b8;
  white-space: nowrap;
  flex-shrink: 0;
}

.info-strip-alert-condition-empty {
  font-size: 11px;
  color: #94a3b8;
  padding: 6px 0;
  text-align: center;
}

[data-theme="dark"] .info-strip-alert-condition-empty {
  color: #64748b;
}

.info-strip-alert-condition-row .info-strip-custom-chip-remove.is-small {
  width: 22px;
  height: 24px;
  padding: 0;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.info-strip-alert-condition-row .info-strip-custom-chip-remove.is-small:hover,
html[data-theme="light"] .info-strip-alert-condition-row .info-strip-custom-chip-remove.is-small:hover,
html[data-theme="dark"] .info-strip-alert-condition-row .info-strip-custom-chip-remove.is-small:hover {
  width: 22px;
  height: 24px;
  padding: 0;
  box-shadow: none;
  min-width: 22px;
  min-height: 24px;
}

.info-strip-alert-condition-row .info-strip-custom-chip-remove.is-small svg {
  display: block;
  margin: auto;
}

.info-strip-custom-chip-summary-preview .info-strip-source-inline-preview.is-custom-device-chip-preview {
  margin-left: auto;
}

/* ===== 告警条件映射折叠 ===== */
.is-mapping-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 24px;
  padding: 0 6px;
  font-size: 9px;
  color: #6366f1;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 4px;
  flex-shrink: 0;
  white-space: nowrap;
}

.is-mapping-toggle:hover {
  background: rgba(99, 102, 241, 0.15);
}

[data-theme="dark"] .is-mapping-toggle {
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.25);
}

/* ===== 告警条件逻辑连接器 ===== */
.info-strip-alert-field-wrap.is-logic-connector {
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.06);
  padding: 0 4px;
  min-width: 48px;
  flex-shrink: 0;
}

[data-theme="dark"] .info-strip-alert-field-wrap.is-logic-connector {
  border-color: rgba(129, 140, 248, 0.25);
  background: rgba(99, 102, 241, 0.1);
}

.info-strip-alert-field-wrap.is-logic-connector.is-logic-disabled {
  opacity: 0.45;
  pointer-events: none;
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(148, 163, 184, 0.06);
}

[data-theme="dark"] .info-strip-alert-field-wrap.is-logic-connector.is-logic-disabled {
  border-color: rgba(148, 163, 184, 0.15);
  background: rgba(148, 163, 184, 0.08);
}

/* ===== 告警条件取反勾选 ===== */
.info-strip-alert-field-wrap.is-negate-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 36px;
  padding: 0 4px;
  border: 1px solid rgba(20, 184, 166, 0.18);
  border-radius: 6px;
  background: rgba(240, 253, 250, 0.62);
  flex-shrink: 0;
}

.info-strip-alert-field-wrap.is-negate-wrap small {
  font-size: 9px;
  color: #0f766e;
  font-weight: 820;
  white-space: nowrap;
}

.info-strip-alert-field-wrap.is-negate-wrap input[type="checkbox"] {
  width: 12px;
  height: 12px;
  margin: 0;
  accent-color: #0f766e;
}

[data-theme="dark"] .info-strip-alert-field-wrap.is-negate-wrap {
  border-color: rgba(45, 212, 191, 0.25);
  background: rgba(20, 184, 166, 0.08);
}

[data-theme="dark"] .info-strip-alert-field-wrap.is-negate-wrap small {
  color: #5eead4;
}

[data-theme="dark"] .info-strip-alert-field-wrap.is-negate-wrap input[type="checkbox"] {
  accent-color: #5eead4;
}

/* ===== 告警条件状态指示 ===== */
.info-strip-alert-condition-row.is-condition-empty {
  border-left: 3px solid rgba(148, 163, 184, 0.3);
}

.info-strip-alert-condition-row.is-condition-pass {
  border-left: 3px solid rgba(34, 197, 94, 0.6);
  background: rgba(34, 197, 94, 0.1);
}

.info-strip-alert-condition-row.is-condition-fail {
  border-left: 3px solid rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.08);
}

[data-theme="dark"] .info-strip-alert-condition-row.is-condition-pass {
  border-left-color: rgba(74, 222, 128, 0.5);
  background: rgba(74, 222, 128, 0.12);
}

[data-theme="dark"] .info-strip-alert-condition-row.is-condition-fail {
  border-left-color: rgba(248, 113, 113, 0.5);
  background: rgba(248, 113, 113, 0.08);
}

.info-strip-alert-condition-row {
  padding: 4px 6px;
  border-radius: 4px;
  border-left: 3px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}

/* ===== 告警条件标签/连接器/结果 ===== */
.info-strip-alert-condition-label {
  font-size: 11px;
  font-weight: 600;
  color: #6366f1;
  min-width: 36px;
  flex-shrink: 0;
  text-align: center;
}

[data-theme="dark"] .info-strip-alert-condition-label {
  color: #a5b4fc;
}

.info-strip-alert-condition-connector {
  display: flex;
  justify-content: center;
  padding: 2px 0;
}

.info-strip-alert-condition-connector select {
  min-width: 80px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #6366f1;
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.25);
}

[data-theme="dark"] .info-strip-alert-condition-connector select {
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
}

.info-strip-alert-result-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(148, 163, 184, 0.2);
}

.info-strip-alert-result-row .stock-manager-input {
  flex: 1;
  min-width: 0;
}

.info-strip-alert-result-hint {
  font-size: 10px;
  color: #94a3b8;
  white-space: nowrap;
}

[data-theme="dark"] .info-strip-alert-result-hint {
  color: #64748b;
}

/* ===== 可搜索设备下拉 ===== */
.info-strip-device-search-wrap {
  position: relative;
  min-width: 160px;
}
.info-strip-device-search-wrap input[type="text"] {
  width: 100%;
  min-width: 140px;
}
.info-strip-device-search-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  min-width: 220px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--card-bg, #fff);
  border: 1px solid rgba(148,163,184,0.25);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 3px 0;
  font-size: 11px;
}
[data-theme="dark"] .info-strip-device-search-list {
  background: #1e293b;
  border-color: rgba(148,163,184,0.15);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.info-strip-device-search-item {
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.6;
}
.info-strip-device-search-item:hover {
  background: rgba(99,102,241,0.1);
}
.info-strip-device-search-item.is-selected {
  background: rgba(99,102,241,0.15);
  font-weight: 600;
}
.info-strip-device-search-item small {
  color: #94a3b8;
  font-size: 10px;
  margin-left: 4px;
}
/* ===== 户型图 ===== */
.floor-plan {
  --fp-safe-x: clamp(8px, 1.8%, 14px);
  --fp-safe-y: clamp(8px, 1.8%, 14px);
  padding: var(--fp-safe-y) var(--fp-safe-x);
  overflow: hidden;
  position: relative;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.floor-plan svg {
  width: auto;
  max-width: 94%;
  height: auto;
  max-height: 94%;
  display: block;
  filter: none;
  margin: auto;
}

/* 房间背景 */
.room-bg {
  stroke: none;
  transition: fill 0.3s ease;
}

.room.occupied .room-bg {
  fill: rgba(0, 184, 148, 0.18) !important;
}

.room text {
  pointer-events: none;
}

/* 防止子元素拦截点击，确保选择正确的 data-type 元素 */
.zone text,
.device-group text,
.device-group rect {
  pointer-events: none;
}

/* 房间文字清晰度 */
.room-label,
.room-label-text {
  fill: rgba(34, 40, 49, 0.92);
  paint-order: stroke;
  stroke: rgba(255,255,255,0.86);
  stroke-width: 2.2px;
  stroke-linejoin: round;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.room-label-emoji,
.room-info,
.room-lights,
.room-occupancy {
  fill: currentColor;
  stroke: none !important;
  paint-order: normal !important;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'EmojiOne Color', sans-serif;
  font-variant-emoji: emoji;
}

.room-temp {
  font-weight: 700;
  paint-order: stroke;
  stroke: rgba(0,0,0,0.4);
  stroke-width: 3px;
  stroke-linejoin: round;
}

[data-theme="light"] .room-temp {
  stroke: rgba(255,255,255,0.88) !important;
  stroke-width: 3.4px;
}

[data-theme="light"] .room-humid {
  paint-order: stroke;
  stroke: rgba(250,252,255,0.9) !important;
  stroke-width: 2.8px;
  stroke-linejoin: round;
}

[data-theme="light"] .room-ac,
[data-theme="light"] .room-pc,
[data-theme="light"] .room-tv {
  paint-order: stroke;
  stroke: rgba(255,255,255,0.88);
  stroke-width: 2.2px;
  stroke-linejoin: round;
}

[data-theme="light"] .room-info,
[data-theme="light"] .room-lights,
[data-theme="light"] .room-occupancy {
  stroke: none !important;
  paint-order: normal !important;
}


[data-theme="light"] .room.occupied .room-bg {
  fill: color-mix(in srgb, var(--accent-green) 18%, rgba(255,255,255,0.86)) !important;
}

/* 区域背景 */
.zone-bg {
  stroke: rgba(255,255,255,0.06);
  stroke-width: 1;
}

/* 设备框 */
.device-rect {
  stroke-width: 1.5;
}

/* 门条 */
.door-bar {
  opacity: 0.8;
}

/* 编辑模式选中高亮 */
.fp-selection-rect {
  pointer-events: none;
  animation: fp-dash 0.8s linear infinite;
}

@keyframes fp-dash {
  to { stroke-dashoffset: -18; }
}

/* 缩放手柄 */
.fp-resize-handle {
  transition: opacity 0.15s;
}

.fp-resize-handle:hover {
  fill: #55efc4;
  transform-origin: center;
}

.fp-selected .room-bg {
  fill-opacity: 0.25 !important;
}

/* 选中高亮覆盖层 */
.fp-selection-rect {
  stroke: #00b894 !important;
  stroke-width: 2 !important;
  fill: rgba(0, 184, 148, 0.08) !important;
}

/* 有人时的呼吸动画 */
.room.occupied .room-bg {
  animation: room-pulse 3s ease-in-out infinite;
}

@keyframes room-pulse {
  0%, 100% { fill-opacity: 1; }
  50% { fill-opacity: 0.7; }
}

/* ===== 编辑器弹窗 ===== */
.fp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(245, 247, 251, 0.42);
  backdrop-filter: blur(6px) saturate(1.04);
  -webkit-backdrop-filter: blur(6px) saturate(1.04);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fp-fade-in 0.2s ease;
}

@keyframes fp-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fp-modal {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 249, 252, 0.98) 100%);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 18px;
  width: min(1280px, 98vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
  animation: fp-slide-up 0.25s ease;
  overflow: hidden;
}

[data-theme="dark"] .fp-modal-overlay {
  background: rgba(2, 6, 23, 0.58);
  backdrop-filter: blur(10px) saturate(1.08);
  -webkit-backdrop-filter: blur(10px) saturate(1.08);
}

[data-theme="dark"] .fp-modal {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.985) 0%, rgba(10, 15, 28, 0.985) 100%);
  border-color: rgba(71, 85, 105, 0.52);
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

@keyframes fp-slide-up {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.fp-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(244, 247, 251, 0.92) 100%);
}

.fp-modal-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: 0.01em;
}

.fp-modal-header .modal-action-btn {
  font-size: 18px;
  opacity: 0.78;
  color: #475569;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}

.fp-modal-header .modal-action-btn:hover {
  opacity: 1;
  color: #0f172a;
}

[data-theme="dark"] .fp-modal-header {
  border-bottom-color: rgba(71, 85, 105, 0.42);
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.96) 0%, rgba(15, 23, 42, 0.94) 100%);
}

[data-theme="dark"] .fp-modal-header h3 {
  color: #e2e8f0;
}

[data-theme="dark"] .fp-modal-header .modal-action-btn {
  color: #94a3b8;
}

[data-theme="dark"] .fp-modal-header .modal-action-btn:hover {
  color: #f8fafc;
}

.fp-modal-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.fp-modal-canvas {
  flex: 1;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(241, 245, 249, 0.98) 100%),
    linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px);
  background-size: auto, 20px 20px, 20px 20px;
  background-position: 0 0, 0 0, 0 0;
  padding: 18px;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

[data-theme="dark"] .fp-modal-canvas {
  background:
    linear-gradient(180deg, rgba(7, 12, 24, 0.98) 0%, rgba(11, 18, 32, 0.98) 100%),
    linear-gradient(90deg, rgba(71, 85, 105, 0.18) 1px, transparent 1px),
    linear-gradient(rgba(71, 85, 105, 0.16) 1px, transparent 1px);
  background-size: auto, 20px 20px, 20px 20px;
}

.fp-modal-canvas svg {
  width: 100%;
  height: auto;
  display: block;
  filter: none;
}

.fp-modal-sidebar {
  flex: 0 0 clamp(360px, 32vw, 460px);
  width: clamp(360px, 32vw, 460px);
  min-width: 360px;
  border-left: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.98) 0%, rgba(241, 245, 249, 0.98) 100%);
  padding: 16px 18px 18px;
  overflow-y: auto;
  max-height: 60vh;
}

[data-theme="dark"] .fp-modal-sidebar {
  border-left-color: rgba(71, 85, 105, 0.42);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.985) 0%, rgba(12, 19, 32, 0.985) 100%);
}

.fp-panel-body-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.editor-feedback,
.fp-panel-feedback {
  display: none;
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  border: 1px solid transparent;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.editor-feedback.is-visible,
.fp-panel-feedback.is-visible {
  display: block;
}

.editor-feedback.is-info,
.fp-panel-feedback.is-info {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.22);
  color: #1d4ed8;
}

.editor-feedback.is-success,
.fp-panel-feedback.is-success {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.24);
  color: #047857;
}

.editor-feedback.is-error,
.fp-panel-feedback.is-error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.24);
  color: #b91c1c;
}

[data-theme="dark"] .editor-feedback.is-info,
[data-theme="dark"] .fp-panel-feedback.is-info {
  color: #93c5fd;
}

[data-theme="dark"] .editor-feedback.is-success,
[data-theme="dark"] .fp-panel-feedback.is-success {
  color: #86efac;
}

[data-theme="dark"] .editor-feedback.is-error,
[data-theme="dark"] .fp-panel-feedback.is-error {
  color: #fca5a5;
}

.fp-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(248, 250, 252, 0.92);
}

[data-theme="dark"] .fp-modal-footer {
  border-top-color: rgba(71, 85, 105, 0.42);
  background: rgba(15, 23, 42, 0.94);
}

[data-theme="dark"] .fp-modal-footer .btn,
[data-theme="dark"] .fp-modal-footer button {
  background: rgba(30, 41, 59, 0.96);
  border-color: rgba(71, 85, 105, 0.56);
  color: #cbd5e1;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

[data-theme="dark"] .fp-modal-footer .btn:hover,
[data-theme="dark"] .fp-modal-footer button:hover {
  background: rgba(51, 65, 85, 0.96);
  border-color: rgba(96, 165, 250, 0.42);
  color: #f8fafc;
}

.fp-modal-footer .btn,
.fp-modal-footer button {
  min-width: 88px;
  height: 38px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(255, 255, 255, 0.92);
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.fp-modal-footer .btn:hover,
.fp-modal-footer button:hover {
  transform: translateY(-1px);
  border-color: rgba(59, 130, 246, 0.3);
  background: #fff;
}

.fp-modal-footer .btn-primary,
.fp-modal-footer .btn-save-fp,
.fp-modal-footer button.btn-primary {
  background: linear-gradient(180deg, #34d399 0%, #10b981 100%) !important;
  border-color: #10b981 !important;
  color: #fff !important;
  box-shadow: 0 8px 18px rgba(16, 185, 129, 0.22) !important;
}

.fp-modal-footer .btn-primary:hover,
.fp-modal-footer .btn-save-fp:hover,
.fp-modal-footer button.btn-primary:hover {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%) !important;
  color: #fff !important;
}

.fp-field-help {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.55;
  color: #64748b;
}

.fp-quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.fp-panel-toolbar {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.fp-panel-toolbar .btn-sm {
  padding: 6px 11px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: #334155;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.fp-panel-toolbar .btn-sm:hover {
  background: #eef4ff;
  color: #1d4ed8;
  border-color: rgba(59, 130, 246, 0.34);
}

[data-theme="dark"] .fp-panel-toolbar .btn-sm,
[data-theme="dark"] .btn-add-entity,
[data-theme="dark"] .fp-inline-add-btn {
  background: rgba(30, 41, 59, 0.94);
  border-color: rgba(71, 85, 105, 0.52);
  color: #cbd5e1;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

[data-theme="dark"] .fp-panel-toolbar .btn-sm:hover,
[data-theme="dark"] .btn-add-entity:hover,
[data-theme="dark"] .fp-inline-add-btn:hover {
  background: rgba(51, 65, 85, 0.96);
  border-color: rgba(96, 165, 250, 0.36);
  color: #f8fafc;
}

.fp-panel-add-btn {
  width: auto;
  min-width: 104px;
  height: 30px;
  padding: 0 12px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 9px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1;
  white-space: nowrap;
}

.fp-inline-confirm-card {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(248,250,252,0.92));
  border: 1px solid rgba(239, 68, 68, 0.16);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255,255,255,0.4);
}

.fp-inline-confirm-title {
  font-size: 13px;
  font-weight: 800;
  color: #991b1b;
}

.fp-inline-confirm-desc {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.55;
  color: #64748b;
}

.fp-inline-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.fp-inline-danger-btn {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%) !important;
  border-color: rgba(239, 68, 68, 0.46) !important;
  color: #fff !important;
  box-shadow: 0 10px 20px rgba(220, 38, 38, 0.18) !important;
}

.fp-inline-danger-btn:hover {
  filter: brightness(1.03);
  box-shadow: 0 12px 24px rgba(220, 38, 38, 0.24) !important;
}

[data-theme="dark"] .fp-inline-confirm-card {
  background: linear-gradient(180deg, rgba(31,41,55,0.92), rgba(17,24,39,0.9));
  border-color: rgba(248, 113, 113, 0.2);
  box-shadow: 0 14px 32px rgba(0,0,0,0.24), inset 0 1px 0 rgba(255,255,255,0.04);
}

[data-theme="dark"] .fp-inline-confirm-title {
  color: #fca5a5;
}

[data-theme="dark"] .fp-inline-confirm-desc {
  color: #cbd5e1;
}

.btn-save-fp {
  margin-left: auto !important;
  background: rgba(16, 185, 129, 0.1) !important;
  border-color: rgba(16, 185, 129, 0.42) !important;
  color: #059669 !important;
}

.btn-save-fp:hover {
  background: #10b981 !important;
  color: #fff !important;
  border-color: #10b981 !important;
}

.fp-panel-body {
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fp-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(241, 245, 249, 0.92) 100%);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.fp-panel-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.3;
}

.fp-hint {
  color: #64748b;
  font-size: 12px;
  text-align: center;
  padding: 10px 12px;
  line-height: 1.65;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed rgba(148, 163, 184, 0.28);
}

[data-theme="dark"] .fp-panel-header {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.92) 0%, rgba(15, 23, 42, 0.92) 100%);
  border-color: rgba(71, 85, 105, 0.44);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

[data-theme="dark"] .fp-panel-header h4 {
  color: #e2e8f0;
}

[data-theme="dark"] .fp-hint {
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.66);
  border-color: rgba(71, 85, 105, 0.44);
}

.fp-field {
  margin-bottom: 0;
}

.fp-field label {
  display: block;
  font-size: 11px;
  color: #475569;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  padding-left: 2px;
}

[data-theme="dark"] .fp-field label,
[data-theme="dark"] .fp-section-title,
[data-theme="dark"] .fp-field-help,
[data-theme="dark"] .fp-multi-add-label {
  color: #94a3b8;
}

.fp-field input[type="text"],
.fp-field input[type="number"],
.fp-field select {
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  outline: none;
  line-height: 1.35;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
}

[data-theme="dark"] .fp-field input[type="text"],
[data-theme="dark"] .fp-field input[type="number"],
[data-theme="dark"] .fp-field select,
[data-theme="dark"] .fp-entity-key,
[data-theme="dark"] .fp-entity-val {
  background: rgba(15, 23, 42, 0.92) !important;
  border-color: rgba(71, 85, 105, 0.54) !important;
  color: #e2e8f0 !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.24);
}

[data-theme="dark"] .fp-field input::placeholder,
[data-theme="dark"] .fp-field select::placeholder,
[data-theme="dark"] .fp-entity-key::placeholder,
[data-theme="dark"] .fp-entity-val::placeholder {
  color: #64748b;
}

[data-theme="dark"] .fp-field input:focus,
[data-theme="dark"] .fp-field select:focus,
[data-theme="dark"] .fp-entity-key:focus,
[data-theme="dark"] .fp-entity-val:focus {
  border-color: rgba(96, 165, 250, 0.72) !important;
  background: rgba(15, 23, 42, 0.98) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22), inset 0 1px 2px rgba(0, 0, 0, 0.24);
}

.fp-field input::placeholder,
.fp-field select::placeholder {
  color: #94a3b8;
}

.fp-field input:focus,
.fp-field select:focus {
  border-color: #3b82f6;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.fp-field input[type="color"] {
  width: 100%;
  height: 42px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 12px;
  cursor: pointer;
  padding: 4px;
  background: #fff;
}

[data-theme="dark"] .fp-field input[type="color"] {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(71, 85, 105, 0.54);
}

.fp-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.fp-field-row .fp-field {
  flex: initial;
  min-width: 0;
}

.fp-identity-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}

.fp-field-emoji input {
  text-align: center;
}

.fp-field-inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

.fp-field-inline input {
  flex: 1;
}

.fp-field-inline .inline-action-btn {
  cursor: pointer;
}

.fp-entity-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.fp-candidate-dropdown {
  margin-top: 8px;
  max-height: 184px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 2px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.fp-candidate-dropdown::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.fp-candidate-item {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  grid-template-areas:
    "main state"
    "sub sub";
  row-gap: 2px;
  column-gap: 8px;
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(203, 213, 225, 0.88);
  background: rgba(255,255,255,0.96);
  color: #334155;
  cursor: pointer;
}

.fp-candidate-item:hover {
  border-color: rgba(16, 185, 129, 0.36);
  background: rgba(236, 253, 245, 0.98);
}

.fp-candidate-main {
  grid-area: main;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
}

.fp-candidate-sub {
  grid-area: sub;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  color: #64748b;
}

.fp-candidate-state {
  grid-area: state;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  font-size: 10px;
  font-weight: 700;
  color: #475569;
}

[data-theme="dark"] .fp-candidate-item {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
}

[data-theme="dark"] .fp-candidate-item:hover {
  background: rgba(20, 83, 45, 0.22);
  border-color: rgba(16, 185, 129, 0.30);
}

[data-theme="dark"] .fp-candidate-main {
  color: #e2e8f0;
}

[data-theme="dark"] .fp-candidate-sub {
  color: #94a3b8;
}

[data-theme="dark"] .fp-candidate-state {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}

[data-theme="dark"] .fp-entity-chip {
  background: rgba(15, 23, 42, 0.88);
  border-color: rgba(148, 163, 184, 0.22);
  color: #cbd5e1;
}

[data-theme="dark"] .fp-entity-chip-action {
  color: #cbd5e1;
}

[data-theme="dark"] .fp-entity-chip-action:hover {
  border-color: rgba(16, 185, 129, 0.38);
  background: rgba(20, 83, 45, 0.24);
}

[data-theme="dark"] .fp-entity-chip code,
[data-theme="dark"] .fp-entity-chip strong {
  color: #e2e8f0;
}

[data-theme="dark"] .fp-entity-sub {
  color: #94a3b8;
}

[data-theme="dark"] .fp-entity-state {
  color: #5eead4;
}

.fp-entity-chip {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  padding: 4px 8px;
  border-radius: 12px;
  background: rgba(241, 245, 249, 0.95);
  border: 1px solid rgba(203, 213, 225, 0.9);
  color: #334155;
  font-size: 11px;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
  writing-mode: horizontal-tb;
  min-width: 0;
  max-width: 100%;
}

.fp-entity-chip-action {
  cursor: pointer;
  text-align: left;
}

.fp-entity-chip-action:hover {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(236, 253, 245, 0.95);
}

.fp-entity-chip code {
  font-size: 11px;
  background: transparent;
  padding: 0;
  color: #0f172a;
}

.fp-entity-chip strong {
  color: #0f172a;
  font-weight: 700;
  flex-basis: 100%;
}

.fp-entity-sub {
  color: #64748b;
  font-size: 10px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.fp-entity-state {
  color: #0f766e;
  font-size: 10px;
  font-weight: 600;
  margin-left: auto;
}

.fp-multi-entity-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fp-multi-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 30px;
}

.fp-multi-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas:
    "main state remove"
    "sub sub remove";
  align-items: center;
  column-gap: 8px;
  row-gap: 2px;
  max-width: 100%;
  min-width: 0;
  padding: 7px 9px;
  border-radius: 11px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.035);
}

.fp-multi-chip-main {
  grid-area: main;
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fp-multi-chip-sub {
  grid-area: sub;
  display: none;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  color: #94a3b8;
}

.fp-multi-chip:hover .fp-multi-chip-sub {
  display: block;
}

.fp-multi-chip-state {
  grid-area: state;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.05);
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
}

.fp-multi-chip-remove {
  grid-area: remove;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
  cursor: pointer;
  flex: 0 0 auto;
}

.fp-multi-chip-remove:hover {
  background: rgba(239, 68, 68, 0.16);
}

.fp-multi-empty {
  text-align: left;
  font-size: 11px;
  padding: 8px 10px;
}

.fp-multi-add-box {
  padding: 8px;
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.78);
  border: 1px solid rgba(226, 232, 240, 0.9);
}

.fp-multi-add-label {
  margin-bottom: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.fp-multi-add-row {
  align-items: stretch;
}

.fp-multi-add-row input,
.fp-multi-add-input {
  flex: 1;
}

.fp-inline-add-btn {
  flex: 0 0 auto;
}

[data-theme="dark"] .fp-multi-chip {
  background: rgba(15, 23, 42, 0.88);
  border-color: rgba(148, 163, 184, 0.18);
}

[data-theme="dark"] .fp-multi-chip-main {
  color: #e2e8f0;
}

[data-theme="dark"] .fp-multi-chip-sub {
  color: #64748b;
}

[data-theme="dark"] .fp-multi-chip-state {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}

[data-theme="dark"] .fp-multi-add-box {
  background: rgba(15, 23, 42, 0.42);
  border-color: rgba(51, 65, 85, 0.9);
}

.fp-section-title {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 4px 0 0;
  padding-top: 12px;
  padding-left: 2px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  font-weight: 800;
}

.fp-entity-row {
  display: grid;
  grid-template-columns: 104px 1fr 36px;
  gap: 8px;
  margin-bottom: 0;
  align-items: center;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

[data-theme="dark"] .fp-entity-row,
[data-theme="dark"] .fp-multi-add-box {
  background: rgba(15, 23, 42, 0.66);
  border-color: rgba(71, 85, 105, 0.44);
}

.fp-entity-key {
  width: 100% !important;
  min-width: 0;
  padding: 9px 10px !important;
  font-size: 12px !important;
  border: 1px solid rgba(148, 163, 184, 0.22) !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, 0.96) !important;
  color: #334155 !important;
}

.fp-entity-val {
  flex: 1;
  min-width: 0;
  padding: 9px 10px !important;
  font-size: 12px !important;
  border: 1px solid rgba(148, 163, 184, 0.22) !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, 0.96) !important;
  color: #0f172a !important;
  font-family: 'JetBrains Mono', monospace;
}

.fp-entity-val-wrap {
  min-width: 0;
}

.fp-entity-val-wrap .fp-entity-val {
  width: 100% !important;
}

.fp-entity-val-wrap .fp-candidate-dropdown {
  max-height: 148px;
}

.fp-entity-val-wrap .fp-entity-preview {
  margin-top: 6px;
}

.fp-entity-del {
  width: 36px;
  height: 36px;
  background: rgba(255, 241, 242, 0.95);
  border: 1px solid rgba(248, 113, 113, 0.22);
  color: #e11d48;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  border-radius: 10px;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}

.fp-entity-del:hover {
  color: #fff;
  background: #ef4444;
  border-color: #ef4444;
}

.btn-add-entity {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  color: #2563eb;
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.98) 0%, rgba(219, 234, 254, 0.92) 100%);
  border: 1px dashed rgba(96, 165, 250, 0.42);
  border-radius: 9px;
  cursor: pointer;
  margin-top: 2px;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
  box-shadow: 0 3px 10px rgba(59, 130, 246, 0.07);
}

.btn-add-entity:hover {
  background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
  border-color: rgba(37, 99, 235, 0.42);
  transform: translateY(-1px);
}

.btn-add-doorlike {
  width: auto;
  min-width: 108px;
  height: 34px;
  padding: 0 14px;
  justify-content: center;
  gap: 6px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.1;
  white-space: nowrap;
}

.fp-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.fp-inline-add-action {
  width: auto;
  min-width: 112px;
  height: 34px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

[data-theme="light"] .btn-add-doorlike,
[data-theme="light"] .fp-inline-add-action.fp-inline-add-action-secondary {
  color: #1d4ed8;
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.98) 0%, rgba(219, 234, 254, 0.94) 100%);
  border: 1px solid rgba(96, 165, 250, 0.42);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.08);
}

[data-theme="light"] .btn-add-doorlike:hover,
[data-theme="light"] .fp-inline-add-action.fp-inline-add-action-secondary:hover {
  background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
  border-color: rgba(37, 99, 235, 0.48);
}

[data-theme="light"] .fp-inline-add-action.fp-inline-add-action-primary {
  color: #0f766e;
  background: linear-gradient(180deg, rgba(236, 253, 245, 0.98) 0%, rgba(209, 250, 229, 0.94) 100%);
  border: 1px solid rgba(52, 211, 153, 0.4);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.08);
}

[data-theme="light"] .fp-inline-add-action.fp-inline-add-action-primary:hover {
  background: linear-gradient(180deg, #d1fae5 0%, #a7f3d0 100%);
  border-color: rgba(5, 150, 105, 0.46);
  color: #065f46;
}

[data-theme="dark"] .btn-add-doorlike,
[data-theme="dark"] .fp-inline-add-action.fp-inline-add-action-secondary {
  background: rgba(30, 41, 59, 0.96);
  border-color: rgba(71, 85, 105, 0.56);
  color: #e2e8f0;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .btn-add-doorlike:hover,
[data-theme="dark"] .fp-inline-add-action.fp-inline-add-action-secondary:hover {
  background: rgba(51, 65, 85, 0.98);
  border-color: rgba(96, 165, 250, 0.4);
  color: #f8fafc;
}

[data-theme="dark"] .fp-inline-add-action.fp-inline-add-action-primary {
  background: linear-gradient(180deg, rgba(6, 78, 59, 0.9) 0%, rgba(6, 95, 70, 0.9) 100%);
  border-color: rgba(52, 211, 153, 0.3);
  color: #d1fae5;
  box-shadow: 0 8px 18px rgba(5, 46, 36, 0.34);
}

[data-theme="dark"] .fp-inline-add-action.fp-inline-add-action-primary:hover {
  background: linear-gradient(180deg, rgba(6, 95, 70, 0.96) 0%, rgba(4, 120, 87, 0.96) 100%);
  border-color: rgba(110, 231, 183, 0.38);
  color: #ecfdf5;
}

.fp-delete-btn {
  font-size: 14px;
  opacity: 1;
  color: #ef4444;
  background: rgba(254, 226, 226, 0.88);
  border: 1px solid rgba(248, 113, 113, 0.26);
  border-radius: 10px;
  width: 34px;
  height: 34px;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}

.fp-delete-btn:hover {
  opacity: 1;
  background: #ef4444;
  color: #fff;
}

[data-theme="dark"] .fp-entity-del {
  background: rgba(69, 10, 10, 0.52);
  border-color: rgba(248, 113, 113, 0.3);
  color: #fca5a5;
}

[data-theme="dark"] .fp-delete-btn {
  background: rgba(69, 10, 10, 0.46);
  border-color: rgba(248, 113, 113, 0.24);
  color: #fca5a5;
}

/* Toast */
.fp-toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(-18px) scale(0.98);
  width: fit-content;
  min-width: 0;
  max-width: min(420px, calc(100vw - 24px));
  background: rgba(245, 245, 247, 0.72);
  color: #1f2937;
  padding: 10px 16px;
  border-radius: 18px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255,255,255,0.32);
  backdrop-filter: blur(18px) saturate(1.16);
  -webkit-backdrop-filter: blur(18px) saturate(1.16);
  opacity: 0;
  transition: opacity 220ms ease, transform 220ms ease;
  z-index: 9999;
  pointer-events: none;
}

[data-theme="dark"] .fp-toast {
  background: rgba(28, 28, 30, 0.72);
  color: rgba(255,255,255,0.94);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255,255,255,0.08);
}

.fp-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.fp-toast.is-success,
.fp-toast.is-error,
.fp-toast.is-info {
  color: inherit;
  border-color: rgba(255, 255, 255, 0.18);
}

[data-theme="dark"] .fp-toast.is-success {
  color: #86efac;
}

[data-theme="dark"] .fp-toast.is-error {
  color: #fca5a5;
}

[data-theme="dark"] .fp-toast.is-info {
  color: #93c5fd;
}

.fp-multi-chip {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  padding: 7px 8px 7px 10px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(248,250,252,0.96) 100%);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
  box-sizing: border-box;
  overflow: hidden;
}

.fp-multi-chip-body {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.fp-multi-chip-main {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.fp-multi-chip-state {
  flex: 0 0 auto;
  max-width: 84px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
}

.fp-multi-chip-sub {
  display: none !important;
}

.fp-multi-chip-remove {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.fp-multi-chip-remove:hover {
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
}

.fp-multi-add-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.fp-multi-add-input {
  flex: 1;
  min-width: 0;
}

.fp-inline-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-width: 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(16, 185, 129, 0.24);
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.14) 0%, rgba(5, 150, 105, 0.18) 100%);
  color: #047857;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 3px 8px rgba(16, 185, 129, 0.08);
}

.fp-inline-add-btn:hover {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.18) 0%, rgba(5, 150, 105, 0.24) 100%);
  border-color: rgba(5, 150, 105, 0.34);
  color: #065f46;
}

.fp-inline-add-btn-icon {
  font-size: 13px;
  line-height: 1;
}

.fp-inline-add-btn-text {
  white-space: nowrap;
}

.fp-inline-clear-btn {
  flex: 0 0 auto;
}

.fp-candidate-dropdown {
  position: relative;
  margin-top: 8px;
  max-height: 220px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.fp-candidate-dropdown::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}


/* Header actions 容器 */
.card-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-edit {
  font-size: 14px;
}
.btn-edit.editing {
  background: rgba(255,255,255,0.15);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.3);
}

/* 应用内确认框 */
.fp-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  animation: fp-fade-in 0.15s ease;
}
.fp-confirm-dialog {
  background: #1e272e;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 20px 28px;
  min-width: 260px;
  max-width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: fp-scale-in 0.15s ease;
}
.fp-confirm-dialog p {
  margin: 0 0 18px;
  color: #dfe6e9;
  font-size: 14px;
  line-height: 1.5;
}
.fp-confirm-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.fp-confirm-cancel,
.fp-confirm-ok {
  padding: 6px 18px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.fp-confirm-cancel {
  background: rgba(255,255,255,0.08);
  color: #b2bec3;
}
.fp-confirm-cancel:hover {
  background: rgba(255,255,255,0.15);
}
.fp-confirm-ok {
  background: #e17055;
  color: #fff;
}
.fp-confirm-ok:hover {
  background: #d63031;
}
@keyframes fp-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fp-scale-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.fp-layer-menu {
  position: fixed;
  z-index: 10050;
  min-width: 120px;
  padding: 6px;
  border: 1px solid color-mix(in srgb, var(--border) 72%, rgba(255,255,255,0.18));
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg-card) 92%, transparent);
  box-shadow: 0 12px 32px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.04);
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
}
.fp-layer-menu button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.fp-layer-menu button:hover {
  background: color-mix(in srgb, var(--accent-blue) 18%, transparent);
}

[data-theme="light"] .fp-layer-menu {
  border-color: rgba(148, 163, 184, 0.46);
  background: rgba(255,255,255,0.94);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16), 0 0 0 1px rgba(255,255,255,0.65);
}

[data-theme="light"] .fp-layer-menu button:hover {
  background: rgba(74,108,247,0.10);
}

[data-theme="light"] .door-bar,
[data-theme="light"] .curtain-bg,
[data-theme="light"] .curtain-group line {
  vector-effect: non-scaling-stroke;
}
/* ===== 小虾米看板 — stocks.css ===== */
/* 港股行情模块样式 */.arrow-up {
  color: #ef4444;
  font-size: 14px;
}
.arrow-slash {
  color: var(--text-muted);
  font-size: 12px;
  opacity: 0.5;
}
.arrow-down {
  color: #22c55e;
  font-size: 14px;
}

#stocks-body {
  --stock-svg-guide-stroke: #64748b;
  --stock-svg-guide-opacity: 0.9;
  --stock-svg-label-text: rgba(255, 255, 255, 0.96);
  --stock-svg-label-bg: rgba(15, 23, 42, 0.76);
  --stock-svg-label-bg-strong: rgba(15, 23, 42, 0.82);
  --stock-svg-label-stroke: rgba(148, 163, 184, 0.24);
  --stock-svg-point-fill: rgba(255, 255, 255, 0.96);
  --stock-svg-point-stroke: rgba(15, 23, 42, 0.32);
  display: flex;
  flex-direction: column;
  gap: 0;
}

[data-theme="light"] #stocks-body {
  --stock-svg-guide-stroke: rgba(71, 85, 105, 0.82);
  --stock-svg-guide-opacity: 0.78;
  --stock-svg-label-text: rgba(15, 23, 42, 0.96);
  --stock-svg-label-bg: rgba(255, 255, 255, 0.9);
  --stock-svg-label-bg-strong: rgba(255, 255, 255, 0.96);
  --stock-svg-label-stroke: rgba(100, 116, 139, 0.28);
  --stock-svg-point-fill: rgba(255, 255, 255, 0.98);
  --stock-svg-point-stroke: rgba(15, 23, 42, 0.24);
}
.stock-mobile-entry {
  display: none;
}
#stocks-body .loading {
  text-align: center;
  color: var(--text-muted);
  padding: 24px 0;
  font-size: 13px;
}

@media (max-width: 768px) {
  .stock-mobile-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 14px 8px;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid rgba(96,165,250,0.16);
    background: linear-gradient(180deg, rgba(96,165,250,0.12), rgba(255,255,255,0.03));
  }
  .stock-mobile-entry-copy {
    flex: 1;
    min-width: 0;
  }
  .stock-mobile-entry-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
  }
  .stock-mobile-entry-subtitle {
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.45;
    color: var(--text-secondary);
  }
  .stock-mobile-entry-btn {
    flex-shrink: 0;
    min-width: 72px;
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(96,165,250,0.22);
    background: rgba(96,165,250,0.16);
    color: #bfdbfe;
    font-size: 12px;
    font-weight: 700;
  }
}

/* ===== Stock Items（五列横排：色条 / 名称+代码 / 走势图 / 价格 / 涨跌幅） ===== */
.stock-item {
  position: relative;
  display: flex;
  align-items: stretch;
  padding: 6px 6px;
  margin: 0;
  border-bottom: 1px solid rgba(30,34,64,0.5);
  min-height: 72px;
  gap: 0;
  transition: background var(--transition), box-shadow 160ms ease;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.stock-item + .stock-item,
div.stock-item + div.stock-item {
  margin-top: 0;
}
.stock-item:last-child { border-bottom: none; }
.stock-item:hover { background: rgba(110,140,255,0.03); border-radius: 6px; }
.stock-item.is-pin-pressing {
  background: rgba(96,165,250,0.09);
  box-shadow: inset 0 0 0 1px rgba(96,165,250,0.16);
  border-radius: 6px;
}
.stock-item.is-pinned {
  background: rgba(96,165,250,0.045);
}

/* 第1列：色块竖条 */
.stock-bar {
  width: 5px;
  flex-shrink: 0;
  border-radius: 3px;
  margin: 4px 0 4px 4px;
}
.stock-bar.stock-up { background: #ef4444; }
.stock-bar.stock-down { background: #22c55e; }
.stock-bar.stock-flat { background: var(--text-muted); }

/* 第2列：名称 / 代码 / 状态（主 / 辅 / 次） */
.stock-name-col {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 150px;
  padding: 4px 8px 4px 4px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 0;
  overflow: hidden;
}
.stock-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
  min-width: 0;
  width: 100%;
  line-height: 1.2;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stock-name-link {
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  border-radius: 4px;
  transition: color .16s ease, background-color .16s ease;
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  user-select: text;
}
.stock-name-link:hover,
.stock-name-link:focus-visible {
  color: var(--accent-blue);
  background: rgba(96, 165, 250, .08);
  outline: none;
}
.stock-code {
  display: block;
  width: 100%;
  margin-top: 1px;
  font-size: 10px;
  line-height: 1.15;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.82;
}
.stock-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin-top: 5px;
  min-width: 0;
}
.stock-meta-row .stock-code {
  flex: 0 1 auto;
}
.stock-meta-row .stock-tag {
  margin-left: 0;
  flex-shrink: 0;
}
.stock-pin-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  color: var(--accent-blue);
  opacity: 0.86;
}
.stock-pin-indicator svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.stock-code-tag-row {
  display: flex;
  align-items: flex-start;
  width: 100%;
  margin-top: 3px;
  min-height: 16px;
  line-height: 1;
}
.stock-code-tag-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
}
.stock-code-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-height: 16px;
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
  vertical-align: top;
}
.stock-status-trigger {
  appearance: none;
  border: none;
  cursor: help;
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}
.stock-status-trigger:hover,
.stock-status-trigger:focus-visible,
.stock-code-tag-wrap.is-open .stock-status-trigger {
  filter: brightness(1.05);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.12) inset;
}
.stock-status-trigger:active {
  transform: translateY(1px);
}
.stock-status-tooltip {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 12;
  width: min(220px, calc(100vw - 48px));
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(12,18,34,0.96);
  border: 1px solid rgba(148,163,184,0.24);
  box-shadow: 0 10px 28px rgba(0,0,0,0.28);
  color: rgba(241,245,249,0.96);
  font-size: 11px;
  line-height: 1.45;
  white-space: normal;
  word-break: break-word;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-2px);
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
  pointer-events: none;
}
.stock-status-tooltip-layer {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}
.stock-status-tooltip-floating {
  position: absolute;
  width: min(220px, calc(100vw - 32px));
  z-index: 9999;
}
.stock-status-tooltip-layer .stock-status-tooltip-floating {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-2px);
}
.stock-status-tooltip-layer.is-visible .stock-status-tooltip-floating {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.stock-status-tooltip::before {
  content: '';
  position: absolute;
  left: 12px;
  top: -5px;
  width: 9px;
  height: 9px;
  background: rgba(12,18,34,0.96);
  border-left: 1px solid rgba(148,163,184,0.24);
  border-top: 1px solid rgba(148,163,184,0.24);
  transform: rotate(45deg);
}
.stock-code-tag-wrap:hover .stock-status-tooltip,
.stock-code-tag-wrap:focus-within .stock-status-tooltip,
.stock-code-tag-wrap.is-open .stock-status-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* 第3列：走势图（弹性占满） */
.stock-chart-col {
  flex: 1.8 1 0;
  min-width: 0;
  overflow: hidden;
  padding: 4px 0 4px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}
.stock-chart-col.has-topline {
  justify-content: flex-start;
}
.stock-chart-col:not(.has-sparkline):not(.has-topline) {
  visibility: hidden;
}
.stock-chart-topline {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 14px;
  margin-bottom: 4px;
}
.stock-chart-topline .stock-tag {
  margin-left: 0;
}
.stock-chart-canvas {
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: stretch;
  perspective: 520px;
  -webkit-perspective: 520px;
}
.stock-chart-col svg {
  width: 100%;
  min-width: 0;
  height: 48px;
  display: block;
  margin-top: 0;
}

.stock-chart-flip {
  width: 100%;
  min-width: 0;
  min-height: 64px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  display: block;
  cursor: pointer;
  text-align: inherit;
  perspective: inherit;
  -webkit-perspective: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.stock-chart-flip-inner {
  position: relative;
  display: block;
  width: 100%;
  min-height: 64px;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 0.42s cubic-bezier(0.2, 0.78, 0.2, 1);
  will-change: transform;
}

.stock-chart-flip.is-flipped .stock-chart-flip-inner {
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
}

.stock-chart-flip.is-flip-animating-forward .stock-chart-flip-inner {
  animation: stockChartFlipForward 0.42s cubic-bezier(0.2, 0.78, 0.2, 1) both;
}

.stock-chart-flip.is-flip-animating-back .stock-chart-flip-inner {
  animation: stockChartFlipBack 0.42s cubic-bezier(0.2, 0.78, 0.2, 1) both;
}

@keyframes stockChartFlipForward {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(180deg); }
}

@keyframes stockChartFlipBack {
  from { transform: rotateY(180deg); }
  to { transform: rotateY(0deg); }
}

.stock-chart-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.stock-chart-face--sparkline {
  transform: rotateY(0deg);
  -webkit-transform: rotateY(0deg);
}

.stock-chart-face--kline {
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
}

.stock-kline-svg .stock-kline-candle {
  vector-effect: non-scaling-stroke;
}

.stock-kline-svg {
  cursor: crosshair;
}

.stock-kline-crosshair-y {
  opacity: 0;
  stroke: #64748b;
  stroke-opacity: 0.88;
  stroke-width: 1.25;
  stroke-dasharray: 3 2.6;
  stroke-linecap: round;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.stock-kline-svg:hover .stock-kline-crosshair-y,
.stock-kline-svg.is-crosshair-active .stock-kline-crosshair-y {
  opacity: 1;
}

.stock-kline-month-marker line {
  stroke: var(--stock-svg-guide-stroke, #64748b);
  stroke-opacity: var(--stock-svg-guide-opacity, 0.9);
  stroke-width: 1.35;
  stroke-dasharray: 2.4 2.2;
  stroke-linecap: round;
}

.stock-kline-month-marker text {
  fill: var(--stock-svg-label-text, rgba(255, 255, 255, 0.98));
  font-size: 8.6px;
  font-weight: 900;
  letter-spacing: 0.15px;
}

.stock-chart-extreme-label {
  pointer-events: none;
}

.stock-chart-extreme-label circle {
  fill: var(--stock-svg-point-fill, rgba(255, 255, 255, 0.96));
  stroke: var(--stock-svg-point-stroke, rgba(15, 23, 42, 0.32));
  stroke-width: 0.75;
}

.stock-chart-extreme-label rect {
  fill: var(--stock-svg-label-bg, rgba(15, 23, 42, 0.76));
  stroke: var(--stock-svg-label-stroke, rgba(148, 163, 184, 0.18));
  stroke-width: 0.6;
}

.stock-chart-extreme-label text {
  fill: var(--stock-svg-label-text, rgba(255, 255, 255, 0.96));
  font-size: 7.8px;
  font-weight: 850;
  font-family: var(--font-mono);
  letter-spacing: -0.28px;
}

@media (max-width: 768px) {
  body[data-dashboard-tier="phone"] .stock-item {
    gap: 6px;
  }

  body[data-dashboard-tier="phone"] .stock-name-col {
    flex: 0 1 82px;
    max-width: 82px;
    padding-right: 4px;
  }

  body[data-dashboard-tier="phone"] .stock-chart-col,
  html:not([data-stock-layout-variant]) body[data-dashboard-tier="phone"] .stock-chart-col {
    flex: 1 1 92px;
    min-width: 72px;
  }

  body[data-dashboard-tier="phone"] .stock-chart-col svg {
    height: 38px;
  }

  body[data-dashboard-tier="phone"] .stock-chart-canvas {
    perspective: 560px;
    -webkit-perspective: 560px;
  }

  body[data-dashboard-tier="phone"] .stock-chart-flip,
  body[data-dashboard-tier="phone"] .stock-chart-flip-inner {
    min-height: 54px;
  }

  body[data-dashboard-tier="phone"] .stock-chart-flip.is-flip-animating-forward .stock-chart-flip-inner {
    animation: stockChartFlipPhoneForward 0.44s cubic-bezier(0.2, 0.78, 0.2, 1) both;
  }

  body[data-dashboard-tier="phone"] .stock-chart-flip.is-flip-animating-back .stock-chart-flip-inner {
    animation: stockChartFlipPhoneBack 0.44s cubic-bezier(0.2, 0.78, 0.2, 1) both;
  }

  @keyframes stockChartFlipPhoneForward {
    0% { transform: rotateY(0deg) scale(1); }
    45% { transform: rotateY(86deg) scale(0.985); }
    100% { transform: rotateY(180deg) scale(1); }
  }

  @keyframes stockChartFlipPhoneBack {
    0% { transform: rotateY(180deg) scale(1); }
    45% { transform: rotateY(94deg) scale(0.985); }
    100% { transform: rotateY(0deg) scale(1); }
  }

  body[data-dashboard-tier="phone"] .stock-price-col {
    width: 50px;
  }

  body[data-dashboard-tier="phone"] .stock-change-col {
    width: 54px;
  }
}

.stock-sparkline-mode {
  display: inline-flex;
  align-self: flex-end;
  align-items: center;
  justify-content: center;
  min-height: 14px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.10);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.stock-sparkline-mode--stale,
.stock-sparkline-mode--fallback,
.stock-sparkline-mode--retrying,
.stock-sparkline-mode--missing {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.stock-sparkline-empty {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 14px;
  color: rgba(100, 116, 139, 0.82);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
  animation: stockSparklineFadeIn 0.18s ease both;
}

.stock-sparkline-empty.is-retrying::after {
  content: '';
  width: 4px;
  height: 4px;
  margin-left: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.72;
  animation: stockSparklineRetryPulse 0.9s ease-in-out infinite;
}

@keyframes stockSparklineFadeIn {
  from { opacity: 0; transform: translateY(1px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes stockSparklineRetryPulse {
  0%, 100% { transform: scale(0.7); opacity: 0.35; }
  50% { transform: scale(1); opacity: 0.85; }
}

.stock-sparkline-break-label {
  fill: var(--stock-svg-label-text, rgba(226, 232, 240, 0.98));
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0;
  opacity: 0;
  user-select: none;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.stock-sparkline-break-marker:hover .stock-sparkline-break-label,
.stock-sparkline-break-marker:focus-within .stock-sparkline-break-label {
  opacity: 1;
}

.stock-sparkline-break-label-bg {
  fill: var(--stock-svg-label-bg-strong, rgba(15, 23, 42, 0.78));
  stroke: var(--stock-svg-label-stroke, rgba(148, 163, 184, 0.28));
  stroke-width: 0.6;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.stock-sparkline-break-marker:hover .stock-sparkline-break-label-bg,
.stock-sparkline-break-marker:focus-within .stock-sparkline-break-label-bg {
  opacity: 1;
}

/* ===== 分时 sparkline ===== */
.stock-chart-col svg polyline {
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.stock-chart-col svg polygon {
  opacity: 0.12;
}
.stock-chart-open-line {
  stroke-opacity: 0.58;
  stroke-width: 1.15;
  stroke-dasharray: 4 3;
  vector-effect: non-scaling-stroke;
}
/* 第4列：价格 */
.stock-price-col {
  width: 58px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 0;
}
.stock-price {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  white-space: nowrap;
  color: var(--text-primary);
}

/* 第5列：涨跌幅（半透明同色胶囊） */
.stock-change-col {
  width: 62px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 0;
}
.stock-change {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: 3px 7px;
  border-radius: 4px;
  white-space: nowrap;
}
.stock-change.stock-up { color: var(--accent-red); background: color-mix(in srgb, var(--accent-red) 16%, transparent); }
.stock-change.stock-down { color: var(--accent-green); background: color-mix(in srgb, var(--accent-green) 16%, transparent); }
.stock-change.stock-flat { color: var(--text-muted); background: color-mix(in srgb, var(--text-muted) 16%, transparent); }

/* ===== 52周标记 ===== */
.stock-tag {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
  line-height: 1.4;
  margin-left: 4px;
  vertical-align: middle;
}
.stock-group-title.stock-group-上涨 {
  color: #ef4444;
}
.stock-group-title.stock-group-下跌 {
  color: #22c55e;
}
.stock-group-title.stock-group-平盘 {
  color: var(--text-muted);
}
.stock-group-title.is-pinned {
  color: var(--accent-blue);
  background: linear-gradient(180deg, rgba(23,37,68,0.97), rgba(18,28,52,0.91));
}

/* ===== Stock layout variants for quick visual comparison ===== */
:root[data-stock-layout-variant="a"] .stock-name-col {
  flex: 0 1 auto;
  max-width: 122px;
}
:root[data-stock-layout-variant="a"] .stock-chart-col {
  flex: 2.2 1 0;
}

:root[data-stock-layout-variant="b"] .stock-name-col {
  flex: 0 1 auto;
  max-width: 116px;
}
:root[data-stock-layout-variant="b"] .stock-chart-col {
  flex: 2.4 1 0;
}
:root[data-stock-layout-variant="b"] .stock-price-col {
  width: 56px;
}
:root[data-stock-layout-variant="b"] .stock-change-col {
  width: 60px;
}
:root:not([data-stock-layout-variant]) .stock-name-col {
  flex: 0 1 auto;
  max-width: 116px;
}
:root:not([data-stock-layout-variant]) .stock-chart-col {
  flex: 2.4 1 0;
}
:root:not([data-stock-layout-variant]) .stock-chart-col:not(.has-sparkline):not(.has-topline) {
  visibility: hidden;
}
:root:not([data-stock-layout-variant]) .stock-price-col {
  width: 56px;
}
:root:not([data-stock-layout-variant]) .stock-change-col {
  width: 60px;
}

:root[data-stock-layout-variant="c"] .stock-name-col {
  flex: 0 1 auto;
  max-width: 130px;
}
:root[data-stock-layout-variant="c"] .stock-chart-col {
  flex: 2.0 1 0;
}

:root[data-stock-layout-variant="d"] .stock-name-col {
  flex: 0 1 auto;
  max-width: 108px;
}
:root[data-stock-layout-variant="d"] .stock-chart-col {
  flex: 2.5 1 0;
}
:root[data-stock-layout-variant="d"] .stock-price-col {
  width: 60px;
}
:root[data-stock-layout-variant="d"] .stock-change-col {
  width: 64px;
}

:root[data-stock-layout-variant="tag-compact"] .stock-code-tag,
:root[data-stock-tag-compact="1"] .stock-code-tag {
  font-size: 8px;
  padding: 1px 5px;
  min-height: 14px;
}
:root[data-stock-layout-variant="tag-compact"] .stock-code-tag-row,
:root[data-stock-tag-compact="1"] .stock-code-tag-row {
  margin-top: 4px;
  min-height: 14px;
}
.tag-high {
  background: color-mix(in srgb, var(--accent-red) 16%, transparent);
  color: var(--accent-red);
}
.tag-low {
  background: color-mix(in srgb, var(--accent-green) 16%, transparent);
  color: var(--accent-green);
}
.tag-closed {
  background: color-mix(in srgb, var(--text-muted) 16%, transparent);
  color: var(--text-muted);
}
.tag-half-day {
  background: color-mix(in srgb, var(--accent-yellow) 18%, transparent);
  color: var(--accent-yellow);
}
.tag-stale {
  background: color-mix(in srgb, var(--accent-purple) 16%, transparent);
  color: color-mix(in srgb, var(--accent-purple) 78%, var(--accent-blue));
}

/* ===== 数字翻牌动画 ===== */
@keyframes price-flash {
  0% { transform: scale(1); }
  30% { transform: scale(1.06); filter: brightness(1.3); }
  100% { transform: scale(1); filter: brightness(1); }
}
.price-animate {
  animation: price-flash 0.5s ease-out;
}

/* ===== 编辑按钮样式 ===== */
.btn-edit-stocks {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  padding: 2px 6px;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1;
}
.btn-edit-stocks:hover { color: var(--text-primary); }


.stock-front-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.stock-front-mode-toggle {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  min-width: 20px;
  padding: 0;
  margin: 0;
  border: none !important;
  outline: none;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--text-secondary);
  line-height: 1;
  cursor: pointer;
  transition: color 140ms ease, opacity 140ms ease, transform 140ms ease;
}

.stock-front-mode-icon {
  width: 14px;
  height: 14px;
  display: block;
  overflow: visible;
}

.stock-front-mode-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stock-front-mode-toggle:hover {
  background: transparent !important;
  color: var(--text-primary);
}

.stock-front-mode-toggle:focus,
.stock-front-mode-toggle:focus-visible,
.stock-front-mode-toggle:active {
  outline: none;
  background: transparent !important;
  box-shadow: none !important;
}

.stock-front-mode-toggle:active {
  transform: translateY(0.5px);
  opacity: 0.82;
}

.stock-group-title {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 -2px;
  padding: 8px 10px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: linear-gradient(180deg, rgba(18,21,42,0.96), rgba(18,21,42,0.88));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.stock-group-title:first-child {
  padding-top: 4px;
}

.stock-group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(148,163,184,0.12);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
}

.stock-pin-feedback {
  position: absolute;
  top: 46px;
  left: 50%;
  z-index: 18;
  max-width: calc(100% - 28px);
  padding: 6px 10px;
  border: 1px solid rgba(96,165,250,0.24);
  border-radius: 999px;
  background: rgba(12,18,34,0.94);
  color: #dbeafe;
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -5px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.stock-pin-feedback.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  .stock-item,
  .stock-pin-feedback {
    transition: none;
  }
}

/* ===== Stock card true front/back flip ===== */
.stock-switch-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  width: 100%;
  height: 100%;
  perspective: 1400px;
  -webkit-perspective: 1400px;
  contain: layout paint;
}

.stock-switch-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.stock-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 620ms cubic-bezier(0.22, 0.8, 0.2, 1);
  will-change: transform;
}

.stock-panel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: transparent;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  overflow: hidden;
}

.stock-panel-front {
  z-index: 2;
  transform: rotateY(0deg) translateZ(1px);
  visibility: visible;
  opacity: 1;
}

.stock-panel-manager {
  z-index: 1;
  transform: rotateY(-180deg) translateZ(1px);
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
}

.stock-switch-card.is-manager-view .stock-flip-inner {
  transform: rotateY(180deg);
}

.stock-switch-card.is-manager-view .stock-panel-manager {
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
}

.stock-switch-card.is-manager-view .stock-panel-front {
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
}

.stock-manager-shell-fixed {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.stock-manager-header-fixed {
  flex-shrink: 0;
}

.stock-manager-body-fixed {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 0 14px 12px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  contain: layout paint style;
  scrollbar-gutter: stable;
  -ms-overflow-style: none;
  scrollbar-width: none;
  gap: 10px;
}

.stock-manager-body-fixed::-webkit-scrollbar {
  display: none;
}

.stock-manager-status {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 0;
}

.stock-manager-topline-fixed {
  flex-shrink: 0;
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(148,163,184,0.18);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
  white-space: normal;
}

.stock-manager-scroll-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  contain: layout paint style;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 2px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.stock-manager-scroll-area::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.stock-manager-scroll-area::-webkit-scrollbar-track,
.stock-manager-scroll-area::-webkit-scrollbar-thumb {
  display: none;
  background: transparent;
}

.stock-manager-list-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 180px;
}

.stock-manager-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(86px, .58fr) minmax(86px, .58fr) minmax(96px, .62fr);
  gap: 8px;
  align-items: center;
}

.stock-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  padding: 10px 11px;
  border-radius: 12px;
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(148,163,184,0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}

.stock-manager-list-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.stock-form-section-title,
.stock-field-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.stock-manager-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.stock-panel-front > .card-header,
.stock-panel-manager > .stock-manager-shell-fixed > .card-header {
  flex-shrink: 0;
  padding-left: 14px;
  padding-right: 14px;
  padding-top: 14px;
  padding-bottom: 10px;
  position: relative;
}

.stock-mobile-flip-hotspot {
  display: none;
}

@media (max-width: 768px) {
  .stock-mobile-flip-hotspot {
    position: absolute;
    left: 12px;
    right: 12px;
    top: 6px;
    height: 26px;
    padding: 0;
    margin: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    pointer-events: none;
    touch-action: pan-y;
    -webkit-tap-highlight-color: transparent;
  }

  .stock-mobile-flip-hotspot__hint {
    pointer-events: none;
    font-size: 10px;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.10);
    border: 1px dashed rgba(148, 163, 184, 0.18);
    opacity: 0.78;
    transition: opacity 160ms ease, transform 160ms ease, background 160ms ease, border-color 160ms ease;
  }

  .stock-mobile-flip-hotspot.is-flash .stock-mobile-flip-hotspot__hint {
    opacity: 1;
    transform: translateY(-1px);
    background: rgba(96, 165, 250, 0.16);
    border-color: rgba(96, 165, 250, 0.28);
  }

  .stock-panel-front > .card-header h3,
  .stock-panel-manager > .stock-manager-shell-fixed > .card-header h3 {
    padding-top: 16px;
  }
}

.stock-panel-front > .card-body,
.stock-panel-manager .stock-manager-body-fixed {
  flex: 1;
  min-height: 0;
}

.stock-panel-front > .card-body {
  padding: 0 14px 12px;
  min-width: 0;
}

.stock-panel-manager .card-header h3,
.stock-panel-front .card-header h3 {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
}

.stock-panel-manager .card-header .badge,
.stock-panel-front .card-header .badge {
  vertical-align: middle;
}

.stock-panel-manager .btn-icon.btn-edit,
.stock-panel-front .btn-icon.btn-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.stock-manager-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.stock-plus-btn {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
  transition: background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition), filter var(--transition);
  transform: translateY(-0.5px);
}

.stock-plus-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.14);
}

.stock-plus-btn:active {
  transform: translateY(0);
  filter: brightness(0.98);
}

.stock-plus-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(139,92,246,0.18);
}

.stock-plus-btn:disabled {
  opacity: 0.5;
}

.btn-add-quick {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(96,165,250,0.92), rgba(139,92,246,0.92));
  color: #ffffff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
  box-shadow: none;
}
.btn-add-quick:hover {
  filter: brightness(1.04);
}
.btn-add-quick:disabled {
  opacity: 0.55;
  cursor: wait;
  box-shadow: none;
}

.stock-manager-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(148,163,184,0.22);
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}
.stock-manager-input::placeholder {
  color: rgba(255,255,255,0.52);
  opacity: 1;
}
.stock-manager-input:focus {
  border-color: rgba(139,92,246,0.9);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.14);
  background: rgba(255,255,255,0.08);
}
.stock-manager-input:disabled {
  opacity: 0.55;
  cursor: wait;
}

.stock-manager-example {
  flex-shrink: 0;
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-muted);
  white-space: normal;
}

.stock-preview-card.is-muted {
  opacity: 0.55;
}

.stock-autocomplete {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stock-suggestion-item {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,0.18);
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.stock-suggestion-item:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(139,92,246,0.2);
  transform: translateY(-1px);
}

.stock-suggestion-main {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.stock-suggestion-meta {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.stock-preview-card {
  padding: 10px 11px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(148,163,184,0.18);
}

.stock-preview-card.is-duplicate {
  background: rgba(245,158,11,0.08);
  border-color: rgba(245,158,11,0.34);
}

.stock-preview-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.stock-preview-main {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.stock-preview-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
}

.stock-preview-meta {
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.stock-preview-lookup {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.4;
  color: rgba(96, 165, 250, 0.92);
}

.stock-preview-duplicate {
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.45;
  color: rgba(251, 191, 36, 0.96);
}

.stock-preview-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(139,92,246,0.16);
  color: #ddd6fe;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.stock-preview-card.is-duplicate .stock-preview-badge {
  background: rgba(245,158,11,0.18);
  color: #fde68a;
}

.stock-manager-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 10px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  margin-bottom: 8px;
  box-shadow: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease, transform 140ms ease;
}

.stock-manager-item:hover {
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
}

.stock-manager-item.is-editing {
  border-color: rgba(96,165,250,0.62);
  background: linear-gradient(180deg, rgba(96,165,250,0.12), rgba(96,165,250,0.07));
  box-shadow: 0 0 0 1px rgba(96,165,250,0.24), 0 10px 26px rgba(59,130,246,0.16);
  transform: translateY(-1px);
}

.stock-manager-item.is-recently-saved {
  border-color: rgba(34,197,94,0.45);
  box-shadow: 0 0 0 1px rgba(34,197,94,0.16), 0 8px 22px rgba(34,197,94,0.1);
}

.stock-manager-item.is-disabled {
  opacity: 0.9;
}

.stock-manager-item.is-disabled:not(.is-editing):not(.is-delete-pending) {
  background: rgba(255,255,255,0.03);
}

.stock-manager-item.is-delete-pending {
  border-color: rgba(239,68,68,0.16);
  background: rgba(239,68,68,0.08);
}

.stock-manager-item.is-flip-animating {
  transition: transform 520ms cubic-bezier(0.22, 0.8, 0.2, 1), box-shadow 280ms ease, border-color 280ms ease, filter 280ms ease;
  z-index: 2;
}

.stock-manager-item.is-flip-primary {
  z-index: 4;
  box-shadow: 0 22px 40px rgba(59,130,246,0.22), 0 0 0 1px rgba(96,165,250,0.26);
  border-color: rgba(96,165,250,0.52);
  filter: saturate(1.05) brightness(1.02);
}

.stock-manager-item.is-flip-peer {
  z-index: 3;
  box-shadow: 0 10px 22px rgba(59,130,246,0.1), 0 0 0 1px rgba(96,165,250,0.14);
  border-color: rgba(96,165,250,0.3);
}

.stock-manager-item.is-flip-peer-up {
  transform-origin: center center;
  filter: saturate(1.02);
}

.stock-manager-item.is-flip-peer-down {
  transform-origin: center center;
  filter: saturate(1.02);
}

[data-theme="light"] .stock-manager-item.is-flip-primary {
  box-shadow: 0 18px 32px rgba(59,130,246,0.16), 0 0 0 1px rgba(59,130,246,0.18);
  border-color: rgba(59,130,246,0.34);
}

[data-theme="light"] .stock-manager-item.is-flip-peer {
  box-shadow: 0 10px 18px rgba(59,130,246,0.08), 0 0 0 1px rgba(59,130,246,0.1);
  border-color: rgba(59,130,246,0.2);
}

@keyframes stock-peer-yield-up {
  0% { transform: translateY(0) scale(1); }
  28% { transform: translateY(-8px) scale(0.988); }
  55% { transform: translateY(-4px) scale(0.994); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes stock-peer-yield-down {
  0% { transform: translateY(0) scale(1); }
  28% { transform: translateY(8px) scale(0.988); }
  55% { transform: translateY(4px) scale(0.994); }
  100% { transform: translateY(0) scale(1); }
}

.stock-manager-item.is-flip-peer-up {
  animation: stock-peer-yield-up 560ms cubic-bezier(0.22, 0.8, 0.2, 1);
}

.stock-manager-item.is-flip-peer-down {
  animation: stock-peer-yield-down 560ms cubic-bezier(0.22, 0.8, 0.2, 1);
}

.stock-manager-inline-confirm {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(239,68,68,0.22);
}

.stock-manager-inline-confirm.is-danger-zone {
  padding: 10px 12px;
  border-top: none;
  border-radius: 10px;
  background: rgba(127,29,29,0.18);
  box-shadow: inset 0 0 0 1px rgba(248,113,113,0.12);
}

.stock-manager-inline-confirm-text {
  font-size: 12px;
  color: #fca5a5;
  line-height: 1.45;
  margin-bottom: 8px;
}

.stock-manager-inline-confirm-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stock-manager-list {
  flex: 0 0 auto;
  min-height: 180px;
  min-width: 0;
  overflow: visible;
  scrollbar-gutter: auto;
  padding-right: 0;
  margin-top: 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 8px;
}

.stock-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
}
.stock-manager-chips {
  padding-bottom: 4px;
}
.stock-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 10px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  max-width: 100%;
}
.stock-chip-code {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}
.stock-chip-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.stock-chip-remove:hover { color: #ef4444; background: rgba(239,68,68,0.12); }
.stock-chips-empty {
  width: 100%;
  font-size: 12px;
  color: var(--text-muted);
  padding: 10px 2px;
}

.stock-manager-item-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 50px;
  gap: 0;
  align-items: stretch;
  margin: -10px -10px -10px 0;
}

.stock-manager-item-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 10px 10px 10px;
}

.stock-manager-item-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.stock-manager-item-main > div:first-child {
  min-width: 0;
  flex: 1;
}

.stock-manager-item-title-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.stock-manager-item-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  word-break: break-word;
  min-width: 0;
  flex: 0 1 auto;
}

.stock-manager-item-meta {
  font-size: 11px;
  line-height: 1.25;
  color: var(--text-secondary);
  margin-top: 1px;
  word-break: break-word;
}

.stock-manager-kline-diagnostic {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.35;
}

.stock-manager-kline-diagnostic span {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 800;
  background: rgba(148, 163, 184, 0.10);
}

.stock-manager-kline-diagnostic small {
  min-width: 0;
  color: var(--text-muted);
  font-size: 10px;
}

.stock-manager-kline-diagnostic.is-ok span {
  color: #22c55e;
  background: rgba(34, 197, 94, 0.12);
}

.stock-manager-kline-diagnostic.is-warn span,
.stock-manager-kline-diagnostic.is-missing span {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
}

.stock-manager-kline-diagnostic.is-waiting span {
  color: var(--text-secondary);
}

.stock-manager-item-badges {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  justify-content: flex-start;
  flex: 0 0 auto;
}

.stock-mini-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.15;
  vertical-align: middle;
}

.stock-mini-badge.is-enabled {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.18);
  color: #86efac;
}

.stock-mini-badge.is-disabled {
  background: rgba(148,163,184,0.16);
  color: #cbd5e1;
}

.stock-mini-badge.is-editing {
  background: rgba(96,165,250,0.2);
  color: #dbeafe;
  box-shadow: inset 0 0 0 1px rgba(147,197,253,0.14);
}

.stock-mini-badge.is-saved {
  background: rgba(34,197,94,0.16);
  color: #dcfce7;
  box-shadow: inset 0 0 0 1px rgba(134,239,172,0.12);
}

.stock-manager-item-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  margin-top: 0;
  align-items: center;
  row-gap: 8px;
}

.stock-manager-item-actions-primary {
  padding-top: 1px;
}

.stock-manager-item-actions > * {
  flex: 0 0 auto;
}

.stock-manager-sort-rail {
  display: grid;
  grid-template-rows: 1fr 1fr;
  min-height: 100%;
  align-self: stretch;
  border-radius: 0 12px 12px 0;
  overflow: hidden;
  border-left: 1px solid rgba(148,163,184,0.14);
  background: rgba(148,163,184,0.06);
  box-shadow: none;
}

.stock-sort-rail-btn {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  position: relative;
  transition: background 140ms ease, color 140ms ease, opacity 140ms ease, transform 140ms ease;
}

.stock-sort-rail-btn::before {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  height: 6px;
  pointer-events: none;
  opacity: 0.18;
}

.stock-sort-rail-btn.is-up::before {
  top: 6px;
  background: linear-gradient(180deg, rgba(148,163,184,0.22), transparent);
}

.stock-sort-rail-btn.is-down::before {
  bottom: 6px;
  background: linear-gradient(0deg, rgba(148,163,184,0.22), transparent);
}

.stock-sort-rail-btn + .stock-sort-rail-btn {
  border-top: 1px solid rgba(148,163,184,0.14);
}

.stock-sort-rail-btn:hover {
  background: rgba(96,165,250,0.12);
  color: #dbeafe;
}

.stock-sort-rail-btn:hover::before {
  opacity: 0.3;
}

.stock-sort-rail-btn.is-up:hover {
  background: rgba(96,165,250,0.12);
}

.stock-sort-rail-btn.is-down:hover {
  background: rgba(96,165,250,0.12);
}

.stock-sort-rail-btn:active {
  background: rgba(96,165,250,0.18);
  color: #eff6ff;
}

.stock-sort-rail-btn:disabled {
  opacity: 0.22;
  cursor: not-allowed;
}

.stock-sort-rail-btn:disabled::before {
  opacity: 0.14;
}

.stock-manager-linkbtn {
  border: 0;
  background: rgba(96,165,250,0.14);
  color: #93c5fd;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  min-height: 30px;
  border-radius: 999px;
  box-shadow: none;
  line-height: 1.2;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease, opacity 140ms ease;
}

.stock-manager-linkbtn:hover {
  background: rgba(96,165,250,0.22);
  color: #bfdbfe;
}

.stock-manager-linkbtn:active {
  transform: translateY(0.5px);
}

.stock-manager-linkbtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.stock-manager-linkbtn.is-primary {
  background: rgba(96,165,250,0.14);
  color: #93c5fd;
}

.stock-manager-linkbtn.is-primary:hover {
  background: rgba(96,165,250,0.22);
  color: #bfdbfe;
}

.stock-manager-linkbtn.is-ghost {
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  box-shadow: inset 0 0 0 1px rgba(148,163,184,0.16);
}

.stock-manager-linkbtn.is-ghost:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
}

.stock-manager-linkbtn.is-danger {
  background: rgba(239,68,68,0.14);
  color: #fca5a5;
  box-shadow: inset 0 0 0 1px rgba(239,68,68,0.12);
}

.stock-manager-linkbtn.is-danger:hover {
  background: rgba(239,68,68,0.22);
  color: #fecaca;
}

[data-theme="light"] .stock-plus-btn {
  background: #ffffff;
  color: var(--text-secondary);
  border-color: rgba(212,216,224,0.9);
}

[data-theme="light"] .stock-plus-btn:hover {
  background: #f5f7fb;
  color: var(--text-primary);
}

[data-theme="light"] .stock-plus-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(59,130,246,0.14);
}

[data-theme="light"] .stock-manager-sort-rail {
  background: #f1f5f9;
  border-left: 1px solid rgba(212,216,224,0.88);
  box-shadow: none;
}

[data-theme="light"] .stock-sort-rail-btn {
  color: #64748b;
}

[data-theme="light"] .stock-sort-rail-btn:hover {
  background: #eff6ff;
  color: #1d4ed8;
}

[data-theme="light"] .stock-sort-rail-btn.is-up::before {
  background: linear-gradient(180deg, rgba(148,163,184,0.24), transparent);
}

[data-theme="light"] .stock-sort-rail-btn.is-down::before {
  background: linear-gradient(0deg, rgba(148,163,184,0.24), transparent);
}

[data-theme="light"] .stock-sort-rail-btn.is-up:hover {
  background: linear-gradient(180deg, #eff6ff, #f8fbff);
}

[data-theme="light"] .stock-sort-rail-btn.is-down:hover {
  background: linear-gradient(180deg, #f8fbff, #eff6ff);
}

[data-theme="light"] .stock-sort-rail-btn:active {
  background: #dbeafe;
  color: #1d4ed8;
}

[data-theme="light"] .stock-manager-linkbtn {
  background: #eff6ff;
  color: #2563eb;
}

[data-theme="light"] .stock-manager-linkbtn:hover {
  background: #dbeafe;
  color: #1d4ed8;
}

[data-theme="light"] .stock-manager-linkbtn.is-ghost {
  background: #ffffff;
  color: #475569;
  box-shadow: inset 0 0 0 1px rgba(148,163,184,0.18);
}

[data-theme="light"] .stock-manager-linkbtn.is-ghost:hover {
  background: #f8fafc;
  color: #0f172a;
}

[data-theme="light"] .stock-manager-linkbtn.is-danger {
  background: #fef2f2;
  color: #dc2626;
  box-shadow: inset 0 0 0 1px rgba(220,38,38,0.12);
}

[data-theme="light"] .stock-manager-linkbtn.is-danger:hover {
  background: #fee2e2;
  color: #b91c1c;
}

[data-theme="light"] .stock-manager-inline-confirm.is-danger-zone {
  background: #fef2f2;
  box-shadow: inset 0 0 0 1px rgba(220,38,38,0.1);
}

[data-theme="light"] .stock-manager-inline-confirm-text {
  color: #dc2626;
}

[data-theme="light"] .stock-manager-item.is-editing {
  background: linear-gradient(180deg, #eff6ff, #f8fbff);
  border-color: rgba(59,130,246,0.28);
  box-shadow: 0 0 0 1px rgba(59,130,246,0.12), 0 10px 24px rgba(59,130,246,0.08);
}

[data-theme="light"] .stock-manager-item.is-recently-saved {
  border-color: rgba(34,197,94,0.3);
  box-shadow: 0 0 0 1px rgba(34,197,94,0.1), 0 8px 18px rgba(34,197,94,0.08);
}

[data-theme="light"] .stock-manager-item.is-disabled:not(.is-editing):not(.is-delete-pending) {
  background: #f8fafc;
}

[data-theme="light"] .stock-mini-badge.is-editing {
  background: #dbeafe;
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgba(59,130,246,0.12);
}

[data-theme="light"] .stock-mini-badge.is-disabled {
  background: rgba(148,163,184,0.14);
  color: #64748b;
}

[data-theme="light"] .stock-mini-badge.is-saved {
  background: #dcfce7;
  color: #15803d;
  box-shadow: inset 0 0 0 1px rgba(34,197,94,0.12);
}

.stock-editor-actions-fixed {
  flex-shrink: 0;
  margin-top: 0;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(107,114,128,0.1);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
  min-height: 18px;
  border: 1px solid rgba(148,163,184,0.16);
}

.stock-tip-toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(-18px) scale(0.98);
  width: fit-content;
  min-width: 0;
  max-width: min(420px, calc(100vw - 24px));
  background: rgba(245, 245, 247, 0.72);
  color: #1f2937;
  padding: 10px 16px;
  border-radius: 18px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255,255,255,0.32);
  backdrop-filter: blur(18px) saturate(1.16);
  -webkit-backdrop-filter: blur(18px) saturate(1.16);
  opacity: 0;
  transition: opacity 220ms ease, transform 220ms ease;
  z-index: 9999;
  pointer-events: none;
}

[data-theme="dark"] .stock-tip-toast {
  background: rgba(28, 28, 30, 0.72);
  color: rgba(255,255,255,0.94);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255,255,255,0.08);
}

.stock-tip-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.stock-tip-toast.is-success {
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--text);
}

.stock-tip-toast.is-error {
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--text);
}

.stock-tip-toast.is-info {
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--text);
}

.stock-editor-actions-fixed.is-success {
  background: rgba(34,197,94,0.14);
  color: #22c55e;
  border-color: rgba(255,255,255,0.08);
}
.stock-editor-actions-fixed.is-error {
  background: rgba(239,68,68,0.14);
  color: #ef4444;
  border-color: rgba(255,255,255,0.08);
}
.stock-editor-actions-fixed.is-toast.is-error {
  background: rgba(127, 29, 29, 0.88);
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.28);
}
.stock-editor-actions-fixed.is-toast.is-success {
  background: rgba(20, 83, 45, 0.9);
  color: #bbf7d0;
  border-color: rgba(74, 222, 128, 0.28);
}
.stock-editor-actions-fixed.is-saving {
  background: rgba(99,102,241,0.14);
  color: #c7d2fe;
  border-color: rgba(99,102,241,0.18);
}

.stock-field-error {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(239,68,68,0.14);
  border: 1px solid rgba(239,68,68,0.18);
  color: #fca5a5;
  font-size: 12px;
  line-height: 1.4;
}

.stock-inline-confirm {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.18);
  color: #fbbf24;
}

.stock-inline-confirm-text {
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 8px;
}

.stock-inline-confirm-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stock-form-grid-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 10px;
  align-items: end;
}

.stock-form-grid-inline > div {
  min-width: 0;
}

.stock-form-grid-inline #stock-enabled-input {
  min-width: 0;
  width: 100%;
}

.stock-manager-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 82px 82px 92px;
  gap: 8px;
  align-items: center;
}

.stock-manager-toolbar #stock-search-input {
  min-width: 0;
  width: 100%;
}

.stock-manager-toolbar #stock-filter-market,
.stock-manager-toolbar #stock-filter-enabled,
.stock-manager-toolbar #stock-link-source {
  width: 100%;
  min-width: 0;
}

.stock-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 2px;
}

.stock-form-actions .btn,
.stock-form-actions button {
  min-height: 32px;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(148,163,184,0.22);
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  box-shadow: none;
}

.stock-form-actions .btn:hover,
.stock-form-actions button:hover {
  background: rgba(255,255,255,0.1);
}

.stock-form-actions .btn-save-fp,
.stock-form-actions button.btn-save-fp {
  background: linear-gradient(135deg, rgba(96,165,250,0.92), rgba(139,92,246,0.92));
  border-color: transparent;
  color: #ffffff;
  box-shadow: none;
}

.stock-form-actions .btn-save-fp:hover,
.stock-form-actions button.btn-save-fp:hover {
  filter: brightness(1.04);
}

#stock-front-add-btn {
  font-size: 16px;
}

@media (max-width: 768px) {
  .stock-manager-item-actions {
    gap: 8px;
    row-gap: 8px;
  }

  .stock-manager-item-actions .stock-manager-linkbtn {
    min-height: 30px;
  }

  .stock-manager-item-shell {
    grid-template-columns: minmax(0, 1fr) 46px;
    gap: 0;
  }

  .stock-manager-item-actions .stock-manager-linkbtn.is-primary {
    order: 0;
  }

  .stock-manager-item-actions .stock-manager-linkbtn.is-ghost {
    order: 1;
  }

  .stock-manager-item-actions .stock-manager-linkbtn.is-danger {
    order: 2;
  }
}

/* ===== Light theme overrides ===== */
[data-theme="light"] .stock-item {
  border-bottom-color: rgba(212,216,224,0.6);
}
[data-theme="light"] .stock-item:hover {
  background: color-mix(in srgb, var(--accent-blue) 6%, #ffffff);
}
[data-theme="light"] .stock-item.is-pin-pressing {
  background: color-mix(in srgb, var(--accent-blue) 10%, #ffffff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-blue) 22%, transparent);
}
[data-theme="light"] .stock-item.is-pinned {
  background: color-mix(in srgb, var(--accent-blue) 5%, #ffffff);
}
[data-theme="light"] .stock-bar.stock-up {
  background: color-mix(in srgb, var(--accent-red) 82%, #dc2626);
}
[data-theme="light"] .stock-bar.stock-down {
  background: color-mix(in srgb, var(--accent-green) 82%, #16a34a);
}
[data-theme="light"] .stock-bar.stock-flat {
  background: color-mix(in srgb, var(--text-muted) 78%, #94a3b8);
}
[data-theme="light"] .stock-price.stock-up,
[data-theme="light"] .stock-change.stock-up,
[data-theme="light"] .arrow-up {
  color: color-mix(in srgb, var(--accent-red) 86%, #991b1b);
}
[data-theme="light"] .stock-price.stock-down,
[data-theme="light"] .stock-change.stock-down,
[data-theme="light"] .arrow-down {
  color: color-mix(in srgb, var(--accent-green) 88%, #166534);
}
[data-theme="light"] .stock-price.stock-flat,
[data-theme="light"] .stock-change.stock-flat {
  color: #64748b;
}
[data-theme="light"] .stock-change.stock-up {
  background: color-mix(in srgb, var(--accent-red) 18%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--accent-red) 26%, rgba(148,163,184,0.24));
}
[data-theme="light"] .stock-change.stock-down {
  background: color-mix(in srgb, var(--accent-green) 18%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--accent-green) 26%, rgba(148,163,184,0.24));
}
[data-theme="light"] .stock-change.stock-flat {
  background: color-mix(in srgb, var(--text-muted) 12%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--border) 42%, rgba(255,255,255,0.4));
}
[data-theme="light"] .tag-high {
  background: color-mix(in srgb, var(--accent-red) 16%, #ffffff);
  color: color-mix(in srgb, var(--accent-red) 84%, #991b1b);
  border: 1px solid color-mix(in srgb, var(--accent-red) 24%, rgba(148,163,184,0.22));
}
[data-theme="light"] .tag-low {
  background: color-mix(in srgb, var(--accent-green) 16%, #ffffff);
  color: color-mix(in srgb, var(--accent-green) 86%, #166534);
  border: 1px solid color-mix(in srgb, var(--accent-green) 24%, rgba(148,163,184,0.22));
}
[data-theme="light"] .tag-closed {
  background: color-mix(in srgb, var(--text-muted) 12%, #ffffff);
  color: #64748b;
  border: 1px solid color-mix(in srgb, var(--border) 40%, rgba(255,255,255,0.42));
}
[data-theme="light"] .tag-half-day {
  background: color-mix(in srgb, var(--accent-yellow) 20%, #ffffff);
  color: color-mix(in srgb, var(--accent-yellow) 86%, #92400e);
  border: 1px solid color-mix(in srgb, var(--accent-yellow) 28%, rgba(148,163,184,0.22));
}
[data-theme="light"] .tag-stale {
  background: color-mix(in srgb, var(--accent-purple) 16%, #ffffff);
  color: color-mix(in srgb, var(--accent-purple) 76%, #4338ca);
  border: 1px solid color-mix(in srgb, var(--accent-purple) 22%, rgba(148,163,184,0.22));
}

[data-theme="light"] .stock-front-mode-toggle {
  background: #ffffff;
  border-color: rgba(212,216,224,0.9);
  color: #475569;
}

[data-theme="light"] .stock-front-mode-toggle:hover {
  background: #f8fafc;
  border-color: rgba(59,130,246,0.22);
  color: #0f172a;
}

[data-theme="light"] .stock-front-mode-toggle.is-active {
  background: rgba(219,234,254,0.98);
  border-color: rgba(96,165,250,0.34);
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgba(147,197,253,0.20), 0 8px 16px rgba(59,130,246,0.12);
}

[data-theme="light"] .stock-group-count {
  color: #64748b;
}

[data-theme="light"] .stock-group-title {
  color: #64748b;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,250,252,0.9));
}

[data-theme="light"] .stock-group-title.is-pinned {
  color: #2563eb;
  background: linear-gradient(180deg, rgba(239,246,255,0.98), rgba(248,250,252,0.92));
}

[data-theme="light"] .stock-pin-feedback {
  border-color: rgba(59,130,246,0.2);
  background: rgba(255,255,255,0.97);
  color: #1d4ed8;
  box-shadow: 0 8px 24px rgba(15,23,42,0.14);
}

[data-theme="light"] .stock-group-count {
  background: rgba(148,163,184,0.12);
}

[data-theme="light"] .stock-manager-topline-fixed {
  background: #f8fafc;
  border-color: rgba(212,216,224,0.9);
  color: #475569;
}

[data-theme="light"] .stock-form {
  background: #ffffff;
  border-color: rgba(212,216,224,0.9);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
}

[data-theme="light"] .stock-manager-item {
  background: #ffffff;
  border-color: rgba(212,216,224,0.9);
}

[data-theme="light"] .stock-manager-item:hover {
  background: #f8fafc;
}

[data-theme="light"] .stock-manager-item.is-editing {
  background: rgba(139,92,246,0.08);
  border-color: rgba(139,92,246,0.22);
}

[data-theme="light"] .stock-manager-item.is-recently-saved {
  background: rgba(34,197,94,0.08);
  border-color: rgba(34,197,94,0.18);
}

[data-theme="light"] .stock-manager-item.is-delete-pending {
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.18);
}

[data-theme="light"] .stock-autocomplete .stock-suggestion-item,
[data-theme="light"] .stock-preview-card {
  background: #ffffff;
  border-color: rgba(212,216,224,0.9);
}

[data-theme="light"] .stock-preview-card.is-duplicate {
  background: #fffbeb;
  border-color: rgba(245,158,11,0.42);
}

[data-theme="light"] .stock-suggestion-item:hover {
  background: #f8fafc;
  border-color: rgba(139,92,246,0.22);
}

[data-theme="light"] .stock-preview-badge {
  background: rgba(139,92,246,0.1);
  color: #6d28d9;
}

[data-theme="light"] .stock-preview-card.is-duplicate .stock-preview-badge {
  background: rgba(245,158,11,0.16);
  color: #92400e;
}

[data-theme="light"] .stock-preview-duplicate {
  color: #b45309;
}

[data-theme="light"] .stock-preview-lookup {
  color: #2563eb;
}

[data-theme="light"] .stock-manager-linkbtn {
  background: #ffffff;
  color: var(--text-primary);
  border-color: rgba(212,216,224,0.9);
}

[data-theme="light"] .stock-manager-linkbtn:hover {
  background: #f8fafc;
}

[data-theme="light"] .stock-manager-input,
[data-theme="light"] .stock-manager-input.code-input,
[data-theme="light"] #stock-display-name-input,
[data-theme="light"] #stock-search-input,
[data-theme="light"] #stock-filter-market,
[data-theme="light"] #stock-filter-enabled,
[data-theme="light"] #stock-link-source,
[data-theme="light"] #stock-enabled-input {
  background: #f8fafc;
  color: #0f172a;
  border-color: rgba(148,163,184,0.3);
  -webkit-text-fill-color: #0f172a;
}

[data-theme="light"] .stock-manager-input::placeholder {
  color: rgba(71,85,105,0.82);
  -webkit-text-fill-color: rgba(71,85,105,0.82);
  opacity: 1;
}
/* ===== Todo Scrollbar ===== */
#todos-body,
#todo-bits-body {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
#todos-body.scroll-y::-webkit-scrollbar,
#todo-bits-body.scroll-y::-webkit-scrollbar {
  display: none;
}

/* ===== Light theme overrides ===== */
[data-theme="light"] .todo-item {
  border-bottom-color: rgba(212,216,224,0.6);
}
[data-theme="light"] .todo-item:hover {
  background: color-mix(in srgb, var(--accent-blue) 6%, #ffffff);
}
[data-theme="light"] .todo-input-wrap {
  background: #ffffff;
  border-color: rgba(212,216,224,0.9);
}
[data-theme="light"] .todo-input-wrap:focus-within {
  background: #ffffff;
  border-color: color-mix(in srgb, var(--accent-blue) 34%, rgba(148,163,184,0.3));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-blue) 14%, transparent);
}
[data-theme="light"] .todo-add-bar {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.98));
  border-color: rgba(212,216,224,0.78);
  box-shadow: 0 10px 24px rgba(15,23,42,0.10), inset 0 1px 0 rgba(255,255,255,0.78);
}
[data-theme="light"] .todo-add-btn {
  background: #ffffff;
  border-color: rgba(212,216,224,0.9);
}
[data-theme="light"] .todo-add-btn:hover {
  background: #f5f7fb;
  border-color: color-mix(in srgb, var(--accent-blue) 24%, rgba(148,163,184,0.3));
}

/* ===== Todo Page Switch ===== */
.todo-card-title {
  display: flex;
  align-items: center;
  min-width: 0;
}
.todo-title-icon {
  flex: 0 0 auto;
}
.todo-title-viewport {
  display: inline-block;
  overflow: hidden;
  width: 4.5em;
  min-width: 0;
  vertical-align: top;
}
.todo-title-track {
  display: flex;
  width: 200%;
  transition: transform 0.24s cubic-bezier(.2,.7,.2,1);
  will-change: transform;
}
.todo-title-track > span {
  flex: 0 0 50%;
  width: 50%;
  min-width: 0;
  white-space: nowrap;
}
.todo-card-title[data-active-page="bits"] .todo-title-track {
  transform: translateX(-50%);
}
.todo-pages {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  width: 100%;
  touch-action: pan-y;
}
.todo-pages-track {
  display: flex;
  width: 200%;
  height: 100%;
  transition: transform 0.22s cubic-bezier(.2,.7,.2,1);
  will-change: transform;
}
.todo-page {
  width: 50%;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.todo-page > .card-body {
  height: 100%;
  min-height: 0;
}

/* ===== Todo Add Bar ===== */
body:not([data-dashboard-tier="phone"]) [gs-id="todos"] > .grid-stack-item-content {
  overflow: hidden !important;
}

.todo-add-bar {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 8px 12px;
  border: 0;
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  border-radius: 0;
  background: linear-gradient(180deg, rgba(15,23,42,0.94), rgba(13,18,32,0.92));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.035);
  max-height: 56px;
  opacity: 1;
  overflow: hidden;
  transform: translateY(0);
  box-sizing: border-box;
  transform-origin: top center;
  transition: max-height 0.24s cubic-bezier(.2,.7,.2,1), opacity 0.18s ease, padding 0.24s cubic-bezier(.2,.7,.2,1), border-color 0.18s ease, transform 0.24s cubic-bezier(.2,.7,.2,1), box-shadow 0.18s ease;
}
.todo-add-bar.is-collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-color: transparent;
  transform: translateY(-6px);
  pointer-events: none;
  box-shadow: none;
}
#todo-toggle-btn[aria-expanded="true"] svg {
  transform: rotate(180deg);
}
#todo-toggle-btn svg {
  transition: transform 0.2s ease;
}
.todo-input-wrap {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: stretch;
  height: 38px;
  padding: 0;
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.todo-input-wrap:focus-within {
  border-color: rgba(96,165,250,0.4);
  box-shadow: 0 0 0 3px rgba(96,165,250,0.12);
  background: rgba(255,255,255,0.07);
}
.todo-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 0 11px;
  margin: 0;
  font-size: 14px;
  line-height: 38px;
  color: var(--text-primary);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}
.todo-input:focus {
  box-shadow: none;
  background: transparent;
}
.todo-input::placeholder {
  color: var(--text-muted);
}
.todo-add-btn {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  color: var(--accent-blue);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, opacity 0.2s;
  flex-shrink: 0;
}
.todo-add-btn:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(96,165,250,0.22);
}
.todo-add-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== Todo Items ===== */
.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 6px;
  border-bottom: 1px solid rgba(30,34,64,0.5);
  transition: background var(--transition);
}
.todo-content-wrap {
  flex: 1;
  min-width: 0;
}
.todo-mobile-head {
  display: none;
}
.todo-mobile-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
}
.todo-mobile-badge.is-today {
  background: rgba(96, 165, 250, 0.14);
  color: #bfdbfe;
}
.todo-mobile-badge.is-upcoming {
  background: rgba(245, 158, 11, 0.16);
  color: #fde68a;
}
.todo-mobile-badge.is-pending,
.todo-mobile-badge.is-todo {
  background: rgba(96, 165, 250, 0.14);
  color: #bfdbfe;
}
.todo-mobile-badge.is-done,
.todo-mobile-badge.is-archived {
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
}
.todo-mobile-meta-badge.is-today-tag {
  background: rgba(96, 165, 250, 0.14);
  color: #bfdbfe;
}
.todo-mobile-meta-badge.is-local-pinned-tag {
  background: linear-gradient(135deg, rgba(88, 28, 135, 0.34) 0%, rgba(126, 34, 206, 0.26) 100%);
  border: 1px solid rgba(168, 85, 247, 0.46);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 0 0 1px rgba(88, 28, 135, 0.16);
  color: #f3e8ff;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.todo-mobile-meta-badge.is-pinned-tag {
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
}
.todo-mobile-meta-badge.is-archived-tag {
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
}
.todo-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.todo-meta-time {
  color: var(--text-muted);
}
.todo-item:last-child { border-bottom: none; }
.todo-item:hover {
  background: rgba(110,140,255,0.03);
}

/* ===== Todo Bits ===== */
.todo-bit-item {
  position: relative;
  overflow: hidden;
  margin: 0 0 8px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.10);
  background: rgba(15, 23, 42, 0.48);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.035);
  transition: opacity 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.todo-bit-item:last-child {
  margin-bottom: 0;
}
.todo-bit-surface {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 10px 10px;
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(17,24,39,0.98), rgba(11,18,32,0.98));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  transition: transform 0.22s cubic-bezier(.2,.7,.2,1), background var(--transition), box-shadow 0.18s ease;
}
.todo-bit-item:hover .todo-bit-surface {
  background: linear-gradient(145deg, rgba(21,30,48,0.98), rgba(12,21,36,0.98));
}
.todo-bit-dot {
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(96,165,250,0.10);
}
.todo-bit-surface .todo-content-wrap {
  display: grid;
  grid-template-rows: auto auto;
  align-content: start;
  gap: 5px;
  width: 100%;
  min-width: 0;
}
.todo-bit-text {
  min-width: 0;
}
.todo-bit-surface .todo-meta {
  justify-content: flex-start;
  justify-self: start;
  text-align: left;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}
.todo-bit-actions {
  position: absolute;
  inset: 0 0 0 auto;
  width: 78px;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  padding: 5px 5px 5px 12px;
  background:
    linear-gradient(90deg, rgba(15,23,42,0), rgba(51,65,85,0.20) 28%, rgba(100,116,139,0.28)),
    linear-gradient(145deg, rgba(15,23,42,0.20), rgba(248,250,252,0.08));
}
.todo-bit-archive-btn {
  width: 62px;
  margin: 0;
  border: 1px solid rgba(148,163,184,0.20);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(248,250,252,0.18), rgba(51,65,85,0.26));
  color: #991b1b;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.12),
    inset 0 -10px 18px rgba(15,23,42,0.22),
    0 1px 0 rgba(255,255,255,0.04);
  transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.todo-bit-archive-btn:hover {
  filter: brightness(1.05);
  background: linear-gradient(145deg, rgba(255,255,255,0.22), rgba(71,85,105,0.28));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.16),
    inset 0 -11px 19px rgba(15,23,42,0.24),
    0 1px 0 rgba(255,255,255,0.05);
}
.todo-bit-archive-btn:active {
  transform: scale(0.97);
  box-shadow:
    inset 0 2px 8px rgba(15,23,42,0.42),
    inset 0 -1px 0 rgba(255,255,255,0.08);
}
.todo-bit-archive-btn:disabled {
  opacity: 0.52;
  cursor: wait;
}
.todo-bit-item.is-actions-open {
  border-color: rgba(148,163,184,0.18);
  box-shadow: 0 12px 26px rgba(15,23,42,0.24), 0 0 0 1px rgba(148,163,184,0.06), inset 0 1px 0 rgba(255,255,255,0.04);
}
.todo-bit-item.is-actions-open .todo-bit-surface {
  transform: translateX(-78px);
  box-shadow: 0 8px 20px rgba(15,23,42,0.22), inset 0 1px 0 rgba(255,255,255,0.05);
}
.todo-bit-source-badge,
.todo-bit-category-badge,
.todo-bit-today-badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}
.todo-bit-source-badge,
.todo-bit-category-badge.is-note {
  background: rgba(96,165,250,0.12);
  color: #bfdbfe;
  border: 1px solid rgba(96,165,250,0.16);
}
.todo-bit-category-badge.is-temp {
  background: rgba(251,191,36,0.13);
  color: #fde68a;
  border: 1px solid rgba(251,191,36,0.18);
}
.todo-bit-category-badge.is-other {
  background: rgba(168,85,247,0.14);
  color: #e9d5ff;
  border: 1px solid rgba(168,85,247,0.18);
}
.todo-bit-today-badge {
  background: rgba(34,197,94,0.13);
  color: #bbf7d0;
  border: 1px solid rgba(34,197,94,0.18);
}
[data-theme="light"] .todo-bit-item {
  background: rgba(255,255,255,0.72);
  border-color: rgba(148,163,184,0.14);
  box-shadow: 0 8px 18px rgba(15,23,42,0.04), inset 0 1px 0 rgba(255,255,255,0.62);
}
[data-theme="light"] .todo-bit-item:hover .todo-bit-surface {
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent-blue) 5%, #ffffff), #ffffff);
}
[data-theme="light"] .todo-bit-surface {
  background: linear-gradient(145deg, #ffffff, #f8fafc);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.82);
}
[data-theme="light"] .todo-bit-source-badge,
[data-theme="light"] .todo-bit-category-badge.is-note {
  background: color-mix(in srgb, var(--accent-blue) 12%, #ffffff);
  color: color-mix(in srgb, var(--accent-blue) 74%, #1d4ed8);
  border-color: color-mix(in srgb, var(--accent-blue) 18%, rgba(148,163,184,0.22));
}
[data-theme="light"] .todo-bit-category-badge.is-temp {
  background: color-mix(in srgb, #f59e0b 13%, #ffffff);
  color: color-mix(in srgb, #b45309 82%, #78350f);
  border-color: color-mix(in srgb, #f59e0b 20%, rgba(148,163,184,0.22));
}
[data-theme="light"] .todo-bit-category-badge.is-other {
  background: color-mix(in srgb, #8b5cf6 12%, #ffffff);
  color: color-mix(in srgb, #7c3aed 78%, #4c1d95);
  border-color: color-mix(in srgb, #8b5cf6 18%, rgba(148,163,184,0.22));
}
[data-theme="light"] .todo-bit-today-badge {
  background: color-mix(in srgb, var(--accent-green) 12%, #ffffff);
  color: color-mix(in srgb, var(--accent-green) 72%, #166534);
  border-color: color-mix(in srgb, var(--accent-green) 18%, rgba(148,163,184,0.22));
}
[data-theme="light"] .todo-bit-archive-btn {
  background: linear-gradient(145deg, #ffffff, #eef2f7);
  color: #991b1b;
  border-color: rgba(148,163,184,0.26);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.92),
    inset 0 -9px 16px rgba(148,163,184,0.16),
    0 1px 0 rgba(255,255,255,0.72);
}
[data-theme="light"] .todo-bit-actions {
  background:
    linear-gradient(90deg, transparent, rgba(226,232,240,0.42) 30%, rgba(248,250,252,0.92)),
    linear-gradient(145deg, rgba(241,245,249,0.56), rgba(255,255,255,0.78));
}
[data-theme="light"] .todo-bit-item.is-actions-open {
  border-color: rgba(148,163,184,0.20);
  box-shadow: 0 12px 24px rgba(15,23,42,0.08), 0 0 0 1px rgba(148,163,184,0.10);
}
.todo-item.is-long-pressing {
  background: rgba(110,140,255,0.08);
  box-shadow: inset 0 0 0 1px rgba(96,165,250,0.22);
}
[data-theme="light"] .todo-item.is-long-pressing {
  background: color-mix(in srgb, var(--accent-blue) 10%, #ffffff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-blue) 24%, rgba(148,163,184,0.24));
}
.todo-item.todo-checked {
  opacity: 0.6;
}
.todo-check {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 5px;
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-green);
  user-select: none;
}
.todo-check:hover {
  border-color: var(--accent-green);
  background: rgba(74,227,168,0.08);
  box-shadow: 0 0 10px rgba(74,227,168,0.2);
  transform: scale(1.1);
}
.todo-check.todo-checked {
  border-color: var(--accent-green);
  background: rgba(74,227,168,0.15);
  color: var(--accent-green);
}
.todo-text {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-primary);
  transition: color 0.3s ease, text-decoration-color 0.3s ease;
  word-break: break-word;
  overflow-wrap: anywhere;
  flex: 1;
  min-width: 0;
}
.todo-text.todo-checked {
  text-decoration: line-through;
  color: var(--text-muted);
  opacity: 0.7;
}
.todo-text code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: rgba(110,140,255,0.08);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--accent-cyan);
}
.todo-text mark {
  display: inline;
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(250, 204, 21, 0.30);
  color: #fde68a;
  box-shadow: inset 0 0 0 1px rgba(250, 204, 21, 0.18);
}
[data-theme="light"] .todo-text mark {
  background: color-mix(in srgb, var(--accent-yellow) 30%, #ffffff);
  color: #854d0e;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-yellow) 28%, rgba(202, 138, 4, 0.18));
}

[data-theme="light"] .todo-mobile-badge {
  background: color-mix(in srgb, var(--text-muted) 10%, #ffffff);
  color: #475569;
  border: 1px solid color-mix(in srgb, var(--border) 42%, rgba(255,255,255,0.4));
}

[data-theme="light"] .todo-mobile-badge.is-today {
  background: color-mix(in srgb, var(--accent-blue) 16%, #ffffff);
  color: color-mix(in srgb, var(--accent-blue) 84%, #1d4ed8);
  border-color: color-mix(in srgb, var(--accent-blue) 24%, rgba(148,163,184,0.22));
}

[data-theme="light"] .todo-mobile-badge.is-upcoming {
  background: color-mix(in srgb, var(--accent-yellow) 20%, #ffffff);
  color: color-mix(in srgb, var(--accent-yellow) 84%, #92400e);
  border-color: color-mix(in srgb, var(--accent-yellow) 28%, rgba(148,163,184,0.22));
}

[data-theme="light"] .todo-mobile-badge.is-pending,
[data-theme="light"] .todo-mobile-badge.is-todo {
  background: color-mix(in srgb, var(--accent-blue) 16%, #ffffff);
  color: color-mix(in srgb, var(--accent-blue) 84%, #1d4ed8);
  border-color: color-mix(in srgb, var(--accent-blue) 24%, rgba(148,163,184,0.22));
}

[data-theme="light"] .todo-mobile-badge.is-done,
[data-theme="light"] .todo-mobile-badge.is-archived {
  background: color-mix(in srgb, var(--accent-green) 12%, #ffffff);
  color: #475569;
  border-color: color-mix(in srgb, var(--accent-green) 16%, rgba(148,163,184,0.22));
}

[data-theme="light"] .todo-mobile-meta-badge.is-local-pinned-tag {
  background: linear-gradient(135deg, rgba(88, 28, 135, 0.16) 0%, rgba(126, 34, 206, 0.10) 100%);
  color: #6b21a8;
  border: 1px solid rgba(168, 85, 247, 0.28);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.42), 0 0 0 1px rgba(88, 28, 135, 0.05);
}
.todo-text a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--transition);
}
.todo-text a:hover {
  color: var(--accent-purple);
  text-decoration: underline;
}
.todo-text li {
  margin-left: 12px;
  list-style: disc;
  line-height: 1.35;
}
.todo-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 6px;
}
.todo-archive-badge,
.todo-pinned-badge,
.todo-local-pinned-badge,
.todo-today-badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.todo-archive-badge {
  background: rgba(148, 163, 184, 0.12);
  color: rgba(203, 213, 225, 0.86);
  border: 1px solid rgba(148, 163, 184, 0.16);
}
.todo-pinned-badge,
.todo-local-pinned-badge {
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(255,255,255,0.055);
}
.todo-pinned-badge {
  color: rgba(255, 218, 186, 0.72);
}
.todo-pinned-badge.is-muted {
  background: rgba(148, 163, 184, 0.12);
  color: rgba(203, 213, 225, 0.86);
  border: 1px solid rgba(148, 163, 184, 0.16);
}
.todo-pinned-badge.is-inactive {
  opacity: 0.82;
  text-decoration: none;
}
.todo-local-pinned-badge {
  color: rgba(243, 232, 255, 0.86);
}
.todo-today-badge {
  background: rgba(239, 68, 68, 0.16);
  color: #fecaca;
  border: 1px solid rgba(248, 113, 113, 0.18);
}
[data-theme="light"] .todo-archive-badge {
  background: rgba(148, 163, 184, 0.12);
  color: rgba(100, 116, 139, 0.92);
  border-color: rgba(148, 163, 184, 0.18);
}
[data-theme="light"] .todo-pinned-badge,
[data-theme="light"] .todo-local-pinned-badge {
  background: rgba(15, 23, 42, 0.025);
  border-color: rgba(148, 163, 184, 0.1);
}
[data-theme="light"] .todo-pinned-badge {
  color: color-mix(in srgb, var(--accent-orange, #f59e0b) 22%, #b45309);
}
[data-theme="light"] .todo-pinned-badge.is-muted {
  background: rgba(148, 163, 184, 0.12);
  color: rgba(100, 116, 139, 0.92);
  border-color: rgba(148, 163, 184, 0.18);
}
[data-theme="light"] .todo-pinned-badge.is-inactive {
  opacity: 0.84;
}
[data-theme="light"] .todo-local-pinned-badge {
  color: #6b21a8;
}
[data-theme="light"] .todo-today-badge {
  background: color-mix(in srgb, var(--accent-red) 16%, #ffffff);
  color: color-mix(in srgb, var(--accent-red) 84%, #991b1b);
  border: 1px solid color-mix(in srgb, var(--accent-red) 24%, rgba(148,163,184,0.22));
}
.todo-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 30px 0;
  font-size: 13px;
  font-weight: 500;
}

.todo-toast-root {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.todo-toast {
  min-width: 196px;
  max-width: min(396px, calc(100vw - 32px));
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(12px) saturate(1.12);
  -webkit-backdrop-filter: blur(12px) saturate(1.12);
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition: opacity 0.18s ease, transform 0.2s ease, border-color 0.2s ease;
}

.todo-toast__icon {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.08);
  color: currentColor;
  border: 1px solid rgba(255,255,255,0.06);
}

.todo-toast__icon svg {
  width: 14px;
  height: 14px;
  display: block;
}

.todo-toast__text {
  min-width: 0;
  flex: 1 1 auto;
}

.todo-toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.todo-toast.is-success {
  border-color: rgba(110, 231, 183, 0.18);
}

.todo-toast.is-success .todo-toast__icon {
  background: rgba(110, 231, 183, 0.12);
  color: #d1fae5;
}

.todo-toast.is-error {
  border-color: rgba(251, 146, 60, 0.18);
}

.todo-toast.is-error .todo-toast__icon {
  background: rgba(251, 146, 60, 0.12);
  color: #fed7aa;
}

.todo-toast.is-info {
  border-color: rgba(125, 211, 252, 0.18);
}

.todo-toast.is-info .todo-toast__icon {
  background: rgba(125, 211, 252, 0.12);
  color: #dbeafe;
}

.todo-toast.is-pin {
  border-color: rgba(253, 186, 116, 0.2);
}

.todo-toast.is-pin .todo-toast__icon {
  background: rgba(253, 186, 116, 0.12);
  color: #fde6bf;
}

.todo-toast.is-unpin {
  border-color: rgba(148, 163, 184, 0.2);
}

.todo-toast.is-unpin .todo-toast__icon {
  background: rgba(148, 163, 184, 0.12);
  color: #dbe4f0;
}

[data-theme="light"] .todo-toast {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(148, 163, 184, 0.14);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.07), inset 0 1px 0 rgba(255,255,255,0.48);
}

[data-theme="light"] .todo-toast__icon {
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(148,163,184,0.1);
}

[data-theme="light"] .todo-toast.is-success .todo-toast__icon {
  background: color-mix(in srgb, var(--accent-green) 12%, #ffffff);
  color: color-mix(in srgb, var(--accent-green) 62%, #166534);
}

[data-theme="light"] .todo-toast.is-error .todo-toast__icon {
  background: color-mix(in srgb, var(--accent-orange, #f59e0b) 12%, #ffffff);
  color: color-mix(in srgb, var(--accent-orange, #f59e0b) 58%, #c2410c);
}

[data-theme="light"] .todo-toast.is-info .todo-toast__icon {
  background: color-mix(in srgb, var(--accent-blue) 10%, #ffffff);
  color: color-mix(in srgb, var(--accent-blue) 54%, #2563eb);
}

[data-theme="light"] .todo-toast.is-pin .todo-toast__icon {
  background: color-mix(in srgb, var(--accent-orange, #f59e0b) 10%, #ffffff);
  color: color-mix(in srgb, var(--accent-orange, #f59e0b) 52%, #b45309);
}

[data-theme="light"] .todo-toast.is-unpin .todo-toast__icon {
  background: color-mix(in srgb, rgba(148,163,184,0.2) 70%, #ffffff);
  color: color-mix(in srgb, rgba(71,85,105,0.92) 84%, #334155);
}

@media (max-width: 768px) {
  #todos-body,
  #todo-bits-body {
    padding: 8px 12px 12px !important;
  }
  .todo-item.todo-item-mobile {
    gap: 10px;
    padding: 10px 4px;
  }
  .todo-bit-surface {
    gap: 10px;
    padding: 10px 4px;
  }
  .todo-bit-surface .todo-content-wrap {
    gap: 4px;
  }
  .todo-bit-surface .todo-meta {
    gap: 4px;
  }
  .todo-bit-dot {
    margin-top: 9px;
  }
  .todo-mobile-head {
    display: none;
  }
  .todo-text {
    font-size: 14px;
    line-height: 1.5;
  }
  .todo-meta {
    margin-top: 4px;
    font-size: 11px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
  }
  .todo-meta-time {
    margin-right: 2px;
  }
  .todo-mobile-meta-badge {
    min-height: 20px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.8;
  }
  .todo-mobile-meta-badge.is-today-tag {
    background: rgba(96, 165, 250, 0.14);
    color: #bfdbfe;
  }
  .todo-mobile-meta-badge.is-pinned-tag {
    background: rgba(148, 163, 184, 0.14);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.16);
  }
  .todo-mobile-meta-badge.is-pinned-tag.is-muted {
    background: rgba(148, 163, 184, 0.14);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.16);
  }
  .todo-mobile-meta-badge.is-pinned-tag.is-inactive {
    opacity: 0.82;
  }
  .todo-mobile-meta-badge.is-archived-tag {
    background: rgba(148, 163, 184, 0.14);
    color: #cbd5e1;
  }
  [data-theme="light"] .todo-mobile-meta-badge.is-today-tag {
    background: color-mix(in srgb, var(--accent-blue) 16%, #ffffff);
    color: color-mix(in srgb, var(--accent-blue) 84%, #1d4ed8);
    border: 1px solid color-mix(in srgb, var(--accent-blue) 24%, rgba(148,163,184,0.22));
  }
  [data-theme="light"] .todo-mobile-meta-badge.is-pinned-tag {
    background: rgba(148, 163, 184, 0.12);
    color: rgba(100, 116, 139, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.18);
  }
  [data-theme="light"] .todo-mobile-meta-badge.is-local-pinned-tag {
    background: linear-gradient(135deg, rgba(88, 28, 135, 0.16) 0%, rgba(126, 34, 206, 0.10) 100%);
    color: #6b21a8;
    border: 1px solid rgba(168, 85, 247, 0.28);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.42), 0 0 0 1px rgba(88, 28, 135, 0.05);
  }
  [data-theme="light"] .todo-mobile-meta-badge.is-pinned-tag.is-muted {
    background: rgba(148, 163, 184, 0.12);
    color: rgba(100, 116, 139, 0.92);
    border-color: rgba(148, 163, 184, 0.18);
  }
  [data-theme="light"] .todo-mobile-meta-badge.is-pinned-tag.is-inactive {
    opacity: 0.84;
  }
  [data-theme="light"] .todo-mobile-meta-badge.is-archived-tag {
    background: color-mix(in srgb, var(--accent-green) 12%, #ffffff);
    color: #475569;
    border: 1px solid color-mix(in srgb, var(--accent-green) 16%, rgba(148,163,184,0.22));
  }
}
/* ===== Calendar ===== */
.calendar-switch-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  width: 100%;
  height: 100%;
  perspective: 1400px;
  -webkit-perspective: 1400px;
  contain: layout paint;
}

.calendar-switch-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.calendar-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 620ms cubic-bezier(0.22, 0.8, 0.2, 1);
  will-change: transform;
}

.calendar-panel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: transparent;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  overflow: hidden;
}

.calendar-panel-front {
  z-index: 2;
  transform: rotateY(0deg) translateZ(1px);
  visibility: visible;
  opacity: 1;
}

.calendar-panel-manager {
  z-index: 1;
  transform: rotateY(-180deg) translateZ(1px);
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
}

.calendar-switch-card.is-manager-view .calendar-flip-inner {
  transform: rotateY(180deg);
}

.calendar-switch-card.is-manager-view .calendar-panel-manager {
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
}

.calendar-switch-card.is-manager-view .calendar-panel-front {
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
}

.calendar-manager-shell-fixed {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.calendar-manager-header-fixed {
  position: relative;
  flex-shrink: 0;
}

.calendar-tip-toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(-18px) scale(0.98);
  width: fit-content;
  min-width: 0;
  max-width: min(420px, calc(100vw - 24px));
  background: rgba(245, 245, 247, 0.72);
  color: #1f2937;
  padding: 10px 16px;
  border-radius: 18px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255,255,255,0.32);
  backdrop-filter: blur(18px) saturate(1.16);
  -webkit-backdrop-filter: blur(18px) saturate(1.16);
  opacity: 0;
  transition: opacity 220ms ease, transform 220ms ease;
  z-index: 9999;
  pointer-events: none;
}

[data-theme="dark"] .calendar-tip-toast {
  background: rgba(28, 28, 30, 0.72);
  color: rgba(255,255,255,0.94);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255,255,255,0.08);
}

.calendar-tip-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.calendar-tip-toast.is-success {
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--text);
}

.calendar-tip-toast.is-error {
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--text);
}

.calendar-tip-toast.is-info {
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--text);
}

.calendar-manager-body-fixed {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 0 14px 18px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  contain: layout style;
  scroll-padding-bottom: 18px;
  scrollbar-gutter: stable;
  -ms-overflow-style: none;
  scrollbar-width: none;
  gap: 10px;
}

.calendar-manager-body-fixed::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.calendar-manager-body-fixed::-webkit-scrollbar-track,
.calendar-manager-body-fixed::-webkit-scrollbar-thumb {
  display: none;
  background: transparent;
}

.calendar-manager-topline-fixed {
  flex-shrink: 0;
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
  white-space: normal;
}

.calendar-sync-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(96,165,250,0.16);
  background: rgba(59,130,246,0.08);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.calendar-sync-status span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-sync-status.is-syncing {
  color: #bfdbfe;
  border-color: rgba(96,165,250,0.26);
  background: rgba(59,130,246,0.13);
}

.calendar-sync-status.is-stale {
  color: #fcd34d;
  border-color: rgba(251,191,36,0.24);
  background: rgba(245,158,11,0.13);
}

.calendar-sync-refresh-btn {
  flex-shrink: 0;
  min-height: 28px;
  padding: 0 10px;
}

.calendar-panel-front > .card-header,
.calendar-panel-manager > .calendar-manager-shell-fixed > .card-header {
  flex-shrink: 0;
  padding-left: 14px;
  padding-right: 14px;
  padding-top: 14px;
  padding-bottom: 10px;
  position: relative;
}

.calendar-mobile-flip-hotspot {
  display: none;
}

@media (max-width: 768px) {
  .calendar-mobile-flip-hotspot {
    position: absolute;
    left: 12px;
    right: 12px;
    top: 6px;
    height: 26px;
    padding: 0;
    margin: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    pointer-events: none;
    touch-action: pan-y;
    -webkit-tap-highlight-color: transparent;
  }

  .calendar-mobile-flip-hotspot__hint {
    pointer-events: none;
    font-size: 10px;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.10);
    border: 1px dashed rgba(148, 163, 184, 0.18);
    opacity: 0.78;
    transition: opacity 160ms ease, transform 160ms ease, background 160ms ease, border-color 160ms ease;
  }

  .calendar-mobile-flip-hotspot.is-flash .calendar-mobile-flip-hotspot__hint {
    opacity: 1;
    transform: translateY(-1px);
    background: rgba(96, 165, 250, 0.16);
    border-color: rgba(96, 165, 250, 0.28);
  }

  .calendar-panel-front > .card-header h3,
  .calendar-panel-manager > .calendar-manager-shell-fixed > .card-header h3 {
    padding-top: 16px;
  }
}

.calendar-panel-front > .card-body,
.calendar-panel-manager .calendar-manager-body-fixed {
  flex: 1;
  min-height: 0;
}

.calendar-panel-front > .card-body {
  padding: 0 14px 12px;
  min-width: 0;
}

.calendar-panel-manager .card-header h3,
.calendar-panel-front .card-header h3 {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
}

.calendar-panel-manager .card-header .badge,
.calendar-panel-front .card-header .badge {
  vertical-align: middle;
}

@media (max-width: 768px) {
  #calendar-body {
    padding: 0 12px 12px;
  }
  .calendar-mobile-priority-card {
    margin-bottom: 10px;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid rgba(96,165,250,0.16);
    background: linear-gradient(180deg, rgba(96,165,250,0.12), rgba(255,255,255,0.03));
  }
  .calendar-mobile-priority-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--accent-blue);
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .calendar-mobile-priority-title {
    margin-top: 4px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
  }
  .calendar-mobile-priority-subtitle {
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.45;
    color: var(--text-secondary);
  }
  .cal-divider {
    margin-top: 12px;
  }
}

.calendar-panel-manager .btn-icon.btn-edit,
.calendar-panel-front .btn-icon.btn-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.calendar-form {
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex-shrink: 0;
  padding: 10px 11px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.calendar-form-summary {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(96,165,250,0.12);
  border: 1px solid rgba(96,165,250,0.2);
  color: #bfdbfe;
  font-size: 12px;
  line-height: 1.45;
}

.calendar-field-error {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(239,68,68,0.14);
  border: 1px solid rgba(239,68,68,0.18);
  color: #fca5a5;
  font-size: 12px;
  line-height: 1.4;
}

.calendar-manager-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px 96px;
  gap: 8px;
  align-items: center;
}

.calendar-manager-toolbar #calendar-search-input,
.calendar-manager-toolbar #calendar-filter-range,
.calendar-manager-toolbar #calendar-filter-calendar {
  min-width: 0;
}

@media (max-width: 768px) {
  .calendar-manager-toolbar {
    grid-template-columns: 1fr;
  }
}

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

.calendar-form-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.calendar-manager-input {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}

.calendar-manager-input::placeholder {
  color: rgba(255,255,255,0.42);
}

.calendar-manager-input:focus {
  border-color: rgba(139,92,246,0.9);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.14);
  background: rgba(255,255,255,0.08);
}

.calendar-manager-input:disabled {
  opacity: 0.55;
  cursor: wait;
}

.calendar-manager-textarea {
  min-height: 56px;
  resize: vertical;
}

.calendar-check-row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 0 2px;
}

.calendar-inline-confirm {
  display: none;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.5;
}

.calendar-inline-confirm.is-active {
  display: block;
}

.calendar-inline-confirm.is-danger-zone {
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.09), rgba(239, 68, 68, 0.05));
  border-color: rgba(239, 68, 68, 0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 6px 16px rgba(15,23,42,0.08);
}

.calendar-inline-confirm-text {
  font-weight: 600;
}

.calendar-inline-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.calendar-inline-confirm .calendar-manager-linkbtn {
  min-height: 32px;
  border-radius: 999px;
  padding: 0 12px;
}

.calendar-inline-confirm .calendar-manager-linkbtn.is-danger {
  background: linear-gradient(180deg, rgba(239,68,68,0.96), rgba(220,38,38,0.96));
  color: #fff;
  border: 1px solid rgba(248,113,113,0.42);
  box-shadow: 0 8px 18px rgba(220,38,38,0.22);
}

.calendar-inline-confirm .calendar-manager-linkbtn.is-danger:hover {
  filter: brightness(1.04);
  box-shadow: 0 10px 22px rgba(220,38,38,0.28);
}

.calendar-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 2px;
}

.calendar-form-actions .btn,
.calendar-form-actions button {
  min-height: 32px;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
}

.calendar-form-actions .btn:hover,
.calendar-form-actions button:hover {
  background: rgba(255,255,255,0.1);
}

.calendar-form-actions .btn-primary,
.calendar-form-actions button.btn-primary {
  background: linear-gradient(135deg, rgba(96,165,250,0.92), rgba(139,92,246,0.92));
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(96,165,250,0.2);
}

.calendar-form-actions .btn-primary:hover,
.calendar-form-actions button.btn-primary:hover {
  filter: brightness(1.04);
}

.calendar-manager-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 2px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.22);
  border: 1px solid rgba(255,255,255,0.08);
}

.calendar-manager-tab {
  min-height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.calendar-manager-tab.is-active {
  color: var(--text-primary);
  background: rgba(255,255,255,0.1);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

.calendar-manager-pane {
  display: none;
  min-height: 0;
}

.calendar-manager-pane.is-active {
  display: block;
}

.calendar-source-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin: 10px 0 0;
}

.calendar-source-toolbar .calendar-source-action {
  min-height: 32px;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
}

.calendar-source-toolbar .calendar-source-action:hover {
  background: rgba(255,255,255,0.1);
}

.calendar-source-toolbar .btn-save-fp {
  margin-left: 0 !important;
}

.calendar-source-hint,
.calendar-source-feedback {
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(107,114,128,0.14);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
  margin-bottom: 8px;
}

.calendar-source-feedback.is-success {
  background: rgba(34,197,94,0.13);
  color: #86efac;
  border-color: rgba(74,222,128,0.22);
}

.calendar-source-feedback.is-error {
  background: rgba(239,68,68,0.13);
  color: #fca5a5;
  border-color: rgba(248,113,113,0.24);
}

.calendar-source-feedback.is-saving {
  background: rgba(59,130,246,0.13);
  color: #bfdbfe;
  border-color: rgba(96,165,250,0.22);
}

.calendar-source-feedback.is-warning,
.calendar-source-refresh-confirm {
  background: rgba(245,158,11,0.13);
  color: #fcd34d;
  border-color: rgba(251,191,36,0.24);
}

.calendar-source-refresh-confirm {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
  font-size: 12px;
  line-height: 1.45;
}

.calendar-source-refresh-confirm span {
  margin-right: auto;
}

.calendar-source-section {
  margin-top: 10px;
}

.calendar-source-section-title {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.calendar-source-account-row,
.calendar-source-item {
  display: grid;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  margin-bottom: 8px;
}

.calendar-source-account-row {
  grid-template-columns: 44px minmax(70px, 0.8fr) minmax(120px, 1.4fr) minmax(76px, 0.8fr);
  font-size: 12px;
}

.calendar-source-account-row em,
.calendar-source-account-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
  font-style: normal;
}

.calendar-source-item {
  grid-template-columns: 1fr;
  align-items: stretch;
}

.calendar-source-item.is-disabled {
  opacity: 0.78;
}

.calendar-source-item-head {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.calendar-source-toggle {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.calendar-source-name,
.calendar-source-url {
  min-width: 0;
}

.calendar-source-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.calendar-source-actions .calendar-manager-linkbtn {
  min-height: 32px;
  padding: 0 10px;
}

.calendar-source-feedback-inline {
  margin: 0;
}

@media (max-width: 768px) {
  .calendar-source-toolbar {
    justify-content: stretch;
  }

  .calendar-source-toolbar .calendar-source-action {
    flex: 1 1 auto;
  }

  .calendar-source-item-head {
    grid-template-columns: minmax(0, 1fr);
  }

  .calendar-source-toggle {
    justify-self: flex-start;
  }

  .calendar-source-actions {
    justify-content: flex-start;
  }
}

.calendar-manager-list {
  flex: 0 0 auto;
  min-height: 0;
  min-width: 0;
  overflow: visible;
  padding-bottom: 10px;
  padding-right: 0;
  margin-top: 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 8px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.calendar-manager-list::-webkit-scrollbar {
  display: none;
}

.calendar-editor-actions-fixed {
  flex-shrink: 0;
  margin-top: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(107,114,128,0.14);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
  min-height: 18px;
  border: 1px solid rgba(255,255,255,0.08);
}

.calendar-editor-actions-fixed.is-toast {
  position: absolute;
  left: 50%;
  right: auto;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 12;
  min-height: 0;
  width: auto;
  max-width: calc(100% - 24px);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.14);
  animation: calendar-toast-in 180ms ease-out;
}

@media (max-width: 768px) {
  .calendar-editor-actions-fixed.is-toast {
    max-width: calc(100% - 16px);
    white-space: normal;
    text-align: center;
  }
}

@keyframes calendar-toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(6px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}


.calendar-editor-actions-fixed.is-error {
  background: rgba(239,68,68,0.14);
  color: #ef4444;
}

.calendar-editor-actions-fixed.is-success {
  background: rgba(34,197,94,0.14);
  color: #22c55e;
}

.calendar-editor-actions-fixed.is-toast.is-error {
  background: rgba(127, 29, 29, 0.9);
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.28);
  border-radius: 12px;
  padding: 8px 11px;
  white-space: normal;
}

.calendar-editor-actions-fixed.is-toast.is-success {
  background: rgba(20, 83, 45, 0.82);
  color: #dcfce7;
  border-color: rgba(74, 222, 128, 0.22);
}

.calendar-editor-actions-fixed.is-saving {
  background: rgba(55, 65, 81, 0.76);
  color: rgba(255,255,255,0.92);
  border-color: rgba(255,255,255,0.12);
}

.calendar-manager-section {
  margin-bottom: 14px;
}

.calendar-manager-section-title {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.calendar-manager-section.is-past .calendar-manager-section-title {
  opacity: 0.82;
}

.calendar-manager-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 10px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  margin-bottom: 8px;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease, transform 140ms ease;
}

.calendar-manager-item.is-readonly {
  opacity: 0.9;
}

.calendar-manager-item.is-editing {
  border-color: rgba(96,165,250,0.62);
  background: linear-gradient(180deg, rgba(96,165,250,0.12), rgba(96,165,250,0.07));
  box-shadow: 0 0 0 1px rgba(96,165,250,0.24), 0 10px 26px rgba(59,130,246,0.16);
  transform: translateY(-1px);
}

.calendar-manager-item.is-recently-saved {
  border-color: rgba(34,197,94,0.45);
  box-shadow: 0 0 0 1px rgba(34,197,94,0.16), 0 8px 22px rgba(34,197,94,0.1);
}

.calendar-mini-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.calendar-mini-badge.is-editing {
  background: rgba(96,165,250,0.2);
  color: #dbeafe;
  box-shadow: inset 0 0 0 1px rgba(147,197,253,0.14);
}

.calendar-mini-badge.is-readonly {
  background: rgba(148,163,184,0.16);
  color: #cbd5e1;
}

.calendar-mini-badge.is-editable {
  background: rgba(148,163,184,0.16);
  color: #cbd5e1;
}

.calendar-mini-badge.is-source {
  max-width: min(220px, 70%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(14,165,233,0.14);
  color: #bae6fd;
  box-shadow: inset 0 0 0 1px rgba(125,211,252,0.12);
}

.calendar-mini-badge.is-source.is-local {
  background: rgba(245,158,11,0.16);
  color: #fde68a;
  box-shadow: inset 0 0 0 1px rgba(251,191,36,0.16);
}

.calendar-mini-badge.is-source.is-caldav {
  background: rgba(99,102,241,0.16);
  color: #c7d2fe;
  box-shadow: inset 0 0 0 1px rgba(129,140,248,0.14);
}

.calendar-mini-badge.is-source.is-ics {
  background: rgba(20,184,166,0.15);
  color: #99f6e4;
  box-shadow: inset 0 0 0 1px rgba(45,212,191,0.14);
}

.calendar-manager-item-source-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.calendar-manager-item-source-meta .calendar-mini-badge {
  margin-right: 0;
}

.calendar-readonly-reason {
  color: var(--text-muted);
}

.calendar-manager-item-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.calendar-manager-item-main > div:first-child {
  min-width: 0;
  flex: 1;
}

.calendar-manager-item-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  word-break: break-word;
}

.calendar-manager-item-meta {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-top: 2px;
  word-break: break-word;
}

.calendar-manager-item-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  padding-top: 1px;
}

.calendar-manager-linkbtn {
  border: 0;
  background: rgba(96,165,250,0.14);
  color: #93c5fd;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 999px;
}

.calendar-manager-linkbtn:hover {
  background: rgba(96,165,250,0.22);
  color: #bfdbfe;
}

.calendar-manager-linkbtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.calendar-manager-linkbtn.is-danger {
  background: rgba(239,68,68,0.14);
  color: #fca5a5;
}

.calendar-manager-linkbtn.is-danger:hover {
  background: rgba(239,68,68,0.22);
  color: #fecaca;
}

.calendar-manager-linkbtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

[data-theme="light"] .calendar-manager-topline-fixed {
  background: #ffffff;
  border-color: rgba(15,23,42,0.08);
  color: #475569;
}

[data-theme="light"] .calendar-sync-status {
  background: #eff6ff;
  border-color: rgba(59,130,246,0.16);
  color: #1d4ed8;
}

[data-theme="light"] .calendar-sync-status.is-syncing {
  background: #dbeafe;
  border-color: rgba(59,130,246,0.24);
  color: #1e40af;
}

[data-theme="light"] .calendar-sync-status.is-stale {
  background: #fffbeb;
  border-color: rgba(245,158,11,0.24);
  color: #92400e;
}

[data-theme="light"] .calendar-form {
  background: #ffffff;
  border-color: rgba(15,23,42,0.08);
  box-shadow: 0 6px 18px rgba(15,23,42,0.05);
}

[data-theme="light"] .calendar-form-summary {
  background: #eff6ff;
  border-color: rgba(59,130,246,0.14);
  color: #1d4ed8;
}

[data-theme="light"] .calendar-manager-item.is-editing {
  background: linear-gradient(180deg, #eff6ff, #f8fbff);
  border-color: rgba(59,130,246,0.28);
  box-shadow: 0 0 0 1px rgba(59,130,246,0.12), 0 10px 24px rgba(59,130,246,0.08);
}

[data-theme="light"] .calendar-mini-badge.is-editing {
  background: #dbeafe;
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgba(59,130,246,0.12);
}

[data-theme="light"] .calendar-field-error {
  background: #fef2f2;
  border-color: rgba(220,38,38,0.14);
  color: #dc2626;
}

[data-theme="light"] .calendar-manager-input {
  background: #f8fafc;
  border-color: rgba(148,163,184,0.3);
  color: #0f172a;
}

[data-theme="light"] .calendar-manager-input::placeholder {
  color: #94a3b8;
}

[data-theme="light"] .calendar-manager-input:focus {
  background: #ffffff;
  border-color: rgba(99,102,241,0.6);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

[data-theme="light"] .calendar-check-row {
  color: #475569;
}

[data-theme="light"] .calendar-manager-list {
  border-top-color: rgba(15,23,42,0.08);
}

[data-theme="light"] .calendar-editor-actions-fixed {
  background: #f8fafc;
  border-color: rgba(148,163,184,0.18);
  color: #475569;
}

[data-theme="light"] .calendar-editor-actions-fixed.is-error {
  background: #fef2f2;
  color: #dc2626;
  border-color: rgba(220,38,38,0.14);
}

[data-theme="light"] .calendar-editor-actions-fixed.is-success {
  background: #f0fdf4;
  color: #16a34a;
  border-color: rgba(22,163,74,0.14);
}

[data-theme="light"] .calendar-editor-actions-fixed.is-saving {
  background: #eef2ff;
  color: #4f46e5;
  border-color: rgba(79,70,229,0.14);
}

[data-theme="light"] #calendar-manage-btn,
[data-theme="light"] #calendar-back-btn {
  background: #ffffff;
  border-color: rgba(148,163,184,0.22);
  color: #334155;
}

[data-theme="light"] #calendar-manage-btn:hover,
[data-theme="light"] #calendar-back-btn:hover {
  background: #f8fafc;
  border-color: rgba(100,116,139,0.28);
}

[data-theme="light"] .calendar-form-actions .btn,
[data-theme="light"] .calendar-form-actions button {
  background: #ffffff;
  border-color: rgba(148,163,184,0.24);
  color: #334155;
}

[data-theme="light"] .calendar-form-actions .btn:hover,
[data-theme="light"] .calendar-form-actions button:hover {
  background: #f8fafc;
}

[data-theme="light"] .calendar-source-toolbar .calendar-source-action {
  background: #ffffff;
  border-color: rgba(148,163,184,0.24);
  color: #334155;
}

[data-theme="light"] .calendar-source-toolbar .calendar-source-action:hover {
  background: #f8fafc;
}

[data-theme="light"] .calendar-form-actions .btn-primary,
[data-theme="light"] .calendar-form-actions button.btn-primary {
  color: #ffffff;
}

[data-theme="light"] .calendar-manager-tabs {
  background: #f1f5f9;
  border-color: rgba(148,163,184,0.24);
}

[data-theme="light"] .calendar-manager-tab.is-active {
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(15,23,42,0.08);
}

[data-theme="light"] .calendar-source-hint,
[data-theme="light"] .calendar-source-feedback {
  background: #f8fafc;
  border-color: rgba(148,163,184,0.2);
  color: #64748b;
}

[data-theme="light"] .calendar-source-feedback.is-warning,
[data-theme="light"] .calendar-source-refresh-confirm {
  background: #fffbeb;
  border-color: rgba(245,158,11,0.24);
  color: #92400e;
}

[data-theme="light"] .calendar-source-account-row,
[data-theme="light"] .calendar-source-item {
  background: #ffffff;
  border-color: rgba(148,163,184,0.18);
  box-shadow: 0 4px 12px rgba(15,23,42,0.04);
}

[data-theme="light"] .calendar-source-toggle {
  background: #f8fafc;
  border-color: rgba(148,163,184,0.22);
  color: #475569;
}

[data-theme="light"] .calendar-manager-section-title {
  color: #64748b;
}

[data-theme="light"] .calendar-manager-item {
  background: #ffffff;
  border-color: rgba(148,163,184,0.18);
  box-shadow: 0 4px 12px rgba(15,23,42,0.04);
}

[data-theme="light"] .calendar-manager-item.is-readonly {
  background: #f8fafc;
}

[data-theme="light"] .calendar-manager-item.is-editing {
  background: #eff6ff;
  border-color: rgba(59,130,246,0.28);
  box-shadow: 0 0 0 1px rgba(59,130,246,0.12), 0 8px 22px rgba(59,130,246,0.08);
}

[data-theme="light"] .calendar-manager-item.is-recently-saved {
  border-color: rgba(22,163,74,0.22);
  box-shadow: 0 0 0 1px rgba(22,163,74,0.08), 0 8px 22px rgba(22,163,74,0.08);
}

[data-theme="light"] .calendar-mini-badge.is-editing {
  background: #dbeafe;
  color: #1d4ed8;
}

[data-theme="light"] .calendar-mini-badge.is-readonly {
  background: #e2e8f0;
  color: #475569;
}

[data-theme="light"] .calendar-mini-badge.is-editable {
  background: #e2e8f0;
  color: #475569;
}

[data-theme="light"] .calendar-mini-badge.is-source {
  background: #e0f2fe;
  color: #0369a1;
  box-shadow: inset 0 0 0 1px rgba(2,132,199,0.12);
}

[data-theme="light"] .calendar-mini-badge.is-source.is-local {
  background: #fef3c7;
  color: #92400e;
  box-shadow: inset 0 0 0 1px rgba(217,119,6,0.14);
}

[data-theme="light"] .calendar-mini-badge.is-source.is-caldav {
  background: #e0e7ff;
  color: #3730a3;
  box-shadow: inset 0 0 0 1px rgba(79,70,229,0.12);
}

[data-theme="light"] .calendar-mini-badge.is-source.is-ics {
  background: #ccfbf1;
  color: #0f766e;
  box-shadow: inset 0 0 0 1px rgba(13,148,136,0.14);
}

[data-theme="light"] .calendar-manager-item-title {
  color: #0f172a;
}

[data-theme="light"] .calendar-manager-item-meta {
  color: #64748b;
}

[data-theme="light"] .calendar-manager-linkbtn {
  background: #eff6ff;
  color: #2563eb;
}

[data-theme="light"] .calendar-manager-linkbtn:hover {
  background: #dbeafe;
  color: #1d4ed8;
}

[data-theme="light"] .calendar-manager-linkbtn.is-danger {
  background: #fef2f2;
  color: #dc2626;
}

[data-theme="light"] .calendar-manager-linkbtn.is-danger:hover {
  background: #fee2e2;
  color: #b91c1c;
}

.cal-event {
  --cal-gap: 18px;
  display: grid;
  grid-template-columns: 16px 52px 1fr;
  gap: 4px;
  min-height: 52px;
  padding: 4px 0 var(--cal-gap);
  align-items: center;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  position: relative;
  z-index: 1;
}

.cal-event:last-child {
  padding-bottom: 6px;
}

/* 时间线竖线 */
.cal-timeline {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  width: 8px;
  min-height: 20px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.cal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-blue);
  margin-top: 4px;
  margin-left: var(--cal-axis-x);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  box-shadow: 0 0 0 3px rgba(11,13,23,0.9);
}

/* 时间 */
.cal-time {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-blue);
  min-width: 52px;
  max-width: 52px;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  padding: 2px 0;
  line-height: 1;
}

.cal-time-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transform: translateY(-0.5px);
}

.cal-time-text {
  display: inline-block;
  line-height: 1;
}

/* 内容区域 + 双栏布局 */
.cal-content {
  position: relative;
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 14px 8px 12px;
  border-left: 2px solid rgba(129,140,248,0.52);
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(129,140,248,0.16) 0%, rgba(129,140,248,0.06) 18%, rgba(255,255,255,0.02) 44%, rgba(255,255,255,0) 100%),
    rgba(255,255,255,0.025);
  box-shadow: none;
}

.cal-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #eef2ff;
  line-height: 1.5;
  font-weight: 600;
}

.cal-title-text {
  min-width: 0;
}

.calendar-notes-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
}

.calendar-notes-trigger {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.5);
  font-size: 9px;
  font-style: normal;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  transform: translateY(1px);
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}

.calendar-notes-trigger:hover,
.calendar-notes-trigger:focus-visible,
.calendar-notes-wrap.is-open .calendar-notes-trigger,
.calendar-notes-wrap.is-pinned .calendar-notes-trigger {
  filter: brightness(1.05);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.12) inset;
  outline: none;
}

.calendar-notes-trigger:active {
  transform: translateY(2px);
}

.calendar-notes-tooltip-layer {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}

.calendar-notes-tooltip {
  position: absolute;
  width: fit-content;
  max-width: min(220px, calc(100vw - 48px));
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(12,18,34,0.96);
  border: 1px solid rgba(148,163,184,0.24);
  box-shadow: 0 10px 28px rgba(0,0,0,0.28);
  color: rgba(241,245,249,0.96);
  font-size: 11px;
  line-height: 1.45;
  white-space: normal;
  word-break: break-word;
}

.calendar-notes-tooltip-layer .calendar-notes-tooltip-floating {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-2px);
}

.calendar-notes-tooltip-layer.is-visible .calendar-notes-tooltip-floating {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.calendar-notes-tooltip::before {
  content: '';
  position: absolute;
  left: 12px;
  top: -5px;
  width: 9px;
  height: 9px;
  background: rgba(12,18,34,0.96);
  border-left: 1px solid rgba(148,163,184,0.24);
  border-top: 1px solid rgba(148,163,184,0.24);
  transform: rotate(45deg);
}

[data-theme="light"] .calendar-notes-trigger {
  background: rgba(15,23,42,0.05);
  color: rgba(15,23,42,0.5);
}

[data-theme="light"] .calendar-notes-trigger:hover,
[data-theme="light"] .calendar-notes-trigger:focus-visible,
[data-theme="light"] .calendar-notes-wrap.is-open .calendar-notes-trigger,
[data-theme="light"] .calendar-notes-wrap.is-pinned .calendar-notes-trigger {
  box-shadow: 0 0 0 1px rgba(15,23,42,0.12) inset;
}

[data-theme="light"] .calendar-notes-tooltip {
  background: rgba(12,18,34,0.96);
  border-color: rgba(148,163,184,0.24);
  color: rgba(241,245,249,0.96);
  box-shadow: 0 10px 28px rgba(0,0,0,0.28);
}

[data-theme="light"] .calendar-notes-tooltip::before {
  background: rgba(12,18,34,0.96);
  border-left-color: rgba(148,163,184,0.24);
  border-top-color: rgba(148,163,184,0.24);
}

/* 距今提示 */
.cal-relative {
  font-size: 11px;
  color: #c9d2eb;
  font-weight: 600;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
}

.cal-ongoing {
  position: relative;
}

.cal-ongoing .cal-content {
  border-left-color: rgba(244, 63, 94, 0.52);
  background: linear-gradient(90deg, rgba(244, 63, 94, 0.16), rgba(244, 63, 94, 0.04));
}

.cal-ongoing .cal-title {
  color: #fff1f4;
  font-weight: 650;
}

.cal-ongoing .cal-relative {
  color: #fff1f4;
  background: rgba(244, 63, 94, 0.24);
}

.cal-completed .cal-content {
  border-left-color: rgba(34, 197, 94, 0.32);
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.08), rgba(34, 197, 94, 0.025));
  opacity: 0.84;
}

.cal-completed .cal-title {
  color: #b7d8c4;
}

.cal-completed .cal-relative {
  color: #b7d8c4;
  background: rgba(34, 197, 94, 0.12);
}

.cal-span-clone {
  --cal-span-line: rgba(148, 163, 184, 0.42);
  --cal-span-badge-bg: rgba(99, 102, 241, 0.08);
  --cal-span-badge-fg: #dbe4ff;
  --cal-span-solid: color-mix(in srgb, var(--cal-span-line) 58%, rgba(129,140,248,0.38));
  --cal-span-dashed: color-mix(in srgb, var(--cal-span-line) 72%, rgba(255,255,255,0.12));
  --cal-span-slot-gap: 10px;
  --cal-span-right-base: 22px;
  --cal-span-slot-x: calc(100% - var(--cal-span-right-base) - (var(--cal-span-slot, 0) * var(--cal-span-slot-gap)));
}

.cal-span-clone .cal-content {
  overflow: hidden;
  border-left-color: color-mix(in srgb, var(--cal-span-line) 28%, rgba(129,140,248,0.52));
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--cal-span-badge-bg) 55%, rgba(255,255,255,0.018)) 0%, rgba(255,255,255,0.018) 16%, rgba(255,255,255,0) 100%),
    rgba(255,255,255,0.022);
}

.cal-span-clone .cal-relative {
  background: rgba(255,255,255,0.045);
  color: #cfd8ee;
}

.cal-span-clone.cal-span-title-wrapped .cal-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  justify-content: stretch;
  gap: 3px;
}

.cal-span-clone.cal-span-title-wrapped .cal-title {
  width: 100%;
}

.cal-span-clone.cal-span-title-wrapped .cal-title-text {
  min-width: 0;
}

.cal-span-clone.cal-span-title-wrapped .cal-relative {
  justify-self: start;
  width: fit-content;
  max-width: 100%;
}

.cal-span-clone[data-span-slot="0"] { --cal-span-slot: 0; }
.cal-span-clone[data-span-slot="1"] { --cal-span-slot: 1; }
.cal-span-clone[data-span-slot="2"] { --cal-span-slot: 2; }
.cal-span-clone[data-span-slot="3"] { --cal-span-slot: 3; }

.cal-span-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.cal-span-clone .cal-span-overlay::before,
.cal-span-clone .cal-span-overlay::after,
.cal-span-clone .cal-span-overlay .cal-span-seg-top,
.cal-span-clone .cal-span-overlay .cal-span-seg-bottom,
.cal-span-clone .cal-span-overlay .cal-span-hook-start,
.cal-span-clone .cal-span-overlay .cal-span-hook-end {
  position: absolute;
  left: var(--cal-span-slot-x);
  transform: translateX(-50%);
  pointer-events: none;
}

.cal-span-clone .cal-span-overlay::before,
.cal-span-clone .cal-span-overlay::after {
  content: '';
  width: 0;
  border-left: 1.5px dashed var(--cal-span-dashed);
  opacity: 0;
}

.cal-span-clone .cal-span-overlay .cal-span-seg-top,
.cal-span-clone .cal-span-overlay .cal-span-seg-bottom {
  width: 1.5px;
  border-radius: 999px;
  background: var(--cal-span-solid);
  opacity: 0;
}

.cal-span-clone[data-span-pos="mid"] .cal-span-overlay .cal-span-seg-top,
.cal-span-clone[data-span-pos="mid"] .cal-span-overlay .cal-span-seg-bottom {
  opacity: 1;
}

.cal-span-clone[data-span-pos="mid"] .cal-span-overlay .cal-span-seg-top {
  top: -10px;
  bottom: 50%;
}

.cal-span-clone[data-span-pos="mid"] .cal-span-overlay .cal-span-seg-bottom {
  top: 50%;
  bottom: -10px;
}

.cal-span-clone[data-span-pos="start"] .cal-span-overlay .cal-span-seg-bottom,
.cal-span-clone[data-span-hook-end="1"] .cal-span-overlay .cal-span-seg-bottom {
  top: 50%;
  bottom: -10px;
  opacity: 1;
}

.cal-span-clone[data-span-pos="end"] .cal-span-overlay .cal-span-seg-top,
.cal-span-clone[data-span-hook-start="1"] .cal-span-overlay .cal-span-seg-top {
  top: -10px;
  bottom: 50%;
  opacity: 1;
}

.cal-span-clone[data-span-bridge-prev="1"] .cal-span-overlay .cal-span-seg-top {
  opacity: 0;
}

.cal-span-clone[data-span-bridge-next="1"] .cal-span-overlay .cal-span-seg-bottom {
  opacity: 0;
}

.cal-span-clone[data-span-bridge-prev="1"] .cal-span-overlay::before {
  top: -10px;
  bottom: 50%;
  opacity: 1;
}

.cal-span-clone[data-span-bridge-next="1"] .cal-span-overlay::after {
  top: 50%;
  bottom: -10px;
  opacity: 1;
}

.cal-span-clone[data-span-hook-start="1"] .cal-span-overlay .cal-span-hook-start,
.cal-span-clone[data-span-hook-end="1"] .cal-span-overlay .cal-span-hook-end {
  width: 10px;
  height: 12px;
  opacity: 1;
}

.cal-span-clone[data-span-hook-start="1"] .cal-span-overlay .cal-span-hook-start {
  top: -10px;
  transform: translateX(-10px);
  border-top: 1.5px solid var(--cal-span-solid);
  border-right: 1.5px solid var(--cal-span-solid);
  border-top-right-radius: 10px;
}

.cal-span-clone[data-span-hook-end="1"] .cal-span-overlay .cal-span-hook-end {
  bottom: -10px;
  transform: translateX(-10px);
  border-bottom: 1.5px solid var(--cal-span-solid);
  border-right: 1.5px solid var(--cal-span-solid);
  border-bottom-right-radius: 10px;
}

.cal-span-clone[data-span-variant="a"] {
  --cal-span-line: rgba(148, 163, 184, 0.44);
  --cal-span-badge-bg: rgba(99, 102, 241, 0.08);
  --cal-span-badge-fg: #dbe4ff;
}

.cal-span-clone[data-span-variant="b"] {
  --cal-span-line: rgba(56, 189, 248, 0.46);
  --cal-span-badge-bg: rgba(56, 189, 248, 0.08);
  --cal-span-badge-fg: #d7f5ff;
}

.cal-span-clone[data-span-variant="c"] {
  --cal-span-line: rgba(244, 114, 182, 0.44);
  --cal-span-badge-bg: rgba(244, 114, 182, 0.07);
  --cal-span-badge-fg: #ffe0f0;
}

.cal-span-clone[data-span-variant="d"] {
  --cal-span-line: rgba(250, 204, 21, 0.44);
  --cal-span-badge-bg: rgba(250, 204, 21, 0.07);
  --cal-span-badge-fg: #fff4c2;
}

.cal-span-clone[data-span-pos="start"] .cal-content {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.cal-span-clone[data-span-pos="mid"] .cal-content {
  border-top-left-radius: 11px;
  border-bottom-left-radius: 11px;
}

.cal-span-clone[data-span-pos="end"] .cal-content {
  box-shadow: inset 0 -1px 0 rgba(255,255,255,0.035);
}

.cal-span-clone[data-span-pos="solo"] .cal-content {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), inset 0 -1px 0 rgba(255,255,255,0.035);
}

/* 时段色块 */
.cal-period-am .cal-dot   { background: #b39ddb; }  /* 浅紫 */
.cal-period-am .cal-time  { color: #7e57c2; }

.cal-period-pm .cal-dot   { background: #ffb74d; }  /* 橙黄 */
.cal-period-pm .cal-time  { color: #e65100; }

.cal-period-night .cal-dot   { background: #90caf9; }  /* 浅蓝 */
.cal-period-night .cal-time  { color: #1976d2; }

.cal-span-clone .cal-dot {
  box-shadow: 0 0 0 3px rgba(11,13,23,0.9), 0 0 0 1px color-mix(in srgb, var(--cal-span-line) 48%, rgba(255,255,255,0.05));
}

.cal-span-clone .cal-timeline {
  align-self: stretch;
  min-height: auto;
}

.cal-span-clone .cal-timeline .cal-span-hook-start,
.cal-span-clone .cal-timeline .cal-span-hook-end {
  position: absolute;
  left: calc(var(--cal-axis-x) + 4px);
  width: 2px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--cal-span-line) 74%, rgba(244, 63, 94, 0.36));
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

.cal-span-clone[data-span-pos="mid"] .cal-timeline .cal-span-hook-start,
.cal-span-clone[data-span-pos="end"] .cal-timeline .cal-span-hook-start,
.cal-span-clone[data-span-hook-start="1"] .cal-timeline .cal-span-hook-start {
  top: -10px;
  bottom: calc(100% - 8px);
  opacity: 1;
}

.cal-span-clone[data-span-pos="start"] .cal-timeline .cal-span-hook-end,
.cal-span-clone[data-span-pos="mid"] .cal-timeline .cal-span-hook-end,
.cal-span-clone[data-span-hook-end="1"] .cal-timeline .cal-span-hook-end {
  top: 8px;
  bottom: -10px;
  opacity: 1;
}

/* 已结束事件 */
.cal-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 30px 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.8;
}

.cal-empty-sub {
  display: inline-block;
  font-size: 12px;
  color: var(--text-secondary);
}
.cal-past {
  opacity: 0.5;
}
.cal-past .cal-time {
  color: #7f8aa8;
}
.cal-past .cal-dot { background: #7f8aa8; }
.cal-past .cal-content {
  background: linear-gradient(180deg, rgba(17, 22, 35, 0.72), rgba(12, 17, 28, 0.82));
  border-left-color: rgba(120, 130, 156, 0.22);
}
.cal-past .cal-title {
  color: #9aa4bf;
}
.cal-past .cal-relative {
  background: rgba(100,100,120,0.05);
  color: #95a0bb;
}

/* 分组标题 */
#calendar-body {
  --cal-axis-x: 3px;
  position: relative;
}

.calendar-debug-panel {
  flex-shrink: 0;
  margin: 0 14px 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.18);
}

.calendar-debug-toggle {
  appearance: none;
  border: none;
  background: transparent;
  color: #fbbf24;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.calendar-debug-content {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calendar-debug-item {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.38);
  border: 1px solid rgba(255,255,255,0.08);
}

.calendar-debug-tag {
  color: #fde68a;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
}

.calendar-debug-msg {
  color: #f8fafc;
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
}

.calendar-debug-meta {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.4;
  word-break: break-word;
}

.calendar-timeline-content {
  position: relative;
  min-height: 100%;
}

.calendar-timeline-content::before {
  content: '';
  position: absolute;
  left: calc(4px + var(--cal-axis-x));
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(to bottom, rgba(110,140,255,0.2), rgba(155,140,255,0.58), rgba(110,140,255,0.2));
  opacity: 1;
  pointer-events: none;
  z-index: 0;
}

.cal-divider {
  position: relative;
  z-index: 1;
  text-align: center;
  color: rgba(214, 222, 255, 0.7);
  font-size: 11px;
  padding: 10px 0 6px;
  letter-spacing: 2px;
  opacity: 0.88;
}

[data-theme="light"] .cal-divider {
  color: rgba(71, 85, 105, 0.92);
  opacity: 1;
}


.cal-now-marker {
  position: absolute;
  left: calc(4px + var(--cal-axis-x));
  width: 0;
  height: 0;
  z-index: 8;
  pointer-events: none;
}

.cal-now-marker::after {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  width: 28px;
  height: 1px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, rgba(244,63,94,0.55), rgba(244,63,94,0.08));
  border-radius: 999px;
}

.cal-now-dot,
.cal-now-pulse {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -50%);
  border-radius: 999px;
}

.cal-now-dot {
  width: 8px;
  height: 8px;
  background: #f43f5e;
  box-shadow: 0 0 0 3px rgba(11,13,23,0.92), 0 0 12px rgba(244,63,94,0.35);
}

.cal-now-pulse {
  width: 16px;
  height: 16px;
  background: rgba(244,63,94,0.18);
  animation: cal-now-pulse 1.8s ease-out infinite;
}

@keyframes cal-now-pulse {
  0% {
    opacity: 0.85;
    transform: translate(-50%, -50%) scale(0.7);
  }
  75% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.7);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.85);
  }
}

[data-theme="light"] .calendar-timeline-content::before {
  background: linear-gradient(to bottom, rgba(148,163,184,0.24), rgba(99,102,241,0.38), rgba(148,163,184,0.24));
}

[data-theme="light"] .cal-dot {
  box-shadow: 0 0 0 1.5px rgba(248,250,252,0.72), 0 0 0 1px rgba(59,130,246,0.18) inset;
}

[data-theme="light"] .cal-now-dot {
  box-shadow: 0 0 0 1.5px rgba(248,250,252,0.72), 0 0 12px rgba(244,63,94,0.24);
}

[data-theme="light"] .cal-content {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--accent-blue) 14%, #ffffff) 0%, color-mix(in srgb, var(--accent-blue) 5%, #ffffff) 24%, rgba(255,255,255,0.98) 52%, rgba(255,255,255,0.94) 100%),
    color-mix(in srgb, var(--bg-card) 86%, #f8fafc);
  border: 1px solid color-mix(in srgb, var(--border) 58%, rgba(255,255,255,0.72));
  border-left: 2px solid color-mix(in srgb, var(--accent-blue) 72%, #94a3b8);
  box-shadow: 0 1px 0 rgba(255,255,255,0.6);
}

[data-theme="light"] .cal-title {
  color: #1e293b;
}

[data-theme="light"] .cal-event:not(.cal-ongoing):not(.cal-completed):not(.cal-past) .cal-time {
  color: color-mix(in srgb, var(--accent-blue) 82%, #1e3a8a);
}

[data-theme="light"] .cal-event:not(.cal-ongoing):not(.cal-completed):not(.cal-past) .cal-dot {
  background: color-mix(in srgb, var(--accent-blue) 76%, #60a5fa);
}

[data-theme="light"] .cal-relative {
  color: #334155;
  background: color-mix(in srgb, var(--accent-blue) 12%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--accent-blue) 18%, rgba(148,163,184,0.3));
}

[data-theme="light"] .cal-ongoing .cal-content {
  border-color: color-mix(in srgb, var(--accent-red) 20%, rgba(255,255,255,0.4));
  border-left-color: color-mix(in srgb, var(--accent-red) 72%, #be123c);
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent-red) 14%, #ffffff), rgba(255,255,255,0.98));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-red) 12%, transparent);
}

[data-theme="light"] .cal-ongoing .cal-title {
  color: #881337;
}

[data-theme="light"] .cal-ongoing .cal-time {
  color: color-mix(in srgb, var(--accent-red) 68%, #7f1d1d);
}

[data-theme="light"] .cal-ongoing .cal-dot {
  background: color-mix(in srgb, var(--accent-red) 78%, #fb7185);
}

[data-theme="light"] .cal-ongoing .cal-relative {
  color: #881337;
  background: color-mix(in srgb, var(--accent-red) 14%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--accent-red) 22%, rgba(255,255,255,0.32));
}

[data-theme="light"] .cal-completed .cal-content {
  border-color: color-mix(in srgb, var(--border) 52%, rgba(255,255,255,0.68));
  border-left-color: color-mix(in srgb, var(--accent-green) 62%, #86efac);
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent-green) 10%, #ffffff), rgba(255,255,255,0.97));
  opacity: 0.92;
}

[data-theme="light"] .cal-completed .cal-title {
  color: #475569;
}

[data-theme="light"] .cal-completed .cal-relative {
  color: #475569;
  background: color-mix(in srgb, var(--accent-green) 10%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--accent-green) 16%, rgba(148,163,184,0.28));
}

[data-theme="light"] .cal-completed .cal-time {
  color: color-mix(in srgb, var(--accent-green) 64%, #4b5563);
}

.cal-completed .cal-dot {
  background: #7dd3a3;
}

[data-theme="light"] .cal-completed .cal-dot {
  background: color-mix(in srgb, var(--accent-green) 66%, #86efac);
}

[data-theme="light"] .cal-span-clone {
  --cal-span-line: rgba(148, 163, 184, 0.54);
  --cal-span-badge-bg: rgba(96, 165, 250, 0.04);
  --cal-span-badge-fg: #2563eb;
}

[data-theme="light"] .cal-span-clone[data-span-variant="a"] {
  --cal-span-line: rgba(148, 163, 184, 0.54);
  --cal-span-badge-bg: rgba(96, 165, 250, 0.04);
  --cal-span-badge-fg: #2563eb;
  --cal-span-offset: 10px;
  --cal-span-width: 10px;
}

[data-theme="light"] .cal-span-clone[data-span-variant="b"] {
  --cal-span-line: rgba(14, 165, 233, 0.42);
  --cal-span-badge-bg: rgba(14, 165, 233, 0.08);
  --cal-span-badge-fg: #0369a1;
  --cal-span-offset: 16px;
  --cal-span-width: 14px;
}

[data-theme="light"] .cal-span-clone[data-span-variant="c"] {
  --cal-span-line: rgba(236, 72, 153, 0.38);
  --cal-span-badge-bg: rgba(236, 72, 153, 0.08);
  --cal-span-badge-fg: #be185d;
  --cal-span-offset: 22px;
  --cal-span-width: 18px;
}

[data-theme="light"] .cal-span-clone[data-span-variant="d"] {
  --cal-span-line: rgba(245, 158, 11, 0.4);
  --cal-span-badge-bg: rgba(245, 158, 11, 0.08);
  --cal-span-badge-fg: #b45309;
  --cal-span-offset: 28px;
  --cal-span-width: 22px;
}

[data-theme="light"] .cal-past .cal-content {
  background: color-mix(in srgb, var(--bg-card) 74%, #f1f5f9);
  border: 1px solid color-mix(in srgb, var(--border) 46%, rgba(255,255,255,0.68));
  border-left: 2px solid color-mix(in srgb, var(--text-muted) 42%, rgba(148,163,184,0.7));
}

[data-theme="light"] .cal-past .cal-title {
  color: #64748b;
}

[data-theme="light"] .cal-past .cal-time {
  color: #94a3b8;
}

[data-theme="light"] .cal-past .cal-dot {
  background: #94a3b8;
}

[data-theme="light"] .cal-past .cal-relative {
  color: #64748b;
  background: color-mix(in srgb, var(--text-muted) 10%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--border) 32%, rgba(255,255,255,0.4));
}

@media (max-width: 768px) {
  .cal-now-marker::after {
    width: 18px;
    opacity: 0.72;
  }

  .cal-span-clone {
    --cal-span-offset: 10px;
    --cal-span-width: 10px;
  }

  .cal-span-clone[data-span-variant="a"] {
    --cal-span-offset: 8px;
    --cal-span-width: 8px;
  }

  .cal-span-clone[data-span-variant="b"] {
    --cal-span-offset: 12px;
    --cal-span-width: 10px;
  }

  .cal-span-clone[data-span-variant="c"] {
    --cal-span-offset: 16px;
    --cal-span-width: 12px;
  }

  .cal-span-clone[data-span-variant="d"] {
    --cal-span-offset: 20px;
    --cal-span-width: 14px;
  }
}
/* ===== Uptime Monitor ===== */
#uptime-body {
  overflow: hidden;
  min-height: 0;
}

.uptime-empty-state {
  display: grid;
  gap: 6px;
  padding: 12px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px dashed rgba(255, 255, 255, 0.12);
}
.uptime-empty-state__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}
.uptime-empty-state__hint {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* Compact card header to match stocks */
#uptime .card-header {
  padding: 6px 0;
}
#uptime .card-header h3 {
  padding: 3px 0;
  font-size: 12px;
}

.uptime-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 2px 6px;
  margin-bottom: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.15;
  transition: none;
}
.uptime-summary.all-ok {
  background: color-mix(in srgb, var(--accent-green) 8%, transparent);
  border-color: color-mix(in srgb, var(--accent-green) 20%, transparent);
  color: var(--accent-green);
  box-shadow: none;
}
.uptime-summary.has-down {
  background: color-mix(in srgb, var(--accent-red) 8%, transparent);
  border-color: color-mix(in srgb, var(--accent-red) 22%, transparent);
  color: var(--accent-red);
  box-shadow: none;
  animation: none;
}
@keyframes pulse-down {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,107,107,0); }
  50% { box-shadow: 0 0 12px 2px rgba(255,107,107,0.15); }
}
.uptime-summary-left {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.uptime-summary-main {
  font-size: 12px;
  font-weight: 600;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.uptime-summary-sub {
  display: none;
  font-size: 10px;
  line-height: 1.35;
  color: var(--text-secondary);
  opacity: 0.9;
}
@keyframes blink-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.uptime-refresh-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.uptime-refresh-btn:hover {
  color: var(--accent-cyan);
  background: rgba(92, 224, 216, 0.1);
}
.uptime-refresh-btn.spinning {
  animation: spin-refresh 0.6s ease;
}
@keyframes spin-refresh {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.uptime-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 2px 0;
}

.uptime-down-section,
.uptime-group {
  margin-top: 6px;
}
.uptime-down-section {
  margin-bottom: 6px;
}
.uptime-down-section:first-child,
.uptime-group:first-child {
  margin-top: 0;
}
.uptime-group + .uptime-group {
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.uptime-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 3px 2px 4px;
  font-size: 12px;
  font-weight: 600;
  opacity: 0.9;
}
.uptime-down-title {
  color: var(--accent-red);
}
.uptime-group-badge {
  font-size: 11px;
  opacity: 0.7;
}
.uptime-down-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.uptime-down-list .uptime-row {
  gap: 8px;
}
.uptime-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  cursor: default;
}
.uptime-row:hover {
  transform: translateX(2px);
  background: rgba(255,255,255,0.04);
}
.uptime-row.row-down {
  padding: 0px 2px;
  background: rgba(255, 107, 107, 0.05);
  border: 1px solid rgba(255, 107, 107, 0.12);
}
.uptime-row.row-down:hover {
  background: rgba(255, 107, 107, 0.1);
  border-color: rgba(255, 107, 107, 0.25);
}

/* Status indicator dot in row */
.uptime-row-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.uptime-row-dot.dot-ok {
  background: var(--accent-green);
  box-shadow: 0 0 6px rgba(74,222,168,0.5);
}
.uptime-row-dot.dot-warn {
  background: var(--accent-yellow);
  box-shadow: 0 0 6px rgba(255,214,102,0.5);
}
.uptime-row-dot.dot-down {
  background: var(--accent-red);
  box-shadow: 0 0 6px rgba(255,107,107,0.5);
  animation: blink-dot 2s ease-in-out infinite;
}

.uptime-name-wrap {
  min-width: 50px;
  max-width: 140px;
  display: grid;
  gap: 2px;
  flex: 0 1 140px;
}
.uptime-name {
  font-size: 11px;
  color: var(--text-secondary);
  min-width: 50px;
  text-align: left;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.uptime-down-group-inline {
  display: none;
  font-size: 10px;
  line-height: 1.2;
  color: var(--text-secondary);
  opacity: 0.72;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.uptime-row.row-down .uptime-name {
  color: var(--accent-red);
  font-weight: 600;
}

.uptime-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.uptime-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s ease;
}
.uptime-bar-fill.bar-ok {
  background: linear-gradient(90deg, var(--accent-green), #22d3a7);
  box-shadow: 0 0 6px rgba(74,227,168,0.4);
}
.uptime-bar-fill.bar-warn {
  background: linear-gradient(90deg, var(--accent-yellow), #ffb347);
  box-shadow: 0 0 6px rgba(255,214,102,0.4);
}
.uptime-bar-fill.bar-down {
  background: linear-gradient(90deg, var(--accent-red), #ff6b6b);
  box-shadow: 0 0 6px rgba(255,107,107,0.4);
}

.uptime-pct {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  min-width: 48px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.uptime-pct.pct-ok { color: var(--accent-green); }
.uptime-pct.pct-warn { color: var(--accent-yellow); }
.uptime-pct.pct-down { color: var(--accent-red); }

.uptime-scroll-wrap {
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  max-height: 280px;
  min-height: 0;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  contain: layout paint style;
  scrollbar-width: none !important;
  -ms-overflow-style: none;
  scrollbar-gutter: auto;
}
.uptime-scroll-wrap::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none;
  background: transparent;
}
.uptime-scroll-wrap::-webkit-scrollbar-track,
.uptime-scroll-wrap::-webkit-scrollbar-thumb {
  display: none;
  background: transparent;
}
.uptime-scroll-wrap:hover::-webkit-scrollbar,
.uptime-scroll-wrap.manual-scroll::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
}
.uptime-scroll-track {
  display: flex;
  flex-direction: column;
  will-change: transform;
  transform: translate3d(0, 0, 0);
  animation: uptime-scroll var(--uptime-scroll-duration, 28s) linear infinite;
}
.uptime-scroll-wrap:hover:not(.manual-scroll) .uptime-scroll-track {
  animation-play-state: paused;
}
.uptime-scroll-wrap.manual-scroll .uptime-scroll-track {
  animation: none;
  transform: none !important;
  will-change: auto;
}
.uptime-scroll-wrap.no-scroll {
  overflow: visible;
  max-height: none;
}
.uptime-scroll-wrap.no-scroll .uptime-scroll-track {
  animation: none;
}
.uptime-scroll-wrap.no-scroll .uptime-list:nth-child(2) {
  display: none;
}
.uptime-scroll-wrap.mobile-readable {
  padding-right: 2px;
  padding-bottom: 6px;
}
.uptime-scroll-wrap.has-down-summary .uptime-list {
  padding-top: 2px;
}
.uptime-scroll-wrap.no-down-summary .uptime-list {
  padding-top: 0;
}
@keyframes uptime-scroll {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(0, calc(-1 * var(--uptime-scroll-distance, 50%)), 0); }
}

/* Light theme overrides */
[data-theme="light"] .uptime-summary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-green) 16%, #ffffff), color-mix(in srgb, var(--accent-green) 8%, #ffffff));
  border-color: color-mix(in srgb, var(--accent-green) 26%, rgba(148,163,184,0.28));
  color: color-mix(in srgb, var(--accent-green) 78%, #065f46);
}
[data-theme="light"] .uptime-summary.all-ok {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55), 0 1px 4px color-mix(in srgb, var(--accent-green) 14%, transparent);
}
[data-theme="light"] .uptime-summary.has-down {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-red) 16%, #ffffff), color-mix(in srgb, var(--accent-red) 8%, #ffffff));
  border-color: color-mix(in srgb, var(--accent-red) 30%, rgba(148,163,184,0.28));
  color: color-mix(in srgb, var(--accent-red) 82%, #991b1b);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55), 0 1px 4px color-mix(in srgb, var(--accent-red) 14%, transparent);
}
[data-theme="light"] .uptime-row.row-down {
  background: color-mix(in srgb, var(--accent-red) 10%, #ffffff);
  border-color: color-mix(in srgb, var(--accent-red) 24%, rgba(148,163,184,0.24));
}
[data-theme="light"] .uptime-group + .uptime-group {
  border-top-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .uptime-down-group-inline {
  color: rgba(0, 0, 0, 0.55);
}
[data-theme="light"] .uptime-row:hover {
  background: rgba(0,0,0,0.02);
}
[data-theme="light"] .uptime-row.row-down:hover {
  background: color-mix(in srgb, var(--accent-red) 14%, #ffffff);
  border-color: color-mix(in srgb, var(--accent-red) 34%, rgba(148,163,184,0.24));
}
[data-theme="light"] .uptime-row-dot.dot-ok {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-green) 20%, transparent), 0 0 6px color-mix(in srgb, var(--accent-green) 30%, transparent);
}
[data-theme="light"] .uptime-row-dot.dot-warn {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-yellow) 24%, transparent), 0 0 6px color-mix(in srgb, var(--accent-yellow) 34%, transparent);
}
[data-theme="light"] .uptime-row-dot.dot-down {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-red) 22%, transparent), 0 0 6px color-mix(in srgb, var(--accent-red) 34%, transparent);
}
[data-theme="light"] .uptime-bar-fill.bar-ok {
  box-shadow: 0 0 4px color-mix(in srgb, var(--accent-green) 30%, transparent);
}
[data-theme="light"] .uptime-bar-fill.bar-warn {
  box-shadow: 0 0 4px color-mix(in srgb, var(--accent-yellow) 34%, transparent);
}
[data-theme="light"] .uptime-bar-fill.bar-down {
  box-shadow: 0 0 4px color-mix(in srgb, var(--accent-red) 34%, transparent);
}
[data-theme="light"] .uptime-pct.pct-ok {
  color: color-mix(in srgb, var(--accent-green) 82%, #166534);
}
[data-theme="light"] .uptime-pct.pct-warn {
  color: color-mix(in srgb, var(--accent-yellow) 84%, #92400e);
}
[data-theme="light"] .uptime-pct.pct-down,
[data-theme="light"] .uptime-row.row-down .uptime-name {
  color: color-mix(in srgb, var(--accent-red) 84%, #991b1b);
}

@media (max-width: 768px) {
  #uptime-body {
    overflow: visible;
  }

  .uptime-empty-state {
    padding: 12px;
  }

  .uptime-summary {
    align-items: flex-start;
    padding: 8px 10px;
    margin-bottom: 8px;
  }

  .uptime-summary-left {
    display: grid;
    gap: 2px;
    align-items: start;
  }

  .uptime-summary-main {
    white-space: normal;
  }

  .uptime-summary-sub {
    display: block;
  }

  .uptime-scroll-wrap {
    max-height: min(52vh, 420px);
    padding-right: 4px;
    scroll-snap-type: y proximity;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.14) transparent;
  }

  .uptime-scroll-wrap::-webkit-scrollbar {
    width: 4px;
    height: 4px;
    display: block;
    background: transparent;
  }

  .uptime-scroll-wrap::-webkit-scrollbar-track {
    display: block;
    background: transparent;
  }

  .uptime-scroll-wrap::-webkit-scrollbar-thumb {
    display: block;
    background: rgba(255,255,255,0.12);
    border-radius: 999px;
  }

  .uptime-group,
  .uptime-down-section {
    scroll-snap-align: start;
  }

  .uptime-row,
  .uptime-row.row-down {
    padding: 8px 10px;
  }

  .uptime-name-wrap {
    min-width: 0;
    max-width: none;
    flex: 1 1 96px;
  }

  .uptime-name {
    min-width: 0;
    max-width: none;
  }

  .uptime-down-group-inline {
    display: block;
  }

  [data-theme="light"] .uptime-scroll-wrap {
    scrollbar-color: rgba(0,0,0,0.18) transparent;
  }

  [data-theme="light"] .uptime-scroll-wrap::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.16);
  }

  .uptime-pct {
    min-width: 44px;
  }
}
/* ===== 小虾米看板 — appliances.css ===== */

/* 设备状态卡片：确保内容层完整撑满 GridStack 高度，避免底边视觉悬空 */
.grid-stack-item[gs-id="appliances"] > .grid-stack-item-content,
.grid-stack-item[gs-id="appliances"] > .grid-stack-item-content > .card {
  height: 100%;
  min-height: 100%;
}
.grid-stack-item[gs-id="appliances"] > .grid-stack-item-content > .card {
  display: flex;
  flex-direction: column;
}
.grid-stack-item[gs-id="appliances"] .card-header {
  flex-shrink: 0;
}
#appliances-body {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0 14px 12px;
}
#appliances-body > .loading,
#appliances-body > .appliance-categories {
  flex: 1 1 auto;
  min-height: 0;
}

.grid-stack-item[gs-id="appliances"] .card-header {
  padding-left: 14px;
  padding-right: 14px;
  padding-top: 14px;
  padding-bottom: 10px;
}

/* ── 分组容器 ── */
.appliance-categories {
  display: flex;
  flex-direction: row;
  gap: 10px;
  flex: 1;
  min-height: 0;
}
.appliance-category {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.appliance-category:last-child {
  margin-bottom: 0;
}

/* ── 分组标题 ── */
.appliance-category-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.appliance-category-name {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.appliance-category-stats {
  margin-left: auto;
  display: flex;
  gap: 4px;
  font-size: 9px;
  font-weight: 600;
  font-family: var(--font-mono);
}
.stat-active {
  color: var(--accent-green);
}
.stat-warning {
  color: var(--accent-yellow, #f5a623);
}
.stat-offline {
  color: var(--accent-red);
  opacity: 0.7;
}

/* ── 设备列表（垂直排列）── */
.appliance-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-height: 0;
}

/* ── 自动循环滚动 ── */
.appliance-scroll-wrap {
  overflow: hidden;
  position: relative;
  flex: 1;
  min-height: 0;
  height: 100%;
}
.appliance-scroll-track,
.appliance-scroll-manual {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.appliance-scroll-track {
  display: none;
  animation: none;
}

.appliance-scroll-wrap.is-slower .appliance-scroll-track {
  animation-duration: 30s;
}
.appliance-scroll-manual {
  display: flex;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  contain: layout paint style;
}

.appliance-scroll-manual::-webkit-scrollbar {
  display: none;
}
.appliance-scroll-wrap.is-paused .appliance-scroll-track {
  display: none;
}
.appliance-scroll-wrap.is-paused .appliance-scroll-manual {
  display: flex;
}

/* ── 移动端：禁用滚动动画，卡片整体可滚动 ── */
@media (max-width: 768px) {
  .appliance-scroll-track {
    animation: none !important;
    transform: none !important;
  }
  .appliance-scroll-wrap {
    overflow: visible !important;
    max-height: none !important;
  }
  .appliance-categories {
    flex-direction: column;
    overflow: visible;
    gap: 12px;
  }
  .appliance-category {
    overflow: visible;
    flex: none !important;
    min-height: 0 !important;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 10px 10px 8px;
  }
  #appliances-body {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    gap: 12px;
  }
  .grid-stack-item-content {
    overflow: hidden !important;
    touch-action: pan-y !important;
  }

  .appliance-mobile-priority {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.04));
  }
  .appliance-mobile-priority.has-alert {
    border-color: rgba(245, 158, 11, 0.22);
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.12), rgba(255,255,255,0.03));
  }
  .appliance-mobile-priority.is-stable {
    border-color: rgba(74, 227, 168, 0.18);
  }
  .appliance-mobile-priority-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
  }
  .appliance-mobile-priority-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
  }
  .appliance-mobile-priority-subtitle {
    margin-top: 3px;
    font-size: 11px;
    line-height: 1.45;
    color: var(--text-secondary);
  }
  .appliance-mobile-priority-badge {
    flex-shrink: 0;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    color: #fef3c7;
    background: rgba(245, 158, 11, 0.18);
    border: 1px solid rgba(245, 158, 11, 0.22);
  }
  .appliance-mobile-priority.is-stable .appliance-mobile-priority-badge {
    color: #d1fae5;
    background: rgba(16, 185, 129, 0.14);
    border-color: rgba(16, 185, 129, 0.2);
  }
  .appliance-mobile-priority-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .appliance-mobile-priority-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(9, 12, 25, 0.28);
    border: 1px solid rgba(255,255,255,0.06);
  }
  .appliance-mobile-priority-item.is-offline {
    border-color: rgba(239, 68, 68, 0.24);
    background: rgba(127, 29, 29, 0.28);
  }
  .appliance-mobile-priority-item.is-warning {
    border-color: rgba(245, 158, 11, 0.24);
    background: rgba(120, 53, 15, 0.24);
  }
  .appliance-mobile-priority-main {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .appliance-mobile-priority-name {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
  }
  .appliance-mobile-priority-level {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
  }
  .appliance-mobile-priority-detail,
  .appliance-mobile-priority-empty {
    padding-left: 14px;
    font-size: 11px;
    line-height: 1.45;
    color: var(--text-secondary);
  }
  [data-theme="light"] .appliance-mobile-priority {
    border-color: rgba(15, 23, 42, 0.12);
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248, 250, 252, 0.96));
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  }
  [data-theme="light"] .appliance-mobile-priority.has-alert {
    border-color: rgba(245, 158, 11, 0.42);
    background:
      linear-gradient(180deg, rgba(255, 248, 220, 0.98), rgba(255, 243, 224, 0.96)),
      linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(245, 158, 11, 0.02));
    box-shadow: 0 12px 28px rgba(245, 158, 11, 0.14);
  }
  [data-theme="light"] .appliance-mobile-priority.is-stable {
    border-color: rgba(16, 185, 129, 0.28);
    background:
      linear-gradient(180deg, rgba(236, 253, 245, 0.98), rgba(226, 250, 240, 0.96)),
      linear-gradient(135deg, rgba(16, 185, 129, 0.06), rgba(52, 211, 153, 0.02));
    box-shadow: 0 12px 28px rgba(16, 185, 129, 0.1);
  }
  [data-theme="light"] .appliance-mobile-priority-badge {
    color: #92400e;
    background: rgba(251, 191, 36, 0.2);
    border-color: rgba(217, 119, 6, 0.26);
  }
  [data-theme="light"] .appliance-mobile-priority.is-stable .appliance-mobile-priority-badge {
    color: #065f46;
    background: rgba(110, 231, 183, 0.24);
    border-color: rgba(5, 150, 105, 0.24);
  }
  [data-theme="light"] .appliance-mobile-priority-item {
    background: rgba(255,255,255,0.88);
    border-color: rgba(148, 163, 184, 0.26);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
  }
  [data-theme="light"] .appliance-mobile-priority-item.is-offline {
    border-color: rgba(239, 68, 68, 0.3);
    background: linear-gradient(180deg, rgba(254, 242, 242, 0.98), rgba(254, 226, 226, 0.94));
  }
  [data-theme="light"] .appliance-mobile-priority-item.is-warning {
    border-color: rgba(245, 158, 11, 0.34);
    background: linear-gradient(180deg, rgba(255, 247, 237, 0.98), rgba(254, 243, 199, 0.92));
  }
  [data-theme="light"] .appliance-mobile-priority-level {
    color: #475569;
  }
  [data-theme="light"] .appliance-mobile-priority-subtitle,
  [data-theme="light"] .appliance-mobile-priority-detail,
  [data-theme="light"] .appliance-mobile-priority-empty {
    color: #475569;
  }
  .appliance-category-header {
    margin-bottom: 8px;
  }
  .appliance-category-name {
    font-size: 11px;
  }
}
.appliance-scroll-wrap:hover .appliance-scroll-track {
  animation-play-state: paused;
}
@keyframes appliance-scroll {
  0% { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}

/* ── 设备行 ── */

.appliance-item.is-offline {
  background: rgba(220, 38, 38, 0.44);
  border-color: var(--border);
  box-shadow: none;
}

.appliance-item.is-offline .appliance-info.state-offline {
  color: #ffd7d7;
}

.appliance-item.is-offline .appliance-dot.dot-offline {
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.16);
}

[data-theme="light"] .appliance-item.is-offline {
  background: rgba(252, 165, 165, 0.94);
  border-color: var(--border);
  box-shadow: none;
}

[data-theme="light"] .appliance-item.is-offline .appliance-info.state-offline {
  color: #b91c1c;
}

.appliance-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background var(--transition);
  position: relative;
}
.appliance-item:hover {
  background: rgba(255,255,255,0.03);
}

/* 状态圆点 */
.appliance-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.appliance-dot.dot-active {
  background: var(--accent-green);
  box-shadow: 0 0 5px var(--accent-green);
}
.appliance-dot.dot-idle {
  background: var(--text-muted);
  opacity: 0.5;
}
.appliance-dot.dot-offline {
  background: var(--accent-red);
  box-shadow: 0 0 4px rgba(255,74,74,0.25);
}
.appliance-dot.dot-warning {
  background: var(--accent-yellow, #f5a623);
  box-shadow: 0 0 5px rgba(245,166,35,0.4);
}
.appliance-info.state-warning {
  color: var(--accent-yellow, #f5a623);
}

/* 设备名称 */
.appliance-name {
  font-size: 11px;
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex-shrink: 1;
}

/* 详情信息（右侧）── */
.appliance-info {
  margin-left: auto;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  white-space: nowrap;
  flex: 0 1 48%;
  min-width: 0;
  max-width: 48%;
  text-align: right;
  line-height: 1.3;
}

.appliance-info-scroll {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  vertical-align: top;
  position: relative;
}

.appliance-info-track {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-width: max-content;
}

.appliance-info-text {
  display: inline-block;
  min-width: max-content;
}

.appliance-info-gap {
  display: none;
  opacity: 0.55;
}

.appliance-info-text-copy {
  display: none;
}

.appliance-info-scroll.is-overflowing .appliance-info-gap,
.appliance-info-scroll.is-overflowing .appliance-info-text-copy {
  display: inline-block;
}

.appliance-info-scroll.is-overflowing .appliance-info-track {
  animation: appliance-marquee-loop var(--scroll-duration, 10s) linear infinite;
  will-change: transform;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
}

.appliance-info-scroll:hover .appliance-info-track {
  animation-play-state: paused;
}

@keyframes appliance-marquee-loop {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(calc(-1 * var(--scroll-distance, 0px)), 0, 0);
  }
}

/* 状态标签 */
.state-active { color: var(--accent-green); }
.state-idle   { color: var(--text-muted); }
.state-offline { color: var(--accent-yellow); }

/* 附加细节行 */
.appliance-detail-line {
  font-size: 9px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── 活跃行微高亮 ── */
.appliance-item.is-active {
  background: rgba(0,200,120,0.04);
}
.appliance-item.is-active:hover {
  background: rgba(0,200,120,0.07);
}

/* ── 警告行：黄色警示 ── */
.appliance-item.is-warning {
  background: rgba(245,166,35,0.06);
  border-radius: 4px;
}
.appliance-item.is-warning:hover {
  background: rgba(245,166,35,0.1);
}

/* ── 离线行：暗沉背景 ── */
.appliance-item.is-offline {
  background: rgba(255,255,255,0.02);
  border-radius: 4px;
}
.appliance-item.is-offline .appliance-name {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: rgba(255,255,255,0.12);
}
.appliance-item.is-offline .appliance-info {
  color: var(--text-muted);
  opacity: 0.6;
}

/* ── 多行设备（空调 + 详情）── */
.appliance-item.has-detail {
  flex-direction: column;
  align-items: stretch;
  gap: 1px;
  padding: 5px 6px;
}
.appliance-item.has-detail .appliance-row-main {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.appliance-item.has-detail .appliance-detail-line {
  margin-left: 13px;
}

/* ── Light theme ── */
[data-theme="light"] .appliance-item:hover {
  background: rgba(0,0,0,0.03);
}
[data-theme="light"] .appliance-item.is-active {
  background: color-mix(in srgb, var(--accent-green) 12%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--accent-green) 18%, rgba(148,163,184,0.18));
}
[data-theme="light"] .appliance-item.is-active:hover {
  background: color-mix(in srgb, var(--accent-green) 18%, #ffffff);
}
[data-theme="light"] .appliance-item.is-warning {
  background: color-mix(in srgb, var(--accent-yellow) 14%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--accent-yellow) 20%, rgba(148,163,184,0.18));
}
[data-theme="light"] .appliance-item.is-warning:hover {
  background: color-mix(in srgb, var(--accent-yellow) 20%, #ffffff);
}
[data-theme="light"] .appliance-item.is-offline {
  background: color-mix(in srgb, var(--accent-red) 12%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--accent-red) 18%, rgba(148,163,184,0.18));
}
[data-theme="light"] .appliance-item.is-offline .appliance-name {
  text-decoration-color: rgba(0,0,0,0.1);
}
[data-theme="light"] .appliance-dot.dot-active {
  background: color-mix(in srgb, var(--accent-green) 88%, #059669);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-green) 20%, transparent), 0 0 5px color-mix(in srgb, var(--accent-green) 36%, transparent);
}
[data-theme="light"] .appliance-dot.dot-offline {
  background: color-mix(in srgb, var(--accent-red) 88%, #dc2626);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-red) 18%, transparent), 0 0 5px color-mix(in srgb, var(--accent-red) 32%, transparent);
}
[data-theme="light"] .appliance-dot.dot-warning {
  background: color-mix(in srgb, var(--accent-yellow) 88%, #d97706);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-yellow) 20%, transparent), 0 0 5px color-mix(in srgb, var(--accent-yellow) 34%, transparent);
}
[data-theme="light"] .appliance-info.state-warning {
  color: color-mix(in srgb, var(--accent-yellow) 84%, #92400e);
}
[data-theme="light"] .appliance-info.state-active {
  color: color-mix(in srgb, var(--accent-green) 84%, #166534);
}
[data-theme="light"] .appliance-info.state-offline,
[data-theme="light"] .stat-offline {
  color: color-mix(in srgb, var(--accent-red) 84%, #991b1b);
  opacity: 0.9;
}
