/* =====================================================================
   F A OLIVA — Sistema de Requisições
   Refresh visual (Camada 1) — identidade vinho/grafite modernizada
   + Listagens e Pendentes em CARTÕES. Somente CSS (drop-in).
   ===================================================================== */

:root {
  --brand:        #D1003F;
  --brand-deep:   #9C0030;
  --brand-wine:   #773C4B;
  --brand-soft:   rgba(209, 0, 63, 0.08);
  --slate-900:    #1C2126;
  --slate-800:    #262D33;
  --slate-600:    #5F626B;
  --bg:           #eef0f3;
  --surface:      #ffffff;
  --line:         #dfe3e8;
  --line-strong:  #cfd4da;
  --muted:        #6b7280;
  --text:         #2b3038;
  --text-soft:    #4b5563;
  --ok:           #2E9E5B;
  --ok-soft:      #e7f5ec;
  --warn:         #E0A800;
  --info:         #2F6FB0;
  --danger:       #D64550;
  --danger-soft:  #fbeaec;
  --shadow-sm:    0 1px 2px rgba(16,24,40,.06);
  --shadow-md:    0 6px 20px rgba(16,24,40,.08);
  --shadow-lg:    0 16px 40px rgba(16,24,40,.18);
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --primary-color:   var(--brand);
  --secondary-color: var(--brand-wine);
}

