:root {
  --ink: #172033;
  --muted: #667085;
  --line: #dfe5ee;
  --page: #f4f7fb;
  --panel: #ffffff;
  --red: #d90012;
  --blue: #1769e0;
  --green: #16835b;
  --amber: #9a5a00;
}

* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; letter-spacing: 0; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-panel {
  width: min(100%, 460px);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 32px rgba(28, 48, 84, 0.08);
}
.panel-header, .admin-header, .admin-tools, .brand-row, .section-bar, .user-actions {
  display: flex;
  align-items: center;
}
.panel-header, .admin-header, .section-bar { justify-content: space-between; }
.brand-row { gap: 10px; font-size: 15px; font-weight: 750; }
.brand-logo {
  width: 86px;
  height: 31px;
  flex: 0 0 auto;
  display: block;
  background: url("/auth/static/roe-logo.svg") center / contain no-repeat;
}

.language-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 116px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f5f7fa;
}
.language-switch button {
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}
.language-switch button.is-active { background: var(--blue); color: #fff; }

.title-block { margin: 36px 0 26px; }
.title-block.compact { margin: 38px 0 28px; }
.title-block.centered { text-align: center; }
.title-block h1, .admin-header h1 { margin: 0; font-size: 28px; line-height: 1.25; }
.verified-email { margin: 14px 0 0; color: var(--ink); font-weight: 750; overflow-wrap: anywhere; }

form { display: grid; gap: 10px; }
label { font-size: 13px; font-weight: 750; }
input {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  border: 1px solid #cfd7e4;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23, 105, 224, 0.12); }
button {
  min-height: 48px;
  border: 0;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}
button:disabled { cursor: wait; opacity: 0.65; }
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: 28px;
  padding: 4px;
  border-radius: 7px;
  background: #eef2f7;
}
.auth-tab { min-height: 40px; background: transparent; color: var(--muted); }
.auth-tab.is-active { background: #fff; color: var(--ink); box-shadow: 0 1px 5px rgba(28,48,84,.1); }
.code-row { display: grid; grid-template-columns: minmax(0,1fr) 118px; gap: 8px; }
.code-button { min-height: 50px; padding: 0 10px; font-size: 12px; }
.text-button { min-height: 34px; padding: 0; background: transparent; color: var(--blue); font-size: 13px; }
.secondary-button { width: 100%; margin-top: 16px; background: #eaf2fc; color: #245590; }
.message { min-height: 22px; margin-top: 16px; font-size: 13px; line-height: 1.55; }
.message.error { color: #b42318; }
.message.success { color: var(--green); }
.message.info { padding: 12px; border-radius: 6px; background: #f0f5fb; color: #34506f; text-align: center; }
.local-test-link {
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #e9f2ff;
  color: #1558b0;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}
.is-hidden { display: none !important; }

.admin-shell {
  width: min(calc(100% - 32px), 980px);
  margin: 24px auto 60px;
  padding: 26px 28px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.admin-header { align-items: flex-end; padding: 2px 2px 26px; }
.admin-header h1 { margin-top: 18px; }
.admin-tools { gap: 14px; }
.admin-email { color: var(--muted); font-size: 13px; }
.admin-return {
  min-height: 34px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  background: #edf3fb;
  color: #245590;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}
.admin-section { padding: 22px 2px; border-top: 1px solid var(--line); }
.section-bar { margin-bottom: 14px; }
.section-bar h2 { margin: 0; font-size: 18px; }
.icon-button { min-height: 34px; padding: 0 13px; background: #edf3fb; color: #245590; font-size: 12px; }
.add-user-form { grid-template-columns: minmax(0, 1fr) 110px; gap: 10px; }
.user-list { display: grid; gap: 8px; }
.user-row {
  min-width: 0;
  min-height: 60px;
  padding: 11px 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid #e7ebf2;
  border-radius: 6px;
}
.user-email { min-width: 0; font-weight: 750; overflow-wrap: anywhere; }
.user-meta { margin-top: 5px; color: var(--muted); font-size: 11px; font-weight: 600; }
.user-actions { gap: 7px; }
.user-actions button { min-height: 34px; padding: 0 12px; font-size: 12px; }
.approve-button { background: var(--green); }
.reject-button { background: #eef1f5; color: #4c5565; }
.status-badge { padding: 5px 8px; border-radius: 4px; background: #eef1f5; color: #4c5565; font-size: 11px; font-weight: 750; }
.status-approved { background: #e8f6ef; color: #126648; }
.status-pending { background: #fff3d7; color: var(--amber); }
.status-rejected, .status-disabled { background: #f5eded; color: #8f2d2d; }
.empty-state { margin: 18px 0; color: var(--muted); text-align: center; }

.portal-shell { width: min(calc(100% - 32px), 860px); margin: 0 auto; padding: 48px 0; }
.portal-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.portal-header h1 { margin: 10px 0 0; font-size: 30px; }
.portal-account { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.module-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-top: 24px; }
.module-card { min-height: 128px; padding: 22px; display: flex; align-items: center; gap: 18px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); text-decoration: none; }
.module-card:hover { border-color: #9cbce8; }
.module-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 8px; background: #eef4fd; color: var(--red); font-size: 22px; font-weight: 900; }
.module-card strong { display: block; font-size: 18px; }
.module-card span { display: block; margin-top: 7px; color: var(--muted); font-size: 13px; }
.no-access-actions { display: grid; gap: 10px; margin-top: 24px; }

@media (max-width: 620px) {
  .auth-shell { align-items: start; padding: 12px; }
  .auth-panel { margin-top: 7vh; padding: 24px 20px; }
  .brand-row { font-size: 13px; }
  .brand-logo { width: 76px; height: 28px; }
  .language-switch { width: 104px; }
  .title-block h1, .admin-header h1 { font-size: 24px; }
  .admin-shell { width: calc(100% - 20px); margin-top: 10px; padding: 20px 14px 4px; }
  .admin-header { align-items: flex-start; gap: 18px; flex-direction: column; }
  .admin-tools { width: 100%; flex-wrap: wrap; justify-content: flex-start; }
  .admin-email { width: 100%; }
  .add-user-form { grid-template-columns: 1fr; }
  .user-row { grid-template-columns: 1fr; }
  .user-actions { width: 100%; flex-wrap: wrap; }
  .user-actions button { flex: 1; }
  .code-row { grid-template-columns: minmax(0,1fr) 104px; }
  .portal-shell { width: calc(100% - 24px); padding-top: 24px; }
  .portal-header { align-items: flex-start; flex-direction: column; }
  .module-grid { grid-template-columns: 1fr; }
}
