/* Kairos One sign-in — a single LIVE sign-in surface (no Demo/Sandbox tabs,
   SSO buttons, or demo modals).
   Brand-panel visual styles (.login-brand-panel*) + .pointer-btn + .section-eyebrow
   come from landing.css; this file adds the 2-column layout, the signal card, the
   auth alert, and the form styling. */

/* ---- Page layout (replaces the Tailwind min-h-screen/flex/w-1/2/lg:flex utils) ---- */
.login-page {
  position: relative;
  display: flex;
  min-height: 100vh;
  width: 100%;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-body);
}

.login-wordmark {
  position: absolute;
  top: 1rem;
  left: clamp(1rem, 2vw, 1.5rem);
  z-index: 30;
  text-decoration: none;
  transition: opacity 160ms ease;
}
.login-wordmark:hover { opacity: 0.82; }

/* Brand panel is hidden on small screens; a centered half-width column on desktop. */
.klogin-brand { display: none; }
.klogin-form-panel {
  display: flex;
  width: 100%;
  flex-direction: column;
  justify-content: center;
  padding: 2rem clamp(1.5rem, 4vw, 4rem);
  overflow-y: auto;
}
.klogin-form-inner {
  width: 100%;
  max-width: 24rem;
  margin: 0 auto;
}

@media (min-width: 1024px) {
  .klogin-brand {
    display: flex;
    width: 50%;
    flex-direction: column;
    justify-content: center;
  }
  .klogin-form-panel { width: 50%; }
}

/* ---- Auth status banner (generic copy; never reveal which field was wrong) ---- */
.login-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-bottom: 1.25rem;
  padding: 0.7rem 0.85rem;
  border-radius: 0.55rem;
  font-size: 0.8125rem;
  line-height: 1.45;
}
.login-alert--error { background: var(--destructive-soft, color-mix(in srgb, var(--destructive) 12%, transparent)); color: var(--destructive); }
.login-alert__icon { flex-shrink: 0; width: 1rem; height: 1rem; margin-top: 0.05rem; }
/* Variant class picks the icon (hidden attr doesn't apply to SVG-namespace elements). */
.login-alert--error .login-alert__icon--success,
.login-alert--success .login-alert__icon--error { display: none; }
/* display:flex would defeat the hidden attribute - make hidden win. */
.login-alert[hidden] { display: none; }
.login-alert--success { background: var(--success-soft, color-mix(in srgb, var(--success) 12%, transparent)); color: var(--success); }

/* ---- Form ---- */
.klogin-head { margin-bottom: 1.5rem; }
.klogin-head__eyebrow { font-size: 0.875rem; color: var(--muted-foreground); margin: 0 0 0.25rem; }
.klogin-head__title { font-size: 1.5rem; font-weight: 600; color: var(--foreground); margin: 0; }

.klogin-form { display: flex; flex-direction: column; gap: 1.25rem; }
.klogin-field { display: flex; flex-direction: column; }
.klogin-label { font-size: 0.875rem; color: var(--foreground); margin-bottom: 0.375rem; }

.klogin-input-wrap {
  display: flex;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.klogin-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
.klogin-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  color: var(--foreground);
  font-family: inherit;
}
.klogin-input::placeholder { color: var(--muted-foreground); }
/* The wrap paints its own focus ring (border + soft shadow via :focus-within), so
   suppress the global a11y outline on the inner input - the bespoke focus styling
   wins and keyboard users still get a clear indicator on the wrap. */
.klogin-input:focus-visible { outline: none; }
.klogin-input-icon { padding-left: 0.85rem; color: var(--muted-foreground); font-size: 1rem; display: flex; }
.klogin-toggle {
  align-self: stretch;
  padding: 0 0.85rem;
  background: transparent;
  border: none;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: color 140ms ease;
}
.klogin-toggle:hover { color: var(--foreground); }

.klogin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem; /* sits below the input (Tailwind mt-2 in the original design) */
}
.klogin-remember { display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer; font-size: 0.875rem; color: var(--muted-foreground); }
.klogin-remember input { accent-color: var(--primary); }
.klogin-inline-link {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  transition: color 140ms ease;
}
.klogin-inline-link:hover { color: var(--foreground); }

.klogin-submit {
  width: 100%;
  margin-top: 0.25rem;
  border: none;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 0.7rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 140ms ease;
}
.klogin-submit:hover:not(:disabled) { opacity: 0.9; }
.klogin-submit:disabled { opacity: 0.7; cursor: not-allowed; }

.klogin-footnote {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--muted-foreground);
}
.klogin-footnote a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.klogin-footnote a:hover { opacity: 0.8; }

/* ===========================================================================
   Live signal card — analytics micro-demo on the brand panel. Pure CSS/SVG,
   decorative. Freezes to the "detected" resting state under prefers-reduced-motion.
   =========================================================================== */
