:root {
  --verde: #78A028;
  --verde-escuro: #4A7A10;
  --dourado: #C8A000;
  --dourado-claro: #E8C020;
  --branco: #FFFFFF;
  --cinza-claro: #F5F5F5;
  --cinza-medio: #E0E0E0;
  --cinza-texto: #333333;
  --cinza-sub: #666666;
  --grad-primary: linear-gradient(135deg, #78A028 0%, #4A7A10 100%);
  --grad-dourado: linear-gradient(135deg, #C8A000 0%, #E8C020 100%);
  --grad-hero: linear-gradient(135deg, #4A7A10 0%, #78A028 60%, #C8A000 100%);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-header: 0 4px 20px rgba(0, 0, 0, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--cinza-texto);
  background: var(--cinza-claro);
  min-height: 100vh;
}

a {
  cursor: pointer;
  color: var(--verde-escuro);
}

button {
  font-family: inherit;
}

/* ---------- LOGIN ---------- */
.login-screen {
  min-height: 100vh;
  background: var(--grad-hero);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-header);
  width: 100%;
  max-width: 420px;
  padding: 36px 36px 28px;
}

.login-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.login-logo-wrap img {
  height: 52px;
}

.login-card h1 {
  text-align: center;
  font-size: 19px;
  font-weight: 700;
  margin-top: 12px;
  color: var(--cinza-texto);
}

.login-card .sub {
  text-align: center;
  font-size: 12.5px;
  color: var(--cinza-sub);
  margin-top: 4px;
  margin-bottom: 24px;
}

.login-error {
  background: #FDECEA;
  color: #C62828;
  font-size: 12.5px;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.pw-wrap {
  position: relative;
}

.pw-wrap .toggle-eye {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--cinza-sub);
  font-weight: 600;
  user-select: none;
}

.login-btn {
  width: 100%;
  margin-top: 6px;
}

.quick-login {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.quick-login button {
  flex: 1;
  font-size: 11.5px;
  padding: 9px 6px;
}

.demo-toggle {
  text-align: center;
  margin-top: 18px;
  font-size: 12px;
}

.demo-creds {
  margin-top: 12px;
  border: 1px solid var(--cinza-medio);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.demo-creds table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.demo-creds th {
  background: var(--cinza-claro);
  text-align: left;
  padding: 6px 8px;
  font-weight: 600;
  color: var(--cinza-sub);
}

.demo-creds td {
  padding: 6px 8px;
  border-top: 1px solid var(--cinza-medio);
}

.login-policy-note {
  text-align: center;
  font-size: 11px;
  color: var(--cinza-sub);
  margin-top: 18px;
  line-height: 1.5;
}

/* ---------- SHELL ---------- */
.pv-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.pv-header {
  background: var(--grad-hero);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-header);
  flex-shrink: 0;
}

.pv-logo {
  height: 36px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.pv-header-text h1 {
  color: white;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.pv-header-text p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  margin-top: 1px;
}

.pv-header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.pv-user-chip {
  text-align: right;
}

.pv-user-chip .name {
  color: white;
  font-size: 13px;
  font-weight: 600;
}

.pv-user-chip .role {
  margin-top: 2px;
}

.pv-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.pv-sidebar {
  width: 240px;
  background: white;
  border-right: 1px solid var(--cinza-medio);
  padding: 18px 0;
  flex-shrink: 0;
}

.pv-sidebar-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 24px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--cinza-sub);
  cursor: pointer;
  border-left: 4px solid transparent;
}

.pv-sidebar-item svg {
  flex-shrink: 0;
  opacity: .85;
}

.pv-sidebar-item:hover {
  background: var(--cinza-claro);
}

.pv-sidebar-item.active {
  background: #EEF5E0;
  color: var(--verde-escuro);
  border-left-color: var(--verde);
  font-weight: 700;
}

.pv-main {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 48px;
}

/* ---------- BADGES ---------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
}

.badge-admin {
  background: var(--dourado);
  color: white;
}

.badge-gestor {
  background: var(--verde-escuro);
  color: white;
}

.badge-usuario {
  background: var(--verde);
  color: white;
}

.badge-diretor {
  background: var(--grad-hero);
  color: white;
}

.badge-financeiro {
  background: var(--dourado-claro);
  color: #4A3B00;
}

.badge-ativo {
  background: #E8F5E9;
  color: #2E7D32;
}

.badge-bloqueado {
  background: #FDECEA;
  color: #C62828;
}

.badge-ok {
  background: #EEF5E0;
  color: var(--verde-escuro);
}

.badge-warn {
  background: #FFF9E6;
  color: #8a6d00;
}

.badge-expired {
  background: #FDECEA;
  color: #C62828;
}

.badge-app {
  background: var(--cinza-claro);
  color: var(--cinza-texto);
  border: 1px solid var(--cinza-medio);
  font-weight: 600;
}

/* ---------- SECTION / KPI / TABLE (brand patterns) ---------- */
.pv-section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 32px 12px;
}

.accent-bar {
  width: 4px;
  height: 24px;
  background: var(--grad-dourado);
  border-radius: 2px;
  flex-shrink: 0;
}

.pv-section-title h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--cinza-texto);
}

