/* ============================================================
   SWC-CRM · swc-modern.css  — Design System Unificado v3
   ============================================================ */

:root {
  --bg-base:    #0f1117;
  --bg-card:    #161b27;
  --bg-card2:   #1c2333;
  --bg-hover:   #1e2740;
  --border:     #252d3d;
  --border-lt:  #2e3a50;
  --text-1:     #e8eaf0;
  --text-2:     #8892a4;
  --text-3:     #546073;
  --blue:       #3b82f6;
  --purple:     #8b5cf6;
  --orange:     #f59e0b;
  --green:      #10b981;
  --red:        #ef4444;
  --pink:       #ec4899;
  --bg-deep:    var(--bg-base);
  --bg-input:   var(--bg-card2);
  --text-primary:   var(--text-1);
  --text-secondary: var(--text-2);
  --text-muted:     var(--text-3);
  --accent:     var(--orange);
  --accent-dim: rgba(245,158,11,.15);
  --green-dim:  rgba(16,185,129,.15);
  --red-dim:    rgba(239,68,68,.15);
  --blue-dim:   rgba(59,130,246,.15);
  --success:    var(--green);
  --warning:    var(--orange);
  --danger:     var(--red);
  --r:          12px;
  --rs:         8px;
  --tr:         .18s ease;
  --radius:     var(--rs);
  --radius-lg:  var(--r);
  --shadow:     0 4px 20px rgba(0,0,0,.4);
  --shadow-lg:  0 8px 40px rgba(0,0,0,.6);
  --sidebar-w:  260px;
  --foreground:         var(--text-1);
  --muted-foreground:   var(--text-2);
  --card:               var(--bg-card);
  --primary:            var(--blue);
  --muted:              var(--bg-card2);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.5;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-lt); border-radius: 4px; }

/* ── LAYOUT NOVO (#swc-app) ─── */
#swc-app { display: flex; min-height: 100vh; }
#page-content {
  min-height: 100vh; flex: 1;
  display: flex; flex-direction: column;
  overflow-x: hidden;
  margin-left: var(--sidebar-w);
}
html[data-sb='mini'] #page-content { margin-left: 64px; }

/* ── LAYOUT LEGADO (.crm-layout) ─── */
/* leads.html, prospeccao.html, follow-up.html usam esta estrutura */
.crm-layout {
  display: flex;
  min-height: 100vh;
}
.crm-layout .main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}
html[data-sb='mini'] .crm-layout .main-content { margin-left: 64px; }

/* ── SIDEBAR slot ─── */
#crm-sidebar-slot {
  width: var(--sidebar-w);
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  z-index: 100;
  flex-shrink: 0;
}
html[data-sb='mini'] #crm-sidebar-slot { width: 64px; }

/* ── PAGE STRUCTURE ─── */
.page-head {
  padding: 24px 28px 0;
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.page-header {
  padding: 24px 28px 0;
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 16px;
}
.page-title { font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.page-subtitle, .muted { font-size: 13px; color: var(--text-2); margin-top: 3px; }
.page-actions, .header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.page-body { padding: 20px 28px 32px; flex: 1; }

/* ── BOTÕES ─── */
.btn, .s-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--rs);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: none; transition: all var(--tr); white-space: nowrap;
  text-decoration: none; font-family: inherit;
}
.btn-primary, .s-btn--primary { background: var(--orange); color: #000; }
.btn-primary:hover, .s-btn--primary:hover { opacity: .88; transform: translateY(-1px); }
.btn-ghost, .btn-secondary, .s-btn--ghost {
  background: transparent; color: var(--text-2); border: 1px solid var(--border-lt);
}
.btn-ghost:hover, .btn-secondary:hover, .s-btn--ghost:hover { background: var(--bg-hover); color: var(--text-1); }
.btn-danger, .s-btn--danger { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239,68,68,.3); }
.btn-danger:hover, .s-btn--danger:hover { background: var(--red); color: #fff; }
.btn-sm, .s-btn--sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }
.btn-icon { padding: 7px; width: 32px; height: 32px; justify-content: center; }

