/* quota-alert 管理后台共用样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-family, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif);
  background: var(--color-gradient, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
  min-height: 100vh;
  padding: 20px;
}

.page { max-width: 1000px; margin: 0 auto; }

.topnav {
  background: white;
  border-radius: var(--radius-lg, 12px);
  box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,.1));
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.topnav .brand { font-size: 18px; font-weight: 700; margin-right: 12px; }
.topnav a.navlink {
  color: var(--color-text-secondary, #666);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
}
.topnav a.navlink:hover { background: var(--color-bg-secondary, #f5f5f5); }
.topnav a.navlink.active {
  background: var(--color-primary, #667eea);
  color: white;
}
.topnav .spacer { flex: 1; }
.topnav .user { font-size: 13px; color: var(--color-text-secondary, #666); }
.topnav button.link-btn {
  background: none; border: none; color: var(--color-primary, #667eea);
  cursor: pointer; font-size: 13px;
}

.card {
  background: white;
  border-radius: var(--radius-lg, 12px);
  box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,.1));
  padding: 20px;
  margin-bottom: 16px;
}
.card h2 { font-size: 16px; margin-bottom: 14px; color: var(--color-text-primary, #333); }
.card h3 { font-size: 14px; margin: 14px 0 8px; color: var(--color-text-secondary, #666); }

table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th, table.list td {
  text-align: left; padding: 10px 8px;
  border-bottom: 1px solid var(--color-border, #eee);
}
table.list th { color: var(--color-text-secondary, #888); font-weight: 500; font-size: 13px; }
table.list tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 10px;
  font-size: 12px; font-weight: 500;
}
.badge.normal   { background: #e6f7e6; color: #2a9d2a; }
.badge.low      { background: #fff4e0; color: #d9860b; }
.badge.critical { background: #ffe4e0; color: #d94a0b; }
.badge.exhausted{ background: #fdd; color: #c00; }
.badge.error    { background: #f0f0f0; color: #888; }
.badge.recovery { background: #e0f0ff; color: #1677ff; }
.badge.pending  { background: #fff4e0; color: #d9860b; }
.badge.leased   { background: #e0f0ff; color: #1677ff; }
.badge.played   { background: #e6f7e6; color: #2a9d2a; }
.badge.failed   { background: #fdd; color: #c00; }
.badge.expired, .badge.cancelled { background: #f0f0f0; color: #888; }
.badge.aggregating { background: #f0e6ff; color: #7048c0; }
.badge.ready    { background: #e0f0ff; color: #1677ff; }
.badge.closed   { background: #f0f0f0; color: #888; }

.btn {
  display: inline-block; padding: 6px 14px; border: none; border-radius: 8px;
  background: var(--color-primary, #667eea); color: white;
  font-size: 13px; cursor: pointer; text-decoration: none;
}
.btn:hover { opacity: .9; }
.btn.secondary { background: var(--color-bg-secondary, #eee); color: var(--color-text-primary, #333); }
.btn.danger { background: #e74c3c; }
.btn.small { padding: 3px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.form-item label { display: block; font-size: 13px; color: var(--color-text-secondary, #666); margin-bottom: 4px; }
.form-item input, .form-item select, .form-item textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--color-border, #ddd);
  border-radius: 8px; font-size: 14px; font-family: inherit;
}
.form-item input:focus, .form-item select:focus { outline: 2px solid var(--color-primary, #667eea33); }

.muted { color: var(--color-text-muted, #999); font-size: 13px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; }

.quota-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.quota-card { border: 1px solid var(--color-border, #eee); border-radius: 10px; padding: 14px; }
.quota-card .acct { font-weight: 600; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.quota-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 13px; }
.quota-row .bar { flex: 1; height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden; }
.quota-row .bar > div { height: 100%; border-radius: 4px; }
.bar.normal > div, .bar > div.normal { background: #52c41a; }
.bar > div.low { background: #faad14; }
.bar > div.critical { background: #fa541c; }
.bar > div.exhausted { background: #cf1322; }

.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: #333; color: white; padding: 10px 20px; border-radius: 8px;
  font-size: 14px; z-index: 1000; box-shadow: 0 4px 12px rgba(0,0,0,.3);
}
.toast.error { background: #c0392b; }

.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; z-index: 900;
}
.modal {
  background: white; border-radius: 12px; padding: 24px;
  max-width: 560px; width: calc(100% - 40px); max-height: 80vh; overflow-y: auto;
}
.modal h3 { margin-bottom: 14px; }
.modal .actions { margin-top: 16px; display: flex; gap: 10px; justify-content: flex-end; }

.token-box {
  background: #fffbe6; border: 1px solid #ffe58f; border-radius: 8px;
  padding: 12px; margin: 10px 0; font-size: 13px;
}

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters select, .filters input { padding: 6px 10px; border: 1px solid #ddd; border-radius: 8px; font-size: 13px; }
