@charset "UTF-8";

:root {
  --brand: #102f2b;
  --brand-2: #0b211e;
  --accent: #2f9e44;
  --accent-dark: #227a35;
  --bg: #f4f6f8;
  --border: #e6e9ec;
  --text: #1c2430;
  --text-muted: #6b7684;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 20px rgba(16, 24, 40, .07);
  --sidebar-w: 264px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

a {
  color: var(--brand);
}

h1, h2, h3, h4, h5, .fw-bold, .fw-semibold {
  letter-spacing: -.01em;
}

/* ---------- Shell / sidebar ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(190deg, var(--brand), var(--brand-2) 75%);
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  z-index: 1030;
  transition: transform .25s ease, width .25s cubic-bezier(0.2, 0, 0, 1), padding .25s ease;
  overflow-y: auto;
}

.app-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.app-sidebar-brand {
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.app-sidebar-brand .text-accent {
  color: var(--accent);
}

.sidebar-collapse-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ffffff;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
}
.sidebar-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}
.sidebar-collapse-btn .collapse-icon {
  display: inline-flex;
  transition: transform 0.25s ease;
}

.app-sidebar-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, .45);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 22px;
}

/* Modo Recolhido no Desktop (> 992px) */
@media (min-width: 992px) {
  .app-content {
    transition: margin-left .25s cubic-bezier(0.2, 0, 0, 1);
  }
  .app-shell.sidebar-collapsed .app-sidebar,
  html.sidebar-collapsed-pref .app-sidebar {
    width: 72px;
    padding: 20px 10px;
  }
  .app-shell.sidebar-collapsed .app-content,
  html.sidebar-collapsed-pref .app-content {
    margin-left: 72px;
  }
  .app-shell.sidebar-collapsed .app-sidebar-sub,
  .app-shell.sidebar-collapsed .app-sidebar-brand span.brand-text,
  .app-shell.sidebar-collapsed .app-user-info,
  .app-shell.sidebar-collapsed .app-nav-link span:not(.app-nav-icon),
  html.sidebar-collapsed-pref .app-sidebar-sub,
  html.sidebar-collapsed-pref .app-sidebar-brand span.brand-text,
  html.sidebar-collapsed-pref .app-user-info,
  html.sidebar-collapsed-pref .app-nav-link span:not(.app-nav-icon) {
    display: none !important;
  }
  .app-shell.sidebar-collapsed .app-sidebar-header,
  html.sidebar-collapsed-pref .app-sidebar-header {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
  }
  .app-shell.sidebar-collapsed .app-nav-section,
  html.sidebar-collapsed-pref .app-nav-section {
    text-indent: -9999px;
    height: 1px;
    margin: 10px 4px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
  }
  .app-shell.sidebar-collapsed .app-nav-link,
  html.sidebar-collapsed-pref .app-nav-link {
    justify-content: center;
    padding: 10px 0;
  }
  .app-shell.sidebar-collapsed .app-avatar,
  html.sidebar-collapsed-pref .app-avatar {
    margin: 0 auto;
  }
}

.app-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.app-nav-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255, 255, 255, .35);
  margin: 18px 12px 6px;
}

.app-nav-section:first-child {
  margin-top: 0;
}

.app-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: rgba(255, 255, 255, .78);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.app-nav-link:hover {
  background: rgba(255, 255, 255, .08);
  color: #fff;
}

.app-nav-link.active {
  background: rgba(255, 255, 255, .16);
  color: #fff;
  font-weight: 600;
}

.app-nav-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.app-nav-icon svg {
  width: 100%;
  height: 100%;
}

.app-sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, .12);
}

.app-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  font-size: 14px;
}

.app-user-info {
  min-width: 0;
}

.app-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-user-logout {
  font-size: 12px;
  color: rgba(255, 255, 255, .6);
  text-decoration: none;
}

.app-user-logout:hover {
  color: #fff;
}

.app-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 28px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1010;
}

.app-topbar-title {
  font-size: 19px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}

.app-main {
  padding: 28px;
  flex: 1;
}

.sidebar-toggle-inline,
.sidebar-toggle,
.topbar-back {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  flex-shrink: 0;
  text-decoration: none;
  transition: background .15s, color .15s;
}

