/* ========================================================
   MOBILE-FIRST — Sistema de Manutenção
   ======================================================== */

/* ---- Reset / Base ---- */
:root {
  --cor-aberta:      #f59e0b;
  --cor-atribuida:   #3b82f6;
  --cor-execucao:    #8b5cf6;
  --cor-aguardando:  #6b7280;
  --cor-concluida:   #10b981;
  --cor-encerrada:   #1f2937;
  --cor-critica:     #ef4444;
  --cor-alta:        #f59e0b;
  --cor-media:       #3b82f6;
  --cor-baixa:       #6b7280;
  --navbar-h:        56px;
  --bottomnav-h:     64px;
}

body {
  background: #f3f4f6;
  padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
}

/* ---- Navbar ---- */
.navbar {
  height: var(--navbar-h);
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.navbar-brand { font-weight: 700; letter-spacing: .3px; }

/* ---- Container principal ---- */
main.container {
  padding-top: 1rem;
  padding-bottom: 1rem;
  max-width: 680px;
}

/* ---- Cards de ordem ---- */
.ordem-card {
  display: block;
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  border-left: 4px solid #e5e7eb;
  transition: box-shadow .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.ordem-card:active { transform: scale(.98); box-shadow: 0 0 0 rgba(0,0,0,0); }
.ordem-card:hover  { color: inherit; text-decoration: none; }

.ordem-card[data-status="Aberta"]      { border-left-color: var(--cor-aberta); }
.ordem-card[data-status="Atribuída"]   { border-left-color: var(--cor-atribuida); }
.ordem-card[data-status="Em Execução"] { border-left-color: var(--cor-execucao); }
.ordem-card[data-status="Aguardando"]  { border-left-color: var(--cor-aguardando); }
.ordem-card[data-status="Concluída"]   { border-left-color: var(--cor-concluida); }
.ordem-card[data-status="Encerrada"]   { border-left-color: var(--cor-encerrada); }

.ordem-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}
.ordem-titulo {
  font-weight: 600;
  font-size: .97rem;
  line-height: 1.3;
  flex: 1;
}
.ordem-id {
  font-size: .78rem;
  color: #9ca3af;
  white-space: nowrap;
}
.ordem-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }

.badge-status, .badge-prio {
  font-size: .72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  display: inline-block;
}

/* Status */
.badge-status-Aberta      { background: #fef3c7; color: #92400e; }
.badge-status-Atribuída   { background: #dbeafe; color: #1e40af; }
.badge-status-Em-Execução { background: #ede9fe; color: #5b21b6; }
.badge-status-Aguardando  { background: #f3f4f6; color: #374151; }
.badge-status-Concluída   { background: #d1fae5; color: #065f46; }
.badge-status-Encerrada   { background: #1f2937; color: #f9fafb; }

/* Prioridade */
.badge-prio-Crítica { background: #fee2e2; color: #991b1b; }
.badge-prio-Alta    { background: #fef3c7; color: #92400e; }
.badge-prio-Média   { background: #dbeafe; color: #1e40af; }
.badge-prio-Baixa   { background: #f3f4f6; color: #374151; }

.ordem-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: .78rem;
  color: #6b7280;
}
.ordem-meta span { display: flex; align-items: center; gap: 4px; }

/* ---- Chips de filtro ---- */
.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
  flex-shrink: 0;
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: .82rem;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-block;
  transition: background .12s, border-color .12s;
}
.filter-chip.active, .filter-chip:active {
  background: #1f2937;
  border-color: #1f2937;
  color: #fff;
}

/* ---- Painel de busca ---- */
.search-box {
  position: relative;
  margin-bottom: 12px;
}
.search-box input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  font-size: .95rem;
  outline: none;
  transition: border-color .15s;
}
.search-box input:focus { border-color: #374151; }
.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: .9rem;
}

/* ---- Botão flutuante Nova Ordem ---- */
.fab {
  position: fixed;
  right: 20px;
  bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom) + 16px);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #1f2937;
  color: #fff;
  border: none;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  cursor: pointer;
  text-decoration: none;
  z-index: 1020;
  transition: background .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.fab:hover { background: #374151; color: #fff; }
.fab:active { transform: scale(.92); }

/* ---- Bottom navigation ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff;
  border-top: 1px solid #e5e7eb;
  display: flex;
  z-index: 1030;
  box-shadow: 0 -2px 12px rgba(0,0,0,.08);
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: #9ca3af;
  font-size: .68rem;
  font-weight: 500;
  padding-top: 8px;
  -webkit-tap-highlight-color: transparent;
  transition: color .12s;
}
.bottom-nav-item.active { color: #1f2937; }
.bottom-nav-item i { font-size: 1.25rem; }

/* ---- Página de detalhe da ordem ---- */
.detalhe-header {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.detalhe-titulo {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.3;
}
.detalhe-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.detalhe-item { display: flex; flex-direction: column; gap: 2px; }
.detalhe-item .label { font-size: .72rem; color: #9ca3af; text-transform: uppercase; letter-spacing: .5px; }
.detalhe-item .value { font-size: .88rem; font-weight: 600; color: #1f2937; }

.descricao-box {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  font-size: .9rem;
  line-height: 1.6;
  color: #374151;
}

/* ---- Ações (detalhe) ---- */
.acao-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.acao-card h6 { font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; color: #9ca3af; margin-bottom: 12px; }

.btn-acao {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px;
  border-radius: 10px;
  font-size: .92rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  margin-bottom: 8px;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .12s;
}
.btn-acao:active { opacity: .8; }
.btn-assumir   { background: #d1fae5; color: #065f46; }
.btn-status    { background: #1f2937; color: #fff; }
.btn-atribuir  { background: #fef3c7; color: #92400e; }
.btn-comentar  { background: #dbeafe; color: #1e40af; }

/* ---- Histórico ---- */
.log-item {
  padding: 12px 14px;
  border-radius: 10px;
  background: #fff;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.log-meta { font-size: .75rem; color: #9ca3af; margin-bottom: 4px; }
.log-meta b { color: #374151; }
.log-status { font-size: .82rem; margin-bottom: 4px; }
.log-obs { font-size: .88rem; color: #374151; }

/* ---- Formulários ---- */
.form-group-mobile label {
  font-size: .82rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
  display: block;
}
.form-control-mobile {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  font-size: .95rem;
  background: #fff;
  outline: none;
  transition: border-color .15s;
  -webkit-appearance: none;
}
.form-control-mobile:focus { border-color: #1f2937; }

/* ---- Contadores no topo ---- */
.resumo-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 14px;
  -webkit-overflow-scrolling: touch;
}
.resumo-bar::-webkit-scrollbar { display: none; }
.resumo-item {
  flex-shrink: 0;
  background: #fff;
  border-radius: 10px;
  padding: 10px 16px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  min-width: 80px;
}
.resumo-item .num  { font-size: 1.4rem; font-weight: 700; color: #1f2937; line-height: 1; }
.resumo-item .txt  { font-size: .68rem; color: #9ca3af; margin-top: 2px; text-transform: uppercase; letter-spacing: .4px; }
.resumo-item.warn  .num { color: var(--cor-aberta); }
.resumo-item.info  .num { color: var(--cor-execucao); }
.resumo-item.muted .num { color: var(--cor-aguardando); }

/* ---- Modal de filtro avançado ---- */
.modal-filtro .modal-content { border-radius: 20px 20px 0 0; }

/* ---- Seção vazia ---- */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #9ca3af;
}
.empty-state i { font-size: 3rem; margin-bottom: 1rem; display: block; }
.empty-state p { font-size: .95rem; }
