@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
    --bg-body: #f0f4f8;
    --bg-body-gradient: linear-gradient(145deg, #edf2f7 0%, #e8edf4 50%, #f0f4f8 100%);
    --sidebar-bg: #0f1a2e;
    --sidebar-hover: rgba(255,255,255,0.06);
    --sidebar-active-bg: rgba(96,165,250,0.18);
    --sidebar-active-text: #93c5fd;
    --card-bg: #ffffff;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #dbeafe;
    --accent: #f59e0b;
    --accent-hover: #d97706;
    --accent-soft: #fef3c7;
    --verde: #10b981;
    --verde-soft: #d1fae5;
    --vermelho: #ef4444;
    --vermelho-soft: #fee2e2;
    --amarelo: #f59e0b;
    --azul: #2563eb;
    --azul-soft: #dbeafe;
    --text-main: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-focus: #93c5fd;
    --input-bg: #f1f5f9;
    --shadow-xs: 0 1px 2px rgba(15,23,42,0.04);
    --shadow-sm: 0 1px 3px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
    --shadow-md: 0 4px 12px rgba(15,23,42,0.07), 0 2px 4px rgba(15,23,42,0.04);
    --shadow-lg: 0 12px 40px rgba(15,23,42,0.1), 0 4px 12px rgba(15,23,42,0.06);
    --radius-sm: 12px;
    --radius: 20px;
    --radius-lg: 24px;
    --radius-pill: 9999px;
    --m-blue: #1e40af;
    --m-light-blue: #eff6ff;
    --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    background-image: var(--bg-body-gradient);
    background-attachment: fixed;
    display: flex;
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "cv11" 1, "ss01" 1;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }
*:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 8px; }

/* ============================================================
   LOGIN / MODAIS
   ============================================================ */
.login-box {
    background: var(--card-bg); padding: 48px 40px; border-radius: var(--radius-lg); text-align: center;
    max-width: 420px; width: 92%; box-shadow: var(--shadow-lg);
}
.login-box img.brand-logo { max-width: 200px; height: auto; margin-bottom: 28px; }
.login-box h2 { font-weight: 800; letter-spacing: -0.5px; font-size: 22px; color: var(--text-main); }
.login-box input {
    text-align: center; letter-spacing: 0.5px; font-size: 15px; margin-bottom: 16px;
    width: 100%; padding: 14px 16px; border: 1.5px solid transparent; border-radius: 16px; outline: none;
    background: var(--input-bg); transition: var(--transition); color: var(--text-main); font-family: inherit;
}
.login-box input:focus { border-color: var(--border-focus); background: #fff; box-shadow: 0 0 0 4px rgba(96,165,250,0.15); }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: 270px; background: var(--sidebar-bg); color: #cbd5e1; height: 100vh; position: fixed;
    padding: 24px 14px; display: flex; flex-direction: column;
    overflow-y: auto; z-index: 100;
}
.sidebar::-webkit-scrollbar { width: 4px; } .sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
.logo-area { text-align: center; margin-bottom: 28px; padding: 4px 0 20px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.logo-area img { max-width: 76%; height: auto; filter: brightness(0) invert(1); opacity: 0.92; }
.logo-tag {
    font-size: 9.5px; color: #93c5fd; margin-top: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 2.5px; background: rgba(96,165,250,0.1); padding: 5px 14px; border-radius: var(--radius-pill); display: inline-block;
}
.nav-category { font-size: 10px; text-transform: uppercase; color: #475569; font-weight: 800; margin: 20px 0 8px 16px; letter-spacing: 1.8px; }
.nav-btn {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 16px; margin-bottom: 2px;
    background: transparent; color: #94a3b8; border: none; border-radius: var(--radius-pill); cursor: pointer;
    font-size: 13.5px; font-weight: 500; transition: var(--transition); text-align: left; text-decoration: none;
}
.nav-btn:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.nav-btn.active {
    background: var(--sidebar-active-bg); color: var(--sidebar-active-text); font-weight: 700;
}

/* ============================================================
   MAIN
   ============================================================ */
.main { margin-left: 270px; padding: 32px 40px 60px; width: calc(100% - 270px); min-height: 100vh; }
.header-title { font-size: 26px; font-weight: 800; color: var(--text-main); margin: 0 0 4px 0; letter-spacing: -0.6px; }
.header-subtitle { color: var(--text-muted); font-size: 14px; margin: 0 0 28px 0; font-weight: 400; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--card-bg); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm);
    margin-bottom: 20px; border: 1px solid var(--border); transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.card-header h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--text-main); letter-spacing: -0.2px; }

/* ============================================================
   RESUMO CARDS
   ============================================================ */
