/* ── Paleta de Marca ──────────────────────────────────────────── */
:root {
  --petroleo:      #0F3D4A;
  --dourado:       #C9A227;
  --dourado-dark:  #a88420;
  --preto:         #111111;
  --verde:         #1E8E5A;
  --offwhite:      #F7F4EC;
  --cinza:         #2B2B2B;

  /* Sidebar */
  --sidebar-w:      240px;
  --sidebar-w-col:   64px;
  --sidebar-bg:     #0F3D4A;
  --sidebar-hover:  rgba(255,255,255,.07);
  --sidebar-active: rgba(201,162,39,.2);
  --transition:     0.22s ease;

  /* Bootstrap overrides via CSS vars */
  --bs-primary:           #C9A227;
  --bs-primary-rgb:       201, 162, 39;
  --bs-success:           #1E8E5A;
  --bs-success-rgb:       30, 142, 90;
  --bs-body-bg:           #F7F4EC;
  --bs-body-color:        #111111;
  --bs-link-color:        #C9A227;
  --bs-link-hover-color:  #a88420;
}

/* ── Base ────────────────────────────────────────────────────── */
body {
  font-family: 'Segoe UI', sans-serif;
  background-color: var(--offwhite);
}

/* ── Bootstrap: botões primários ─────────────────────────────── */
.btn-primary {
  --bs-btn-bg:                #C9A227;
  --bs-btn-border-color:      #C9A227;
  --bs-btn-color:             #111111;
  --bs-btn-hover-bg:          #a88420;
  --bs-btn-hover-border-color:#a88420;
  --bs-btn-hover-color:       #111111;
  --bs-btn-focus-shadow-rgb:  201, 162, 39;
  --bs-btn-active-bg:         #a88420;
  --bs-btn-active-border-color:#a88420;
  --bs-btn-active-color:      #111111;
  --bs-btn-disabled-bg:       #C9A227;
  --bs-btn-disabled-border-color:#C9A227;
  font-weight: 600;
}

.btn-outline-primary {
  --bs-btn-color:             #C9A227;
  --bs-btn-border-color:      #C9A227;
  --bs-btn-hover-bg:          #C9A227;
  --bs-btn-hover-border-color:#C9A227;
  --bs-btn-hover-color:       #111111;
  --bs-btn-focus-shadow-rgb:  201, 162, 39;
  --bs-btn-active-bg:         #C9A227;
  --bs-btn-active-border-color:#C9A227;
  --bs-btn-active-color:      #111111;
}

/* ── Bootstrap: sucesso ──────────────────────────────────────── */
.btn-success {
  --bs-btn-bg:                #1E8E5A;
  --bs-btn-border-color:      #1E8E5A;
  --bs-btn-color:             #fff;
  --bs-btn-hover-bg:          #177a4d;
  --bs-btn-hover-border-color:#177a4d;
  --bs-btn-hover-color:       #fff;
}

.btn-outline-success {
  --bs-btn-color:             #1E8E5A;
  --bs-btn-border-color:      #1E8E5A;
  --bs-btn-hover-bg:          #1E8E5A;
  --bs-btn-hover-border-color:#1E8E5A;
  --bs-btn-hover-color:       #fff;
}

