:root {
  --blue-dark: #071425;
  --blue-mid: #1f4fa8;
  --blue-light: #7cb8ff;
  --blue-soft: #d9ecff;
  --surface: rgba(12, 24, 48, 0.90);
  --surface-strong: rgba(14, 32, 64, 0.94);
  --text: #eef5ff;
  --border: rgba(255, 255, 255, 0.10);
  --danger: #ff4444;
  --warning: #ffbb33;
  --success: #38ef7d;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 20px 14px;
  font-family: 'Segoe UI', 'Segoe UI Variable', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, rgba(124, 184, 255, 0.22), transparent 24%),
              radial-gradient(circle at bottom right, rgba(35, 87, 189, 0.18), transparent 28%),
              linear-gradient(180deg, #041023 0%, #081b36 36%, #0d2d53 100%);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  -webkit-tap-highlight-color: transparent;
}

#app {
  width: 100%;
  max-width: 580px;
  display: grid;
  gap: 18px;
}

header {
  text-align: center;
  margin-bottom: 10px;
}

.main-logo {
  width: min(170px, 62%);
  max-width: 170px;
  display: block;
  margin: 0 auto 14px;
  background: transparent;
  border: none;
}

h1 {
  color: var(--text);
  font-size: clamp(2rem, 4vw, 2.6rem);
  margin: 0;
  letter-spacing: -0.04em;
}

#subtitulo {
  max-width: 640px;
  color: rgba(238, 245, 255, 0.72);
  font-size: 0.95rem;
  line-height: 1.65;
  margin: 0 auto;
}

