/*
 * The sign-in page of a private server (ADR 0037). It loads none of the app's files, so the few
 * design tokens it needs are repeated here from src/theme/tokens.css (keep them in step): light on
 * :root, dark on [data-theme='dark'] (set by /theme-init.js from the app's theme setting).
 */

:root {
  --surface-app: #f4f5f7;
  --surface-panel: #ffffff;
  --surface-sunken: #eef0f3;
  --border: #d3d8de;
  --border-control: #8c949e;
  --text: #1a1d21;
  --text-secondary: #4a525c;
  --accent: #2f6fed;
  --accent-hover: #2560d6;
  --on-accent: #ffffff;
  --danger-subtle: #fdeceb;
  --danger-border: #f1aeaa;
  --danger-text: #b42318;
  --info-subtle: #e8f0fe;
  --info-border: #9dbcf7;
  --info-text: #2459c9;
  --grid-dot: #c4c9d1;
  --focus: #2f6fed;
  --shadow: 0 4px 12px rgba(16, 24, 40, 0.12), 0 1px 3px rgba(16, 24, 40, 0.08);
  color-scheme: light;
}

:root[data-theme='dark'] {
  --surface-app: #111316;
  --surface-panel: #181a1e;
  --surface-sunken: #0e1013;
  --border: #30343a;
  --border-control: #6c747f;
  --text: #e9ecef;
  --text-secondary: #b3bac3;
  --accent: #6b9bff;
  --accent-hover: #86adff;
  --on-accent: #0b1220;
  --danger-subtle: #3a1614;
  --danger-border: #7a2a26;
  --danger-text: #ff9a93;
  --info-subtle: #1a2742;
  --info-border: #3a5c9e;
  --info-text: #8fb4ff;
  --grid-dot: #2c3238;
  --focus: #8fb4ff;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.06);
  color-scheme: dark;
}

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

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--surface-app);
  color: var(--text);
  font-family: 'Inter Variable', Inter, system-ui, 'Segoe UI', sans-serif;
  font-size: 13px;
  line-height: 20px;
  -webkit-font-smoothing: antialiased;
}

/* The drawing grid, faint at the edges and gone behind the card (as the app's account screens). */
body::before {
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, var(--grid-dot) 1px, transparent 1.5px);
  background-size: 20px 20px;
  content: '';
  mask-image: radial-gradient(ellipse 60% 70% at 50% 50%, transparent 35%, black 100%);
  pointer-events: none;
}

.gate {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 48px 16px;
}

.gate-column {
  width: 100%;
  max-width: 400px;
}

.gate-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.gate-mark rect {
  fill: var(--accent);
}

.gate-mark path {
  fill: none;
  stroke: var(--on-accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gate-brand-name {
  font-size: 22px;
  font-weight: 600;
  line-height: 28px;
  letter-spacing: -0.01em;
}

.gate-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-panel);
  box-shadow: var(--shadow);
}

.gate-header,
.gate-form,
.gate-alert {
  margin-right: 32px;
  margin-left: 32px;
}

.gate-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 32px;
  margin-bottom: 24px;
}

.gate-header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  line-height: 28px;
}

.gate-header h1:focus {
  outline: none;
}

.gate-header p {
  margin: 0;
  color: var(--text-secondary);
}

.gate-alert {
  padding: 8px 12px;
  margin-bottom: 16px;
  border: 1px solid var(--danger-border);
  border-radius: 6px;
  background: var(--danger-subtle);
  color: var(--danger-text);
}

.gate-alert[data-tone='info'] {
  border-color: var(--info-border);
  background: var(--info-subtle);
  color: var(--info-text);
}

.gate-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 32px;
}

.gate-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gate-field label {
  font-weight: 500;
}

.gate-field input {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border-control);
  border-radius: 6px;
  background: var(--surface-panel);
  color: var(--text);
  font: inherit;
}

.gate-field input:focus-visible,
.gate-submit:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.gate-field input[aria-invalid='true'] {
  border-color: var(--danger-text);
}

.gate-hint {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 16px;
}

.gate-submit {
  height: 40px;
  margin-top: 8px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.gate-submit:hover {
  background: var(--accent-hover);
}

.gate-submit[aria-busy='true'] {
  cursor: progress;
  opacity: 0.8;
}

.gate-footer {
  padding: 16px 32px;
  border-top: 1px solid var(--border);
  background: var(--surface-sunken);
  color: var(--text-secondary);
}

.gate-footer p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

@media (max-width: 440px) {
  .gate-header,
  .gate-form,
  .gate-alert {
    margin-right: 20px;
    margin-left: 20px;
  }

  .gate-header {
    padding-top: 24px;
  }

  .gate-footer {
    padding: 16px 20px;
  }
}