/* ── CARDS ─── */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 20px; overflow: hidden; }
.card__hd, .card-header { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card__bd, .card-body { padding: 16px 20px; }
.card__title, .card-title { font-size: 14px; font-weight: 600; }
.card__sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ── KPIs ─── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px; padding: 20px 28px 0;
}
.kpi {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r); padding: 16px 20px;
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color var(--tr);
}
.kpi:hover { border-color: var(--border-lt); }
.kpi__label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); font-weight: 500; }
.kpi__value { font-size: 26px; font-weight: 700; line-height: 1.1; }
.kpi__sub   { font-size: 11px; color: var(--text-2); margin-top: 2px; }

/* stats-grid legado */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 24px; padding: 20px 28px 0;
}
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r); padding: 16px 20px; display: flex; flex-direction: column; gap: 6px; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); font-weight: 500; }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1; }

/* ── TOOLBAR ─── */
.toolbar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  padding: 12px 28px; background: var(--bg-card2);
  border-bottom: 1px solid var(--border); margin-top: 16px;
}
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; padding: 0 28px; }

/* ── INPUTS ─── */
.s-input, .form-control {
  padding: 8px 11px; background: var(--bg-card2);
  border: 1px solid var(--border-lt); border-radius: var(--rs);
  color: var(--text-1); font-size: 13px; font-family: inherit; width: 100%;
  transition: border-color var(--tr), box-shadow var(--tr);
}
.s-input:focus, .form-control:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(245,158,11,.15); }
.s-input::placeholder, .form-control::placeholder { color: var(--text-3); }
textarea.s-input, textarea.form-control { resize: vertical; min-height: 72px; }
.s-select, select.form-control {
  padding: 8px 11px; background: var(--bg-card2);
  border: 1px solid var(--border-lt); border-radius: var(--rs);
  color: var(--text-1); font-size: 13px; font-family: inherit;
  cursor: pointer; width: 100%; transition: border-color var(--tr);
}
.s-select:focus, select.form-control:focus { outline: none; border-color: var(--orange); }

/* ── TABELA ─── */
.table-wrap { overflow-x: auto; border-radius: var(--rs); }
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); background: var(--bg-card); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text-1); font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

/* ── BADGES ─── */
.badge, .pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 500; white-space: nowrap; background: var(--bg-hover); color: var(--text-2); border: 1px solid var(--border-lt); }
.badge-active  { background: rgba(16,185,129,.12); color: var(--green); border-color: rgba(16,185,129,.3); }
.badge-inactive{ background: rgba(239,68,68,.12);  color: var(--red);   border-color: rgba(239,68,68,.3); }
.badge-novo    { background: var(--blue-dim);  color: var(--blue); }
.badge-ganho   { background: var(--green-dim); color: var(--green); }
.badge-perdido { background: var(--red-dim);   color: var(--red); }
.badge-open    { background: var(--blue-dim);  color: var(--blue); }
.badge-won     { background: var(--green-dim); color: var(--green); }
.badge-lost    { background: var(--red-dim);   color: var(--red); }

/* ── FORMS ─── */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 2px; }
.field label, .form-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--text-3); }
.form-label .req, .field label .req { color: var(--orange); margin-left: 2px; }
.form-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.grid2       { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-col-full, .form-full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.section-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-2); padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }

/* ── DRAWER ─── */
.drawer-backdrop, .modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.65); backdrop-filter: blur(4px); z-index: 999; display: none; }
.drawer-backdrop.open { display: block; }
.drawer { position: fixed; top: 0; right: 0; width: 560px; max-width: 100%; height: 100vh; background: var(--bg-card); border-left: 1px solid var(--border); display: flex; flex-direction: column; z-index: 1000; transform: translateX(100%); transition: transform .25s ease; overflow: hidden; }
.drawer.open { transform: translateX(0); }
.drawer__hd, .modal-header { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.drawer__bd, .modal-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.drawer__ft, .modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-shrink: 0; }

