/* =========================================================
   GestObra — app.css
   Estrutura pensada para evitar “remendos no fim”.
   Ajustes de cor: mexer só nos tokens em :root.
========================================================= */

/* -----------------------------
   1) TOKENS (CORES, ESPAÇOS, ETC.)
------------------------------ */
:root{
  /* Base */
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #101828;
  --muted: #667085;
  --grid: #dbe0e7;

/* Grid: enche a área toda; se tiver muitas colunas, cresce e faz scroll */
.grid{
  min-width: 100%;
  width: max-content;     /* permite crescer para a direita quando adicionas colunas */
}

/* opcional: evita que “Ações” e “Estado” partam linha */
.grid th, .grid td{
  vertical-align: middle;
}
/* Grid table: linhas mais finas */
.grid thead th{
  padding: 10px 12px;
  border-bottom: 1px solid var(--grid);
}

.grid tbody td{
  padding: 10px 12px;     /* baixa a altura */
  border-bottom: 1px solid var(--grid);
}
/* Botões de ícone menores dentro de tabelas */
.grid .btn--icon{
  width: 34px;
  height: 34px;
}
.grid .btn--soft{
  padding: 8px 12px;
}


  /* Ação */
  --primary: #2563eb;      /* azul limpo */
  --primary-ink: #ffffff;
  --soft: #eef2ff;         /* fundo soft p/ botões */
  --focus: #94a3b8;

  /* Estados */
  --ok: #16a34a;
  --info: #0ea5e9;
  --warn: #f59e0b;
  --neutral: #64748b;

  /* Layout */
  --sidebar-w: 220px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 56px;

  /* Tipografia */
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  --radius: 12px;

  /* Sombras (muito suaves) */
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.06);
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06);

  /* Espaçamento */
  --p-1: 8px;
  --p-2: 12px;
  --p-3: 16px;
  --p-4: 20px;
  --p-5: 24px;
}

/* -----------------------------
   2) RESET / BASE
------------------------------ */
*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}
a{ color: inherit; text-decoration: none; }
img{ max-width: 100%; display: block; }
button, input, select, textarea{ font: inherit; }
strong{ font-weight: 650; }

/* Helpers */
.muted{ color: var(--muted); }
.strong{ font-weight: 650; }
.num{ text-align: right; font-variant-numeric: tabular-nums; }

/* -----------------------------
   3) APP LAYOUT
------------------------------ */
.app{
  min-height: 100%;
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr;
}

.topbar{
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--p-3);
  background: var(--panel);
  border-bottom: 1px solid var(--grid);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar__left{ display:flex; align-items:center; gap: 10px; }
.topbar__right{ display:flex; align-items:center; gap: 10px; }

.topbar__brand{
  display:flex; align-items:center; gap: 10px;
  padding-left: 6px;
}
.topbar__brand-name{ font-weight: 750; letter-spacing: .2px; }
.topbar__brand-pill{
  font-size: 12px;
  padding: 3px 8px;
  border: 1px solid var(--grid);
  border-radius: 999px;
  background: #fafafa;
  color: var(--muted);
}

.app-body{
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--topbar-h));
}

/* Sidebar collapse via data attr */
.app[data-sidebar-state="collapsed"] .app-body{
  grid-template-columns: var(--sidebar-w-collapsed) 1fr;
}
.app[data-sidebar-state="collapsed"] .nav__label,
.app[data-sidebar-state="collapsed"] .sidebar__logo-text,
.app[data-sidebar-state="collapsed"] .nav__group-label,
.app[data-sidebar-state="collapsed"] .mini-card{
  display: none;
}
.app[data-sidebar-state="collapsed"] .sidebar__logo{
  justify-content: center;
}

