/* Painel Executivo Bitrix24 — linha executiva sóbria
   Âncora: mesma arquitetura de informação da v1 (4 telas temáticas + carrossel)
   Design: grafite neutro, acento único, tabelas hairline, numerais tabulares */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #0d1117;
  --panel: #151b23;
  --panel-alt: #1a212b;
  --line: rgba(230, 237, 243, 0.09);
  --line-strong: rgba(230, 237, 243, 0.18);

  --text: #e6edf3;
  --dim: #98a3af;
  --faint: #6e7681;

  --accent: #4f8ff7;
  --ok: #3fb950;
  --warn: #d29922;
  --crit: #f85149;
  --info: #58a6ff;

  --font-ui: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;

  --radius: 10px;
}

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

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 18px;
}

/* === HEADER === */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 12px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  flex-shrink: 0;
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(79, 143, 247, 0.14);
  border: 1px solid rgba(79, 143, 247, 0.35);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  display: grid;
  place-items: center;
}

.brand-name { font-size: 17px; font-weight: 600; }
.brand-sub { font-size: 12.5px; color: var(--dim); }

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

.nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--dim);
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nav-btn:hover { background: rgba(230, 237, 243, 0.06); color: var(--text); }

.play-btn {
  height: 32px;
  padding: 0 14px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.play-btn:hover { color: var(--text); }
.play-btn.paused { color: var(--warn); border-color: rgba(210, 153, 34, 0.45); }

.tab-group { display: flex; gap: 4px; margin-left: 8px; }

.tab-btn {
  padding: 7px 14px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--dim);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text); background: rgba(230, 237, 243, 0.05); }

.tab-btn.active {
  color: var(--text);
  background: rgba(79, 143, 247, 0.14);
  border-color: rgba(79, 143, 247, 0.4);
}

.header-status { display: flex; align-items: center; gap: 22px; }

.status-item { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }

.status-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

.status-value {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.sync-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.sync-pill.offline { color: var(--crit); border-color: rgba(248, 81, 73, 0.4); }
.sync-pill.offline .sync-dot { background: var(--crit); }

.interval-select {
  background: var(--panel-alt);
  border: 1px solid var(--line-strong);
  color: var(--dim);
  border-radius: 7px;
  padding: 6px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
}

/* === FAIXA DE KPIs === */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  flex-shrink: 0;
}

.kpi-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.kpi-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.kpi-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--dim);
}

.kpi-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

.kpi-row { display: flex; align-items: baseline; gap: 10px; }

.kpi-value {
  font-family: var(--font-mono);
  font-size: 34px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.kpi-context { font-size: 12.5px; color: var(--dim); }

.kpi-bar { height: 4px; border-radius: 2px; background: rgba(230, 237, 243, 0.07); overflow: hidden; }
.kpi-bar-fill { height: 100%; border-radius: 2px; background: var(--accent); transition: width 0.5s ease; }
.kpi-bar-fill.ok { background: var(--ok); }
.kpi-bar-fill.warn { background: var(--warn); }
.kpi-bar-fill.crit { background: var(--crit); }

.kpi-foot {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* === TELAS TEMÁTICAS === */
.screen { display: none; flex: 1; min-height: 0; }
.screen.active { display: flex; flex-direction: column; }

.screen-panel {
  flex: 1;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.screen-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.screen-title { font-size: 15px; font-weight: 600; }
.screen-sub { font-size: 12.5px; color: var(--dim); margin-top: 2px; }

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

.search-input {
  background: var(--panel-alt);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 7px 12px;
  width: 210px;
}

.search-input::placeholder { color: var(--faint); }
.search-input:focus { outline: none; border-color: rgba(79, 143, 247, 0.5); }

.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--dim); }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; }

/* --- Tela 1: matriz de ciclos --- */
.matrix-scroll { flex: 1; min-height: 0; overflow: auto; }

.matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.matrix th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel-alt);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}

.matrix td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.matrix tbody tr:hover { background: rgba(230, 237, 243, 0.025); }

.person-cell { display: flex; align-items: center; gap: 10px; min-width: 190px; }

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--panel-alt);
  border: 1px solid var(--line-strong);
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.person-name { font-weight: 500; font-size: 13.5px; }
.person-role { font-size: 11.5px; color: var(--dim); }

.ritual-cell { white-space: nowrap; }

.ritual-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 5px;
  margin-right: 4px;
  border: 1px solid;
}

.ritual-pill.ok { color: var(--ok); border-color: rgba(63, 185, 80, 0.35); background: rgba(63, 185, 80, 0.1); }
.ritual-pill.fail { color: var(--crit); border-color: rgba(248, 81, 73, 0.35); background: rgba(248, 81, 73, 0.08); }

