/* =========== VARIÁVEIS E RESET =========== */
:root {
  --green: #4a7c2f;
  --green-light: #6aab45;
  --green-dark: #2d5a1b;
  --black: #1a1a1a;
  --gray-dark: #3d3d3d;
  --gray: #7a7a7a;
  --gray-light: #c8c8c8;
  --gray-bg: #f5f5f5;
  --white: #ffffff;
  --red: #c0392b;
  --orange: #e67e22;
  --gold: #f39c12;
  --blue: #2980b9;
  --teal: #27ae60;
  --shadow: 0 2px 12px rgba(0,0,0,0.10);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.13);
  --radius: 8px;
  --radius-lg: 14px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: var(--gray-bg); color: var(--black); min-height: 100vh; }

/* =========== LOGIN =========== */
#login-screen {
  position: fixed; inset: 0; background: linear-gradient(135deg, #1a2e0f 0%, #2d5a1b 40%, #4a7c2f 100%);
  display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.login-card {
  background: var(--white); border-radius: 20px; padding: 48px 40px; width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4); text-align: center;
}
.login-logo { width: 240px; margin: 0 auto 24px; display: block; }
.login-card h2 { color: var(--green-dark); font-size: 1.15rem; margin-bottom: 28px; font-weight: 500; }
.form-group { margin-bottom: 16px; text-align: left; }
.form-group label { display: block; font-size: 0.82rem; color: var(--gray); font-weight: 600; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.form-input {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--gray-light); border-radius: 8px;
  font-size: 0.95rem; outline: none; transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--green); }
.btn-login {
  width: 100%; padding: 13px; background: var(--green); color: white; border: none;
  border-radius: 8px; font-size: 1rem; font-weight: 700; cursor: pointer;
  margin-top: 8px; transition: background 0.2s;
}
.btn-login:hover { background: var(--green-dark); }
.login-hint { font-size: 0.78rem; color: var(--gray); margin-top: 20px; }

/* =========== LAYOUT =========== */
#app { display: none; min-height: 100vh; flex-direction: column; }
.topbar {
  background: var(--white); border-bottom: 2px solid var(--green); padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; height: 64px;
  position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow);
}
.topbar-logo { height: 40px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.user-badge {
  display: flex; align-items: center; gap: 8px; background: var(--gray-bg);
  padding: 6px 14px; border-radius: 20px; font-size: 0.85rem; cursor: pointer;
}
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--green);
  color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem;
}
.btn-logout { background: none; border: 1.5px solid var(--gray-light); padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 0.82rem; color: var(--gray); }
.btn-logout:hover { border-color: var(--red); color: var(--red); }