/* ── MODAL CENTER ─── */
.modal-panel { position: fixed; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r); display: flex; flex-direction: column; z-index: 1001; overflow: hidden; width: 580px; max-width: 100%; max-height: 90vh; top: 50%; left: 50%; transform: translate(-50%,-50%); }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { width: 30px; height: 30px; border-radius: 6px; border: none; background: var(--bg-hover); color: var(--text-2); cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; transition: all var(--tr); }
.modal-close:hover { background: var(--red-dim); color: var(--red); }

/* ── EMPTY STATE ─── */
.empty-state { padding: 60px 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; }
.empty-state-icon, .empty-icon { font-size: 40px; opacity: .35; }
.empty-state-title, .empty-title { font-size: 15px; font-weight: 600; color: var(--text-2); }
.empty-state-sub, .empty-sub { font-size: 13px; color: var(--text-3); max-width: 300px; }

/* ── TOAST ─── */
#toast-container, #toast-host { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; }
.toast { padding: 11px 16px; border-radius: var(--rs); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow); min-width: 220px; animation: toastIn .2s ease; }
@keyframes toastIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
.toast-success, .toast-ok { background: rgba(16,185,129,.15); border:1px solid var(--green); color: var(--green); }
.toast-error,   .toast-err { background: rgba(239,68,68,.15);  border:1px solid var(--red);   color: var(--red); }
.toast-info  { background: rgba(59,130,246,.15); border:1px solid var(--blue);   color: var(--blue); }
.toast-warn  { background: rgba(245,158,11,.15); border:1px solid var(--orange); color: var(--orange); }

/* ── SPINNER ─── */
.spinner { width: 22px; height: 22px; border: 2px solid var(--border-lt); border-top-color: var(--orange); border-radius: 50%; animation: spin .7s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── PIPELINE / KANBAN ─── */
.pipeline-grid { display: flex; gap: 14px; overflow-x: auto; padding: 0 28px 8px; min-height: 400px; }
.pipeline-col { min-width: 260px; max-width: 280px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r); display: flex; flex-direction: column; flex-shrink: 0; }
.pipeline-col-header { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.pipeline-col-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.pipeline-col-count { background: var(--bg-hover); border-radius: 10px; padding: 2px 8px; font-size: 11px; color: var(--text-3); }
.pipeline-col-body  { padding: 10px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.pipeline-card { background: var(--bg-base); border: 1px solid var(--border); border-radius: var(--rs); padding: 12px; cursor: pointer; transition: all var(--tr); }
.pipeline-card:hover { border-color: var(--orange); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.3); }
.pipeline-card-title { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.pipeline-card-sub   { font-size: 11px; color: var(--text-3); }

/* ── UTILITÁRIOS ─── */
.flex { display: flex; } .flex-center { display: flex; align-items: center; justify-content: center; } .flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-4{gap:4px;} .gap-8{gap:8px;} .gap-12{gap:12px;} .gap-16{gap:16px;}
.mt-8{margin-top:8px;} .mt-12{margin-top:12px;} .mt-16{margin-top:16px;} .mt-24{margin-top:24px;} .mb-16{margin-bottom:16px;}
.text-muted{color:var(--text-3);} .text-sm{font-size:12px;} .text-accent{color:var(--orange);} .text-green{color:var(--green);} .text-red{color:var(--red);} .text-blue{color:var(--blue);}
.font-bold{font-weight:700;} .font-medium{font-weight:500;}
.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.w-full{width:100%;}

/* ── RESPONSIVO ─── */
@media (max-width: 900px) {
  #page-content { margin-left: 0; }
  .crm-layout .main-content { margin-left: 0; }
  .page-head, .page-header { flex-direction: column; padding: 16px; }
  .page-body { padding: 16px; }
  .toolbar { padding: 12px 16px; }
  .kpi-row { padding: 16px; grid-template-columns: repeat(2,1fr); }
  .stats-grid { padding: 16px; grid-template-columns: repeat(2,1fr); }
  .form-grid, .form-grid-3, .grid2 { grid-template-columns: 1fr; }
  .drawer { width: 100%; }
}


aside#swcSidebar,
#crm-sidebar-slot aside#swcSidebar {
  background: linear-gradient(180deg, #1a1d2e 0%, #0f1419 100%) !important;
  background-image: linear-gradient(180deg, #1a1d2e 0%, #0f1419 100%) !important;
}

/* ── SIDEBAR FIX DEFINITIVO ── */
#crm-sidebar-slot {
  background: linear-gradient(180deg, #1a1d2e 0%, #0f1419 100%) !important;
  overflow: hidden;
}
#crm-sidebar-slot aside#swcSidebar,
aside#swcSidebar {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  width: 100% !important;
  height: 100vh !important;
  min-height: 100vh !important;
  background: linear-gradient(180deg, #1a1d2e 0%, #0f1419 100%) !important;
  z-index: auto !important;
}
/* Neutraliza NAV legado que pode sobrepor o slot da sidebar */
nav#sidebar.sidebar{
  display: none !important;
}
/* =========================================
   SAFETY FIX - NAV LEGADO NÃO INTERFERE
   ========================================= */
nav#sidebar.sidebar{
  display: none !important;
}
/* BOTÕES DENTRO DAS CAIXAS */

.box-header-actions{
  display:flex;
  gap:8px;
  justify-content:flex-end;
  margin-bottom:10px;
}

.s-btn{
  padding:6px 12px;
  border-radius:6px;
  font-size:12px;
  cursor:pointer;
}

.s-btn--ghost{
  background:transparent;
  border:1px solid rgba(255,255,255,0.1);
  color:#94a3b8;
}

.s-btn--ghost:hover{
  border-color:#3b82f6;
  color:#fff;
}

.s-btn--primary{
  background:#f59e0b;
  border:none;
  color:#000;
  font-weight:700;
}

.resumo-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  font-size:14px;
}

