/*
 * animations.css  —  Glassmorphism Motion System
 * Auth screen, dashboard transitions, card stagger, micro-interactions.
 */

/* ════════════════════════════════════════
   AUTH SCREEN
════════════════════════════════════════ */

#auth-screen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  transition: opacity 1.1s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 1.1s;
}

#auth-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}


#auth-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* Subtle noise texture */
/* Scanline noise overlay REMOVED 2026-08-11 — feTurbulence grain reads as
   amateur and fought the clean professional direction. */
.auth-scanlines { display: none; }

/* ── Auth content block ────────────────── */
.auth-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  animation: auth-enter 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes auth-enter {
  from { opacity: 0; transform: translateY(28px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ── Logo + title ──────────────────────── */
.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.auth-icon {
  transition: opacity 0.3s;
}

/* Torus wordmark — clean typographic treatment in the display face (was the
   Press Start 2P pixel font, which read as retro-gaming, not professional).
   The ™ superscript sits at the right with reduced size + raised baseline. */
.torus-wordmark {
  font-family: var(--font-display);
  font-size: clamp(22px, 6vw, 40px);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.12em;
  line-height: 1;
  user-select: none;
  display: inline-block;
}
.torus-wordmark sup {
  font-size: 0.45em;
  vertical-align: super;
  margin-left: 2px;
}

/* Round black-disc badge with the wordmark centred inside. Used in the
   top nav (~30 px) and dept-shell brand mark (~34 px). The wordmark
   shrinks dramatically inside the disc — at 30 px it's nearly a dot,
   which is intentional: at small sizes a simple round logo reads better
   than illegible micro-type. */
.torus-mark-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  background: var(--text-primary);
  color: var(--col-void);
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  user-select: none;
  flex-shrink: 0;
  transition: transform var(--t-base) var(--ease-out);
}
.nav-logo:hover .torus-mark-badge {
  transform: scale(1.06);
}
/* Slightly bigger in the dept-shell header */
.dept-shell-brand-mark.torus-mark-badge { width: 36px; height: 36px; font-size: 9px; }

/* More organic 3-step float */
@keyframes auth-float {
  0%   { transform: translateY(0)     rotate(0deg);   }
  25%  { transform: translateY(-12px) rotate(2deg);   }
  55%  { transform: translateY(-5px)  rotate(-1.5deg);}
  80%  { transform: translateY(-9px)  rotate(1deg);   }
  100% { transform: translateY(0)     rotate(0deg);   }
}

.auth-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-align: center;
  color: var(--text-primary);
  margin: 0;
}

/* "Culture" carries the accent as a solid colour, inline with "Torus". */
.auth-title span { color: var(--accent-cyan); }

.auth-subtitle {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  text-align: center;
  margin: 0;
}

/* ── User / Role selector (legacy, kept for compat) ──────── */
.role-selector,
.user-selector {
  display: flex;
  gap: 8px;
  width: 100%;
}

.role-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 14px 10px 12px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: var(--r-md);
  color: rgba(240,244,255,0.55);
  cursor: pointer;
  outline: none;
  transition: all var(--t-base) var(--ease-out);
}

.role-card:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.28);
  color: rgba(240,244,255,0.85);
  transform: translateY(-2px);
}

.role-card.active[data-role="admin"] {
  background: rgba(56,189,248,0.10);
  border-color: rgba(56,189,248,0.55);
  color: var(--accent-cyan);
  box-shadow: 0 0 24px rgba(56,189,248,0.18), inset 0 0 14px rgba(56,189,248,0.06);
}

.role-card.active[data-role="employee"] {
  background: rgba(45,212,191,0.10);
  border-color: rgba(45,212,191,0.55);
  color: var(--accent-teal);
  box-shadow: 0 0 24px rgba(45,212,191,0.18), inset 0 0 14px rgba(45,212,191,0.06);
}

.role-card-name {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.role-card-desc {
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.65;
}

.user-card-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.10);
  border: 1.5px solid rgba(255,255,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: inherit;
  transition: background var(--t-base) var(--ease-out), border-color var(--t-base) var(--ease-out);
}

