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

:root {
  --azul: #1a73e8;
  --azul-hover: #1557b0;
  --verde: #34a853;
  --vermelho: #ea4335;
  --cinza-bg: #f5f5f5;
  --cinza-borda: #ddd;
  --texto: #333;
  --texto-leve: #666;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--cinza-bg);
  color: var(--texto);
  min-height: 100vh;
  padding: 16px;
}

header {
  background: var(--azul);
  color: white;
  padding: 14px 16px;
  margin: -16px -16px 20px -16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

header h1 {
  font-size: 18px;
  font-weight: 600;
}

.header-logo {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.card {
  background: white;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card-titulo {
  font-size: 13px;
  font-weight: 600;
  color: var(--texto-leve);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

/* Busca RAT */
.busca-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.busca-row input {
  flex: 1;
}

/* Tarefa encontrada */
.tarefa-info {
  display: none;
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 10px;
}

.tarefa-info .tarefa-nome {
  font-weight: 600;
  font-size: 15px;
  color: #2e7d32;
}

.tarefa-info .tarefa-sub {
  font-size: 13px;
  color: #388e3c;
  margin-top: 2px;
}

/* Formulário */
.form-group {
  margin-bottom: 14px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 5px;
  color: var(--texto);
}

label .obrigatorio {
  color: var(--vermelho);
  margin-left: 2px;
}

select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--cinza-borda);
  border-radius: 6px;
  font-size: 15px;
  font-family: inherit;
  color: var(--texto);
  background: white;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.2s;
}

select:focus {
  outline: none;
  border-color: var(--azul);
}

input[type="text"],
input[type="number"],
input[type="datetime-local"],
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--cinza-borda);
  border-radius: 6px;
  font-size: 15px;
  font-family: inherit;
  color: var(--texto);
  background: white;
  -webkit-appearance: none;
  transition: border-color 0.2s;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--azul);
}

textarea {
  min-height: 80px;
  resize: vertical;
}

input[type="number"] {
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

/* Botões */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 16px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-buscar {
  background: var(--azul);
  color: white;
  width: auto;
  padding: 10px 16px;
  font-size: 14px;
  white-space: nowrap;
  border-radius: 6px;
}

.btn-buscar:hover:not(:disabled) {
  background: var(--azul-hover);
}

.btn-submeter {
  background: var(--verde);
  color: white;
  margin-top: 4px;
  font-size: 16px;
  padding: 15px;
}

.btn-submeter:hover:not(:disabled) {
  background: #2d9247;
}

/* Formulário oculto até buscar */
#formulario {
  display: none;
}

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

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

/* Mensagem de resultado */
.mensagem {
  display: none;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  margin-top: 12px;
  text-align: center;
}

.mensagem.sucesso {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.mensagem.erro {
  background: #fdecea;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

.mensagem.aviso {
  background: #fff8e1;
  color: #f57f17;
  border: 1px solid #ffe082;
}

/* Tags da tarefa (empresa - equipamento - manutenção) */
.tarefa-tags {
  font-size: 12px;
  color: #2e7d32;
  margin-top: 4px;
  font-weight: 500;
}

/* Badges de informação da tarefa */
.tarefa-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.badge-pecas {
  background: #fff3e0;
  color: #bf360c;
  border: 1px solid #ffcc80;
}

.badge-prev-sim {
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #90caf9;
}

.badge-prev-nao {
  background: #f5f5f5;
  color: #616161;
  border: 1px solid #e0e0e0;
}

/* ── Tela de Sucesso ──────────────────────────────────────────────────────── */
#telaSuccesso {
  position: fixed;
  inset: 0;
  background: white;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 80px 32px 48px;
  z-index: 200;
}

#telaSuccesso.visivel {
  display: flex;
}

.sucesso-corpo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.sucesso-check {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--verde);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: popIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sucesso-check svg {
  width: 52px;
  height: 52px;
}

.sucesso-polyline {
  stroke-dasharray: 70;
  stroke-dashoffset: 70;
  animation: drawCheck 0.4s ease-out 0.25s forwards;
}

@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

@keyframes drawCheck {
  to { stroke-dashoffset: 0; }
}

.sucesso-titulo {
  font-size: 24px;
  font-weight: 700;
  color: var(--texto);
}

.sucesso-rat-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sucesso-rat-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--verde);
}

.sucesso-rat-nome {
  font-size: 14px;
  color: var(--texto-leve);
}

.btn-proxima {
  width: 100%;
  padding: 16px;
  background: var(--azul);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-proxima:active {
  background: var(--azul-hover);
}

/* Upload area */
.upload-area {
  text-align: center;
  padding: 8px 0 4px;
}

.btn-upload {
  background: #f0f4ff;
  color: var(--azul);
  border: 1.5px dashed var(--azul);
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
}

.btn-upload:hover {
  background: #e0eaff;
}

.upload-hint {
  font-size: 12px;
  color: var(--texto-leve);
  margin-top: 6px;
}

/* Preview lista */
.preview-lista {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.preview-item {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--cinza-borda);
  background: #f5f5f5;
  flex-shrink: 0;
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-item .video-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.preview-item .remover {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Ícones (emoji) */
.icone {
  font-size: 20px;
}
