/* ServiceForge platform sign-in (D-052). Static and self-contained: served before the gate opens, so it may not
   depend on the SPA bundle. Malomatia brand tokens mirror apps/web/src/index.css. */
@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 400;
  font-display: swap;
  src: url('/login/fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 600;
  font-display: swap;
  src: url('/login/fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Bitter';
  font-weight: 500;
  font-display: swap;
  src: url('/login/fonts/bitter-latin-500-normal.woff2') format('woff2');
}

:root {
  --red: #cf0a2c;
  --red-ink: #b00824;
  --graphite: #231f20;
  --graphite-2: #2e292a;
  --metallic: #777575;
  --cool-grey: #a7a9ac;
  --surface: #f5f4f4;
  --raised: #ffffff;
  --sunken: #ebe9e9;
  --ink: #231f20;
  --ink-muted: #5c5859;
  --ink-subtle: #6e6a6b;
  --line: #dcd9d9;
  --focus: rgba(207, 10, 44, 0.28);
  --ok: #1f7a4d;
  --sans: 'IBM Plex Sans', ui-sans-serif, system-ui, 'Segoe UI', Roboto, Arial, sans-serif;
  --display: 'Bitter', Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }

.shell { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }

/* ---------------- brand panel */
.brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 56px;
  background: var(--graphite);
  color: #fff;
}
.brand::before { /* the red rule */
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--red);
}
.arcs {
  position: absolute;
  right: -120px;
  bottom: -90px;
  width: 620px;
  height: 548px;
  background: url('/brand/malomatia-arcs.svg') no-repeat center / contain;
  opacity: 0.14;
  pointer-events: none;
}
.brand-logo { position: relative; width: 150px; height: auto; user-select: none; }
.brand-copy { position: relative; max-width: 30rem; }
.overline {
  margin: 0 0 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cool-grey);
}
.display {
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2rem, 3.2vw, 2.9rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
}
.accent { color: var(--red); }
.brand .accent { color: #ff4d67; }
.lede { margin: 20px 0 0; font-size: 15px; line-height: 1.6; color: #cfcccc; max-width: 26rem; }
.brand-foot { position: relative; margin: 0; font-size: 12px; color: var(--metallic); letter-spacing: 0.02em; }

/* ---------------- sign-in panel */
.panel { min-width: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 48px 24px 24px; }
.panel-inner { width: 100%; max-width: 400px; }
.mobile-logo { display: none; height: 40px; width: auto; margin-bottom: 28px; }

.band {
  display: flex;
  align-items: center;
  min-height: 40px;
  margin: 0 -24px 28px 0;
  padding: 0 24px 0 16px;
  background: var(--red);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
.title {
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: 2rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.subtitle { margin: 8px 0 24px; color: var(--ink-muted); font-size: 14px; line-height: 1.5; }

.alert {
  margin: 0 0 18px;
  padding: 10px 12px;
  border: 1px solid rgba(207, 10, 44, 0.35);
  border-left: 3px solid var(--red);
  background: #fdf0f2;
  color: #7a0a1d;
  font-size: 13px;
  line-height: 1.45;
  border-radius: 4px;
}

.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 13px; font-weight: 600; color: var(--ink); }
.hint { font-size: 12px; color: var(--ink-subtle); line-height: 1.45; }

input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:hover { border-color: var(--cool-grey); }
input:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--focus); }
input.code {
  height: 56px;
  font-size: 26px;
  letter-spacing: 0.5em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  padding-left: 0.5em;
}

.password-wrap { position: relative; display: block; }
.password-wrap input { padding-right: 64px; }
.reveal {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  height: 32px;
  padding: 0 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}
.reveal:hover { background: var(--sunken); color: var(--ink); }
.reveal:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 46px;
  margin-top: 4px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--red);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.primary:hover { background: var(--red-ink); }
.primary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.primary:disabled { opacity: 0.7; cursor: progress; }
.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.primary.busy .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.link {
  align-self: center;
  padding: 6px 8px;
  font: inherit;
  font-size: 13px;
  color: var(--ink-muted);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link:hover { color: var(--ink); }

.secure-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 28px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-subtle);
}
.secure-note svg { color: var(--ok); flex: none; }

.foot { margin-top: auto; padding-top: 40px; font-size: 12px; color: var(--ink-subtle); }
.foot strong { color: var(--ink); font-weight: 600; }

/* ---------------- small screens */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .brand { display: none; }
  .panel { justify-content: flex-start; padding: 40px 16px 20px; border-top: 4px solid var(--red); }
  .mobile-logo { display: block; }
  .band { margin-right: -16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: 1.5s !important; }
}