.cycle-cell {
  width: 34px;
  height: 26px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color 0.15s;
}

.cycle-cell:hover { border-color: var(--line-strong); }

.cycle-cell.done { background: rgba(63, 185, 80, 0.16); color: var(--ok); }
.cycle-cell.in_progress { background: rgba(79, 143, 247, 0.16); color: var(--accent); }
.cycle-cell.pending { background: rgba(230, 237, 243, 0.05); color: var(--faint); }

.hours-cell {
  font-family: var(--font-mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.hours-sub { display: block; font-size: 10.5px; font-weight: 400; color: var(--faint); }

.status-pill {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
}

.status-pill.fechado { color: var(--ok); border-color: rgba(63, 185, 80, 0.4); background: rgba(63, 185, 80, 0.1); }
.status-pill.em_andamento { color: var(--info); border-color: rgba(88, 166, 255, 0.4); background: rgba(88, 166, 255, 0.1); }
.status-pill.alerta { color: var(--crit); border-color: rgba(248, 81, 73, 0.4); background: rgba(248, 81, 73, 0.1); }
.status-pill.pendente { color: var(--warn); border-color: rgba(210, 153, 34, 0.4); background: rgba(210, 153, 34, 0.1); }

/* --- Tela 2: departamentos --- */
.dept-grid {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  /* Linhas auto: o card cresce com o texto (tabela de pessoas) e a sobra de
     tela é distribuída entre as duas linhas; se não couber, o grid rola em
     vez de deixar o conteúdo vazar da borda do card. */
  grid-template-rows: repeat(2, auto);
  gap: 12px;
  padding: 16px 20px;
}

.dept-card {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.dept-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.dept-head > div { min-width: 0; }
.dept-name { font-size: 14.5px; font-weight: 600; }
.dept-meta { font-size: 12px; color: var(--dim); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dept-ritual {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  white-space: nowrap;
}

.dept-hours { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; color: var(--dim); }
.dept-hours b { font-family: var(--font-mono); font-size: 15px; color: var(--text); font-weight: 600; }

.dept-members { display: flex; flex-direction: column; margin-top: 2px; }

.dept-member {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}

.dept-member-name {
  font-size: 12.5px;
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dept-member-hours {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.dept-member .status-pill { font-size: 9.5px; padding: 2px 8px; }

.dept-foot { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--faint); }
.dept-foot .andon-on { color: var(--crit); }
.dept-foot .andon-off { color: var(--ok); }

/* --- Tela 3: entregas ao vivo --- */
.live-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 12px;
  padding: 16px 20px;
}

.live-col {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.live-col-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.live-col-head .count { font-family: var(--font-mono); font-size: 11px; color: var(--faint); letter-spacing: 0; text-transform: none; }

.feed-scroll { flex: 1; min-height: 0; overflow-y: auto; }

.feed-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  align-items: start;
}

.feed-row.new { animation: feed-in 0.25s ease-out, feed-fade 6s ease-out forwards; }

@keyframes feed-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes feed-fade { from { background: rgba(79, 143, 247, 0.1); } to { background: transparent; } }

.feed-time { font-family: var(--font-mono); font-size: 11.5px; color: var(--dim); padding-top: 2px; }
.feed-person { font-weight: 500; font-size: 13.5px; }
.feed-desc { color: var(--dim); font-weight: 400; }
.feed-badge-line { font-size: 11px; color: var(--faint); margin-top: 2px; }

.feed-min {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 3px 8px;
  white-space: nowrap;
}

.rank-list { flex: 1; min-height: 0; overflow-y: auto; padding: 8px; }

.rank-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 7px;
}

.rank-row:hover { background: rgba(230, 237, 243, 0.03); }

.rank-pos { font-family: var(--font-mono); font-size: 11px; color: var(--faint); text-align: right; }
.rank-name { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-role { font-size: 11px; color: var(--dim); }

.rank-hours {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* --- Tela 4: rituais & andon --- */
.ritual-grid {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 12px;
  padding: 16px 20px;
}

.ritual-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ritual-col .live-col-head { flex-shrink: 0; }
.ritual-card, .andon-card { flex: 1; }

.ritual-card {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.ritual-id {
  width: 44px;
  height: 44px;
  border-radius: 9px;
  background: rgba(79, 143, 247, 0.12);
  border: 1px solid rgba(79, 143, 247, 0.3);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  display: grid;
  place-items: center;
}

.ritual-name { font-size: 14px; font-weight: 600; }
.ritual-desc { font-size: 12px; color: var(--dim); margin-top: 2px; }
.ritual-time { font-family: var(--font-mono); font-size: 11px; color: var(--faint); margin-top: 4px; }
.ritual-attend { font-size: 11.5px; color: var(--faint); margin-top: 4px; }
.ritual-attend.warn { color: var(--warn); }

.ritual-score { text-align: right; }
.ritual-score b { font-family: var(--font-mono); font-size: 22px; font-weight: 600; }
.ritual-score span { display: block; font-size: 11px; color: var(--faint); }

.andon-card {
  background: var(--panel-alt);
  border: 1px solid rgba(248, 81, 73, 0.3);
  border-left: 3px solid var(--crit);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.andon-foot {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--faint);
}

.andon-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.andon-title { font-size: 14px; font-weight: 600; }
.andon-owner { font-family: var(--font-mono); font-size: 11px; color: var(--dim); white-space: nowrap; }
.andon-desc { font-size: 12.5px; color: var(--dim); margin-top: 6px; }
.andon-evidence { font-family: var(--font-mono); font-size: 11px; color: var(--faint); margin-top: 6px; }

.empty-note { padding: 28px; text-align: center; color: var(--dim); font-size: 13px; }

/* --- Tela 5: projetos & cronograma (dados reais do Bitrix24) --- */
.pmo-resumo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  flex-shrink: 0;
}

.pmo-resumo .evm-chip { font-weight: 500; }
.pmo-resumo .evm-chip:not(.ok):not(.warn):not(.crit) {
  color: var(--dim);
  border-color: var(--line-strong);
  background: transparent;
}

.gantt-window {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--faint);
  letter-spacing: 0.04em;
}

.pmo-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
  color: var(--dim);
  font-size: 13px;
}

.pmo-grid {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px;
}

.gantt-panel {
  flex: 1.2;
  min-height: 0;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gantt-head, .gantt-row {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 158px;
  gap: 14px;
  align-items: center;
}

.gantt-head {
  border-bottom: 1px solid var(--line-strong);
  flex-shrink: 0;
}

.gantt-head-label, .gantt-head-evm {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 9px 14px;
}

.gantt-head-evm { text-align: right; }

.gantt-ticks { position: relative; height: 30px; }

.gantt-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line);
}

.gantt-tick span {
  position: absolute;
  top: 8px;
  left: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--faint);
  white-space: nowrap;
}

.gantt-tick.today { background: rgba(230, 237, 243, 0.4); }
.gantt-tick.today span { color: var(--text); font-weight: 600; }

.gantt-body { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }

.gantt-row { border-bottom: 1px solid var(--line); min-height: 52px; flex: 1; }
.gantt-row:last-child { border-bottom: 0; }

.gantt-label { padding: 8px 14px; min-width: 0; }
.gantt-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-meta { font-size: 11px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.gantt-track { position: relative; min-height: 44px; align-self: stretch; }

/* Cada barra é uma tarefa real do Bitrix24 (criação → prazo); até 18 por
   projeto, distribuídas em 3 raias para reduzir sobreposição. */
.gantt-bar {
  position: absolute;
  height: 7px;
  border-radius: 3px;
  margin-top: -3.5px;
}

.gantt-bar:nth-child(3n+1) { top: 28%; }
.gantt-bar:nth-child(3n+2) { top: 50%; }
.gantt-bar:nth-child(3n) { top: 72%; }

.gantt-bar.done { background: rgba(63, 185, 80, 0.55); }
.gantt-bar.in_progress { background: rgba(79, 143, 247, 0.6); }
.gantt-bar.pending { background: rgba(230, 237, 243, 0.14); }
.gantt-bar.atrasada { background: rgba(248, 81, 73, 0.65); }

.gantt-today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(230, 237, 243, 0.4);
}

.gantt-evm { display: flex; gap: 6px; justify-content: flex-end; padding-right: 14px; }

.evm-chip {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 5px;
  border: 1px solid;
  white-space: nowrap;
}

.evm-chip.ok { color: var(--ok); border-color: rgba(63, 185, 80, 0.35); background: rgba(63, 185, 80, 0.1); }
.evm-chip.warn { color: var(--warn); border-color: rgba(210, 153, 34, 0.35); background: rgba(210, 153, 34, 0.1); }
.evm-chip.crit { color: var(--crit); border-color: rgba(248, 81, 73, 0.35); background: rgba(248, 81, 73, 0.1); }

.pmo-bottom {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.pmo-scroll { flex: 1; min-height: 0; overflow-y: auto; }

.aloc-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 108px;
  gap: 12px;
  align-items: center;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}

.aloc-name { color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aloc-name b { color: var(--text); font-weight: 500; }

.aloc-bar { height: 6px; border-radius: 3px; background: rgba(230, 237, 243, 0.07); overflow: hidden; }
.aloc-bar-fill { height: 100%; border-radius: 3px; background: var(--accent); }

.aloc-hours { font-family: var(--font-mono); font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--dim); text-align: right; }

.marco-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
}