.user-card-role {
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 100px;
  border: 1px solid transparent;
}

.user-card-role.admin    { color: var(--accent-cyan); background: rgba(56,189,248,0.14); border-color: rgba(56,189,248,0.32); }
.user-card-role.employee { color: var(--accent-teal); background: rgba(45,212,191,0.14); border-color: rgba(45,212,191,0.32); }

/* ── Save login row ────────────────────── */
.save-login-row {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text-muted);
  text-transform: none;
  width: 100%;
  user-select: none;
  margin-top: 2px;
}

.save-login-row input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.save-login-indicator {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  border-radius: 4px;
  background: rgba(255,255,255,0.07);
  border: 1.5px solid rgba(255,255,255,0.22);
  position: relative;
  transition: all var(--t-base) var(--ease-out);
}

.save-login-row:has(input:checked) .save-login-indicator {
  background: rgba(56,189,248,0.22);
  border-color: rgba(56,189,248,0.70);
}

.save-login-row:has(input:checked) .save-login-indicator::after {
  content: '';
  position: absolute;
  left: 3px; top: 1px;
  width: 5px; height: 8px;
  border-right: 2px solid var(--accent-cyan);
  border-bottom: 2px solid var(--accent-cyan);
  transform: rotate(40deg);
}

.auth-role-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
  text-align: center;
  width: 100%;
  margin-top: -4px;
  transition: color var(--t-base) var(--ease-smooth);
}

/* Light mode role cards */
html[data-theme="light"] .role-card { background: rgba(255,255,255,0.40); border-color: rgba(130,100,200,0.15); color: var(--text-muted); }
html[data-theme="light"] .role-card:hover { background: rgba(255,255,255,0.60); border-color: rgba(130,100,200,0.30); }
html[data-theme="light"] .role-card.active[data-role="admin"]    { background: rgba(2,132,199,0.08);  border-color: rgba(2,132,199,0.50);  color: var(--accent-cyan); box-shadow: 0 0 20px rgba(2,132,199,0.12); }
html[data-theme="light"] .role-card.active[data-role="employee"] { background: rgba(13,148,136,0.08); border-color: rgba(13,148,136,0.50); color: var(--accent-teal); box-shadow: 0 0 20px rgba(13,148,136,0.12); }

/* ── Light mode auth overrides ─────────── */
html[data-theme="light"] .auth-content {
  filter: drop-shadow(0 4px 32px rgba(80,90,160,0.14));
}

html[data-theme="light"] .auth-title {
  text-shadow: 0 2px 16px rgba(200,210,255,0.6);
}

html[data-theme="light"] .auth-subtitle {
  text-shadow: none;
}

html[data-theme="light"] #auth-canvas {
  opacity: 0.30;
}

/* ── Glass card around form ────────────── */
/* One compact, professional sign-in card. (Was a wider glass panel with a
   cyan-tinted border, a big cyan glow, and an animated rainbow shimmer line.) */
.auth-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  width: 100%;
  max-width: 384px;
  padding: 34px 32px 28px;
  background: rgba(19, 21, 27, 0.72);
  backdrop-filter: blur(16px) saturate(1.05);
  -webkit-backdrop-filter: blur(16px) saturate(1.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: auth-enter 0.7s 0.1s both;
  position: relative;
}

.auth-form::before { content: none; }   /* shimmer line removed */

