body {
  background:
    radial-gradient(ellipse at 20% 10%, rgba(99, 56, 200, 0.45) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(14, 80, 196, 0.4) 0%, transparent 60%),
    #0a0f1e;
}

.glass-panel,
.glass-toolbar {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  backdrop-filter: blur(16px);
}

.app-shell {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 1024px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
}

.field {
  min-height: 2.5rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  padding: 0.55rem 0.7rem;
  color: rgba(255, 255, 255, 0.92);
  outline: none;
}

.field:focus {
  border-color: rgba(129, 140, 248, 0.85);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.18);
}

.field::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.history-filter-bar,
.pending-toolbar {
  position: sticky;
  top: 5rem;
  z-index: 20;
  background: rgba(10, 15, 30, 0.72);
  box-shadow: 0 18px 50px rgba(2, 6, 23, 0.24);
  backdrop-filter: blur(16px);
}

.history-filter-bar {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(129, 140, 248, 0.08)),
    rgba(10, 15, 30, 0.72);
}

.pending-toolbar {
  margin: -0.25rem -0.25rem 1rem;
  border-radius: 12px;
  padding: 0.25rem;
}

.history-filter-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(11rem, 14rem);
  gap: 0.75rem;
  align-items: center;
}

.history-search-field {
  width: 100%;
  min-width: 0;
}

.history-status-select {
  width: 100%;
  color-scheme: dark;
}

.history-status-select option {
  background: #0a0f1e;
  color: rgba(255, 255, 255, 0.92);
}

.history-pagination-sentinel {
  margin-top: 0.75rem;
  border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.035);
  padding: 0.85rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.38);
  font-size: 0.875rem;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  display: inline-flex;
  min-height: 2.5rem;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
}

.primary-button {
  background: #818cf8;
  color: #0a0f1e;
  padding: 0.55rem 0.8rem;
}

.secondary-button {
  border: 1px solid rgba(129, 140, 248, 0.35);
  color: rgba(255, 255, 255, 0.9);
  padding: 0.55rem 0.8rem;
}

.ghost-button,
.icon-button {
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.72);
  padding: 0.55rem;
}

.nav-link,
.drawer-link {
  display: inline-flex;
  min-height: 2.5rem;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.875rem;
  font-weight: 500;
}

.nav-link.is-active,
.drawer-link.is-active {
  background: rgba(129, 140, 248, 0.18);
  color: rgba(255, 255, 255, 0.92);
}

.drawer-link {
  justify-content: flex-start;
}

.approval-row,
.result-row,
.empty-state {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.85rem;
}

.empty-state {
  display: flex;
  min-height: 16rem;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.875rem;
}

.auth-dialog {
  width: min(calc(100vw - 2rem), 24rem);
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
}

.auth-dialog::backdrop {
  background: rgba(10, 15, 30, 0.68);
  backdrop-filter: blur(6px);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(10, 15, 30, 0.58);
}

.mobile-drawer {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: min(82vw, 20rem);
  transform: translateX(-100%);
  transition: transform 180ms ease;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 15, 30, 0.88);
  padding: 1rem;
  backdrop-filter: blur(16px);
}

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

.selection-checkbox {
  accent-color: #818cf8;
}

.badge,
.badge-success,
.badge-error,
.badge-warning {
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
  line-height: 1rem;
}

.badge {
  background: rgba(129, 140, 248, 0.14);
  color: rgba(199, 210, 254, 0.95);
}

.badge-success {
  background: rgba(52, 211, 153, 0.12);
  color: #86efac;
}

.badge-error {
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
}

.badge-warning {
  background: rgba(251, 191, 36, 0.12);
  color: #fde68a;
}

.device-row {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  transition: border-color 0.2s;
}

.device-row:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.device-dialog {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  max-width: 100vw;
  max-height: 100vh;
}

.device-dialog::backdrop {
  background: rgba(10, 15, 30, 0.75);
  backdrop-filter: blur(8px);
}

/* 移动端设备对话框优化 */
@media (max-width: 640px) {
  .history-filter-bar,
  .pending-toolbar {
    top: 4.5rem;
  }

  .history-filter-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .history-status-select {
    min-width: 0;
  }

  .device-dialog .glass-panel {
    max-width: 90vw;
    padding: 1rem;
  }

  .device-dialog .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
}

@media (min-width: 768px) {
  .device-dialog .glass-panel {
    max-width: 80vw;
  }
}

@media (min-width: 1024px) {
  .device-dialog .glass-panel {
    max-width: 60vw;
  }
}

/* HTMX 加载状态 */
.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator {
  display: inline-block;
}

.htmx-request .button-text,
.htmx-request .button-icon {
  display: none !important;
}

/* 对话框内文字颜色优化 */
.device-dialog .text-white\/30 {
  color: rgba(255, 255, 255, 0.5);
}

.device-dialog .text-white\/45 {
  color: rgba(255, 255, 255, 0.6);
}

.device-dialog .text-white\/70 {
  color: rgba(255, 255, 255, 0.85);
}

.device-dialog .text-white\/90 {
  color: rgba(255, 255, 255, 0.95);
}

/* 按钮禁用状态 */
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Toast 样式覆盖 */
.toastify {
  font-family: system-ui, -apple-system, sans-serif;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

/* HTMX 请求期间给刷新图标添加旋转动画 */
.htmx-request .refresh-icon {
  @apply animate-spin;
}