.signal-card {
  margin-top: 2.1rem;
  padding: 1.1rem 1.2rem 1.2rem;
  border: 1px solid rgba(7, 26, 47, 0.1);
  border-radius: 1rem;
  background: linear-gradient(180deg, #ffffff, #fbfaf8);
  box-shadow: 0 18px 40px -28px rgba(7, 26, 47, 0.35);
}
.signal-card__head { display: flex; align-items: center; gap: 0.5rem; font-size: 0.78rem; color: rgba(7, 26, 47, 0.7); }
.signal-card__dot { width: 0.5rem; height: 0.5rem; border-radius: 999px; background: #5fd0a3; box-shadow: 0 0 0 0 rgba(95, 208, 163, 0.55); animation: signal-pulse 2.4s ease-out infinite; }
.signal-card__label { font-weight: 600; }
.signal-card__live { margin-left: auto; text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.62rem; font-weight: 700; color: rgba(7, 26, 47, 0.55); }
.signal-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; margin-top: 0.95rem; }
.signal-kpi { display: flex; flex-direction: column; gap: 0.08rem; padding: 0.55rem 0.6rem; border: 1px solid rgba(7, 26, 47, 0.08); border-radius: 0.6rem; background: rgba(7, 26, 47, 0.03); }
.signal-kpi__value { font-size: 1.05rem; font-weight: 700; line-height: 1.1; color: #071a2f; }
.signal-kpi__label { font-size: 0.66rem; color: rgba(7, 26, 47, 0.6); }
.signal-kpi__delta { margin-top: 0.15rem; font-size: 0.66rem; font-weight: 700; color: #b45309; }
.signal-chart { margin-top: 0.7rem; padding: 0.55rem 0.45rem 0.35rem; border-radius: 0.6rem; background: rgba(7, 26, 47, 0.03); }
.signal-chart__svg { display: block; width: 100%; height: auto; }
.signal-chart__threshold { stroke: rgba(7, 26, 47, 0.2); stroke-width: 1; stroke-dasharray: 4 5; }
.signal-chart__area { fill: rgba(249, 115, 22, 0.14); opacity: 0; animation: signal-fade 0.8s ease 0.4s both; }
.signal-chart__line { fill: none; stroke: #f97316; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 380; stroke-dashoffset: 380; animation: signal-draw 1.5s ease 0.3s both; }
.signal-chart__marker { fill: #f97316; opacity: 0; animation: signal-marker-pop 0.4s ease 1.6s both; }
.signal-chart__pulse { fill: none; stroke: rgba(249, 115, 22, 0.6); stroke-width: 1.5; transform-box: fill-box; transform-origin: center; opacity: 0; animation: signal-ping 2.4s ease-out 1.8s infinite; }
.signal-card__alert { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.85rem; opacity: 0; transform: translateY(4px); animation: signal-reveal 0.6s ease 1.7s both; }
.signal-card__alert-chip { flex: 0 0 auto; padding: 0.2rem 0.55rem; border: 1px solid rgba(249, 115, 22, 0.4); border-radius: 999px; background: rgba(249, 115, 22, 0.12); color: #b45309; font-size: 0.72rem; font-weight: 700; }
.signal-card__alert-text { font-size: 0.78rem; color: rgba(7, 26, 47, 0.65); }
.signal-card__action { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid rgba(7, 26, 47, 0.1); font-size: 0.82rem; color: rgba(7, 26, 47, 0.82); }
.signal-card__action-icon { flex: 0 0 auto; color: #1d5d8f; width: 1.1rem; height: 1.1rem; }
.signal-insight { display: flex; align-items: center; gap: 0.6rem; min-height: 1.4rem; margin-top: 1.4rem; color: rgba(7, 26, 47, 0.7); font-size: 0.9rem; line-height: 1.4; }
.signal-insight__key { flex: 0 0 auto; width: 1.5rem; height: 2px; border-radius: 999px; background: rgba(29, 93, 143, 0.9); }

@keyframes signal-draw { from { stroke-dashoffset: 380; } to { stroke-dashoffset: 0; } }
@keyframes signal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes signal-marker-pop { from { opacity: 0; } to { opacity: 1; } }
@keyframes signal-ping { 0% { transform: scale(0.6); opacity: 0.7; } 70%, 100% { transform: scale(2.6); opacity: 0; } }
@keyframes signal-reveal { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes signal-pulse { 0% { box-shadow: 0 0 0 0 rgba(95, 208, 163, 0.55); } 70%, 100% { box-shadow: 0 0 0 0.5rem rgba(95, 208, 163, 0); } }

@media (prefers-reduced-motion: reduce) {
  .signal-card__dot, .signal-chart__area, .signal-chart__line, .signal-chart__marker, .signal-chart__pulse, .signal-card__alert { animation: none; }
  .signal-chart__area, .signal-chart__marker { opacity: 1; }
  .signal-chart__line { stroke-dashoffset: 0; }
  .signal-chart__pulse { display: none; }
  .signal-card__alert { opacity: 1; transform: none; }
}