.sidebar-toggle-inline:hover,
.sidebar-toggle:hover,
.topbar-back:hover {
  background: rgba(0, 0, 0, .05);
}

.sidebar-toggle svg,
.topbar-back svg {
  width: 18px;
  height: 18px;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 18, .5);
  z-index: 1020;
}

.sidebar-backdrop.is-open {
  display: block;
}

@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
  }

  .app-sidebar.is-open {
    transform: none;
  }

  .app-content {
    margin-left: 0;
  }

  .app-topbar {
    padding: 14px 16px;
  }

  .app-main {
    padding: 18px 16px 32px;
  }
}

@media (min-width: 992px) {
  .sidebar-toggle-inline {
    display: none;
  }
}

/* ---------- Cards / componentes ---------- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.stat-card .stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}

.stat-card .stat-value {
  font-size: 24px;
  font-weight: 700;
  margin-top: 4px;
}

.btn {
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
}

.btn svg {
  width: 16px;
  height: 16px;
  vertical-align: -3px;
  margin-right: 2px;
}

.btn-brand,
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn-brand:hover,
.btn-primary:hover,
.btn-brand:focus,
.btn-primary:focus {
  background: var(--brand-2);
  border-color: var(--brand-2);
  color: #fff;
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-accent:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
}

.btn-outline-secondary {
  border-color: var(--border);
  color: var(--text);
}

.form-control,
.form-select {
  border-radius: 10px;
  border-color: var(--border);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 .2rem rgba(47, 158, 68, .15);
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.table {
  --bs-table-bg: transparent;
}

.table thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom-width: 1px;
  background: #fafbfc;
}

.card-header {
  border-bottom: 1px solid var(--border);
  background: #fff;
  font-weight: 700;
  border-top-left-radius: var(--radius) !important;
  border-top-right-radius: var(--radius) !important;
}

.badge {
  font-weight: 600;
  border-radius: 999px;
  padding: 5px 10px;
}

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

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

/* ---------- iframe de salvar (oculto) ---------- */
.save-frame {
  display: none;
}

.form-error-box {
  display: none;
}

.form-error-box.is-visible {
  display: block;
}

/* ---------- Cards do catálogo (hub) ---------- */
.hub-system-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.hub-system-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(16, 47, 43, .12);
  border-color: var(--accent);
}

.hub-system-icon {
  width: 44px;
  height: 44px;
  color: var(--brand);
}

.hub-system-icon svg {
  width: 100%;
  height: 100%;
}

.hub-system-cta {
  color: var(--brand);
  letter-spacing: .04em;
}

/* ---------- Desktop: pastas por empresa ---------- */
.folder-card-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.folder-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--ink, #1c2b28);
  padding: 16px 8px 10px;
  border-radius: var(--radius);
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  transition: background-color .15s, transform .15s, box-shadow .15s;
}

.folder-card:hover {
  background-color: #fff;
  color: var(--brand);
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(16, 47, 43, .1);
}

.folder-icon {
  width: 44px;
  height: 44px;
}

.folder-label {
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  word-break: break-word;
  line-height: 1.25;
}

.folder-count {
  font-size: 11px;
  color: #868e96;
}

.folder-actions {
  display: flex;
  gap: 10px;
  font-size: 11px;
  margin-top: 6px;
}

.folder-actions a,
.folder-actions .btn-link {
  text-decoration: none;
  font-size: 11px;
}

/* ---------- Desktop: quadro de notas de uma empresa ---------- */
.notes-grid {
  column-count: 1;
  column-gap: 16px;
}

@media (min-width: 576px) {
  .notes-grid {
    column-count: 2;
  }
}

@media (min-width: 992px) {
  .notes-grid {
    column-count: 3;
  }
}

.note-card {
  break-inside: avoid;
  margin-bottom: 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(0, 0, 0, .08);
  padding: 16px;
}

.note-card .note-title {
  font-weight: 600;
  margin-bottom: 8px;
}

.note-card .note-body {
  white-space: pre-wrap;
  font-size: 14px;
  color: #333;
}

.note-card .note-field {
  font-size: 13px;
  margin-bottom: 4px;
}

.password-display {
  font-family: monospace;
  letter-spacing: .04em;
}

