:root {
  color-scheme: light;
  font: 16px/1.55 system-ui, 'Microsoft YaHei', 'PingFang SC', sans-serif;
  color: #192347;
  background: #eef0fb;
  --accent: #4b36a8;
  --ink-light: #58627d;
  --border: #dce0ee;
  --surface: #fff;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; }
.public-shell {
  display: grid;
  place-items: center;
  padding: 36px 20px;
  background: radial-gradient(ellipse at 20% 12%, #d9cffc, transparent 55%),
    radial-gradient(ellipse at 85% 83%, #cfe6ff, transparent 54%), #f2effb;
}
.card {
  position: relative;
  overflow: hidden;
  width: min(100%, 476px);
  padding: clamp(26px, 7vw, 46px);
  border: 1px solid #fff;
  border-radius: 28px;
  background: var(--surface);
  box-shadow: 0 28px 74px #33256024;
}
.card::before { content: ''; position: absolute; inset: 0 0 auto; height: 5px; background: linear-gradient(90deg,#6a4ed0,#a48bf2,#85baff); }
.invite-mark { display: grid; place-items: center; width: 49px; height: 49px; margin-bottom: 23px; border-radius: 15px; background: #eee8ff; }
.invite-mark::before { content: ''; width: 21px; height: 13px; border: 2px solid var(--accent); border-radius: 4px; background: radial-gradient(circle, var(--accent) 1px, transparent 1.5px) 50% 0 / 3px 4px repeat-y; }
.card h1 { margin: 0 0 10px; font-size: clamp(1.85rem, 6vw, 2.35rem); letter-spacing: -.04em; }
.card h1:has(+ form) { margin-bottom: 22px; }
.intro { margin: 0 0 26px; color: var(--ink-light); }
.field { margin-bottom: 17px; }
.note, .muted { color: var(--ink-light); }
.note { margin: 13px 0 0; font-size: .86rem; }
.note:has(+ a) { margin: 12px 0 18px; }
.privacy { padding-top: 15px; margin-top: 22px; border-top: 1px solid var(--border); }

label { display: block; font-size: .88rem; font-weight: 650; }
.field label, .edit-panel label { margin-bottom: 6px; }
input, button, select, textarea { font: inherit; border-radius: 9px; }
input, select, textarea { width: 100%; min-height: 43px; border: 1px solid #bfc7de; padding: 8px 11px; background: #fafbff; color: inherit; }
input::placeholder, textarea::placeholder { color: #65708b; }
textarea { resize: vertical; }
button {
  min-height: 43px;
  padding: 8px 16px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.card input, .card button { min-height: 49px; }
.card button { width: 100%; margin-top: 4px; }
button:hover { background: #3b278f; }
.secondary { border-color: #cbd0e5; background: white; color: var(--accent); }
.secondary:hover { background: #eeeafe; }
.danger { background: #fff; border-color: #f2c6c7; color: #8e2632; }
.danger:hover { background: #fff0f2; }
.small { min-height: 38px; padding: 6px 12px; font-size: .88rem; }
:focus-visible { outline: 3px solid #6e52ce; outline-offset: 2px; }
a { color: var(--accent); text-underline-offset: 3px; }
.error, .notice { margin: 0 0 17px; padding: 10px 13px; border: 1px solid #f2c6c7; border-radius: 8px; background: #fff1f2; color: #8e2632; }
.notice { border-color: #bbddd4; background: #effaf5; color: #205f54; }

.admin-shell { background: #f4f5fa; }
.dashboard { max-width: 1280px; margin: auto; padding: 24px clamp(14px, 5vw, 60px) 56px; }
.dashboard-header, .section-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dashboard h1 { font-size: clamp(1.55rem, 4vw, 2rem); margin: 0; }
.dashboard h2 { font-size: 1.08rem; margin: 0 0 14px; }
.section-header h2 { margin: 0; }
.tabs, .pagination { display: flex; flex-wrap: wrap; gap: 12px; }
.tabs { margin: 18px 0; border-bottom: 1px solid var(--border); }
.tabs a { padding: 9px 12px 11px; text-decoration: none; color: var(--ink-light); border-bottom: 3px solid transparent; font-weight: 650; }
.tabs a[aria-current] { color: var(--accent); border-color: var(--accent); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 20px; }
.metrics div, .admin-panel { border: 1px solid var(--border); border-radius: 13px; background: var(--surface); }
.metrics div { padding: 11px 14px; min-width: 0; }
.metrics dt { color: var(--ink-light); font-size: .82rem; }
.metrics dd { margin: 0; font-size: 1.46rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.admin-panel { padding: clamp(12px, 3vw, 22px); margin-bottom: 15px; }
.action-form, .filter { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; }
.filter input, .filter select { min-height: 38px; font-size: .88rem; }
.quantity { width: 86px; }
.grow { flex: 1 1 200px; max-width: 480px; }
.import-grid { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 14px; margin-bottom: 10px; }
.table-wrap { overflow-x: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
td, th { padding: 11px 9px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: #f3f4fa; white-space: nowrap; }
td.email { min-width: 140px; overflow-wrap: anywhere; }
td time { white-space: nowrap; }
td code { font: .86rem ui-monospace, 'Cascadia Code', Consolas, monospace; padding: 3px 6px; border-radius: 4px; background: #f2effc; white-space: nowrap; user-select: all; }
.empty { padding: 22px; color: var(--ink-light); text-align: center; }
.status { display: inline-block; white-space: nowrap; border-radius: 100px; padding: 2px 8px; background: #f0f1f8; color: var(--ink-light); font-size: .82rem; font-weight: 650; }
.status.ready { background: #e6f6ed; color: #23634f; }
.status.waiting { background: #fff0d3; color: #73450e; }
.row-controls summary { color: var(--accent); cursor: pointer; white-space: nowrap; }
.edit-panel { min-width: 210px; padding-top: 9px; }
.edit-panel textarea { margin-bottom: 6px; }
.edit-panel input:not([type="checkbox"]), .edit-panel select { margin-bottom: 8px; }
.stack-actions { display: grid; gap: 8px; }
.invitation-actions { margin-bottom: 9px; padding-bottom: 9px; border-bottom: 1px solid var(--border); }
.invitation-actions .confirm, .stack-actions .confirm { margin-bottom: 6px; }
.delete-form { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--border); }
.confirm { display: flex; align-items: center; gap: 5px; color: #8e2632; }
.confirm input { width: 17px; min-height: 17px; margin: 0; }
.row-selection { width: 18px; min-height: 18px; margin: 3px 0 0; accent-color: var(--accent); }
.slots { padding-left: 1.35em; margin: 0; white-space: nowrap; }
.pagination { margin-top: 12px; font-size: .88rem; }

@media (max-width: 610px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .import-grid { grid-template-columns: 1fr; }
  .action-form .grow { order: 2; flex-basis: 100%; }
  .batch-entry .grow { order: 0; }
}
