/* Factura AI auth — extracted 1:1 from prototype-auth.html */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg-primary: #0a0a0b;
  --bg-secondary: #141415;
  --bg-card: #1a1a1c;
  --bg-input: #232326;
  --bg-input-focus: #2a2a2e;
  --border: #2e2e32;
  --border-focus: #5b5bd6;
  --text-primary: #ececf0;
  --text-secondary: #8b8b96;
  --text-muted: #5c5c66;
  --accent: #5b5bd6;
  --accent-hover: #6e6ede;
  --accent-subtle: rgba(91, 91, 214, 0.15);
  --success: #30a46c;
  --success-subtle: rgba(48, 164, 108, 0.15);
  --error: #e5484d;
  --error-subtle: rgba(229, 72, 77, 0.15);
  --warning: #f5a623;
  --warning-subtle: rgba(245, 166, 35, 0.15);
  --radius: 8px;
  --radius-lg: 12px;
  --transition: 150ms ease;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.auth-container { display: flex; min-height: 100vh; }
.auth-branding {
  flex: 1;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  display: flex; flex-direction: column; justify-content: center;
  padding: 60px; position: relative; overflow: hidden;
}
.auth-branding::before {
  content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(91, 91, 214, 0.08) 0%, transparent 50%);
  pointer-events: none;
}
.brand-logo { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 8px; position: relative; z-index: 1; }
.brand-logo span { color: var(--accent); }
.brand-tagline { font-size: 14px; color: var(--text-secondary); margin-bottom: 48px; position: relative; z-index: 1; }
.brand-feature { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 28px; position: relative; z-index: 1; }
.brand-feature-icon {
  width: 40px; height: 40px; border-radius: var(--radius); background: var(--accent-subtle);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 18px;
}
.brand-feature h3 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.brand-feature p { font-size: 13px; color: var(--text-secondary); line-height: 1.4; }
.brand-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  background: var(--accent-subtle); border-radius: 20px; font-size: 12px; font-weight: 500;
  color: var(--accent); margin-top: 40px; position: relative; z-index: 1;
}
.auth-form-side { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; max-width: 560px; }
.auth-form-wrapper { width: 100%; max-width: 400px; }

.auth-tabs { display: flex; gap: 0; margin-bottom: 32px; border-bottom: 1px solid var(--border); }
.auth-tab {
  flex: 1; padding: 12px 0; text-align: center; font-size: 14px; font-weight: 500;
  color: var(--text-muted); cursor: pointer; border: none; border-bottom: 2px solid transparent;
  transition: var(--transition); background: none; font-family: var(--font); text-decoration: none;
}
.auth-tab:hover { color: var(--text-secondary); }
.auth-tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }

.form-header { margin-bottom: 28px; }
.form-header h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.3px; margin-bottom: 6px; }
.form-header p { font-size: 14px; color: var(--text-secondary); }

.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-input-wrapper { position: relative; }
.form-input {
  width: 100%; padding: 10px 14px; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary); font-size: 14px; font-family: var(--font);
  transition: var(--transition); outline: none;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus { border-color: var(--border-focus); background: var(--bg-input-focus); box-shadow: 0 0 0 3px var(--accent-subtle); }
.form-input.error { border-color: var(--error); box-shadow: 0 0 0 3px var(--error-subtle); }
.form-input.success { border-color: var(--success); }

.form-error { font-size: 12px; color: var(--error); margin-top: 4px; display: none; }
.form-error.visible { display: block; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error-banner {
  background: var(--error-subtle); border: 1px solid rgba(229, 72, 77, 0.4); border-left: 3px solid var(--error);
  color: var(--error); padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 18px;
}

.phone-input-group { display: flex; gap: 8px; }
.phone-prefix { width: 90px; flex-shrink: 0; }

.password-strength { display: flex; gap: 4px; margin-top: 8px; }
.strength-bar { flex: 1; height: 3px; border-radius: 2px; background: var(--border); transition: var(--transition); }
.strength-bar.active-weak { background: var(--error); }
.strength-bar.active-fair { background: var(--warning); }
.strength-bar.active-good { background: var(--accent); }
.strength-bar.active-strong { background: var(--success); }
.strength-text { font-size: 11px; margin-top: 4px; color: var(--text-muted); }

.password-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 13px; font-family: var(--font);
}
.password-toggle:hover { color: var(--text-secondary); }