/* ── Bootstrap: utilitários de cor ──────────────────────────── */
.text-primary   { color: #C9A227 !important; }
.bg-primary     { background-color: #C9A227 !important; color: #111111 !important; }
.border-primary { border-color: #C9A227 !important; }

.text-success   { color: #1E8E5A !important; }
.bg-success     { background-color: #1E8E5A !important; }

.badge.bg-primary { color: #111111 !important; }

/* ── Bootstrap: links ────────────────────────────────────────── */
a { color: #C9A227; }
a:hover { color: #a88420; }

/* ── Bootstrap: progress bar ────────────────────────────────── */
.progress-bar { background-color: #C9A227; }
.progress-bar.bg-success { background-color: #1E8E5A !important; }
.progress-bar.bg-warning { background-color: #C9A227 !important; }
.progress-bar.bg-danger  { background-color: #c0392b !important; }

/* ── Bootstrap: inputs focus ─────────────────────────────────── */
.form-control:focus,
.form-select:focus {
  border-color: #C9A227;
  box-shadow: 0 0 0 0.2rem rgba(201,162,39,.2);
}
.form-check-input:checked {
  background-color: #C9A227;
  border-color: #C9A227;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
#sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  transition: width var(--transition);
  overflow: hidden;
  z-index: 1040;
}
#sidebar.collapsed { width: var(--sidebar-w-col); }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  min-height: 60px;
  flex-shrink: 0;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #C9A227;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
}
.sidebar-brand i { font-size: 1.25rem; flex-shrink: 0; }

#sidebar-toggle {
  background: none;
  border: none;
  color: rgba(255,255,255,.5);
  padding: 0.25rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: color var(--transition);
  line-height: 1;
}
#sidebar-toggle:hover { color: #C9A227; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 0;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
  border-left: 3px solid transparent;
}
.sidebar-link i { font-size: 1.1rem; flex-shrink: 0; width: 1.5rem; text-align: center; }
.sidebar-link:hover  {
  background: var(--sidebar-hover);
  color: #fff;
  border-left-color: rgba(201,162,39,.4);
}
.sidebar-link.active {
  background: var(--sidebar-active);
  color: #C9A227;
  font-weight: 600;
  border-left-color: #C9A227;
}

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.1);
  padding: 0.5rem 0;
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  color: rgba(255,255,255,.6);
  font-size: 0.85rem;
  white-space: nowrap;
}
.sidebar-user i { font-size: 1.1rem; flex-shrink: 0; width: 1.5rem; text-align: center; }

#sidebar.collapsed .sidebar-text { display: none; }
#sidebar.collapsed .sidebar-header { justify-content: center; padding: 1rem 0; }
#sidebar.collapsed .sidebar-brand  { display: none; }
#sidebar.collapsed #sidebar-toggle { margin: 0 auto; }
#sidebar.collapsed .sidebar-link   { justify-content: center; padding: 0.65rem 0; border-left: none; }
#sidebar.collapsed .sidebar-user   { justify-content: center; padding: 0.5rem 0; }

/* ── Conteúdo principal ──────────────────────────────────────── */
#main-content {
  margin-left: var(--sidebar-w);
  transition: margin-left var(--transition);
  min-height: 100vh;
}
#main-content.collapsed { margin-left: var(--sidebar-w-col); }

.content-inner { padding: 1.5rem 1.75rem; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  border: none;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
  background-color: #fff;
}

/* ── Navbar (telas públicas) ─────────────────────────────────── */
.navbar { border-bottom: 1px solid rgba(15,61,74,.12); background: #fff !important; }

/* ── Tabelas ─────────────────────────────────────────────────── */
.table th {
  background-color: rgba(15,61,74,.07);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #0F3D4A;
}

.table-scroll {
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}
.table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background-color: rgba(15,61,74,.07);
  box-shadow: inset 0 -1px 0 rgba(15,61,74,.15);
}

/* ── Utilitários ─────────────────────────────────────────────── */
.cursor-pointer { cursor: pointer; }
.month-selector select { min-width: 130px; }

/* ── Contas hierárquicas (DRE) ───────────────────────────────── */
.conta-nivel-1 { background-color: rgba(15,61,74,.08); }
.conta-tipo-bold { font-weight: 700; }

/* Zebra */
.table-zebra tbody tr:nth-child(even) { --bs-table-bg: rgba(247,244,236,.6); }
.table-zebra tbody tr.conta-nivel-1   { --bs-table-bg: rgba(15,61,74,.08); }
.table-zebra tbody tr.row-active      { --bs-table-bg: rgba(201,162,39,.12); }

/* ── Inputs de valor ─────────────────────────────────────────── */
.valor-input {
  text-align: right;
  max-width: 180px;
}

.dre-table .valor-input {
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  padding: 0;
  width: 100%;
  max-width: 100%;
  color: inherit;
  font-weight: inherit;
  font-size: inherit;
}
.dre-table .valor-input:hover {
  background: #fff;
  border-color: rgba(201,162,39,.4);
  border-radius: 0.2rem;
  padding: 0 4px;
}
.dre-table .valor-input:focus {
  background: #fff;
  border-color: #C9A227;
  border-radius: 0.2rem;
  box-shadow: 0 0 0 0.2rem rgba(201,162,39,.2);
  outline: 0;
  padding: 0 4px;
}
