﻿:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --ok: #16a34a;
  --bad: #dc2626;
  --soft: #f3f4f6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  background: var(--bg);
}

button, input, textarea, select { font: inherit; }
button, input, textarea, select, .ghost-button {
  outline: none;
}

.shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
  font-weight: 700;
}

h2 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 650;
}

.muted {
  color: var(--muted);
  margin: 6px 0 0;
  font-size: 14px;
}

.hero-actions { display: flex; gap: 10px; }

.panel, .stat-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
}

.panel {
  padding: 18px;
  margin-top: 14px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat-card { padding: 16px; }
.stat-card span { display: block; color: var(--muted); font-size: 13px; }
.stat-card strong { display: block; margin-top: 8px; font-size: 28px; }

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.85fr);
  gap: 14px;
}

textarea, input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
}

textarea {
  min-height: 150px;
  padding: 12px;
  resize: vertical;
}

input, select { padding: 10px 12px; }
textarea:focus, input:focus, select:focus { border-color: #cbd5e1; box-shadow: none; }
input[type="checkbox"] {
  width: auto;
  padding: 0;
  border: 0;
  box-shadow: none;
}
input[type="checkbox"]:focus {
  outline: none;
  box-shadow: none;
}

button, .ghost-button {
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover, .ghost-button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button:focus, .ghost-button:focus,
button:focus-visible, .ghost-button:focus-visible {
  outline: none;
  box-shadow: none;
}
button.secondary, .ghost-button { background: #fff; color: var(--text); border-color: var(--line); }
button.secondary:hover, .ghost-button:hover { background: var(--soft); border-color: #d1d5db; }

.button-row, .toolbar-actions, .inline-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 12px;
}

.inline-form input { max-width: 320px; }

.table-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.table-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}

.table-toolbar-buttons {
  margin-bottom: 14px;
}

.table-toolbar input { width: 220px; }
.table-toolbar button {
  flex: 0 0 auto;
}
.select-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}
.select-field select {
  width: 170px;
  min-width: 150px;
}
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1320px;
  background: #fff;
}

.user-account-table {
  min-width: 1080px;
  table-layout: fixed;
}

.user-account-table th:nth-child(1),
.user-account-table td:nth-child(1) { width: 42px; }
.user-account-table th:nth-child(2),
.user-account-table td:nth-child(2) { width: 330px; }
.user-account-table th:nth-child(3),
.user-account-table td:nth-child(3) { width: 130px; }
.user-account-table th:nth-child(4),
.user-account-table td:nth-child(4) { width: 110px; }
.user-account-table th:nth-child(5),
.user-account-table td:nth-child(5) { width: 340px; }
.user-account-table th:nth-child(6),
.user-account-table td:nth-child(6) { width: 180px; }
.user-account-table th:nth-child(7),
.user-account-table td:nth-child(7) { width: 92px; }

th, td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: #374151;
  font-size: 13px;
  background: #f9fafb;
  font-weight: 650;
}

td small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
  max-width: 420px;
  overflow-wrap: anywhere;
}

.password-cell {
  color: var(--muted);
  font-family: Consolas, "Microsoft YaHei", monospace;
  white-space: nowrap;
}

.email-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-cell small {
  max-width: 76px;
  word-break: break-word;
}

.token-exp-cell,
.refresh-source-cell {
  white-space: normal;
  overflow-wrap: anywhere;
}

.quota-cell {
  min-width: 180px;
  color: #059669;
  font-size: 12px;
  line-height: 1.55;
  font-weight: 700;
  white-space: nowrap;
}

.quota-cell strong {
  color: #111827;
  font-weight: 700;
}

.quota-plan {
  color: #111827;
}

.log-box {
  min-height: 150px;
  max-height: 260px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafb;
  color: #111827;
  white-space: pre-wrap;
}

.admin-panel {
  padding: 16px 18px 18px;
}

.admin-import-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.admin-import-text {
  min-height: 120px;
  margin-top: 4px;
}

.admin-import-meta {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.admin-actions {
  margin-top: 8px;
}

.admin-panel .log-box {
  min-height: 96px;
  max-height: 150px;
  margin-top: 10px;
}

.admin-panel .table-wrap {
  margin-top: 2px;
}

.admin-list-toolbar {
  margin: 12px 0 10px;
}

.status-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.status-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
  color: #374151;
  font-size: 12px;
}

.status-stat strong { color: var(--text); }

.pill {
  display: inline-flex;
  border: 1px solid var(--line);
  color: #374151;
  background: #fff;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
}

.pill.ok { color: #166534; background: #dcfce7; border-color: #bbf7d0; }
.pill.bad { color: #991b1b; background: #fee2e2; border-color: #fecaca; }
.hidden { display: none !important; }

.info-cell {
  width: 260px;
  max-width: 260px;
  white-space: normal;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.row-action {
  padding: 7px 10px;
  font-size: 12px;
  width: auto;
  min-width: 76px;
  white-space: nowrap;
  word-break: keep-all;
}

.action-cell {
  width: 96px;
  min-width: 96px;
  white-space: nowrap;
}

.admin-panel table {
  min-width: 1420px;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.pagination-bar button {
  width: auto;
  min-width: 76px;
  padding: 8px 12px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(17, 24, 39, 0.42);
}

.modal-card {
  width: min(880px, 100%);
  max-height: min(760px, calc(100vh - 44px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 { margin: 2px 0 0; }

.mail-list {
  max-height: 610px;
  overflow: auto;
  padding: 14px 18px 18px;
}

.mail-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.mail-item:last-child { border-bottom: none; }
.mail-subject { font-weight: 700; color: var(--text); }
.mail-meta { margin-top: 4px; color: var(--muted); font-size: 12px; }
.mail-snippet { margin-top: 8px; color: #374151; line-height: 1.5; }
.mail-error { color: #991b1b; background: #fee2e2; border: 1px solid #fecaca; border-radius: 10px; padding: 12px; }

@media (max-width: 820px) {
  .hero, .table-heading, .table-toolbar { flex-direction: column; }
  .stats-grid, .grid-two { grid-template-columns: 1fr; }
  .table-toolbar, .inline-form { width: 100%; }
  .table-toolbar input, .inline-form input, .select-field, .select-field select, button, .ghost-button { width: 100%; }
  .select-field { align-items: flex-start; flex-direction: column; }
}
