/* Autentificare INGESTA — stiluri comune Corporate Clasic */

* { box-sizing: border-box; }

:root {
  --bg: #f6f8fb;
  --bg-elev: #ffffff;
  --bg-sunken: #eef1f6;
  --border: #e2e6ed;
  --border-strong: #cdd3de;
  --ink: #0f172a;
  --ink-2: #1e293b;
  --ink-3: #475569;
  --ink-4: #64748b;
  --ink-5: #94a3b8;
  --accent: #1d4ed8;
  --accent-2: #1e40af;
  --accent-soft: #e6eeff;
  --accent-softer: #f0f5ff;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --err: #b91c1c;
  --err-soft: #fee2e2;
  --info-soft: #dbeafe;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 1px 3px rgba(15, 23, 42, 0.05), 0 4px 12px rgba(15, 23, 42, 0.04);
}

html, body {
  margin: 0; padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 24px 24px;
}

/* Logo */
.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
  text-decoration: none;
}
.auth-logo-mark {
  width: 36px; height: 36px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  display: grid; place-items: center;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow: 0 1px 3px rgba(29, 78, 216, 0.3);
}
.auth-logo-text {
  display: flex; flex-direction: column;
}
.auth-logo-text b {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.auth-logo-text small {
  font-size: 10px;
  color: var(--ink-5);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: -2px;
}

/* Card */
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 32px;
  box-shadow: var(--shadow-md);
}

.auth-card-sm { max-width: 380px; }
.auth-card-lg { max-width: 480px; }

.auth-card h1 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.auth-card p.lead {
  margin: 0 0 24px;
  color: var(--ink-4);
  font-size: 14px;
  line-height: 1.5;
}
.auth-card p.lead b {
  color: var(--ink-2);
  font-weight: 600;
}

/* Field */
.field { margin-bottom: 16px; }
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  margin-bottom: 6px;
  letter-spacing: 0.005em;
}
.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.field-label-row .field-label { margin: 0; }
.field-hint-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.field-hint-link:hover { text-decoration: underline; }

.field-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  font-size: 14px;
  background: var(--bg-elev);
  color: var(--ink);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}
.field-input::placeholder { color: var(--ink-5); }

.field-input-wrap {
  position: relative;
}
.field-input-wrap .field-input { padding-right: 40px; }
.field-input-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px;
  color: var(--ink-4);
  cursor: pointer;
  border-radius: 3px;
}
.field-input-toggle:hover { color: var(--ink-2); background: var(--bg-sunken); }

.field-hint {
  font-size: 12px;
  color: var(--ink-4);
  margin-top: 6px;
  line-height: 1.4;
}
.field-error {
  font-size: 12px;
  color: var(--err);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Checkbox */
.checkbox-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 4px 0 20px;
}
.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-3);
  cursor: pointer;
  user-select: none;
}
.checkbox input { display: none; }
.checkbox-box {
  width: 16px; height: 16px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: white;
  display: grid; place-items: center;
  transition: all 0.15s;
  flex: none;
}
.checkbox input:checked + .checkbox-box {
  background: var(--accent);
  border-color: var(--accent);
}
.checkbox input:checked + .checkbox-box::after {
  content: '';
  width: 9px; height: 5px;
  border-left: 1.5px solid white;
  border-bottom: 1.5px solid white;
  transform: rotate(-45deg) translate(1px, -1px);
}

/* Button */
.btn {
  width: 100%;
  padding: 11px 16px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-2); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--bg-sunken); }

.btn-text {
  background: transparent;
  color: var(--accent);
  border: none;
  padding: 8px;
  font-weight: 500;
  width: auto;
}
.btn-text:hover { text-decoration: underline; }

.btn-sm { padding: 7px 12px; font-size: 13px; }

/* Link */
a { color: var(--accent); }
a:hover { text-decoration: underline; }

/* Alert */
.alert {
  padding: 12px 14px;
  border-radius: 5px;
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 20px;
}
.alert svg { flex: none; margin-top: 1px; }
.alert-info { background: var(--info-soft); color: #1e3a8a; }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-err { background: var(--err-soft); color: var(--err); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert b { font-weight: 600; }

/* OTP */
.otp-grid {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin: 8px 0 16px;
}
.otp-cell {
  flex: 1;
  aspect-ratio: 1;
  max-width: 52px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: white;
  font-size: 22px;
  font-weight: 700;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  color: var(--ink);
  text-align: center;
  transition: all 0.15s;
}
.otp-cell:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}
.otp-cell.filled { border-color: var(--accent); }

.otp-meta {
  text-align: center;
  font-size: 13px;
  color: var(--ink-4);
  margin-bottom: 8px;
}
.otp-meta b { color: var(--warn); font-weight: 600; }

