
:root{
  --blue:#1e3a5f;
  --blue-2:#274d7d;
  --gold:#d69e2e;
  --bg:#f5f7fb;
  --card:#ffffff;
  --text:#243447;
  --muted:#6b7280;
  --border:#d9e1ea;
  --danger:#d73a49;
  --warning:#f2c94c;
  --orange:#f2994a;
  --green-light:#7fcf8a;
  --green:#22863a;
}
*{box-sizing:border-box}
body{margin:0;font-family:Arial,Helvetica,sans-serif;color:var(--text);background:var(--bg)}
a{text-decoration:none;color:inherit}
.app{display:flex;min-height:100vh}
.sidebar{width:260px;background:var(--blue);color:#fff;padding:18px 0;position:fixed;left:0;top:0;bottom:0;overflow:auto}
.sidebar .brand{padding:0 18px 18px;border-bottom:1px solid rgba(255,255,255,.08);margin-bottom:10px}
.sidebar .brand img{width:170px;display:block}
.nav a{display:block;padding:12px 18px;color:#fff;border-left:4px solid transparent}
.nav a:hover,.nav a.active{background:rgba(255,255,255,.08);border-left-color:var(--gold)}
.main{margin-left:260px;flex:1;padding:22px}
.topbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}
.topbar h1{margin:0;font-size:26px}
.userbox{display:flex;align-items:center;gap:12px}
.avatar-sm{width:38px;height:38px;border-radius:50%;object-fit:cover;background:#ddd}
.card{background:var(--card);border:1px solid var(--border);border-radius:12px;padding:18px;box-shadow:0 2px 8px rgba(0,0,0,.04)}
.grid{display:grid;gap:16px}
.grid-4{grid-template-columns:repeat(4,minmax(0,1fr))}
.stat{padding:18px;border-left:5px solid var(--blue)}
.stat .label{font-size:12px;color:var(--muted);text-transform:uppercase}
.stat .value{font-size:30px;font-weight:bold;margin-top:8px}
.btn{display:inline-block;padding:10px 14px;border-radius:8px;border:1px solid var(--border);background:#fff;cursor:pointer}
.btn-primary{background:var(--blue);border-color:var(--blue);color:#fff}
.btn-danger{background:var(--danger);border-color:var(--danger);color:#fff}
.btn-warning{background:var(--gold);border-color:var(--gold);color:#fff}
.btn-sm{padding:6px 10px;font-size:12px}
.form-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.form-group{margin-bottom:14px}
label{display:block;margin-bottom:6px;font-weight:bold;font-size:14px}
input,select,textarea{width:100%;padding:10px;border:1px solid var(--border);border-radius:8px;background:#fff}
textarea{min-height:90px;resize:vertical}
table{width:100%;border-collapse:collapse}
th,td{padding:10px;border-bottom:1px solid var(--border);text-align:left;font-size:14px;vertical-align:top}
th{background:#f0f4f8}
.flash{padding:12px 14px;border-radius:8px;margin-bottom:14px}
.flash.ok{background:#e8f6ed;color:#166534}
.flash.err{background:#fdeaea;color:#991b1b}
.pipeline{display:grid;grid-template-columns:repeat(6, minmax(220px,1fr));gap:12px;overflow:auto;padding-bottom:10px}
.stage-col{background:#f7f9fb;border:1px solid var(--border);border-radius:12px;padding:12px;min-height:320px}
.stage-title{font-weight:bold;margin-bottom:10px;color:var(--blue)}
.project-card{background:#fff;border:1px solid var(--border);border-left:4px solid var(--gold);border-radius:10px;padding:10px;margin-bottom:10px}
.badge{display:inline-block;padding:4px 8px;border-radius:999px;font-size:12px;background:#eef2f7}
.progress-square{display:inline-flex;align-items:center;justify-content:center;width:54px;height:54px;border-radius:10px;color:#fff;font-weight:bold;font-size:12px;text-align:center;line-height:1.1}
.progress-yellow{background:var(--warning);color:#3a2f00}
.progress-orange{background:var(--orange);color:#fff}
.progress-green-light{background:var(--green-light);color:#10351a}
.progress-green{background:var(--green);color:#fff}
.progress-red{background:var(--danger);color:#fff}
.timeline-wrap{overflow:auto}
.timeline{min-width:1100px}
.timeline-grid{display:grid;grid-template-columns:260px 120px 120px 120px 110px 140px repeat(15, 60px) 220px;align-items:stretch}
.timeline-grid > div{padding:8px;border-bottom:1px solid var(--border);font-size:13px}
.timeline-head{font-weight:bold;background:#f0f4f8;position:sticky;top:0;z-index:2}
.bar-cell{position:relative;padding:0 !important;border-bottom:1px solid var(--border);height:44px}
.taskbar{position:absolute;top:10px;height:24px;border-radius:999px}
.taskbar.red{background:var(--danger)}
.taskbar.yellow{background:var(--warning)}
.taskbar.orange{background:var(--orange)}
.taskbar.green-light{background:var(--green-light)}
.taskbar.green{background:var(--green)}
.overflow-btn{position:absolute;right:2px;top:8px;width:28px;height:28px;border:none;border-radius:50%;background:var(--blue);color:#fff;cursor:pointer}
.small{font-size:12px;color:var(--muted)}
.modal{display:none;position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:99;align-items:center;justify-content:center}
.modal .inner{background:#fff;border-radius:14px;padding:20px;max-width:420px;width:90%}
.profile-head{display:flex;gap:20px;align-items:center}
.avatar-lg{width:110px;height:110px;border-radius:50%;object-fit:cover;background:#ddd}
.clean-box{min-height:280px;display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:20px}
.permissions-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
@media (max-width: 900px){
 .sidebar{position:relative;width:100%;height:auto}
 .main{margin-left:0}
 .app{display:block}
 .grid-4,.form-row{grid-template-columns:1fr}
}

.badge.red{background:#fdeaea;color:#991b1b}.badge.yellow{background:#fff3c4;color:#5b4b00}.badge.orange{background:#ffe1c2;color:#7a3b00}.badge.green-light{background:#daf6df;color:#14532d}.badge.green{background:#1f8f3a;color:#fff}

.timeline-actions{display:flex;flex-wrap:wrap;gap:6px;align-items:center;min-width:200px;}
.timeline-actions form{display:inline-block;margin:0;}
.timeline-actions .btn{white-space:nowrap;}
.timeline-grid .actions-cell{min-width:200px;}


/* Correção do cronograma: manter a coluna de ações sempre visível */
.timeline-wrap{
  overflow:auto;
  position:relative;
}
.timeline{
  min-width:max-content;
}
.actions-head{
  position:sticky;
  right:0;
  z-index:4;
  background:#f0f4f8;
  min-width:220px;
  box-shadow:-8px 0 12px rgba(0,0,0,.06);
}
.actions-cell{
  position:sticky;
  right:0;
  z-index:3;
  min-width:220px;
  background:#fff;
  box-shadow:-8px 0 12px rgba(0,0,0,.06);
}
.timeline-actions{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  align-items:center;
  min-width:200px;
}
.timeline-actions form{
  display:inline-flex;
}
.timeline-actions .btn{
  white-space:nowrap;
}

/* FIX DEFINITIVO CRONOGRAMA (SEM QUEBRAR GRID) */
.actions-cell {
    text-align: right;
    white-space: nowrap;
}

.actions-cell .timeline-actions {
    display: inline-flex;
    gap: 6px;
}

td.actions-cell {
    min-width: 180px;
}


/* USER TABLE IMPROVEMENT */
table {
    border-collapse: collapse;
    width: 100%;
}

table th {
    background: #f4f6f9;
    padding: 12px;
    text-align: left;
    border-bottom: 2px solid #ddd;
}

table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

table tr:hover {
    background: #f9fbfd;
}

.role-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.role-admin { background:#e3f2fd; color:#1976d2; }
.role-direcao { background:#fff3e0; color:#ef6c00; }
.role-executor { background:#e8f5e9; color:#2e7d32; }

/* PERMISSIONS GRID */
.permissions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 40px;
    margin-top: 10px;
    padding: 15px;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 8px;
}

.permissions-grid label {
    border-bottom: 1px dashed #ddd;
    padding-bottom: 6px;
}

/* DASHBOARD NOVO */
.dashboard-hero{display:flex;justify-content:space-between;align-items:flex-end;gap:20px;margin-bottom:18px}
.dashboard-hero .eyebrow{font-size:15px;letter-spacing:.08em;color:#4b5f7a;font-weight:700;margin-bottom:8px}
.dashboard-hero h2{margin:0 0 8px;font-size:36px;color:#1c3555}
.dashboard-hero p{margin:0;color:#5a6d86;font-size:18px}
.dashboard-updated{font-size:14px;color:#6d7f96;background:#fff;border:1px solid #dfe7f1;border-radius:999px;padding:10px 14px;box-shadow:0 6px 18px rgba(31,79,143,.08)}
.dashboard-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin-bottom:16px}
.metric-card{background:linear-gradient(180deg,#ffffff 0%,#f7faff 100%);border:1px solid #dce6f2;border-radius:18px;padding:20px 24px;box-shadow:0 14px 34px rgba(29,53,87,.08)}
.metric-card span{display:block;font-size:14px;text-transform:uppercase;color:#7789a2;margin-bottom:8px;font-weight:700}
.metric-card strong{display:block;font-size:46px;line-height:1;color:#1d3557;margin-bottom:8px}
.metric-card small{color:#667991;font-size:15px}
.dashboard-grid{display:grid;grid-template-columns:1.45fr 1fr 1fr;gap:18px;align-items:stretch}
.chart-panel{background:linear-gradient(180deg,#ffffff 0%,#f8fbff 100%);border:1px solid #dbe5f2;border-radius:22px;padding:18px 18px 14px;box-shadow:0 18px 40px rgba(31,79,143,.08)}
.chart-panel-wide{grid-column:span 1}
.panel-header{display:flex;justify-content:space-between;align-items:flex-start;gap:18px;margin-bottom:10px}
.panel-header-stack{align-items:center}
.panel-header h3{margin:0 0 4px;font-size:24px;color:#213a5b}
.panel-header p{margin:0;color:#6a7d95;font-size:14px}
.chart-box{min-height:290px}
.chart-lg{min-height:330px}
.chart-filter-form select{min-width:280px;background:#fff}
.pipeline-hero{margin-bottom:24px}
.pipeline-board{display:grid;grid-template-columns:repeat(6,minmax(260px,1fr));gap:16px;overflow:auto;padding-bottom:8px}
.pipeline-column{background:linear-gradient(180deg,#f9fbff 0%,#eef4fb 100%);border:1px solid #dbe4f0;border-radius:20px;padding:14px;min-height:540px;box-shadow:0 12px 28px rgba(31,79,143,.08)}
.pipeline-column header{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px;padding-bottom:10px;border-bottom:1px solid #dfe6f1}
.pipeline-column h3{margin:0;font-size:18px;color:#203757}
.pipeline-column header span{display:inline-flex;align-items:center;justify-content:center;min-width:34px;height:34px;padding:0 10px;border-radius:999px;background:#1f4f8f;color:#fff;font-weight:700}
.pipeline-item{background:#fff;border:1px solid #dde6f0;border-radius:16px;padding:14px;margin-bottom:12px;box-shadow:0 8px 22px rgba(31,79,143,.08)}
.pipeline-item-top{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;margin-bottom:8px}
.pipeline-item-top strong{font-size:16px;color:#203757}
.pipeline-progress{display:inline-flex;align-items:center;justify-content:center;min-width:62px;height:38px;border-radius:12px;padding:0 10px;font-weight:700}
.pipeline-meta,.pipeline-date{font-size:13px;color:#667991;margin-bottom:7px}
.pipeline-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.pipeline-empty{padding:18px;border:1px dashed #c9d8ea;border-radius:14px;color:#70839d;text-align:center;background:rgba(255,255,255,.7)}
@media (max-width: 1280px){
  .dashboard-grid{grid-template-columns:1fr 1fr}
}
@media (max-width: 980px){
  .dashboard-hero{flex-direction:column;align-items:flex-start}
  .dashboard-stats,.dashboard-grid{grid-template-columns:1fr}
  .chart-filter-form select{min-width:100%}
}

/* RELATÓRIOS */
.report-page{display:grid;gap:18px}
.report-header-card{display:flex;justify-content:space-between;gap:18px;align-items:flex-start;background:linear-gradient(180deg,#ffffff 0%,#f7faff 100%);border:1px solid #dbe5f2;border-radius:22px;padding:22px;box-shadow:0 18px 40px rgba(31,79,143,.08)}
.report-header-card h2{margin:0 0 8px;font-size:34px;color:#1c3555}
.report-header-card p{margin:0;color:#60748d}
.report-meta-box{min-width:260px;background:#fff;border:1px solid #dfe7f1;border-radius:16px;padding:14px 16px;display:grid;gap:10px;font-size:14px;color:#536781}
.reports-filter-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;align-items:end}
.reports-actions-row{display:flex;flex-wrap:wrap;gap:10px;align-items:center;grid-column:1/-1}
.report-summary-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px}
.report-summary-card{background:linear-gradient(180deg,#ffffff 0%,#f8fbff 100%);border:1px solid #dce6f2;border-radius:18px;padding:18px 20px;box-shadow:0 14px 34px rgba(29,53,87,.08)}
.report-summary-card span{display:block;font-size:13px;text-transform:uppercase;color:#7789a2;font-weight:700;margin-bottom:8px}
.report-summary-card strong{display:block;font-size:32px;color:#1d3557}
.report-table-card{padding:0;overflow:hidden}
.report-table-wrap{overflow:auto}
.report-table th{white-space:nowrap}
.report-export-body{background:#eef3f9;padding:22px}
.report-page-export{max-width:1400px;margin:0 auto}
.report-export-actions{display:flex;justify-content:flex-end}
@media (max-width: 1100px){
  .reports-filter-grid,.report-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .report-header-card{flex-direction:column}
}
@media (max-width: 700px){
  .reports-filter-grid,.report-summary-grid{grid-template-columns:1fr}
}
@media print{
  .no-print,.sidebar,.topbar{display:none !important}
  body, .report-export-body{background:#fff !important;padding:0 !important}
  .app,.main{display:block !important;margin:0 !important;padding:0 !important}
  .report-page,.report-page-export{display:block}
  .report-header-card,.report-summary-card,.report-table-card{box-shadow:none !important}
  .report-header-card,.report-summary-card,.report-table-card{break-inside:avoid-page}
  .report-summary-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin:18px 0}
  .report-table-wrap{overflow:visible}
  a.btn, button.btn{display:none !important}
}


/* PDP / HUB TÉCNICO */
.project-insights{display:flex;flex-wrap:wrap;gap:18px}
.insight-chip-list{display:flex;flex-wrap:wrap;gap:8px}
.chip{display:inline-flex;align-items:center;padding:6px 12px;border-radius:999px;background:#eef4fb;border:1px solid #d7e3f1;color:#28486f;font-size:13px;font-weight:700}
.hub-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}
.inline-form{margin-bottom:14px}
.photo-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-top:14px}
.photo-card{border:1px solid var(--border);border-radius:12px;padding:10px;background:#fff}
.photo-card img{width:100%;height:180px;object-fit:cover;border-radius:10px;margin-bottom:8px}
.brand-preview{padding:12px;border:1px dashed var(--border);border-radius:12px;background:#f8fbff;display:inline-block;margin-bottom:10px}
.brand-preview img{max-width:220px;max-height:90px;display:block}
@media (max-width: 980px){
  .hub-grid{grid-template-columns:1fr}
  .photo-grid{grid-template-columns:1fr}
}


/* gráficos refeitos */
.dashboard-hero{display:flex;justify-content:space-between;align-items:flex-end;gap:20px;margin-bottom:18px}
.dashboard-hero h2{font-size:56px;line-height:1;margin:0 0 12px;color:#14386b}
.dashboard-hero p{font-size:18px;max-width:760px;color:#496584}
.dashboard-updated{padding:12px 18px;border:1px solid #d8e3f0;border-radius:999px;background:#fff;color:#5f7694;white-space:nowrap}
.dashboard-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:18px;margin-bottom:18px}
.metric-card{background:linear-gradient(180deg,#ffffff 0%,#f7fbff 100%);border:1px solid #d9e5f0;border-radius:24px;padding:22px 26px;box-shadow:0 10px 30px rgba(37,99,235,.06)}
.metric-card span{display:block;text-transform:uppercase;letter-spacing:.04em;font-weight:700;color:#6b84a3;font-size:15px}
.metric-card strong{display:block;font-size:58px;line-height:1;color:#163a6d;margin:10px 0 10px}
.metric-card small{font-size:16px;color:#607896}
.charts-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:22px}
.chart-panel{background:linear-gradient(180deg,#ffffff 0%,#f8fbff 100%);border:1px solid #d9e5f0;border-radius:24px;padding:22px 22px 10px;box-shadow:0 12px 34px rgba(15,23,42,.05);overflow:hidden}
.chart-panel-wide{grid-column:span 1}
.chart-panel-full{width:100%}
.panel-header{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;margin-bottom:12px}
.panel-header h3{margin:0 0 6px;font-size:24px;line-height:1.15;color:#163a6d}
.panel-header p{margin:0;color:#607896;font-size:16px;max-width:420px}
.panel-header-stack{align-items:center}
.chart-box{width:100%;min-height:340px}
.chart-lg{min-height:420px}
.chart-filter-form select{min-width:260px;padding:12px 14px;border-radius:14px;border:1px solid #cfdceb;background:#fff;font-size:16px}
.apexcharts-canvas,.apexcharts-svg{max-width:100%!important}
@media (max-width: 1200px){
  .dashboard-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
  .charts-grid{grid-template-columns:1fr}
}
@media (max-width: 768px){
  .dashboard-hero{flex-direction:column;align-items:flex-start}
  .dashboard-hero h2{font-size:42px}
  .dashboard-stats{grid-template-columns:1fr}
}



/* ACOMPANHAMENTO DE PRODUÇÃO */
.acompanhamento-card{padding:0;background:#fff}
.acomp-empty-state{padding:40px 32px;text-align:center}
.acomp-empty-state h3{margin:0 0 10px;color:#18365f;font-size:28px}
.acomp-empty-state p{margin:0;color:#617792}
.acomp-sheet{padding:28px;display:grid;gap:20px;background:linear-gradient(180deg,#fff 0%,#f9fbff 100%)}
.acomp-sheet-header{display:flex;justify-content:space-between;gap:24px;align-items:flex-start;padding-bottom:18px;border-bottom:2px solid #d9e5f2}
.acomp-brand{display:flex;gap:16px;align-items:center}
.acomp-brand img{width:84px;height:auto;object-fit:contain}
.acomp-brand span{display:block;font-size:12px;letter-spacing:.08em;color:#6f85a0;font-weight:800}
.acomp-brand strong{display:block;font-size:30px;color:#173a6b}
.acomp-brand small{display:block;margin-top:4px;color:#6b7f98}
.acomp-sheet-meta{display:grid;grid-template-columns:repeat(3,minmax(120px,1fr));gap:12px;min-width:420px}
.acomp-sheet-meta div,.acomp-product-grid div{background:#fff;border:1px solid #dce6f2;border-radius:16px;padding:12px 14px}
.acomp-sheet-meta span,.acomp-product-grid label{display:block;text-transform:uppercase;font-size:11px;letter-spacing:.06em;color:#7387a1;font-weight:800;margin-bottom:6px}
.acomp-sheet-meta strong,.acomp-product-grid strong{display:block;color:#18365f;font-size:18px}
.acomp-product-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
.acomp-section{display:grid;gap:10px}
.acomp-section-title{display:inline-flex;align-items:center;padding:10px 14px;border-radius:12px;background:#173a6b;color:#fff;font-weight:800;letter-spacing:.03em;width:max-content}
.acomp-table th,.acomp-table td,.acomp-check-table td{font-size:14px}
.checkbox-cell{white-space:nowrap;text-align:center;font-weight:700;color:#173a6b}
.manual-line{min-width:180px;border-bottom:1px solid #b9c9dd}
.acomp-two-col{display:grid;grid-template-columns:1.2fr .8fr;gap:18px}
.acomp-notes-box{display:grid;gap:18px;padding:16px 8px 4px}
.acomp-notes-box div{border-bottom:1px solid #b9c9dd;min-height:16px}
.acomp-signatures{display:grid;grid-template-columns:repeat(3,1fr);gap:30px;margin-top:14px;padding-top:18px}
.acomp-signatures div{padding-top:20px;border-top:1px solid #b9c9dd;text-align:center}
.acomp-signatures span{font-size:13px;color:#627792;font-weight:700}
@media (max-width: 980px){
  .acomp-sheet-header,.acomp-two-col{grid-template-columns:1fr;display:grid}
  .acomp-sheet-meta,.acomp-product-grid{grid-template-columns:1fr}
  .acomp-sheet-meta{min-width:0}
}
@media print{
  .acomp-sheet{padding:0;background:#fff}
  .acomp-sheet-meta div,.acomp-product-grid div{break-inside:avoid}
}


/* Cronograma ajustado */
.timeline{min-width:max-content}
.timeline-grid{align-items:stretch}
.timeline-grid > div{display:flex;align-items:center}
.timeline-main-cell{display:block !important;align-items:initial !important}
.timeline-day-head{justify-content:center;text-align:center;min-width:48px}
.timeline-day-cell{padding:0 !important;height:42px;min-width:48px;background:#fff;border-left:1px solid #eef2f7;border-bottom:1px solid var(--border)}
.timeline-day-cell.is-active{position:relative}
.timeline-day-cell.is-active.yellow{background:#f2c94c}
.timeline-day-cell.is-active.orange{background:#f2994a}
.timeline-day-cell.is-active.red{background:#eb5757}
.timeline-day-cell.is-active.green-light{background:#6fcf97}
.timeline-day-cell.is-active.green{background:#27ae60}
.timeline-day-cell.is-start{border-top-left-radius:999px;border-bottom-left-radius:999px}
.timeline-day-cell.is-end{border-top-right-radius:999px;border-bottom-right-radius:999px}
.timeline-day-cell.is-active + .timeline-day-cell.is-active{border-left-color:transparent}
.timeline-grid .timeline-head.actions-head,.timeline-grid .actions-cell{position:sticky;right:0;background:#fff;z-index:3}
.timeline-grid .timeline-head.actions-head{background:#f0f4f8;z-index:4}