.wbs-row{
  display:flex;
  justify-content:space-between;
  padding:6px 0;
  border-bottom:1px solid rgba(255,255,255,0.05);
}

.status-btn {
  background: transparent;
  border: 1px solid #334155;
  color: #cbd5f5;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.status-btn.active {
  background: #f59e0b;
  color: #000;
  font-weight: bold;
}

/* PRODUTO */
.tag-produto-sistema {
    background: rgba(0, 200, 120, 0.18);
    color: #00ff9c;
    border: 1px solid rgba(0,255,156,0.3);
}

.tag-produto-grupo {
    background: rgba(0, 200, 120, 0.12);
    color: #00d88a;
    border: 1px solid rgba(0,255,156,0.2);
}

.tag-produto-item {
    background: rgba(0, 200, 120, 0.08);
    color: #00b874;
    border: 1px solid rgba(0,255,156,0.15);
}

/* SERVIÇO */
.tag-servico-etapa {
    background: rgba(160, 90, 255, 0.18);
    color: #caa6ff;
    border: 1px solid rgba(200,150,255,0.3);
}

.tag-servico-subetapa {
    background: rgba(160, 90, 255, 0.12);
    color: #b48cff;
    border: 1px solid rgba(200,150,255,0.2);
}

.tag-servico-composicao {
    background: rgba(160, 90, 255, 0.08);
    color: #9a70ff;
    border: 1px solid rgba(200,150,255,0.15);
}
.def-subtabs{
  display:flex;
  gap:6px;
  margin-bottom:12px;
}

.def-subtab{
  padding:6px 12px;
  border-radius:20px;
  background:#1a233a;
  border:1px solid #2a3550;
  cursor:pointer;
}

.def-subtab.active{
  background:#f59e0b;
  color:#000;
}

.def-grid{
  display:grid;
  grid-template-columns: 1.2fr 1.2fr 1fr;
  gap:12px;
}

.def-tree,.def-editor,.def-summary{
  background:#111a2e;
  border:1px solid #27324a;
  border-radius:12px;
  padding:12px;
}

.tree-scroll{
  max-height:420px;
  overflow:auto;
}

.editor-tabs{
  display:flex;
  gap:6px;
  margin-bottom:10px;
}

