:root {
  --ink: #13243a;
  --muted: #617086;
  --paper: #f5f8fb;
  --surface: #ffffff;
  --line: #d9e1ea;
  --navy: #183b66;
  --navy-dark: #102b4d;
  --sky: #dceeff;
  --green: #16856c;
  --red: #ba3f4b;
  --shadow: 0 18px 45px rgba(24, 59, 102, 0.1);
  font-family: "Aptos", "Segoe UI Variable", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(24, 59, 102, 0.035) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--paper);
}

button,
input {
  font: inherit;
}

.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 64px;
}

.masthead {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

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

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px 3px 10px 3px;
  color: white;
  background: var(--navy);
  font-family: Consolas, monospace;
  font-weight: 700;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.eyebrow,
.step-label,
dt {
  color: var(--muted);
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.2rem, 5vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

h2 {
  letter-spacing: -0.025em;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 18px 6px 18px 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-layout,
.setup-layout {
  min-height: calc(100vh - 150px);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: clamp(36px, 8vw, 110px);
}

.auth-intro p:last-child,
.setup-layout > section:first-child p:last-child {
  max-width: 540px;
  font-size: 1.08rem;
}

.auth-card,
.setup-card {
  padding: clamp(28px, 5vw, 48px);
}

.form-stack {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  font-size: 0.88rem;
  font-weight: 650;
}

.field input {
  width: 100%;
  min-height: 46px;
  border: 1px solid #b8c4d1;
  border-radius: 8px 3px 8px 3px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fbfdff;
}

.field input:focus {
  outline: 3px solid var(--sky);
  border-color: var(--navy);
}

.button {
  min-height: 42px;
  border: 0;
  border-radius: 8px 3px 8px 3px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 700;
}

.button:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 3px;
}

.button-primary {
  color: white;
  background: var(--navy);
}

.button-primary:hover {
  background: var(--navy-dark);
}

.button-secondary {
  color: var(--navy);
  background: var(--sky);
}

.button-danger {
  color: white;
  background: var(--red);
}

.button-quiet {
  color: var(--navy);
  background: transparent;
  border: 1px solid var(--line);
}

.notice {
  margin: 18px 0;
  border-left: 4px solid var(--navy);
  padding: 12px 16px;
  color: var(--ink);
  background: var(--sky);
}

.notice-error {
  border-color: var(--red);
  background: #fff0f1;
}

.qr-code {
  display: block;
  width: min(240px, 100%);
  margin: 0 auto 24px;
}

.recovery-key {
  margin-bottom: 24px;
  border: 1px dashed #aebccb;
  padding: 14px;
  background: var(--paper);
}

.recovery-key span,
.recovery-key code {
  display: block;
}

.recovery-key span {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

.recovery-key code {
  overflow-wrap: anywhere;
  font-weight: 700;
}

.dashboard-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 64px 0 28px;
}

.dashboard-heading h1 {
  font-size: clamp(2.6rem, 7vw, 5rem);
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.service-card {
  position: relative;
  overflow: hidden;
  padding: 28px;
}

.service-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: var(--red);
  content: "";
}

.service-card.is-running::before {
  background: var(--green);
}

.service-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 26px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
}

.is-running .status-dot {
  background: var(--green);
}

dl {
  margin: 24px 0;
}

dl > div {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

dd {
  margin: 7px 0 0;
  overflow-wrap: anywhere;
  color: var(--ink);
}

.password-panel {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: clamp(30px, 7vw, 90px);
  margin-top: 20px;
  padding: clamp(28px, 5vw, 44px);
}

.password-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.password-form .button {
  grid-column: 1 / -1;
  justify-self: start;
}

.password-form-wide {
  grid-column: 1 / -1;
}

@media (max-width: 760px) {
  .auth-layout,
  .setup-layout,
  .password-panel,
  .service-grid {
    grid-template-columns: 1fr;
  }

  .auth-layout,
  .setup-layout {
    padding: 48px 0;
  }

  .dashboard-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-heading .button {
    width: 100%;
  }

  .password-form {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .button {
    transition: background-color 150ms ease, transform 150ms ease;
  }

  .button:hover {
    transform: translateY(-1px);
  }
}
