:root {
  color-scheme: light;
  --blue-700: #164dc8;
  --blue-600: #1f5eea;
  --blue-100: #eaf1ff;
  --ink-950: #0d172a;
  --ink-700: #334155;
  --ink-500: #64748b;
  --line: #d9e1ec;
  --surface: #ffffff;
  --error: #b42318;
  --radius: 10px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #fff;
  color: var(--ink-950);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; margin: 0; }

body {
  background: #fff;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }

button { cursor: pointer; }

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(31, 94, 234, .24);
  outline-offset: 2px;
}

.login-layout {
  width: min(440px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 32px;
  padding: 48px 0;
}

.brand-context {
  padding: 0;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  color: var(--ink-950);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.04em;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: block;
}

.brand-context p {
  max-width: 280px;
  margin: 24px 0 0;
  color: var(--ink-500);
  font-size: 15px;
  line-height: 1.75;
}

.login-panel {
  width: 100%;
}

.single-auth-layout {
  width: min(440px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  align-items: center;
  padding: 48px 0;
}

.compact-lockup {
  margin-bottom: 36px;
  font-size: 24px;
}

.compact-lockup .brand-mark {
  width: 38px;
  height: 38px;
}

.password-hint {
  margin: 2px 0 0;
  color: var(--ink-500);
  font-size: 13px;
}

.login-panel h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 44px);
  letter-spacing: -.035em;
  line-height: 1.2;
}

.login-subtitle {
  margin: 10px 0 38px;
  color: var(--ink-500);
  font-size: 18px;
}

.login-panel form { display: grid; gap: 10px; }

.login-panel label {
  color: var(--ink-700);
  font-size: 14px;
  font-weight: 650;
}

.login-panel input {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink-950);
  transition: border-color .18s ease, box-shadow .18s ease;
}

.login-panel input:hover { border-color: #aebbd0; }

.login-panel input:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 4px rgba(31, 94, 234, .1);
  outline: 0;
}

.password-field { position: relative; }
.password-field input { padding-right: 72px; }

.icon-button {
  position: absolute;
  right: 8px;
  top: 50%;
  translate: 0 -50%;
  min-width: 54px;
  min-height: 36px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-500);
  font-size: 13px;
}

.icon-button:hover { background: #f3f6fa; color: var(--ink-700); }

.primary-button,
.secondary-button {
  min-height: 48px;
  padding: 11px 20px;
  border-radius: var(--radius);
  font-weight: 700;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}

.primary-button {
  border: 1px solid var(--blue-600);
  background: var(--blue-600);
  color: #fff;
}

.login-panel .primary-button { margin-top: 18px; min-height: 54px; }
.primary-button:hover { background: var(--blue-700); }
.primary-button:active { transform: translateY(1px); }
.primary-button:disabled { cursor: wait; opacity: .65; }

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-700);
}

.form-error {
  margin-top: 8px;
  padding: 10px 12px;
  border-left: 3px solid var(--error);
  background: #fff6f5;
  color: var(--error);
  font-size: 14px;
}

.admin-help {
  margin: 16px 0 0;
  text-align: center;
  color: var(--ink-500);
  font-size: 14px;
}

.admin-help { color: var(--blue-700); }

.prepare-layout {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 36px;
  padding: 56px 24px;
}

.prepare-brand { font-size: 26px; gap: 12px; }
.prepare-brand .brand-mark { width: 42px; height: 42px; }

.prepare-card {
  width: min(620px, 100%);
  text-align: center;
}

.office-scene {
  width: min(300px, 78vw);
  aspect-ratio: 1.42 / 1;
  margin: 0 auto 32px;
  background-image: url("/assets/agent-office-sprite-v2.png");
  background-repeat: no-repeat;
  background-size: 300% auto;
  background-position-y: center;
  image-rendering: pixelated;
}

.stage-door { background-position-x: left; }
.stage-lights { background-position-x: center; }
.stage-agent { background-position-x: right; }

.stage-copy h1 {
  margin: 0;
  font-size: clamp(27px, 4vw, 38px);
  line-height: 1.3;
  letter-spacing: -.025em;
}

.stage-copy p {
  margin: 8px 0 0;
  color: var(--blue-700);
  font-size: 14px;
}

.fun-copy {
  min-height: 32px;
  margin: 18px auto 0;
  color: var(--ink-500);
  font-size: 15px;
  transition: opacity .25s ease;
}

.text-button {
  margin-top: 18px;
  padding: 6px 8px;
  border: 0;
  background: transparent;
  color: var(--ink-500);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prepare-error {
  width: min(540px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(23, 43, 77, .08);
  text-align: center;
}

.prepare-error h1 { margin: 0; font-size: 28px; }
.prepare-error > p { color: var(--ink-700); }
.prepare-error .diagnostic { color: var(--ink-500); font-size: 13px; overflow-wrap: anywhere; }
.error-actions { display: flex; justify-content: center; gap: 12px; margin-top: 24px; }

.workbench-header {
  height: 72px;
  padding: 0 clamp(20px, 5vw, 64px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.workbench-header .brand-lockup { font-size: 24px; gap: 10px; }
.workbench-header .brand-mark { width: 38px; height: 38px; }
.workbench-header .secondary-button { min-height: 40px; }

.workbench {
  width: min(960px, calc(100% - 40px));
  margin: 0 auto;
  padding: 72px 0;
}

.local-boundary {
  color: var(--blue-700);
  font-size: 14px;
  font-weight: 700;
}

.workbench h1 { margin: 8px 0; font-size: clamp(32px, 5vw, 48px); }
.workbench h2 { margin-top: 48px; font-size: 20px; }

#navigation {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

#navigation a {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-700);
  text-decoration: none;
}

#navigation a:hover { border-color: var(--blue-600); color: var(--blue-700); }

.integration-pending {
  margin-top: 56px;
  padding: 16px 18px;
  border-left: 3px solid var(--blue-600);
  background: #f7f9fd;
  color: var(--ink-700);
}

[hidden] { display: none !important; }

@media (max-width: 760px) {
  .login-layout {
    width: min(100% - 40px, 440px);
    min-height: 100svh;
    display: flex;
    padding: 32px 0 40px;
  }

  .brand-context {
    padding: 0;
    margin: 0;
    border: 0;
  }

  .brand-lockup {
    gap: 12px;
    font-size: 25px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .login-panel h1 { font-size: 30px; }
  .login-subtitle { margin: 6px 0 24px; font-size: 16px; }
  .login-panel input { min-height: 50px; }
  .login-panel .primary-button { min-height: 52px; margin-top: 14px; }
}

@media (max-width: 420px) {
  .login-layout { width: calc(100% - 32px); padding: 24px 0 32px; gap: 26px; }
  .login-panel h1 { font-size: 29px; }
  .prepare-layout { padding: 32px 16px; gap: 28px; }
  .prepare-brand { width: 150px; }
  .office-scene { width: min(250px, 74vw); margin-bottom: 24px; }
  .stage-copy h1 { font-size: 26px; }
  .fun-copy { max-width: 320px; min-height: 48px; }
  .prepare-error { padding: 24px 18px; }
  .error-actions { flex-direction: column; }
  .error-actions button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
