/* =====================================================================
   Portal de Gestão — Secretaria de Tecnologia da Informação
   Santa Tereza do Oeste - PR
   Visual unificado com o Portal de Sistemas (mesmos tokens de design).
   Todas as classes abaixo têm os MESMOS NOMES usados nas páginas PHP —
   só o visual foi trocado, nenhum HTML/PHP de página precisou mudar.
   ===================================================================== */

:root{
  --primary-50:  #eafbf1;
  --primary-100: #cdf3dc;
  --primary-400: #2fa863;
  --primary-500: #17914f;
  --primary-600: #0f7a41;
  --primary-700: #0c6335;
  --primary-900: #0a3d22;

  --accent-500: #0e6fc9;
  --accent-600: #0b5aa3;

  /* Cores fixas da marca — sidebar e tela de login não mudam com o tema. */
  --brand-900: #0a3d22;
  --brand-700: #0c6335;
  --brand-600: #0f7a41;
  --brand-accent-600: #0b5aa3;

  --bg: #f3f5f4;
  --card-bg: #ffffff;
  --surface-soft: #f7f9f8;
  --border: #e3e8e5;
  --border-strong: #cdd5d0;

  --text: #1b2320;
  --muted: #5c6864;
  --text-faint: #8b948f;

  --danger: #d1332a;
  --danger-bg: #fbe1df;
  --success: #0f7a41;
  --success-bg: #e3f2e8;
  --warning-bg: #fdf0e2;
  --warning-text: #b3541e;

  --shadow-sm: 0 1px 2px rgba(15, 30, 20, 0.06);
  --shadow-md: 0 6px 20px -4px rgba(15, 30, 20, 0.12), 0 2px 6px rgba(15, 30, 20, 0.06);
  --shadow-lg: 0 20px 45px -12px rgba(10, 30, 20, 0.28);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, Arial, Helvetica, sans-serif;
  color-scheme: light;
}

[data-theme="dark"]{
  --bg: #0f1512;
  --card-bg: #17201c;
  --surface-soft: #1b2521;
  --border: #26332c;
  --border-strong: #33453b;

  --text: #eaf1ec;
  --muted: #a3b0aa;
  --text-faint: #71807a;

  --primary-50:  #10261a;
  --primary-100: #123521;
  --primary-400: #37c17c;
  --primary-500: #2fa863;
  --primary-600: #3fce88;
  --primary-700: #63dc9f;

  --danger-bg: #301715;
  --success-bg: #123521;
  --warning-bg: #2e2113;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.35);
  --shadow-md: 0 10px 30px -8px rgba(0,0,0,0.55), 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 25px 60px -15px rgba(0,0,0,0.65);
  color-scheme: dark;
}

* { box-sizing: border-box; }
.icon{ flex-shrink: 0; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}
h1,h2,h3 { margin: 0; }
a { color: inherit; }
::selection{ background: var(--primary-100); color: var(--primary-900); }
:focus-visible{ outline: 2px solid var(--accent-500); outline-offset: 2px; border-radius: 6px; }

/* ---------------------------------------------------------------------
   Login
   --------------------------------------------------------------------- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 20%, rgba(255,255,255,0.10), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(255,255,255,0.08), transparent 45%),
    linear-gradient(150deg, var(--brand-900), var(--brand-600) 70%, var(--brand-accent-600));
  padding: 20px;
}
.login-box {
  background: var(--card-bg);
  padding: 40px 36px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 380px;
  max-width: 100%;
  text-align: center;
}
.login-box .brasao{
  width: 48px; height: 48px;
  border-radius: 14px;
  background: var(--brand-900);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px;
  margin: 0 auto 16px auto;
}
.login-box h1 { margin: 0 0 4px; font-size: 19px; font-weight: 800; color: var(--text); }
.login-box .subtitle { color: var(--muted); font-size: 13px; margin-bottom: 22px; line-height: 1.5; }
.login-box form { text-align: left; }
.login-box label { display: block; margin: 14px 0 6px; font-size: 12.5px; font-weight: 700; color: var(--text); }
.login-box input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; background: var(--card-bg); color: var(--text); outline: none;
}
.login-box input:focus{ border-color: var(--primary-400); box-shadow: 0 0 0 3px var(--primary-100); }
.login-box .hint { font-size: 11.5px; color: var(--text-faint); margin-top: 20px; line-height: 1.6; }

/* ---------------------------------------------------------------------
   Layout: sidebar + conteúdo
   --------------------------------------------------------------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar-overlay{
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 39;
}
.sidebar-overlay.aberta{ display: block; }

.mobile-topbar{ display: none; }

.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--brand-900), var(--brand-700) 65%, var(--brand-600));
  color: #eafbf1;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 40;
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 20px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.14);
  margin-bottom: 10px;
}
.sidebar .brand::before{
  content: "STI";
  width: 42px; height: 42px;
  border-radius: 12px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; letter-spacing: 0.4px;
  flex-shrink: 0;
}
.sidebar .brand strong { display: block; font-size: 13.5px; font-weight: 700; line-height: 1.25; }
.sidebar .brand span { display: block; font-size: 11px; opacity: 0.75; margin-top: 2px; }

.sidebar nav { flex: 1; display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.sidebar nav a {
  color: rgba(255,255,255,0.88);
  text-decoration: none;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border-left: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.10); }
.sidebar nav a.active { background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.24); color: #fff; font-weight: 700; }

.sidebar-footer {
  padding: 14px 4px 0;
  margin-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.14);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-footer > span{ padding: 0 8px; font-weight: 600; color: rgba(255,255,255,0.85); }
.sidebar-footer a {
  color: #fff;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-footer a:hover{ background: rgba(255,255,255,0.16); }
.theme-toggle{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
}
.theme-toggle:hover{ background: rgba(255,255,255,0.16); }

.content { flex: 1; min-width: 0; padding: 30px 36px; overflow-x: auto; }
.content h2 { color: var(--text); font-size: 20px; font-weight: 800; letter-spacing: -0.2px; }
.content h3 { color: var(--text); margin-top: 30px; font-size: 16px; font-weight: 700; }

.page-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------------
   Cards (dashboard)
   --------------------------------------------------------------------- */
