/* ======================================================================
   CONFIGURACOES - ABAS / PRIORIDADES / STATUS / E-MAIL
   ====================================================================== */

.cfg-page-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  margin-bottom:14px;
  gap:16px;
}

.cfg-subtitle{
  color:#94a3b8;
}

.cfg-card{
  padding:0;
  overflow:hidden;
  background:linear-gradient(180deg, rgba(24,28,37,.98) 0%, rgba(17,22,31,.98) 100%);
  border:1px solid rgba(255,255,255,.07);
  border-radius:16px;
  box-shadow:0 14px 30px rgba(0,0,0,.26);
  max-height:calc(100vh - 160px);
  overflow:auto;
}

.tabs{
  display:flex;
  gap:8px;
  padding:10px;
  background:#11161f;
  border-bottom:1px solid rgba(255,255,255,.08);
  flex-wrap:wrap;
}

.tab{
  border:1px solid rgba(255,255,255,.08);
  background:#171c25;
  padding:10px 14px;
  border-radius:10px;
  cursor:pointer;
  font-weight:700;
  color:#cbd5e1;
  transition:
    background-color .16s ease,
    border-color .16s ease,
    color .16s ease,
    transform .16s ease;
}

.tab:hover{
  background:rgba(34,197,94,.10);
  border-color:rgba(34,197,94,.24);
  color:#ffffff;
  transform:translateY(-1px);
}

.tab.active{
  background:rgba(34,197,94,.14);
  border-color:rgba(34,197,94,.32);
  color:#86efac;
  box-shadow:0 0 0 3px rgba(34,197,94,.10);
}

.tabpane{
  display:none;
  padding:20px;
}

.tabpane.show{
  display:block;
}

.cfg-section-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin:10px 0 16px;
}

.cfg-section-title{
  font-weight:850;
  margin-bottom:4px;
  color:#f8fafc;
}

.cfg-section-sub{
  color:#94a3b8;
  line-height:1.45;
}


.cfg-dotline{
  display:inline-flex;
  align-items:center;
  gap:10px;
  font-weight:900;
  color:#f8fafc;
}

.cfg-dot{
  width:13px;
  height:13px;
  min-width:13px;
  border-radius:999px;
  background:var(--dot);
  display:inline-block;
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--dot) 18%, transparent),
    0 0 18px color-mix(in srgb, var(--dot) 38%, transparent);
}

.cfg-card .table tbody tr:has(.cfg-dot){
  position:relative;
}

.cfg-card .table tbody tr:has(.cfg-dot) td:first-child{
  border-left-color:var(--dot, rgba(255,255,255,.08)) !important;
}

.badge-code{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:max-content;
  padding:6px 10px;
  border-radius:999px;
  background:rgba(255,255,255,.045);
  border:1px solid rgba(255,255,255,.10);
  color:#f8fafc;
  font-size:12px;
  font-weight:800;
  font-family:Consolas, Monaco, "Courier New", monospace;
}

.cfg-card .table td{
  background:#111822;
  color:#f8fafc;
  border-color:rgba(255,255,255,.07);
}

.cfg-card .table tbody tr:hover td{
  background:#162033;
}

.cfg-card .table th{
  color:#a9c7ee;
  font-weight:900;
  letter-spacing:.04em;
}

.cfg-card .table td:first-child{
  font-weight:900;
}

.cfg-card .table td.actions{
  background:#111822;
}

.cfg-card .table tbody tr:hover td.actions{
  background:#162033;
}
.color-picker{
  display:flex;
  align-items:center;
  gap:8px;
}

.color-picker input[type="color"]{
  width:40px;
  height:32px;
  padding:0;
  border:none;
  cursor:pointer;
  background:transparent;
}

.color-picker .color-preview{
  width:40px;
  height:32px;
  border-radius:8px;
  border:1px solid rgba(255,255,255,.12);
}

/* ======================================================================
   CONFIGURACOES - TABELAS INTERNAS
   ====================================================================== */