.resumo-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.resumo-card {
    background: var(--card-bg); padding: 20px; border-radius: var(--radius); border: 1px solid var(--border);
    box-shadow: var(--shadow-xs); position: relative; overflow: hidden; transition: transform var(--transition), box-shadow var(--transition);
}
.resumo-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.resumo-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; border-radius: 0 4px 4px 0; }
.resumo-azul::before { background: var(--azul); } .resumo-verde::before { background: var(--verde); }
.resumo-vermelho::before { background: var(--vermelho); } .resumo-amarelo::before { background: var(--accent); }
.resumo-card h4 { margin: 0 0 8px 0; font-size: 11px; color: var(--text-muted); text-transform: uppercase; font-weight: 700; letter-spacing: 0.8px; }
.valor { font-size: 28px; font-weight: 800; color: var(--text-main); margin: 0; letter-spacing: -0.8px; }

/* ============================================================
   TABELAS
   ============================================================ */
.table-container { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--card-bg); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: var(--input-bg); padding: 12px 14px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; font-size: 10.5px; letter-spacing: 0.5px; text-align: left; position: sticky; top: 0; z-index: 10; }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text-secondary); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8fafc; }
.badge { padding: 4px 10px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 700; display: inline-block; text-align: center; }
.btn-icon { background: var(--input-bg); border: none; cursor: pointer; font-size: 13px; padding: 8px; border-radius: 10px; transition: var(--transition); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.btn-icon:hover { background: var(--primary-soft); transform: scale(1.05); }

/* ============================================================
   FORMS & BUTTONS
   ============================================================ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.input-group { margin-bottom: 16px; position: relative; display: flex; flex-direction: column; }
.input-group.full { grid-column: span 2; }
label { margin-bottom: 6px; font-weight: 600; font-size: 12px; color: var(--text-muted); }
input, select, textarea {
    width: 100%; padding: 12px 16px; border: 1.5px solid transparent; border-radius: 16px;
    font-family: 'Inter', sans-serif; font-size: 14px; background: var(--input-bg); transition: var(--transition);
    color: var(--text-main);
}
input:focus, select:focus, textarea:focus { border-color: var(--border-focus); background: #fff; box-shadow: 0 0 0 4px rgba(96,165,250,0.12); outline: none; }
textarea { resize: vertical; min-height: 80px; }

.btn-action {
    background: var(--primary); color: white; border: none; padding: 14px 24px; border-radius: var(--radius-pill);
    cursor: pointer; font-weight: 700; width: 100%; transition: var(--transition); font-family: inherit; font-size: 14px;
    box-shadow: 0 4px 14px -4px rgba(37,99,235,0.4);
}
.btn-action:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 6px 20px -4px rgba(37,99,235,0.5); }
.btn-red { background: var(--vermelho); box-shadow: 0 4px 14px -4px rgba(239,68,68,0.4); } .btn-red:hover { background: #dc2626; }
.btn-accent { background: var(--accent); color: #0f172a; box-shadow: 0 4px 14px -4px rgba(245,158,11,0.4); } .btn-accent:hover { background: var(--accent-hover); }
.btn-link-add { background: none; border: none; color: var(--primary); font-size: 12px; font-weight: 700; cursor: pointer; padding: 0; }

.btn-secundario {
    background: var(--input-bg); color: var(--text-secondary); border: 1px solid var(--border); padding: 10px 18px;
    border-radius: var(--radius-pill); cursor: pointer; font-weight: 600; text-decoration: none; font-size: 13px;
    transition: var(--transition); display: inline-block; font-family: inherit;
}
.btn-secundario:hover { background: #e2e8f0; }

/* ============================================================
   GRIDS, CHARTS, MISC
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.chart-box { height: 320px; width: 100%; position: relative; }
.status-box { padding: 12px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 700; text-align: center; margin-bottom: 20px; }

.btn-associar {
    background: var(--input-bg); border: 1.5px solid var(--border); padding: 11px 16px; border-radius: var(--radius-sm); font-weight: 600;
    cursor: pointer; color: var(--text-secondary); margin-bottom: 8px; width: 100%; text-align: left; transition: var(--transition);
    text-decoration: none; display: block;
}
.btn-associar:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

/* ============================================================
   DIARIO DE BORDO
   ============================================================ */
.section-title-diario {
    background: var(--m-light-blue); color: var(--m-blue); padding: 10px 16px; font-size: 12px; text-transform: uppercase;
    font-weight: 800; border-left: 4px solid var(--m-blue); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 24px 0 14px 0; letter-spacing: 0.4px;
}
.acompanhamento-row {
    display: grid; grid-template-columns: 1fr 1fr 3fr auto; gap: 12px; background: var(--input-bg); padding: 14px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; align-items: end;
}
.btn-danger { background: var(--vermelho); color: white; border: none; padding: 12px; border-radius: 10px; cursor: pointer; font-weight: 600; }
.file-hint { font-size: 11px; color: var(--text-muted); margin-top: 5px; }
.evidencias-container { display: flex; flex-wrap: wrap; gap: 15px; justify-content: center; padding: 15px; border: 1px solid var(--border); border-top: none; background: #fff; }
.evidence-img { max-width: 45%; max-height: 250px; object-fit: contain; border: 1px solid var(--border); padding: 4px; border-radius: 8px; }

/* ============================================================
   TOPBAR & ALERTS
   ============================================================ */
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 14px; }
.topbar .unidade-tag {
    background: var(--primary-soft); color: var(--primary); padding: 6px 16px; border-radius: var(--radius-pill);
    font-size: 12px; font-weight: 700;
}
a.nav-btn { text-decoration: none; }
.alert-erro { background: var(--vermelho-soft); color: #991b1b; padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 20px; font-weight: 600; font-size: 13px; border: 1px solid #fecaca; }
.alert-sucesso { background: var(--verde-soft); color: #065f46; padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 20px; font-weight: 600; font-size: 13px; border: 1px solid #a7f3d0; }

.dropzone {
    background: linear-gradient(180deg, #f0f7ff, #e8f0fe); padding: 36px; border: 2px dashed var(--primary);
    border-radius: var(--radius-lg); text-align: center; transition: var(--transition); cursor: pointer;
}
.dropzone:hover { background: #dbeafe; border-color: var(--primary-hover); }
.dropzone h3 { color: var(--primary); margin: 0 0 8px 0; font-size: 16px; }

/* ============================================================
   TABS (Pill Style)
   ============================================================ */
.tabs-pill { display: flex; gap: 6px; margin-bottom: 24px; padding: 4px; background: var(--input-bg); border-radius: var(--radius-pill); width: fit-content; }
.tab-pill {
    padding: 9px 20px; border-radius: var(--radius-pill); border: none; cursor: pointer; font-family: inherit;
    font-size: 13px; font-weight: 600; color: var(--text-muted); background: transparent; transition: var(--transition);
}
.tab-pill:hover { color: var(--text-main); }
.tab-pill.active { background: var(--primary); color: white; box-shadow: 0 2px 8px rgba(37,99,235,0.3); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============================================================
   PROGRESS BAR (Auditorias)
   ============================================================ */
.progress-bar-container { display: flex; height: 28px; border-radius: var(--radius-pill); overflow: hidden; background: var(--input-bg); margin-bottom: 12px; }
.progress-segment { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: white; transition: width 0.5s ease; }
.progress-atendida { background: var(--verde); }
.progress-prazo { background: var(--primary); }
.progress-atrasada { background: var(--vermelho); }

/* ============================================================
   APRESENTAÇÃO GERENCIAL (Print Landscape)
   ============================================================ */
.slide-page {
    background: #fffef5; border-radius: var(--radius-lg); padding: 40px; margin-bottom: 24px;
    box-shadow: var(--shadow-md); border: 1px solid #fef08a; min-height: 60vh; position: relative;
    overflow: hidden;
}
.slide-page::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 5px; background: linear-gradient(90deg, var(--accent), #fbbf24, var(--accent)); }
.slide-header { font-size: 22px; font-weight: 800; color: #1e293b; margin-bottom: 24px; letter-spacing: -0.5px; }
.slide-subheader { font-size: 13px; color: var(--text-muted); margin-top: -20px; margin-bottom: 24px; font-weight: 500; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .sidebar { position: relative; width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; padding: 12px; }
  .main { margin-left: 0; width: 100%; padding: 20px; }
  .resumo-grid, .form-grid, .grid-2 { grid-template-columns: 1fr; }
  .input-group.full { grid-column: span 1; }
}

@media print {
  .sidebar, .no-print, .topbar, .btn-icon, .btn-action, .btn-secundario, .dropzone, form { display: none !important; }
  .main { margin-left: 0 !important; width: 100% !important; padding: 10px !important; }
  body { background: #fff !important; display: block !important; color: #000 !important; font-size: 11pt; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; break-inside: avoid; padding: 12px !important; margin-bottom: 12px !important; border-radius: 8px !important; }
  .card-header { border-bottom: 2px solid #333 !important; padding-bottom: 6px !important; }
  .card-header h3 { font-size: 13pt !important; }
  .resumo-grid { grid-template-columns: repeat(4, 1fr) !important; gap: 8px !important; }
  .resumo-card { padding: 10px !important; border: 1px solid #ccc !important; box-shadow: none !important; }
  .valor { font-size: 20pt !important; }
  table { font-size: 9pt !important; }
  th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .badge { border: 1px solid #999 !important; }
  .chart-box { height: 250px !important; }
  .grid-2 { grid-template-columns: 1fr 1fr !important; }
  .kanban { grid-template-columns: repeat(4, 1fr) !important; }
  .kanban-card .mover-btns { display: none !important; }
  a { color: #000 !important; text-decoration: none !important; }
  /* Header de impressão */
  .main::before {
    content: ''; display: block; text-align: center; font-size: 8pt; color: #999;
    border-bottom: 1px solid #ccc; padding-bottom: 6px; margin-bottom: 12px;
  }
  .slide-page { page-break-after: always; box-shadow: none !important; border: none !important; border-radius: 0 !important; min-height: 95vh; padding: 20px !important; }
  .slide-page::before { display: none; }
  .progress-bar-container { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .progress-segment { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media print and (orientation: landscape) {
  @page { size: A4 landscape; margin: 12mm; }
}
