/* =============================================================
   Operator Panel — login page
   ============================================================= */

:root {
  --bg-0: #07090d;
  --bg-1: #0c1018;
  --bg-2: #131826;
  --bg-3: #1a2032;
  --line: #1f2738;
  --line-2: #2a3346;
  --text: #e8edf6;
  --text-2: #8b95a7;
  --text-3: #5a6373;
  --accent: #7cf5b0;
  --accent-2: #3ddc97;
  --accent-glow: rgba(124, 245, 176, 0.35);
  --warn: #f4b740;
  --bad: #ff6b6b;
  --ok: #7cf5b0;
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.55), 0 8px 30px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 0 1px rgba(124, 245, 176, 0.15), 0 12px 40px rgba(124, 245, 176, 0.12);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-0);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* --- Decorative background --- */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(124, 245, 176, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 245, 176, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, black 30%, transparent 80%);
}
.bg-glow {
  position: fixed; z-index: 0; pointer-events: none;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
}
.bg-glow-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  top: -200px; right: -100px;
  opacity: 0.18;
  animation: drift 20s ease-in-out infinite alternate;
}
.bg-glow-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #6aa9ff 0%, transparent 70%);
  bottom: -200px; left: -100px;
  opacity: 0.15;
  animation: drift 24s ease-in-out infinite alternate-reverse;
}
@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(40px, -30px) scale(1.1); }
}

/* --- Card --- */
.login-shell {
  position: relative; z-index: 1;
  width: 100%; max-width: 440px;
  padding: 24px;
  animation: cardIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.login-card {
  background: linear-gradient(180deg, rgba(19, 24, 38, 0.85), rgba(12, 16, 24, 0.92));
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 40px 36px 32px;
  box-shadow: var(--shadow-lg);
}

/* --- Brand --- */
.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 28px; }
.logo {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, rgba(124, 245, 176, 0.15), rgba(61, 220, 151, 0.05));
  border: 1px solid rgba(124, 245, 176, 0.25);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 20px rgba(124, 245, 176, 0.15);
}
.brand-text h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #ffffff 0%, #b8c2d4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.brand-text p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-2);
  font-weight: 400;
}

/* --- Form fields --- */
form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0.01em;
  padding-left: 2px;
}
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(7, 9, 13, 0.6);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.input-wrap:hover { border-color: rgba(124, 245, 176, 0.4); }
.input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: rgba(7, 9, 13, 0.85);
}
.input-icon {
  display: flex; align-items: center; justify-content: center;
  width: 42px; flex-shrink: 0;
  color: var(--text-3);
  transition: color 0.15s;
}
.input-wrap:focus-within .input-icon { color: var(--accent); }
.input-wrap input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  padding: 13px 14px 13px 0;
  font-family: 'Inter', sans-serif;
}
.input-wrap input::placeholder { color: var(--text-3); }
.toggle-pw {
  appearance: none; background: none; border: 0;
  padding: 0 14px 0 8px;
  color: var(--text-3);
  cursor: pointer;
  display: flex; align-items: center;
  transition: color 0.15s;
}
.toggle-pw:hover { color: var(--text); }

/* --- Submit button --- */
button.primary {
  appearance: none;
  position: relative;
  border: 0;
  border-radius: 12px;
  padding: 14px 20px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #0a0d12;
  background: linear-gradient(180deg, #7cf5b0 0%, #3ddc97 100%);
  cursor: pointer;
  margin-top: 8px;
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  transition: transform 0.08s, box-shadow 0.15s, filter 0.15s;
  box-shadow: 0 4px 16px rgba(124, 245, 176, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  font-family: 'Inter', sans-serif;
  letter-spacing: -0.005em;
}
button.primary:hover { box-shadow: 0 6px 24px rgba(124, 245, 176, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
button.primary:active { transform: translateY(1px); }
button.primary[disabled] { filter: grayscale(0.4) brightness(0.95); cursor: not-allowed; }

.btn-spinner {
  display: none;
  width: 14px; height: 14px;
  border: 2px solid rgba(10, 13, 18, 0.25);
  border-top-color: rgba(10, 13, 18, 0.85);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
button.primary.loading .btn-spinner { display: inline-block; }
button.primary.loading .btn-label { opacity: 0.7; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Message --- */
.msg {
  font-size: 13px;
  min-height: 1.2em;
  text-align: center;
  padding: 8px 0 0;
  transition: color 0.15s;
}
.msg.err { color: var(--bad); }
.msg.ok { color: var(--ok); }
.msg.warn { color: var(--warn); }

/* --- Footer --- */
.login-foot {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-2);
  background: rgba(124, 245, 176, 0.08);
  border: 1px solid rgba(124, 245, 176, 0.18);
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 500;
}
.status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.foot-meta {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.02em;
}
.dot-sep { margin: 0 6px; color: var(--text-3); }

/* --- TOTP field reveal animation --- */
.totp-field[hidden] { display: none !important; }
.totp-field {
  animation: totpIn 0.3s ease-out both;
  overflow: hidden;
}
@keyframes totpIn {
  from { opacity: 0; max-height: 0; transform: translateY(-4px); }
  to { opacity: 1; max-height: 100px; transform: translateY(0); }
}

/* --- Mobile --- */
@media (max-width: 480px) {
  .login-shell { padding: 14px; }
  .login-card { padding: 28px 22px 22px; border-radius: 18px; }
  .brand { gap: 14px; margin-bottom: 26px; }
  .logo { width: 48px; height: 48px; border-radius: 13px; }
  .logo svg { width: 34px; height: 34px; }
  .brand-text h1 { font-size: 24px; }
  .brand-text p { font-size: 14px; margin-top: 3px; }
  form { gap: 18px; }
  .field label { font-size: 13px; }
  .input-wrap input { font-size: 16px; padding: 14px 14px 14px 0; }
  .input-icon { width: 46px; }
  button.primary { padding: 16px; font-size: 16px; margin-top: 10px; }
  .login-foot { margin-top: 24px; padding-top: 18px; flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* Very small phones */
@media (max-width: 340px) {
  .login-card { padding: 24px 18px 20px; }
  .brand-text h1 { font-size: 22px; }
}