.nif-status { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 500; display: none; }
.nif-status.found { color: var(--success); display: block; }
.nif-status.not-found { color: var(--warning); display: block; }
.nif-empresa-name { font-size: 12px; color: var(--success); margin-top: 4px; padding: 6px 10px; background: var(--success-subtle); border-radius: var(--radius); display: none; }
.nif-empresa-name.visible { display: block; }
.nif-not-found-warning {
  margin-top: 8px; padding: 12px 14px; background: var(--warning-subtle);
  border: 1px solid rgba(245, 166, 35, 0.3); border-radius: var(--radius); font-size: 13px; color: var(--warning);
}
.nif-not-found-warning p { margin-bottom: 4px; }
.btn-warning-yes { padding: 6px 14px; background: var(--warning); color: #000; border: none; border-radius: var(--radius); font-size: 12px; font-weight: 600; cursor: pointer; font-family: var(--font); }
.btn-warning-no { padding: 6px 14px; background: transparent; color: var(--text-secondary); border: 1px solid var(--border); border-radius: var(--radius); font-size: 12px; cursor: pointer; font-family: var(--font); }
.btn-warning-yes:hover { opacity: 0.9; }
.btn-warning-no:hover { border-color: var(--text-muted); }

.agt-result-card { margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg-secondary); }
.agt-result-header { background: var(--accent); color: white; padding: 8px 14px; font-size: 12px; font-weight: 600; letter-spacing: 0.3px; }
.agt-result-body { padding: 12px 14px; }
.agt-row { display: flex; padding: 4px 0; font-size: 13px; border-bottom: 1px solid var(--border); }
.agt-row:last-child { border-bottom: none; }
.agt-label { width: 120px; flex-shrink: 0; color: var(--text-muted); font-weight: 500; }
.agt-value { color: var(--text-primary); flex: 1; }
.agt-resident { font-style: italic; color: var(--text-secondary); }
.agt-result-footer { padding: 6px 14px; font-size: 11px; color: var(--text-muted); border-top: 1px solid var(--border); background: var(--bg-card); }
.agt-estado-badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.agt-estado-badge.activo { background: var(--success-subtle); color: var(--success); }
.agt-estado-badge.inactivo { background: var(--error-subtle); color: var(--error); }

.form-checkbox { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.form-checkbox input[type="checkbox"] { width: 16px; height: 16px; border-radius: 4px; border: 1px solid var(--border); background: var(--bg-input); cursor: pointer; accent-color: var(--accent); margin-top: 2px; flex-shrink: 0; }
.form-checkbox span { font-size: 13px; color: var(--text-secondary); line-height: 1.4; }
.form-checkbox a { color: var(--accent); text-decoration: none; }
.form-checkbox a:hover { text-decoration: underline; }

.form-select {
  width: 100%; padding: 10px 14px; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary); font-size: 14px; font-family: var(--font);
  transition: var(--transition); outline: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238b8b96' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}
.form-select:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-subtle); }

.btn { width: 100%; padding: 11px 20px; border-radius: var(--radius); font-size: 14px; font-weight: 500; font-family: var(--font); cursor: pointer; transition: var(--transition); border: none; outline: none; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-primary); }
.btn-outline:hover { background: var(--bg-input); border-color: var(--text-muted); }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; }
.btn-google svg { width: 18px; height: 18px; }

.auth-divider { display: flex; align-items: center; gap: 16px; margin: 20px 0; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-divider span { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

.auth-link { text-align: center; font-size: 13px; color: var(--text-secondary); margin-top: 20px; }
.auth-link a { color: var(--accent); text-decoration: none; font-weight: 500; }
.auth-link a:hover { text-decoration: underline; }

.forgot-link { display: block; text-align: right; font-size: 13px; color: var(--accent); text-decoration: none; margin-top: -10px; margin-bottom: 18px; }
.forgot-link:hover { text-decoration: underline; }

.otp-container { display: flex; gap: 10px; justify-content: center; margin: 28px 0; }
.otp-input {
  width: 48px; height: 56px; text-align: center; font-size: 22px; font-weight: 600;
  font-family: var(--font); background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary); outline: none; transition: var(--transition);
}
.otp-input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-subtle); }
.otp-message { text-align: center; font-size: 14px; color: var(--text-secondary); margin-bottom: 8px; }
.otp-email { color: var(--text-primary); font-weight: 500; }
.otp-resend { text-align: center; font-size: 13px; color: var(--text-muted); margin-top: 16px; }
.otp-resend a { color: var(--accent); text-decoration: none; cursor: pointer; }

.wizard-progress { display: flex; align-items: center; gap: 0; margin-bottom: 32px; }
.wizard-step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.wizard-step.active { color: var(--text-primary); }
.wizard-step.completed { color: var(--success); }
.wizard-step-number { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.wizard-step.active .wizard-step-number { background: var(--accent); border-color: var(--accent); color: white; }
.wizard-step.completed .wizard-step-number { background: var(--success); border-color: var(--success); color: white; }
.wizard-step-line { flex: 1; height: 1px; background: var(--border); margin: 0 12px; }
.wizard-step-line.completed { background: var(--success); }

.file-upload { border: 1px dashed var(--border); border-radius: var(--radius); padding: 20px; text-align: center; cursor: pointer; transition: var(--transition); }
.file-upload:hover { border-color: var(--accent); background: var(--accent-subtle); }
.file-upload-icon { font-size: 24px; margin-bottom: 8px; }
.file-upload-text { font-size: 13px; color: var(--text-secondary); }
.file-upload-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

@media (max-width: 900px) {
  .auth-branding { display: none; }
  .auth-form-side { max-width: 100%; padding: 24px; }
}
@media (max-width: 480px) {
  .auth-form-wrapper { max-width: 100%; }
  .otp-input { width: 42px; height: 48px; font-size: 18px; }
  .otp-container { gap: 6px; }
}