/* ---------- Desktop: busca nas notas ---------- */
.note-search {
  position: relative;
  max-width: 460px;
}

.note-search .form-control {
  padding-left: 40px;
}

.note-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #868e96;
  pointer-events: none;
}

.note-search-icon svg {
  width: 100%;
  height: 100%;
}

/* ---------- Ícone inline pequeno (dentro de texto, fora de botão/nav) ---------- */
.icon-inline {
  display: inline-flex;
  width: 16px;
  height: 16px;
  vertical-align: -3px;
  margin-right: 2px;
}

.icon-inline svg {
  width: 100%;
  height: 100%;
}

/* ---------- Aplicativo no celular (barra de abas, cartões, botão +) ---------- */
/* ---------- Menu no Celular: Exclusivamente na Barra Lateral (Offcanvas pelos Três Traços) ---------- */
.app-tabbar, .app-tabbar-wrapper, .fab { display: none !important; }

@media (max-width: 991.98px) {
  /* Botão dos Três Traços (Hambúrguer) no Topo do Celular */
  .sidebar-toggle-inline {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .sidebar-toggle-inline:active {
    background: rgba(0, 0, 0, 0.08);
    transform: scale(0.95);
  }
  body.theme-dark .sidebar-toggle-inline:active {
    background: rgba(255, 255, 255, 0.1);
  }

  /* Barra Lateral Offcanvas que desliza no celular */
  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    z-index: 1050;
    transform: translateX(-100%);
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.35);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .app-sidebar.is-open {
    transform: none;
  }
  .sidebar-backdrop {
    z-index: 1040;
  }

  .app-topbar {
    position: sticky;
    top: 0;
    z-index: 1010;
    padding: 10px 14px;
    padding-top: calc(10px + env(safe-area-inset-top));
    gap: 8px;
  }
  .app-topbar-title {
    font-size: 16px !important;
    font-weight: 700;
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .app-topbar .theme-toggle-btn {
    padding: 6px 10px !important;
    font-size: 12.5px !important;
    border-radius: 8px !important;
  }
  .app-main {
    padding: 16px 14px 28px !important;
  }

  .fab {
    display: inline-flex; align-items: center; justify-content: center;
    position: fixed; right: 16px; bottom: calc(82px + env(safe-area-inset-bottom));
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--accent); color: #fff; z-index: 1014;
    box-shadow: 0 8px 20px rgba(47, 158, 68, .4);
    text-decoration: none;
  }
  .fab svg { width: 24px; height: 24px; }

  .btn { min-height: 40px; }
  .form-control, .form-select { min-height: 46px; font-size: 16px; }
  .page-header { flex-wrap: wrap; gap: 10px; }
  .account-switcher strong { min-width: 0 !important; flex: 1; }

  .stats-strip {
    flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x mandatory;
    margin-left: -16px; margin-right: -16px; padding: 0 16px 6px;
  }
  .stats-strip > * { flex: 0 0 72%; max-width: 72%; scroll-snap-align: start; }

  .cards-wrap { background: transparent; border: 0; box-shadow: none; }
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody { display: block; }
  .table-cards tr {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow-sm);
  }
  .table-cards td { display: block; border: 0; padding: 0; background: none; }
  .table-cards .td-desc { order: 1; flex: 1 1 55%; font-weight: 500; }
  .table-cards .td-val { order: 2; margin-left: auto; font-size: 1.05rem; text-align: right; }
  .table-cards .td-date { order: 3; }
  .table-cards .td-cat, .table-cards .td-card { order: 4; }
  .table-cards .td-status { order: 5; margin-left: auto; }
  .table-cards .td-actions { order: 9; flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 6px; padding-top: 8px; margin-top: 4px; border-top: 1px solid var(--border); }
  .table-cards .td-actions form { display: inline-block; }
  .table-cards td[colspan] { flex: 1 0 100%; }
}
@media (max-width: 767.98px) {
  .app-tab-label { white-space: nowrap; font-size: 10.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
}

@media (max-width: 767.98px) {
  .page-header > div { width: 100%; justify-content: center; }
  .app-main > .d-flex.justify-content-between { justify-content: center !important; }
  .app-main > .btn-group { display: flex; width: fit-content; margin-left: auto; margin-right: auto; }
  .app-main > .btn-group .btn { padding-left: 14px; padding-right: 14px; }

  .stats-strip > * { flex: 0 0 44%; max-width: 44%; }
  .stats-strip .card-body { padding: 10px 12px; }
  .stats-strip .stat-label { font-size: 10px; }
  .stats-strip .stat-value { font-size: 17px; margin-top: 2px; }
  .stats-strip .card-body .small { font-size: 11px; }
}

/* ---------- Formulário de categoria ---------- */
.cat-form-card { max-width: 520px; overflow: hidden; }
.cat-preview { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; background: #f8faf9; border-bottom: 1px solid var(--border); }
.cat-preview-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #868e96; font-weight: 600; }
.cat-preview-badge { font-size: 14px; padding: 8px 14px; border-radius: 999px; transition: background-color .15s; }
.cat-type-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cat-type-opt { text-align: center; padding: 12px; border: 1.5px solid var(--border); border-radius: 12px; font-weight: 600; cursor: pointer; color: #868e96; transition: all .15s; }
.btn-check:checked + .cat-type-saida { border-color: #e03131; background: rgba(224, 49, 49, .08); color: #e03131; }
.btn-check:checked + .cat-type-entrada { border-color: var(--accent); background: rgba(47, 158, 68, .1); color: var(--accent); }
.cat-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.cat-swatch { width: 38px; height: 38px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--border); cursor: pointer; padding: 0; transition: transform .12s; }
.cat-swatch:hover { transform: scale(1.1); }
.cat-swatch.is-active { box-shadow: 0 0 0 2px var(--brand); }
.cat-swatch-custom { position: relative; display: inline-flex; align-items: center; justify-content: center; background: #fff; color: #868e96; font-weight: 700; overflow: hidden; }
.cat-swatch-custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

/* ---------- Barra de controles dos Lançamentos ---------- */
.toolbar-card { padding: 14px 16px; margin-bottom: 18px; display: flex; flex-direction: column; gap: 14px; }
.toolbar-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.toolbar-filters { padding-top: 12px; border-top: 1px solid var(--border); }
.seg { display: inline-flex; background: #eef1f0; border-radius: 12px; padding: 3px; gap: 2px; }
.seg-opt { padding: 7px 16px; border-radius: 9px; font-size: 14px; font-weight: 600; color: #6b7775; text-decoration: none; transition: all .15s; white-space: nowrap; }
.seg-opt:hover { color: var(--brand); }
.seg-opt.is-active { background: var(--brand); color: #fff; box-shadow: 0 2px 6px rgba(16, 47, 43, .25); }
.seg-sm .seg-opt { padding: 5px 13px; font-size: 13px; }
.period-nav { display: inline-flex; align-items: center; gap: 8px; }
.period-label { font-weight: 700; min-width: 140px; text-align: center; }
.period-today { font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: none; padding: 4px 8px; }
.nav-circle { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: #fff; color: var(--brand); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; transition: background .15s; }
.nav-circle:hover { background: #eef1f0; }
.nav-circle svg { width: 16px; height: 16px; }
.acct-switch { display: flex; align-items: center; justify-content: center; gap: 12px; }
.acct-pill { background: rgba(47, 158, 68, .1); color: var(--brand); font-weight: 700; padding: 8px 20px; border-radius: 999px; text-align: center; min-width: 120px; }
.acct-sub { font-weight: 500; color: #6b7775; font-size: 13px; }

@media (max-width: 767.98px) {
  .toolbar-row { justify-content: center; }
  .seg { width: 100%; }
  .seg-opt { flex: 1; text-align: center; padding-left: 8px; padding-right: 8px; }
  .toolbar-filters { flex-direction: column; align-items: stretch; }
  .period-label { min-width: 0; flex: 1; }
  .period-nav { width: 100%; justify-content: space-between; }
}

/* ---------- Lista de categorias ---------- */
.cat-panel { overflow: hidden; }
.cat-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; font-weight: 700; border-bottom: 1px solid var(--border); background: #f8faf9; }
.cat-head-saida { color: #e03131; }
.cat-head-entrada { color: var(--accent); }
.cat-count { background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 1px 10px; font-size: 12px; color: #6b7775; }
.cat-list { padding: 6px 10px 10px; }
.cat-row { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-bottom: 1px solid #f0f2f1; }
.cat-row:last-child { border-bottom: 0; }
.cat-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.cat-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cat-actions { display: flex; gap: 6px; flex-shrink: 0; }
.cat-empty { padding: 22px 10px; text-align: center; color: #868e96; font-size: 14px; }
.pm-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; font-weight: 600; font-size: 14px; background: #fff; }
.pm-chip-note { font-weight: 500; font-size: 11px; color: #868e96; }

/* ---------- Pesquisa e ordenação da lista ---------- */
.list-tools { display: flex; gap: 10px; margin-bottom: 12px; }
.list-search { position: relative; flex: 1; }
.list-search .form-control { padding-left: 40px; }
.list-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: #868e96; pointer-events: none; }
.list-search-icon svg { width: 100%; height: 100%; }
.list-tools .form-select { max-width: 190px; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--brand); }
th.sortable::after { content: ' ↕'; color: #ced4da; font-size: 11px; }
th.sortable.sort-asc::after { content: ' ▲'; color: var(--accent); }
th.sortable.sort-desc::after { content: ' ▼'; color: var(--accent); }


/* ==========================================================================
   TEMA ESCURO GLOBAL (DARK MODE) PARA TODOS OS SISTEMAS DO HUB
   ========================================================================== */
[data-theme="dark"],
html[data-bs-theme="dark"],
body.theme-dark {
  --bg: #0b1120;
  --bg-card: #1e293b;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --brand: #22c55e;
  --brand-2: #16a34a;
  background-color: #0b1120 !important;
  color: #f1f5f9 !important;
}

body.theme-dark .app-content,
body.theme-dark .app-main,
body.theme-dark .app-shell {
  background-color: #0b1120 !important;
  color: #f1f5f9 !important;
}

body.theme-dark .app-topbar {
  background: rgba(15, 23, 42, 0.92) !important;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #334155 !important;
  color: #f1f5f9 !important;
}

body.theme-dark .app-topbar-title {
  color: #f8fafc !important;
}

body.theme-dark .sidebar-toggle-inline,
body.theme-dark .sidebar-toggle,
body.theme-dark .topbar-back {
  border-color: #334155 !important;
  color: #f1f5f9 !important;
  background: #1e293b !important;
}

body.theme-dark .sidebar-toggle-inline:hover,
body.theme-dark .sidebar-toggle:hover,
body.theme-dark .topbar-back:hover {
  background: #334155 !important;
  color: #4ade80 !important;
}

body.theme-dark .app-sidebar {
  background: #0f172a !important;
  border-right: 1px solid #334155 !important;
}

body.theme-dark .app-nav-link {
  color: #cbd5e1 !important;
}
body.theme-dark .app-nav-link:hover,
body.theme-dark .app-nav-link.active {
  background: #1e293b !important;
  color: #4ade80 !important;
}

body.theme-dark .card,
body.theme-dark .hub-system-card,
body.theme-dark .modal-content,
body.theme-dark .foco-header-card,
body.theme-dark .cal-container {
  background-color: #1e293b !important;
  color: #f1f5f9 !important;
  border-color: #334155 !important;
}

body.theme-dark .card-header {
  background-color: #0f172a !important;
  border-bottom-color: #334155 !important;
  color: #f8fafc !important;
}

body.theme-dark .modal-header,
body.theme-dark .modal-footer {
  border-color: #334155 !important;
}

body.theme-dark .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

/* Tabelas no Modo Escuro (Financeiro, Usuários, Cartões) */
body.theme-dark .table {
  --bs-table-bg: transparent !important;
  --bs-table-color: #f1f5f9 !important;
  --bs-table-border-color: #334155 !important;
  --bs-table-hover-bg: rgba(255, 255, 255, 0.04) !important;
  --bs-table-hover-color: #ffffff !important;
  color: #f1f5f9 !important;
}

body.theme-dark .table thead th {
  background: #0f172a !important;
  color: #94a3b8 !important;
  border-bottom-color: #334155 !important;
}

body.theme-dark .table tbody td,
body.theme-dark .table tbody th {
  border-color: #334155 !important;
  color: #e2e8f0;
}

body.theme-dark .table-light,
body.theme-dark .table-light > td,
body.theme-dark .table-light > th {
  --bs-table-bg: #162032 !important;
  background-color: #162032 !important;
  color: #f1f5f9 !important;
  border-color: #334155 !important;
}

body.theme-dark .tr-secao-divisor td {
  background: #0f172a !important;
  border-top-color: #334155 !important;
  border-bottom-color: #334155 !important;
  color: #f8fafc !important;
}

/* Cartões Mobile (.table-cards) e Barra Inferior (.app-tabbar) no Modo Escuro */
@media (max-width: 767.98px) {
  body.theme-dark .cards-wrap {
    background: transparent !important;
  }
  body.theme-dark .table-cards tr {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
  }
  body.theme-dark .table-cards .td-actions {
    border-top-color: #334155 !important;
  }}

/* Desktop (Pastas de Empresas e Quadro de Notas) no Modo Escuro */
body.theme-dark .folder-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

body.theme-dark .folder-card:hover {
  background: #26354d !important;
  border-color: #4ade80 !important;
  color: #4ade80 !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35) !important;
}

body.theme-dark .folder-count {
  color: #94a3b8 !important;
}

body.theme-dark .note-card {
  /* Sobreposição escura translúcida sobre a cor pastel da nota para preservar a cor com leitura nítida */
  background-image: linear-gradient(rgba(15, 23, 42, 0.82), rgba(15, 23, 42, 0.86)) !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  color: #f1f5f9 !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.32);
}

body.theme-dark .note-card .note-title {
  color: #ffffff !important;
}

body.theme-dark .note-card .note-body,
body.theme-dark .note-card .note-field,
body.theme-dark .note-card .password-display {
  color: #e2e8f0 !important;
}

body.theme-dark .note-card .text-muted {
  color: #cbd5e1 !important;
}

/* Financeiro (Filtros, Segmented Controls, Categorias e Pagamentos) no Modo Escuro */
body.theme-dark .seg {
  background: #0f172a !important;
  border: 1px solid #334155;
}

body.theme-dark .seg-opt {
  color: #94a3b8 !important;
}

body.theme-dark .seg-opt:hover {
  color: #f8fafc !important;
}

body.theme-dark .seg-opt.is-active {
  background: #22c55e !important;
  color: #052e16 !important;
  font-weight: 700;
}

body.theme-dark .nav-circle {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

body.theme-dark .nav-circle:hover {
  background: #334155 !important;
}

body.theme-dark .acct-pill {
  background: rgba(34, 197, 94, 0.16) !important;
  color: #4ade80 !important;
}

body.theme-dark .acct-sub {
  color: #94a3b8 !important;
}

body.theme-dark .cat-preview,
body.theme-dark .cat-panel-head {
  background: #0f172a !important;
  border-bottom-color: #334155 !important;
  color: #f1f5f9 !important;
}

body.theme-dark .cat-count,
body.theme-dark .pm-chip {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

body.theme-dark .cat-row {
  border-bottom-color: #334155 !important;
}

body.theme-dark .cat-type-opt {
  border-color: #334155 !important;
  color: #94a3b8 !important;
}

body.theme-dark .cat-swatch {
  border-color: #1e293b !important;
}

body.theme-dark .cat-swatch-custom {
  background: #0f172a !important;
  color: #e2e8f0 !important;
}

/* Utilitários Gerais Bootstrap e Blocos de Foco em Modo Noite */
body.theme-dark .week-column {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}
body.theme-dark .week-column.is-today {
  background: rgba(34, 197, 94, 0.12) !important;
  border-color: #22c55e !important;
}
body.theme-dark .week-col-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
body.theme-dark .week-col-title {
  color: #f8fafc !important;
  font-weight: 800 !important;
}
body.theme-dark .week-column.is-today .week-col-title {
  color: #86efac !important;
}
body.theme-dark .week-col-count {
  color: #94a3b8 !important;
}
body.theme-dark .cal-weekdays {
  background: #0f172a !important;
  border-bottom-color: #334155 !important;
  color: #cbd5e1 !important;
}
body.theme-dark .text-dark,
body.theme-dark h1, body.theme-dark h2, body.theme-dark h3, body.theme-dark h4, body.theme-dark h5, body.theme-dark h6 {
  color: #f1f5f9 !important;
}

body.theme-dark .text-muted,
body.theme-dark .text-secondary {
  color: #94a3b8 !important;
}

body.theme-dark .bg-light,
body.theme-dark .bg-white {
  background-color: #0f172a !important;
  color: #f1f5f9 !important;
}

body.theme-dark .badge.bg-light,
body.theme-dark .badge.text-dark {
  background-color: #0f172a !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}

body.theme-dark .border,
body.theme-dark .border-top,
body.theme-dark .border-bottom,
body.theme-dark .border-start,
body.theme-dark .border-end {
  border-color: #334155 !important;
}

body.theme-dark .form-control,
body.theme-dark .form-select {
  background-color: #0f172a !important;
  color: #f1f5f9 !important;
  border-color: #334155 !important;
}

body.theme-dark .form-control::placeholder {
  color: #64748b !important;
}

body.theme-dark .btn-light,
body.theme-dark .btn-outline-secondary {
  background-color: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

body.theme-dark .btn-light:hover,
body.theme-dark .btn-outline-secondary:hover {
  background-color: #334155;
  border-color: #475569;
  color: #ffffff;
}

body.theme-dark .btn-outline-primary {
  color: #60a5fa;
  border-color: #3b82f6;
}

body.theme-dark .btn-outline-primary:hover {
  background-color: #2563eb;
  color: #ffffff;
}

body.theme-dark .hub-system-icon,
body.theme-dark .hub-system-cta {
  color: #4ade80 !important;
}

/* Correções Profundas de Cores e Alto Contraste (Modo Noite vs Modo Dia) */
body.theme-dark,
:root[data-theme="dark"],
:root[data-bs-theme="dark"] {
  --bg: #090d16;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;
  background-color: #090d16;
  color: #f8fafc;
}

body.theme-dark input,
body.theme-dark select,
body.theme-dark textarea,
body.theme-dark .form-control,
body.theme-dark .form-select {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

body.theme-dark input:focus,
body.theme-dark select:focus,
body.theme-dark textarea:focus,
body.theme-dark .form-control:focus,
body.theme-dark .form-select:focus {
  background-color: #141e33 !important;
  color: #ffffff !important;
  border-color: #22c55e !important;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25) !important;
}

body.theme-dark select option {
  background-color: #0f172a !important;
  color: #f8fafc !important;
}

body.theme-dark .dropdown-menu {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5) !important;
}

body.theme-dark .dropdown-item {
  color: #cbd5e1 !important;
}

body.theme-dark .dropdown-item:hover,
body.theme-dark .dropdown-item:focus {
  background-color: #334155 !important;
  color: #ffffff !important;
}

body.theme-dark .dropdown-divider {
  border-top-color: #334155 !important;
}

body.theme-dark .alert-info {
  background-color: rgba(37, 99, 235, 0.16) !important;
  border-color: rgba(37, 99, 235, 0.35) !important;
  color: #93c5fd !important;
}

body.theme-dark .alert-success {
  background-color: rgba(34, 197, 94, 0.16) !important;
  border-color: rgba(34, 197, 94, 0.35) !important;
  color: #86efac !important;
}

body.theme-dark .alert-danger,
body.theme-dark .alert-error {
  background-color: rgba(239, 68, 68, 0.16) !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
  color: #fca5a5 !important;
}

body.theme-dark .alert-warning {
  background-color: rgba(245, 158, 11, 0.16) !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
  color: #fde68a !important;
}

/* Modo Dia (Alto Contraste e Suavidade) */
body.theme-light,
:root[data-theme="light"],
:root[data-bs-theme="light"] {
  --bg: #f8fafc;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  background-color: #f8fafc;
  color: #0f172a;
}

/* Botão de Tema na Topbar */
.theme-toggle-btn {
  margin-left: auto;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: var(--text);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.theme-toggle-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}
body.theme-dark .theme-toggle-btn {
  background: #1e293b;
  border-color: #475569;
  color: #f1f5f9;
}
body.theme-dark .theme-toggle-btn:hover {
  background: #334155;
}
