:root {
  --ink-950: #132227;
  --ink-800: #263a40;
  --ink-650: #52666b;
  --ink-500: #718187;
  --line: #dce5e4;
  --surface: #ffffff;
  --surface-soft: #f3f7f6;
  --mint-700: #087f6d;
  --mint-600: #0c947c;
  --mint-500: #19aa8d;
  --mint-150: #d9f3ed;
  --mint-75: #effaf7;
  --amber-600: #b76e13;
  --amber-100: #fff1d8;
  --red-650: #b54040;
  --red-100: #fde8e8;
  --shadow-lg: 0 28px 75px rgba(24, 59, 56, .13), 0 5px 18px rgba(24, 59, 56, .07);
  --shadow-sm: 0 5px 16px rgba(24, 59, 56, .08);
  --radius-lg: 28px;
  --radius-md: 16px;
  --focus: 0 0 0 4px rgba(25, 170, 141, .18);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink-950);
  background: var(--surface-soft);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

*, *::before, *::after { box-sizing: border-box; }

html { min-width: 320px; scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink-950);
  background: var(--surface-soft);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }
img { max-width: 100%; }
a { color: inherit; }

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 9px 14px;
  color: #fff;
  background: var(--ink-950);
  border-radius: 10px;
  transform: translateY(-150%);
  transition: transform .18s ease;
}
.skip-link:focus { transform: translateY(0); }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

[hidden] { display: none !important; }

.public-page {
  background:
    radial-gradient(circle at 15% 18%, rgba(155, 229, 211, .42), transparent 28rem),
    radial-gradient(circle at 88% 78%, rgba(220, 203, 255, .34), transparent 30rem),
    #f4f8f7;
}

.public-page::before,
.public-page::after {
  content: "";
  position: fixed;
  z-index: 0;
  border: 1px solid rgba(12, 148, 124, .16);
  border-radius: 50%;
  pointer-events: none;
}

.public-page::before {
  width: 390px;
  height: 390px;
  top: -210px;
  right: -130px;
}

.public-page::after {
  width: 270px;
  height: 270px;
  bottom: -160px;
  left: -90px;
}

.public-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 20px;
  padding: 48px 20px 32px;
}

.invite-card {
  width: min(100%, 610px);
  min-height: 600px;
  padding: 44px 50px 46px;
  overflow: hidden;
  background: rgba(255, 255, 255, .95);
  border: 1px solid rgba(255, 255, 255, .95);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 27px;
  background: var(--ink-950);
  border-radius: 13px 13px 13px 4px;
  box-shadow: 0 7px 18px rgba(19, 34, 39, .18);
}

.brand-mark span {
  width: 17px;
  height: 17px;
  border: 3px solid #79e1ca;
  border-top-color: transparent;
  border-radius: 50%;
  transform: rotate(-20deg);
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--mint-700);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .2em;
}

.invite-heading h1,
.state-panel h2 {
  margin: 0;
  font-weight: 740;
  line-height: 1.2;
  letter-spacing: -.02em;
}

.invite-heading h1 { font-size: clamp(29px, 5vw, 38px); }

.public-intro {
  margin: 15px 0 31px;
  color: var(--ink-650);
  font-size: 15px;
  line-height: 1.78;
}

