*{
  box-sizing:border-box;
}

:root{
  --laranja:#f97316;
  --laranja-escuro:#ea580c;
  --vermelho:#ef4444;
  --vermelho-escuro:#dc2626;
  --bg:#f4f6f9;
  --texto:#0f172a;
  --muted:#64748b;
  --card:#ffffff;
  --borda:#e5e7eb;
  --shadow:0 10px 25px rgba(15,23,42,0.08);
  --shadow-strong:0 18px 45px rgba(15,23,42,0.18);
  --header-h:84px;
  --sidebar-w:310px;
}

html, body{
  overflow-x:hidden;
}

body{
  margin:0;
  font-family:'Segoe UI', sans-serif;
  background:var(--bg);
  color:var(--texto);
}

/* ================== SIDEBAR ================== */
.sidebar-overlay{
  position:fixed;
  inset:0;
  background:rgba(2,6,23,.42);
  backdrop-filter:blur(2px);
  opacity:0;
  pointer-events:none;
  transition:opacity .25s ease;
  z-index:1190;
}

.sidebar{
  position:fixed;
  top:0;
  right:0;
  width:var(--sidebar-w);
  max-width:88vw;
  height:100vh;
  background:#ffffff;
  box-shadow:var(--shadow-strong);
  transform:translateX(105%);
  transition:transform .28s ease;
  z-index:1200;
  display:flex;
  flex-direction:column;
  border-left:1px solid rgba(15,23,42,0.06);
}

body.menu-open .sidebar{
  transform:translateX(0);
}

body.menu-open .sidebar-overlay{
  opacity:1;
  pointer-events:auto;
}

.sidebar-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:18px 18px 14px;
  border-bottom:1px solid #eef2f7;
}

.sidebar-brand{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
}