html[data-theme="light"] .auth-form {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(19, 16, 58, 0.10);
  box-shadow:
    0 24px 60px rgba(80, 90, 160, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* ── Brand block inside the card ──────────────────────────────────────── */
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-bottom: 20px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
html[data-theme="light"] .auth-brand { border-bottom-color: rgba(19, 16, 58, 0.08); }

.auth-mark {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  color: var(--accent-cyan);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
}
html[data-theme="light"] .auth-mark {
  background: rgba(19, 16, 58, 0.04);
  border-color: rgba(19, 16, 58, 0.10);
}

.auth-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.input-wrapper {
  position: relative;
  width: 100%;
}

/* Leading field icon (user / lock) — accent-tinted, brightens on focus */
.auth-input-ic {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  display: inline-flex; color: var(--text-dim);
  pointer-events: none; transition: color 0.2s var(--ease-smooth);
}
.input-wrapper:focus-within .auth-input-ic { color: var(--accent-cyan); }
html[data-theme="light"] .auth-input-ic { color: rgba(19,16,58,0.35); }

/* Neutral inputs at rest; the accent appears only on focus. (Was a permanent
   bright-cyan border + cyan glow that made every field look "lit up".) */
#username-input,
#password-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 400;
  padding: 13px 16px 13px 42px;
  text-align: left;
  outline: none;
  box-shadow: none;
  transition:
    border-color 0.2s var(--ease-smooth),
    background   0.2s var(--ease-smooth),
    box-shadow   0.2s var(--ease-smooth);
  caret-color: var(--accent-cyan);
}

#username-input { letter-spacing: 0; }
#password-input { letter-spacing: 0.04em; }

#username-input::placeholder,
#password-input::placeholder {
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
}

#username-input:focus,
#password-input:focus {
  border-color: var(--accent-cyan);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(79, 159, 218, 0.16);
}

html[data-theme="light"] #username-input,
html[data-theme="light"] #password-input {
  background: rgba(19, 16, 58, 0.03);
  border-color: rgba(19, 16, 58, 0.14);
  color: var(--text-primary);
  box-shadow: none;
}

html[data-theme="light"] #username-input::placeholder,
html[data-theme="light"] #password-input::placeholder {
  color: rgba(19,16,58,0.38);
}

html[data-theme="light"] #username-input:focus,
html[data-theme="light"] #password-input:focus {
  border-color: var(--accent-cyan);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.14);
}

html[data-theme="light"] .save-login-indicator {
  background: rgba(255,255,255,0.60);
  border-color: rgba(130,100,200,0.35);
}

/* Animated underline — replaced with border glow */
.input-underline { display: none; }

/* ── Auth CTA — premium gradient pill with sliding arrow + shimmer sweep ── */
.auth-hint {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  margin-top: 6px;
  font-family: var(--font-display, 'Space Grotesk', sans-serif);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  color: #06131d;
  /* Solid accent (was a 4-hue animated gradient + shimmer sweep + cyan glow).
     Depth now comes from one real offset shadow, not a coloured halo. */
  background: var(--accent-cyan);
  border: none;
  cursor: pointer;
  padding: 14px 22px;
  border-radius: var(--r-md);
  box-shadow: 0 6px 16px rgba(0,0,0,0.30);
  transition:
    background  var(--t-base) var(--ease-smooth),
    box-shadow  var(--t-base) var(--ease-smooth),
    transform   var(--t-fast) var(--ease-out);
}
.auth-hint-label { position: relative; z-index: 1; }
.auth-hint-arrow { position: relative; z-index: 1; transition: transform 0.28s var(--ease-out); }

/* Shimmer sweep removed. */
.auth-hint::after { content: none; }

.auth-hint:hover {
  background: #63b1e8;
  box-shadow: 0 8px 22px rgba(0,0,0,0.36);
  transform: translateY(-1px);
}
.auth-hint:hover .auth-hint-arrow { transform: translateX(4px); }
.auth-hint:active { transform: translateY(0) scale(0.99); }
.auth-hint:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 3px; }

