/* LumiPuhu authentication screens (sign-in, password reset) — static,
   hand-authored CSS, same approach as public/dashboard.css: no asset
   pipeline exists in this app (see backend/.claude/CLAUDE.md, "Web
   frontend"), so this is served directly from public/ rather than built.
   Palette/spacing lifted from design/claude-design/"LumiPuhu Admin - W0
   Login and Access.dc.html".

   Full-viewport fix: the previous layout had no height reset at all, so the
   default 8px body margin plus the layout's own bare flash <p> tags (now
   removed, see app/views/shared/_flash.html.erb) could push the page taller
   than one viewport — showing a white frame to the right/below and forcing
   a scrollbar. `100dvh` (with a `100vh` fallback for older engines) is used
   instead of a plain `100vh` so mobile browser chrome resizing the visual
   viewport doesn't itself cause a scrollbar. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: -apple-system, "Inter", "Segoe UI", sans-serif;
  color: #1e2338;
}

a { color: #5f6fd4; text-decoration: none; }
a:hover { color: #4a58b8; }

@keyframes lumipuhu-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }

/* Flash — replaces the old bare `<p style="color:...">` above the page.
   See app/views/shared/_flash.html.erb; the "you need to sign in" reason is
   suppressed entirely (CustomFailureApp), everything else renders here. */
