:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-input: #0f172a;
  --border: #334155;
  --border-focus: #3b82f6;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
  --transition: 0.2s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

header {
  text-align: center;
  margin-bottom: 32px;
  padding: 8px 0;
}

.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--accent), #1d4ed8);
  color: #fff;
  border-radius: 16px;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 1px;
  margin-bottom: 16px;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

header h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

header p {
  color: var(--text-secondary);
  font-size: 14px;
  max-width: 480px;
  margin: 0 auto;
}

main {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.form-section {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.form-section:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 16px;
}

.form-section h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section h2::before {
  content: '';
  width: 4px;
  height: 16px;
  background: var(--accent);
  border-radius: 2px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group.full {
  width: 100%;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row .form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13px;
}

input[type="text"],
input[type="date"],
input[type="number"],
select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition),
    background var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

input[type="text"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
  background: #0b1220;
}

input::placeholder {
  color: var(--text-muted);
}

input.invalid,
select.invalid {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.05);
}

select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'><path fill='%2394a3b8' d='M7 10L2 5h10z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 36px;
  cursor: pointer;
}

.hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.file-input-wrapper {
  position: relative;
}

.file-input-wrapper input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.file-input-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 28px 16px;
  background: var(--bg-input);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  transition: all var(--transition);
  min-height: 120px;
  text-align: center;
}

.file-input-display .icon {
  font-size: 32px;
}

.file-input-display .text {
  font-size: 14px;
}

.file-input-wrapper:hover .file-input-display,
.file-input-wrapper.dragover .file-input-display {
  border-color: var(--border-focus);
  background: rgba(59, 130, 246, 0.05);
  color: var(--text-primary);
}

#fotoPreview {
  display: none;
  max-width: 160px;
  max-height: 200px;
  margin: 12px auto 0;
  border-radius: 8px;
  border: 2px solid var(--border);
}

#fotoPreview.visible {
  display: block;
}

button[type="submit"] {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), #1d4ed8);
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  min-height: 50px;
  margin-top: 8px;
}

button[type="submit"]:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-hover), #1e40af);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

button[type="submit"]:active:not(:disabled) {
  transform: translateY(0);
}

button[type="submit"]:disabled {
  background: #475569;
  cursor: not-allowed;
  opacity: 0.7;
  box-shadow: none;
}

.loading {
  display: none;
  align-items: center;
  gap: 8px;
}

.loading.active {
  display: inline-flex;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.alert {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideDown 0.3s ease;
}

.alert.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid var(--success);
  color: #6ee7b7;
}

.alert.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--danger);
  color: #fca5a5;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

footer {
  text-align: center;
  margin-top: 32px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ===== Tablet ===== */
@media (max-width: 768px) {
  .container {
    padding: 20px 12px 32px;
  }
  main {
    padding: 20px 16px;
  }
  header {
    margin-bottom: 24px;
  }
  .logo {
    width: 56px;
    height: 56px;
    font-size: 20px;
  }
}

/* ===== Mobile ===== */
@media (max-width: 560px) {
  .container {
    padding: 16px 10px 24px;
  }
  main {
    padding: 16px 14px;
    border-radius: 12px;
  }
  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .form-row .form-group {
    margin-bottom: 16px;
  }
  .form-section {
    margin-bottom: 22px;
    padding-bottom: 18px;
  }
  header h1 {
    font-size: 1.4rem;
  }
  header p {
    font-size: 13px;
  }
  .logo {
    width: 48px;
    height: 48px;
    font-size: 18px;
    margin-bottom: 12px;
  }
  input[type="text"],
  input[type="date"],
  input[type="number"],
  select {
    font-size: 16px;
    padding: 10px 12px;
  }
  button[type="submit"] {
    font-size: 15px;
    padding: 12px;
  }
  .file-input-display {
    padding: 20px 12px;
    min-height: 100px;
  }
}

/* ===== Very small screens ===== */
@media (max-width: 360px) {
  .container {
    padding: 12px 8px 20px;
  }
  main {
    padding: 14px 10px;
  }
  header h1 {
    font-size: 1.2rem;
  }
}

/* ===== Print ===== */
@media print {
  body {
    background: #fff;
    color: #000;
  }
  .container, main, header, footer {
    background: transparent;
    box-shadow: none;
  }
}