.state-panel {
  outline: none;
  animation: panel-in .35s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.invite-form { display: grid; gap: 21px; }

.field-group label,
.captcha-group legend {
  display: block;
  margin: 0 0 9px;
  padding: 0;
  color: var(--ink-800);
  font-size: 14px;
  font-weight: 670;
}

.field-group input,
.captcha-input-wrap input {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  color: var(--ink-950);
  background: var(--surface);
  border: 1px solid #cdd9d7;
  border-radius: 13px;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.field-group input:hover,
.captcha-input-wrap input:hover { border-color: #9db2ae; }

.field-group input:focus,
.captcha-input-wrap input:focus {
  border-color: var(--mint-500);
  box-shadow: var(--focus);
}

.field-group input::placeholder,
.captcha-input-wrap input::placeholder { color: #98a6a9; }

.field-hint {
  margin: 7px 2px 0;
  color: var(--ink-500);
  font-size: 12px;
}

.captcha-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.captcha-row { display: grid; grid-template-columns: 1fr 145px; gap: 12px; }

.captcha-image-button {
  position: relative;
  height: 54px;
  padding: 0;
  overflow: hidden;
  background: #eaf1ef;
  border: 1px solid #cdd9d7;
  border-radius: 13px;
  cursor: pointer;
  outline: none;
}

.captcha-image-button:hover { border-color: var(--mint-500); }
.captcha-image-button:focus-visible { border-color: var(--mint-500); box-shadow: var(--focus); }
.captcha-image-button:disabled { cursor: wait; opacity: .65; }

.captcha-image-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity .18s ease;
}
.captcha-image-button img.is-loading { opacity: .22; }

.captcha-reload {
  position: absolute;
  right: 5px;
  bottom: 4px;
  padding: 1px 5px;
  color: #fff;
  background: rgba(19, 34, 39, .72);
  border-radius: 5px;
  font-size: 10px;
}

.form-message {
  min-height: 21px;
  margin: -5px 1px -5px;
  color: var(--red-650);
  font-size: 13px;
  font-weight: 610;
}

.primary-button,
.secondary-button {
  min-height: 54px;
  border-radius: 13px;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, opacity .18s ease;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 20px;
  color: #fff;
  background: var(--ink-950);
  border: 1px solid var(--ink-950);
  box-shadow: 0 9px 20px rgba(19, 34, 39, .14);
}

.primary-button:hover { background: #20383e; transform: translateY(-1px); box-shadow: 0 12px 23px rgba(19, 34, 39, .18); }
.primary-button:focus-visible, .secondary-button:focus-visible { box-shadow: var(--focus); }
.primary-button:active, .secondary-button:active { transform: translateY(1px); }
.primary-button:disabled { cursor: wait; opacity: .65; transform: none; }
.primary-button.is-loading span:first-child::after { content: "…"; }

.processing-panel,
.result-panel {
  min-height: 310px;
  padding: 38px 8px 10px;
  text-align: center;
}

.processing-panel h2,
.result-panel h2 { margin-top: 23px; font-size: 27px; }

.processing-panel > p:not(.elapsed-label),
.result-panel > p:not(.eyebrow) {
  max-width: 420px;
  margin: 12px auto 0;
  color: var(--ink-650);
  line-height: 1.75;
}

.status-orbit {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 0 auto;
  background: var(--mint-75);
  border-radius: 50%;
}

.status-orbit::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 2px solid var(--mint-150);
  border-top-color: var(--mint-600);
  border-radius: 50%;
  animation: spin .85s linear infinite;
}

.status-orbit span {
  position: absolute;
  top: 33px;
  left: 33px;
  width: 6px;
  height: 6px;
  background: var(--mint-600);
  border-radius: 50%;
}

@keyframes spin { to { transform: rotate(360deg); } }

.waiting-track {
  width: min(100%, 380px);
  height: 7px;
  margin: 29px auto 0;
  overflow: hidden;
  background: #e7efed;
  border-radius: 100px;
}

.waiting-track span {
  display: block;
  width: 38%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--mint-500), transparent);
  border-radius: inherit;
  animation: waiting 1.55s ease-in-out infinite;
}

.waiting-track--soft span { background: linear-gradient(90deg, transparent, #c98b2e, transparent); }

@keyframes waiting {
  from { transform: translateX(-105%); }
  to { transform: translateX(365%); }
}

.elapsed-label { margin: 11px 0 0; color: var(--ink-500); font-size: 12px; }

.result-symbol {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  margin: 0 auto;
  border-radius: 50%;
  font-size: 29px;
  font-weight: 780;
}

.result-symbol--success { color: var(--mint-700); background: var(--mint-150); }
.result-symbol--manual { color: var(--amber-600); background: var(--amber-100); letter-spacing: .1em; }
.result-symbol--error { color: var(--red-650); background: var(--red-100); }
.result-panel .eyebrow { margin-top: 18px; }
.result-panel .eyebrow + h2 { margin-top: 6px; }

.success-copy { white-space: pre-line; }

.success-image {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 1;
  margin: 25px auto 0;
  object-fit: cover;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.secondary-button {
  min-width: 154px;
  margin-top: 27px;
  padding: 0 22px;
  color: var(--ink-800);
  background: var(--surface);
  border: 1px solid #bdcbc9;
}
.secondary-button:hover { border-color: var(--mint-500); color: var(--mint-700); transform: translateY(-1px); }

.noscript-message {
  margin: 24px 0 0;
  padding: 12px 14px;
  color: var(--red-650);
  background: var(--red-100);
  border-radius: 10px;
  font-size: 13px;
}

.public-footnote { margin: 0; color: var(--ink-500); font-size: 12px; letter-spacing: .04em; }

@media (max-width: 620px) {
  .public-shell { place-content: start center; padding: 0; }
  .invite-card {
    width: 100%;
    min-height: calc(100vh - 44px);
    padding: 34px 22px 38px;
    border: 0;
    border-radius: 0 0 25px 25px;
    box-shadow: 0 18px 46px rgba(24, 59, 56, .1);
  }
  .brand-mark { margin-bottom: 24px; }
  .public-intro { margin-bottom: 27px; }
  .captcha-row { grid-template-columns: minmax(0, 1fr) 128px; }
  .processing-panel, .result-panel { padding-top: 47px; }
  .public-footnote { padding-bottom: 15px; }
}

@media (max-width: 385px) {
  .captcha-row { grid-template-columns: 1fr; }
  .captcha-image-button { width: 145px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Admin */
.admin-page { background: #f3f6f5; }
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.admin-sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 27px 18px 22px; color: #d8e5e2; background: #14272b; }
.admin-logo { display: flex; align-items: center; gap: 11px; margin: 0 8px 30px; color: #fff; text-decoration: none; }
.admin-logo span { display: grid; place-items: center; width: 35px; height: 35px; color: #13302c; background: #6ad6bd; border-radius: 11px 11px 11px 4px; font-weight: 850; }
.admin-logo strong { font-size: 17px; }
.admin-sidebar nav { display: grid; gap: 5px; }
.admin-sidebar nav a { padding: 11px 13px; color: #aebfbc; border-radius: 10px; font-size: 14px; font-weight: 620; text-decoration: none; }
.admin-sidebar nav a:hover { color: #fff; background: rgba(255,255,255,.06); }
.admin-sidebar nav a.active { color: #fff; background: rgba(94,211,184,.15); box-shadow: inset 3px 0 #65d6bd; }
.logout-form { margin-top: auto; }
.logout-form button { width: 100%; padding: 10px; color: #aebfbc; background: transparent; border: 1px solid rgba(255,255,255,.13); border-radius: 10px; cursor: pointer; }
.admin-main { min-width: 0; padding: 42px clamp(25px, 4vw, 62px) 70px; }
.maintenance-banner { margin: -42px calc(clamp(25px, 4vw, 62px) * -1) 32px; padding: 11px 30px; color: #74460e; background: #ffedc7; text-align: center; font-size: 13px; font-weight: 700; }
.admin-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 25px; margin-bottom: 28px; }
.admin-header h1 { margin: 3px 0 6px; font-size: clamp(28px, 4vw, 38px); line-height: 1.2; letter-spacing: -.025em; }
.admin-header p:not(.eyebrow) { margin: 0; color: var(--ink-650); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 20px; }
.metric-grid article, .panel, .profile-card, .empty-card { background: #fff; border: 1px solid #e0e8e6; border-radius: 17px; box-shadow: 0 4px 14px rgba(24,59,56,.035); }
.metric-grid article { padding: 21px 22px; }
.metric-grid span { display: block; color: var(--ink-650); font-size: 13px; }
.metric-grid strong { display: block; margin: 6px 0 0; font-size: 32px; line-height: 1; }
.metric-grid small { color: var(--ink-500); }
.panel { margin-bottom: 20px; padding: 22px; }
.narrow-panel { max-width: 720px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 17px; }
.panel-heading h2 { margin: 0; font-size: 18px; }
.panel-heading p { margin: 3px 0 0; color: var(--ink-500); font-size: 13px; }
.panel hr { height: 1px; margin: 25px 0; background: var(--line); border: 0; }
.text-link { color: var(--mint-700); font-size: 13px; font-weight: 700; text-decoration: none; }
.notice, .key-box { margin: 0 0 20px; padding: 13px 16px; border-radius: 12px; font-size: 14px; }
.notice.success { color: #086d5a; background: #ddf5ee; }
.notice.error { color: #963737; background: #fde8e8; }
.notice.warning { color: #87520f; background: #fff0d3; }
.stack-form { display: grid; gap: 17px; }
.inline-form { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.stack-form label, .inline-form label { display: grid; flex: 1; gap: 7px; min-width: 190px; color: var(--ink-800); font-size: 13px; font-weight: 650; }
.stack-form label small { color: var(--ink-500); font-weight: 500; }
.stack-form input, .stack-form textarea, .inline-form input, .search-form input, .filter-form input, .filter-form select, .panel textarea { width: 100%; padding: 11px 13px; color: var(--ink-950); background: #fff; border: 1px solid #cdd9d7; border-radius: 10px; outline: none; }
.stack-form input:focus, .stack-form textarea:focus, .inline-form input:focus, .search-form input:focus, .filter-form input:focus, .filter-form select:focus { border-color: var(--mint-500); box-shadow: var(--focus); }
.stack-form textarea, .panel textarea { resize: vertical; line-height: 1.6; }
.primary-compact, .secondary-compact, .danger-button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 16px; border-radius: 10px; font-size: 13px; font-weight: 730; text-decoration: none; cursor: pointer; }
.primary-compact { color: #fff; background: var(--ink-950); border: 1px solid var(--ink-950); }
.secondary-compact { color: var(--ink-800); background: #fff; border: 1px solid #c8d5d2; }
.danger-button { color: #fff; background: #a64242; border: 1px solid #a64242; }
.search-form, .filter-form { display: flex; align-items: center; gap: 9px; }
.search-form input { width: min(280px, 55vw); }
.search-form button { padding: 9px 13px; background: #fff; border: 1px solid #c8d5d2; border-radius: 9px; cursor: pointer; }
.filter-form { margin-bottom: 18px; }
.filter-form input { max-width: 330px; }.filter-form select { width: 170px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 11px 12px; color: var(--ink-500); background: #f6f8f8; text-align: left; font-size: 12px; white-space: nowrap; }
td { padding: 13px 12px; border-bottom: 1px solid #edf1f0; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
td small { display: block; margin-top: 3px; color: var(--ink-500); }
.mono, code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.empty { padding: 30px; color: var(--ink-500); text-align: center; }
.status { display: inline-flex; padding: 3px 8px; color: #455b60; background: #edf2f1; border-radius: 999px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.status-completed { color: #08715e; background: #dff5ef; }.status-queued { color: #6d5414; background: #fff1cc; }.status-needs_review { color: #9b3737; background: #fde5e5; }.status-cancelled { color: #667176; background: #ecefef; }
.starred-row { background: #fff9e9; }
.link-danger { padding: 0; color: #a23b3b; background: transparent; border: 0; font-size: 12px; font-weight: 700; cursor: pointer; }
.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }.split-grid .panel { min-width: 0; }
.error-list { margin: 0; padding-left: 20px; color: #913b3b; font-size: 13px; line-height: 1.8; }
.action-row { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.confirm-box h2, #manual-result h2 { margin: 0 0 9px; }.confirm-box p, #manual-result p { color: var(--ink-650); }
#manual-result { padding: 20px; text-align: center; }.admin-page .status-orbit { margin-bottom: 20px; }
.content-preview { width: 100%; aspect-ratio: 3/1; object-fit: cover; border: 1px solid var(--line); border-radius: 12px; }
.profile-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.profile-card { padding: 20px; }.profile-card.disabled { opacity: .58; }.profile-card > div:first-child { display: grid; grid-template-columns: 10px 1fr; column-gap: 9px; }.profile-card > div:first-child small { grid-column: 2; color: var(--ink-500); }
.online-dot { width: 9px; height: 9px; margin-top: 6px; background: #acb8b6; border-radius: 50%; }.online-dot.on { background: #19a887; box-shadow: 0 0 0 4px #ddf5ef; }
.profile-card dl { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 19px 0; font-size: 12px; }.profile-card dt { color: var(--ink-500); }.profile-card dd { margin: 0; font-weight: 700; }.card-actions { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 14px; }
.empty-card { grid-column: 1/-1; padding: 45px; color: var(--ink-500); text-align: center; }
.key-box { color: #eafff9; background: #183a39; }.key-box strong, .key-box code, .key-box p { display: block; }.key-box code { margin: 10px 0; padding: 10px; overflow-wrap: anywhere; color: #65e0c2; background: rgba(0,0,0,.2); border-radius: 8px; }.key-box p { margin: 0; opacity: .72; }
.admin-login-page { display: grid; place-items: center; padding: 25px; background: radial-gradient(circle at 20% 10%, #d9f3ed, transparent 28rem), #f3f7f6; }
.login-card { width: min(100%, 430px); padding: 38px; background: #fff; border: 1px solid #e0e8e6; border-radius: 24px; box-shadow: var(--shadow-lg); }.login-card h1 { margin: 5px 0; font-size: 31px; }.login-card > p:not(.eyebrow) { margin: 0 0 23px; color: var(--ink-650); }

@media (max-width: 1050px) { .metric-grid { grid-template-columns: repeat(2, 1fr); }.profile-grid { grid-template-columns: repeat(2, 1fr); }.split-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .admin-shell { display: block; }.admin-sidebar { position: static; width: 100%; height: auto; padding: 15px; }.admin-logo { margin: 0 0 12px; }.admin-sidebar nav { display: flex; overflow-x: auto; padding-bottom: 5px; }.admin-sidebar nav a { white-space: nowrap; }.logout-form { position: absolute; top: 17px; right: 15px; }.logout-form button { width: auto; }.admin-main { padding: 26px 16px 50px; }.maintenance-banner { margin: -26px -16px 24px; }.admin-header { align-items: flex-start; }.profile-grid { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .metric-grid { grid-template-columns: 1fr 1fr; }.metric-grid article { padding: 17px; }.metric-grid strong { font-size: 27px; }.admin-header { display: grid; }.inline-form, .filter-form { align-items: stretch; flex-direction: column; }.filter-form input, .filter-form select { width: 100%; max-width: none; }.panel { padding: 16px; }.login-card { padding: 28px 22px; } }
