/* 主色对齐 ui-tokens（微信绿）；登录页保留浅底表面 */
:root {
  color-scheme: light;
  --bg: #f5f5f5;
  --ink: #191919;
  --muted: #888888;
  --line: #e5e5e5;
  --card: #ffffff;
  --accent: #07c160;
  --accent-ink: #fff;
  --danger: #fa5151;
  --ok: #07c160;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--wx-font, "PingFang SC", "Segoe UI", system-ui, sans-serif);
  background:
    radial-gradient(1200px 500px at 10% -10%, #e8f8ef 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.06);
  width: min(420px, 100%);
  padding: 32px 28px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 { margin: 0 0 8px; font-size: 28px; }
h2 { margin: 0; font-size: 18px; font-weight: 600; }
.sub { margin: 0 0 22px; color: var(--muted); line-height: 1.6; }

label {
  display: block;
  margin-bottom: 14px;
  font-size: 13px;
  color: #44403c;
}

input,
select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  color: inherit;
}

input:focus,
select:focus {
  outline: 2px solid rgba(7, 193, 96, 0.35);
  border-color: var(--accent);
}

button {
  font: inherit;
  border: 0;
  border-radius: 6px;
  padding: 9px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  transition: filter 160ms ease, background 160ms ease;
}

button:hover { filter: brightness(1.05); }
button:disabled { opacity: 0.6; cursor: not-allowed; }
button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
button.warn { background: #c2410c; }
button.danger { background: #e11d48; }
button.tiny {
  padding: 4px 8px;
  font-size: 12px;
  background: #2e2e2e;
  color: #fff;
  line-height: 1.3;
}
button.linkish {
  background: transparent;
  color: var(--accent);
  padding: 4px 6px;
  border: 0;
}
button.linkish:hover { text-decoration: underline; filter: none; }

.error {
  margin: 0 0 12px;
  color: var(--danger);
  font-size: 13px;
}

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 20px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.table-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.04);
}

.table-scroll {
  overflow-x: auto;
}

.sites-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.sites-table th,
.sites-table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

.sites-table th {
  background: #fafafa;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.sites-table tbody tr:hover > td {
  background: #fafafa;
}

.sites-table tbody tr.is-expired > td {
  background: #fff8f8;
}

.sites-table tbody tr.is-open > td {
  background: #f7fbf8;
}

.sites-table .name-cell {
  font-weight: 600;
  color: var(--ink);
  min-width: 120px;
}

.sites-table .slug-cell {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.sites-table .ops {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 220px;
}

.badge-ok,
.badge-expired {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  padding: 2px 8px;
  white-space: nowrap;
}

.badge-ok {
  background: var(--wx-brand-soft, #e8f8ef);
  color: var(--ok, #07c160);
}

.badge-expired {
  background: var(--wx-danger-soft, #ffeaea);
  color: var(--danger, #fa5151);
}

.lang-field {
  width: auto;
  min-width: 118px;
  margin-top: 0;
  padding: 4px 8px;
  font-size: 13px;
}

.accounts-summary {
  color: var(--muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-row td {
  padding: 0;
  background: #fafafa !important;
  border-bottom: 1px solid var(--line);
}

.detail-panel {
  padding: 14px 16px 16px;
  display: grid;
  gap: 14px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.detail-block {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.detail-block h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
}

.keys {
  display: grid;
  gap: 8px;
}

.key-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.key-row code,
.account-grid code {
  display: block;
  overflow: auto;
  background: #2e2e2e;
  color: #f7f7f7;
  border-radius: 6px;
  padding: 7px 9px;
  white-space: nowrap;
  font-size: 12px;
}

.accounts {
  display: grid;
  gap: 10px;
}

.account {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.account-grid {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.account .actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.muted-warn {
  color: #b45309;
  font-size: 12px;
}

.embed {
  margin: 0;
  background: #2e2e2e;
  color: #f7f7f7;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.empty-hint {
  margin: 0;
  padding: 36px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.text-link {
  color: var(--accent);
  text-decoration: none;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* 弹窗 */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(90vh, 720px);
  overflow: auto;
  background: var(--card);
  border-radius: 10px;
  border: 1px solid var(--line);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fafafa;
}

.icon-close {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  border-radius: 6px;
}

.icon-close:hover {
  background: var(--line);
  color: var(--ink);
  filter: none;
}

.modal-body {
  padding: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 860px) {
  .detail-grid { grid-template-columns: 1fr; }
  .top { flex-direction: column; align-items: flex-start; }
  .top-actions { justify-content: flex-start; }
  .row { grid-template-columns: 1fr; }
  .key-row,
  .account-grid { grid-template-columns: 1fr; }
}