* {
  margin: 0; padding: 0; box-sizing: border-box;
  font-family: 'Segoe UI', Roboto, Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background:
    radial-gradient(1200px 500px at 50% -120px, #ffffff 0%, rgba(255,255,255,0) 60%),
    linear-gradient(160deg, #eef0f3 0%, #e6e9ee 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
  padding-top: 104px; overflow-x: hidden; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* =========================== HEADER / NAV =========================== */
.header {
  position: fixed; top: 0; left: 0; width: 100%;
  background: linear-gradient(110deg, var(--slate-800) 0%, var(--slate-900) 100%);
  border-bottom: 3px solid var(--brand);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.22);
  z-index: 1000; transition: padding 0.25s ease, box-shadow 0.25s ease;
}
.nav-container {
  max-width: 1240px; margin: 0 auto; display: flex;
  justify-content: space-between; align-items: center; padding: 16px 24px;
}
#logoutBtn { margin: 0; }
.logo { font-size: 24px; font-weight: 700; color: #fff; text-decoration: none; display: flex; align-items: center; }
.logo-icon {
  width: 116px; height: 41px; margin-right: 10px;
  background-image: url("../Imagens/Logo.png");
  background-size: contain; background-repeat: no-repeat; display: inline-block;
}
.nav-menu { display: flex; list-style: none; align-items: center; }
.nav-item { margin-left: 26px; position: relative; }
.nav-link {
  text-decoration: none; color: rgba(255, 255, 255, 0.82);
  font-weight: 500; font-size: 15px; letter-spacing: .2px;
  padding: 10px 2px; display: inline-block; position: relative;
  background-color: transparent; border: 0; cursor: pointer; transition: color 0.18s ease;
}
.nav-link::before {
  content: ''; position: absolute; bottom: 0; left: 0; width: 0; height: 3px;
  background: linear-gradient(to right, var(--brand-wine), var(--brand));
  transition: width 0.3s ease; border-radius: 3px;
}
.nav-link:hover { color: #fff; }
.nav-link:hover::before, .nav-link.active::before { width: 100%; }
.nav-link.active { color: #fff; }
.menu-toggle { display: none; cursor: pointer; }
.bar { width: 26px; height: 3px; background-color: #fff; margin: 5px 0; transition: all 0.3s ease; border-radius: 3px; }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: 100%; left: 0; background-color: #fff;
  box-shadow: var(--shadow-lg); border-radius: var(--r-md); width: 210px; padding: 8px 0;
  opacity: 0; visibility: hidden; transform: translateY(16px); transition: all 0.25s ease; z-index: 100;
}
.dropdown:hover .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(10px); }
.dropdown-item { display: block; padding: 11px 20px; color: var(--text); text-decoration: none; transition: all 0.18s ease; }
.dropdown-item:hover { background-color: var(--brand-soft); color: var(--brand); padding-left: 26px; }
.nav-indicator {
  position: absolute; left: 0; bottom: -3px; height: 3px; border-radius: 3px;
  background: linear-gradient(to right, var(--brand-wine), var(--brand)); transition: all 0.3s ease; width: 100%;
}
main { width: 75%; }

/* =========================== TÍTULOS =========================== */
.title, h1.title {
  width: 92%; max-width: 1080px; margin: 8px auto 4px; font-size: 1.9rem;
  font-weight: 600; letter-spacing: -0.3px; color: var(--slate-900);
  position: relative; padding-bottom: 12px;
}
.title::after {
  content: ''; position: absolute; left: 0; bottom: 0; width: 56px; height: 4px;
  border-radius: 4px; background: linear-gradient(to right, var(--brand), var(--brand-wine));
}
.welcome { color: var(--slate-900); font-weight: 600; }

/* =========================== TABELAS (gestão: usuários/obras) =========================== */
table {
  width: 90%; max-width: 1080px; border-collapse: separate; border-spacing: 0;
  margin: 1.5rem auto 0; background: var(--surface); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--shadow-md); border: 1px solid var(--line);
}
.titulo { max-width: 300px; }
th, td { padding: 14px 18px; text-align: left; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
th {
  background: linear-gradient(180deg, #f6f7f9, #eef0f3); color: var(--slate-900);
  font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: .4px;
  border-bottom: 2px solid var(--line-strong);
}
tbody tr { transition: background 0.15s ease; }
tbody tr:hover { background: #f7f8fa; }
td:last-child, th:last-child { white-space: nowrap; }

/* =====================================================================
   LISTAGEM EM CARTÕES — Todos Pedidos / Minhas Requisições
   (escopado a #tabela-requisicoes; não afeta usuários/obras)
   ===================================================================== */
#tabela-requisicoes {
  width: 92%; max-width: 1080px; margin: 1.5rem auto 0;
  background: transparent; border: none; box-shadow: none; border-radius: 0; display: block;
}
#tabela-requisicoes thead { display: none; }
#tabela-requisicoes tbody { display: block; }

#tabela-requisicoes tbody tr:not(.status-row) {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 14px 36px;
  background: var(--surface); border: 1px solid var(--line); border-bottom: none;
  border-radius: 16px 16px 0 0; padding: 18px 280px 16px 300px; margin-top: 18px;
  position: relative; box-shadow: var(--shadow-md);
}
#tabela-requisicoes tbody tr:not(.status-row)::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--brand); border-radius: 16px 0 0 0;
}
#tabela-requisicoes tbody tr:not(.status-row) td {
  display: flex; flex-direction: column; gap: 3px; align-items: center; text-align: center;
  border: none; padding: 0; font-size: 0.95rem; color: var(--text);
}
#tabela-requisicoes tbody tr:not(.status-row) td::before {
  content: attr(data-label); font-size: 0.66rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; color: var(--muted);
}
/* Título: à esquerda, largura fixa para não empurrar os campos */
#tabela-requisicoes tbody tr:not(.status-row) td.titulo {
  order: 1; flex: 0 0 auto; align-items: flex-start; text-align: left;
  position: absolute; left: 26px; top: 50%; transform: translateY(-50%); max-width: 260px;
  font-size: 1.15rem; font-weight: 700; color: var(--slate-900);
}
#tabela-requisicoes tbody tr:not(.status-row) td.titulo::before { content: "Requisição"; }
/* Demais campos: centralizados de verdade, com respiro */
#tabela-requisicoes tbody tr:not(.status-row) td:not(.titulo):not([data-label="Ações"]) { order: 3; flex: 0 0 auto; }
#tabela-requisicoes tbody tr:not(.status-row) td[data-label="Status"] { font-weight: 600; }
/* Ações: flutuando no canto superior direito */
#tabela-requisicoes tbody tr:not(.status-row) td[data-label="Ações"] {
  order: 4; position: absolute; right: 24px; top: 50%; transform: translateY(-50%);
  flex-direction: row; align-items: center; gap: 8px;
}
#tabela-requisicoes tbody tr:not(.status-row) td[data-label="Ações"]::before { display: none; }