.pv-section-title .flexgap {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.section-badge {
  background: var(--verde);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  padding: 8px 32px 8px;
}

.kpi-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 18px 22px;
  box-shadow: var(--shadow-card);
}

.kpi-card.kpi-verde {
  border-left: 4px solid var(--verde);
}

.kpi-card.kpi-dourado {
  border-left: 4px solid var(--dourado);
}

.kpi-card.kpi-red {
  border-left: 4px solid #C62828;
}

.kpi-label {
  font-size: 10.5px;
  color: var(--cinza-sub);
  text-transform: uppercase;
  letter-spacing: .6px;
  font-weight: 600;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--cinza-texto);
  margin: 6px 0 2px;
}

.kpi-note {
  font-size: 11.5px;
  color: var(--cinza-sub);
}

.table-wrap {
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow-x: auto;
  margin: 8px 32px 24px;
}

.pv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  min-width: 640px;
}

.pv-table thead tr {
  background: var(--grad-primary);
}

.pv-table th {
  color: white;
  font-weight: 600;
  padding: 11px 14px;
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .4px;
  white-space: nowrap;
}

.pv-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--cinza-medio);
  color: var(--cinza-texto);
  vertical-align: middle;
}

.pv-table tbody tr:nth-child(even) {
  background: var(--cinza-claro);
}

.pv-table tbody tr:hover {
  background: #EEF5E0;
}

.pv-table td.actions {
  white-space: nowrap;
}

.pv-table code {
  font-size: 11.5px;
  background: var(--cinza-claro);
  padding: 2px 6px;
  border-radius: 4px;
}

.empty-row td {
  text-align: center;
  color: var(--cinza-sub);
  padding: 28px;
  font-style: italic;
}

.funnel-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.funnel-label {
  width: 150px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.funnel-label span:first-child {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--cinza-texto);
}

.funnel-count {
  font-size: 10.5px;
  color: var(--cinza-sub);
}

.funnel-bar-bg {
  flex: 1;
  height: 10px;
  background: var(--cinza-medio);
  border-radius: 5px;
  overflow: hidden;
}

.funnel-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width .5s ease;
}

.funnel-pct {
  width: 40px;
  font-size: 12px;
  font-weight: 700;
  color: var(--verde-escuro);
  text-align: right;
  flex-shrink: 0;
}

.funnel-wrap {
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  margin: 8px 32px 24px;
  padding: 6px 24px 18px;
}

/* ---------- APP TILES ---------- */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
  padding: 8px 32px 8px;
}

.app-tile {
  background: white;
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-card);
  border-top: 4px solid var(--verde);
  transition: transform .15s ease;
}

.app-tile:hover {
  transform: translateY(-3px);
}

.app-tile .app-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
  background: var(--cinza-claro);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.app-tile .sigla {
  font-size: 22px;
  font-weight: 800;
  color: var(--verde-escuro);
  letter-spacing: .5px;
}


.app-tile .nome {
  font-size: 12.5px;
  color: var(--cinza-sub);
  margin: 5px 0 6px;
  min-height: 32px;
}

.app-tile .meta {
  font-size: 11px;
  color: var(--cinza-sub);
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-tile .meta b {
  color: var(--cinza-texto);
}

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--cinza-sub);
}

.empty-state .big {
  font-size: 38px;
  margin-bottom: 10px;
}

/* ---------- FORMS / BUTTONS ---------- */
.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform .12s, box-shadow .12s;
  white-space: nowrap;
}

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

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(120, 160, 40, .35);
}

.btn-secondary {
  background: white;
  color: var(--cinza-texto);
  border: 1px solid var(--cinza-medio);
}

.btn-secondary:hover {
  background: var(--cinza-claro);
}

.btn-danger {
  background: #FDECEA;
  color: #C62828;
}