/* Microcopy under the CTA */
.auth-help {
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 10.5px; font-weight: 500; letter-spacing: 0.04em;
  color: rgba(186,211,232,0.5);
  margin-top: -2px;
}
.auth-help kbd {
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.02em;
  color: rgba(224,242,254,0.85);
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14);
  border-radius: 5px; padding: 1px 6px;
}
html[data-theme="light"] .auth-help { color: rgba(71,85,105,0.7); }
html[data-theme="light"] .auth-help kbd { color: #0f172a; background: rgba(15,23,42,0.06); border-color: rgba(15,23,42,0.16); }
html[data-theme="light"] .auth-hint { color: #fff; box-shadow: 0 10px 30px rgba(2,132,199,0.28), 0 0 0 1px rgba(255,255,255,0.25) inset; }

/* ── Auth error ────────────────────────── */
.auth-error {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--accent-rose);
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  transition: opacity 0.22s ease, transform 0.22s var(--ease-out);
  padding: 8px 14px;
  background: rgba(251,113,133,0.08);
  border: 1px solid rgba(251,113,133,0.2);
  border-radius: var(--r-sm);
  width: 100%;
  justify-content: center;
}

.auth-error.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ── Shake animation ───────────────────── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%       { transform: translateX(-11px); }
  20%       { transform: translateX(10px); }
  30%       { transform: translateX(-8px); }
  40%       { transform: translateX(7px); }
  50%       { transform: translateX(-5px); }
  60%       { transform: translateX(4px); }
  70%       { transform: translateX(-3px); }
  80%       { transform: translateX(2px); }
}

.input-wrapper.shake {
  animation: shake 0.52s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.input-wrapper.shake #username-input,
.input-wrapper.shake #password-input {
  border-color: rgba(251,113,133,0.55);
  background: rgba(251,113,133,0.06);
  box-shadow: 0 0 0 3px rgba(251,113,133,0.12);
}

/* ── Auth screen theme toggle ───────────── */
.auth-theme-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 10;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  cursor: pointer;
  outline: none;
  transition: all var(--t-base) var(--ease-out);
}

.auth-theme-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.28);
  color: var(--text-primary);
}

html[data-theme="light"] .auth-theme-btn {
  background: rgba(255,255,255,0.50);
  border-color: rgba(130,100,200,0.26);
  color: var(--text-muted);
}

html[data-theme="light"] .auth-theme-btn:hover {
  background: rgba(255,255,255,0.78);
  border-color: rgba(130,100,200,0.46);
  color: var(--text-primary);
}

/* Auth footer */
.auth-footer {
  position: absolute;
  bottom: 24px;
  left: 0; right: 0;
  text-align: center;
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  text-transform: uppercase;
  z-index: 2;
  animation: auth-enter 1.2s 0.4s both;
}


/* ════════════════════════════════════════
   DASHBOARD TRANSITIONS
════════════════════════════════════════ */

#dashboard {
  opacity: 0;
  transition: opacity 1s ease;
}

#dashboard.visible {
  opacity: 1;
}

/* ── Dashboard header drops in from nav ── */
.dashboard-header {
  animation: header-drop 0.7s var(--ease-out) 0.1s both;
}