.glass-card {
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(18px);
  border-radius: 28px;
  padding: 24px;
  margin-bottom: 0;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.btn-bravo,
.btn-menu,
.btn-add,
.btn-relatorio,
.btn-edit,
.btn-delete {
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease, opacity 0.22s ease;
}

.btn-bravo {
  background: linear-gradient(135deg, var(--blue-light), var(--blue-mid));
  color: white;
  border: none;
  padding: 16px 18px;
  border-radius: 999px;
  width: 100%;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  box-shadow: 0 18px 34px rgba(29, 95, 215, 0.26);
}

.btn-bravo:hover,
.btn-menu:hover,
.btn-add:hover,
.btn-relatorio:hover,
.btn-prioridade:hover,
.btn-edit:hover,
.btn-delete:hover {
  transform: translateY(-1px);
}

.btn-bravo:active,
.btn-menu:active {
  transform: translateY(0);
}

.btn-escuro {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(124, 184, 255, 0.24);
  color: var(--text);
  margin-top: 10px;
  border-radius: 999px;
  min-height: 56px;
}

.btn-menu {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(124, 184, 255, 0.14);
  color: var(--text);
  padding: 14px 16px;
  border-radius: 24px;
  cursor: pointer;
  font-size: 0.98rem;
  width: 100%;
  text-align: left;
}

.btn-add {
  background: var(--blue-light);
  color: #081227;
  border-radius: 18px;
  padding: 0 16px;
  min-width: 56px;
  font-weight: bold;
  border: none;
  cursor: pointer;
}

.btn-export {
  background: #5ff2c8 !important;
  color: #081227 !important;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  padding: 16px;
  margin-bottom: 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(9, 23, 44, 0.92);
  color: var(--text);
  font-size: 1rem;
  outline: none;
}

label {
  font-size: 0.9rem;
  color: rgba(238, 245, 255, 0.82);
  margin-bottom: 6px;
  display: block;
  font-weight: 600;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(124, 184, 255, 0.85);
  box-shadow: 0 0 0 4px rgba(124, 184, 255, 0.12);
}

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

.hidden {
  display: none !important;
}

.grid-botoes {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.divisor {
  text-align: center;
  margin: 20px 0;
  font-size: 0.96rem;
  color: rgba(238, 245, 255, 0.72);
}

.row {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.scroll-lista {
  max-height: 420px;
  overflow-y: auto;
  margin-top: 16px;
  padding-right: 5px;
}

.scroll-lista::-webkit-scrollbar {
  width: 8px;
}

.scroll-lista::-webkit-scrollbar-thumb {
  background: rgba(124, 184, 255, 0.30);
  border-radius: 999px;
}

.preview-img {
  width: 100%;
  border-radius: 16px;
  display: none;
  margin-top: 10px;
  height: auto;
  max-height: 200px;
  object-fit: cover;
}

.canvas-container {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(124, 184, 255, 0.32);
  background: #ffffff;
  touch-action: none;
}

canvas {
  background: white;
  width: 100%;
  height: 180px;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.btn-voltar {
  background: none;
  border: none;
  color: rgba(238, 245, 255, 0.82);
  width: 100%;
  margin-top: 16px;
  cursor: pointer;
  text-decoration: underline;
  font-size: 0.95rem;
}

.checklist-box {
  border: 1px dashed rgba(124, 184, 255, 0.55);
  padding: 18px;
  color: rgba(172, 211, 255, 0.95);
  margin-bottom: 20px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checklist-box label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  cursor: pointer;
}

.checklist-box input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 12px;
}

th, td {
  padding: 10px 8px;
}

th {
  border-bottom: 1px solid rgba(124, 184, 255, 0.18);
  text-align: left;
  color: rgba(238, 245, 255, 0.88);
}

.status-badge {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.status-concluida {
  background: #38ef7d;
  color: #081227;
}

.status-pendente {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.subtexto {
  font-size: 13px;
  opacity: 0.78;
  margin-top: 6px;
  margin-bottom: 12px;
}

.btn-relatorio {
  background: linear-gradient(135deg, #7cb8ff, #1f52ba);
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 16px;
  cursor: pointer;
  margin-top: 10px;
  font-weight: 600;
  width: 100%;
}

.form-materiais {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 18px;
  margin-bottom: 16px;
  background: rgba(9, 23, 44, 0.92);
}

.grid-prioridades {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.btn-prioridade {
  padding: 18px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  transition: all 0.22s ease;
}

.btn-prioridade.urgente {
  background: #ff5c74;
  color: white;
}

.btn-prioridade.alto {
  background: #ff9a3f;
  color: white;
}

.btn-prioridade.medio {
  background: #ffd45d;
  color: #081227;
}

.btn-prioridade.baixa {
  background: #39ff14;
  color: #081227;
}

.btn-prioridade.active {
  box-shadow: 0 0 0 4px rgba(124, 184, 255, 0.35);
  transform: scale(1.02);
}

input[type="password"] {
  font-family: monospace;
}

/* CARDS COM BOTÕES DE AÇÃO (EDITAR E EXCLUIR) */
.item-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(124, 184, 255, 0.15);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.item-info {
  flex: 1;
  line-height: 1.4;
}

.item-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-edit {
  background: rgba(124, 184, 255, 0.18);
  border: 1px solid rgba(124, 184, 255, 0.35);
  color: #7cb8ff;
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-delete {
  background: rgba(255, 68, 68, 0.18);
  border: 1px solid rgba(255, 68, 68, 0.35);
  color: #ff6b6b;
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* MODAL OVERLAY */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 16, 35, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  padding: 16px;
}

.modal-card {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-card h3 {
  margin-top: 0;
  margin-bottom: 16px;
  color: var(--blue-light);
}

/* LOADING OVERLAY SPINNER */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 16, 35, 0.92);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 100000;
  color: var(--text);
  font-weight: 600;
  gap: 16px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 5px solid rgba(124, 184, 255, 0.2);
  border-top-color: var(--blue-light);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* REGRAS DE IMPRESSÃO DEDICADAS PARAE FALLBACK IMPRESSÃO/PDF */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  #app, .modal-overlay, .loading-overlay {
    display: none !important;
  }
  #pdf-container {
    display: block !important;
    position: static !important;
    width: 100% !important;
    background: #ffffff !important;
    color: #000000 !important;
  }
}

@media (max-width: 480px) {
  body {
    padding: 12px 10px;
  }
  .glass-card {
    padding: 18px;
    border-radius: 22px;
  }
  .grid-botoes {
    grid-template-columns: 1fr;
  }
}