.cfg-card .table td{
  background:rgba(17,22,31,.92);
  color:#e5e7eb;
  border-color:rgba(255,255,255,.07);
}

.cfg-card .table th{
  color:#94a3b8;
}

.cfg-card .table tr:hover td{
  background:#18231d;
}

.cfg-card .table input,
.cfg-card .table select,
.cfg-card .table textarea{
  background:#171c25;
  color:#f8fafc;
  border:1px solid rgba(255,255,255,.10);
  border-radius:10px;
}

.cfg-card .table input:focus,
.cfg-card .table select:focus,
.cfg-card .table textarea:focus{
  outline:none;
  border-color:rgba(34,197,94,.55);
  box-shadow:0 0 0 3px rgba(34,197,94,.14);
}

/* ======================================================================
   CONFIGURACOES > E-MAIL - REGRAS POR ROLE
   ====================================================================== */

.email-role-grid{
  display:grid;
  grid-template-columns:320px 1fr;
  gap:16px;
  align-items:start;
}

.email-role-card{
  border:1px solid rgba(255,255,255,.08);
  border-radius:16px;
  background:#11161f;
  padding:14px;
  box-shadow:0 10px 24px rgba(0,0,0,.16);
}

.email-role-card__title{
  font-weight:850;
  font-size:14px;
  color:#f8fafc;
}

.email-role-card__sub{
  margin-top:4px;
  color:#94a3b8;
  font-size:13px;
  line-height:1.45;
}

.email-role-picker{
  margin-top:12px;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.email-role-btn{
  width:100%;
  border:1px solid rgba(255,255,255,.08);
  background:#171c25;
  color:#f8fafc;
  padding:12px;
  border-radius:14px;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  transition:
    background-color .16s ease,
    border-color .16s ease,
    transform .16s ease,
    box-shadow .16s ease;
}

.email-role-btn:hover{
  background:rgba(34,197,94,.08);
  border-color:rgba(34,197,94,.22);
  transform:translateY(-1px);
}

.email-role-btn.active{
  border-color:rgba(34,197,94,.55);
  background:rgba(34,197,94,.12);
  box-shadow:0 0 0 4px rgba(34,197,94,.12);
}

.email-role-pill{
  display:none;
  font-size:12px;
  padding:4px 8px;
  border-radius:999px;
  background:rgba(34,197,94,.14);
  color:#86efac;
  font-weight:800;
}

.email-role-btn.active .email-role-pill{
  display:inline-flex;
}

.email-role-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  flex-wrap:wrap;
}

.email-role-head__actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.email-rule-box{
  margin-top:12px;
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:12px;
}

.email-chk{
  display:flex;
  gap:10px;
  align-items:flex-start;
  border:1px solid rgba(255,255,255,.08);
  border-radius:14px;
  padding:12px;
  cursor:pointer;
  background:#171c25;
  color:#e5e7eb;
  transition:
    background-color .16s ease,
    border-color .16s ease,
    transform .16s ease;
}

.email-chk:hover{
  background:rgba(34,197,94,.08);
  border-color:rgba(34,197,94,.22);
  transform:translateY(-1px);
}

.email-chk input{
  margin-top:4px;
  transform:scale(1.05);
  accent-color:#22c55e;
}

.email-chk strong,
.email-chk b{
  color:#f8fafc;
}

.email-chk small,
.email-chk span{
  color:#94a3b8;
}

.email-role-footer{
  margin-top:12px;
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.email-msg{
  margin-top:12px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.08);
  color:#e5e7eb;
  background:#11161f;
}

.email-msg.ok{
  border-color:rgba(34,197,94,.35);
  background:rgba(34,197,94,.08);
  color:#86efac;
}

.email-msg.err{
  border-color:rgba(239,68,68,.35);
  background:rgba(239,68,68,.08);
  color:#fca5a5;
}

/* ======================================================================
   CONFIGURACOES > SMTP SENDER CARD
   ====================================================================== */