.cards { display: flex; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  flex: 1;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}
.card-number { font-size: 30px; font-weight: 800; color: var(--primary-600); }
.card-label { color: var(--muted); font-size: 12.5px; margin-top: 4px; font-weight: 600; }

/* ---------------------------------------------------------------------
   Tabelas
   --------------------------------------------------------------------- */
.table-wrap { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.table th { background: var(--surface-soft); color: var(--text); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.table tbody tr:last-child td{ border-bottom: none; }
.table tbody tr:hover { background: var(--surface-soft); }
.table .empty { text-align: center; color: var(--text-faint); padding: 28px; }
.wrap-cell { max-width: 420px; word-break: break-word; }
.cell-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.cell-strong{ font-weight: 700; }

.actions a { margin-right: 12px; font-size: 12.5px; font-weight: 700; text-decoration: none; color: var(--primary-600); }
.actions a:hover{ text-decoration: underline; }
.actions a.danger { color: var(--danger); }

.filter-bar { margin-bottom: 16px; }
.filter-bar select { padding: 9px 14px; border-radius: var(--radius-pill); border: 1px solid var(--border); font-size: 13px; background: var(--card-bg); color: var(--text); font-family: inherit; }

.pass-field { display: flex; align-items: center; gap: 6px; }
.pass-field input { border: none; background: transparent; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; width: 130px; color: var(--text); }
.toggle-pass { border: none; background: none; cursor: pointer; font-size: 14px; }

/* ---------------------------------------------------------------------
   Botões
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover{ border-color: var(--primary-400); color: var(--primary-600); }
.btn-primary { background: var(--primary-500); color: #fff; border-color: var(--primary-500); }
.btn-primary:hover { background: var(--primary-600); color: #fff; border-color: var(--primary-600); }
.btn-block { display: flex; width: 100%; justify-content: center; margin-top: 20px; }
.btn-small { padding: 7px 12px; font-size: 12px; white-space: nowrap; }

/* ---------------------------------------------------------------------
   Formulários
   --------------------------------------------------------------------- */
.form { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 26px; max-width: 560px; box-shadow: var(--shadow-sm); }
.form label { display: block; margin: 14px 0 6px; font-size: 12.5px; font-weight: 700; color: var(--text); }
.form input, .form select, .form textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13.5px; font-family: inherit;
  background: var(--card-bg); color: var(--text); outline: none;
}
.form input:focus, .form select:focus, .form textarea:focus{ border-color: var(--primary-400); box-shadow: 0 0 0 3px var(--primary-100); }
.form-actions { margin-top: 22px; display: flex; gap: 10px; }

.field-with-action { display: flex; gap: 8px; align-items: center; }
.field-with-action select, .field-with-action input { flex: 1; min-width: 0; }
.pasta-row { margin-bottom: 8px; }

/* ---------------------------------------------------------------------
   Alertas / badges
   --------------------------------------------------------------------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 18px; font-weight: 600; }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(209,51,42,0.25); }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(15,122,65,0.25); }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); border: 1px solid rgba(179,84,30,0.25); margin-top: 22px; }

.hint { color: var(--text-faint); font-size: 12px; margin-top: 10px; line-height: 1.6; }

.badge { border: none; border-radius: var(--radius-pill); padding: 6px 15px; font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit; }
.badge-yes { background: var(--success-bg); color: var(--success); }
.badge-no { background: var(--danger-bg); color: var(--danger); }

/* ---------------------------------------------------------------------
   Mensagem de acesso
   --------------------------------------------------------------------- */
.msg-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  max-width: 620px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.msg-box label { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 8px; }
.msg-box textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  background: var(--surface-soft);
  color: var(--text);
  resize: vertical;
}
.msg-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.copia-ok { color: var(--success); font-size: 13px; font-weight: 700; }
.ref-image { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); display: block; }

