:root{
  --ts-black:#111111;
  --ts-paper:#f5f2ed;
  --ts-white:#ffffff;
  --ts-gold:#c9b99a;
  --ts-gold-dark:#8c7f6e;
  --ts-line:#e6ded1;
  --ts-sidebar:220px;
  --ts-topbar:64px;
}

html,body{
  min-height:100%;
}

body{
  background:var(--ts-paper);
}

#app{
  min-height:100vh;
}

#app nav{
  position:fixed;
  z-index:100;
  top:0;
  left:0;
  right:0;
  height:var(--ts-topbar);
  padding:0 22px 0 24px;
  box-shadow:0 1px 0 rgba(255,255,255,.07);
}

#app nav h1{
  letter-spacing:.02em;
}

.nav-right{
  margin-left:auto;
}

#nav-role{
  display:inline-flex;
  align-items:center;
  min-height:24px;
  padding:0 9px;
  border:1px solid rgba(201,185,154,.35);
  color:var(--ts-gold);
  border-radius:999px;
  font-size:10px;
  text-transform:uppercase;
  letter-spacing:.08em;
}

.container{
  max-width:none !important;
  margin:0 !important;
  margin-left:var(--ts-sidebar) !important;
  padding:calc(var(--ts-topbar) + 28px) 28px 40px !important;
}

.tabs{
  position:fixed;
  z-index:90;
  left:0;
  top:var(--ts-topbar);
  bottom:0;
  width:var(--ts-sidebar);
  margin:0 !important;
  padding:22px 12px;
  display:flex;
  flex-direction:column;
  gap:5px !important;
  overflow-y:auto;
  border:0 !important;
  background:#171717;
}

.tab{
  display:flex;
  align-items:center;
  min-height:44px;
  margin:0 !important;
  padding:0 14px !important;
  border:0 !important;
  border-radius:7px;
  color:rgba(255,255,255,.56) !important;
  font-size:11px !important;
  letter-spacing:.06em !important;
  transition:.15s ease;
}

.tab:hover{
  color:white !important;
  background:rgba(255,255,255,.06);
}

.tab.active{
  color:var(--ts-black) !important;
  background:var(--ts-gold);
  font-weight:700;
}

.cards{
  gap:14px !important;
}

.card{
  border-left:0 !important;
  border-radius:9px;
  box-shadow:0 1px 2px rgba(0,0,0,.04);
}

.panel > table,
.pipeline .pipe-col,
.fg,
.rel-filters{
  border-radius:9px;
  overflow:hidden;
}

table{
  border-radius:9px;
  overflow:hidden;
}

th:first-child{
  border-radius:9px 0 0 0;
}

th:last-child{
  border-radius:0 9px 0 0;
}

.btn{
  border-radius:5px;
}

input,select,textarea{
  border-radius:5px;
}

.app-section-title{
  margin:0 0 18px;
}

.app-section-title strong{
  display:block;
  font-family:Georgia,serif;
  font-size:22px;
  font-weight:500;
}

.app-section-title span{
  display:block;
  margin-top:4px;
  color:var(--ts-gold-dark);
  font-size:12px;
}

.mobile-nav,
.mobile-more{
  display:none;
}

