:root {
  color-scheme: light;
  --bg: #f5f2ea;
  --bg-soft: #efebe0;
  --surface: #fcfaf5;
  --surface-raised: #fffdf8;
  --text: #1c1b18;
  --text-soft: #464239;
  --muted: #797266;
  --line: rgba(28, 27, 24, 0.12);
  --line-strong: rgba(28, 27, 24, 0.22);
  --accent: #b44a23;
  --accent-hover: #913817;
  --accent-soft: #ead6c6;
  --green: #3f6b45;
  --green-soft: #e0ead9;
  --danger: #9d2f20;
  --danger-soft: #f4ddd7;
  --shadow: 0 30px 70px -36px rgba(58, 44, 25, 0.38);
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Songti SC", "Noto Serif CJK SC",
    "STSong", Georgia, serif;
  --font-sans: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui,
    -apple-system, sans-serif;
  --font-mono: "SFMono-Regular", "Cascadia Code", "Liberation Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #171613;
    --bg-soft: #1d1b17;
    --surface: #201e19;
    --surface-raised: #26231d;
    --text: #f2eee4;
    --text-soft: #cbc4b6;
    --muted: #9b9385;
    --line: rgba(242, 238, 228, 0.12);
    --line-strong: rgba(242, 238, 228, 0.22);
    --accent: #e38a5c;
    --accent-hover: #f0a176;
    --accent-soft: #49291d;
    --green: #8fbd92;
    --green-soft: #26352a;
    --danger: #f0a093;
    --danger-soft: #45231d;
    --shadow: 0 30px 70px -36px rgba(0, 0, 0, 0.75);
  }
}

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

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 42% at 82% -8%, rgba(180, 74, 35, 0.12), transparent 65%),
    radial-gradient(ellipse 42% 30% at 4% 28%, rgba(63, 107, 69, 0.06), transparent 70%);
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-hover);
}

.skip {
  position: absolute;
  left: -999px;
  top: 12px;
  padding: 8px 12px;
  background: var(--surface-raised);
  border-radius: 8px;
  z-index: 10;
}

.skip:focus {
  left: 12px;
}

.site-head {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--text);
  color: var(--bg);
  font-family: var(--font-serif);
  font-size: 22px;
  line-height: 1;
}

.brand-text {
  display: flex;
  flex-direction: column;
  font-family: var(--font-serif);
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.brand-text small {
  margin-top: 3px;
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}

.head-link {
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
}

.head-link:hover {
  color: var(--accent);
}

.auth-shell {
  flex: 1;
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(20px, 5vh, 58px) 0 clamp(40px, 8vh, 90px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.card {
  width: min(100%, 470px);
  padding: clamp(28px, 4.5vw, 46px);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.card-wide {
  width: min(100%, 760px);
}

.card-mid {
  width: min(100%, 620px);
}

.hint {
  margin: -6px 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.inline-form {
  display: inline;
  margin: 0;
}

.inline-form .link-button {
  margin-left: 4px;
}

.section-sep {
  margin: 28px 0 22px;
  border-top: 1px solid var(--line);
}

.status-ok,
.status-warn {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  vertical-align: 1px;
}

.status-ok {
  background: var(--green-soft);
  color: var(--green);
}

.status-warn {
  background: var(--danger-soft);
  color: var(--danger);
}

td.email {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(30px, 5vw, 42px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.lede {
  margin: 12px 0 26px;
  color: var(--muted);
  font-size: 15px;
}

.error-code {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 64px;
  line-height: 1;
  color: var(--accent);
}

.form {
  display: grid;
  gap: 17px;
  margin-top: 8px;
}

.form.compact {
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--text-soft);
}

label > span {
  font-weight: 600;
  letter-spacing: 0.01em;
}

label small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface-raised);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease,
    transform 140ms ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  width: 100%;
  background: var(--text);
  color: var(--bg);
}

.btn.primary:hover {
  background: var(--accent);
  color: #fff;
}

.btn.ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text);
}

.btn.ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.alert,
.notice {
  margin: 0 0 18px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.55;
}

.alert {
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  color: var(--danger);
}

.notice {
  background: var(--green-soft);
  border: 1px solid color-mix(in srgb, var(--green) 30%, transparent);
  color: var(--green);
}

.meta {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.dot {
  color: var(--line-strong);
}

.facts {
  margin: 0 0 24px;
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.facts > div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  color: var(--text-soft);
  text-align: right;
  font-weight: 500;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.actions .btn {
  flex: 1 1 150px;
}

.logout {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-button:hover {
  color: var(--danger);
}

.table-wrap {
  overflow-x: auto;
  margin: 20px 0 30px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  background: var(--bg-soft);
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.02em;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td.num {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.subhead {
  margin: 10px 0 14px;
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 600;
}

.site-foot {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 18px 0 28px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.site-foot a {
  color: var(--muted);
  text-decoration: none;
}

.site-foot a:hover {
  color: var(--accent);
}

@media (max-width: 520px) {
  .site-head,
  .auth-shell,
  .site-foot {
    width: calc(100% - 28px);
  }

  .card {
    border-radius: 16px;
    padding: 24px 20px;
  }

  .facts > div {
    flex-direction: column;
    gap: 2px;
  }

  .facts dd {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