/* ---------------------------------------------------------------------
   Relatório
   --------------------------------------------------------------------- */
.report-controls { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.check-inline { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.check-inline input { width: auto; }

.report-modern {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-width: 900px;
  box-shadow: var(--shadow-md);
}

.report-banner {
  background: linear-gradient(135deg, var(--brand-900), var(--brand-600));
  color: #fff;
  padding: 26px 32px;
  display: flex;
  align-items: center;
  gap: 18px;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}
.report-badge {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.6);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; letter-spacing: 0.5px;
  flex-shrink: 0;
}
.report-banner-text h1 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: 0.2px; }
.report-banner-text p { margin: 4px 0 0; font-size: 12.5px; opacity: 0.85; }

.report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 32px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
}
.meta-chip {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 5px 14px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.meta-chip-accent { background: var(--success-bg); border-color: rgba(15,122,65,0.25); color: var(--success); font-weight: 700; }

.report-section { padding: 22px 32px; border-bottom: 1px solid var(--border); }
.report-section:last-of-type { border-bottom: none; }

.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.section-title h3 { margin: 0; margin-top: 0; font-size: 15px; color: var(--text); flex: 1; }
.section-badge {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--primary-500);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}
.section-count {
  background: var(--surface-soft);
  color: var(--primary-600);
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 11px;
  border-radius: var(--radius-pill);
}

.depto-block { margin-bottom: 18px; }
.depto-block:last-child { margin-bottom: 0; }
.depto-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; color: var(--primary-600);
  margin-bottom: 6px;
}
.depto-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary-500); flex-shrink: 0; }
.depto-count { margin-left: auto; font-weight: 500; color: var(--text-faint); font-size: 11.5px; }

.report-table { width: 100%; border-collapse: collapse; margin-bottom: 4px; font-size: 12.5px; border-radius: var(--radius-sm); overflow: hidden; }
.report-table th {
  background: var(--surface-soft);
  color: var(--text);
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  font-weight: 700;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 2px solid var(--border-strong);
}
.report-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.report-table tbody tr:nth-child(even) { background: var(--surface-soft); }

.status-pill { display: inline-block; padding: 2px 11px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 700; }
.status-yes { background: var(--success-bg); color: var(--success); }
.status-no { background: var(--danger-bg); color: var(--danger); }

.report-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.filter-pill {
  display: inline-block;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
}
.filter-pill:hover { border-color: var(--primary-400); color: var(--primary-600); }
.filter-pill.active { background: var(--primary-500); border-color: var(--primary-500); color: #fff; font-weight: 700; }

.report-footer {
  padding: 16px 32px;
  background: var(--surface-soft);
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
}

/* ---------------------------------------------------------------------
   Responsivo
   --------------------------------------------------------------------- */
@media (max-width: 980px){
  .sidebar{
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 82vw);
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.aberta{ transform: translateX(0); }
  .mobile-topbar{
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--brand-700);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 30;
    margin: -30px -36px 22px -36px;
  }
  .mobile-topbar .btn-menu{
    width: 34px; height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
  }
  .mobile-topbar .titulo-mobile{ font-size: 13.5px; font-weight: 700; }
  .content{ padding: 18px; }
  .login-painel{ display: none; }
}

@media print {
  html, body { height: auto; }
  .sidebar, .sidebar-overlay, .mobile-topbar, .no-print { display: none !important; }
  .layout { display: block; min-height: 0; }
  .content { padding: 0; overflow: visible; }
  body { background: #fff; }
  /* overflow:hidden é só para arredondar os cantos na tela; na impressão
     ele faz o Chrome calcular mal a paginação de um card com várias
     páginas e gerar páginas em branco antes do conteúdo. */
  .report-modern { box-shadow: none; border-radius: 0; max-width: 100%; overflow: visible; }
  .report-banner { border-radius: 0; page-break-after: avoid; break-after: avoid; }
  .report-meta { page-break-after: avoid; break-after: avoid; }
  /* "avoid" na seção inteira (título + tabela) faz o Chrome tentar manter
     tudo junto quando a tabela é grande, e como não cabe mesmo assim, ele
     empurra a seção pra próxima página e o título fica sozinho lá (órfão),
     com a tabela só começando na página seguinte. Por isso o "avoid" fica
     só no título, pra ele nunca ficar sozinho no fim da página — a tabela
     em si já quebra sozinha entre linhas normalmente. */
  .section-title { page-break-after: avoid; break-after: avoid; }
  .depto-block { page-break-inside: avoid; break-inside: avoid; }
  .report-table tr { page-break-inside: avoid; break-inside: avoid; }
  .report-table thead { display: table-header-group; }
  .report-footer { page-break-inside: avoid; break-inside: avoid; }
  @page { size: A4; margin: 12mm; }
}
