:root {
  --primary: #667eea;
  --primary-dark: #5a67d8;
  --secondary: #764ba2;
  --bg-dark: #1a1a2e;
  --bg-sidebar: #161625;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --text-main: #ffffff;
  --text-muted: #a0a0a0;
  --border: rgba(255, 255, 255, 0.1);
  --success: #1dd1a1;
  --warning: #feca57;
  --danger: #ff6b6b;
  --glass: blur(10px);
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --toolbar-gap: 0.625rem;
  --toolbar-gap-compact: 0.4rem;
  --drawer-width: 720px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.6;
  height: 100vh;
  overflow: hidden;
}

/* Layout */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 100;
  transition: width 0.3s ease;
}

.sidebar.collapsed {
  width: 68px;
}

.sidebar-header {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border);
}

.sidebar.collapsed .sidebar-header {
  padding: 0;
  justify-content: center;
}

.logo-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
  transition: opacity 0.2s;
}

.sidebar.collapsed .logo-wrapper {
  display: none;
}

.sidebar-toggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s;
}

.sidebar-toggle svg {
  width: 20px;
  height: 20px;
}

.sidebar-toggle:hover {
  color: var(--primary);
  background: rgba(255, 255, 255, 0.05);
}

.sidebar.collapsed .sidebar-toggle {
  transform: rotate(180deg);
}

.logo-icon {
  width: 28px;
  height: 28px;
  color: var(--primary);
  flex-shrink: 0;
}

.sidebar-header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(to right, var(--primary), var(--success));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  padding: 1.5rem 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-x: hidden;
}

.sidebar.collapsed .sidebar-nav {
  padding: 1.5rem 0.5rem;
}

.nav-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  padding-left: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.sidebar.collapsed .nav-label {
  opacity: 0;
  height: 0;
  margin: 0.5rem 0 0 0;
  overflow: hidden;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-section-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.75rem;
  border: none;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
}

.nav-section-header:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.nav-section-chevron {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.nav-section.collapsed .nav-section-chevron {
  transform: rotate(-90deg);
}

.nav-submenu {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.nav-section.collapsed .nav-submenu {
  max-height: 0;
}

.nav-submenu .nav-item {
  margin-left: 0.35rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s;
  font-weight: 500;
  white-space: nowrap;
}

.sidebar.collapsed .nav-item {
  padding: 0.75rem;
  justify-content: center;
  border-radius: 8px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(102, 126, 234, 0.1), transparent);
  color: var(--primary);
  border-left: 3px solid var(--primary);
  border-radius: 0 12px 12px 0;
  /* Changed radius for left border effect */
  padding-left: calc(1rem - 3px);
}

.sidebar.collapsed .nav-item.active {
  border-left: none;
  background: rgba(102, 126, 234, 0.15);
  border-radius: 8px;
  padding: 0.75rem;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-item span {
  opacity: 1;
  transition: opacity 0.2s;
}

.sidebar.collapsed .nav-item span {
  opacity: 0;
  width: 0;
  display: none;
}

.sidebar.collapsed .nav-section-header {
  justify-content: center;
  padding: 0.6rem;
}

.sidebar.collapsed .nav-section-header span {
  display: none;
}

.sidebar.collapsed .nav-section-chevron {
  display: none;
}

.sidebar.collapsed .nav-submenu {
  max-height: 500px;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 0.5rem 0;
}

.sidebar-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  overflow: hidden;
}

.version-info {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  opacity: 0.5;
  white-space: nowrap;
}

.sidebar.collapsed .sidebar-footer {
  padding: 1rem 0;
  display: none;
}

/* Main Content Wrapper */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(102, 126, 234, 0.05) 0%, transparent 20%),
    radial-gradient(circle at 90% 80%, rgba(118, 75, 162, 0.05) 0%, transparent 20%);
}

/* Top Bar */
.top-bar {
  height: var(--topbar-height);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  background: rgba(26, 26, 46, 0.8);
  backdrop-filter: var(--glass);
  flex-shrink: 0;
}

.top-bar-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
}

.top-bar-actions {
  justify-content: flex-end;
}

/* Content Area */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
}