.layout { display: flex; flex: 1; }
.sidebar {
  width: 240px; background: var(--black); min-height: calc(100vh - 64px);
  position: sticky; top: 64px; padding: 16px 0;
}
.sidebar-section { padding: 8px 16px 4px; font-size: 0.68rem; color: #666; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; margin-top: 8px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 18px;
  color: #aaa; cursor: pointer; font-size: 0.88rem; transition: all 0.15s;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: #222; color: white; }
.nav-item.active { background: #1a1a1a; color: var(--green-light); border-left-color: var(--green-light); }
.nav-icon { font-size: 1.1rem; width: 20px; text-align: center; }

.main { flex: 1; padding: 24px; overflow-x: auto; }
.page { display: none; }
.page.active { display: block; }

/* =========== CARDS =========== */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 1.5rem; color: var(--green-dark); font-weight: 700; }
.page-header p { color: var(--gray); font-size: 0.88rem; margin-top: 4px; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  background: var(--white); border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow); border-left: 4px solid var(--green);
}
.kpi-card.red { border-left-color: var(--red); }
.kpi-card.orange { border-left-color: var(--orange); }
.kpi-card.gold { border-left-color: var(--gold); }
.kpi-card.blue { border-left-color: var(--blue); }
.kpi-label { font-size: 0.75rem; color: var(--gray); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.kpi-value { font-size: 2rem; font-weight: 800; color: var(--black); margin: 4px 0; }
.kpi-sub { font-size: 0.78rem; color: var(--gray); }

.card { background: var(--white); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--gray-bg); }
.card-title { font-size: 1rem; font-weight: 700; color: var(--black); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* =========== BADGES =========== */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; }
.badge-approved { background: #d4edda; color: #155724; }
.badge-rejected { background: #f8d7da; color: #721c24; }
.badge-partial { background: #fff3cd; color: #856404; }
.badge-na { background: #e2e3e5; color: #383d41; }
.badge-major { background: #fde8d8; color: #8a3a00; }
.badge-minor { background: #e8f4fd; color: #0c4a7c; }
.badge-bronze { background: #f5e6c8; color: #7a5000; }
.badge-silver { background: #e8e8e8; color: #333; }
.badge-gold { background: #fff4c2; color: #7a5000; }

/* =========== TABELA =========== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th { background: var(--gray-bg); padding: 10px 12px; text-align: left; font-size: 0.75rem; color: var(--gray); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; border-bottom: 2px solid var(--gray-light); }
td { padding: 10px 12px; border-bottom: 1px solid var(--gray-bg); vertical-align: middle; }
tr:hover td { background: #fafff8; }

/* =========== FORMULÁRIO =========== */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-row.full { grid-template-columns: 1fr; }
.form-row.triple { grid-template-columns: 1fr 1fr 1fr; }
.field-group { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 0.78rem; color: var(--gray-dark); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.field-input, .field-select, .field-textarea {
  padding: 9px 12px; border: 1.5px solid var(--gray-light); border-radius: 6px; font-size: 0.88rem; outline: none;
  transition: border-color 0.2s; background: white;
}
.field-input:focus, .field-select:focus, .field-textarea:focus { border-color: var(--green); }
.field-textarea { resize: vertical; min-height: 80px; }

/* =========== BOTÕES =========== */
.btn { padding: 9px 18px; border-radius: 6px; border: none; cursor: pointer; font-size: 0.85rem; font-weight: 600; transition: all 0.15s; display: inline-flex; align-items: center; gap: 6px; }
.btn-primary { background: var(--green); color: white; }
.btn-primary:hover { background: var(--green-dark); }
.btn-secondary { background: var(--gray-bg); color: var(--gray-dark); border: 1px solid var(--gray-light); }
.btn-secondary:hover { background: var(--gray-light); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #a93226; }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-outline { background: transparent; border: 1.5px solid var(--green); color: var(--green); }
.btn-outline:hover { background: var(--green); color: white; }

/* =========== CHECKLIST =========== */
.criteria-section { margin-bottom: 24px; }
.criteria-header {
  background: var(--green-dark); color: white; padding: 10px 16px; border-radius: 8px 8px 0 0;
  font-weight: 700; font-size: 0.9rem; display: flex; align-items: center; justify-content: space-between;
}
.criteria-body { border: 1px solid var(--gray-light); border-top: none; border-radius: 0 0 8px 8px; }
.checklist-item { padding: 12px 16px; border-bottom: 1px solid var(--gray-bg); }
.checklist-item:last-child { border-bottom: none; }
.item-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.item-number { font-weight: 800; color: var(--green-dark); min-width: 36px; font-size: 0.85rem; }
.item-text { font-size: 0.83rem; color: var(--gray-dark); flex: 1; line-height: 1.4; }
.item-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.radio-group { display: flex; gap: 6px; }
.radio-opt { display: flex; align-items: center; gap: 4px; font-size: 0.78rem; cursor: pointer; }
.radio-opt input { accent-color: var(--green); cursor: pointer; }

/* =========== BARRA DE PROGRESSO =========== */
.progress-bar { background: var(--gray-bg); border-radius: 10px; height: 10px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 10px; background: linear-gradient(90deg, var(--green) 0%, var(--green-light) 100%); transition: width 0.5s; }

/* =========== ABAS =========== */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--gray-light); margin-bottom: 20px; }
.tab { padding: 10px 20px; cursor: pointer; font-size: 0.88rem; font-weight: 600; color: var(--gray); border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all 0.15s; }
.tab.active { color: var(--green-dark); border-bottom-color: var(--green-dark); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* =========== MODAL =========== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: none; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: white; border-radius: 14px; padding: 28px; width: 680px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-md); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--gray-bg); }
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--gray); }

/* =========== NOTIFICAÇÕES =========== */
.notify { position: fixed; top: 80px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.notify-item {
  background: white; border-radius: 8px; padding: 14px 18px; box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 10px; font-size: 0.88rem;
  border-left: 4px solid var(--green); min-width: 280px; animation: slideIn 0.3s ease;
}
.notify-item.error { border-left-color: var(--red); }
.notify-item.warn { border-left-color: var(--orange); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* =========== BARRA DE BUSCA =========== */
.search-bar { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.search-input { flex: 1; min-width: 200px; padding: 9px 14px; border: 1.5px solid var(--gray-light); border-radius: 6px; font-size: 0.88rem; outline: none; }
.search-input:focus { border-color: var(--green); }

/* =========== INDICADOR DE NÍVEL =========== */
.nivel-meter { display: flex; flex-direction: column; gap: 6px; }
.nivel-row { display: flex; align-items: center; gap: 10px; }
.nivel-name { font-size: 0.8rem; font-weight: 700; width: 60px; }
.nivel-bar { flex: 1; }
.nivel-pct { font-size: 0.78rem; color: var(--gray); width: 40px; text-align: right; }

/* =========== INDICADORES DE RESULTADO =========== */
.result-approved { color: #155724; font-weight: 700; }
.result-rejected { color: var(--red); font-weight: 700; }

/* =========== FOOTER =========== */
footer { background: var(--black); color: #666; text-align: center; padding: 12px; font-size: 0.75rem; }

/* =========== PLANO DE AÇÃO =========== */
.ap-item { border: 1px solid var(--gray-light); border-radius: 8px; padding: 14px; margin-bottom: 12px; }
.ap-item-header { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.nc-badge { background: #fde8d8; color: #8a3a00; padding: 2px 8px; border-radius: 4px; font-size: 0.72rem; font-weight: 700; }

.stat-row { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 10px; }
.stat-item { text-align: center; }
.stat-num { font-size: 1.6rem; font-weight: 800; }
.stat-lbl { font-size: 0.72rem; color: var(--gray); text-transform: uppercase; }

/* =========== IMPORTAÇÃO =========== */
.dropzone {
  border: 2px dashed var(--gray-light); border-radius: 12px; padding: 48px; text-align: center;
  cursor: pointer; transition: all 0.2s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--green); background: #f0f8ea; }
.dropzone-icon { font-size: 3rem; margin-bottom: 12px; }

/* =========== TOOLTIP =========== */
.tooltip { position: relative; cursor: help; }
.tooltip:hover::after {
  content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  background: #333; color: white; padding: 4px 8px; border-radius: 4px; font-size: 0.72rem;
  white-space: nowrap; z-index: 100;
}

/* =========== RESPONSIVO =========== */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