.marco-date { font-family: var(--font-mono); font-size: 11.5px; color: var(--dim); }
.marco-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.marco-proj { font-size: 11px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.marco-due { font-family: var(--font-mono); font-size: 11px; color: var(--dim); white-space: nowrap; }
.marco-due.atrasado { color: var(--crit); }
.marco-due.hoje { color: var(--warn); }

/* === FOOTER === */
.app-footer {
  flex-shrink: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.carousel-progress { height: 3px; background: rgba(230, 237, 243, 0.06); }
.carousel-progress-fill { height: 100%; width: 0%; background: var(--accent); transition: width 0.1s linear; }

.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 18px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--dim);
}

.footer-info { display: flex; gap: 24px; }
.footer-info .value { color: var(--text); }
.footer-hint { color: var(--faint); }

/* === DRAWER === */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 12, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 50;
}

.drawer-backdrop.open { opacity: 1; pointer-events: auto; }

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 92vw);
  background: var(--panel);
  border-left: 1px solid var(--line-strong);
  padding: 22px 24px;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

.drawer-backdrop.open .drawer-panel { transform: translateX(0); }

.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.drawer-cycle { font-family: var(--font-mono); font-size: 11.5px; color: var(--accent); letter-spacing: 0.08em; }
.drawer-name { font-size: 19px; font-weight: 600; margin-top: 4px; }
.drawer-meta { font-size: 12.5px; color: var(--dim); margin-top: 3px; }