.editor-tab-small{
  padding:4px 10px;
  border-radius:8px;
  background:#1f2b46;
}

.editor-tab-small.active{
  background:#f59e0b;
  color:#000;
}

.summary-card{
  padding:10px;
  border:1px solid #27324a;
  border-radius:10px;
}

.summary-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}

.logo{
  height: 60px;
  width: auto;
}

.header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:2px solid #ddd;
  padding-bottom:10px;
  margin-bottom:20px;
}

.title h1{
  margin:0;
  font-size:18px;
  color:#2F2F2F;
}

.meta{
  text-align:right;
  font-size:12px;
}

/* ============================================================
   SWC-CRM · PATCH DE VISUALIZAÇÃO DE TABELAS v1
   Melhoria de legibilidade: zebra-striping, bordas, hierarquia
   ============================================================ */

/* ── VARIÁVEIS EXTRAS PARA TABELAS ────────────────────────── */
:root {
  --table-border:      rgba(255,255,255,.09);   /* borda de célula */
  --table-head-bg:     rgba(255,255,255,.035);  /* fundo do <thead> */
  --table-head-color:  #a8b4c8;                 /* texto do <th> */
  --table-row-odd:     transparent;
  --table-row-even:    rgba(255,255,255,.025);  /* zebra suave */
  --table-row-hover:   rgba(245,158,11,.07);    /* hover laranja-dim */
  --table-row-hover-border: rgba(245,158,11,.5);
  --table-accent-line: rgba(255,255,255,.06);   /* separador de seção */
}

/* ── RESET E OVERRIDE DE TABELA GLOBAL ─────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}

/* Cabeçalho: mais destaque, fundo próprio, cor mais clara */
th {
  padding: 11px 14px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--table-head-color);
  background: var(--table-head-bg);
  border-bottom: 2px solid var(--table-border);
  border-right: 1px solid var(--table-accent-line);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
th:last-child { border-right: none; }

/* Células: bordas visíveis + padding generoso */
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--table-border);
  border-right: 1px solid var(--table-accent-line);
  color: var(--text-1);
  font-size: 13px;
  vertical-align: middle;
  transition: background .12s ease;
}
td:last-child { border-right: none; }

/* Zebra striping: linhas pares levemente diferenciadas */
tbody tr:nth-child(even) td {
  background: var(--table-row-even);
}

/* Hover: destaque laranja-dim com borda lateral esquerda */
tbody tr:hover td {
  background: var(--table-row-hover) !important;
}
tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--table-row-hover-border);
}

/* Última linha sem border-bottom */
tr:last-child td { border-bottom: none; }

/* ── TABELAS COM CLASSE .table-clean (orcamentos.html) ──────── */
.table-clean th {
  padding: 11px 10px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--table-head-color);
  background: rgba(255,255,255,.04);
  border-bottom: 2px solid var(--table-border);
  border-right: 1px solid var(--table-accent-line);
}
.table-clean th:last-child { border-right: none; }
.table-clean td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--table-border);
  border-right: 1px solid var(--table-accent-line);
}
.table-clean td:last-child { border-right: none; }
.table-clean tbody tr:nth-child(even) td {
  background: var(--table-row-even);
}
.table-clean tbody tr:hover td {
  background: var(--table-row-hover) !important;
}
.table-clean tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--table-row-hover-border);
}

/* ── TABELAS WBS / HIERÁRQUICAS ─────────────────────────────── */
/* Classes usadas no orcamento_edit.html para WBS EAP */
.wbs-table th {
  background: rgba(59,130,246,.08);
  border-bottom: 2px solid rgba(59,130,246,.25);
  color: #93c5fd;
}

/* Nível raiz (A1, A2...) */
tr.wbs-level-0 td {
  font-weight: 800;
  font-size: 13px;
  color: #f1f5f9;
  background: rgba(59,130,246,.07) !important;
  border-left: 3px solid rgba(59,130,246,.5);
}

/* Nível sistema (A1.1) */
tr.wbs-level-1 td {
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(255,255,255,.03) !important;
  border-left: 3px solid rgba(139,92,246,.4);
}
tr.wbs-level-1 td:first-child { padding-left: 22px; }