.auth-flash {
  display: flex; align-items: flex-start; gap: 10px;
  border-radius: 10px; padding: 12px 14px; font-size: 13px; line-height: 1.5;
  margin-bottom: 16px;
}
.auth-flash__icon {
  flex-shrink: 0; width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 900; color: #fff;
}
.auth-flash--notice { background: #e7f5f0; color: #1f6a56; }
.auth-flash--notice .auth-flash__icon { background: #3d8571; }
.auth-flash--alert { background: #fdf9f7; color: #b0472f; border: 1px solid #f0c6ba; }
.auth-flash--alert .auth-flash__icon { background: #e8705a; }
/* Layout-level fallback placement (unstyled Devise default views only —
   see application.html.erb) gets a bit of breathing room since it has no
   card to sit inside. */
body.auth-page > .auth-flash { max-width: 560px; margin: 20px auto 0; }

/* ===== L1 — sign in (two-column split) ===== */
.auth-shell { display: flex; min-height: 100vh; min-height: 100dvh; }

.auth-panel-brand {
  flex: 0 0 42%; max-width: 592px; position: relative; overflow: hidden;
  display: flex; flex-direction: column; padding: 52px 54px;
  /* The iOS app's night-sky gradient (LivingBackground.swift), top to
     bottom, so the panel reads as the same sky the phone shows. */
  background: linear-gradient(180deg, #232752 0%, #1d2145 40%, #181c3a 70%, #141733 100%);
  color: #fff;
}

/* ===== Living sky =====
   Pure-CSS port of ios/LumiPuhu/Components/LivingBackground.swift; the
   per-sprite numbers (position, size, period, phase) come inline from
   app/views/shared/_auth_sky.html.erb, which carries the Swift layout
   table. Only the shapes, colours and motion recipes live here.

   Every sprite is absolutely positioned by its centre: `left`/`top` name
   the centre point and the `translate` property pulls the box back by
   half its size. `translate` is kept separate from `transform` on purpose
   — the twinkle/drift keyframes own `transform`, and the two compose
   (translate first, then the keyframe's scale/offset) without fighting. */
.auth-sky {
  position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
}
.auth-sky__halo, .auth-sky__star, .auth-sky__firefly {
  position: absolute; display: block; translate: -50% -50%; will-change: transform, opacity;
}

/* Two breathing halos: cool moonlight centred 140px above the top edge,
   warm floor glow centred 160px below the bottom edge. Each gradient runs
   to the shape's own radius (190 / 230) — the floor one is a 230px circle
   clipped to its 460x340 ellipse, exactly as the Swift RadialGradient +
   Ellipse pair renders. One "leg" of the CSS animation is half the design
   period since `alternate` plays it out and back (7s → 3.5s, 9s → 4.5s). */
.auth-sky__halo {
  left: 50%; border-radius: 50%; opacity: .35;
  animation: auth-sky-breath 3.5s ease-in-out infinite alternate;
}
.auth-sky__halo--moon {
  top: -140px; width: 380px; height: 380px;
  background: radial-gradient(190px circle, rgba(139,155,245,.16), transparent);
}
.auth-sky__halo--floor {
  top: auto; bottom: -160px; translate: -50% 50%; width: 460px; height: 340px;
  background: radial-gradient(230px circle, rgba(255,190,100,.09), transparent);
  animation-duration: 4.5s; animation-delay: 2s;
}
@keyframes auth-sky-breath {
  from { opacity: .35; transform: translateY(0) scale(1); }
  to   { opacity: .6;  transform: translateY(-14px) scale(1.06); }
}

/* Twelve stars in two brightness classes. The colour rides on
   `currentColor` so one inline `color` serves both the dot's background
   and the sparkle's fill. A cycle starts at the floor, peaks halfway and
   eases both ways — the cosine breath of LivingBackgroundLayout.swift. */
.auth-sky__star {
  border-radius: 50%; background: currentColor; opacity: .1;
  animation: auth-sky-twinkle-soft 4s ease-in-out infinite;
}
.auth-sky__star--bright { opacity: .15; animation-name: auth-sky-twinkle-bright; }
/* The four-point sparkle: the design's 18-unit path, scaled by the SVG
   viewBox to the 10px box the layout gives it. */
.auth-sky__sparkle { border-radius: 0; background: none; fill: currentColor; opacity: .15; animation-name: auth-sky-twinkle-bright; overflow: visible; }
@keyframes auth-sky-twinkle-soft {
  0%, 100% { opacity: .1; }
  50%      { opacity: .55; }
}
@keyframes auth-sky-twinkle-bright {
  0%, 100% { opacity: .15; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.25); }
}

/* Four fireflies: the mote is the element itself (diameter `--d`, set
   inline), the halo (3.2x the mote, #ffd278 at 18%) a solid box-shadow
   ring with spread (3.2d − d) / 2 = 1.1d — the Swift Canvas fills a flat
   disc too, no gradient. The element's opacity carries the glow (.25…1),
   so the halo's 18% and the mote's 100% both scale with it as in the app.
   Two animations per element — drift on `transform`, glow on `opacity` —
   with the inline duration/delay lists pairing up by index. */
.auth-sky__firefly {
  width: var(--d); height: var(--d); border-radius: 50%; background: #ffd98a; opacity: .25;
  box-shadow: 0 0 0 calc(var(--d) * 1.1) rgba(255,210,120,.18);
  animation: auth-sky-drift 12s ease-in-out infinite, auth-sky-glow 3s ease-in-out infinite;
}
@keyframes auth-sky-drift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(14px, -20px); }
  50%  { transform: translate(-8px, -34px); }
  75%  { transform: translate(-18px, -12px); }
  100% { transform: translate(0, 0); }
}
@keyframes auth-sky-glow {
  0%, 100% { opacity: .25; }
  50%      { opacity: 1; }
}

.auth-brand-row { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.auth-brand-row__text { display: flex; flex-direction: column; }
.auth-brand-row__name { color: #fff; font-size: 17px; font-weight: 700; }
.auth-brand-row__tag { color: #7b84a8; font-size: 11px; font-weight: 600; letter-spacing: .4px; }

.auth-panel-brand__content {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  gap: 26px; position: relative; z-index: 1; min-height: 0;
}
.auth-hero-row { display: flex; align-items: flex-end; gap: 22px; margin-bottom: 6px; }
.auth-character--lumi { display: inline-flex; animation: lumipuhu-float 3.6s ease-in-out infinite; }
.auth-character--puhu { display: inline-flex; }

.auth-brand-heading { display: flex; flex-direction: column; gap: 14px; max-width: 420px; }
.auth-brand-heading__title { color: #fff; font-size: 34px; font-weight: 800; line-height: 1.22; letter-spacing: -.7px; margin: 0; }
.auth-brand-heading__desc { color: #a4abc7; font-size: 15px; line-height: 1.65; }

.auth-checklist { display: flex; flex-direction: column; gap: 12px; max-width: 420px; margin-top: 6px; padding: 0; list-style: none; }
.auth-checklist li { display: flex; align-items: center; gap: 12px; }
.auth-checklist__icon {
  width: 24px; height: 24px; border-radius: 7px; background: rgba(87,166,143,.2);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  color: #7fc7b2; font-size: 11px; font-weight: 800;
}
.auth-checklist span:last-child { color: #c9d0e8; font-size: 13.5px; font-weight: 500; }

.auth-panel-brand__footer { display: flex; align-items: center; gap: 18px; position: relative; z-index: 1; }
.auth-panel-brand__footer span { color: #a4abc7; font-size: 12px; }
.auth-panel-brand__footer span.auth-dot { color: #4d5677; }

.auth-panel-form { flex: 1; display: flex; flex-direction: column; padding: 52px 56px; background: #fff; min-width: 0; overflow-y: auto; }
.auth-panel-form__top { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.auth-signup-link { border: 1px solid #e4e7f0; border-radius: 9px; padding: 8px 15px; color: #3b4260; font-size: 13px; font-weight: 600; }
.auth-panel-form__divider { width: 1px; height: 22px; background: #e4e7f0; }
.auth-locale { display: flex; align-items: center; gap: 8px; color: #1e2338; font-size: 13px; font-weight: 600; }
.auth-locale span { color: #8d95b2; font-size: 10px; }
.auth-locale .locale-option-form { display: inline; }
.auth-locale .locale-option { background: none; border: 0; padding: 0; margin: 0; font: inherit; font-weight: 600; color: #8d95b2; cursor: pointer; }
.auth-locale .locale-option:hover { color: #3b4260; text-decoration: underline; }
.auth-locale .is-current { color: #1e2338; }

.auth-form-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 420px; width: 100%; margin: 0 auto; gap: 22px; min-height: 0; }
.auth-form-heading { display: flex; flex-direction: column; gap: 7px; }
.auth-form-heading__title { color: #1e2338; font-size: 27px; font-weight: 800; letter-spacing: -.5px; margin: 0; }
.auth-form-heading__sub { color: #6b7390; font-size: 14px; }

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-field { display: flex; flex-direction: column; gap: 7px; }
.auth-field label { color: #4b5473; font-size: 12.5px; font-weight: 600; }
.auth-field__row { display: flex; align-items: center; }
.auth-field__row label { flex: 1; }
.auth-field__link { color: #5f6fd4; font-size: 12.5px; font-weight: 600; }
.auth-field__control {
  border: 1px solid #dfe3ee; border-radius: 10px; padding: 2px 14px; background: #fff;
}
.auth-field__control--focus { border: 1.6px solid #5f6fd4; box-shadow: 0 0 0 3px rgba(95,111,212,.12); }
.auth-field__control--error { border: 1px solid #f0c6ba; background: #fdf9f7; }
.auth-field__control input {
  width: 100%; border: 0; outline: 0; padding: 10px 0; font-size: 14px; color: #1e2338; background: transparent;
}
.auth-field__control input[type="password"] { font-size: 16px; letter-spacing: 3px; }
.auth-field__hint { color: #8d95b2; font-size: 12px; }
.auth-field__error { display: flex; align-items: center; gap: 7px; }
.auth-field__error-icon {
  width: 15px; height: 15px; border-radius: 50%; background: #e8705a; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 9.5px; font-weight: 900;
}
.auth-field__error-text { color: #b0472f; font-size: 12px; font-weight: 500; }

.auth-remember { display: flex; align-items: center; gap: 10px; }
.auth-remember input { width: 17px; height: 17px; accent-color: #5f6fd4; }
.auth-remember label { color: #4b5473; font-size: 13px; }

.auth-submit {
  background: #5f6fd4; border: 0; border-radius: 10px; padding: 14px; text-align: center;
  box-shadow: 0 8px 22px rgba(95,111,212,.26); color: #fff; font-size: 14.5px; font-weight: 600; cursor: pointer; width: 100%;
}
.auth-submit--amber { background: #c98f2e; color: #3a2c10; box-shadow: none; font-weight: 700; }
.auth-submit--dark { background: #171c33; }

.auth-note { background: #f7f5fd; border: 1px solid #e6e1f6; border-radius: 10px; padding: 13px 15px; display: flex; gap: 11px; align-items: flex-start; }
.auth-note span { color: #6a5f9c; font-size: 12px; line-height: 1.55; }

/* ===== L4 — password reset (topbar + centered card) ===== */
.auth-page-plain { min-height: 100vh; min-height: 100dvh; background: #f6f7fb; display: flex; flex-direction: column; }

.auth-topbar { height: 66px; background: #fff; border-bottom: 1px solid #e4e7f0; display: flex; align-items: center; padding: 0 32px; gap: 12px; }
.auth-topbar__name { color: #1e2338; font-size: 16px; font-weight: 700; }
.auth-topbar__spacer { flex: 1; }
.auth-topbar__link { color: #5f6fd4; font-size: 13px; font-weight: 600; }

.auth-center {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 20px;
  gap: 26px; flex-wrap: wrap;
}
.auth-card { width: 436px; max-width: 100%; background: #fff; border: 1px solid #e4e7f0; border-radius: 14px; padding: 34px; display: flex; flex-direction: column; gap: 22px; }
.auth-card__icon { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.auth-card__icon--amber { background: #fdf3e3; }
.auth-card__icon--teal { background: #e7f5f0; }
.auth-card__heading { display: flex; flex-direction: column; gap: 7px; }
.auth-card__heading h1 { color: #1e2338; font-size: 22px; font-weight: 800; letter-spacing: -.4px; margin: 0; }
.auth-card__heading p { color: #6b7390; font-size: 13.5px; line-height: 1.6; margin: 0; }
.auth-card__caption { color: #8d95b2; font-size: 12px; line-height: 1.55; text-align: center; margin: 0; }

.auth-hint-box { background: #fafbfe; border: 1px solid #eef0f7; border-radius: 11px; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.auth-hint-box__title { color: #4b5473; font-size: 12px; font-weight: 700; letter-spacing: .4px; }
.auth-hint-box__row { display: flex; align-items: flex-start; gap: 10px; }
.auth-hint-box__num { color: #8d95b2; font-size: 12px; font-weight: 800; flex-shrink: 0; }
.auth-hint-box__row span:last-child { color: #6b7390; font-size: 12.5px; line-height: 1.55; }

.auth-actions-row { display: flex; gap: 10px; }
.auth-actions-row form, .auth-actions-row a { flex: 1; }
.auth-actions-row .auth-submit, .auth-actions-row a {
  width: 100%; border-radius: 10px; padding: 12px; text-align: center; font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.auth-actions-row a { background: #171c33; color: #fff; display: block; }
.auth-actions-row .auth-submit--outline { background: #fff; border: 1px solid #e4e7f0; color: #4b5473; box-shadow: none; }

/* ===== Narrow windows ===== */
/* Below ~900px the two-column split has no room to hold its proportions —
   the brand panel would crush the form. Stacking is the deliberate choice:
   the brand panel becomes a compact header instead of a full-height pane
   (hero characters and the KVKK checklist drop, since they're reinforcing
   flourish, not information the form needs), and the page is allowed to
   scroll normally below this width — the "no vertical scroll" requirement
   only holds at the desktop widths (1280/1440/1920) the design targets. */
@media (max-width: 900px) {
  .auth-shell { flex-direction: column; min-height: 0; }
  .auth-panel-brand { flex: none; max-width: none; width: 100%; padding: 28px 24px; }
  .auth-hero-row, .auth-checklist, .auth-panel-brand__footer { display: none; }
  .auth-panel-brand__content { gap: 14px; }
  .auth-brand-heading__title { font-size: 24px; }
  .auth-panel-form { padding: 32px 24px; }
  .auth-form-wrap { margin: 0; max-width: none; }
}

/* Short viewports (e.g. 1280x720): trim vertical rhythm so the existing
   1440x900 composition fits one screen instead of scrolling — content and
   copy are unchanged, only spacing/scale. */
@media (max-height: 760px) {
  .auth-panel-brand, .auth-panel-form { padding-top: 30px; padding-bottom: 30px; }
  .auth-panel-brand__content { gap: 16px; }
  .auth-hero-row { margin-bottom: 0; gap: 16px; }
  /* CSS `width`/`height` on an <svg> take priority over its own width/height
     attributes, so this reliably overrides the size the partial rendered
     server-side (see app/views/shared/_lumi.html.erb, _puhu.html.erb) —
     unlike a percentage, which can't resolve against a shrink-to-fit
     parent. Absolute px, scaled ~25% down from each partial's default,
     aspect ratio preserved (92:112 for Lumi, 88:104 for Puhu). */
  .auth-character--lumi svg { width: 58px; height: 48px; }
  .auth-character--puhu svg { width: 50px; height: 59px; }
  .auth-brand-heading__title { font-size: 26px; }
  .auth-brand-heading { gap: 8px; }
  .auth-checklist { gap: 8px; margin-top: 0; }
  .auth-form-wrap { gap: 14px; }
  .auth-form { gap: 11px; }

  /* L4 (password reset) cards — the "sent" state in particular (icon +
     heading + hint box + action row + footnote) is tall enough to scroll
     at 1280x720 without this. */
  .auth-center { padding: 20px 20px; }
  .auth-card { padding: 22px; gap: 14px; }
  .auth-hint-box { padding: 12px 14px; gap: 8px; }
}

/* Reduce Motion — the same trims the iOS app makes: halos keep only the
   opacity breath (no scale, no lift), bright stars twinkle without
   swelling, fireflies stay home (drift off, `none` keeps the glow paired
   with its own duration/delay at index 1) but keep glowing. */
@media (prefers-reduced-motion: reduce) {
  .auth-sky__halo { animation-name: auth-sky-breath-still; }
  .auth-sky__star--bright, .auth-sky__sparkle { animation-name: auth-sky-twinkle-bright-still; }
  .auth-sky__firefly { animation-name: none, auth-sky-glow; }
}
@keyframes auth-sky-breath-still {
  from { opacity: .35; }
  to   { opacity: .6; }
}
@keyframes auth-sky-twinkle-bright-still {
  0%, 100% { opacity: .15; }
  50%      { opacity: 1; }
}

/* Print — mirrors public/dashboard.css's rule; auth screens aren't normally
   printed, but this keeps a stray print from showing raw layout chrome. */
@media print {
  .auth-sky { display: none !important; }
}