.drawer-close {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  font-size: 14px;
}

.drawer-close:hover { color: var(--text); }

.drawer-section { margin-top: 20px; }

.drawer-section h4 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-5w2h {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  border: 1px solid rgba(79, 143, 247, 0.4);
  background: rgba(79, 143, 247, 0.1);
  border-radius: 5px;
  padding: 2px 7px;
}

.drawer-section p { font-size: 13.5px; color: var(--text); }
.drawer-section p.mono { font-family: var(--font-mono); font-size: 12px; color: var(--ok); }

.drawer-kv {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--dim);
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

.drawer-kv b { font-family: var(--font-mono); color: var(--text); font-weight: 500; }

/* === TELA 6: DISPARADOR (.XLSX) & MODAL DE AUTENTICAÇÃO === */
.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--dim);
}
.user-badge .email { color: var(--text); font-weight: 500; }
.btn-logout {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--dim);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-logout:hover { background: rgba(248, 81, 73, 0.15); color: var(--crit); border-color: var(--crit); }

.btn-login-open {
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-login-open:hover { opacity: 0.9; }

.screen-content-scroll {
  flex: 1;
  overflow-y: auto;
  padding-right: 6px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dropzone-panel {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(21, 27, 35, 0.6);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.dropzone-panel:hover, .dropzone-panel.dragover {
  border-color: var(--accent);
  background: rgba(79, 143, 247, 0.05);
}
.dropzone-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.dropzone-sub { font-size: 12.5px; color: var(--dim); }

.dispatch-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.stat-card {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.stat-card .label { font-size: 11px; text-transform: uppercase; color: var(--dim); letter-spacing: 0.5px; }
.stat-card .value { font-family: var(--font-mono); font-size: 18px; font-weight: 600; color: var(--text); margin-top: 4px; }

.checks-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
}
.check-item.passed { border-left: 3px solid var(--ok); }
.check-item.failed { border-left: 3px solid var(--crit); }
.check-item.pending { border-left: 3px solid var(--dim); }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--dim); text-transform: uppercase; letter-spacing: 0.5px; }
.form-select, .form-input {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 12px;
  font-family: var(--font-ui);
  font-size: 13.5px;
}
.form-select:focus, .form-input:focus { outline: none; border-color: var(--accent); }

.btn-action {
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-action:hover:not(:disabled) { opacity: 0.9; }
.btn-action:disabled { opacity: 0.4; cursor: not-allowed; }

/* Modal de Autenticação */
.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}
.auth-modal-backdrop.open { display: flex; }
.auth-modal-panel {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  width: 100%;
  max-width: 440px;
  padding: 28px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}
.auth-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.auth-modal-head h3 { font-size: 17px; font-weight: 600; color: var(--text); }
.auth-modal-close {
  background: transparent;
  border: none;
  color: var(--dim);
  font-size: 18px;
  cursor: pointer;
}
.auth-modal-close:hover { color: var(--text); }

/* === SCROLLBARS === */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(230, 237, 243, 0.12); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* === TELAS MENORES === */
@media (max-width: 1200px) {
  body { overflow: auto; }
  .app { position: static; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .dept-grid, .live-grid, .ritual-grid, .dispatch-grid, .checks-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .app-header { flex-wrap: wrap; }
}