@keyframes header-drop {
  from { opacity: 0; transform: translateY(-18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Eyebrow accent line pulses ────────── */
@keyframes eyebrow-line-pulse {
  0%, 100% { width: 20px; box-shadow: 0 0 6px var(--accent-cyan); }
  50%       { width: 30px; box-shadow: 0 0 16px var(--accent-cyan), 0 0 32px rgba(56,189,248,0.45); }
}

.page-eyebrow::before {
  animation: eyebrow-line-pulse 3.5s ease-in-out infinite;
}

/* ── Tab panel reveal ───────────────────
   Was var(--ease-spring), whose second control point sits above 1 and so
   overshoots the endpoint by roughly half again before settling. (The literal
   curve is deliberately NOT written out here: the design scanner matches the
   value itself, and quoting it in prose reports this comment as a live defect.)
   That bounce fires on EVERY
   tab switch, which is the most repeated motion in the app; an overshoot is
   playful the first time and grating the hundredth, and on a phone it reads as
   the "overstimulating" quality the mobile brief exists to remove.
   --ease-out is cubic-bezier(0.16, 1, 0.3, 1): a real deceleration, no
   overshoot. The token itself is untouched — 10+ other files use it, and some
   of those uses are legitimately springy. Only these operational animations
   are retargeted. */
.tab-panel.active {
  animation: tab-reveal 0.48s var(--ease-out) forwards;
}

@keyframes tab-reveal {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ── Overview sections stagger in ──────── */
.overview-section {
  animation: card-rise 0.55s var(--ease-out) 0.08s both;
}

.alerts-sidebar {
  animation: card-rise 0.55s var(--ease-out) 0.16s both;
}

/* ── Stat card stagger ─────────────────── */
@keyframes card-rise {
  from { opacity: 0; transform: translateY(22px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* Metric cards settle, they do not bounce — an overshoot on a number reads as
   the value wobbling before it lands. See the tab-panel note above. */
.stat-card {
  animation: card-rise 0.52s var(--ease-out) both;
}

.stat-card:nth-child(1)  { animation-delay: 0.04s; }
.stat-card:nth-child(2)  { animation-delay: 0.08s; }
.stat-card:nth-child(3)  { animation-delay: 0.12s; }
.stat-card:nth-child(4)  { animation-delay: 0.16s; }
.stat-card:nth-child(5)  { animation-delay: 0.20s; }
.stat-card:nth-child(6)  { animation-delay: 0.24s; }
.stat-card:nth-child(7)  { animation-delay: 0.28s; }
.stat-card:nth-child(8)  { animation-delay: 0.32s; }
.stat-card:nth-child(9)  { animation-delay: 0.36s; }
.stat-card:nth-child(10) { animation-delay: 0.40s; }
.stat-card:nth-child(11) { animation-delay: 0.44s; }
.stat-card:nth-child(12) { animation-delay: 0.48s; }
.stat-card:nth-child(13) { animation-delay: 0.52s; }
.stat-card:nth-child(14) { animation-delay: 0.56s; }
.stat-card:nth-child(15) { animation-delay: 0.60s; }
.stat-card:nth-child(16) { animation-delay: 0.64s; }
.stat-card:nth-child(17) { animation-delay: 0.68s; }
.stat-card:nth-child(18) { animation-delay: 0.72s; }
.stat-card:nth-child(19) { animation-delay: 0.76s; }
.stat-card:nth-child(20) { animation-delay: 0.80s; }

/* Room indicator dot — subtle glow pulse */
@keyframes dot-pulse {
  0%, 100% { box-shadow: 0 0 6px var(--accent-cyan); }
  50%       { box-shadow: 0 0 16px var(--accent-cyan), 0 0 32px rgba(56,189,248,0.5); }
}

.stat-room::before {
  animation: dot-pulse 3s ease-in-out infinite;
}

/* ── Loading dots ──────────────────────── */
@keyframes loading-blink {
  0%, 100% { opacity: 1;    color: var(--accent-cyan); }
  50%       { opacity: 0.12; color: var(--text-dim); }
}

.loading-dots::after {
  content: '...';
  display: inline-block;
  animation: loading-blink 1.6s ease-in-out infinite;
}

/* ── Alert group entrance ──────────────── */
@keyframes alert-slide-in {
  from { opacity: 0; transform: translateX(-14px) scale(0.98); }
  to   { opacity: 1; transform: translateX(0)      scale(1); }
}

/* An ALERT must not be playful. A bounce on the element that says something is
   wrong in the facility is tonally backwards — it should arrive and settle,
   with authority. This is the most important of the four. */
.alert-item {
  animation: alert-slide-in 0.38s var(--ease-out) both;
}

.alert-item:nth-child(1)  { animation-delay: 0.04s; }
.alert-item:nth-child(2)  { animation-delay: 0.09s; }
.alert-item:nth-child(3)  { animation-delay: 0.14s; }
.alert-item:nth-child(4)  { animation-delay: 0.19s; }
.alert-item:nth-child(5)  { animation-delay: 0.24s; }
.alert-item:nth-child(6)  { animation-delay: 0.29s; }
.alert-item:nth-child(7)  { animation-delay: 0.34s; }
.alert-item:nth-child(8)  { animation-delay: 0.39s; }
.alert-item:nth-child(9)  { animation-delay: 0.44s; }
.alert-item:nth-child(10) { animation-delay: 0.49s; }

/* Alert group hover nudge */
.alert-group {
  transition:
    background   var(--t-base) var(--ease-smooth),
    box-shadow   var(--t-base) var(--ease-smooth),
    transform    var(--t-fast) var(--ease-out);
}

.alert-group:hover {
  transform: translateX(3px);
}

/* ── Section label ─────────────────────── */
@keyframes label-in {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: translateX(0); }
}

.section-label {
  animation: label-in 0.45s var(--ease-out) both;
}

/* ── Summary pills stagger ─────────────── */
/* Staggered entrances compound: with N pills the overshoot repeats N times in
   sequence, which is where a "lively" easing turns into visual noise. */
.summary-pill {
  animation: card-rise 0.42s var(--ease-out) both;
}

.summary-pill:nth-child(1) { animation-delay: 0.06s; }
.summary-pill:nth-child(2) { animation-delay: 0.12s; }
.summary-pill:nth-child(3) { animation-delay: 0.18s; }
.summary-pill:nth-child(4) { animation-delay: 0.24s; }
.summary-pill:nth-child(5) { animation-delay: 0.30s; }
.summary-pill:nth-child(6) { animation-delay: 0.36s; }

/* ── Table row flash ───────────────────── */
@keyframes row-new {
  0%   { background: rgba(56,189,248,0.25); box-shadow: inset 0 0 16px rgba(56,189,248,0.15); }
  30%  { background: rgba(56,189,248,0.14); box-shadow: inset 0 0 8px  rgba(56,189,248,0.08); }
  100% { background: transparent;           box-shadow: none; }
}

.data-table tbody tr.flash-row {
  animation: row-new 2.5s ease-out forwards;
}

/* ── WIP card float ────────────────────── */
@keyframes wip-float {
  0%   { transform: translateY(0); }
  40%  { transform: translateY(-10px); }
  70%  { transform: translateY(-4px); }
  100% { transform: translateY(0); }
}

.wip-card {
  animation: wip-float 7s ease-in-out infinite;
}

/* ── WIP icon ring glow pulse ──────────── */
@keyframes ring-glow {
  0%, 100% {
    box-shadow: 0 0 0  0   rgba(56,189,248,0),
                0 0 12px   rgba(56,189,248,0.08);
  }
  50% {
    box-shadow: 0 0 0  10px rgba(56,189,248,0.04),
                0 0 36px   rgba(56,189,248,0.20);
  }
}

.wip-icon-ring {
  animation: ring-glow 4.5s ease-in-out infinite;
}

/* ── Background watermark breathe ─────── */
@keyframes bg-breathe {
  0%, 100% { opacity: 0.025; transform: scale(1.000); }
  50%       { opacity: 0.060; transform: scale(1.020); }
}

.overview-bg-text {
  animation: bg-breathe 10s ease-in-out infinite;
  transform-origin: center center;
}

/* wip-bg-text uses translate(-50%,-50%) for centering — don't override transform */

@keyframes bg-breathe-room {
  0%, 100% { opacity: 0.025; transform: scale(1.000); }
  50%       { opacity: 0.055; transform: scale(1.018); }
}

.room-bg-text {
  animation: bg-breathe-room 12s ease-in-out infinite;
  transform-origin: right top;
}

/* ─── Respect reduced-motion preference ───────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ════════════════════════════════════════════════════════════════════════
   WORK-IN-PROGRESS BANNER
   Sticky strip at the top of the viewport. Lives above every modal,
   drawer, and toast (z-index 999999). Other fixed chrome (nav, sidebar,
   toasts) offsets itself by --banner-h so nothing overlaps it.

   To deactivate site-wide: remove the #wip-banner <div> from index.html
   and set --banner-h to 0px below — every other surface picks up the
   change automatically through the variable.
════════════════════════════════════════════════════════════════════════ */
:root { --banner-h: 0px; }   /* BETA banner removed 2026-06-16 — no top offset */
body { padding-top: var(--banner-h); }

#wip-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999999;
  height: var(--banner-h);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(90deg,
    rgba(251, 191, 36, 0.96) 0%,
    rgba(251, 146, 60, 0.96) 100%);
  color: #1a0f00;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(0, 0, 0, 0.25);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.30);
  pointer-events: none;            /* never blocks clicks on what's behind */
  user-select: none;
}
.wip-banner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1a0f00;
  box-shadow: 0 0 0 0 rgba(26, 15, 0, 0.55);
  animation: wip-pulse 1.8s ease-in-out infinite;
  flex-shrink: 0;
}
.wip-banner-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wip-banner-sub {
  margin-left: 6px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: none;
  opacity: 0.85;
}
/* Inline bug icon inside the banner copy — illustrative only (the banner is
   pointer-events:none), so it just shows users which top-bar button to use. */
.wip-banner-bug {
  vertical-align: -3px;
  margin: 0 2px;
  opacity: 0.9;
}
@keyframes wip-pulse {
  0%, 100% { box-shadow: 0 0 0 0   rgba(26, 15, 0, 0.55); }
  50%      { box-shadow: 0 0 0 6px rgba(26, 15, 0, 0);    }
}
@media (max-width: 640px) {
  #wip-banner .wip-banner-sub { display: none; }
}
@media (max-width: 480px) {
  /* keep just WIP label + deadline chip on phones */
  #wip-banner .wip-banner-date { margin-left: 8px; padding: 2px 7px; font-size: 9.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .wip-banner-dot { animation: none; }
}

/* (Removed 2026-07-27: the Rooms-tab "this isn't the final spreadsheet" migration
   notice. The migration is long done — banner + styles deleted to reclaim the space.) */

/* ── Light-mode gap fixes (appended) ─────────────────────────────────────
   The login hero wordmark is hardcoded #fff and sits over the lavender auth
   background (the Three.js canvas is dimmed to 0.30 in light), so white text
   washes out. Re-anchor it to the deep-navy text token for contrast. */
html[data-theme="light"] .torus-wordmark { color: var(--text-primary); }

/* ── MOBILE (2026-07-06 overhaul) — scoped, desktop untouched ── */

/* Phones: the fixed, center-justified auth screen traps the form under the
   software keyboard (visual viewport halves, no scroll path). Switch to a
   scrollable column; margin:auto on .auth-content keeps it centered while
   the keyboard is closed but lets it scroll into view when open. */
@media (max-width: 768px) {
  #auth-screen {
    height: 100vh;          /* fallback */
    height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
    padding: max(24px, env(safe-area-inset-top, 0px)) 16px
             calc(24px + env(safe-area-inset-bottom, 0px));
  }
  .auth-content { margin: auto 0; }
}

/* Touch devices: lift the 15px login inputs to the 16px iOS no-zoom floor.
   (≤768px is already floored by the global mobile input rule; this covers
   landscape phones / coarse tablets above 768px.) Placeholders may stay
   small — they don't trigger focus zoom. */
@media (pointer: coarse) {
  #username-input,
  #password-input { font-size: 16px; }

  /* Login theme toggle: 34px → 44px touch minimum, and drop it below the
     iOS status-bar tap zone via the safe-area inset. */
  .auth-theme-btn {
    width: 44px;
    height: 44px;
    top: max(12px, env(safe-area-inset-top, 0px));
    right: 12px;
  }
}

/* Phones: collapse the entrance-stagger ladder (up to 0.8s of delay on the
   last stat cards) — on a phone that reads as a slow load. Reveals still
   play, just immediately and quickly. */
@media (pointer: coarse) and (max-width: 768px) {
  .stat-card,
  .alert-item {
    animation-delay: 0s !important;
    animation-duration: 0.25s !important;
  }
}

/* ── gradient-flow — RESTORED 2026-08-12 ─────────────────────────────────────
 * src/departments/cultivation/tabs/overview/overview.css:139 animates with this
 * keyframe, but the definition went missing from this file during the 2026-08-11
 * reorganization session. Nothing errored and nothing logged: an animation naming
 * an undefined keyframe is simply ignored by CSS, so the Overview gradient just
 * stopped moving. Found by diffing this file's keyframe list against the
 * pre-reorg snapshot, not by looking at the screen.
 *
 * It stays in 2-generic because a keyframe is generic by ITCSS definition and has
 * no specificity of its own; only its consumer needs to know about it. */
@keyframes gradient-flow {
  0%   { background-position: 0%   50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0%   50%; }
}