/* Nível tipo (A1.1.1 Produto/Infra/Serviço) */
tr.wbs-level-2 td {
  font-weight: 500;
  color: #94a3b8;
  background: rgba(255,255,255,.015) !important;
  border-left: 3px solid rgba(16,185,129,.3);
}
tr.wbs-level-2 td:first-child { padding-left: 36px; }

/* Nível item */
tr.wbs-level-3 td {
  font-weight: 400;
  color: #64748b;
  background: transparent !important;
  border-left: 3px solid rgba(255,255,255,.06);
}
tr.wbs-level-3 td:first-child { padding-left: 50px; }

/* Linha de totais / destaque em tabelas */
tr.row-total td {
  font-weight: 800;
  color: #f8fafc;
  background: rgba(245,158,11,.08) !important;
  border-top: 2px solid rgba(245,158,11,.25);
  border-bottom: 2px solid rgba(245,158,11,.12);
}
tr.row-total td:first-child {
  box-shadow: inset 3px 0 0 var(--orange);
}

/* Linha de subtotal */
tr.row-subtotal td {
  font-weight: 700;
  color: #e2e8f0;
  background: rgba(255,255,255,.04) !important;
  border-top: 1px solid rgba(255,255,255,.1);
}

/* ── MEMÓRIA / TABELA DE ITENS ──────────────────────────────── */
/* Melhorar tabela de Memória item a item */
.memory-table td,
table.mem-table td {
  padding: 9px 12px;
  font-size: 12px;
}
.memory-table th,
table.mem-table th {
  font-size: 10px;
}

/* ── TABELA DE RESUMO GERENCIAL ─────────────────────────────── */
/* Linhas de resumo financeiro */
tr.summary-group td {
  font-weight: 700;
  background: rgba(255,255,255,.04) !important;
  color: #e2e8f0;
  border-top: 1px solid rgba(255,255,255,.08);
}
tr.summary-highlight td {
  font-weight: 800;
  color: var(--green);
  background: rgba(16,185,129,.07) !important;
}
tr.summary-cost td {
  font-weight: 800;
  color: var(--orange);
  background: rgba(245,158,11,.07) !important;
}

/* ── WRAP DO SCROLL HORIZONTAL ──────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.07);
  /* Scrollbar mais visível na horizontal */
}
.table-wrap::-webkit-scrollbar {
  height: 6px;
}
.table-wrap::-webkit-scrollbar-track {
  background: rgba(255,255,255,.03);
  border-radius: 4px;
}
.table-wrap::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.15);
  border-radius: 4px;
}
.table-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(245,158,11,.4);
}

/* ── CÉLULAS NUMÉRICAS / MONETÁRIAS ────────────────────────── */
td.money,
td.num,
td[data-type="money"],
td[data-type="num"] {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  color: #f8fafc;
}
td.money-green { color: var(--green); font-weight: 700; }
td.money-red   { color: var(--red);   font-weight: 700; }
td.money-orange{ color: var(--orange);font-weight: 700; }

/* ── CHIPS DE STATUS NA TABELA ──────────────────────────────── */
/* Evitar que status pill quebre o alinhamento vertical */
td .pill,
td .badge {
  vertical-align: middle;
}

/* ── ESTADO VAZIO ────────────────────────────────────────────── */
td.empty-state,
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-3);
  font-size: 14px;
}

/* ── PRINT FRIENDLY ─────────────────────────────────────────── */
@media print {
  :root {
    --table-border: #d1d5db;
    --table-head-bg: #f3f4f6;
    --table-head-color: #374151;
    --table-row-even: #f9fafb;
    --table-row-hover: transparent;
    --text-1: #111827;
  }
  th, td { color: #111827 !important; border-color: #d1d5db !important; }
  .table-wrap { border: none; }
}
/* suporte ao modo via classes (sidebar-crm.js) */
#crm-sidebar-slot.sb-mini{width:64px;}
#page-content.sb-collapsed{margin-left:64px;}