/* -----------------------------
   4) SIDEBAR
------------------------------ */
.sidebar{
  background: var(--panel);
  border-right: 1px solid var(--grid);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar__logo{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border: 0;
  border-bottom: 1px solid #f0f2f7;
  border-radius: 0;
  background: transparent;
}

.sidebar__logo-img{
  width: 32px;
  height: 32px;
}

.sidebar__logo-title{ font-size: 14px; font-weight: 700; line-height: 1.2; }
.sidebar__logo-sub{ font-size: 10px; line-height: 1.2; color: #9ca3af; }

.nav{
  display: flex;
  flex-direction: column;
  align-content: start;
  overflow: auto;
  padding: 8px 0 12px;
}

.nav__group{
  padding: 12px 8px 4px;
  flex: 0 0 auto;
}

.nav__group-label{
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .9px;
  color: #c4cbd8;
  padding: 0 8px;
  margin-bottom: 4px;
}

.nav__item{
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  color: #6b7280;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 1px;
}
.nav__item svg{
  flex-shrink: 0;
  opacity: .7;
}
.nav__item:hover{
  background: #f9fafb;
  color: #111827;
  border-color: transparent;
}
.nav__item:hover svg{
  opacity: 1;
}
.nav__item.is-active{
  background: #dbeafe;
  border-color: transparent;
  color: #1d4ed8;
  font-weight: 600;
}
.nav__item.is-active svg{
  opacity: 1;
  color: #2563eb;
}
.nav__label{ font-weight: 500; font-size: 13px; }

.sidebar__foot{
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid #f0f2f7;
}
.mini-card{
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  padding: 12px;
  background: #fbfbfc;
}
.mini-card--logo{
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}
.mini-card__logo-img{
  display: block;
  width: 100%;
  max-width: 210px;
  height: auto;
  object-fit: contain;
}
.mini-card__title{ font-size: 12px; color: var(--muted); margin-bottom: 8px; font-weight: 650; }
.mini-card__row{ display:flex; align-items:center; gap: 8px; padding: 6px 0; }

/* -----------------------------
   5) CONTENT AREA
------------------------------ */
.content{
  padding: var(--p-4);
  overflow: auto;
}

.page-head{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--p-4);
  align-items: start;
  margin-bottom: var(--p-4);
}
/* --- Page head right: separar tabs e actions --- */
.page-head__right{
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;              /* espaço vertical entre tabs e botões */
}

@media (max-width: 900px){
  .page-head__right{
    align-items: flex-start;
  }
}

.h1{
  margin: 6px 0 6px 0;
  font-size: 22px;
  letter-spacing: .2px;
}

.crumbs{ font-size: 12px; color: var(--muted); }
.crumb{ opacity: .9; }
.crumb.strong{ color: var(--text); font-weight: 700; }
.crumb-sep{ margin: 0 6px; opacity: .5; }

.actions{ display:flex; gap: 10px; align-items: center; justify-content: flex-end; }

/* Tabs */
.segmented{
  display: inline-flex;
  background: var(--panel);
  border: 1px solid var(--grid);
  border-radius: 999px;
  padding: 4px;
  box-shadow: var(--shadow-sm);
}
.segmented__item{
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 650;
  font-size: 14px;
  color: var(--muted);
}
.segmented__item:hover{ background: #fafafa; color: var(--text); }
.segmented__item.is-active{
  background: var(--soft);
  color: var(--text);
  border: 1px solid rgba(37,99,235,.25);
}

/* -----------------------------
   6) BUTTONS / FORMS
------------------------------ */
.btn{
  border: 1px solid var(--grid);
  background: var(--panel);
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}
.btn:not(.btn--primary):hover{ background: #fafafa; }

.btn:active{ transform: translateY(1px); }

.btn--sm{
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
  gap: 6px;
}

.btn--primary{
  background: var(--primary);
  border-color: rgba(0,0,0,.08);
  color: var(--primary-ink);
}
.btn--primary:hover{
  background: #1d4ed8;     /* azul um pouco mais escuro */
  color: #ffffff;
}
.btn--primary:active{
  background: #1e40af;     /* mais escuro ao clicar */
}


.btn--ghost{
  background: transparent;
  border-color: var(--grid);
  box-shadow: none;
}
.btn--ghost:hover{ background: #fafafa; }

.btn--soft{
  background: #f7f8ff;
  border-color: rgba(37,99,235,.16);
  box-shadow: none;
}
.btn--soft:hover{ background: #eef2ff; }

.btn--icon{
  width: 38px;
  height: 38px;
  justify-content: center;
  padding: 0;
  color: var(--text);          /* ✅ garante stroke visível */
  background: var(--panel);
}
.btn--icon:hover{
  background: #fafafa;
}

.btn--icon-xs{
  width: 24px;
  height: 24px;
}

.btn--icon-xs .icon{
  width: 13px;
  height: 13px;
}


.input, .select, .textarea{
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--grid);
  border-radius: 10px;
  background: #fff;
  outline: none;
}
.input:focus, .select:focus, .textarea:focus{
  border-color: rgba(37,99,235,.35);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.textarea{
  min-height: 44px;
  resize: none;
  overflow: hidden;
  line-height: 1.4;
}

.textarea--limit{
  max-height: 180px;
  overflow-y: auto;
}

.field{ display: grid; gap: 6px; }
.field__label{ font-size: 12px; color: var(--muted); font-weight: 650; }
.field--full{ grid-column: 1 / -1; }

.field--date-pt{
  position: relative;
}

.field--date-pt .input[data-date-pt]{
  padding-right: 40px;
}

.date-pt-trigger{
  position: absolute;
  right: 8px;
  bottom: 10px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #667085;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.date-pt-trigger:hover{
  background: #eef2f7;
  color: #344054;
}

.date-pt-trigger:focus-visible{
  outline: 2px solid rgba(37,99,235,.35);
  outline-offset: 1px;
}

.date-pt-proxy{
  position: absolute;
  right: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  border: 0;
  padding: 0;
}

.form-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 900px){
  .page-head{ grid-template-columns: 1fr; }
  .actions{ justify-content: flex-start; }
  .form-grid{ grid-template-columns: 1fr; }
}
.btn--center-label{
  position: relative;
  justify-content: center;
  padding-left: 44px;
  padding-right: 44px;
}
.btn--center-label .icon:first-child{
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.btn--center-label-right{
  position: relative;
  justify-content: center;
  padding-left: 44px;
  padding-right: 44px;
}
.btn--center-label-right .icon:last-child{
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}



/* -----------------------------
   7) DROPDOWN
------------------------------ */
.dropdown{ position: relative; }
.dropdown__panel{
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 240px;
  background: var(--panel);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px;
  display: none;
  z-index: 80;
}
.dropdown.is-open .dropdown__panel{ display: block; }
.dropdown__title{
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  padding: 8px 10px;
}
.dropdown__item{
  display: block;
  padding: 10px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
}
.dropdown__item--btn{
  width: 100%;
  text-align: left;
  background: transparent;
  cursor: pointer;
}
.dropdown__item:hover{
  background: #fafafa;
  border-color: var(--grid);
}
.dropdown__item.is-active{
  background: var(--soft);
  border-color: rgba(37,99,235,.25);
}
.dropdown__sep{
  height: 1px;
  background: var(--grid);
  margin: 8px 0;
}

/* -----------------------------
   8) SHEET (TABELA TIPO EXCEL)
------------------------------ */
.sheet{
  background: var(--panel);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.sheet__toolbar{
  display:flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--grid);
  background: #fcfcfd;
}

.sheet__toolbar-left{
  display:flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Formularios de filtro devem ficar numa linha */
.sheet__toolbar-left form.row{
  flex-wrap: nowrap;
  width: 100%;
}
.sheet__toolbar-left form.row .search{
  flex: 1 1 340px;
}
.sheet__toolbar-left form.row .select{
  min-width: 220px;
}
.sheet__toolbar-left form.row .btn{
  white-space: nowrap;
}

@media (max-width: 900px){
  .sheet__toolbar-left form.row{
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .sheet__toolbar-left form.row > *{
    flex: 0 0 auto;
  }
}

.sheet__toolbar-right{
  display:flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Sheet wrap: ocupa tudo e permite scroll horizontal quando necessário */
.sheet__wrap{
  width: 100%;
  overflow-x: auto;
}

.sheet__hint{
  padding: 10px 12px;
  border-top: 1px solid var(--grid);
  color: var(--muted);
  font-size: 12px;
  background: #fcfcfd;
}

/* Search */
.search{
  display:flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--grid);
  border-radius: 999px;
  background: #fff;
}
.search input{
  border: 0;
  outline: 0;
  padding: 0;
  width: 240px;
}
@media (max-width: 900px){
  .search input{ width: 160px; }
}

/* Table grid */
.grid{
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.grid thead th{
  position: sticky;
  top: 0;
  z-index: 20;
  background: #f9fafb;
  color: #344054;
  font-weight: 750;
  border-bottom: 1px solid var(--grid-strong);
  border-right: 1px solid var(--grid);
  padding: 10px 10px;
  text-align: left;
  white-space: nowrap;
}

.grid tbody td, .grid tfoot td{
  border-bottom: 1px solid var(--grid);
  border-right: 1px solid var(--grid);
  padding: 10px 10px;
  vertical-align: middle;
  background: #fff;
}

.grid tbody tr:hover td{
  background: #fbfcff;
}

tr[data-open-url]{
  cursor: pointer;
}

.grid tfoot td{
  background: #fcfcfd;
  font-weight: 650;
}

/* Variante compacta para tabelas com muitas linhas */
.grid--compact thead th{
  padding-top: 6px;
  padding-bottom: 6px;
}

.grid--compact tbody td,
.grid--compact tfoot td{
  padding-top: 5px;
  padding-bottom: 5px;
}

.grid--compact .btn--icon{
  width: 30px;
  height: 30px;
}

.grid--compact .cell-actions{
  gap: 6px;
}

/* Sticky first columns */
.sticky-col{
  position: sticky;
  left: 0;
  z-index: 25;
  background: #fff;
  border-right: 1px solid var(--grid-strong) !important;
}
.grid thead .sticky-col{ background: #f9fafb; z-index: 30; }
.col-check{ width: 44px; text-align: center; }
.col-item{ width: 280px; }
.col-item.sticky-col{ left: 44px; } /* segunda coluna sticky */
.grid thead th.col-item.sticky-col{ left: 44px; }

.col-cat{ width: 150px; }
.col-unit{ width: 105px; }
.col-qty{ width: 90px; }
.col-price{ width: 120px; }
.col-total{ width: 120px; }
.col-supplier{ width: 160px; }
.col-status{ width: 120px; }
.col-phase{ width: 140px; }
.col-notes{ width: 220px; }

/* Cell styles */
.cell-main{ display: grid; gap: 4px; }
.cell-title{ font-weight: 700; }
.cell-sub{ font-size: 12px; }

.cell-edit{
  display: inline-block;
  padding: 2px 6px;
  border-radius: 8px;
}
.cell-edit:hover{
  background: #f6f7fb;
  outline: 1px dashed rgba(100,116,139,.35);
}

/* Tags & badges */
.tag{
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--grid);
  background: #fbfbfc;
  font-size: 12px;
  color: #344054;
  white-space: nowrap;
}

.badge{
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--grid);
  background: #fbfbfc;
  color: #344054;
}
.field .badge{
  justify-self: start;
  align-self: start;
}
.badge--compact{
  padding: 3px 8px;
  font-size: 11px;
}
.badge--ok{ border-color: rgba(22,163,74,.25); background: rgba(22,163,74,.08); color: #166534; }
.badge--info{ border-color: rgba(14,165,233,.25); background: rgba(14,165,233,.08); color: #075985; }
.badge--warn{ border-color: rgba(245,158,11,.25); background: rgba(245,158,11,.12); color: #92400e; }
.badge--neutral{ border-color: rgba(100,116,139,.25); background: rgba(100,116,139,.10); color: #334155; }

/* Pills & dots */
.pill{
  display:inline-flex;
  gap: 8px;
  align-items:center;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--grid);
  background: #fff;
}
.pill__text{ font-size: 12px; font-weight: 700; color: #344054; }

.dot{
  width: 8px; height: 8px;
  border-radius: 99px;
  background: var(--neutral);
}
.dot--ok{ background: var(--ok); }
.dot--info{ background: var(--info); }
.dot--warn{ background: var(--warn); }

/* -----------------------------
   9) MODAL
------------------------------ */
.modal{
  position: fixed;
  inset: 0;
  display: none;
  z-index: 120;
}
.modal.is-open{ display: block; }

.modal__backdrop{
  position: absolute;
  inset: 0;
  background: rgba(16,24,40,.35);
}

.modal__panel{
  position: relative;
  width: min(720px, calc(100% - 24px));
  margin: 6vh auto;
  max-height: 88vh;
  background: var(--panel);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal__panel > form{
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.modal__head{
  display:flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--grid);
  background: #fcfcfd;
}
.modal__title{ font-weight: 850; }

.modal__body{
  padding: 16px;
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.modal__foot{
  padding: 14px 16px;
  border-top: 1px solid var(--grid);
  background: #fcfcfd;
  display:flex;
  gap: 10px;
  justify-content: flex-end;
}

.range{
  display:flex;
  gap: 10px;
  align-items:center;
}

/* -----------------------------
   10) ICONS (inline via JS)
------------------------------ */
.icon{
  width: 18px;
  height: 18px;
  display:inline-block;
  vertical-align: middle;
}
.icon--sm{ width: 16px; height: 16px; }

/* -----------------------------
   11) UI KIT / COMPONENTS (cards, alerts danger, tabelas compactas)
------------------------------ */

:root{
  --danger: #dc2626;
}

/* Danger button */
.btn--danger{
  background: var(--danger);
  border-color: rgba(0,0,0,.08);
  color: #ffffff;
}
.btn--danger:hover{ background: #b91c1c; }
.btn--danger:active{ background: #991b1b; }

/* Cards (UI Kit) */
.card{
  background: var(--panel);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--p-4);
}
.card__head{
  display:flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.card__title{
  font-weight: 850;
  margin-bottom: 4px;
}
.card__title.mt{ margin-top: var(--p-4); }

.mt{ margin-top: var(--p-4); }

.kit-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--p-4);
}
@media (max-width: 900px){
  .kit-grid{ grid-template-columns: 1fr; }
}

.row{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.stack{ display:grid; gap: 10px; }

.obra-dados-grid{
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 28px;
}

.obra-meta-line{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  line-height: 1.25;
}

.obra-meta-dot{
  opacity: 0.7;
}

.obra-dados-col{
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}

.obra-dados-grid .strong{
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 900px){
  .obra-dados-grid{
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* Alerts */
.alert{
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  padding: 12px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--grid);
  background: #fbfbfc;
}
.alert__title{ font-weight: 850; }
.alert--ok{ border-color: rgba(22,163,74,.25); background: rgba(22,163,74,.06); }
.alert--warn{ border-color: rgba(245,158,11,.25); background: rgba(245,158,11,.08); }
.alert--danger{ border-color: rgba(220,38,38,.30); background: rgba(220,38,38,.06); }

/* Tabela compacta (para cards/listagens) */
.table-simple{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  border: 1px solid var(--grid);
  border-radius: 12px;
  overflow: hidden;
}
.table-simple thead th{
  background: #f9fafb;
  border-bottom: 1px solid var(--grid);
  color: #344054;
  font-weight: 750;
  text-align: left;
  padding: 10px 10px;
  white-space: nowrap;
}
.table-simple tbody td{
  border-bottom: 1px solid var(--grid);
  padding: 10px 10px;
  vertical-align: middle;
  background: #fff;
}
.table-simple tbody tr:hover td{ background: #fbfcff; }
.table-simple tbody tr:last-child td{ border-bottom: 0; }

.table-simple .resumo-fornecedor-table{
  table-layout: fixed;
}

.table-simple .resumo-fornecedor-cell{
  width: 58%;
}

.table-simple .resumo-fornecedor-text{
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-simple .resumo-fornecedor-valor{
  width: 42%;
  white-space: nowrap;
}

/* Tag variação (opcional) */
.tag--warn{
  border-color: rgba(245,158,11,.25);
  background: rgba(245,158,11,.08);
}

.price-lowest{
  color: #15803d;
  font-weight: 700;
}

.price-highest{
  color: #b91c1c;
  font-weight: 700;
}

/* Coluna Ações: não partir linha */
/* Coluna Ações: largura suficiente + sem quebra */
.col-actions{
  white-space: nowrap;
  width: 180px; 
  text-align: left;           /* sobe para 280px se quiseres ainda mais folga */
}

/* Wrapper dos botões */
.cell-actions{
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
   justify-content: flex-start;   /* ✅ botões à esquerda */
}

/* O dropdown também não pode quebrar */
.cell-actions .dropdown{ flex: 0 0 auto; }

/* Garantir separador vertical após colunas sticky */
.grid .sticky-col{
  border-right: 1px solid var(--grid);
}

/* (opcional) garante que a linha aparece também no header */
.grid .sticky-col{ border-right: 1px solid var(--grid) !important; }

/* Lista fornecedores: ajustar largura entre Fornecedor e Contacto */
.col-fornecedor-nome{
  width: 240px;
}

.col-fornecedor-contacto{
  width: 300px;
}

/* Lista fornecedores: primeira coluna sticky sem offset da coluna checkbox antiga */
.grid--fornecedores .col-item.sticky-col{
  left: 0 !important;
}

.grid--fornecedores thead th.col-item.sticky-col{
  left: 0 !important;
}

/* Obra itens: layout estável para evitar "tremer" ao filtrar */
.grid--obra-itens{
  table-layout: fixed;
  width: 100%;
  min-width: 100%;
}

.grid--obra-itens col.obra-col-fornecedor{ width: 10%; }
.grid--obra-itens col.obra-col-produto{ width: 24%; }
.grid--obra-itens col.obra-col-tipo{ width: 10%; }
.grid--obra-itens col.obra-col-encomendado{ width: 8%; }
.grid--obra-itens col.obra-col-entregue{ width: 8%; }
.grid--obra-itens col.obra-col-unidade{ width: 5%; }
.grid--obra-itens col.obra-col-qtd{ width: 5%; }
.grid--obra-itens col.obra-col-preco{ width: 10%; }
.grid--obra-itens col.obra-col-desc{ width: 4%; }
.grid--obra-itens col.obra-col-iva{ width: 4%; }
.grid--obra-itens col.obra-col-total{ width: 6%; }
.grid--obra-itens col.obra-col-acoes{ width: 6%; }

.grid--obra-itens th,
.grid--obra-itens td{
  padding-left: 6px;
  padding-right: 6px;
  white-space: nowrap;
}

.grid--obra-itens .cell-title{
  display: block;
  overflow-wrap: anywhere;
}

.grid--obra-itens th:nth-child(1),
.grid--obra-itens td:nth-child(1){
  overflow: hidden;
  max-width: 0;
}

.grid--obra-itens th:nth-child(2),
.grid--obra-itens td:nth-child(2){
  white-space: normal;
}

.grid--obra-itens th:nth-child(3),
.grid--obra-itens td:nth-child(3){
  white-space: normal;
}

.grid--obra-itens .cell-truncate{
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grid--obra-itens .cell-truncate--fornecedor{
  max-width: 100%;
}

.grid--obra-itens tr.obra-tipo-row td{
  padding: 0 !important;
  height: 8px;
  background: #eef1f5;
  border-bottom: 1px solid #dde3eb;
}

.grid--obra-itens tr.obra-item-row{
  cursor: pointer;
}

.grid--obra-itens th.col-actions,
.grid--obra-itens td.col-actions{
  width: 88px;
}

.grid--obra-itens .js-total-cell{
  font-size: 12px;
}

.grid--obra-itens th:nth-child(11),
.grid--obra-itens td:nth-child(11){
  white-space: nowrap;
}

/* Materiais: tabela mais compacta e com ações menores */
.grid--materiais{
  width: max-content;
  min-width: 980px;
  table-layout: fixed;
}

.grid--materiais thead th{
  padding: 6px 8px;
}

.grid--materiais tbody td{
  padding: 5px 8px;
  border-bottom-color: #e7ecf3;
}

.grid--materiais .col-check{ width: 56px; }
.grid--materiais .col-item{ width: 240px; }
.grid--materiais .col-cat{ width: 150px; }
.grid--materiais .col-unit{ width: 96px; }
.grid--materiais .col-status{ width: 102px; }
.grid--materiais .col-notes{ width: 112px; }
.grid--materiais .col-actions{ width: 88px; }

.grid--materiais .cell-actions{
  gap: 6px;
}

.grid--materiais .cell-actions .btn--icon{
  width: 30px;
  height: 30px;
}

.grid--materiais .cell-actions .icon{
  width: 14px;
  height: 14px;
}

.grid--materiais .tag{
  padding: 3px 7px;
  font-size: 11px;
}

.grid--materiais .badge{
  padding: 4px 8px;
  font-size: 11px;
}

.grid--armazem{
  min-width: 1160px;
}

.grid--armazem .col-item{ width: 220px; }
.grid--armazem .col-unit{ width: 86px; }
.grid--armazem .col-status{ width: 110px; }
.grid--armazem .col-notes{ width: 120px; }
.grid--armazem .col-actions{ width: 96px; }

.js-armazem-row{
  cursor: pointer;
}

.js-armazem-row:hover td{
  background: #f8fafc;
}

.armazem-detalhe-wrap{
  padding: 10px 12px;
}

.armazem-detalhe-head{
  margin-bottom: 8px;
}

.armazem-saldo--ok{
  color: #0f8f4e;
}

.armazem-saldo--warn{
  color: #9a3a3a;
}

.kit-grid--obra-top{
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1400px){
  .kit-grid--obra-top{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px){
  .kit-grid--obra-top{
    grid-template-columns: 1fr;
  }
}

/* Obra planeamento: cronograma interativo */
.planeamento-gantt{
  display: grid;
  gap: 10px;
}

.planeamento-gantt__tools{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.planeamento-gantt__hint{
  font-size: 12px;
  color: #667085;
}

.planeamento-gantt__zoom{
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--grid);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.planeamento-gantt__zoom .btn{
  border: 0;
  border-radius: 0;
  min-width: 34px;
  height: 30px;
  padding: 0 10px;
}

.planeamento-gantt__zoom-value{
  min-width: 58px;
  text-align: center;
  font-size: 12px;
  color: #344054;
  border-left: 1px solid var(--grid);
  border-right: 1px solid var(--grid);
  padding: 0 8px;
  line-height: 30px;
}

.planeamento-gantt__quick-nav{
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.planeamento-gantt__viewport{
  border: 1px solid var(--grid);
  border-radius: 12px;
  background: #fcfdff;
  overflow: auto;
  max-height: 72vh;
}

.planeamento-gantt__canvas{
  min-width: 100%;
  width: max-content;
  display: grid;
  grid-template-columns: 220px max-content;
  gap: 8px 10px;
  align-items: center;
  padding: 12px;
}

.planeamento-gantt__axis-label{
  font-size: 12px;
  color: #667085;
  font-weight: 700;
}

.planeamento-gantt__axis{
  position: relative;
  height: 34px;
  margin-top: 16px;
  border: 1px solid #d7deea;
  border-radius: 8px;
  background: #f5f8ff;
  overflow: visible;
}

.planeamento-gantt__axis-mark{
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(148, 163, 184, 0.2);
}

.planeamento-gantt__axis-mark--week{
  background: rgba(71, 85, 105, 0.35);
}

.planeamento-gantt__axis-text{
  position: absolute;
  top: 6px;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 700;
  color: #344054;
  white-space: nowrap;
  background: rgba(245, 248, 255, 0.92);
  padding: 0 4px;
  border-radius: 4px;
  line-height: 1.2;
}

.planeamento-gantt__deadline-tag{
  position: absolute;
  top: -18px;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  padding: 2px 5px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 4;
  color: #991b1b;
  background: rgba(255, 245, 245, 0.96);
  border: 1px solid rgba(220, 38, 38, 0.35);
  pointer-events: none;
}

.planeamento-gantt__deadline-tag--end{
  color: #7f1d1d;
}

.planeamento-gantt__axis-text--start{
  left: 6px;
  transform: none;
}

.planeamento-gantt__axis-text--end{
  right: 6px;
  left: auto;
  transform: none;
}

.planeamento-gantt__label{
  font-size: 13px;
  color: #344054;
  line-height: 1.2;
  padding-right: 4px;
}

.planeamento-gantt__label-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.planeamento-gantt__label strong{
  display: block;
  font-size: 13px;
  color: #101828;
  margin-bottom: 3px;
}

.planeamento-gantt__label-head strong{
  margin-bottom: 0;
}

.planeamento-gantt__label small{
  color: #667085;
  font-size: 11px;
}

.planeamento-gantt__add-inline{
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid #d0d7e2;
  background: #fff;
  color: #2563eb;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
}

.planeamento-gantt__add-inline:hover{
  background: #eef4ff;
}

.planeamento-gantt__track{
  position: relative;
  height: 46px;
  border: 1px solid #d7deea;
  border-radius: 10px;
  background: #f8faff;
  overflow: hidden;
}

.planeamento-gantt__track::before{
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      to right,
      rgba(148, 163, 184, 0.18) 0,
      rgba(148, 163, 184, 0.18) 1px,
      transparent 1px,
      transparent var(--planeamento-grid-day, 16px)
    ),
    repeating-linear-gradient(
      to right,
      rgba(71, 85, 105, 0.26) 0,
      rgba(71, 85, 105, 0.26) 1px,
      transparent 1px,
      transparent var(--planeamento-grid-week, 112px)
    );
  pointer-events: none;
}

.planeamento-gantt__bar{
  position: absolute;
  top: 4px;
  height: 36px;
  border-radius: 7px;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 20px 0 20px;
  background: var(--phase-color, #2563eb);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.2);
  cursor: grab;
  user-select: none;
  z-index: 4;
  overflow: hidden;
  white-space: normal;
  line-height: 1.1;
}

.planeamento-gantt__bar.is-saving{
  opacity: 0.6;
  cursor: progress;
}

.planeamento-gantt__bar.is-dragging{
  cursor: grabbing;
  box-shadow: 0 3px 10px rgba(16, 24, 40, 0.25);
}

.planeamento-gantt__bar-mode{
  opacity: 0.9;
  margin-right: 4px;
}

.planeamento-gantt__bar-text{
  display: inline-block;
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  width: 100%;
}

.planeamento-gantt__bar-handle{
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  background: rgba(255, 255, 255, 0.4);
  cursor: ew-resize;
}

.planeamento-gantt__bar-handle--start{
  left: 0;
  border-top-left-radius: 7px;
  border-bottom-left-radius: 7px;
}

.planeamento-gantt__bar-handle--end{
  right: 0;
  border-top-right-radius: 7px;
  border-bottom-right-radius: 7px;
}

.planeamento-gantt__add{
  position: absolute;
  right: 4px;
  left: auto;
  top: 4px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid #d0d7e2;
  background: #fff;
  color: #2563eb;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 6;
}

.planeamento-gantt__add:hover{
  background: #eef4ff;
}

.planeamento-gantt__deadline-line{
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 2px dashed rgba(220, 38, 38, 0.75);
  pointer-events: none;
  z-index: 5;
}

.planeamento-gantt__axis .planeamento-gantt__deadline-line{
  z-index: 3;
}

.planeamento-gantt__deadline-line--end{
  border-left-color: rgba(153, 27, 27, 0.9);
}

.planeamento-gantt__empty{
  font-size: 13px;
  color: #667085;
  padding: 8px 2px;
}

@media (max-width: 900px){
  .planeamento-gantt__canvas{
    grid-template-columns: 170px max-content;
  }
}