#tabela-requisicoes tbody tr.status-row {
  display: block; background: #fbfcfd; border: 1px solid var(--line);
  border-top: 1px dashed var(--line); border-radius: 0 0 16px 16px;
  margin-bottom: 4px; box-shadow: var(--shadow-md); padding: 0;
}
#tabela-requisicoes tbody tr.status-row td { display: block; border: none; padding: 18px 26px 20px; }

/* fora do @media, junto das regras de #tabela-requisicoes */
#tabela-requisicoes tbody tr:not(.status-row) td[data-label="Ações"] button {
  white-space: nowrap;
}

/* =====================================================================
   PENDENTES — #tabela-pedidos como cartões (sem linha do tempo)
   ===================================================================== */
#tabela-pedidos {
  width: 92%; max-width: 1080px; margin: 1.5rem auto 0;
  background: transparent; border: none; box-shadow: none; border-radius: 0; display: block;
}
#tabela-pedidos thead { display: none; }
#tabela-pedidos tbody { display: block; }
#tabela-pedidos tbody tr {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 26px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 18px 22px 16px 26px; margin-top: 18px;
  position: relative; box-shadow: var(--shadow-md);
}
#tabela-pedidos tbody tr::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--brand); border-radius: 16px 0 0 16px;
}
#tabela-pedidos tbody tr td {
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start; text-align: left;
  border: none; padding: 0; font-size: 0.95rem; color: var(--text);
}
#tabela-pedidos tbody tr td::before {
  content: attr(data-label); font-size: 0.66rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; color: var(--muted);
}
/* Título: topo-esquerda */
#tabela-pedidos tbody tr td[data-label="Titulo"] {
  order: 1; flex: 1 1 100%; font-size: 1.12rem; font-weight: 700; color: var(--slate-900);
}
/* Data de Necessidade: abaixo do título, à esquerda, em negrito */
#tabela-pedidos tbody tr td[data-label="Data Necessidade"] {
  order: 2; flex: 1 1 100%; font-weight: 700; color: var(--slate-900);
}
/* Demais campos: como antes (à esquerda, em sequência) */
#tabela-pedidos tbody tr td:not([data-label="Titulo"]):not([data-label="Data Necessidade"]):not([data-label="Ações"]) { order: 3; flex: 0 1 auto; }
/* Ações: empurradas para a direita */
#tabela-pedidos tbody tr td[data-label="Ações"] {
  order: 4; margin-left: auto; flex-direction: row; align-items: center; gap: 8px;
}
#tabela-pedidos tbody tr td[data-label="Ações"]::before { display: none; }
#tabela-pedidos tbody tr:hover { background: var(--surface); }

/* =========================== CONTEÚDO / FILTROS =========================== */
.content { width: 90%; max-width: 1080px; margin-top: 45pt; text-align: center; }
.content p { color: var(--muted); line-height: 1.6; }
.filtro-box {
  width: 92%; max-width: 1080px; margin: 16px auto 0; display: flex; gap: 16px;
  align-items: flex-end; flex-wrap: wrap; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.filtro-box span { display: flex; flex-direction: column; gap: 4px; }
.filtro-box label { margin-top: 0; font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.filtro { width: 200px; display: inline-block; }

/* =========================== BADGE =========================== */
.badge {
  position: absolute; top: -5px; right: -10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-wine)); color: white;
  border-radius: 50%; width: 20px; height: 20px; display: flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: bold; transform: scale(0);
  transition: transform 0.3s ease; animation: pulse 2s infinite;
}
.badge.show { transform: scale(1); }

