
:root{
  --bg:#F9FAFB;
  --panel-bg:#FFFFFF;
  --panel-border:#E4E7EC;
  --radius-xxl:15px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background: var(--bg);
  font-family: 'Outfit', system-ui, -apple-system, Segoe UI, Roboto, 'Helvetica Neue', Arial, sans-serif;
  color:#0f172a;
}

/* Layout base com sidebar */
.app-layout{
  display:grid;
  grid-template-columns: 280px 1fr;
  min-height:100vh;
}
.app-sidebar{
  background: #fff;
  color:#fff;
  display:flex;
  flex-direction:column;
  padding:24px 16px;
}
.app-brand{
  font-weight:700;
  font-size:24px;
  line-height:1;
  margin-bottom:24px;
}
.app-nav{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin-bottom:auto;
}
.app-link{
  color:#fff;
  text-decoration:none;
  padding:10px 12px;
  border-radius:12px;
  transition:background .15s ease;
}
.app-link:hover{ background:rgba(255,255,255,.12); }
.app-user{
  margin-top:24px;
  border-top:1px solid rgba(255,255,255,.15);
  padding-top:16px;
}
.app-main{ padding:28px; }

/* Título fora dos containers */
.page-title{
  margin: 2px 6px 18px;
  font-size: clamp(20px, 2.5vw, 28px);
  font-weight: 600;
}

/* Containers padrão */
.panel, .table-responsive, .card, .modal-content {
  background: var(--panel-bg);
  border:1px solid var(--panel-border);
  border-radius: var(--radius-xxl);
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.table-responsive{ padding:18px; }
.card .card-body{ padding:22px; }
.modal-content{ overflow:hidden; }

.form-control, .form-select { border-radius: 12px; }
.btn{ border-radius:12px; }

/* ===== Drawer Modal (400px, altura total, animação lateral) ===== */
.modal.modal-drawer .modal-dialog{
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  margin: 0;
  max-width: 400px;
  width: 400px;
  transform: translateX(100%);
  transition: transform .28s ease;
}
.modal.modal-drawer.show .modal-dialog{ transform: translateX(0); }
.modal.modal-drawer .modal-content{
  height: 100%;
  border-radius: 15px 0 0 15px;
  border: 1px solid var(--panel-border);
}
.modal.modal-drawer .modal-header{ border-bottom: 1px solid var(--panel-border); }
.modal.modal-drawer .modal-footer{ border-top: 1px solid var(--panel-border); }
@media (max-width: 480px){
  .modal.modal-drawer .modal-dialog{ max-width: 100%; width: 100%; }
  .modal.modal-drawer .modal-content{ border-radius: 0; }
}

/* Active link highlight */
.app-link.is-active{ background: rgba(255,255,255,.18); font-weight:600; }


/* Stack fields vertically inside drawer modals */
.modal.modal-drawer .row > [class^="col-"],
.modal.modal-drawer .row > [class*=" col-"]{
  flex: 0 0 100% !important;
  max-width: 100% !important;
}
.modal.modal-drawer .row{
  --bs-gutter-x: 0.75rem;
}



/* === Drawer forms: force vertical stacking === */
.modal.modal-drawer .modal-body form { display:block; }
.modal.modal-drawer .modal-body .row { margin-left:0; margin-right:0; }
.modal.modal-drawer .modal-body .row > * {
  flex: 0 0 100% !important;
  max-width: 100% !important;
}
.modal.modal-drawer .modal-body [class^="col-"],
.modal.modal-drawer .modal-body [class*=" col-"] {
  flex: 0 0 100% !important;
  max-width: 100% !important;
}
.modal.modal-drawer .modal-body .d-flex { 
  flex-direction: column !important; 
  align-items: stretch !important;
  gap: .75rem;
}
.modal.modal-drawer .modal-body .mb-3,
.modal.modal-drawer .modal-body .form-group { 
  width: 100% !important; 
}
.modal.modal-drawer .modal-body .input-group,
.modal.modal-drawer .modal-body .form-control,
.modal.modal-drawer .modal-body .form-select,
.modal.modal-drawer .modal-body textarea {
  width: 100% !important;
}


/* Drawer layout: header/footer fixos, corpo rolável */
.modal.modal-drawer .modal-content{ display:flex; flex-direction:column; height:100%; }
.modal.modal-drawer .modal-header{ flex:0 0 auto; position:sticky; top:0; background:#fff; z-index:2; }
.modal.modal-drawer .modal-footer{ flex:0 0 auto; position:sticky; bottom:0; background:#fff; z-index:2; }
.modal.modal-drawer .modal-body{ flex:1 1 auto; overflow:auto; padding-bottom:1rem; }


/* === Small-screen drawer scrolling improvements === */
.modal.modal-drawer .modal-dialog{
  height: 100vh;
}
@supports (height: 100dvh){
  .modal.modal-drawer .modal-dialog{ height: 100dvh; }
}
.modal.modal-drawer .modal-content{ display:flex; flex-direction:column; height:100%; overflow:hidden; }
.modal.modal-drawer .modal-header{ flex:0 0 auto; position:sticky; top:0; background:#fff; z-index:2; }
.modal.modal-drawer .modal-footer{ flex:0 0 auto; position:sticky; bottom:0; background:#fff; z-index:2; padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
.modal.modal-drawer .modal-body{ flex:1 1 auto; overflow:auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding-bottom:1rem; }

/* Fallback: se não existir .modal-body, torna o conteudo intermediário rolável */
.modal.modal-drawer .modal-content > :not(.modal-header):not(.modal-footer){
  flex: 1 1 auto;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}


/* === List action buttons (icon-only) === */
.table .col-actions,
.table .text-end.col-actions { text-align: right; white-space: nowrap; }
.col-actions .btn-icon { padding: 8px; border-radius: 10px; border: 1px solid var(--panel-border); background:#fff; }
.col-actions .btn-icon .bi { font-size: 16px; vertical-align: -2px; }
.col-actions .btn-icon + .btn-icon { margin-left: 6px; }
@media (max-width: 480px){
  .col-actions .btn-icon { padding: 8px; }
}
