/* VeloHR - sign-in pages (login, error pages)
   Middleware console look: slate control-room panel with a routing diagram,
   quiet paper form panel. Amber is reserved for "signal" (moving message, focus). */

:root {
   --slate: #1b2330;
   --slate-2: #253042;
   --slate-line: #3a475c;
   --steel: #8a97ab;
   --mist: #c9d2df;
   --paper: #eef1f5;
   --white: #ffffff;
   --ink: #1b2330;
   --ink-2: #4a5568;
   --muted: #6b7686;
   --line: #d6dce5;
   --signal: #f2a93b;
   --ok: #2f9e6b;
   --error: #c2372f;
   --error-soft: #fdf1f0;
   --ok-soft: #eef8f3;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
   font-family: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
   font-stretch: 100%;
   color: var(--ink);
   background: var(--paper);
   -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); }
[hidden] { display: none !important; }

/* ---------- frame: full-bleed split ---------- */
.auth-page { min-height: 100vh; }
.auth-shell {
   min-height: 100vh;
   display: grid;
   grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
}

/* ---------- control-room side ---------- */
.auth-brand {
   position: relative;
   display: flex;
   flex-direction: column;
   padding: 40px 56px 44px;
   background:
      radial-gradient(ellipse 70% 55% at 50% 45%, rgba(242,169,59,.06), transparent 70%),
      radial-gradient(ellipse 120% 90% at 50% 50%, transparent 55%, rgba(0,0,0,.28) 100%),
      var(--slate);
   color: var(--mist);
   overflow: hidden;
}
/* faint rack grid, like a patch panel */
.auth-brand::before {
   content: "";
   position: absolute;
   inset: 0;
   background-image:
      linear-gradient(to right, rgba(255,255,255,.035) 1px, transparent 1px),
      linear-gradient(to bottom, rgba(255,255,255,.035) 1px, transparent 1px);
   background-size: 32px 32px;
   pointer-events: none;
}
.auth-brand > * { position: relative; }