@media(max-width:768px){
  :root{
    --ts-topbar:58px;
  }

  #app nav{
    height:var(--ts-topbar);
    padding:0 16px;
  }

  #app nav h1{
    font-size:14px;
  }

  .nav-right{
    gap:9px !important;
  }

  .nav-user{
    max-width:105px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }

  #nav-role{
    display:none;
  }

  .nav-logout{
    font-size:0 !important;
  }

  .nav-logout::after{
    content:'Sair';
    font-size:10px;
  }

  .container{
    margin-left:0 !important;
    padding:
      calc(var(--ts-topbar) + 20px)
      14px
      92px !important;
  }

  .tabs{
    display:none !important;
  }

  .cards{
    display:grid !important;
    grid-template-columns:1fr 1fr !important;
    gap:9px !important;
    margin-bottom:18px !important;
  }

  .card{
    min-width:0;
    padding:14px !important;
  }

  .card-num{
    font-size:23px !important;
  }

  .card-label{
    font-size:9px !important;
  }

  .pipeline{
    grid-template-columns:1fr !important;
    gap:10px !important;
  }

  .pipe-col{
    margin-bottom:0;
  }

  .fg{
    padding:15px !important;
    gap:12px !important;
  }

  .search-bar{
    flex-direction:column;
  }

  table{
    display:block;
    overflow-x:auto;
    white-space:nowrap;
  }

  .rel-filters{
    align-items:stretch !important;
    flex-direction:column;
  }

  .modal-box{
    width:calc(100% - 20px) !important;
    max-height:90vh !important;
    padding:18px !important;
    border-radius:10px;
  }

  .mobile-nav{
    display:grid;
    position:fixed;
    z-index:950;
    left:0;
    right:0;
    bottom:0;
    height:72px;
    grid-template-columns:repeat(5,1fr);
    padding:6px 5px max(6px,env(safe-area-inset-bottom));
    background:rgba(17,17,17,.98);
    border-top:1px solid rgba(255,255,255,.08);
  }

  .mobile-nav button{
    appearance:none;
    border:0;
    background:none;
    color:rgba(255,255,255,.55);
    font-family:inherit;
    font-size:9px;
    letter-spacing:.01em;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:4px;
    cursor:pointer;
  }

  .mobile-nav button .mi{
    font-size:20px;
    line-height:20px;
  }

  .mobile-nav button.active{
    color:var(--ts-gold);
  }

  .mobile-more{
    display:none;
    position:fixed;
    z-index:940;
    left:10px;
    right:10px;
    bottom:78px;
    padding:10px;
    background:white;
    border-radius:13px;
    box-shadow:0 14px 45px rgba(0,0,0,.25);
  }

  .mobile-more.open{
    display:block;
  }

  .mobile-more button{
    display:flex;
    width:100%;
    min-height:46px;
    align-items:center;
    border:0;
    border-bottom:1px solid #eee8df;
    background:white;
    color:#222;
    font-family:inherit;
    font-size:13px;
    text-align:left;
    padding:0 12px;
    cursor:pointer;
  }

  .mobile-more button:last-child{
    border-bottom:0;
  }

  body.role-consulta #nc,
  body.role-consulta #no{
    display:none !important;
  }

  body.role-comercial #producao > .fg,
  body.role-consulta #producao > .fg{
    display:none !important;
  }
}

/* =========================================================
   Gate 4 — Product polish
   ========================================================= */

@media(min-width:1100px){
  .cards{
    grid-template-columns:repeat(6,minmax(0,1fr)) !important;
  }
}

.ts-primary-action{
  display:flex;
  align-items:center;
  justify-content:center;
  width:calc(100% - 24px);
  min-height:44px;
  margin:0 12px 14px;
  border:0;
  border-radius:7px;
  background:#c9b99a;
  color:#111;
  font-family:inherit;
  font-size:11px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.06em;
  cursor:pointer;
}

.ts-primary-action:hover{
  background:#d6c8aa;
}

.ts-sidebar-divider{
  height:1px;
  margin:8px 14px 12px;
  background:rgba(255,255,255,.08);
}

#usuarios.panel{
  max-width:100%;
}

.ts-users-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:16px;
}

.ts-users-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:12px;
}

.ts-user-card{
  background:white;
  border:1px solid #e8e1d7;
  border-radius:9px;
  padding:16px;
}

.ts-user-name{
  font-size:15px;
  font-weight:700;
}

.ts-user-email{
  margin-top:3px;
  color:#8c7f6e;
  font-size:12px;
}

.ts-user-meta{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-top:12px;
}

.ts-chip{
  display:inline-flex;
  align-items:center;
  min-height:23px;
  padding:0 8px;
  border-radius:999px;
  background:#f0ede8;
  color:#555;
  font-size:10px;
  text-transform:uppercase;
  letter-spacing:.04em;
}

.ts-chip.active{
  background:#e4f2e8;
  color:#386746;
}

.ts-chip.inactive{
  background:#f6e7e4;
  color:#8b433b;
}

.ts-user-form{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}

.ts-user-form .full{
  grid-column:1/-1;
}

.ts-user-form label{
  display:block;
  margin-bottom:5px;
  color:#8c7f6e;
  font-size:10px;
  text-transform:uppercase;
}

.ts-user-form input,
.ts-user-form select{
  width:100%;
  min-height:40px;
  padding:0 10px;
  border:1px solid #ddd3c5;
  border-radius:5px;
  background:white;
}

.ts-user-msg{
  margin-top:10px;
  font-size:12px;
}

@media(max-width:768px){
  .cards{
    grid-template-columns:1fr 1fr !important;
  }

  .ts-users-toolbar{
    align-items:stretch;
    flex-direction:column;
  }

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

  .ts-user-form .full{
    grid-column:auto;
  }
}
