* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f4f4f2; color: #222; margin: 0; font-size: 16px; padding-top: 52px;
}
/* ====== NAV (mobile-first, hamburger) ====== */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  background: #1f2937; height: 52px; padding: 0 12px;
}
#menuToggle {
  background: none; border: none; color: #fff;
  font-size: 28px; cursor: pointer; padding: 8px 4px; line-height: 1;
}
#navLinks {
  display: none; position: fixed; top: 52px; left: 0; right: 0;
  background: #1f2937; flex-direction: column; padding: 4px 0 12px; z-index: 99;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
#navLinks.open { display: flex; }
#navLinks a {
  color: #d1d5db; text-decoration: none; padding: 16px 20px;
  font-size: 17px; border-bottom: 1px solid #374151;
}
#navLinks a:last-child { border-bottom: none; }
#navLinks a.active, #navLinks a:hover { color: #fff; background: #111827; }
#navLinks .spacer { display: none; }
#logoutBtn {
  background: none; border: none; color: #ef4444; cursor: pointer;
  font-size: 17px; padding: 16px 20px; text-align: left; width: 100%;
  border-top: 1px solid #374151; margin-top: 8px;
}
/* fechar ao clicar fora - overlay */
#navOverlay {
  display: none; position: fixed; top: 52px; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3); z-index: 98;
}
#navOverlay.open { display: block; }

/* ====== MAIN ====== */
main { max-width: 960px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 0 0 16px; }
.card {
  background: #fff; border: 1px solid #e5e5e0;
  border-radius: 12px; padding: 16px; margin-bottom: 16px;
}
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ====== FORMULARIOS ====== */
input, select {
  width: 100%; padding: 14px 12px; border: 1px solid #d1d5db;
  border-radius: 8px; font-size: 16px; background: #fff;
  -webkit-appearance: none; appearance: none;
}
button.primary, button.danger, button.secondary {
  border: none; border-radius: 8px; cursor: pointer;
  font-size: 16px; min-height: 48px; padding: 12px 20px;
  display: inline-flex; align-items: center; justify-content: center;
}
button.primary { background: #2563eb; color: #fff; }
button.danger { background: #dc2626; color: #fff; }
button.secondary { background: #e5e7eb; color: #222; }
button:disabled { opacity: 0.5; cursor: default; }

/* ====== TABELAS ====== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th, td { text-align: left; padding: 12px 8px; border-bottom: 1px solid #eee; font-size: 15px; }
th { font-size: 13px; color: #6b7280; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.thumb-wrap { width: 52px; height: 36px; overflow: hidden; border-radius: 6px; background: #ddd; display: flex; align-items: center; justify-content: center; }
.thumb, .thumb-wrap img, .thumb-wrap video { width: 100%; height: 100%; object-fit: cover; background: #ddd; }

/* ====== MISC ====== */
.muted { color: #888; font-size: 14px; }
#progressBar { width:100%; height:10px; background:#e5e7eb; border-radius:5px; overflow:hidden; }
#progressFill { height:100%; width:0%; background:#2563eb; transition:width 0.15s ease; }
#progressLabel { font-size: 13px; }
.stat-value { font-size: 26px; font-weight: 700; color: #111827; }
.stat-label { font-size: 13px; color: #6b7280; margin-top: 2px; }
.login-box { max-width: 360px; margin: 60px 16px; }
.error { color: #dc2626; font-size: 14px; margin-top: 6px; }
code.token { background: #f1f1ee; padding: 3px 8px; border-radius: 4px; font-size: 14px; word-break: break-all; }

/* ====== MOBILE ====== */
@media (max-width: 768px) {
  .table-wrap { overflow-x: visible; margin: 0; }
  table { min-width: auto; }
  thead { display: none; }
  tbody, tr { display: block; }
  tr {
    border: 1px solid #e5e5e0; border-radius: 12px;
    padding: 12px; margin-bottom: 12px; background: #fff;
  }
  td {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; border-bottom: 1px solid #f0f0f0;
  }
  td:last-child { border-bottom: none; }
  td::before {
    content: attr(data-label); font-weight: 600; font-size: 12px;
    color: #6b7280; flex-shrink: 0; margin-right: 8px; text-transform: uppercase;
  }
  td:empty::before, td[data-label=""]::before { display: none; }
  .thumb-wrap { width: 100%; height: auto; aspect-ratio: 16/9; max-height: 160px; }
  .thumb, .thumb-wrap img, .thumb-wrap video { object-fit: contain; }
}

/* ====== DESKTOP ====== */
@media (min-width: 769px) {
  body { padding-top: 48px; font-size: 14px; }
  nav { height: 48px; padding: 0 16px; display: flex; }
  #menuToggle { display: none; }
  #navLinks {
    display: flex; position: static; flex-direction: row; align-items: center;
    background: none; padding: 0; box-shadow: none; flex: 1;
  }
  #navLinks a { padding: 14px 12px; font-size: 14px; border-bottom: none; }
  #navLinks a.active, #navLinks a:hover { color: #fff; background: #111827; }
  #navLinks .spacer { display: block; flex: 1; }
  #logoutBtn {
    width: auto; border-top: none; margin-top: 0; padding: 14px 12px;
    font-size: 14px; color: #d1d5db;
  }
  #logoutBtn:hover { color: #fff; background: #111827; }
  #navOverlay { display: none !important; }
  main { padding: 24px 16px; }
  h1 { font-size: 20px; }
  .card { padding: 16px; }
  input, select { width: auto; min-width: 200px; padding: 8px 10px; font-size: 14px; }
  button.primary, button.danger, button.secondary { padding: 9px 14px; font-size: 14px; min-height: auto; }
  th, td { font-size: 14px; padding: 8px; }

  /* Cards em grid responsivo no desktop */
  .table-wrap { overflow-x: visible; margin: 0; }
  table { min-width: auto; }
  thead { display: none; }
  tbody { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
  tr {
    display: flex; flex-direction: column;
    border: 1px solid #e5e5e0; border-radius: 12px;
    padding: 12px; background: #fff; margin: 0;
  }
  td {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; border-bottom: 1px solid #f0f0f0;
  }
  td:last-child { border-bottom: none; }
  td::before {
    content: attr(data-label); font-weight: 600; font-size: 12px;
    color: #6b7280; flex-shrink: 0; margin-right: 8px; text-transform: uppercase;
  }
  td:empty::before, td[data-label=""]::before { display: none; }
  .thumb-wrap { width: 100%; height: auto; aspect-ratio: 16/9; max-height: 200px; }
  .thumb, .thumb-wrap img, .thumb-wrap video { object-fit: contain; }

  .login-box { margin: 80px auto; }
  .stat-value { font-size: 28px; }
  .muted { font-size: 13px; }
}
