:root {
  --bg: #f4f7f6;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --text: #17201d;
  --muted: #66736e;
  --line: rgba(25, 48, 41, 0.11);
  --green: #0e7558;
  --green-strong: #07543f;
  --green-soft: #e5f5ee;
  --amber: #9a6207;
  --amber-soft: #fff2cf;
  --red: #a33a32;
  --red-soft: #fdecea;
  --shadow: 0 24px 70px rgba(19, 55, 43, 0.11);
  --radius: 22px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% -20%, rgba(199, 235, 218, 0.72), transparent 42%),
    linear-gradient(180deg, #f6faf8 0%, var(--bg) 52%, #f8faf9 100%);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.aurora {
  position: fixed;
  z-index: -1;
  width: 42vw;
  height: 42vw;
  min-width: 360px;
  min-height: 360px;
  border-radius: 50%;
  filter: blur(12px);
  pointer-events: none;
}
.aurora-one { top: -24vw; right: -10vw; background: rgba(157, 226, 193, 0.25); }
.aurora-two { bottom: -30vw; left: -14vw; background: rgba(210, 228, 176, 0.22); }

.site-header, .admin-header {
  width: min(1140px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  font-weight: 800;
  font-size: 19px;
  background: linear-gradient(145deg, #138664, #075940);
  box-shadow: 0 9px 24px rgba(11, 100, 74, 0.28);
}
.brand strong { display: block; font-size: 15px; letter-spacing: -0.01em; }
.brand small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }

.shell { width: min(980px, calc(100% - 36px)); margin: 28px auto 60px; }
.hero { padding: 52px 4px 38px; max-width: 820px; }
.eyebrow { color: var(--green); letter-spacing: 0.16em; font-size: 11px; font-weight: 800; }
.hero h1 {
  margin: 13px 0 16px;
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1.06;
  letter-spacing: -0.045em;
  font-weight: 780;
}
.hero-copy { color: var(--muted); line-height: 1.8; max-width: 720px; font-size: 15px; margin: 0; }
.hero-metrics { display: flex; flex-wrap: wrap; gap: 30px; margin-top: 28px; }
.hero-metrics div { min-width: 110px; }
.hero-metrics span { display: block; font-size: 23px; font-weight: 750; letter-spacing: -0.03em; }
.hero-metrics small { display: block; color: var(--muted); margin-top: 4px; font-size: 11px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.panel + .panel { margin-top: 18px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.panel-heading h2 { font-size: 20px; margin: 0 0 6px; letter-spacing: -0.02em; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.field > span { font-size: 12px; font-weight: 700; color: #40514b; }
input, textarea, select {
  width: 100%;
  border: 1px solid rgba(32, 63, 53, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  outline: none;
  padding: 12px 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; min-height: 100px; font-family: var(--mono); font-size: 13px; line-height: 1.65; }
input:focus, textarea:focus, select:focus {
  border-color: rgba(14, 117, 88, 0.55);
  box-shadow: 0 0 0 4px rgba(14, 117, 88, 0.09);
}
.form-row { display: grid; grid-template-columns: minmax(230px, 1fr) auto; align-items: end; gap: 14px; }
.field.compact { margin-bottom: 0; }

.primary-button, .ghost-button, .mini-button, .icon-button {
  border: 0;
  cursor: pointer;
  border-radius: 12px;
  font-weight: 700;
  transition: transform 0.12s, opacity 0.12s, background 0.15s;
}
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 22px;
  color: #fff;
  background: linear-gradient(135deg, #108463, #076046);
  box-shadow: 0 10px 24px rgba(9, 100, 72, 0.19);
}
.primary-button:hover { transform: translateY(-1px); }
.primary-button:disabled { opacity: 0.56; cursor: wait; transform: none; }
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 15px;
  color: #2c433a;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
  font-size: 12px;
}
.ghost-button:hover { background: #fff; }
.mini-button { min-height: 30px; padding: 0 9px; font-size: 11px; background: #edf3f0; color: #29463c; }
.mini-button.danger { color: var(--red); background: var(--red-soft); }
.mini-button.ghost { border: 1px solid var(--line); background: #fff; }
.icon-button { width: 34px; height: 34px; background: #edf2f0; color: #384e46; font-size: 22px; line-height: 1; }

.form-message { margin-top: 12px; padding: 11px 13px; border-radius: 11px; font-size: 12px; line-height: 1.6; background: #edf5f1; color: #345649; }
.form-message.error { color: var(--red); background: var(--red-soft); }
.form-message.success { color: var(--green-strong); background: var(--green-soft); }
.status-pill { display: inline-flex; align-items: center; min-height: 25px; padding: 0 10px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.status-pill.neutral { color: #4a5d56; background: #edf2f0; }
.status-pill.success { color: #086047; background: #dff4ea; }
.status-pill.warning { color: var(--amber); background: var(--amber-soft); }
.status-pill.danger { color: var(--red); background: var(--red-soft); }

.progress-track { height: 7px; border-radius: 99px; overflow: hidden; background: #eaf0ed; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #1b9b74, #096548); transition: width 0.35s ease; }
.result-grid, .error-list { display: grid; gap: 8px; margin-top: 17px; }
.result-row { display: grid; grid-template-columns: 1.1fr 1.4fr 0.5fr; gap: 12px; padding: 11px 12px; border-radius: 11px; background: #f8fbf9; border: 1px solid #edf2ef; font-size: 12px; }
.result-row.error { grid-template-columns: 1.1fr 1.9fr; color: var(--red); background: #fff9f8; border-color: #f9e4e1; }
.result-key { font-family: var(--mono); color: #50635b; }
.result-account { font-weight: 700; }
.result-plan { color: var(--green); }

.download-box { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 18px; padding: 15px 16px; border-radius: 14px; background: #eef8f3; border: 1px solid #d8eee5; }
.download-box strong { font-size: 13px; }
.download-box p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.totp-panel { margin-top: 18px; }
.totp-layout { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 22px; align-items: end; }
.totp-result { min-height: 92px; border-radius: 15px; background: #0d3428; color: #fff; padding: 14px 16px; display: flex; flex-direction: column; justify-content: center; }
.totp-result small { color: #a6c9ba; font-size: 10px; }
.totp-result strong { font-family: var(--mono); font-size: 30px; letter-spacing: 0.09em; margin-top: 4px; }
.totp-result span { color: #82b7a1; font-size: 11px; margin-top: 3px; }
.site-footer { width: min(980px, calc(100% - 40px)); margin: 0 auto 34px; padding: 18px 0 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 11px; }

.admin-body { background: #f2f5f4; }
.admin-header { width: min(1420px, calc(100% - 40px)); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.subtle { color: var(--muted); font-size: 11px; }
.admin-shell { width: min(1420px, calc(100% - 40px)); margin: 6px auto 48px; }
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 10px 0 18px; }
.admin-tabs { display: flex; gap: 5px; padding: 5px; background: rgba(255,255,255,.72); border: 1px solid var(--line); border-radius: 13px; overflow: auto; }
.admin-tab { border: 0; background: transparent; padding: 9px 14px; border-radius: 9px; font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.admin-tab.active { background: #fff; color: var(--green-strong); box-shadow: 0 4px 14px rgba(21,54,43,.08); font-weight: 700; }
.admin-view { display: none; }
.admin-view.active { display: block; }
.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric-card { padding: 19px; border-radius: 16px; background: var(--surface-solid); border: 1px solid var(--line); }
.metric-value { font-size: 28px; font-weight: 780; letter-spacing: -0.04em; }
.metric-value.success { color: var(--green); }
.metric-value.warning { color: var(--amber); }
.metric-value.danger { color: var(--red); }
.metric-label { color: var(--muted); font-size: 11px; margin-top: 5px; }
.split-grid { display: grid; grid-template-columns: minmax(330px, 0.92fr) minmax(0, 1.4fr); gap: 18px; align-items: start; }
.admin-view .panel { background: var(--surface-solid); box-shadow: 0 10px 35px rgba(22,54,43,.055); }
.inline-fields { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 10px; }
.key-form .field { margin-bottom: 12px; }
.filter-row { display: flex; gap: 8px; align-items: center; }
.filter-row input, .filter-row select { min-height: 36px; width: 150px; font-size: 12px; }
.table-wrap { overflow: auto; }
.data-table { min-width: 760px; }
.data-row { display: grid; grid-template-columns: 2.2fr 0.8fr 0.8fr 0.7fr 0.7fr 0.8fr 1.2fr 1.2fr; gap: 10px; align-items: center; min-height: 47px; padding: 0 10px; border-top: 1px solid #eef2f0; font-size: 11px; }
.data-row.head { min-height: 36px; border: 0; color: #75817c; font-size: 10px; letter-spacing: .02em; background: #f8faf9; border-radius: 9px; }
.data-row:not(.head):hover { background: #fbfdfc; }
.data-row > div { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.account-row { grid-template-columns: 2.4fr .65fr .9fr .5fr 1.5fr 1.3fr 1.5fr; }
.key-row { grid-template-columns: 2.1fr .55fr .45fr .55fr .55fr .5fr 1.25fr 1.2fr; }
.audit-row { grid-template-columns: 1.1fr .7fr 1.1fr 1.2fr 2.5fr; }
.email-cell { display: flex; flex-direction: column; gap: 4px; }
.strong { font-weight: 700; }
.mono { font-family: var(--mono); }
.success-text { color: var(--green); font-weight: 700; }
.danger-text { color: var(--red); font-weight: 700; }
.row-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.metadata-cell { white-space: nowrap; }
.empty-state { min-height: 150px; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(15,34,27,.45); backdrop-filter: blur(5px); }
.modal { width: min(760px, calc(100% - 30px)); max-height: min(720px, calc(100% - 30px)); overflow: auto; background: #fff; border-radius: 18px; padding: 24px; box-shadow: 0 40px 100px rgba(0,0,0,.27); }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.modal-heading h3 { margin: 0 0 6px; }
.modal-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.modal-text { margin-top: 18px; min-height: 280px; font-size: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.toast { position: fixed; z-index: 70; right: 22px; bottom: 22px; padding: 12px 16px; border-radius: 11px; background: #143a2d; color: #fff; font-size: 12px; box-shadow: 0 14px 40px rgba(0,0,0,.18); }
.toast.error { background: #8c342d; }

@media (max-width: 960px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .split-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .site-header, .admin-header { width: calc(100% - 24px); padding-top: 18px; }
  .shell, .admin-shell { width: calc(100% - 24px); margin-top: 10px; }
  .hero { padding: 34px 2px 22px; }
  .hero h1 { font-size: 38px; }
  .panel { padding: 20px; border-radius: 18px; }
  .form-row, .totp-layout { grid-template-columns: 1fr; }
  .inline-fields { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .download-box, .site-footer { flex-direction: column; align-items: flex-start; }
  .site-footer { width: calc(100% - 24px); }
  .filter-row { flex-wrap: wrap; }
  .filter-row input, .filter-row select { width: 100%; }
  .admin-toolbar { align-items: flex-start; flex-direction: column; }
}