.email-sender-card{
  border:1px solid rgba(255,255,255,.08);
  border-radius:16px;
  padding:16px;
  background:#11161f;
  box-shadow:0 10px 24px rgba(0,0,0,.16);
}

.email-sender-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:12px;
}

.email-sender-title{
  font-weight:850;
  font-size:16px;
  color:#f8fafc;
}

.email-sender-sub{
  color:#94a3b8;
  margin-top:2px;
  line-height:1.45;
}

.email-switch{
  display:flex;
  align-items:center;
  gap:10px;
  cursor:pointer;
  user-select:none;
  font-weight:800;
  color:#e5e7eb;
}

.email-switch input{
  accent-color:#22c55e;
}

.email-sender-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
}

.email-sender-grid .form-group label{
  color:#cbd5e1;
}

.email-sender-grid .form-group input,
.email-sender-grid .form-group select,
.email-sender-grid .form-group textarea{
  background:#171c25;
  color:#f8fafc;
  border:1px solid rgba(255,255,255,.10);
}

.email-sender-grid .form-group input:focus,
.email-sender-grid .form-group select:focus,
.email-sender-grid .form-group textarea:focus{
  outline:none;
  border-color:rgba(34,197,94,.55);
  box-shadow:0 0 0 3px rgba(34,197,94,.14);
}

.email-sender-grid small,
.email-sender-card small{
  color:#94a3b8 !important;
}

.email-row{
  grid-column:1 / -1;
  display:flex;
  gap:18px;
  flex-wrap:wrap;
  align-items:center;
}

.chk-inline{
  display:flex;
  gap:10px;
  align-items:flex-start;
  cursor:pointer;
  color:#e5e7eb;
}

.chk-inline input{
  accent-color:#22c55e;
}

.email-sender-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  align-items:center;
  margin-top:12px;
  flex-wrap:wrap;
}

/* ======================================================================
   CONFIGURACOES - FIXES PARA CARDS CLAROS / INLINE
   ====================================================================== */

.cfg-card [style*="background:#fff"],
.cfg-card [style*="background: #fff"],
.cfg-card [style*="background:white"],
.cfg-card [style*="background: white"],
.cfg-card [style*="background:#ffffff"],
.cfg-card [style*="background: #ffffff"]{
  background:#11161f !important;
}

.cfg-card [style*="color:#0f172a"],
.cfg-card [style*="color: #0f172a"],
.cfg-card [style*="color:#334155"],
.cfg-card [style*="color: #334155"],
.cfg-card [style*="color:#111827"],
.cfg-card [style*="color: #111827"]{
  color:#f8fafc !important;
}

.cfg-card [style*="color:#6b7280"],
.cfg-card [style*="color: #6b7280"],
.cfg-card [style*="color:#64748b"],
.cfg-card [style*="color: #64748b"]{
  color:#94a3b8 !important;
}

/* ======================================================================
   CONFIGURACOES - RESPONSIVO / SCROLL
   ====================================================================== */

html,
body{
  height:100%;
  overflow-y:auto;
}

.wrapper{
  min-height:100vh;
  height:auto;
}

.content,
main,
.main,
.page,
.page-content{
  height:auto;
  overflow:visible;
}

@media (max-width:980px){
  .email-role-grid{
    grid-template-columns:1fr;
  }

  .email-rule-box{
    grid-template-columns:1fr;
  }
}

@media (max-width:900px){
  .email-sender-grid{
    grid-template-columns:1fr;
  }

  .cfg-page-header{
    flex-direction:column;
  }

  .cfg-card{
    max-height:none;
  }
}

@media (max-width:700px){
  .tabs{
    display:grid;
    grid-template-columns:1fr;
  }

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

  .email-role-head,
  .email-sender-head,
  .cfg-section-head{
    flex-direction:column;
    align-items:stretch;
  }

  .email-role-head__actions,
  .email-sender-actions{
    width:100%;
  }

  .email-role-head__actions .btn,
  .email-sender-actions .btn{
    flex:1;
  }
}