:root {
  --primary: #004e92; /* Azul segurança */
  --primary-dark: #003366;
  --secondary: #ff6b6b; /* Alerta suave */
  --bg-body: #f4f6f9;
  --bg-card: #ffffff;
  --text-main: #2c3e50;
  --text-muted: #7f8c8d;
  --border-color: #e9ecef;
  --success: #27ae60;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
}

/* Reset e Base */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  font-size: 16px;
  line-height: 1.5;
}

/* Utilitários */
.page-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: linear-gradient(135deg, #004e92 0%, #000428 100%); /* Fundo mais bonito para login/home */
}
.page-center .card { box-shadow: 0 10px 25px rgba(0,0,0,0.2); }
.hidden { display: none !important; }
.muted { color: var(--text-muted); font-size: 0.9em; }

/* Tipografia */
h1, h2, h3 { margin-top: 0; font-weight: 700; color: var(--primary-dark); }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }

/* Cards */
.card, .form-card, .login-card, .hero-card {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 24px;
  width: 100%;
  max-width: 500px;
  margin: 0 auto 20px auto;
  border: 1px solid rgba(0,0,0,0.05);
}

.hero-card { text-align: center; padding: 40px 24px; }
.hero-card h1 { color: #333; margin-bottom: 10px; }
.hero-card h1 span { color: var(--primary); }

/* Inputs */
input, select {
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid #ced4da;
  background-color: #f8f9fa;
  font-size: 16px;
  margin-bottom: 16px;
  transition: border-color 0.2s;
  appearance: none; /* Mobile feel */
}
input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(0, 78, 146, 0.1);
}
label.lab {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-main);
  text-align: left;
}

/* Botões */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
  text-decoration: none;
  text-align: center;
}
button:active, .btn:active { transform: scale(0.98); }

.btn-primary { background-color: var(--primary); color: white; }
.btn-primary:hover { background-color: var(--primary-dark); }

.btn-outline {
  background-color: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover { background-color: rgba(0, 78, 146, 0.05); }

.ghost { background: transparent; color: var(--text-muted); padding: 8px; font-size: 14px; }
.ghost:hover { color: var(--text-main); background: rgba(0,0,0,0.05); }

.small { padding: 8px 12px; font-size: 13px; width: auto; }

/* Header/Topbar Mobile */
.topbar-collab {
  background: var(--primary);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  margin-bottom: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-collab h1 { color: white; font-size: 18px; margin: 0 0 0 10px; }
.topbar-collab .ghost { color: rgba(255,255,255,0.8); border: 1px solid rgba(255,255,255,0.2); }

/* Layout Grid */
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

/* Listas e Tabelas */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th { background: #f8f9fa; text-transform: uppercase; font-size: 12px; letter-spacing: 0.5px; color: var(--text-muted); padding: 12px; text-align: left; }
td { padding: 12px; border-bottom: 1px solid var(--border-color); font-size: 14px; }
tr:last-child td { border-bottom: none; }

/* Admin Sidebar & Layout */
.app { display: flex; min-height: 100vh; background: var(--bg-body); }
.sidebar {
  width: 260px;
  background: #fff;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 20px;
}
.sidebar h2 { color: var(--primary); font-size: 20px; margin-bottom: 30px; line-height: 1.2; }
.sidebar nav button {
  background: transparent;
  color: var(--text-muted);
  justify-content: flex-start;
  margin-bottom: 8px;
  text-align: left;
}
.sidebar nav button.active {
  background: rgba(0, 78, 146, 0.1);
  color: var(--primary);
}
.main { flex: 1; padding: 20px; overflow-y: auto; height: 100vh; }

/* KPIs */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi { background: white; padding: 20px; border-radius: 12px; box-shadow: var(--shadow); text-align: center; }
.kpi-title { font-size: 13px; color: var(--text-muted); text-transform: uppercase; margin-bottom: 8px; }
.kpi-value { font-size: 28px; font-weight: 800; color: var(--primary); }

/* Offline Toast */
.offline-toast {
  position: fixed;
  bottom: 80px; /* Acima do botão de instalar */
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: #34495e;
  color: white;
  padding: 12px 24px;
  border-radius: 50px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  opacity: 0;
  pointer-events: none;
}
.offline-toast.visible { transform: translateX(-50%) translateY(0); opacity: 1; pointer-events: auto; }

/* Install Prompt */
.install-prompt {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: white;
  padding: 20px;
  box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
  z-index: 10000;
  transform: translateY(100%);
  transition: transform 0.3s ease-out;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.install-prompt.visible { transform: translateY(0); }
.install-prompt p { margin: 0 0 16px 0; font-size: 15px; color: var(--text-main); font-weight: 500; }
.install-btn { background: var(--primary); color: white; width: 100%; border-radius: 12px; padding: 16px; font-size: 16px; }

/* Responsivo */
@media (max-width: 768px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; padding: 16px; border-right: none; border-bottom: 1px solid var(--border-color); }
  .sidebar h2 { font-size: 18px; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
  .sidebar nav { display: flex; overflow-x: auto; gap: 10px; padding-bottom: 5px; }
  .sidebar nav button { width: auto; white-space: nowrap; margin: 0; padding: 8px 16px; }
  .main { padding: 16px; height: auto; overflow: visible; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
  
  /* Ajuste tabela mobile */
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
}