.auth-wordmark { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand-mark { flex: none; display: block; }
.auth-wordmark__name {
   margin: 0;
   font-size: 26px;
   font-weight: 700;
   font-stretch: 125%;
   letter-spacing: -.01em;
   color: var(--white);
}
.auth-wordmark__desc { margin: 0 0 0 4px; padding-left: 14px; border-left: 1px solid var(--slate-line); font-size: 14px; color: var(--steel); }
.auth-brand__logo { max-height: 40px; max-width: 180px; object-fit: contain; }
.auth-brand__mark { display: none; }

.auth-diagram { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 0; }
.auth-diagram svg { width: 100%; max-width: 600px; height: auto; overflow: visible; }

.rd-node rect { fill: var(--slate-2); stroke: var(--slate-line); }
.rd-node:hover rect { stroke: var(--steel); }
.rd-node text { fill: var(--mist); font: 500 14px "Archivo", system-ui, sans-serif; }
.rd-node .rd-dot { fill: var(--ok); }
.rd-hub rect { fill: #202a3a; stroke: var(--signal); stroke-width: 1.5; }
.rd-hub .rd-bar { fill: var(--signal); }
.rd-hub text { fill: var(--steel); font: 500 13px "Archivo", system-ui, sans-serif; }
.rd-path { fill: none; stroke: var(--steel); stroke-width: 1.4; opacity: .5; }
.rd-pulse { fill: var(--signal); filter: drop-shadow(0 0 6px rgba(242,169,59,.8)); }

/* the one orchestrated moment: routes draw in on load */
.rd-path { stroke-dasharray: 420; stroke-dashoffset: 420; animation: rd-draw 1.1s cubic-bezier(.4, 0, .2, 1) forwards; }
.rd-path:nth-of-type(2) { animation-delay: .08s; }
.rd-path:nth-of-type(3) { animation-delay: .16s; }
.rd-path:nth-of-type(4) { animation-delay: .24s; }
@keyframes rd-draw { to { stroke-dashoffset: 0; } }

.auth-brand__caption { max-width: 40ch; }
.auth-brand__headline {
   margin: 0;
   font-size: clamp(22px, 2.1vw, 30px);
   line-height: 1.2;
   font-weight: 600;
   font-stretch: 112%;
   letter-spacing: -.015em;
   text-wrap: balance;
   color: var(--white);
}
.auth-brand__note { margin: 12px 0 0; font-size: 15px; line-height: 1.55; color: var(--steel); max-width: 44ch; }

/* ---------- form side ---------- */
.auth-panel {
   display: flex;
   flex-direction: column;
   justify-content: center;
   padding: 48px 56px;
   background: var(--white);
}
.auth-panel__inner { width: 100%; max-width: 360px; margin: 0 auto; }
.auth-title { margin: 0; font-size: 28px; line-height: 1.2; font-weight: 600; font-stretch: 112%; letter-spacing: -.015em; }
.auth-subtitle { margin: 8px 0 0; font-size: 15px; line-height: 1.5; color: var(--muted); }

.auth-form { margin-top: 32px; display: grid; gap: 20px; }
.auth-field label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 600; color: var(--ink); }
.auth-input-wrap { position: relative; }
.auth-input-wrap > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.auth-input {
   width: 100%;
   height: 48px;
   padding: 0 46px 0 42px;
   border: 1px solid var(--line);
   border-radius: 6px;
   background: var(--white);
   color: var(--ink);
   font: inherit;
   font-size: 15px;
   transition: border-color .15s, box-shadow .15s;
}
.auth-input::placeholder { color: #9aa4b2; }
.auth-input:hover { border-color: #b8c1ce; }
.auth-input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(242, 169, 59, .45); }
.auth-input.is-invalid { border-color: var(--error); }
.auth-input.is-invalid:focus { box-shadow: 0 0 0 3px rgba(194, 55, 47, .2); }
.auth-toggle {
   position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
   width: 36px; height: 36px; border: 0; border-radius: 4px;
   background: transparent; color: var(--muted); cursor: pointer;
   display: inline-flex; align-items: center; justify-content: center;
}
.auth-toggle:hover { color: var(--ink); background: var(--paper); }
.auth-toggle:focus-visible { outline: 2px solid var(--signal); outline-offset: 1px; }
.auth-error { margin: 6px 0 0; font-size: 13px; color: var(--error); }

.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; }
.auth-check { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); cursor: pointer; user-select: none; }
.auth-check input { width: 16px; height: 16px; accent-color: var(--slate); margin: 0; }