/* =========================== FORMULÁRIOS =========================== */
form {
  background: var(--surface); padding: 2rem; border-radius: var(--r-lg);
  box-shadow: var(--shadow-md); border: 1px solid var(--line);
  width: 80%; max-width: 820px; margin: 1.75rem auto;
}
form h3 {
  color: var(--slate-900); font-size: 1.05rem; margin: 1.4rem 0 0.2rem;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
label { display: block; margin-top: 1rem; margin-bottom: 0.2rem; font-weight: 600; font-size: 0.9rem; color: var(--text-soft); }
input, select, textarea {
  text-align: left; padding: 0.7rem 0.85rem; margin-top: 0.25rem;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  font-size: 0.98rem; width: 100%; background: #fff; color: var(--text);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input:disabled, input[readonly], textarea[readonly] { background: #f3f4f6; color: var(--muted); cursor: not-allowed; }

/* =========================== BOTÕES =========================== */
button {
  background-color: var(--brand); color: white; font-weight: 600; border: none; cursor: pointer;
  text-align: center; padding: 0.7rem 1.1rem; margin-top: 0.4rem; border-radius: var(--r-sm);
  font-size: 0.96rem; letter-spacing: .2px;
  transition: transform 0.12s ease, box-shadow 0.16s ease, background 0.16s ease, filter 0.16s ease;
  box-shadow: var(--shadow-sm);
}
button:hover { background-color: var(--brand-deep); transform: translateY(-1px); box-shadow: var(--shadow-md); }
button:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
button:focus-visible { outline: 3px solid var(--brand-soft); outline-offset: 2px; }
.btn-salvar { background-color: var(--ok); }
.btn-salvar:hover { background-color: #25844c; }
.btn-rm { background-color: var(--ok); color: white; }
.btn-rm:hover { background-color: #25844c; }
.btn-devolver { background-color: var(--info); color: white; }
.btn-devolver:hover { background-color: #265d94; }
.btn-adicionar { color: white; text-align: center; width: auto; min-width: 40%; margin: 1rem auto 0; display: block; }
.insumo-group { border: 1px solid var(--line); padding: 1.25rem; margin-top: 1.5rem; border-radius: var(--r-md); background: #fafbfc; }
.actions { margin-top: 2rem; display: flex; gap: 1rem; justify-content: flex-end; }

/* =========================== LOADING =========================== */
.loading {
  position: fixed; inset: 0; width: 100%; height: 100%;
  background: rgba(28, 33, 38, 0.55); backdrop-filter: blur(3px); color: white;
  display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 9999;
}
.telaLoad {
  width: 260px; padding: 28px; border-radius: var(--r-lg); background: var(--surface); color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: var(--shadow-lg);
}
.telaLoad p { margin-top: 4px; font-weight: 600; color: var(--text-soft); }
.spinner { border: 5px solid var(--line); border-top: 5px solid var(--brand); border-radius: 50%; width: 54px; height: 54px; animation: spin 0.9s linear infinite; margin-bottom: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading.hidden { display: none; }

/* =========================== MENSAGENS =========================== */
.success, #mensagem.success { color: var(--ok); font-weight: 700; text-align: center; margin-top: 1rem; }
.error,   #mensagem.error   { color: var(--danger); font-weight: 700; text-align: center; margin-top: 1rem; }
#mensagem { margin-top: 1.5rem; text-align: center; font-weight: 700; font-size: 1.05rem; }
.mensagem { text-align: center; font-weight: 700; margin-top: 0.75rem; padding: 0.6rem 0.9rem; border-radius: var(--r-sm); }
.mensagem.success { color: var(--ok); background: var(--ok-soft); }
.mensagem.error { color: var(--danger); background: var(--danger-soft); }

/* =========================== AUTOCOMPLETE =========================== */
.suggestions {
  position: absolute; border: 1px solid var(--line-strong); max-height: 180px; overflow-y: auto;
  background: white; z-index: 1000; border-radius: var(--r-sm); box-shadow: var(--shadow-md); width: 100%;
}
.suggestions div { padding: 0.6rem 0.75rem; cursor: pointer; }
.suggestions div:hover { background-color: var(--brand-soft); color: var(--brand); }
.suggestion-item { border-bottom: 1px solid var(--line); }

/* =========================== LISTA DE INSUMOS =========================== */
#lista-preview { margin-top: 1rem; border: 1px solid var(--line); border-radius: var(--r-md); padding: 1rem; max-height: 280px; overflow-y: auto; background: #fafbfc; }
.item-preview { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 0.4rem; border-bottom: 1px solid var(--line); }
.item-preview span { flex: 1; color: var(--text); }
.item-preview button { flex: 0 0 auto; background: var(--danger); border: none; color: white; padding: 0.35rem 0.7rem; border-radius: 6px; cursor: pointer; margin-top: 0; }
.item-preview button:hover { background: #b73843; }

/* =========================== BOTÕES DE TABELA =========================== */
.btn { padding: 0.42rem 0.9rem; border: none; border-radius: 6px; cursor: pointer; font-size: 0.88rem; font-weight: 600; margin-right: 0.3rem; margin-top: 0; color: #fff; transition: filter 0.15s ease, transform 0.12s ease; }
.btn:hover { filter: brightness(0.92); transform: translateY(-1px); }
.btn-visualizar-rm { background-color: var(--slate-600); color: white; }
.btn-visualizar    { background-color: var(--slate-600); color: white; }
.btn-editar        { background-color: var(--info); color: white; }
.btn-excluir       { background-color: var(--danger); color: white; }
.btn-enviar        { background-color: var(--ok); color: white; }

/* =========================== MODAL =========================== */
#modal { display: none; position: fixed; inset: 0; background: rgba(28, 33, 38, 0.6); backdrop-filter: blur(4px); justify-content: center; align-items: center; z-index: 1000; padding: 16px; }
#modal-content { background: white; padding: 2rem; border-radius: var(--r-lg); width: 100%; max-width: 760px; position: relative; box-shadow: var(--shadow-lg); max-height: 85vh; overflow-y: auto; border-top: 4px solid var(--brand); }
#modal-content h2 { color: var(--slate-900); margin-bottom: 0.75rem; }
#modal-content p { margin: 0.25rem 0; color: var(--text-soft); }
#modal-content hr { border: none; border-top: 1px solid var(--line); margin: 1rem 0; }
.close-modal, .close { position: absolute; top: 1rem; right: 1.25rem; cursor: pointer; font-size: 1.6rem; line-height: 1; color: var(--muted); transition: color 0.15s ease; }
.close-modal:hover, .close:hover { color: var(--brand); }
.print-modal { position: absolute; top: 3.4rem; right: 1.25rem; cursor: pointer; font-size: 1.3rem; color: var(--muted); background-color: transparent; box-shadow: none; padding: 4px; margin: 0; }
.print-modal:hover { background-color: transparent; color: var(--brand); transform: none; }

/* =========================== PULSE =========================== */
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(209, 0, 63, 0.6); } 70% { box-shadow: 0 0 0 10px rgba(209, 0, 63, 0); } 100% { box-shadow: 0 0 0 0 rgba(209, 0, 63, 0); } }

/* =========================== UNIDADES =========================== */
#unidade-options { display: flex; flex-direction: column; gap: 6px; margin-top: 5px; }
.unidade-option { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.unidade-option input[type="radio"] { accent-color: var(--brand); width: 16px; height: 16px; }
.unidade-label { font-size: 14px; color: var(--text); cursor: pointer; }

/* =========================== STATUS TRACK =========================== */
.status-track { display: flex; justify-content: space-between; position: relative; margin: 12px 0 4px; padding: 0 10px; }
.status-track::before { content: ''; position: absolute; top: 17px; left: 10%; right: 10%; height: 3px; background: var(--line-strong); border-radius: 3px; z-index: 0; }
.status-track .step { text-align: center; position: relative; z-index: 1; flex: 1; }
.status-track .circle { width: 34px; height: 34px; border-radius: 50%; margin: 0 auto; background: #fff; border: 2px solid var(--line-strong); color: var(--muted); display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm); transition: all 0.2s ease; }
.status-track .complete .circle { background: var(--ok); border-color: var(--ok); color: white; }
.status-track .future .circle { background: #fff; border-color: var(--line-strong); color: #aeb4bb; }
.status-track .step-label { margin-top: 8px; font-weight: 600; font-size: 12px; color: var(--text); }
.status-track .date-label { font-size: 11px; color: var(--muted); margin-top: 2px; }
.status-track .step.partial .circle { background-color: var(--warn); border-color: #c79400; color: #fff; }
.status-track .step.partial.complete .circle { background-color: #f0c000; }

/* =========================== OBRAS / CHECKBOXES =========================== */
.linha-obra { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.nome-obra { color: var(--text); }
.checkbox-obra input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand); }

/* =====================================================================
   RESPONSIVO (≤768px)
   ===================================================================== */
@media screen and (max-width: 768px) {
  body { padding-top: 84px; }
  .menu-toggle { display: block; }
  .nav-container { padding: 14px 18px; }

  h1, .title { text-align: center; font-size: 1.5rem; }
  .title { width: 92%; padding-left: 0; }
  .title::after { left: 50%; transform: translateX(-50%); }
  .welcome { margin: 0; padding: 0; font-size: 1rem; }

  .filtro-box { width: 94%; padding: 14px; gap: 12px; }
  .filtro-box span { width: 100%; }
  .filtro { width: 100%; }

  form { width: 94%; padding: 1.3rem; }
  table { width: 94%; margin: 1rem auto; }

  .nav-menu {
    position: fixed; left: -100%; top: 66px; flex-direction: column;
    background: linear-gradient(160deg, var(--slate-800), var(--slate-900));
    width: 100%; text-align: center; transition: 0.3s; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
    padding: 16px 0; height: calc(100vh - 66px); overflow-y: auto; align-items: stretch;
  }
  .nav-menu.active { left: 0; }
  .nav-link { color: #fff; width: 100%; padding: 14px 0; }
  .nav-item { margin: 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
  .nav-item:hover { background: rgba(209, 0, 63, 0.18); }
  .nav-link::before { display: none; }
  .dropdown-menu { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; width: 100%; max-height: 0; overflow: hidden; padding: 0; transition: max-height 0.3s ease; }
  .dropdown.open .dropdown-menu { max-height: 300px; padding: 10px 0; }
  .nav-indicator { display: none; }
  .actions { flex-direction: column; }

  /* Tabelas de gestão (usuários/obras) viram cartão genérico */
  table:not(#tabela-requisicoes):not(#tabela-pedidos),
  table:not(#tabela-requisicoes):not(#tabela-pedidos) thead,
  table:not(#tabela-requisicoes):not(#tabela-pedidos) tbody,
  table:not(#tabela-requisicoes):not(#tabela-pedidos) th,
  table:not(#tabela-requisicoes):not(#tabela-pedidos) td,
  table:not(#tabela-requisicoes):not(#tabela-pedidos) tr { display: block; }
  table:not(#tabela-requisicoes):not(#tabela-pedidos) { border: none; box-shadow: none; background: transparent; }
  table:not(#tabela-requisicoes):not(#tabela-pedidos) thead tr { display: none; }
  table:not(#tabela-requisicoes):not(#tabela-pedidos) tbody tr {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
    box-shadow: var(--shadow-sm); margin-bottom: 14px; padding: 8px 4px 12px;
  }
  table:not(#tabela-requisicoes):not(#tabela-pedidos) td { border-bottom: 1px solid var(--line); }
  table:not(#tabela-requisicoes):not(#tabela-pedidos) tr td:last-child { border-bottom: none; }

  /* Cartões de listagem / pendentes no mobile */
  #tabela-requisicoes, #tabela-pedidos { width: 94%; }
  #tabela-requisicoes tbody tr:not(.status-row),
  #tabela-pedidos tbody tr { gap: 12px; padding: 16px 16px 14px 20px; justify-content: flex-start; }
  #tabela-requisicoes tbody tr:not(.status-row) td,
  #tabela-pedidos tbody tr td { flex: 1 1 40%; align-items: flex-start; text-align: left; }
  /* título volta ao fluxo (sem absolute) no celular */
  #tabela-requisicoes tbody tr:not(.status-row) td.titulo {
    position: static; transform: none; left: auto; top: auto; max-width: none; flex: 1 1 100%;
  }
  #tabela-pedidos tbody tr td[data-label="Titulo"],
  #tabela-pedidos tbody tr td[data-label="Data Necessidade"] { flex: 1 1 100%; }
  /* ações voltam ao fluxo, largura cheia */
  #tabela-requisicoes tbody tr:not(.status-row) td[data-label="Ações"],
  #tabela-pedidos tbody tr td[data-label="Ações"] {
    position: static; right: auto; top: auto; transform: none; flex: 1 1 100%; margin-top: 6px; margin-left: 0;
  }
  #tabela-requisicoes tbody tr:not(.status-row) td[data-label="Ações"] .btn,
  #tabela-requisicoes tbody tr:not(.status-row) td[data-label="Ações"] button,
  #tabela-pedidos tbody tr td[data-label="Ações"] .btn-visualizar,
  #tabela-pedidos tbody tr td[data-label="Ações"] button { flex: 1; }
  #tabela-requisicoes tbody tr.status-row td { padding: 16px; }

  /* Linha do tempo empilha na vertical */
  .status-track { flex-direction: column; gap: 14px; padding: 4px; margin: 6px 0; }
  .status-track::before { display: none; }
  .status-track .step { display: flex; align-items: center; gap: 12px; text-align: left; flex: none; }
  .status-track .circle { margin: 0; flex-shrink: 0; }
  .status-track .step-label, .status-track .date-label { font-size: 13px; margin-top: 0; }
  .status-track .date-label { margin-left: auto; }

  #modal { padding: 10px; }
  #modal-content { padding: 1.4rem; max-height: 90vh; }
  .btn-adicionar { width: 100%; min-width: 0; }

 /* Lista de insumos na tela de editar/nova requisição */
  #lista-preview { padding: 0.6rem; }

  .item-preview {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 10px;
  }
  .item-preview span {
    flex: 1 1 100%;          /* texto ocupa a linha toda */
    font-size: 0.9rem;
    line-height: 1.45;
    word-break: break-word;  /* nome comprido não estoura a tela */
    overflow-wrap: anywhere;
  }
  .item-preview button {
    flex: 0 0 auto;
    min-height: 38px;        /* alvo de toque confortável */
    padding: 0.4rem 1rem;
    margin-top: 0;
  }
/* Campos exclusivos de Minhas Requisições */
  #tabela-requisicoes tbody tr:not(.status-row) td[data-label="Numero RM"],
  #tabela-requisicoes tbody tr:not(.status-row) td[data-label="Tecnico"] {
    flex: 1 1 45%;
  }
  #tabela-requisicoes tbody tr:not(.status-row) td[data-label="Observações"] {
    flex: 1 1 100%;
  }
  /* Três botões (Editar/Enviar/Excluir) dividem a linha */
  #tabela-requisicoes tbody tr:not(.status-row) td[data-label="Ações"] {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  #tabela-requisicoes tbody tr:not(.status-row) td[data-label="Ações"] button {
    flex: 1 1 auto;
    min-height: 38px;
  }
}

@media (prefers-reduced-motion: reduce) { * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }
