/* =========================
   PONTO - MOBILE APP FEEL
   ========================= */

@media (max-width: 767px) {
  body {
    background: #f5f6f8 !important;
  }

  /* cards mais “mobile” */
  .card {
    border-radius: 14px !important;
    box-shadow: 0 6px 18px rgba(0,0,0,.08) !important;
  }

  /* botões mais fáceis de tocar */
  .btn {
    border-radius: 12px !important;
    padding: 10px 14px !important;
  }

  /* espaçamento geral */
  main, .container, .container-fluid, .p-4 {
    padding: 12px !important;
  }

  /* tabelas com scroll horizontal */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* input maior */
  input, select, textarea {
    font-size: 15px !important;
  }

  /* sidebar mobile */
  aside {
    padding: 10px !important;
  }

  /* list-group mais confortável */
  .list-group-item {
    padding: 12px 14px !important;
    border-radius: 12px !important;
    margin-bottom: 8px;
  }
}

/* =========================
   Sidebar (ERP)
   ========================= */

.sidebar {
  min-height: 100%;
}

/* overlay no mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 1029;
}

/* sidebar no mobile (abre/fecha) */
@media (max-width: 767px) {
  .sidebar {
    position: fixed;
    top: 56px;
    left: -320px;
    width: 280px;
    height: calc(100vh - 56px);
    overflow-y: auto;
    z-index: 1030;
    transition: left .25s ease;
    border-right: 1px solid #e5e7eb;
  }

  .sidebar.active {
    left: 0;
  }

  .sidebar-overlay.active {
    display: block;
  }
}

/* =========================
   Ficha Técnica (FT) - layout
   ========================= */

.ft-sheet {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(0,0,0,.08);
  overflow: hidden;
}

.ft-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #e5e7eb;
  background: #fafafa;
}

.ft-logo {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #eef2ff;
  color: #4f46e5;
  font-weight: 800;
  letter-spacing: .08em;
  border: 2px solid #c7d2fe;
  flex: 0 0 auto;
}

.ft-title {
  font-weight: 800;
  font-size: 18px;
}

.ft-subtitle {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}

.ft-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ft-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
}

.ft-cell {
  border-right: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  padding: 11px 12px;
  min-height: 60px;
}


.ft-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #6b7280;
  margin-bottom: 6px;
}

.ft-value {
  font-size: 12px;
  font-weight: 500;
}

/* colspans */
.ft-colspan-12 { grid-column: span 12; }
.ft-colspan-10 { grid-column: span 10; }
.ft-colspan-9  { grid-column: span 9; }
.ft-colspan-8  { grid-column: span 8; }
.ft-colspan-7  { grid-column: span 7; }
.ft-colspan-6  { grid-column: span 6; }
.ft-colspan-5  { grid-column: span 5; }
.ft-colspan-4  { grid-column: span 4; }
.ft-colspan-3  { grid-column: span 3; }
.ft-colspan-2  { grid-column: span 2; }

/* Remove setas do input number (Chrome, Edge, Safari) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Remove setas do input number (Firefox) */
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}


/* responsivo FT */
@media (max-width: 767px) {
  .ft-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .ft-actions {
    width: 100%;
  }
}
@media (max-width: 1200px) {
  .ft-grid {
    grid-template-columns: repeat(6, 1fr);
  }
  .ft-colspan-12 { grid-column: span 6; }
  .ft-colspan-10 { grid-column: span 6; }
  .ft-colspan-9  { grid-column: span 6; }
  .ft-colspan-8  { grid-column: span 6; }
  .ft-colspan-7  { grid-column: span 6; }
  .ft-colspan-6  { grid-column: span 6; }
  .ft-colspan-5  { grid-column: span 6; }
  .ft-colspan-4  { grid-column: span 6; }
  .ft-colspan-3  { grid-column: span 3; }
  .ft-colspan-2  { grid-column: span 3; }

  .ft-cell:nth-child(12n) {
    border-right: 1px solid #e5e7eb;
  }

}

/* ============================
   Layout ERP: Sidebar (desktop)
   - Deixa o menu lateral mais estreito
   - Evita que o conteúdo "quebre" para baixo do menu
   ============================ */
:root{
  --erp-sidebar-width: 190px; /* ajuste aqui (ex: 200px / 240px) */
}

@media (min-width: 992px){
  /* garante colunas lado a lado */
  .container-fluid > .row{
    flex-wrap: nowrap;
  }

  /* sidebar com largura fixa */
  #erpSidebar.sidebar{
    flex: 0 0 var(--erp-sidebar-width);
    width: var(--erp-sidebar-width);
    max-width: var(--erp-sidebar-width);
    position: sticky;
    top: 56px; /* altura da navbar fixed-top */
    height: calc(100vh - 56px);
    overflow-y: auto;
  }

  /* conteúdo ocupa o resto */
  .main-content-col{
    flex: 1 1 auto;
    width: auto;
    min-width: 0; /* importante p/ tabelas não estourarem */
  }
}

/* =========================
   Sidebar: títulos de grupo + separadores
   ========================= */

.sidebar-group-title{
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  color: #6b7280;
  text-transform: uppercase;
  margin: 10px 0 6px;
  padding: 0 6px;
}

.sidebar-group-sep{
  height: 1px;
  background: #e5e7eb;
  margin: 10px 0;
}

/* =========================
   Sidebar: sub-menu (ex: Ponto > Res Ponto)
   ========================= */

.sidebar-subitem{
  margin-left: 18px;
  border-left: 2px solid #e5e7eb;
  padding-left: 10px;
  border-radius: 0 !important;
  font-size: 0.95em;
}

.sidebar-subitem i{
  font-size: 0.95em;
  opacity: .9;
}

.sidebar-subitem.list-group-item-action:hover{
  background: #f8fafc;
}

  /* conteúdo ocupa o resto */
  .main-content-col{
    flex: 1 1 auto;
    width: auto;
    min-width: 0; /* importante p/ tabelas não estourarem */
  }
}
/* ============================
   Mensagens (Django messages) como "toast"
   - flutua no canto e some sozinho
   ============================ */
.container.mb-3.px-0{
  position: fixed;
  top: 72px; /* abaixo da navbar */
  right: 16px;
  left: auto;
  width: min(420px, calc(100% - 32px));
  z-index: 2000;
  margin: 0 !important;
}

.container.mb-3.px-0 .alert{
  margin-bottom: 10px;
  box-shadow: 0 10px 24px rgba(0,0,0,.12);
  animation: tnewt-toast 4.2s ease forwards;
}

@keyframes tnewt-toast{
  0%   {opacity:0; transform: translateY(-8px);}
  10%  {opacity:1; transform: translateY(0);}
  80%  {opacity:1; transform: translateY(0);}
  100% {opacity:0; transform: translateY(-8px); visibility:hidden;}
}

/* Em telas pequenas, centraliza */
@media (max-width: 767px){
  .container.mb-3.px-0{
    left: 16px;
    right: 16px;
    width: calc(100% - 32px);
  }
}
.ft-sheet--centered {
  max-width: 1280px;
  margin: 18px auto 28px;
}

.ft-sheet--compact {
  max-width: 1100px;
  margin: 18px auto 28px;
}

.ft-header-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.ft-header-copy {
  min-width: 0;
}

.ft-logo--amber {
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  color: #c2410c;
  border-color: #fdba74;
}

.ft-logo--emerald {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  color: #047857;
  border-color: #86efac;
}

.ft-value .mb-3,
.ft-uploader .mb-3 {
  margin-bottom: 0 !important;
}

.ft-sheet .form-check {
  min-height: auto;
  margin-bottom: 0;
}

.ft-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ft-note {
  font-size: 12px;
  color: #6b7280;
  margin-top: 6px;
}

.ft-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.ft-gallery--single {
  grid-template-columns: minmax(0, 1fr);
}

.ft-photo-card {
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  overflow: hidden;
  min-height: 240px;
  display: flex;
  flex-direction: column;
}

.ft-photo-frame {
  position: relative;
  background: #f8fafc;
  min-height: 200px;
  display: grid;
  place-items: center;
  padding: 12px;
}

.ft-photo-frame img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .14);
}

.ft-photo-empty {
  width: 100%;
  height: 200px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #f8fafc, #eef2ff);
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.ft-photo-meta {
  padding: 12px 14px 14px;
}

.ft-photo-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #64748b;
  margin-bottom: 8px;
}

.ft-photo-caption {
  font-size: 13px;
  color: #475569;
  margin-top: 8px;
}

.ft-preview-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 600;
}

.ft-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, .7fr);
  gap: 0;
}

.ft-hero-copy {
  padding: 22px 22px 18px;
  border-right: 1px solid #e5e7eb;
}

.ft-hero-preview {
  padding: 20px;
  background: linear-gradient(180deg, #f8fafc, #eef2ff);
}

.ft-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.ft-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.ft-compact-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.ft-span-2 {
  grid-column: span 2;
}

.ft-form-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0;
}

.ft-form-cell {
  border-right: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  padding: 12px 14px;
}

.ft-form-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #6b7280;
  margin-bottom: 6px;
}

.ft-form-cell .mb-3 {
  margin-bottom: 0 !important;
}

.ft-form-col-12 { grid-column: span 12; }
.ft-form-col-8 { grid-column: span 8; }
.ft-form-col-6 { grid-column: span 6; }
.ft-form-col-4 { grid-column: span 4; }
.ft-form-col-3 { grid-column: span 3; }
.ft-form-col-2 { grid-column: span 2; }
.ft-form-col-1 { grid-column: span 1; }

@media (max-width: 1199px) {
  .ft-hero {
    grid-template-columns: 1fr;
  }

  .ft-hero-copy {
    border-right: 0;
    border-bottom: 1px solid #e5e7eb;
  }

  .ft-gallery {
    grid-template-columns: 1fr;
  }

  .ft-compact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ft-form-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .ft-form-col-12,
  .ft-form-col-8,
  .ft-form-col-6,
  .ft-form-col-4 {
    grid-column: span 6;
  }

  .ft-form-col-3,
  .ft-form-col-2 {
    grid-column: span 3;
  }

  .ft-form-col-1 {
    grid-column: span 2;
  }
}

@media (max-width: 767px) {
  .ft-sheet--centered,
  .ft-sheet--compact {
    margin: 12px auto 22px;
  }

  .ft-title-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .ft-compact-grid {
    grid-template-columns: 1fr;
  }

  .ft-span-2 {
    grid-column: span 1;
  }

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

  .ft-form-col-12,
  .ft-form-col-8,
  .ft-form-col-6,
  .ft-form-col-4,
  .ft-form-col-3,
  .ft-form-col-2,
  .ft-form-col-1 {
    grid-column: span 1;
  }
}
.foto-preview {
  width: 220px !important;
  max-width: min(100%, 30vw) !important;
  height: 180px !important;
  max-height: 180px !important;
  margin: 0 auto;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.foto-preview img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 220px !important;
  max-height: 180px !important;
  object-fit: contain;
}

.ft-cell-compact {
  min-height: 52px;
  padding: 9px 10px;
}

.ft-sheet--form {
  margin-bottom: 18px;
}