.btn-danger:hover {
  background: #fadbd8;
}

.btn-ghost-white {
  background: rgba(255, 255, 255, .15);
  color: white;
  border: 1px solid rgba(255, 255, 255, .45);
}

.btn-ghost-white:hover {
  background: rgba(255, 255, 255, .28);
}

.btn-sm {
  padding: 6px 11px;
  font-size: 11.5px;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.btn[disabled] {
  opacity: .5;
  cursor: not-allowed;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--cinza-sub);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.form-hint {
  font-size: 11px;
  color: var(--cinza-sub);
  margin-top: 4px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.form-control {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--cinza-medio);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--cinza-texto);
  background: white;
}

.form-control:focus {
  outline: none;
  border-color: var(--verde);
  box-shadow: 0 0 0 3px rgba(120, 160, 40, .15);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 11px;
  font-size: 13px;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--verde);
}

.checklist-item {
  font-size: 12px;
  color: var(--cinza-sub);
  padding: 3px 0;
  display: flex;
  gap: 7px;
  align-items: center;
}

.checklist-item .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cinza-medio);
  flex-shrink: 0;
}

.checklist-item.valid {
  color: #2E7D32;
  font-weight: 600;
}

.checklist-item.valid .dot {
  background: #2E7D32;
}

.app-checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 14px;
}

/* ---------- MODALS / TOAST / ALERTS ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 30, 20, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-box {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-header);
}

.modal-box.narrow {
  max-width: 420px;
}

.modal-header {
  padding: 18px 26px;
  border-bottom: 1px solid var(--cinza-medio);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 15.5px;
  font-weight: 700;
}

.modal-header .x {
  cursor: pointer;
  font-size: 20px;
  color: var(--cinza-sub);
  line-height: 1;
}

.modal-body {
  padding: 22px 26px;
}

.modal-footer {
  padding: 15px 26px;
  border-top: 1px solid var(--cinza-medio);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--cinza-texto);
  color: white;
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-header);
  z-index: 2000;
  font-size: 13px;
  font-weight: 500;
  max-width: 340px;
}

.toast.success {
  background: #2E7D32;
}

.toast.error {
  background: #C62828;
}

.alert-banner {
  margin: 16px 32px 0;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.alert-banner.warn {
  background: #FFF9E6;
  color: #7a6100;
  border: 1px solid #f0d878;
}

.alert-banner.expired {
  background: #FDECEA;
  color: #9c2020;
  border: 1px solid #f0b8b8;
}

.alert-banner a {
  font-weight: 700;
  text-decoration: underline;
}

.alert-banner .close-x {
  cursor: pointer;
  font-weight: 700;
  opacity: .6;
}

.pv-footer {
  background: white;
  border-top: 3px solid var(--dourado);
  padding: 12px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--cinza-sub);
  margin-top: 12px;
}

.pw-preview-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--cinza-claro);
  border-radius: var(--radius-sm);
  margin-top: 8px;
}

.pw-preview-box .mask-sample {
  font-size: 18px;
  letter-spacing: 3px;
  color: var(--cinza-texto);
}

.rule-text {
  font-size: 12.5px;
  color: var(--cinza-sub);
  background: var(--cinza-claro);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  line-height: 1.6;
  margin-top: 6px;
}

.progress-track {
  height: 12px;
  background: var(--cinza-medio);
  border-radius: 6px;
  overflow: hidden;
  margin: 10px 0 6px;
}

.progress-fill {
  height: 100%;
  border-radius: 6px;
  transition: width .5s ease;
}

@media (max-width: 860px) {
  .pv-body {
    flex-direction: column;
  }

  .pv-sidebar {
    width: 100%;
    display: flex;
    overflow-x: auto;
    padding: 8px 4px;
    border-right: none;
    border-bottom: 1px solid var(--cinza-medio);
  }

  .pv-sidebar-item {
    border-left: none;
    border-bottom: 4px solid transparent;
    padding: 10px 16px;
    white-space: nowrap;
  }

  .pv-sidebar-item.active {
    border-left-color: transparent;
    border-bottom-color: var(--verde);
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .app-checkbox-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Adições para a versão real (backend) ---------- */
.loading-note {
  padding: 48px;
  text-align: center;
  color: var(--cinza-sub);
  font-size: 13px;
}

.toggle-eye {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--cinza-sub);
  cursor: pointer;
  display: flex;
}

.toggle-eye svg {
  opacity: .7;
}

.toggle-eye:hover svg {
  opacity: 1;
}