/* Workspace picker */
.ws-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.ws-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  background: white;
}
.ws-item:hover {
  border-color: var(--border-strong);
  background: var(--bg);
}
.ws-item.active {
  border-color: var(--accent);
  background: var(--accent-softer);
  box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.1);
}
.ws-logo {
  width: 36px; height: 36px;
  border-radius: 5px;
  display: grid; place-items: center;
  color: white;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
  flex: none;
}
.ws-info { flex: 1; min-width: 0; }
.ws-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ws-meta {
  font-size: 11px;
  color: var(--ink-5);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: 0.02em;
}
.ws-role {
  font-size: 10px;
  padding: 3px 7px;
  border-radius: 3px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-sunken);
  color: var(--ink-3);
  flex: none;
}
.ws-role.admin { background: var(--accent-soft); color: var(--accent-2); }
.ws-check {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: grid; place-items: center;
  flex: none;
}

/* Divider text */
.or-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--ink-5);
  font-size: 12px;
}
.or-divider::before, .or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Foot */
.auth-foot {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-4);
}
.auth-foot a {
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 500;
}
.auth-foot a:hover { color: var(--accent); text-decoration: underline; }

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--ink-4);
  text-decoration: none;
  margin-bottom: 20px;
}
.back-link:hover { color: var(--ink-2); text-decoration: underline; }

/* Status + legal strip (bottom of page) */
.auth-legal {
  margin-top: auto;
  padding-top: 32px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  font-size: 11px;
  color: var(--ink-5);
}
.auth-legal-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.auth-legal-links a {
  color: var(--ink-4);
  text-decoration: none;
}
.auth-legal-links a:hover { color: var(--ink-2); text-decoration: underline; }
.auth-legal-status {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.03em;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ok);
  display: inline-block;
  margin-right: 5px;
  animation: pulse 2s ease-in-out infinite;
  box-shadow: 0 0 0 0 var(--ok);
}
.status-dot.err { background: var(--err); }
.status-dot.warn { background: var(--warn); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(21, 128, 61, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(21, 128, 61, 0); }
}

/* Step indicator */
.steps {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 11px;
  color: var(--ink-5);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.steps-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--border-strong);
}
.steps-dot.active { background: var(--accent); }
.steps-dot.done { background: var(--ok); }
.steps-line {
  width: 12px; height: 1px;
  background: var(--border-strong);
}

/* Password strength meter */
.strength {
  margin-top: 8px;
}
.strength-bars {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}
.strength-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}
.strength-bar.on-1 { background: var(--err); }
.strength-bar.on-2 { background: var(--warn); }
.strength-bar.on-3 { background: #ca8a04; }
.strength-bar.on-4 { background: var(--ok); }
.strength-label {
  font-size: 11px;
  color: var(--ink-4);
  display: flex;
  justify-content: space-between;
}
.strength-label b { font-weight: 600; color: var(--ink-2); }

/* Password requirements */
.pwd-reqs {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
}
.pwd-reqs li {
  font-size: 12px;
  color: var(--ink-4);
  display: flex;
  align-items: center;
  gap: 6px;
}
.pwd-reqs li.ok { color: var(--ok); }
.pwd-reqs li.ok::before { content: '✓'; font-weight: 700; }
.pwd-reqs li:not(.ok)::before { content: '○'; color: var(--ink-5); }

/* Success screen */
.success-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--ok-soft);
  color: var(--ok);
  display: grid; place-items: center;
  margin: 0 auto 20px;
}

/* Micro icon helper */
.i-small { width: 14px; height: 14px; flex: none; }

/* Responsive */
@media (max-width: 480px) {
  .auth-shell { padding: 32px 16px 16px; }
  .auth-card { padding: 24px 20px; }
  .otp-grid { gap: 6px; }
  .otp-cell { font-size: 18px; }
}

/* ─── Selector bază de date (multi-DB login) ──────────────────────────────── */
.field-db-selector {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.field-db-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius, 8px);
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s;
  user-select: none;
}
.field-db-option:hover {
  border-color: var(--accent);
  background: var(--accent-soft, rgba(79,70,229,.05));
}
.field-db-option.active {
  border-color: var(--accent, #4f46e5);
  background: var(--accent-soft, rgba(79,70,229,.07));
}
.field-db-option input[type="radio"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent, #4f46e5);
  flex-shrink: 0;
  margin: 0;
}
.field-db-key {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent, #4f46e5);
  background: var(--accent-soft, rgba(79,70,229,.1));
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.field-db-label {
  font-size: 13px;
  color: var(--ink, #111);
  flex: 1;
}
.field-db-option.active .field-db-label {
  font-weight: 500;
}