.brand-icon{
  width:44px;
  height:44px;
  border-radius:14px;
  background:linear-gradient(135deg, #f97316 0%, #fb923c 100%);
  color:#fff;
  display:grid;
  place-items:center;
  font-size:20px;
  font-weight:900;
  box-shadow:0 10px 20px rgba(249,115,22,.22);
}

.brand-title{
  font-size:16px;
  font-weight:900;
  color:#0f172a;
}

.brand-subtitle{
  font-size:12px;
  color:#64748b;
  font-weight:700;
}

.sidebar-close{
  width:40px;
  height:40px;
  border:none;
  border-radius:12px;
  background:#f8fafc;
  color:#334155;
  cursor:pointer;
  font-size:18px;
  font-weight:800;
  transition:.18s ease;
  flex-shrink:0;
}

.sidebar-close:hover{
  background:#fff1e8;
  color:var(--laranja-escuro);
}

.sidebar-profile{
  margin:16px 16px 10px;
  padding:16px;
  border-radius:18px;
  background:linear-gradient(135deg, #fff7ed 0%, #ffffff 100%);
  border:1px solid #fed7aa;
  display:flex;
  align-items:center;
  gap:14px;
}

.profile-avatar{
  width:56px;
  height:56px;
  border-radius:18px;
  background:linear-gradient(135deg, #f97316 0%, #fb923c 100%);
  color:#fff;
  display:grid;
  place-items:center;
  font-size:22px;
  font-weight:900;
  flex-shrink:0;
  box-shadow:0 12px 24px rgba(249,115,22,.22);
}

.profile-info{
  min-width:0;
}

.profile-label{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.8px;
  color:#94a3b8;
  font-weight:900;
  margin-bottom:4px;
}

.profile-name{
  font-size:16px;
  font-weight:900;
  color:#0f172a;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.profile-role{
  font-size:13px;
  color:#64748b;
  font-weight:700;
  margin-top:2px;
}

.sidebar-nav{
  padding:8px 12px 18px;
  overflow:auto;
  flex:1;
}

.nav-btn{
  width:100%;
  border:none;
  background:transparent;
  display:flex;
  align-items:center;
  gap:12px;
  padding:14px 14px;
  border-radius:16px;
  cursor:pointer;
  font-size:15px;
  font-weight:800;
  color:#0f172a;
  transition:.18s ease;
  margin-bottom:6px;
}

.nav-btn:hover{
  background:#fff7ed;
  color:var(--laranja-escuro);
  transform:translateX(2px);
}

.nav-btn.active{
  background:linear-gradient(90deg, #fff1e8 0%, #fff7ed 100%);
  color:var(--laranja-escuro);
  box-shadow:inset 0 0 0 1px #fed7aa;
}

.nav-icon{
  width:24px;
  text-align:center;
  font-size:17px;
  flex-shrink:0;
}

.sidebar-bottom{
  padding:14px 16px 18px;
  border-top:1px solid #eef2f7;
  background:#fff;
}

.sidebar-logout{
  width:100%;
}

/* ================== HEADER ================== */
.main-header{
  position:fixed;
  top:0;
  left:0;
  width:100%;
  height:var(--header-h);
  z-index:1000;

  background:linear-gradient(90deg, #f97316 0%, #fb7b1f 100%);
  color:#fff;
  box-shadow:0 8px 24px rgba(0,0,0,0.10);

  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;

  padding:12px 22px;
}

.header-left{
  display:flex;
  align-items:center;
  gap:14px;
  min-width:0;
  flex:1;
}

.header-title-wrap{
  min-width:0;
  flex:1;
}

.hamburger-btn{
  margin-left:auto;
  width:48px;
  height:48px;
  border:none;
  border-radius:14px;
  background:rgba(255,255,255,0.18);
  cursor:pointer;
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:5px;
  padding:0 12px;
  transition:.18s ease;
  flex-shrink:0;
}



.hamburger-btn{
  width:48px;
  height:48px;
  border:none;
  border-radius:14px;
  background:rgba(255,255,255,0.18);
  cursor:pointer;
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:5px;
  padding:0 12px;
  transition:.18s ease;
  flex-shrink:0;
}

.hamburger-btn:hover{
  background:rgba(255,255,255,0.28);
  transform:translateY(-1px);
}

.hamburger-btn span{
  display:block;
  width:100%;
  height:3px;
  border-radius:999px;
  background:#fff;
}

.header-title-wrap{
  min-width:0;
}

#welcome{
  margin:0;
  font-size:17px;
  font-weight:900;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  line-height:1.15;
}

.header-page{
  display:block;
  margin-top:4px;
  color:rgba(255,255,255,0.84);
  font-size:12px;
  font-weight:700;
}

.header-right{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:12px;
}

.profile-chip{
  border:none;
  background:rgba(255,255,255,0.18);
  color:#fff;
  height:48px;
  padding:0 14px 0 10px;
  border-radius:16px;
  cursor:pointer;
  display:flex;
  align-items:center;
  gap:10px;
  transition:.18s ease;
  max-width:260px;
}

.profile-chip:hover{
  background:rgba(255,255,255,0.28);
  transform:translateY(-1px);
}

.profile-chip-avatar{
  width:30px;
  height:30px;
  border-radius:10px;
  background:rgba(255,255,255,0.24);
  display:grid;
  place-items:center;
  font-size:14px;
  font-weight:900;
  flex-shrink:0;
}

.profile-chip-text{
  font-size:14px;
  font-weight:800;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* ================== CONTAINER ================== */
.container{
  max-width:1200px;
  margin:0 auto;
  padding:28px;
  margin-top:calc(var(--header-h) + 22px);
}

/* ================== CARDS ================== */
.card{
  background:var(--card);
  padding:30px;
  border-radius:18px;
  box-shadow:var(--shadow);
  border:1px solid rgba(15,23,42,0.04);
}

h3{
  margin:0 0 22px;
  font-size:20px;
  font-weight:900;
  color:#0b1b3a;
}

/* ================== KPIS ================== */
.kpis{
  display:grid;
  grid-template-columns:repeat(4, 1fr);
  gap:16px;
  margin-bottom:20px;
}

.kpi{
  background:#fff;
  padding:18px 18px 16px;
  border-radius:18px;
  box-shadow:var(--shadow);
  border:1px solid rgba(15,23,42,0.04);
}

.kpi-title{
  font-size:11px;
  color:#64748b;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.7px;
}

.kpi-value{
  margin-top:8px;
  font-size:27px;
  font-weight:900;
  color:#0b1b3a;
  line-height:1.1;
}

.kpi-sub{
  margin-top:8px;
  color:#64748b;
  font-size:12px;
  font-weight:700;
}

/* ================== FORM GRID ================== */
.grid{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:22px;
}

label{
  display:block;
  font-size:13px;
  font-weight:800;
  color:#0f172a;
  margin-bottom:8px;
}

input,
select{
  width:100%;
  height:48px;
  padding:0 14px;
  border:1px solid #d6dbe3;
  border-radius:12px;
  outline:none;
  transition:all .15s ease;
  background:#fff;
  font-size:15px;
  color:#0f172a;
}

input::placeholder{
  color:#94a3b8;
}

input:focus,
select:focus{
  border-color:var(--laranja);
  box-shadow:0 0 0 4px rgba(249,115,22,0.14);
}

/* ================== BOTÃO ================== */
.save-wrapper.full{
  grid-column:1 / -1;
  display:flex;
  align-items:center;
  gap:14px;
  margin-top:4px;
}

button.salvar,
.logout{
  min-width:210px;
  height:48px;
  padding:0 20px;
  background:var(--laranja);
  color:#fff;
  border:none;
  border-radius:14px;
  cursor:pointer;
  font-weight:900;
  transition:all .18s ease;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  position:relative;
  box-shadow:0 10px 20px rgba(249,115,22,0.22);
}

button.salvar:hover{
  background:var(--laranja-escuro);
  transform:translateY(-1px);
}

.logout{
  background:var(--vermelho);
  box-shadow:0 8px 18px rgba(239,68,68,0.28);
}

.logout:hover{
  background:var(--vermelho-escuro);
  transform:translateY(-1px);
}

button.salvar:disabled{
  opacity:.88;
  cursor:not-allowed;
  transform:none;
}

.btn-spinner{
  width:18px;
  height:18px;
  border:3px solid rgba(255,255,255,.35);
  border-top:3px solid #fff;
  border-radius:50%;
  display:none;
  animation:spin 1s linear infinite;
}

@keyframes spin{
  to{ transform:rotate(360deg); }
}

button.salvar.btn-success{
  background:#22c55e !important;
  box-shadow:0 10px 20px rgba(34,197,94,0.22);
}

button.salvar.btn-loading{
  pointer-events:none;
}

#saveHint{
  color:#64748b;
  font-size:12px;
  font-weight:700;
}

/* ================== ALERT ================== */
.form-alert{
  background:#fee2e2;
  color:#991b1b;
  padding:13px 14px;
  border-radius:12px;
  margin:0 0 18px;
  font-size:14px;
  font-weight:800;
  display:none;
  transform:translateY(-10px);
  opacity:0;
  transition:all .35s ease;
}

.form-alert.show{
  display:block;
  transform:translateY(0);
  opacity:1;
}

.form-alert.hide{
  transform:translateY(-10px);
  opacity:0;
}

.input-error{
  border:2px solid #ef4444 !important;
  background:#fff5f5;
}

.error-message{
  color:#ef4444;
  font-size:12px;
  margin-top:6px;
  font-weight:800;
}

/* ================== FOOTER ================== */
.footer{
  margin-top:60px;
  background:#081a3a;
  color:#fff;
  padding:22px 20px;
  text-align:center;
  font-size:14px;
}

.footer a{
  color:#ffb36b;
  text-decoration:none;
  font-weight:800;
}

.footer a:hover{
  text-decoration:underline;
}

/* ================== RESPONSIVO ================== */
@media (max-width: 1150px){
  .kpis{
    grid-template-columns:repeat(2, 1fr);
  }
}

@media (max-width: 980px){
  .grid{
    grid-template-columns:repeat(2, 1fr);
  }

  .container{
    padding:22px;
  }

  .profile-chip-text{
    max-width:120px;
  }
}

@media (max-width: 640px){
  :root{
    --header-h:78px;
  }

  #welcome{
    font-size:15px;
  }

  .header-page{
    font-size:11px;
  }

  .profile-chip{
    padding-right:10px;
  }

  .profile-chip-text{
    display:none;
  }

  .grid{
    grid-template-columns:1fr;
  }

  .save-wrapper.full{
    flex-direction:column;
    align-items:stretch;
  }

  button.salvar,
  .logout{
    width:100%;
    min-width:unset;
  }

  .kpis{
    grid-template-columns:1fr;
  }

  .container{
    padding:18px;
  }

  .card{
    padding:22px;
  }

  .sidebar{
    width:min(86vw, 320px);
  }
}

.header-right{
  display:flex;
  align-items:center;
  gap:12px;
}






.notification-btn{
  position:relative;
  width:42px;
  height:42px;
  min-width:42px;
  border:none;
  border-radius:10px;
  background:rgba(255,255,255,.18);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  transition:.2s ease;
  box-shadow:none;
  padding:0;
  font-size:18px;
}

.notification-btn:hover{
  background:rgba(255,255,255,.28);
  transform:translateY(-1px);
}

.notification-btn:active{
  transform:translateY(0);
}

.notification-badge{
  position:absolute;
  top:-6px;
  right:-6px;
  min-width:20px;
  height:20px;
  padding:0 5px;
  border-radius:999px;
  background:#ef4444;
  color:#fff;
  font-size:11px;
  font-weight:800;
  display:flex;
  align-items:center;
  justify-content:center;
  line-height:1;
  border:2px solid #f97316;
  box-shadow:0 4px 10px rgba(0,0,0,.18);
}

.painel-notificacoes{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.28);
  z-index:9998;
  display:none;
  align-items:flex-start;
  justify-content:flex-end;
  padding:86px 18px 18px;
}

.painel-notificacoes.show{
  display:flex;
}

.painel-notificacoes-box{
  width:min(420px, 100%);
  max-height:calc(100vh - 110px);
  overflow:auto;
  background:#fff;
  border-radius:18px;
  box-shadow:0 20px 50px rgba(15,23,42,.20);
  border:1px solid #e5e7eb;
}

.painel-notificacoes-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:16px 18px;
  border-bottom:1px solid #f1f5f9;
}

.painel-notificacoes-head h3{
  margin:0;
  font-size:18px;
  color:#0f172a;
}

.painel-notificacoes-head button{
  border:none;
  background:#fff7ed;
  color:#ea580c;
  width:34px;
  height:34px;
  border-radius:10px;
  cursor:pointer;
  font-size:20px;
  font-weight:700;
}

.notificacao-item{
  padding:14px 16px;
  border-bottom:1px solid #f1f5f9;
}

.notificacao-item:last-child{
  border-bottom:none;
}

.notificacao-item h4{
  margin:0 0 6px;
  font-size:15px;
  color:#0f172a;
}

.notificacao-item p{
  margin:0 0 8px;
  font-size:14px;
  color:#475569;
  line-height:1.45;
}

.notificacao-meta{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  font-size:12px;
  color:#94a3b8;
}

.notificacao-vazia{
  padding:22px 16px;
  text-align:center;
  color:#64748b;
  font-size:14px;
}

.toast-aviso{
  position:fixed;
  top:92px;
  right:18px;
  z-index:9999;
  width:min(360px, calc(100vw - 36px));
  background:#fff;
  border-left:5px solid #f97316;
  border-radius:16px;
  box-shadow:0 18px 45px rgba(15,23,42,.20);
  padding:14px 16px;
  display:none;
}

.toast-aviso.show{
  display:block;
  animation:toastIn .25s ease;
}

.toast-aviso strong{
  display:block;
  color:#0f172a;
  margin-bottom:6px;
  font-size:14px;
}

.toast-aviso span{
  display:block;
  color:#475569;
  font-size:13px;
  line-height:1.4;
}

@keyframes toastIn{
  from{
    opacity:0;
    transform:translateY(-8px);
  }
  to{
    opacity:1;
    transform:translateY(0);
  }
}

.notification-icon{
  display:flex;
  align-items:center;
  justify-content:center;
  line-height:1;
}

.btn-marcar-lido{
  border:none;
  background:linear-gradient(135deg,#f97316,#ea580c);
  color:#fff;
  min-height:34px;
  padding:8px 14px;
  border-radius:10px;
  font-size:12px;
  font-weight:700;
  cursor:pointer;
  transition:.2s ease;
  box-shadow:0 8px 18px rgba(249,115,22,.18);
}

.btn-marcar-lido:hover{
  transform:translateY(-1px);
  box-shadow:0 10px 22px rgba(249,115,22,.24);
}

.notificacao-item p{
  margin:0;
  font-size:14px;
  line-height:1.55;
  color:#475569;
  white-space:normal;
  word-break:break-word;
  overflow-wrap:anywhere;
}

.notificacao-link{
  color:#ea580c;
  font-weight:700;
  text-decoration:none;
  word-break:break-word;
  overflow-wrap:anywhere;
}

.notificacao-link:hover{
  text-decoration:underline;
}

.btn-marcar-lido{
  border:none;
  background:linear-gradient(135deg,#f97316,#ea580c);
  color:#fff;
  min-height:34px;
  padding:8px 14px;
  border-radius:10px;
  font-size:12px;
  font-weight:700;
  cursor:pointer;
  transition:.2s ease;
  box-shadow:0 8px 18px rgba(249,115,22,.18);

  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}

.btn-marcar-lido:hover{
  transform:translateY(-1px);
}

.btn-marcar-lido:disabled{
  opacity:.7;
  cursor:not-allowed;
}

.btn-spinner{
  width:14px;
  height:14px;
  border:2px solid rgba(255,255,255,.4);
  border-top-color:#fff;
  border-radius:50%;
  display:none;
  animation:spin .7s linear infinite;
}

.btn-marcar-lido.loading .btn-spinner{
  display:block;
}

@keyframes spin{
  to{ transform:rotate(360deg); }
}

.import-overlay{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.45);
  z-index:99999;
  display:none;
  align-items:center;
  justify-content:center;
  padding:20px;
}

.import-overlay-box{
  width:min(420px, 100%);
  background:#fff;
  border-radius:20px;
  padding:24px;
  box-shadow:0 25px 60px rgba(0,0,0,.20);
  text-align:center;
}

.import-spinner{
  width:42px;
  height:42px;
  margin:0 auto 14px;
  border:4px solid rgba(249,115,22,.20);
  border-top-color:#f97316;
  border-radius:50%;
  animation:importSpin .8s linear infinite;
}

.import-progress{
  width:100%;
  height:12px;
  background:#e5e7eb;
  border-radius:999px;
  overflow:hidden;
  margin-top:14px;
}

.import-progress-bar{
  width:0%;
  height:100%;
  background:linear-gradient(90deg,#f97316,#ea580c);
  transition:width .25s ease;
}

.import-progress-label{
  margin-top:10px;
  font-weight:800;
  color:#0f172a;
}

@keyframes importSpin{
  to{ transform:rotate(360deg); }
}