:root{--primary:#e91e8c;--primary-light:#ffd4e8;--primary-dark:#c41570;--sidebar:#2d1b3d;--bg:#fff5f8;--surface:#fff;--text:#2d1b3d;--muted:#6b5b70;--border:#f0d0e0;--selected:#ffe082;--selected-border:#f59f00}
*{box-sizing:border-box}
body{background:var(--bg);color:var(--text);font-family:'Segoe UI',sans-serif;margin:0;display:flex;height:100vh;overflow:hidden}
body.theme-dark{--bg:#16151a;--surface:#24212a;--text:#f5edf7;--muted:#c9b9d0;--border:#51415a;--selected:#5c4300;--selected-border:#ffc107}

/* SIDEBAR */
#sidebar{width:245px;min-width:245px;background:var(--sidebar);height:100vh;overflow-y:auto;display:flex;flex-direction:column;flex-shrink:0}
/* BRANDING DA SIDEBAR (LOGO ACIMA DOS MENUS) */
.sidebar-brand {
  padding: 25px 20px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.15);
  margin-bottom: 15px;
}
.sidebar-brand .logo-icon {
  font-size: 2.8rem;
  margin-bottom: 5px;
  display: inline-block;
}
.sidebar-brand h5 {
  color: #fff;
  font-weight: 700;
  margin: 0;
  letter-spacing: 1px;
}
.sidebar-brand small {
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
}
.nav-section{padding:10px 16px 4px;font-size:.68rem;text-transform:uppercase;color:rgba(255,255,255,.35);letter-spacing:1px;margin-top:6px}
.nav-item{cursor:pointer;padding:10px 16px;display:flex;align-items:center;gap:10px;color:#e8d0f0;font-size:.85rem;transition:all .2s;border-left:3px solid transparent}
.nav-item:hover,.nav-item.active{background:rgba(233,30,140,.25);border-left-color:var(--primary);color:#fff}
.nav-item i{width:18px;text-align:center;font-size:.9rem}

/* Definição de tamanho para sua imagem de Logo */
.img-logo-custom {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 50%; /* Deixa a foto redondinha */
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  margin-bottom: 15px;
}

/* Tamanho menor para caber perfeitamente na Sidebar */
.img-logo-sidebar {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 50%;
  margin-bottom: 10px;
}

/* Tamanho ideal para o cabeçalho do PDV */
.img-logo-pdv {
  width: 55px;
  height: 55px;
  object-fit: cover;
  border-radius: 50%;
}


/* TELA DE LOGIN REESTRUTURADA */
#login-screen {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: linear-gradient(135deg, var(--sidebar) 0%, #4a285a 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.login-box {
  background: #ffffff;
  width: 100%;
  max-width: 450px; /* Aumentado para dar mais robustez igual à imagem */
  padding: 40px 35px; /* Mais espaçamento interno para um visual premium */
  border-radius: 16px; /* Cantos arredondados modernos */
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); /* Sombra projetada elegante */
}

.login-logo-container {
  margin-bottom: 12px;
}

.img-login-custom {
  width: 118px;
  height: 118px;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 8px 20px rgba(45, 27, 61, 0.22);
}

.app-version {
  color: var(--primary);
  font-size: .78rem;
  font-weight: 700;
}

.topbar-version {
  color: var(--primary);
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
}

.img-pdv-destaque {
  width: 100%;
  max-width: 190px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(45, 27, 61, 0.16);
  margin-bottom: 10px;
}
/* MAIN */
#main{flex:1;display:flex;flex-direction:column;overflow:hidden;min-width:0}
#topbar{background:var(--surface);border-bottom:2px solid var(--primary-light);padding:8px 20px;display:flex;align-items:center;justify-content:space-between;box-shadow:0 2px 6px rgba(0,0,0,.06)}
#topbar h4{margin:0;color:var(--primary);font-weight:700;font-size:1.1rem}
#content{flex:1;overflow-y:auto;padding:16px 20px 42px}
.section{display:none}
.section.active{display:block}

#app-footer{
  position:fixed;
  left:0;
  right:0;
  bottom:0;
  z-index:10001;
  padding:6px 12px;
  background:rgba(255,255,255,.92);
  border-top:1px solid rgba(233,30,140,.18);
  color:#6b5b70;
  font-size:.78rem;
  font-weight:600;
  text-align:center;
  backdrop-filter:blur(6px);
}
body.theme-dark #app-footer{background:rgba(36,33,42,.92);border-top-color:var(--border);color:var(--muted)}

