/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
       font-size: 13px; color: #1e293b; background: #f1f5f9; line-height: 1.5;
       overflow: hidden; }
#app { display: flex; flex-direction: column; height: 100vh; }
button { cursor: pointer; font-family: inherit; font-size: 13px; }
input, select { font-family: inherit; font-size: 13px; }

/* ── Top Nav ──────────────────────────────────────────────────────────────── */
.top-nav {
  display: flex; align-items: center; justify-content: space-between;
  background: #1e40af; color: #fff; padding: 0 20px; height: 52px;
  position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px #0004;
}
.nav-brand { display: flex; align-items: center; gap: 10px; }
.nav-logo   { font-size: 22px; }
.nav-title  { font-size: 16px; font-weight: 600; letter-spacing: .3px; }
.nav-actions { display: flex; gap: 8px; }

/* ── Section Tabs (navegação primária no topo) ────────────────────────────── */
.section-tabs { display: flex; gap: 6px; }
.section-tab { padding: 6px 14px; border-radius: 8px; border: none; background: #ffffff1a;
               color: #dbeafe; font-weight: 600; font-size: 13px; transition: .15s; }
.section-tab:hover  { background: #ffffff33; color: #fff; }
.section-tab.active { background: #fff; color: #1e40af; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 6px 14px;
       border-radius: 6px; border: none; font-weight: 500; transition: .15s; }
.btn-primary  { background: #2563eb; color: #fff; }
.btn-primary:hover  { background: #1d4ed8; }
.btn-secondary { background: #64748b; color: #fff; }
.btn-secondary:hover { background: #475569; }
.btn-outline  { background: transparent; border: 1px solid currentColor; color: inherit; }
.btn-outline:hover  { background: #f1f5f9; }
.btn-ghost    { background: transparent; color: #64748b; border: none; }
.btn-ghost:hover    { background: #f1f5f9; }
.btn-danger   { background: #dc2626; color: #fff; border: none; }
.btn-danger:hover   { background: #b91c1c; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { background: transparent; border: none; color: inherit; font-size: 16px;
            padding: 4px 8px; border-radius: 4px; }
.btn-icon:hover { background: #f1f5f9; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Settings Panel ───────────────────────────────────────────────────────── */
.settings-panel { background: #fff; border-bottom: 1px solid #e2e8f0; padding: 10px 20px; }
.settings-inner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.settings-sep   { width: 1px; height: 20px; background: #e2e8f0; margin: 0 4px; }
.settings-field { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: #475569; }

/* ── Filter Bar ───────────────────────────────────────────────────────────── */
.filter-bar { background: #fff; border-bottom: 1px solid #e2e8f0; padding: 10px 20px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filter-group { display: flex; flex-direction: column; gap: 3px; }
.filter-group-emitente { flex: 0 0 auto; }
.filter-group-search { flex: 1 1 200px; }
.filter-label { font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .5px; }
.filter-select { height: 32px; padding: 0 8px; border: 1px solid #cbd5e1; border-radius: 6px;
                 background: #fff; color: #1e293b; outline: none; }
.filter-select:focus { border-color: #2563eb; box-shadow: 0 0 0 2px #2563eb22; }
.filter-input { height: 32px; padding: 0 10px; border: 1px solid #cbd5e1; border-radius: 6px;
                background: #fff; color: #1e293b; outline: none; width: 100%; }
.filter-input:focus { border-color: #2563eb; box-shadow: 0 0 0 2px #2563eb22; }
.chip-group { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { padding: 3px 9px; border-radius: 20px; border: 1px solid #cbd5e1; background: #fff;
        color: #475569; font-size: 12px; font-weight: 500; transition: .1s; }
.chip:hover     { border-color: #2563eb; color: #2563eb; }
.chip-active    { background: #2563eb; color: #fff; border-color: #2563eb; }
.toggle-stack { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 32px; }
.filter-group-entrega .atraso-toggle { height: 18px; padding: 0 4px; white-space: nowrap; }

/* ── Summary Cards ────────────────────────────────────────────────────────── */
/* Tudo numa linha só: não quebra (nowrap); se não couber em telas pequenas, rola na
   horizontal em vez de empurrar o grupo "Geral" pra baixo. */
.summary-cards { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 10px; padding: 12px 16px;
                 background: #fff; border-bottom: 1px solid #e2e8f0; align-items: flex-start; }
/* Blocos rotulados: Obras (obra+cliente) × Pedidos (linha) × Geral */
.card-group { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.card-group + .card-group { padding-left: 12px; border-left: 1px solid #e2e8f0; }
.card-group-cards { display: flex; flex-wrap: nowrap; gap: 8px; }
.card-group-label { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700;
                    text-transform: uppercase; letter-spacing: .5px; color: #475569; }
.card-group-label span { font-weight: 500; text-transform: none; letter-spacing: 0;
                         color: #94a3b8; font-size: 10px; }
.card-group-label::before { content: ''; width: 9px; height: 9px; border-radius: 3px; background: #cbd5e1; }
.card-group-label-obras::before   { background: #2563eb; }
.card-group-label-pedidos::before { background: #4338ca; }
.card { padding: 12px 16px; border-radius: 10px; min-width: 110px; color: #fff; flex: 1 1 110px; }
/* Cards do resumo (dashboard topo): tamanho uniforme — largura fixa + altura igual,
   conteúdo centralizado. Largura enxuta p/ caber todos os grupos numa linha (inclui o
   card "Sem Obra"). Não afeta .tec-cards / .dash-cards. */
.summary-cards .card { box-sizing: border-box; flex: 0 0 112px; width: 112px; min-width: 112px; height: 84px;
                       padding: 11px 12px; display: flex; flex-direction: column; justify-content: center; }
.card-value    { font-size: 22px; font-weight: 700; line-height: 1.2; }
.card-value-sm { font-size: 13px; font-weight: 600; }
.card-label    { font-size: 11px; font-weight: 600; opacity: .85; text-transform: uppercase; margin-top: 2px; }
.card-blue   { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.card-indigo { background: linear-gradient(135deg, #4338ca, #6366f1); }
.card-purple { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.card-red    { background: linear-gradient(135deg, #dc2626, #ef4444); }
.card-yellow { background: linear-gradient(135deg, #d97706, #f59e0b); }
.card-green  { background: linear-gradient(135deg, #16a34a, #22c55e); }
.card-gray   { background: linear-gradient(135deg, #475569, #64748b); }
.card-slate  { background: linear-gradient(135deg, #64748b, #94a3b8); }
.card-teal   { background: linear-gradient(135deg, #0d9488, #14b8a6); }
.card-broken { background: linear-gradient(135deg, #b91c1c, #ef4444); }
.card-clickable { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.card-clickable:hover { transform: translateY(-2px); box-shadow: 0 6px 16px #0003; }
.card-empty  { color: #94a3b8; padding: 10px 0; }

/* Toggle "atraso ao vivo" acima dos cards */
.summary-toolbar { display: flex; justify-content: flex-end; align-items: center;
                   padding: 8px 20px 0; background: #fff; }
.summary-toolbar.hidden { display: none; }
.atraso-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
                 font-weight: 500; color: #475569; cursor: pointer; user-select: none; }
.atraso-toggle input { cursor: pointer; margin: 0; }
.atraso-toggle:hover { color: #1e293b; }

/* ── View Toolbar ─────────────────────────────────────────────────────────── */
.view-toolbar { display: flex; align-items: center; justify-content: space-between;
                padding: 8px 20px; background: #fff; border-bottom: 1px solid #e2e8f0; }
.view-tabs { display: flex; gap: 4px; }
.view-tab { padding: 6px 14px; border-radius: 6px; border: none; background: transparent;
            color: #64748b; font-weight: 500; transition: .15s; }
.view-tab:hover  { background: #f1f5f9; }
.view-tab.active { background: #2563eb; color: #fff; }
.view-info { font-size: 12px; color: #94a3b8; }

/* ── Main Content ─────────────────────────────────────────────────────────── */
.main-content { flex: 1; min-height: 0; overflow: hidden; }
.view-panel { height: 100%; }
.hidden { display: none !important; }

/* ── App Sections (Dashboard / Obras / Agenda / Técnicos) ─────────────────── */
.app-section { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.section-scroll { flex: 1; min-height: 0; overflow: auto; padding: 18px 20px; }
.section-head { display: flex; align-items: center; justify-content: space-between;
                padding: 12px 20px; background: #fff; border-bottom: 1px solid #e2e8f0; }
.section-head h2 { font-size: 16px; font-weight: 700; color: #1e293b; }
.section-subtabs { display: flex; gap: 4px; }
.section-subtab { padding: 6px 14px; border-radius: 6px; border: none; background: transparent;
                  color: #64748b; font-weight: 600; transition: .15s; }
.section-subtab:hover  { background: #f1f5f9; }
.section-subtab.active  { background: #2563eb; color: #fff; }
.section-empty { color: #94a3b8; text-align: center; padding: 40px 20px; font-size: 13px; }

/* ── Técnicos & Equipes ───────────────────────────────────────────────────── */
.tec-cards { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.tec-cards .card { min-width: 130px; }
.tec-toolbar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.tec-form { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 14px; margin-bottom: 14px; }
.tec-form-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.tec-form-actions { display: flex; gap: 8px; margin-top: 4px; }
.tec-color { width: 42px; height: 32px; padding: 2px; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; }
.tec-actions { white-space: nowrap; text-align: right; }
.tec-avatar { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
              border-radius: 50%; background: #2563eb; color: #fff; font-weight: 700; font-size: 13px;
              background-size: cover; background-position: center; }
.tec-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }

/* ── Gantt ────────────────────────────────────────────────────────────────── */
/* Timeline contínua: --ppd (px/dia) controla o zoom; posições via calc()      */
.gantt-wrap {
  height: 100%; display: flex; flex-direction: column;
  --ppd: 14; --total-days: 0; --wkoff: 0;
}

.gantt-nav { display: flex; align-items: center; gap: 10px; padding: 8px 16px;
             background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.gantt-period-label { font-weight: 600; font-size: 14px; flex: 1; text-align: center; color: #1e40af; }
.gantt-count { font-size: 12px; color: #94a3b8; }

.gantt-scroll-wrap { flex: 1; display: flex; overflow: hidden; }

.gantt-labels {
  width: 280px; flex-shrink: 0;
  overflow-y: scroll;
  scrollbar-width: none;       /* Firefox */
  -ms-overflow-style: none;    /* IE/Edge */
  border-right: 2px solid #e2e8f0;
  background: #fff;
}
.gantt-labels::-webkit-scrollbar { display: none; }
.gantt-labels-header {
  position: sticky; top: 0; z-index: 10;
  height: 58px; box-sizing: border-box;
  display: flex; align-items: flex-end;
  padding: 0 10px 6px 8px;
  background: #f8fafc; border-bottom: 2px solid #e2e8f0;
  font-size: 11px; font-weight: 600; color: #64748b;
  text-transform: uppercase; letter-spacing: .03em;
}
.zoom-months .gantt-labels-header { height: 24px; }
.gantt-label-row {
  height: 44px; display: flex; align-items: center; gap: 8px;
  padding: 0 10px 0 8px; border-bottom: 1px solid #f1f5f9;
  cursor: pointer; transition: background .1s;
  content-visibility: auto; contain-intrinsic-size: auto 45px;
}
.gantt-label-row:hover { background: #eff6ff; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.lbl-text { overflow: hidden; }
.lbl-obra  { font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lbl-client { font-size: 11px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.gantt-timeline-scroll { flex: 1; overflow: auto; position: relative; cursor: grab; }
.gantt-panning .gantt-timeline-scroll,
.gantt-panning .gantt-timeline-scroll * { cursor: grabbing !important; user-select: none; }

/* canvas = única origem de largura da timeline */
.gantt-canvas {
  position: relative;
  width: calc(var(--ppd) * var(--total-days) * 1px);
  min-width: 100%;
}

/* header de 2 níveis: meses (label sticky) + dias */
.gantt-header {
  position: sticky; top: 0; z-index: 10;
  background: #f8fafc; border-bottom: 2px solid #e2e8f0;
}
.gantt-header-months { display: flex; height: 22px; box-sizing: border-box; }
.month-cell {
  position: relative; flex-shrink: 0;
  border-right: 1px solid #dbe2ea; border-bottom: 1px solid #e9ecef;
  font-size: 11px; font-weight: 600; color: #334155;
  cursor: pointer; user-select: none;
}
.month-cell:hover { background: #eff6ff; }
.month-label {
  position: sticky; left: 6px;
  display: inline-block; padding: 3px 4px 0;
  white-space: nowrap; line-height: 1.4;
}
.gantt-header-days { display: flex; height: 34px; }
.zoom-months .gantt-header-days { display: none; }
.date-col {
  width: calc(var(--ppd) * 1px);
  flex-shrink: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; border-right: 1px solid #e9ecef;
  font-size: 11px; user-select: none; position: relative; cursor: pointer;
  overflow: hidden;
}
.date-col:hover { background: #eff6ff; }
.col-resize-handle {
  position: absolute; right: 0; top: 0; bottom: 0; width: 6px;
  cursor: col-resize; z-index: 10;
}
.col-resize-handle:hover { background: rgba(59,130,246,.35); }
.date-col.weekend { background: #fef9f0; color: #9ca3af; }
.date-col.today-col { background: #dbeafe; color: #1e40af; font-weight: 700; }
.day-num { font-size: 13px; font-weight: 600; line-height: 1; }
.day-dow { font-size: 10px; color: #94a3b8; }
.today-col .day-dow { color: #3b82f6; }
.zoom-compact .day-num { font-size: 9px; }
.zoom-compact .day-dow { display: none; }

/* corpo: fim de semana sombreado via gradiente (sem células de grade) */
.gantt-body {
  position: relative;
  background-image: repeating-linear-gradient(90deg,
    transparent 0, transparent calc(var(--ppd) * 5px),
    #f6f1e7 calc(var(--ppd) * 5px), #f6f1e7 calc(var(--ppd) * 7px));
  background-position-x: calc(var(--ppd) * var(--wkoff) * -1px);
}
.zoom-days .gantt-body, .zoom-compact .gantt-body {
  background-image:
    repeating-linear-gradient(90deg, #f1f5f9 0 1px, transparent 1px calc(var(--ppd) * 1px)),
    repeating-linear-gradient(90deg,
      transparent 0, transparent calc(var(--ppd) * 5px),
      #f6f1e7 calc(var(--ppd) * 5px), #f6f1e7 calc(var(--ppd) * 7px));
}
.zoom-months .gantt-body { background-image: none; }

/* separadores verticais de mês — visíveis em qualquer zoom */
.gantt-month-grid > div {
  position: absolute; top: 0; bottom: 0; width: 1px;
  background: #dde4ed; pointer-events: none;
}

/* linha "hoje" única atravessando todas as linhas */
.gantt-today-line {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: #2563eb; opacity: .5; pointer-events: none; z-index: 5;
}
.gantt-today-line[hidden] { display: none; }

.gantt-row-body {
  position: relative; height: 44px;
  border-bottom: 1px solid #f1f5f9; background: transparent;
  content-visibility: auto; contain-intrinsic-size: auto 45px;
}
.gantt-rows > .gantt-row-body:nth-child(even) { background: rgba(241,245,249,.45); }

.gantt-bar {
  position: absolute; top: 8px; height: 28px; border-radius: 5px;
  width: max-content; max-width: 240px;
  color: #fff; font-size: 11px; font-weight: 600;
  padding: 0 8px 0 4px; display: flex; align-items: center; gap: 6px;
  cursor: pointer; transition: filter .15s; white-space: nowrap;
  overflow: hidden;
  box-shadow: 0 1px 3px #0003;
}
.gantt-bar:hover { filter: brightness(1.12); box-shadow: 0 2px 8px #0004; }
.gantt-bar-name { overflow: hidden; text-overflow: ellipsis; }
.gantt-bar-days {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: #fff; color: #1e293b; font-size: 10px; font-weight: 700;
}
.zoom-months .gantt-bar { padding: 0 2px; }

.gantt-span-line {
  position: absolute; top: 50%; transform: translateY(-50%);
  height: 4px; border-radius: 2px;
  opacity: 0.30; pointer-events: none; z-index: 1;
}

.gantt-schedule-dot {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 12px; height: 22px; border-radius: 3px;
  background: #1e40af; border: 2px solid #fff;
  box-shadow: 0 1px 4px #0003;
  z-index: 4; cursor: default; pointer-events: auto;
}
.zoom-months .gantt-schedule-dot { display: none; }

/* ── Works Table ──────────────────────────────────────────────────────────── */
.works-table-wrap { height: 100%; display: flex; flex-direction: column; }
.table-info { padding: 8px 20px; font-size: 12px; color: #64748b; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.table-scroll { flex: 1; overflow: auto; }
.table-empty { padding: 40px; text-align: center; color: #94a3b8; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { position: sticky; top: 0; background: #f1f5f9; padding: 8px 10px;
                  text-align: left; font-weight: 600; font-size: 11px; color: #475569;
                  border-bottom: 2px solid #e2e8f0; white-space: nowrap; }
.th-sortable { cursor: pointer; user-select: none; }
.th-sortable:hover { background: #e2e8f0; }
.data-table td { padding: 7px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.row-clickable:hover td { background: #eff6ff; cursor: pointer; }
.td-num  { text-align: right; font-variant-numeric: tabular-nums; }
.td-date { white-space: nowrap; }
.td-obra { max-width: 200px; }

/* ── Badges & Status ──────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px;
         font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-sm { padding: 1px 6px; font-size: 10px; }
.status-atrasado  { background: #fee2e2; color: #dc2626; }
.status-no-prazo  { background: #fef3c7; color: #d97706; }
.status-faturado  { background: #dcfce7; color: #16a34a; }
.status-indefinido { background: #f1f5f9; color: #64748b; }
.status-removido  { background: #e2e8f0; color: #64748b; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: #0006; z-index: 200;
                 display: flex; align-items: center; justify-content: center; }
.modal-box { background: #fff; border-radius: 12px; width: 520px; max-width: 95vw;
             box-shadow: 0 20px 60px #0004; }
.modal-header { display: flex; align-items: center; justify-content: space-between;
                padding: 18px 20px 12px; border-bottom: 1px solid #e2e8f0; }
.modal-header h2 { font-size: 16px; font-weight: 700; color: #1e293b; }
.modal-body { padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px;
                padding: 12px 20px; border-top: 1px solid #e2e8f0; }

.drop-zone {
  border: 2px dashed #cbd5e1; border-radius: 10px; padding: 32px;
  text-align: center; cursor: pointer; transition: .2s; color: #64748b;
}
.drop-zone:hover, .drop-zone.drag-over { border-color: #2563eb; background: #eff6ff; }
.drop-icon { font-size: 36px; margin-bottom: 8px; }
.drop-sub { font-size: 12px; color: #94a3b8; margin-top: 4px; }

.file-info { background: #f1f5f9; border-radius: 8px; padding: 10px 14px;
             margin-top: 12px; font-size: 13px; color: #1e293b; }
.import-progress { margin-top: 14px; }
.progress-bar { height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.progress-fill { height: 100%; background: #2563eb; transition: width .4s; width: 0%; }
#import-status { font-size: 12px; color: #64748b; }

.import-result { margin-top: 14px; }
.result-ok { text-align: center; padding: 16px; }
.result-ok h3 { color: #16a34a; margin: 8px 0; }
.result-ok ul { list-style: none; font-size: 13px; color: #475569; margin-top: 8px; display: inline-block; text-align: left; }
.result-ok li::before { content: '• '; }
.result-icon { font-size: 32px; }
.result-err { background: #fee2e2; color: #dc2626; padding: 12px; border-radius: 8px; font-size: 13px; }
.result-warn  { color: #b45309; }
.result-alert { color: #b91c1c; font-weight: 600; }

/* ── União de obras ───────────────────────────────────────────────────────── */
.merge-box { width: 560px; }
.merge-hint { font-size: 12px; color: #64748b; margin-bottom: 12px; line-height: 1.5; }
.merge-results { margin-top: 12px; max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.merge-empty { font-size: 13px; color: #94a3b8; padding: 14px 4px; text-align: center; }
.merge-result { display: flex; align-items: center; justify-content: space-between; gap: 12px;
                width: 100%; text-align: left; padding: 10px 12px; border: 1px solid #e2e8f0;
                border-radius: 8px; background: #fff; cursor: pointer; transition: .12s; }
.merge-result:hover { border-color: #2563eb; background: #eff6ff; }
.merge-result-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.merge-result-nome { font-weight: 600; color: #1e293b; font-size: 13px;
                     white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.merge-result-cli  { font-size: 11px; color: #64748b; }
.merge-result-meta { font-size: 11px; color: #94a3b8; white-space: nowrap; flex-shrink: 0; }
.merge-panel { margin: 14px 0 4px; }
.merged-list { margin-top: 10px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px 10px; }
.merged-list-title { font-size: 11px; font-weight: 700; text-transform: uppercase; color: #64748b; margin-bottom: 6px; }
.merged-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; }
.merged-item + .merged-item { border-top: 1px dashed #e2e8f0; }
.merged-item-nome { font-size: 12px; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-unmerge { flex-shrink: 0; font-size: 11px; color: #dc2626; background: transparent; border: 1px solid #fecaca;
               border-radius: 6px; padding: 2px 8px; cursor: pointer; transition: .12s; }
.btn-unmerge:hover { background: #fee2e2; border-color: #dc2626; }

/* ── Pedidos removidos (painel + drawer) ──────────────────────────────────── */
.removidos-box, .broken-box { width: 600px; }
.rem-list { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow-y: auto; }
.rem-row { flex-shrink: 0; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }
.rem-row-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer; font-size: 12px; background: #f8fafc; }
.rem-row-head:hover { background: #f1f5f9; }
.rem-row-head .rem-emit { color: #64748b; font-size: 11px; }
.rem-row-head .rem-cli  { flex: 1; color: #475569; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rem-row-head .rem-val  { font-weight: 600; color: #1e293b; }
.rem-row-body { padding: 10px; border-top: 1px solid #f1f5f9; }
.rem-meta { display: flex; gap: 14px; font-size: 11px; color: #64748b; margin-bottom: 8px; flex-wrap: wrap; }

/* Complementares s/ Instalação — modal */
.compl-count { font-size: 12px; font-weight: 500; color: #64748b; }
.compl-obra { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.compl-obra strong { color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compl-cli { font-size: 11px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compl-tag { flex-shrink: 0; font-size: 11px; font-weight: 600; color: #0f766e;
             background: #ccfbf1; border-radius: 10px; padding: 2px 8px; }
.compl-row-flag td { background: #fff7ed; }

/* Banner + seção de obra fantasma / pedidos removidos no drawer */
.ghost-banner { background: #f1f5f9; border-left: 3px solid #94a3b8; color: #475569;
                font-size: 12px; padding: 10px 12px; border-radius: 6px; margin-bottom: 14px; }
.section-removed { color: #64748b; }
.order-removed { opacity: .9; }
.order-removed .removed-header { background: #f1f5f9; }

/* ── Uniões quebradas ─────────────────────────────────────────────────────── */
.bu-list { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; }
.bu-row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
          border: 1px solid #fecaca; background: #fef2f2; border-radius: 8px; padding: 10px 12px; }
.bu-info { min-width: 0; }
.bu-pair { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #1e293b; flex-wrap: wrap; }
.bu-arrow { color: #94a3b8; }
.bu-missing { text-decoration: line-through; color: #b91c1c; }
.bu-reason { font-size: 11px; color: #b91c1c; margin-top: 3px; }

/* ── Drawer ───────────────────────────────────────────────────────────────── */
.drawer-overlay { position: fixed; inset: 0; background: #0003; z-index: 150; }
.details-drawer {
  position: fixed; right: 0; top: 0; bottom: 0; width: 520px; max-width: 95vw;
  background: #fff; z-index: 160; display: flex; flex-direction: column;
  box-shadow: -4px 0 20px #0003; overflow: hidden;
}
.drawer-content { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.drawer-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 16px 20px; border-bottom: 1px solid #e2e8f0; background: #f8fafc;
}
.drawer-title { font-size: 15px; font-weight: 700; color: #1e293b; }
.drawer-sub   { font-size: 12px; color: #64748b; margin-top: 2px; }
.drawer-close { font-size: 18px; margin-left: 10px; }
.drawer-body  { flex: 1; overflow-y: auto; padding: 16px 20px; }

.detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 16px; }
.meta-row { display: flex; flex-direction: column; gap: 2px; }
.meta-label { font-size: 11px; font-weight: 600; color: #94a3b8; text-transform: uppercase; }

.duration-edit-panel { background: #f8fafc; border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; }
.duration-edit-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.dur-input { width: 80px; }
.termino-hint { font-size: 11px; color: #64748b; margin-top: 6px; }
.termino-hint--conflict { color: #dc2626; font-weight: 600; }

.drawer-conflict-alert {
  background: #fef2f2; border: 1.5px solid #fca5a5; border-radius: 8px;
  color: #b91c1c; font-size: 13px; font-weight: 600;
  padding: 10px 14px; margin-bottom: 14px; line-height: 1.45;
}

.gantt-span-line.line-conflict {
  background: #dc2626 !important; opacity: 0.55;
}
.gantt-schedule-dot.dot-conflict {
  background: #dc2626; border-color: #fff; box-shadow: 0 0 0 2px #fca5a5, 0 1px 4px #0003;
}

.section-title { font-size: 13px; font-weight: 700; color: #1e293b; margin-bottom: 10px; border-bottom: 1px solid #f1f5f9; padding-bottom: 6px; }

/* Cabeçalho dos Pedidos: título + toggle de ocultar créditos de projeto */
.pedidos-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pedidos-head .section-title { flex: 1 1 auto; }
.credito-toggle {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-size: 12px; color: #64748b; user-select: none; white-space: nowrap;
  margin-bottom: 10px;
}
.credito-toggle input { cursor: pointer; }
.credito-note {
  font-size: 11px; color: #92400e; background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 6px; padding: 6px 10px; margin-bottom: 8px;
}
.badge-credito { background: #ede9fe; color: #6d28d9; }
.order-credito { border-style: dashed; }
.order-credito .order-value { color: #94a3b8; font-weight: 500; }

.orders-list { display: flex; flex-direction: column; gap: 8px; }
.order-card { border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }
.order-header {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  cursor: pointer; background: #f8fafc; user-select: none;
}
.order-header:hover { background: #eff6ff; }
.toggle-arrow { font-size: 10px; color: #94a3b8; }
.order-emitente { font-size: 11px; color: #64748b; }
.order-luminarias {
  font-size: 11px; font-weight: 600; color: #475569; background: #f1f5f9;
  border: 1px solid #e2e8f0; border-radius: 10px; padding: 1px 8px; white-space: nowrap;
}

/* Contador de luminárias clicável (abre o modal de categorias) */
.luminarias-count-btn {
  display: inline-flex; align-items: center; gap: 4px; background: transparent;
  border: none; padding: 0; font: inherit; color: inherit; cursor: pointer;
}
.luminarias-count-btn:hover strong { text-decoration: underline; text-decoration-style: dotted; }
.luminarias-cfg-icon { font-size: 11px; color: #94a3b8; }

/* Modal de categorias da contagem de luminárias */
.luminarias-box { width: 420px; }
.lum-cat-list { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; max-height: 320px; overflow-y: auto; }
.lum-cat-row {
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: #1e293b;
  padding: 6px 4px; border-radius: 6px; cursor: pointer;
}
.lum-cat-row:hover { background: #f1f5f9; }
.lum-cat-row input { cursor: pointer; }
.lum-cat-all { border-bottom: 1px solid #e2e8f0; padding-bottom: 8px; margin-bottom: 4px; }
.order-value    { margin-left: auto; font-weight: 600; font-size: 12px; }
.order-body { padding: 10px 12px; background: #fff; }
.order-meta { display: flex; gap: 14px; font-size: 11px; color: #64748b; margin-bottom: 8px; flex-wrap: wrap; }

.products-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.products-table th { text-align: left; padding: 4px 6px; color: #64748b; border-bottom: 1px solid #f1f5f9; }
.products-table td { padding: 4px 6px; border-bottom: 1px solid #f8fafc; vertical-align: top; }

/* ── Spinner ──────────────────────────────────────────────────────────────── */
.spinner-wrap { display: flex; align-items: center; gap: 10px; color: #64748b; padding: 20px 0; }
.spinner { width: 20px; height: 20px; border: 3px solid #e2e8f0;
           border-top-color: #2563eb; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.err-msg { color: #dc2626; padding: 12px; }

/* ── Anotações da obra: 2º card do drawer (v1.11) ──────────────────────────── */
.drawer-header-actions { display: flex; align-items: center; gap: 4px; }
.drawer-notes-btn { position: relative; font-size: 17px; }
.wn-count {
  position: absolute; top: -3px; right: -3px; min-width: 15px; height: 15px; padding: 0 3px;
  background: #2563eb; color: #fff; font-size: 9px; font-weight: 700; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}

.notes-pane {
  position: absolute; inset: 0; background: #fff; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .22s ease; z-index: 5;
}
.notes-pane.show { transform: translateX(0); }
.notes-pane .drawer-header { align-items: center; }
.notes-back { font-size: 18px; margin-right: 6px; color: #2563eb; }

.notes-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.notes-count-lbl { font-size: 12px; font-weight: 600; color: #64748b; }

.wn-note { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; margin-bottom: 8px; }
.wn-head {
  width: 100%; display: flex; align-items: center; gap: 9px; text-align: left; padding: 9px 11px;
  background: none; border: none; cursor: pointer; font-family: inherit; color: inherit;
}
.wn-caret { color: #94a3b8; font-size: 11px; transition: transform .15s ease; flex: none; }
.wn-note.open .wn-caret { transform: rotate(90deg); }
.wn-main { flex: 1; min-width: 0; }
.wn-title { font-size: 13px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wn-preview { font-size: 12px; color: #94a3b8; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.wn-note.open .wn-preview { display: none; }
.wn-date { font-size: 11px; color: #94a3b8; flex: none; font-variant-numeric: tabular-nums; }
.wn-tag { font-size: 10px; font-weight: 600; border-radius: 10px; padding: 2px 8px; flex: none; white-space: nowrap; }
.wn-body { display: none; padding: 2px 12px 12px 31px; border-top: 1px solid #e2e8f0; }
.wn-note.open .wn-body { display: block; }
.wn-text { margin: 10px 0 0; white-space: pre-wrap; font-size: 13px; color: #334155; }
.wn-text.wn-empty { color: #94a3b8; font-style: italic; }
.wn-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.wn-meta { font-size: 11px; color: #94a3b8; }
.wn-actions { display: flex; gap: 2px; }
.btn-ghost.danger { color: #dc2626; }

.wn-form { display: flex; flex-direction: column; gap: 8px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 11px; margin-bottom: 12px; }
.wn-form .filter-input { width: 100%; }
.wn-textarea { min-height: 64px; resize: vertical; }
.wn-form-row { display: flex; gap: 8px; align-items: center; }
.wn-cat-create { display: flex; flex-direction: column; gap: 9px; padding: 10px; border: 1px solid #e2e8f0; border-radius: 6px; background: #fff; }
.wn-cat-colors { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wn-cat-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #cbd5e1; cursor: pointer; padding: 0; }
.wn-cat-dot.selected { box-shadow: 0 0 0 2px #2563eb; }

@media (prefers-reduced-motion: reduce) {
  .notes-pane, .wn-caret { transition: none; }
}

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: #e2e8f0; border-radius: 6px; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 6px; border: 2px solid #e2e8f0; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }
/* Firefox */
html { scrollbar-width: auto; scrollbar-color: #94a3b8 #e2e8f0; }

/* ── Summary Cards extras ─────────────────────────────────────────────────── */
.card-amber { background: linear-gradient(135deg, #b45309, #f59e0b); }

/* ── Orfaos Card ──────────────────────────────────────────────────────────── */
#orfaos-card-wrap { padding: 0 20px 0; background: #fff; }
.orfaos-card {
  border: 1.5px solid #f59e0b; border-radius: 8px; margin: 10px 0 4px;
  background: #fffbeb; overflow: hidden;
}
.orfaos-header {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  cursor: pointer; user-select: none; transition: background .1s;
}
.orfaos-header:hover { background: #fef3c7; }
.orfaos-badge {
  background: #d97706; color: #fff; border-radius: 20px;
  padding: 2px 9px; font-size: 13px; font-weight: 700;
}
.orfaos-title { font-weight: 600; color: #92400e; }
.orfaos-hint { font-size: 11px; color: #b45309; margin-left: 2px; }
.orfaos-chevron { margin-left: auto; color: #b45309; font-size: 12px; }

.orfaos-body { border-top: 1px solid #fde68a; }
.orfaos-list { max-height: 320px; overflow-y: auto; }

.orfao-row {
  border-bottom: 1px solid #fef3c7; padding: 8px 14px;
  background: #fff; transition: background .1s;
}
.orfao-row:hover { background: #fffbeb; }
.orfao-row:last-child { border-bottom: none; }

.orfao-info {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: 6px; font-size: 12px;
}
.orfao-num    { font-weight: 700; color: #1e40af; }
.orfao-emit   { background: #e0e7ff; color: #3730a3; padding: 1px 6px; border-radius: 4px; font-size: 11px; }
.orfao-cli    { color: #374151; }
.orfao-obra   { color: #6b7280; font-style: normal; }
.orfao-obra em { color: #9ca3af; }
.orfao-data   { color: #6b7280; font-size: 11px; }
.orfao-val    { font-weight: 600; color: #065f46; margin-left: auto; }
.badge-sm     { padding: 1px 6px; border-radius: 4px; font-size: 11px; }

.orfao-actions { display: flex; gap: 6px; }
.btn-amber { background: #d97706; color: #fff; }
.btn-amber:hover { background: #b45309; }

.orfao-inline { padding: 6px 0 4px; }
.orfao-search-box { display: flex; flex-direction: column; gap: 6px; }
.orfao-results {
  max-height: 180px; overflow-y: auto;
  border: 1px solid #e2e8f0; border-radius: 6px; background: #fff;
}
.orfao-result-item {
  display: flex; gap: 8px; align-items: center;
  padding: 7px 10px; cursor: pointer; transition: background .1s;
  border-bottom: 1px solid #f1f5f9;
}
.orfao-result-item:last-child { border-bottom: none; }
.orfao-result-item:hover { background: #eff6ff; }
.orfao-result-nome { font-weight: 600; font-size: 12px; }
.orfao-result-cli  { font-size: 11px; color: #6b7280; }
.orfao-result-empty { padding: 10px; color: #9ca3af; font-size: 12px; text-align: center; }
.orfao-criar-btns  { display: flex; gap: 6px; }

/* ── SDD Panel ────────────────────────────────────────────────────────────── */
.sdd-overlay {
  position: fixed; inset: 0; background: #0006; z-index: 300;
  display: flex; align-items: stretch;
}
.sdd-drawer {
  width: min(860px, 95vw); background: #fff; display: flex; flex-direction: column;
  box-shadow: 4px 0 24px #0003; margin-left: auto;
  animation: slideInRight .2s ease;
}
@keyframes slideInRight {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.sdd-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: #1e40af; color: #fff;
}
.sdd-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.sdd-icon  { font-size: 18px; }

.sdd-toolbar {
  display: flex; gap: 8px; align-items: center; padding: 10px 16px;
  background: #f8fafc; border-bottom: 1px solid #e2e8f0;
}
.sdd-filter { height: 30px; font-size: 12px; }

.sdd-form {
  background: #f1f5f9; border-bottom: 1px solid #e2e8f0; padding: 10px 16px;
}
.sdd-form-inner { display: flex; flex-direction: column; gap: 6px; }
.sdd-form-row   { display: flex; gap: 6px; flex-wrap: wrap; }
.sdd-form-row .filter-select { height: 30px; font-size: 12px; }
.sdd-textarea {
  width: 100%; padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 6px;
  resize: vertical; font-family: inherit; font-size: 12px;
}
.sdd-textarea:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px #2563eb22; }
.sdd-form-actions { display: flex; gap: 6px; }

.sdd-kanban {
  flex: 1; display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 0; overflow: hidden;
}
.sdd-col {
  display: flex; flex-direction: column; border-right: 1px solid #e2e8f0;
  overflow: hidden;
}
.sdd-col:last-child { border-right: none; }
.sdd-col-header {
  padding: 8px 12px; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; flex-shrink: 0;
}
.sdd-col-pendente-hdr { background: #fef9f0; color: #92400e; border-bottom: 2px solid #f59e0b; }
.sdd-col-progress-hdr { background: #eff6ff; color: #1e40af; border-bottom: 2px solid #3b82f6; }
.sdd-col-done-hdr     { background: #f0fdf4; color: #14532d; border-bottom: 2px solid #22c55e; }
.sdd-col-body { flex: 1; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 6px; }
.sdd-col-empty { color: #9ca3af; text-align: center; padding: 20px; font-size: 12px; }

.sdd-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
  padding: 10px 12px; transition: box-shadow .15s;
}
.sdd-card:hover { box-shadow: 0 2px 8px #0002; }
.sdd-card-top {
  display: flex; align-items: center; gap: 6px; margin-bottom: 6px; flex-wrap: wrap;
}
.sdd-tipo-badge {
  color: #fff; border-radius: 4px; padding: 2px 7px; font-size: 11px; font-weight: 600;
}
.sdd-prior-dot { font-size: 14px; }
.sdd-versao    { font-size: 11px; color: #6b7280; background: #f1f5f9; padding: 1px 5px; border-radius: 4px; }
.sdd-card-data { font-size: 10px; color: #9ca3af; margin-left: auto; }
.sdd-card-titulo { font-size: 13px; font-weight: 600; color: #1e293b; margin-bottom: 4px; }
.sdd-card-desc { font-size: 11px; color: #64748b; line-height: 1.4; margin-bottom: 6px; }
.sdd-card-actions { display: flex; gap: 2px; }

/* ── SDD Tabs ─────────────────────────────────────────────────────────────── */
.sdd-tabs { display: flex; border-bottom: 2px solid #e2e8f0; background: #f8fafc; flex-shrink: 0; }
.sdd-tab {
  padding: 10px 20px; font-size: 13px; font-weight: 600; color: #64748b;
  background: transparent; border: none; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: .15s; cursor: pointer;
}
.sdd-tab:hover { color: #1e40af; background: #eff6ff; }
.sdd-tab.active { color: #1e40af; border-bottom-color: #2563eb; }
.sdd-tab-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.sdd-tab-panel.hidden { display: none !important; }

/* ── Milestones ───────────────────────────────────────────────────────────── */
.ms-list { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 12px; }
.ms-form { background: #f1f5f9; border-bottom: 1px solid #e2e8f0; padding: 10px 16px; }

.ms-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 14px 16px;
  box-shadow: 0 1px 3px #0001; transition: box-shadow .15s;
}
.ms-card:hover { box-shadow: 0 2px 10px #0002; }
.ms-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 6px; }
.ms-card-title  { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ms-nome        { font-size: 15px; font-weight: 700; color: #1e293b; }
.ms-card-meta   { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.ms-status-badge { color: #fff; border-radius: 20px; padding: 3px 10px; font-size: 11px; font-weight: 600; }
.ms-dates       { font-size: 12px; color: #64748b; margin-bottom: 4px; }
.ms-descricao   { font-size: 12px; color: #475569; margin-bottom: 8px; line-height: 1.5; }

.ms-progress { margin-top: 8px; }
.ms-progress-bar  { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.ms-progress-fill { height: 100%; border-radius: 4px; transition: width .4s; }
.ms-progress-label { font-size: 11px; color: #64748b; }

/* ── Auth Modal ───────────────────────────────────────────────────────────── */
.auth-overlay {
  position: fixed; inset: 0; background: #ede8e0;
  z-index: 500; display: flex; align-items: center; justify-content: center;
}
.auth-card {
  background: #fff; border-radius: 12px; padding: 36px 32px; width: 360px; max-width: 95vw;
  box-shadow: 0 8px 32px #0000001a; display: flex; flex-direction: column; gap: 20px;
}

/* brand row: logo | divider | title+subtitle */
.auth-brand { display: flex; flex-direction: row; align-items: center; gap: 16px; }
.auth-logo-img { height: 44px; width: auto; object-fit: contain; flex-shrink: 0; }
.auth-brand-sep { width: 1px; height: 44px; background: #d1d5db; flex-shrink: 0; }
.auth-brand-text { display: flex; flex-direction: column; gap: 2px; }
.auth-title    { font-size: 17px; font-weight: 700; color: #1a1a1a; line-height: 1.2; }
.auth-subtitle { font-size: 12px; color: #6b7280; line-height: 1.4; }

.auth-divider { border: none; border-top: 1px solid #e5e7eb; margin: 0; }

.auth-form  { display: flex; flex-direction: column; gap: 14px; }
.auth-field { display: flex; flex-direction: column; gap: 5px; }
.auth-label { font-size: 13px; font-weight: 600; color: #d97706; }
.auth-input {
  height: 42px; padding: 0 12px; border: 1.5px solid #d1d5db; border-radius: 6px;
  font-size: 14px; color: #1e293b; outline: none; transition: border-color .15s, box-shadow .15s; width: 100%;
  box-sizing: border-box;
}
.auth-input:focus { border-color: #d97706; box-shadow: 0 0 0 3px #d9770620; }
.auth-pass-wrap { position: relative; display: flex; }
.auth-pass-wrap .auth-input { flex: 1; padding-right: 40px; }
.auth-toggle-pass {
  position: absolute; right: 0; top: 0; bottom: 0; width: 40px;
  background: transparent; border: none; color: #94a3b8; font-size: 16px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.auth-toggle-pass:hover { color: #64748b; }
.auth-error {
  background: #fee2e2; color: #dc2626; border-radius: 6px;
  padding: 10px 12px; font-size: 13px; font-weight: 500;
}
.auth-notice {
  background: #fffbeb; color: #92400e; border: 1px solid #fde68a; border-radius: 6px;
  padding: 10px 12px; font-size: 13px; font-weight: 500; line-height: 1.4;
}
.auth-btn {
  width: 100%; height: 44px; font-size: 15px; font-weight: 700; border-radius: 6px;
  background: #f5a623; color: #1a1a1a; border: none; cursor: pointer;
  transition: background .15s; letter-spacing: .3px;
}
.auth-btn:hover   { background: #e09610; }
.auth-btn:active  { background: #c8870e; }
.auth-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ── Nav User ─────────────────────────────────────────────────────────────── */
.nav-user { display: flex; align-items: center; gap: 8px; padding: 0 4px; }
.nav-user-avatar {
  width: 30px; height: 30px; border-radius: 50%; background: #3b82f6;
  color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.nav-user-nome { font-size: 13px; font-weight: 500; color: #bfdbfe; max-width: 120px;
                 overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-logout { color: #93c5fd !important; font-size: 16px !important; }
.nav-logout:hover { background: rgba(255,255,255,.1) !important; color: #fff !important; }

/* ── Users Panel ──────────────────────────────────────────────────────────── */
.users-form { background: #f1f5f9; border-bottom: 1px solid #e2e8f0; padding: 10px 16px; }
.users-form-inner { display: flex; flex-direction: column; gap: 6px; }
.users-form-row { display: flex; gap: 6px; flex-wrap: wrap; }
.users-form-actions { display: flex; gap: 6px; }

.users-list { flex: 1; overflow-y: auto; padding: 8px 0; }
.users-loading, .users-empty { padding: 24px; text-align: center; color: #94a3b8; font-size: 13px; }

.user-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; border-bottom: 1px solid #f1f5f9; transition: background .1s;
}
.user-row:hover { background: #f8fafc; }
.user-row-inactive { opacity: .5; }
.user-row-info { display: flex; align-items: center; gap: 12px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: #2563eb;
  color: #fff; font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-row-inactive .user-avatar { background: #94a3b8; }
.user-nome  { font-size: 13px; font-weight: 600; color: #1e293b; }
.user-email { font-size: 11px; color: #64748b; }
.user-row-actions { display: flex; align-items: center; gap: 6px; }

.user-badge { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-ti       { background: #f3e8ff; color: #6d28d9; }
.badge-admin    { background: #dbeafe; color: #1e40af; }
.badge-op       { background: #f1f5f9; color: #475569; }
.badge-inactive { background: #fee2e2; color: #dc2626; }

.perms-preview { font-size: 11px; color: #94a3b8; margin-top: 2px; }

.user-perms-panel {
  background: #f8fafc; border-top: 1px solid #e2e8f0;
  padding: 14px 18px 12px; border-bottom: 1px solid #e2e8f0;
}
.user-perms-panel.hidden { display: none; }
.perms-ti-badge {
  background: #f3e8ff; color: #6d28d9; border-radius: 8px;
  padding: 8px 14px; font-size: 12px; font-weight: 600; margin-bottom: 12px;
}
.perms-role-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.perms-role-label { font-size: 12px; font-weight: 600; color: #475569; white-space: nowrap; }
.perms-checkboxes { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-bottom: 12px; }
.perm-checkbox-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: #334155; cursor: pointer; min-width: 220px;
}
.perm-checkbox-label input { cursor: pointer; }
.perms-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ════════════════════════════════════════════════════════════════════════════
   Gestão de Obras (v1.6) — Kanban, Agenda, modais
   ════════════════════════════════════════════════════════════════════════════ */

.status-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; }

/* ── Kanban ───────────────────────────────────────────────────────────────── */
.kanban-toolbar { display: flex; align-items: center; gap: 10px; }
.kanban-wrap { flex: 1; min-height: 0; display: flex; gap: 12px; overflow-x: auto; padding: 16px 20px; }
.kanban-col { flex: 0 0 270px; display: flex; flex-direction: column; background: #f8fafc;
              border: 1px solid #e2e8f0; border-radius: 10px; max-height: 100%; }
.kanban-inbox { background: #f1f5f9; border-style: dashed; }
.kanban-col-hdr { display: flex; align-items: center; gap: 7px; padding: 10px 12px;
                  border-top: 3px solid #94a3b8; border-radius: 10px 10px 0 0; font-weight: 700; font-size: 13px; }
.kanban-col-name { flex: 1; }
.kanban-col-count { background: #e2e8f0; color: #475569; border-radius: 10px; padding: 1px 8px; font-size: 11px; }
.kanban-col-body { flex: 1; min-height: 60px; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.kanban-col-body.drag-over { background: #dbeafe; outline: 2px dashed #2563eb; outline-offset: -4px; }
.kanban-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px;
               cursor: pointer; transition: box-shadow .12s, transform .12s; position: relative; }
.kanban-card:hover { box-shadow: 0 3px 10px #0002; }
.kanban-card.selected { border-color: #2563eb; background: #eff6ff; }
.kb-check { position: absolute; top: 9px; right: 9px; width: 15px; height: 15px;
            cursor: pointer; accent-color: #2563eb; }
.kanban-card .kanban-card-title { padding-right: 22px; }
.kb-bulkbar { display: flex; align-items: center; gap: 10px; padding: 8px 20px;
              background: #eff6ff; border-bottom: 1px solid #bfdbfe; font-size: 13px; color: #1e40af; }
.kb-bulkbar[hidden] { display: none; }
.kb-bulk-count { font-weight: 700; }
.kb-novo-pedido { display: flex; align-items: center; gap: 5px; margin-top: 6px; padding: 3px 7px;
                  background: #fffbeb; border: 1px solid #fcd34d; border-radius: 6px;
                  font-size: 11px; font-weight: 600; color: #92400e; }
.kb-novo-x { margin-left: auto; border: none; background: none; cursor: pointer;
             color: #b45309; font-size: 11px; padding: 0 2px; line-height: 1; }
.kb-novo-x:hover { color: #78350f; }

/* ── Drawer: endereço manual + contatos da obra (v1.6.7) ─────────────────── */
.meta-row-full { grid-column: 1 / -1; }
.ct-edit-btn { font-size: 12px; padding: 0 4px; vertical-align: middle; }
.end-edit-row { display: flex; gap: 6px; margin-top: 4px; }
.end-edit-row.hidden { display: none; }
.contatos-panel { margin: 14px 0; }
.ct-row { display: flex; align-items: center; gap: 8px; padding: 7px 9px; background: #fff;
          border: 1px solid #e2e8f0; border-radius: 7px; margin-top: 6px; }
.ct-row-main { flex: 1; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.ct-tel, .ct-email { color: #64748b; font-size: 12px; }
.ct-badge { background: #e0e7ff; color: #3730a3; border-radius: 10px; padding: 2px 9px;
            font-size: 11px; font-weight: 600; white-space: nowrap; }
.ct-form-row { display: flex; gap: 6px; margin-top: 6px; }
.ct-form-row.hidden { display: none; }
#ct-form.hidden { display: none; }
.kanban-card[draggable="true"] { cursor: grab; }
.kanban-card.dragging { opacity: .5; }
.kanban-card-title { font-weight: 600; font-size: 13px; color: #1e293b; line-height: 1.3; }
.kanban-card-sub { font-size: 12px; color: #64748b; margin-top: 2px; }
.kanban-card-meta { display: flex; align-items: center; gap: 8px; margin-top: 7px; flex-wrap: wrap; }
.kanban-card-ped { font-size: 11px; color: #94a3b8; }

/* Bolinha = situação de entrega dos pedidos (atrasado/no prazo/entregue).
   Empurrada para a direita (margin-left:auto), colada no contador de pedidos. */
.kb-dot { width: 16px; height: 16px; border-radius: 50%; flex: 0 0 auto; margin-left: auto;
          box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(0,0,0,.08); }

/* Flag de prazo (previsão de término) — pílula colorida (fundo + borda) para
   chamar atenção; muda de cor conforme a saúde do prazo + estado "parado". */
.kb-prazo { font-size: 11px; font-weight: 600; letter-spacing: .5px; line-height: 1;
            display: inline-flex; align-items: center; gap: 3px;
            border-radius: 5px; padding: 2px 7px; border: 1px solid transparent; }
.kb-prazo--none     { color: #94a3b8; font-weight: 700; letter-spacing: 2px;
                      background: #f1f5f9; border-color: #e2e8f0; }
.kb-prazo--verde    { color: #16a34a; background: #dcfce7; border-color: #bbf7d0; }
.kb-prazo--amarelo  { color: #d97706; background: #fef3c7; border-color: #fde68a; }
.kb-prazo--vermelho { color: #dc2626; background: #fee2e2; border-color: #fecaca; }
.kb-prazo--parado   { color: #b45309; background: #fffbeb; border-color: #fde68a; font-weight: 700; }
.kanban-empty { color: #cbd5e1; text-align: center; font-size: 12px; padding: 6px; }
.kanban-more { color: #94a3b8; text-align: center; font-size: 11px; padding: 6px; font-style: italic; }
.kanban-card.kb-no-key { opacity: .75; cursor: pointer; }
.kanban-card.kb-no-key:hover { box-shadow: none; }
.kb-sem-chave { margin-top: 5px; padding: 2px 6px; background: #fff7ed; border: 1px solid #fed7aa;
                border-radius: 5px; font-size: 11px; color: #92400e; }
.kb-nova-obra-modal { padding: 10px 0 4px; }
.kb-nova-obra-inner { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
                      background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px;
                      padding: 10px 14px; }

/* ── Agenda ───────────────────────────────────────────────────────────────── */
.agenda-toolbar { display: flex; align-items: center; gap: 8px; flex: 1; }
.agenda-range { font-weight: 600; color: #334155; margin-left: 6px; }
.agenda-grid { display: grid; gap: 1px; background: #e2e8f0; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }
.agenda-hcell { background: #f1f5f9; padding: 8px; font-weight: 700; font-size: 12px; color: #475569; text-align: center; display: flex; align-items: center; justify-content: center; }
.agenda-hcell-label { flex: 1; text-align: center; }
.agenda-hcell-icons { display: inline-flex; align-items: center; gap: 2px; }
.agenda-corner { text-align: left; }
.agenda-today { background: #dbeafe; color: #1e40af; }
.agenda-team { background: #fff; padding: 10px; font-weight: 600; font-size: 12px; display: flex; align-items: center; gap: 5px; }
.agenda-team-h { margin-left: auto; color: #94a3b8; font-weight: 500; font-size: 11px; }
.agenda-cell { background: #fff; padding: 6px; min-height: 64px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; position: relative; }
.agenda-cell:hover { background: #f8fafc !important; }
.agenda-occ { position: absolute; top: 3px; right: 5px; font-size: 10px; color: #94a3b8; }
.agenda-occ.over { color: #dc2626; font-weight: 700; }
.agenda-block { display: flex; align-items: center; gap: 4px; color: #fff; border-radius: 5px;
                padding: 3px 6px; font-size: 11px; cursor: pointer; overflow: hidden; }
.agenda-block:hover { filter: brightness(1.1); }
.agenda-block-tag { opacity: .85; }
.agenda-block-obra { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.agenda-block-h { background: #ffffff33; border-radius: 3px; padding: 0 4px; }
.agenda-legend { margin-top: 10px; font-size: 11px; color: #94a3b8; }
.agenda-vtabs { margin-left: 8px; }

/* Cards de capacidade (% utilizado) */
.agenda-cap { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.cap-card { flex: 1 1 150px; min-width: 150px; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 14px; }
.cap-card-pct { font-size: 26px; font-weight: 800; line-height: 1; color: #1e293b; }
.cap-card.cap-ok   .cap-card-pct { color: #16a34a; }
.cap-card.cap-warn .cap-card-pct { color: #d97706; }
.cap-card.cap-over .cap-card-pct { color: #dc2626; }
.cap-card-label { font-size: 11px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .4px; margin-top: 2px; }
.cap-card-bar { height: 6px; background: #f1f5f9; border-radius: 3px; overflow: hidden; margin: 8px 0 6px; }
.cap-card-fill { height: 100%; background: #2563eb; }
.cap-card.cap-ok   .cap-card-fill { background: #16a34a; }
.cap-card.cap-warn .cap-card-fill { background: #d97706; }
.cap-card.cap-over .cap-card-fill { background: #dc2626; }
.cap-card-sub { font-size: 11px; color: #94a3b8; }

/* Barra de capacidade compartilhada (mês/ano) */
.cap-bar { height: 5px; background: #f1f5f9; border-radius: 3px; overflow: hidden; }
.cap-bar-fill { height: 100%; background: #2563eb; }
.cap-bar-fill.cap-ok   { background: #16a34a; }
.cap-bar-fill.cap-warn { background: #d97706; }
.cap-bar-fill.cap-over { background: #dc2626; }

/* Calendário mensal */
.cal-month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: #e2e8f0; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }
.cal-weekday { background: #f1f5f9; padding: 6px; text-align: center; font-size: 11px; font-weight: 700; color: #475569; }
.cal-day { background: #fff; min-height: 80px; padding: 6px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.cal-day:hover { background: #f8fafc; }
.cal-day.out { background: #f8fafc; }
.cal-day.out .cal-daynum { color: #cbd5e1; }
.cal-day.today { background: #dbeafe; }
.cal-daynum { font-size: 12px; font-weight: 700; color: #334155; }
.cal-badge { font-size: 10px; background: #eff6ff; color: #1e40af; border-radius: 8px; padding: 1px 6px; align-self: flex-start; }
.cal-pct { font-size: 10px; font-weight: 700; }
.cal-pct.cap-ok { color: #16a34a; } .cal-pct.cap-warn { color: #d97706; } .cal-pct.cap-over { color: #dc2626; }

/* Visão anual (12 meses) */
.cal-year { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.cal-monthcard { background: #fff; border: 1px solid #e2e8f0; border-left: 4px solid #cbd5e1; border-radius: 10px; padding: 12px 14px; cursor: pointer; transition: box-shadow .12s; }
.cal-monthcard:hover { box-shadow: 0 3px 10px #0002; }
.cal-monthcard.cap-ok   { border-left-color: #16a34a; }
.cal-monthcard.cap-warn { border-left-color: #d97706; }
.cal-monthcard.cap-over { border-left-color: #dc2626; }
.cal-monthcard-name { font-size: 12px; font-weight: 700; color: #64748b; text-transform: uppercase; }
.cal-monthcard-pct { font-size: 22px; font-weight: 800; color: #1e293b; margin: 2px 0 6px; }
.cal-monthcard-sub { font-size: 11px; color: #94a3b8; margin-top: 6px; }

/* Ativação de fim de semana (sáb/dom) na capacidade */
.agenda-hcell-off { color: #cbd5e1; }
.agenda-daychk { display: inline-flex; align-items: center; cursor: pointer; }
.agenda-daychk input, .cal-daychk input { width: 13px; height: 13px; cursor: pointer; vertical-align: middle; margin: 0; }
.cal-dayhead { display: flex; align-items: center; justify-content: space-between; }
.cal-day-icons { display: inline-flex; align-items: center; gap: 3px; }
.cal-daychk { display: inline-flex; align-items: center; cursor: pointer; }
.cal-day-off { background: #fbfbfc; }
.cal-day-off .cal-daynum { color: #94a3b8; }

/* Feriados */
.cal-day-feriado { background: #fff7ed; }
.cal-day-feriado .cal-daynum { color: #ea580c; font-weight: 600; }
.agenda-hcell-feriado { background: #fff7ed; color: #ea580c; }
.cal-feriado-label { font-size: 10px; color: #ea580c; font-style: italic; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feriado-btn {
  background: none; border: none; cursor: pointer; padding: 0 2px; font-size: 11px;
  opacity: 0.3; line-height: 1; transition: opacity 0.15s;
}
.feriado-btn:hover, .feriado-btn.ativo { opacity: 1; }
.feriado-btn.ativo { filter: none; }
.feriado-badge { font-size: 11px; margin-left: 2px; }

/* ── Agendar modal ────────────────────────────────────────────────────────── */
.ag-field { margin-bottom: 12px; }
.ag-field-row { display: flex; gap: 10px; }
.ag-obra-fixed { font-weight: 600; color: #1e293b; padding: 7px 0; }
.ag-periodo { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ag-periodo label { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; cursor: pointer; }
.ag-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }

/* ── Gestão no drawer ─────────────────────────────────────────────────────── */
.gestao-panel { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px; margin: 14px 0; }
.gestao-row { margin-bottom: 10px; }
.gestao-row:last-child { margin-bottom: 0; }
.gestao-ag-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.gestao-agenda-list { display: flex; flex-direction: column; gap: 5px; }
.gestao-ag-row { display: flex; align-items: center; gap: 7px; font-size: 12px; background: #fff;
                 border: 1px solid #e2e8f0; border-radius: 6px; padding: 5px 8px; }
.gestao-ag-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.gestao-ag-data { font-weight: 600; color: #334155; }
.gestao-ag-team { color: #475569; }
.gestao-ag-per { color: #94a3b8; }
.gestao-ag-actions { margin-left: auto; white-space: nowrap; }

/* ── Dashboard administrativo (v1.7) ──────────────────────────────────────── */
.dash-filters { display: flex; gap: 8px; align-items: center; }
.dash-toggle { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none;
               font-size: 12px; font-weight: 600; color: #475569; padding: 4px 10px;
               border: 1px solid #cbd5e1; border-radius: 8px; background: #f8fafc; white-space: nowrap; }
.dash-toggle input { accent-color: #16a34a; cursor: pointer; margin: 0; }
.dash-section-title { font-size: 14px; font-weight: 800; color: #1e293b; text-transform: uppercase;
                      letter-spacing: .4px; margin: 6px 0 10px; padding-bottom: 6px;
                      border-bottom: 2px solid #e2e8f0; }
.dash-section-title:not(:first-child) { margin-top: 24px; }
.dash-hint { font-size: 11px; font-weight: 500; color: #94a3b8; text-transform: none; letter-spacing: 0; margin-left: 6px; }
.dash-cards { padding: 0 0 4px; background: transparent; border: none; }
.dash-cards .card { min-width: 130px; }

.dash-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 14px; }
@media (max-width: 900px) { .dash-grid-2 { grid-template-columns: 1fr; } }
.dash-block { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 14px 16px; }
.dash-block-title { font-size: 13px; font-weight: 700; color: #334155; margin-bottom: 12px; }

/* Barras horizontais (funil / capacidade / emitente) */
.dash-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.dash-bar-row:last-child { margin-bottom: 0; }
.dash-bar-label { width: 130px; flex: 0 0 130px; font-size: 12px; color: #475569; font-weight: 600; }
.dash-bar-track { flex: 1; height: 16px; background: #f1f5f9; border-radius: 8px; overflow: hidden; }
.dash-bar-fill { height: 100%; border-radius: 8px; transition: width .25s; }
.dash-bar-meta { flex: 0 0 auto; min-width: 92px; text-align: right; font-size: 11px; color: #64748b;
                 font-variant-numeric: tabular-nums; }
.dash-bar-meta b { color: #1e293b; }

/* Mix — donut + legenda */
.dash-mix { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.dash-donut-svg { flex: 0 0 auto; }
.dash-legend { display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 160px; }
.dash-legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.dash-swatch { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 auto; }
.dash-legend-label { color: #475569; font-weight: 600; }
.dash-legend-val { margin-left: auto; color: #64748b; font-variant-numeric: tabular-nums; }