/* Views */
.view-content {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.view-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  transition: transform 0.2s, background 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  background: var(--bg-card-hover);
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.stat-icon svg {
  width: 28px;
  height: 28px;
}

.stat-icon.accounts {
  background: linear-gradient(135deg, #667eea, #764ba2);
}

.stat-icon.resources {
  background: linear-gradient(135deg, #1dd1a1, #10ac84);
}

.stat-icon.expiring {
  background: linear-gradient(135deg, #ff6b6b, #ee5253);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Cards & Generic Containers */
.card {
  background: #1f1f35;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-family: inherit;
  white-space: nowrap;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.btn.is-busy {
  opacity: 0.78;
}

.btn.is-busy svg {
  animation: rotate 1s linear infinite;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: 0 4px 12px rgba(118, 75, 162, 0.3);
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: rgba(255, 107, 107, 0.1);
  color: var(--danger);
  border: 1px solid rgba(255, 107, 107, 0.2);
}

.btn-danger:hover {
  background: rgba(255, 107, 107, 0.2);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.75rem;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: var(--toolbar-gap);
  flex-wrap: wrap;
}

.toolbar-actions .btn {
  min-height: 36px;
}

.toolbar-actions .btn.btn-sm {
  min-height: 30px;
}

.toolbar-actions-compact {
  gap: var(--toolbar-gap-compact);
}

.toolbar-actions .chip {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
}

.btn-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.section-actions {
  justify-content: flex-end;
}

/* Accounts List */
.accounts-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.account-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.3s;
}

.account-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
}

.account-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.account-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.account-icon {
  width: 40px;
  height: 40px;
  background: rgba(102, 126, 234, 0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.account-name {
  font-weight: 600;
  font-size: 1rem;
}

.account-info-body {
  min-width: 0;
}

.account-meta {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.account-field-label {
  color: var(--text-muted);
}

.account-balance {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--text-main);
}

.account-coupon-balance {
  margin-top: 0.2rem;
  font-size: 0.875rem;
  color: var(--text-main);
}

.account-refreshable {
  cursor: pointer;
}

.account-alert-group {
  margin-top: 0.3rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.account-alert-status {
  margin-top: 0.25rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.account-alert-status-chip {
  font-size: 0.75rem;
  padding: 2px 8px;
  border: 1px solid transparent;
}

.account-alert-status-chip.is-alert {
  color: #ff9b9b;
  background: rgba(239, 83, 80, 0.15);
  border-color: rgba(239, 83, 80, 0.35);
}

.account-alert-status-chip.is-ok {
  color: #8dd6a6;
  background: rgba(56, 142, 60, 0.14);
  border-color: rgba(56, 142, 60, 0.35);
}

.account-alert-group-chip {
  font-size: 0.75rem;
  padding: 2px 6px;
}

.balance-amount {
  color: #1dd1a1;
  font-weight: 600;
  font-family: monospace;
}

.balance-loading {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.8rem;
}

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

.account-note-row {
  margin-top: 0.25rem;
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  min-width: 0;
}

.account-note-text {
  color: var(--text-muted);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-actions {
  gap: 0.75rem;
}

.chevron {
  transition: transform 0.3s;
}

.account-card.expanded .chevron {
  transform: rotate(180deg);
}

.resources-list {
  display: none;
  padding: 0 1.5rem 1.5rem;
  border-top: 1px solid var(--border);
}

.account-card.expanded .resources-list {
  display: block;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Resources Table */
.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.875rem;
}

.table th {
  text-align: left;
  padding: 1rem;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.6rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.status-badge.normal {
  background: rgba(29, 209, 161, 0.15);
  color: var(--success);
}

.status-badge.warning {
  background: rgba(254, 202, 87, 0.15);
  color: var(--warning);
}

.status-badge.danger {
  background: rgba(255, 107, 107, 0.15);
  color: var(--danger);
}

.status-badge.disabled {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

/* v9.4.41: 手动录入资源标识 */
.status-badge.manual-badge {
  display: inline-block;
  background: rgba(102, 126, 234, 0.2);
  color: var(--primary);
  font-size: 0.68rem;
  padding: 0.1rem 0.45rem;
  border-radius: 99px;
  vertical-align: middle;
  margin-left: 0.3rem;
}

.table-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.resource-id {
  font-family: monospace;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.sortable {
  cursor: pointer;
  user-select: none;
}

.sortable:hover {
  color: var(--primary);
}

/* Form Controls */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.label-with-help {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.finance-threshold-row {
  align-items: start;
  margin-top: 0.25rem;
}

.finance-toggle-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.finance-toggle-row .form-group-checkbox {
  margin-top: 0;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.form-group input,
.form-group select {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  color: white;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.form-group textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  color: white;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: all 0.2s;
  resize: vertical;
  min-height: 120px;
}

.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.form-hint {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.form-actions,
.field-editor-actions,
.billing-filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.form-actions {
  margin-top: 1.25rem;
}

.form-actions .btn {
  min-height: 36px;
}

.field-editor-actions .btn,
.billing-filter-actions .btn {
  min-height: 32px;
}

.form-group-checkbox {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.form-group-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  margin: 0;
}

.form-group-checkbox label {
  margin: 0;
  cursor: pointer;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: #1f1f35;
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  transform: translateY(20px);
  transition: transform 0.3s;
}

#bulkImportModal .modal {
  max-width: 720px;
}

.import-result {
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-main);
  font-size: 0.85rem;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
}

.check-scope-hint {
  margin-bottom: 0.75rem;
  color: var(--text-muted);
}

.modal-sm {
  max-width: 400px;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-body {
  padding: 1.5rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px dashed var(--border);
}

.empty-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.empty-icon svg {
  width: 40px;
  height: 40px;
}

.empty-state h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.resource-error-state {
  padding: 20px;
  text-align: center;
}

.resource-error-title {
  color: #ef5350;
  margin-bottom: 10px;
}

.resource-error-message {
  color: #888;
  font-size: 0.9em;
  margin-bottom: 15px;
}

/* Spinner */
.spinner {
  animation: rotate 2s linear infinite;
  width: 16px;
  height: 16px;
}

@keyframes rotate {
  100% {
    transform: rotate(360deg);
  }
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.toast {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  animation: slideIn 0.3s ease-out;
  min-width: 300px;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.error {
  border-left: 4px solid var(--danger);
}

.toast.info {
  border-left: 4px solid var(--primary);
}

/* Settings & List Items */
.settings-section {
  margin-bottom: 2rem;
}

.settings-section:last-child {
  margin-bottom: 0;
}

.finance-guide h4 {
  margin-bottom: 0.6rem;
}

.finance-guide ul,
.finance-guide ol {
  margin: 0 0 1rem 1.2rem;
  color: var(--text-muted);
}

.finance-guide li {
  margin-bottom: 0.35rem;
}

.settings-section-title {
  margin-bottom: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.settings-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

.settings-collapse {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 0.9rem;
  overflow: hidden;
}

.settings-collapse-summary {
  list-style: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.02);
}

.settings-collapse-summary::-webkit-details-marker {
  display: none;
}

.settings-collapse-summary::after {
  content: '▾';
  font-size: 0.95rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.settings-collapse[open] .settings-collapse-summary::after {
  transform: rotate(180deg);
}

.settings-collapse-content {
  border-top: 1px solid var(--border);
  padding: 1rem;
}

.form-grid {
  display: grid;
  gap: 1rem;
}

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

.form-grid.one-column {
  grid-template-columns: minmax(0, 1fr);
}

.form-grid.three-column {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid.four-column {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.threshold-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.02);
}

.threshold-item .form-group {
  margin-bottom: 0;
}

/* v9.4.21: 规则抽屉「监控账号」勾选网格(账号覆盖样式已随功能移除) */
.schedule-account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.4rem 1rem;
  margin-bottom: 0.5rem;
}

.threshold-toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
}

.date-picker-field {
  position: relative;
}

.date-picker-field input[data-role="date-display"] {
  padding-right: 46px;
  cursor: pointer;
}

.date-picker-native {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.date-picker-trigger {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.date-picker-trigger:hover,
.date-picker-trigger:focus-visible {
  border-color: rgba(122, 134, 255, 0.55);
  color: #fff;
  background: rgba(122, 134, 255, 0.2);
  outline: none;
}

/* 自绘日历弹层（替代浏览器原生日历，关闭行为可控） */
.dp-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 3000;
  width: 268px;
  padding: 10px;
  background: #20263c;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  user-select: none;
}

.dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.dp-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.dp-nav {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.dp-nav:hover {
  color: #fff;
  border-color: rgba(122, 134, 255, 0.55);
  background: rgba(122, 134, 255, 0.2);
}

.dp-week,
.dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.dp-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  border-radius: 6px;
  font-size: 0.82rem;
}

.dp-weekday {
  color: var(--text-muted);
  font-weight: 600;
}

.dp-blank {
  pointer-events: none;
}

.dp-day {
  border: none;
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  padding: 0;
}

.dp-day:hover {
  background: rgba(122, 134, 255, 0.25);
}

.dp-day.dp-today {
  color: var(--primary);
  font-weight: 700;
}

.dp-day.dp-selected {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

.dp-today-btn {
  width: 100%;
  margin-top: 8px;
  padding: 6px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
}

.dp-today-btn:hover {
  color: #fff;
  border-color: rgba(122, 134, 255, 0.55);
  background: rgba(122, 134, 255, 0.2);
}

/* 年-月选择弹层（单月阈值覆盖用） */
.mp-popover {
  width: 236px;
}

.mp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.mp-month {
  border: none;
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  padding: 0;
  height: 34px;
}

.mp-month:hover {
  background: rgba(122, 134, 255, 0.25);
}

.mp-month.dp-today {
  color: var(--primary);
  font-weight: 700;
}

.mp-month.dp-selected {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

.month-picker-field input[data-role="month-display"] {
  padding-right: 46px;
  cursor: pointer;
}

.threshold-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  margin: 0;
}

.field-pick-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  max-height: 220px;
  overflow: auto;
  background: rgba(255, 255, 255, 0.02);
}

.field-pick-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-main);
}

.field-label-with-help {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.field-help-btn {
  position: relative;
  width: 16px;
  height: 16px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
}

.field-help-btn:hover,
.field-help-btn:focus-visible {
  color: #fff;
  border-color: rgba(124, 140, 255, 0.8);
  background: rgba(124, 140, 255, 0.25);
  outline: none;
}

.field-help-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%);
  width: 260px;
  max-width: 60vw;
  padding: 8px 10px;
  border-radius: 8px;
  background: #151628;
  border: 1px solid var(--border);
  color: #e8ecff;
  font-size: 12px;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 80;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.field-help-btn::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: #151628;
  opacity: 0;
  visibility: hidden;
  z-index: 81;
}

.field-help-btn:hover::after,
.field-help-btn:hover::before,
.field-help-btn:focus-visible::after,
.field-help-btn:focus-visible::before {
  opacity: 1;
  visibility: visible;
}

.field-pick-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
}

.field-editor-wrap {
  position: relative;
}

.field-editor-popover {
  position: absolute;
  right: 0;
  top: 36px;
  min-width: 320px;
  max-width: 420px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #1f2038;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  z-index: 40;
}

.field-editor-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.field-editor-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding: 4px 0;
}

.field-editor-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.field-editor-select-all {
  grid-column: 1 / -1;
  padding-bottom: 6px;
  margin-bottom: 2px;
  border-bottom: 1px dashed var(--border);
}

.field-editor-select-all-text {
  font-weight: 600;
}

.field-editor-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
}

.field-editor-actions {
  margin-top: 10px;
}

.credit-forecast-panel {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.credit-forecast-summary {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.credit-forecast-chart {
  overflow-x: auto;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 8px;
  background: rgba(18, 20, 40, 0.65);
}

.credit-forecast-svg {
  width: 100%;
  min-width: 840px;
  height: 260px;
  display: block;
}

.credit-axis {
  stroke: rgba(255, 255, 255, 0.28);
  stroke-width: 1;
}

.credit-line-total {
  stroke: rgba(255, 180, 80, 0.75);
  stroke-width: 1.2;
  stroke-dasharray: 4 4;
}

.credit-line-today {
  stroke: rgba(164, 174, 255, 0.85);
  stroke-width: 1.2;
  stroke-dasharray: 2 4;
}

.credit-line-end {
  stroke: rgba(130, 240, 200, 0.6);
  stroke-width: 1.2;
}

.credit-line-actual {
  stroke: #8ea2ff;
  stroke-width: 2;
}

.credit-line-forecast,
.credit-line-forecast-p50 {
  stroke: #ffb36b;
  stroke-width: 2;
  stroke-dasharray: 6 4;
}

.credit-line-forecast-p80 {
  stroke: #ffd37f;
  stroke-width: 1.8;
  stroke-dasharray: 4 4;
}

.credit-line-forecast-p90 {
  stroke: #ff8f8f;
  stroke-width: 1.8;
  stroke-dasharray: 2 4;
}

.credit-line-ideal {
  stroke: #66d3a9;
  stroke-width: 1.8;
  stroke-dasharray: 3 3;
}

.credit-label {
  fill: rgba(255, 255, 255, 0.65);
  font-size: 11px;
}

.credit-forecast-legend {
  margin-top: 8px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 12px;
}

.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  margin-right: 5px;
  vertical-align: middle;
}

.legend-actual {
  background: #8ea2ff;
}

.legend-forecast,
.legend-forecast-p50 {
  background: #ffb36b;
}

.legend-forecast-p80 {
  background: #ffd37f;
}

.legend-forecast-p90 {
  background: #ff8f8f;
}

.legend-ideal {
  background: #66d3a9;
}

.legend-total {
  background: #f2be72;
}

.risk-critical {
  color: #ff7a8b;
}

.risk-warning {
  color: #f2be72;
}

.risk-normal {
  color: #66d3a9;
}

.billing-header-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.billing-sort-btn {
  color: inherit;
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.billing-sort-btn.is-sortable {
  cursor: pointer;
}

.billing-filter-icon-btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  cursor: pointer;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s ease;
}

.billing-filter-icon-btn:hover {
  color: var(--text-main);
  border-color: rgba(124, 140, 255, 0.45);
  background: rgba(124, 140, 255, 0.14);
}

.billing-filter-icon-btn.active {
  color: #d7dcff;
  border-color: rgba(124, 140, 255, 0.75);
  background: linear-gradient(135deg, rgba(122, 134, 255, 0.38), rgba(133, 108, 255, 0.3));
  box-shadow: 0 0 0 1px rgba(124, 140, 255, 0.25) inset;
}

.billing-filter-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 18, 0.58);
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.billing-filter-modal {
  width: min(460px, 92vw);
  max-height: 80vh;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #1f2038;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.billing-filter-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.billing-filter-list {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.billing-filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}

.billing-filter-item:last-child {
  margin-bottom: 0;
}

.billing-filter-item-all {
  margin-bottom: 8px;
  font-weight: 600;
}

.billing-filter-actions {
  margin-top: 10px;
}

.settings-toolbar,
.panel-header-inline {
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.settings-toolbar {
  justify-content: flex-end;
}

.panel-header-inline {
  justify-content: space-between;
}

.panel-header-inline h3 {
  line-height: 1.2;
}

.panel-header-inline .settings-section-title {
  margin: 0;
}

.panel-header-inline .toolbar-actions {
  margin-left: auto;
}

.settings-toolbar+.list-container,
.settings-toolbar+form {
  margin-top: 0.75rem;
}

.list-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.list-item-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--toolbar-gap-compact);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.list-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.list-item-info h4 {
  margin-bottom: 0.25rem;
}

.list-item-meta {
  display: flex;
  gap: 1rem;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.group-list-item {
  padding: 0.85rem 1.1rem;
  align-items: flex-start;
}

.group-list-item .list-item-actions {
  align-self: center;
}

.table-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--toolbar-gap-compact);
  flex-wrap: wrap;
}

.table-actions .btn {
  justify-content: center;
}

.group-list-item-info h4 {
  margin: 0 0 0.2rem 0;
  line-height: 1.2;
}

.group-list-item-info p {
  margin: 0;
  line-height: 1.35;
  color: var(--text-muted);
}

.group-list-item .list-item-meta {
  margin-top: 0.45rem;
  gap: 0.35rem;
  flex-direction: column;
  align-items: flex-start;
}

.group-list-item .chip {
  padding: 0.15rem 0.5rem;
  font-size: 0.78rem;
}

.group-id-chip-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.group-id-copy-btn {
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.group-id-chip-wrap:hover .group-id-copy-btn,
.group-id-chip-wrap:focus-within .group-id-copy-btn {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.group-id-copy-btn:hover {
  background: rgba(122, 134, 255, 0.25);
  border-color: rgba(122, 134, 255, 0.5);
}

.contact-value-truncate {
  max-width: 300px;
}

.chip {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
  font-size: 0.75rem;
}

.chip.lark {
  background: rgba(51, 112, 255, 0.2);
  color: #3370ff;
}

.chip.email {
  background: rgba(255, 159, 28, 0.2);
  color: #ff9f1c;
}

.inline-form {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.inline-form h4 {
  margin-bottom: 1.5rem;
  color: var(--primary);
}

@media (max-width: 1200px) {
  .form-grid.three-column,
  .form-grid.four-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .field-pick-list {
    grid-template-columns: 1fr;
  }

  .field-editor-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .form-grid.two-column,
  .form-grid.three-column,
  .form-grid.four-column {
    grid-template-columns: 1fr;
  }

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

  .finance-toggle-row {
    gap: 0.75rem;
  }

  .settings-toolbar,
  .panel-header-inline {
    justify-content: flex-start;
  }

  .panel-header-inline .toolbar-actions {
    margin-left: 0;
    width: 100%;
  }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions .btn,
  .field-editor-actions .btn,
  .billing-filter-actions .btn {
    flex: 1 1 calc(50% - 0.375rem);
    justify-content: center;
  }

  .finance-inline-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .finance-query-controls .btn {
    flex: 1 1 calc(50% - 0.375rem);
    justify-content: center;
  }

  .finance-query-controls > div {
    min-width: 0;
    flex: 1 1 calc(50% - 0.375rem);
  }
}

/* Batch Toolbar */
.batch-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
  border: 1px solid rgba(102, 126, 234, 0.3);
  border-radius: 8px;
  margin-bottom: 12px;
}

.batch-info {
  font-size: 0.875rem;
  color: var(--text-main);
}

.batch-info strong {
  color: var(--primary);
  font-size: 1rem;
}

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

.batch-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.batch-select {
  min-width: 120px;
}

.account-batch-all {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  justify-content: space-between;
  align-items: center;
  row-gap: 0.5rem;
}

.account-batch-filters,
.account-batch-shortcuts {
  align-items: center;
  row-gap: 0.4rem;
}

.batch-inline-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.resource-filter-btn,
.resource-shortcut-btn {
  min-height: 28px;
}

.resources-table {
  min-width: 960px;
}

/* Rotating Class */
.rotating {
  animation: rotate 1s linear infinite;
}

.inline-spinner {
  display: inline-block;
}

.btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Checkboxes & Selects custom styles */
.member-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: 6px;
}

.member-option:hover {
  background: rgba(255, 255, 255, 0.05);
}

.members-select-container {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
}

/* Site Tags */
.site-type-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.badge-china {
  background: rgba(255, 107, 107, 0.2);
  color: #ff6b6b;
  border: 1px solid rgba(255, 107, 107, 0.3);
}

.badge-intl {
  background: rgba(29, 209, 161, 0.2);
  color: #1dd1a1;
  border: 1px solid rgba(29, 209, 161, 0.3);
}

.account-description {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  font-style: italic;
}

/* Drawer */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.drawer-overlay.open {
  opacity: 1;
  visibility: visible;
}

.drawer {
  position: fixed;
  top: 0;
  width: min(var(--drawer-width), calc(100vw - 24px));
  right: calc(-1 * min(var(--drawer-width), calc(100vw - 24px)));
  height: 100%;
  background: #1f1f35;
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  z-index: 1001;
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.drawer.open {
  right: 0;
}

.drawer-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

/* Transfer Component (Dual List) */
.transfer-container {
  display: flex;
  gap: 1rem;
  height: 350px;
}

.transfer-panel {
  flex: 1;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.transfer-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
}

.transfer-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.transfer-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
  user-select: none;
}

.transfer-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.transfer-item.selected {
  background: rgba(102, 126, 234, 0.2);
}

.transfer-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
  pointer-events: none;
  /* Let parent handle click */
}

.transfer-item label {
  flex: 1;
  cursor: pointer;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.transfer-search {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.transfer-search input {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  color: white;
  font-size: 0.8rem;
}

/* Transfer Actions (Vertical Buttons) */
.transfer-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
}

.transfer-btn {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.transfer-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-color: rgba(255, 255, 255, 0.3);
}

.transfer-btn:active {
  transform: translateY(1px);
}

.transfer-btn svg {
  width: 16px;
  height: 16px;
}

/* Adjust transfer container to ensure alignment */
.transfer-container {
  /* Removed align-items: center to allow panels to stretch */
}
.transfer-footer {
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.1);
}

.transfer-footer input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--primary);
}

/* Check Account List */
.check-account-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.check-account-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  font-size: 0.95rem;
}

.check-account-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.check-account-btn.all-accounts {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
  border-color: rgba(102, 126, 234, 0.3);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.check-account-btn.all-accounts:hover {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
}

.check-account-btn .account-icon {
  width: 24px;
  height: 24px;
  color: var(--primary);
}

/* Finance Views */
.finance-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 1rem;
  min-height: calc(100vh - 180px);
}

.finance-account-panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  overflow-y: auto;
}

.finance-account-panel h3 {
  margin: 0;
  font-size: 1rem;
}

.panel-header-inline {
  gap: 0.75rem;
}

.panel-header-actions {
  justify-content: flex-end;
}

.finance-account-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
  color: var(--text-main);
  padding: 0.75rem;
  margin-bottom: 0.6rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.finance-account-item:hover {
  border-color: rgba(102, 126, 234, 0.4);
  background: rgba(102, 126, 234, 0.08);
}

.finance-account-item.active {
  border-color: rgba(102, 126, 234, 0.7);
  background: linear-gradient(90deg, rgba(102, 126, 234, 0.2), rgba(102, 126, 234, 0.05));
}

.finance-account-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-weight: 600;
}

.finance-account-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-account-meta {
  font-size: 0.8rem;
  margin-top: 0.35rem;
  color: var(--text-muted);
}

.finance-account-description {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.35;
  white-space: normal;
  overflow: hidden;
  margin-top: 0.45rem;
}

.finance-detail-panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  overflow: auto;
}

.finance-detail-panel .empty-state {
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.credit-contract-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.credit-contract-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  padding: 0.9rem 1rem;
}

.credit-contract-card.expanded {
  border-color: rgba(122, 134, 255, 0.5);
  background: rgba(122, 134, 255, 0.08);
}

.credit-contract-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.credit-contract-title-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.credit-contract-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.credit-contract-actions {
  justify-content: flex-end;
}

.credit-contract-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1rem;
  margin-top: 0.45rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.credit-contract-description {
  margin-top: 0.45rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.credit-contract-forecast {
  margin-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.75rem;
}

.credit-forecast-granularity {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.credit-granularity-btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all .2s ease;
}

.credit-granularity-btn:hover {
  color: var(--text-main);
  border-color: rgba(122, 134, 255, 0.5);
}

.credit-granularity-btn.is-active {
  color: #fff;
  border-color: rgba(122, 134, 255, 0.75);
  background: linear-gradient(135deg, rgba(122, 134, 255, 0.75), rgba(122, 134, 255, 0.45));
}

.credit-contract-forecast-summary {
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--text-main);
  margin-bottom: 0.55rem;
}

.credit-contract-scope {
  color: var(--text-muted);
}

.credit-contract-delete-btn {
  color: #ff8282;
  border-color: rgba(255, 130, 130, 0.35);
}

.credit-contract-delete-btn:hover {
  color: #ffd2d2;
  border-color: rgba(255, 130, 130, 0.75);
  background: rgba(255, 130, 130, 0.15);
}

.credit-contract-account-list {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.credit-contract-account-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.credit-contract-account-item:hover {
  border-color: rgba(122, 134, 255, 0.35);
  background: rgba(122, 134, 255, 0.08);
}

.credit-contract-account-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
}

.credit-contract-account-item .text-muted {
  font-size: 0.8rem;
}

/* Contract Credit drawer form: dedicated layout tuning */
.credit-contract-form .form-grid.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.credit-contract-form .form-grid.three-column {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.credit-contract-form .form-grid.four-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.credit-contract-form .form-group {
  margin-bottom: 1rem;
}

.credit-contract-form .form-actions {
  margin-top: 1.5rem;
}

.finance-loading {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 4px;
}

.finance-skeleton {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.04));
  background-size: 220% 100%;
  border-radius: 10px;
  animation: skeletonMove 1.3s ease infinite;
}

.skeleton-line-lg {
  height: 48px;
}

.skeleton-line {
  height: 30px;
}

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

.finance-detail-header {
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.finance-detail-header h3 {
  font-size: 1rem;
  margin: 0;
}

.finance-inline-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  row-gap: 8px;
}

.finance-query-controls {
  align-items: flex-end;
  gap: 0.625rem;
  margin: 8px 0 12px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.finance-query-controls > div {
  min-width: 140px;
}

.finance-mode-select {
  min-width: 130px;
}

.form-label-xs {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.finance-summary-chips {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0 8px 0;
}

.finance-summary-chips .chip {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
}

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

/* v9.4.12: suppressed (same-name sibling) chip in the resource package drawer */
.text-success {
  color: #10b981;
}

.finance-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.finance-kpi-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  padding: 10px 12px;
}

.finance-kpi-label {
  color: var(--text-muted);
  font-size: 12px;
}

.finance-kpi-value {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 4px;
}

.finance-error {
  border: 1px dashed rgba(255, 107, 107, 0.45);
  background: rgba(255, 107, 107, 0.06);
  border-radius: 14px;
  padding: 20px;
}

.finance-error h3 {
  margin-bottom: 8px;
}

.finance-error p {
  color: #ffd5d5;
  margin-bottom: 10px;
  word-break: break-word;
}

.finance-error-hint {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 14px;
}

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

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

.table-pagination .btn {
  min-width: 72px;
  justify-content: center;
}

.sort-icon.dim {
  opacity: 0.3;
}

@media (max-width: 1024px) {
  :root {
    --sidebar-width: 220px;
  }

  .top-bar {
    padding: 0 1rem;
  }

  .content-area {
    padding: 1.25rem;
  }

  .stats-grid {
    gap: 1rem;
    margin-bottom: 1.75rem;
  }

  .stat-card {
    padding: 1rem;
    gap: 1rem;
  }

  .section-header {
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-start;
  }

  .section-actions {
    flex-wrap: wrap;
    width: 100%;
    justify-content: flex-start;
  }

  .list-item {
    align-items: flex-start;
  }

  .list-item-actions {
    width: 100%;
    justify-content: flex-start;
    margin-top: 0.5rem;
  }

  .account-batch-all {
    padding: 0.6rem 0.85rem;
    align-items: flex-start;
  }

  .account-batch-filters,
  .account-batch-shortcuts {
    width: 100%;
  }

  .finance-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .finance-kpi-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .finance-detail-header {
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
  }

  .panel-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .table-pagination {
    justify-content: flex-start;
  }

  .drawer {
    width: min(640px, 94vw);
    right: calc(-1 * min(640px, 94vw));
  }

  .credit-contract-form .form-grid.three-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .top-bar {
    height: auto;
    min-height: var(--topbar-height);
    padding: 0.75rem 0.875rem;
    gap: 0.75rem;
    align-items: flex-start;
    flex-direction: column;
  }

  .top-bar-actions {
    width: 100%;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .top-bar-actions .btn {
    flex: 1 1 0;
    justify-content: center;
    min-width: 120px;
  }

  .account-batch-all {
    padding: 0.55rem 0.75rem;
  }

  .account-batch-filters,
  .account-batch-shortcuts {
    gap: 0.35rem;
  }

  .account-batch-filters .btn,
  .account-batch-shortcuts .btn {
    flex: 1 1 calc(50% - 0.35rem);
    justify-content: center;
  }

  .content-area {
    padding: 1rem 0.875rem;
  }

  .drawer {
    width: 100vw;
    right: -100vw;
    border-left: none;
  }

  .drawer-body {
    padding: 1rem;
  }

  .card {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .account-header {
    padding: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .account-info {
    min-width: 0;
    flex: 1 1 100%;
  }

  .account-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .resources-list {
    padding: 0 1rem 1rem;
    overflow-x: auto;
  }

  .table {
    min-width: 760px;
  }

  .modal {
    width: min(680px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
  }

  #bulkImportModal .modal {
    width: min(820px, calc(100vw - 24px));
  }

  .modal-body {
    max-height: calc(100vh - 180px);
    overflow-y: auto;
  }

  .transfer-container {
    flex-direction: column;
    height: auto;
    max-height: none;
    gap: 0.75rem;
  }

  .table-actions {
    width: 100%;
  }

  .table-actions .btn {
    flex: 1 1 calc(50% - 0.375rem);
  }

  .field-editor-popover {
    position: fixed;
    top: 50%;
    left: 50%;
    right: auto;
    transform: translate(-50%, -50%);
    width: min(560px, calc(100vw - 28px));
    max-width: none;
    max-height: calc(100vh - 28px);
    overflow: auto;
    z-index: 90;
  }

  .credit-contract-form .form-grid.two-column,
  .credit-contract-form .form-grid.three-column,
  .credit-contract-form .form-grid.four-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .sidebar {
    width: 68px;
  }

  .sidebar-header {
    padding: 0;
    justify-content: center;
  }

  .logo-wrapper {
    display: none;
  }

  .sidebar-toggle {
    transform: rotate(180deg);
  }

  .sidebar-nav {
    padding: 0.75rem 0.45rem;
  }

  .form-actions .btn,
  .field-editor-actions .btn,
  .billing-filter-actions .btn {
    flex-basis: 100%;
  }

  .finance-query-controls .btn,
  .panel-header-actions .btn,
  .settings-toolbar .btn {
    flex: 1 1 100%;
    justify-content: center;
  }

  .finance-query-controls > div {
    flex-basis: 100%;
  }

  .table-actions .btn,
  .list-item-actions .btn {
    flex-basis: 100%;
  }

  .account-batch-filters .btn,
  .account-batch-shortcuts .btn {
    flex-basis: 100%;
  }

  .nav-item {
    padding: 0.7rem;
    justify-content: center;
    border-radius: 8px;
  }

  .nav-item span,
  .nav-section-header span,
  .nav-section-chevron,
  .nav-submenu {
    display: none;
  }

  .nav-section-header {
    justify-content: center;
    padding: 0.6rem;
  }

  .sidebar-footer {
    display: none;
  }

  .top-bar-title {
    font-size: 1.05rem;
  }

  .top-bar-actions .btn {
    min-width: 0;
    padding: 0.55rem 0.75rem;
  }

  .top-bar-actions .btn span {
    display: none;
  }

  .section-header h2 {
    font-size: 1.05rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .finance-toggle-row {
    flex-direction: column;
    align-items: stretch;
  }

  .finance-toggle-row .form-group-checkbox {
    width: 100%;
    justify-content: flex-start;
  }
}

/* v8: per-account x per-alert-item notification schedule editor */
.alert-schedule-editor {
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  padding: 4px 12px;
  max-height: 320px;
  overflow-y: auto;
}
.alert-schedule-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(128, 128, 128, 0.15);
}
.alert-schedule-row:last-child {
  border-bottom: none;
}
.alert-schedule-row .schedule-label {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 160px;
  font-size: 13px;
}
.alert-schedule-row select,
.alert-schedule-row input[type="time"],
.alert-schedule-row input[type="text"] {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color, #e2e8f0);
}
.alert-schedule-row .schedule-type {
  width: 86px;
}
.alert-schedule-row .schedule-time {
  width: 110px;
}
.alert-schedule-row .schedule-cron {
  width: 130px;
}
.alert-schedule-row .schedule-timezone {
  width: 140px;
}
.alert-schedule-row.is-locked .schedule-type,
.alert-schedule-row.is-locked .schedule-time,
.alert-schedule-row.is-locked .schedule-cron,
.alert-schedule-row.is-locked .schedule-timezone {
  opacity: 0.45;
  pointer-events: none;
}

/* v9: contract per-month threshold override editor */
#creditContractMonthlyOverrides {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}
.threshold-override-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.threshold-override-row .threshold-override-month {
  width: 150px;
  padding: 6px 8px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid var(--border-color, #e2e8f0);
}
.threshold-override-row .threshold-override-value {
  width: 130px;
  padding: 6px 8px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid var(--border-color, #e2e8f0);
}

/* v9.4.11: resource package usage drawer */
.rp-drawer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rp-name {
  font-weight: 500;
}

.rp-usage {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rp-usage-col {
  min-width: 150px;
}

.rp-usage-bar {
  position: relative;
  flex: 1;
  min-width: 64px;
  max-width: 140px;
  height: 6px;
  border-radius: 3px;
  background: rgba(148, 163, 184, 0.25);
  overflow: hidden;
}

.rp-usage-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: #3b82f6;
}

.rp-usage-fill.warn {
  background: #f59e0b;
}

.rp-usage-fill.over {
  background: #ef4444;
}

.rp-row-over td {
  background: rgba(239, 68, 68, 0.06);
}

.rp-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* v9.4.16 调度中心 */
.schedule-status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}
.schedule-status-badge.enabled {
  background: rgba(46, 164, 79, 0.15);
  color: #2ea44f;
}
.schedule-status-badge.disabled {
  background: rgba(106, 115, 125, 0.18);
  color: #6a737d;
}
.schedule-status-badge.always {
  background: rgba(9, 105, 218, 0.12);
  color: #0366d6;
}

/* v9.4.17 调度中心任务列表行(点击打开编辑抽屉) */
.schedule-task-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.6rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.1s;
}
.schedule-task-row:hover,
.schedule-task-row:focus-visible {
  border-color: var(--primary, #58a6ff);
  background: rgba(88, 166, 255, 0.06);
  outline: none;
}
.schedule-task-row:active {
  transform: scale(0.995);
}
.schedule-row-main {
  flex: 1;
  min-width: 0;
}
.schedule-row-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.schedule-row-name {
  font-weight: 600;
  font-size: 0.92rem;
}
.schedule-row-desc {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.schedule-row-side {
  flex: 0 0 auto;
  text-align: right;
  font-size: 0.78rem;
}
.schedule-row-cron {
  color: var(--text, #c9d1d9);
  font-weight: 600;
}
.schedule-row-meta {
  margin-top: 0.15rem;
  color: var(--text-muted);
}
.schedule-row-side .chip {
  display: inline-block;
  margin-top: 0.25rem;
  margin-left: 0.3rem;
}
.schedule-row-arrow {
  flex: 0 0 auto;
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.schedule-task-row:hover .schedule-row-arrow {
  color: var(--primary, #58a6ff);
}
/* v9.4.22: 规则行内操作按钮(启停/立即执行/删除) */
.schedule-row-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* 调度抽屉表单 */
.schedule-drawer-form .drawer-footer {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.6rem;
}
/* v9.4.20: 规则抽屉内「通知 / 阈值与字段」小节标题 */
.schedule-drawer-form .drawer-section-title {
  margin: 1.25rem 0 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text, #e6edf3);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
}

/* v9.4.25: alert history page category tabs */
.alert-history-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 4px 0;
  border-bottom: 1px solid var(--border, #30363d);
  padding-bottom: 0;
}

.alert-history-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted, #8b949e);
  padding: 8px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 4px 4px 0 0;
}

.alert-history-tab:hover {
  color: var(--text, #e6edf3);
  background: rgba(255, 255, 255, 0.04);
}

.alert-history-tab.active {
  color: var(--primary, #3b82f6);
  border-bottom-color: var(--primary, #3b82f6);
  font-weight: 600;
}

.alert-history-panel {
  margin-top: 8px;
}

/* v9.4.26: 告警记录分组归纳列表（监控项 × 账号 × 日期）+ 过滤行 + 抽屉明细 */
.alert-history-filters {
  margin: 10px 0 4px;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.alert-history-filters .form-control {
  width: auto;
  min-width: 140px;
}
.alert-history-group-list {
  margin-top: 8px;
}
.alert-history-group-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.6rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.1s;
}
.alert-history-group-row:hover,
.alert-history-group-row:focus-visible {
  border-color: var(--primary, #58a6ff);
  background: rgba(88, 166, 255, 0.06);
  outline: none;
}
.alert-history-group-row:active {
  transform: scale(0.995);
}
.alert-history-group-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  min-width: 0;
}
.alert-history-group-account {
  font-weight: 600;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.alert-history-group-date {
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary, #8b949e);
}
.alert-history-group-side {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  white-space: nowrap;
  font-size: 0.85rem;
}
.alert-history-group-arrow {
  font-size: 1.2rem;
  color: var(--text-muted, #8b949e);
}
.alert-history-drawer .credit-contract-meta-row {
  margin-bottom: 10px;
}
.alert-history-drawer-body {
  margin-top: 8px;
  overflow-x: auto;
}
.alert-history-error-row td {
  font-size: 0.8rem;
  color: var(--danger, #f85149);
  word-break: break-all;
  padding-top: 0;
}
/* v9.4.27: detail 明细子表(资源项名称/实例/使用率/到期) */
.alert-history-detail-row td {
  padding-top: 0;
}
.alert-history-detail-row table {
  margin: 0;
}
.alert-history-detail-row table td,
.alert-history-detail-row table th {
  font-size: 0.8rem;
}
.alert-history-group-cards .credit-contract-card {
  margin-bottom: 10px;
}