/* CARDS */
.card-c{background:var(--surface);border-radius:10px;box-shadow:0 2px 10px rgba(0,0,0,.08);border:1px solid var(--border);margin-bottom:16px}
.card-h{background:linear-gradient(135deg,var(--primary),var(--primary-dark));color:#fff;padding:11px 18px;border-radius:10px 10px 0 0;font-weight:600;display:flex;align-items:center;gap:8px;font-size:.9rem}
.card-b{padding:16px}

/* TABLES */
.tbl-c thead{background:var(--primary);color:#fff}
.tbl-c thead th{font-weight:600;padding:7px 10px;font-size:.82rem;white-space:nowrap}
.tbl-c thead th.sortable-th{cursor:pointer;user-select:none}
.tbl-c thead th.sortable-th:hover{filter:brightness(1.08)}
.tbl-c tbody td{padding:6px 10px;font-size:.82rem;vertical-align:middle}
.tbl-c tbody tr:hover>td{background:#fff0f7;cursor:pointer}
.tbl-c tbody tr.sel>td{background:var(--selected) !important;color:var(--text) !important;box-shadow:inset 0 1px 0 var(--selected-border),inset 0 -1px 0 var(--selected-border)}
.tbl-c tbody tr.sel>td:first-child{box-shadow:inset 4px 0 0 var(--selected-border),inset 0 1px 0 var(--selected-border),inset 0 -1px 0 var(--selected-border)}
#v-tbody tr.sel>td{background:var(--selected) !important;color:var(--text) !important;box-shadow:inset 0 1px 0 var(--selected-border),inset 0 -1px 0 var(--selected-border)}
#v-tbody tr.sel>td:first-child{box-shadow:inset 4px 0 0 var(--selected-border),inset 0 1px 0 var(--selected-border),inset 0 -1px 0 var(--selected-border)}
body.theme-dark #main .table{--bs-table-bg:transparent;--bs-table-color:var(--text);--bs-table-border-color:var(--border)}
body.theme-dark #main .tbl-c tbody tr:hover>td{background:#332734}

/* FORM */
.form-control,.form-select{font-size:.83rem}
.form-control:disabled,.form-select:disabled{background:#f5f5f5;color:#aaa}
label.lbl{font-size:.78rem;font-weight:600;margin-bottom:3px;color:#555}
body.theme-dark #main label.lbl,body.theme-dark #main .text-muted{color:var(--muted)!important}
body.theme-dark #main .bg-white{background:var(--surface)!important}
body.theme-dark #main .form-control,body.theme-dark #main .form-select,body.theme-dark #main textarea{background:#1d1a22;color:var(--text);border-color:var(--border)}
body.theme-dark #main .form-control:disabled,body.theme-dark #main .form-select:disabled{background:#2d2833;color:#908096}
body.theme-dark #main input[type="date"],body.theme-dark #main select{color-scheme:dark}
body.theme-dark #main .form-control::placeholder{color:#d8cde0;opacity:.85}
body.theme-dark #main input[type="date"]::-webkit-calendar-picker-indicator{filter:invert(1)}
body.theme-dark #main .form-select{
  background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23f5edf7' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat:no-repeat;
  background-position:right .75rem center;
  background-size:16px 12px;
}
.date-filter-picker{position:fixed;opacity:0;pointer-events:none;width:34px;height:32px;z-index:12000}

/* BUTTONS */
.btn-toolbar{display:flex;gap:6px;margin-bottom:12px;flex-wrap:wrap}
.btn{font-size:.82rem;padding:5px 12px}
.btn-dedo-duro{
  background:#217346;
  border-color:#185c37;
  color:#fff;
  font-weight:700;
  box-shadow:inset 0 -1px 0 rgba(0,0,0,.18);
}
.btn-dedo-duro:hover,.btn-dedo-duro:focus{
  background:#185c37;
  border-color:#12462a;
  color:#fff;
}

/* POS */
.pos-hdr{background:linear-gradient(135deg,var(--primary),var(--primary-dark));color:#fff;padding:12px 18px;border-radius:10px;margin-bottom:12px;display:flex;justify-content:space-between;align-items:center}
.pos-logo{background:var(--surface);border:2px dashed #ffd4e8;border-radius:10px;display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:220px;padding:16px}
.pos-total{background:var(--primary);color:#fff;padding:10px 16px;border-radius:8px;font-size:1.1rem;font-weight:700;text-align:center;margin-top:8px}
.cart-empty{text-align:center;color:#ccc;padding:30px}
.cart-empty i{font-size:2rem;display:block;margin-bottom:8px}

/* DROPDOWN SEARCH */
.dd-search{position:absolute;z-index:1050;background:var(--surface);border:1px solid var(--border);border-radius:8px;box-shadow:0 4px 14px rgba(0,0,0,.15);max-height:200px;overflow-y:auto;width:100%;top:100%;left:0}
.dd-item{cursor:pointer;padding:7px 12px;border-bottom:1px solid #f5f5f5;font-size:.82rem}
.dd-item:hover{background:var(--primary-light)}
.dd-item:last-child{border-bottom:none}

/* TABS */
.nav-tabs .nav-link{font-size:.84rem;color:#666}
.nav-tabs .nav-link.active{color:var(--primary);font-weight:600;border-bottom-color:var(--primary)}

/* BADGES */
.badge-ok{background:#198754}
.badge-low{background:#ffc107;color:#000}
.badge-zero{background:#dc3545}

/* MODAL */
.modal-hdr-c{background:linear-gradient(135deg,var(--primary),var(--primary-dark));color:#fff}
.modal-hdr-c .btn-close{filter:invert(1)}
.modal-content{background:#fff;color:#212529}
.modal-content .text-muted{color:#6c757d!important}
#modalRelPrint .modal-dialog{max-width:96vw}
#modalRelPrint .modal-body{max-height:78vh;overflow:auto}
.excel-log-table{width:100%;border-collapse:collapse;background:#fff;color:#111;font-size:.82rem;margin-bottom:14px}
.excel-log-table th,.excel-log-table td{border:1px solid #d9d9d9;padding:4px 6px;vertical-align:middle}
.excel-log-table th{background:#f3f6f4;font-weight:600;text-transform:lowercase}
.excel-log-table td.valor{text-align:right}
.excel-log-empty{border:1px solid #d9d9d9;background:#fff;color:#666;padding:14px;text-align:center}
.about-change-log{margin-top:18px;text-align:left;border:1px solid var(--border);border-radius:8px;overflow:hidden;background:var(--surface)}
.about-change-log h6{margin:0;padding:9px 12px;background:var(--primary-light);color:var(--primary);font-weight:800}
.about-change-log ul{list-style:none;margin:0;padding:0;max-height:430px;overflow:auto}
.about-change-log li{padding:9px 12px;border-top:1px solid var(--border);font-size:.84rem}
.about-change-log strong{color:var(--primary)}
.about-change-log span{display:block;color:var(--muted);font-size:.78rem;margin-top:2px}
body.theme-dark #main .about-change-log{background:#17141c}
body.theme-dark #main .about-change-log h6{background:#2d2031;color:#ff7ac0}

.seg-user-selected{border:1px solid var(--selected-border);background:var(--selected);color:var(--text);font-weight:800;border-radius:6px;padding:8px 10px;margin-bottom:8px;font-size:.82rem}
.seg-grid-title{font-weight:800;color:var(--primary);font-size:.86rem;margin:8px 0 4px}
.seg-table-wrap{height:190px;overflow:auto}
.seg-actions{display:flex;justify-content:center;gap:8px;flex-wrap:wrap;margin:10px 0}
body.theme-dark #main .seg-user-selected{background:var(--selected);color:var(--text)}

/* PRINT */
@media print {
  /* Oculta tudo do sistema de estoque em segundo plano */
  body * {
    visibility: hidden;
  }
  /* Torna visível estritamente a área interna e textos do Comprovante/Preview */
  #modalImp, #modalImp *, #modalRelPrint, #modalRelPrint * {
    visibility: visible;
  }
  /* Posiciona perfeitamente no topo esquerdo da página impressa */
  #modalImp, #modalRelPrint {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }
  #modalRelPrint .modal-dialog,
  #modalRelPrint .modal-content,
  #modalRelPrint .modal-body,
  #modalRelPrint .tbl-wrap {
    max-width:none !important;
    max-height:none !important;
    overflow:visible !important;
    box-shadow:none !important;
    border:0 !important;
  }
  /* Remove as bordas do modal e os botões de fechar/imprimir na folha */
  .modal-footer, .btn-close, .modal-header {
    display: none !important;
  }
}

/* SUMMARY CARDS */
.sum-card{border-radius:10px;padding:14px;text-align:center;margin-bottom:10px}
.sum-card h6{font-size:.78rem;margin-bottom:6px;font-weight:600}
.sum-card .num{font-size:1.5rem;font-weight:700}

/* SCROLL TABLES */
.tbl-wrap{overflow-x:auto;border:1px solid var(--border);border-radius:8px}
.tbl-wrap-h{height:320px;overflow-y:auto}

/* CONTAINER FLUTUANTE PARA AS NOTIFICAÇÕES (CANTOS SUPERIOR DIREITO) */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 11000; /* Fica por cima de absolutamente tudo, inclusive do Login */
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

/* O BALÃO DE NOTIFICAÇÃO ANIMADO */
.custom-toast {
  pointer-events: auto;
  min-width: 300px;
  max-width: 380px;
  background: #ffffff;
  color: #333333;
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'Segoe UI', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  border-left: 6px solid #ccc;
  
  /* Animação de entrada: desliza do lado direito para dentro */
  animation: toastSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards,
            toastFadeOut 0.4s ease forwards 3.6s; /* Esconde sozinho após 3.6s */
}

/* Cores dinâmicas baseadas no tipo de alerta */
.custom-toast.toast-success { border-left-color: #2ec4b6; }
.custom-toast.toast-danger { border-left-color: #e71d36; }
.custom-toast.toast-warning { border-left-color: #ff9f1c; }
.custom-toast.toast-info { border-left-color: #4361ee; }

.custom-toast i {
  font-size: 1.25rem;
}
.custom-toast.toast-success i { color: #2ec4b6; }
.custom-toast.toast-danger i { color: #e71d36; }
.custom-toast.toast-warning i { color: #ff9f1c; }
.custom-toast.toast-info i { color: #4361ee; }

/* KEYFRAMES DAS ANIMAÇÕES */
@keyframes toastSlideIn {
  from {
    transform: translateX(110%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toastFadeOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(50%);
    opacity: 0;
  }
}