.auth-submit {
   display: inline-flex; align-items: center; justify-content: center;
   width: 100%; height: 48px; padding: 0 20px;
   border: 0; border-radius: 6px;
   background: var(--slate); color: var(--white);
   font: inherit; font-size: 15px; font-weight: 600;
   text-decoration: none;
   cursor: pointer;
   transition: background-color .15s;
}
.auth-submit:hover { background: #2c384b; }
.auth-submit:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
.auth-submit[disabled] { opacity: .85; cursor: progress; }
.auth-submit.is-loading::before { content: ""; width: 16px; height: 16px; margin-right: 10px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: auth-spin .7s linear infinite; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

.auth-alert { margin-top: 24px; padding: 12px 14px; border-radius: 6px; font-size: 14px; line-height: 1.45; display: flex; gap: 10px; align-items: flex-start; }
.auth-alert--error { background: var(--error-soft); color: var(--error); }
.auth-alert--success { background: var(--ok-soft); color: #1f6e4a; }
.auth-alert svg { flex: none; margin-top: 2px; }

.auth-footer { margin: 40px 0 0; font-size: 13px; color: var(--muted); }

/* ---------- error pages (404) ---------- */
.err-code {
   margin: 0 0 8px;
   font-size: 64px;
   line-height: 1;
   font-weight: 700;
   font-stretch: 125%;
   letter-spacing: -.02em;
   color: var(--slate);
}
.err-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 28px; }
.err-back {
   display: inline-flex; align-items: center; justify-content: center;
   width: 100%; height: 48px; padding: 0 20px;
   border: 1px solid var(--line); border-radius: 6px;
   background: var(--white); color: var(--ink);
   font: inherit; font-size: 15px; font-weight: 600;
   cursor: pointer;
}
.err-back:hover { border-color: var(--ink); }
.err-back:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }

/* ---------- small screens: brand becomes a header band ---------- */
@media (max-width: 900px) {
   .auth-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
   .auth-brand { padding: 20px 20px; }
   .auth-diagram, .auth-brand__caption { display: none; }
   .auth-wordmark__name { font-size: 22px; }
   .auth-wordmark__desc { display: none; }
   .auth-panel { justify-content: flex-start; padding: 36px 20px 32px; }
}

@media (prefers-reduced-motion: reduce) {
   .rd-path { animation: none; stroke-dashoffset: 0; }
   .auth-submit.is-loading::before { animation-duration: 2s; }
}

/* ---------- 403: access restricted ---------- */
.sec-path { fill: none; stroke: var(--steel); stroke-width: 1.6; opacity: .65; }
.sec-path--blocked { stroke-dasharray: 5 6; opacity: .4; }
.sec-node rect:first-child { fill: var(--slate-2); stroke: var(--slate-line); }
.sec-node text { fill: var(--mist); font: 600 14px "Archivo", system-ui, sans-serif; }
.sec-node .sec-node__sub { fill: var(--steel); font: 400 12px "Archivo", system-ui, sans-serif; }
.sec-node__ic { fill: none; stroke: var(--mist); stroke-width: 1.6; }
.sec-node__ic-line { fill: none; stroke: var(--mist); stroke-width: 1.6; stroke-linecap: round; }
.sec-node__doc { fill: none; stroke: var(--steel); stroke-width: 1.6; }
.sec-node--locked rect:first-child { fill: #1f2836; stroke: #323d4f; }
.sec-node--locked text { fill: var(--steel); }
.sec-node--locked .sec-node__ic-line { stroke: var(--steel); }
.sec-shield__body { fill: #202a3a; stroke: var(--signal); stroke-width: 2; }
.sec-shield__lock { fill: var(--signal); }
.sec-shield__shackle { fill: none; stroke: var(--signal); stroke-width: 3.5; stroke-linecap: round; }
.sec-shield__hole { fill: #1b2330; stroke: #1b2330; stroke-width: 2.4; stroke-linecap: round; }
.sec-label { fill: var(--steel); font: 500 13px "Archivo", system-ui, sans-serif; }
.sec-denied rect { fill: rgba(217, 45, 32, .16); stroke: rgba(240, 68, 56, .55); }
.sec-denied text { fill: #ff8a80; font: 600 12.5px "Archivo", system-ui, sans-serif; }
.sec-pulse { fill: var(--signal); filter: drop-shadow(0 0 6px rgba(242,169,59,.85)); }
.sec-shield { transform-origin: 280px 142px; animation: sec-hit .5s ease-out 1.55s 1 both; }
@keyframes sec-hit { 0% { transform: scale(1); } 35% { transform: scale(1.06); } 100% { transform: scale(1); } }
.sec-denied { opacity: 0; animation: sec-show .4s ease-out 1.7s 1 forwards; }
@keyframes sec-show { to { opacity: 1; } }

.sec-badge { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 6px 12px 6px 8px; border-radius: 999px; background: #fef1f0; color: var(--error); font-size: 13px; font-weight: 600; }
.sec-badge svg { flex: none; }
.sec-facts { margin: 24px 0 0; padding: 14px 16px; display: grid; gap: 10px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.sec-facts div { display: grid; grid-template-columns: 104px 1fr; gap: 12px; font-size: 14px; }
.sec-facts dt { color: var(--muted); }
.sec-facts dd { margin: 0; color: var(--ink); font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.sec-facts code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; padding: 1px 6px; border-radius: 4px; background: #eef1f5; }
.sec-help { display: flex; gap: 10px; margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: #fef4e4; color: #7a4d0b; font-size: 14px; line-height: 1.5; }
.sec-help svg { flex: none; margin-top: 2px; }
.sec-help p { margin: 0; }
.sec-switch { margin: 0; text-align: center; }
.sec-switch__btn { border: 0; background: none; padding: 6px; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.sec-switch__btn:hover { color: var(--ink); }
.sec-switch__btn:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
   .sec-shield, .sec-denied { animation: none; opacity: 1; }
}
