.ui-icon,
.nav-icon {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.ui-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  color: #8fd5b8;
  transition: color .18s, transform .18s;
}

.sidebar-nav a:hover .nav-icon,
.sidebar-nav a.active .nav-icon {
  color: #c4f5df;
  transform: scale(1.06);
}

.icon-button {
  display: grid;
  place-items: center;
  transition: background .18s, color .18s, transform .18s;
}

.icon-button:hover {
  background: #dfeae5;
  color: var(--brand);
}

.icon-button:active {
  transform: scale(.94);
}

.icon-button .ui-icon {
  width: 20px;
  height: 20px;
}

.button .ui-icon {
  transition: transform .18s;
}

.button:hover .ui-icon {
  transform: translateY(-1px);
}

.sidebar-collapsed .sidebar-nav a {
  font-size: 0;
}

.sidebar-collapsed .sidebar-nav .nav-icon {
  width: 21px;
  height: 21px;
}

.compact-field {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: .78rem;
  white-space: nowrap;
}

.compact-field input {
  width: 145px;
}

.line-items-header,
.line-item {
  display: flex;
  align-items: end;
  gap: 10px;
}

.line-items-header {
  align-items: center;
  justify-content: space-between;
  margin: 12px 0 2px;
}

.line-item {
  border-top: 1px solid var(--line);
}

.line-item .field {
  flex: 1;
}

.line-item .quantity {
  max-width: 120px;
}

.line-item > .button {
  margin-bottom: 17px;
}

.integration-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 14px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--muted);
  font-size: .82rem;
}

.integration-state strong {
  color: var(--ink);
}

.integration-state.enabled {
  border-color: #a9ddc5;
  background: #eefaf4;
}

.integration-state.disabled {
  border-color: #ead9aa;
  background: #fffaf0;
}

.ticket-thread {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.ticket-thread article {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8faf9;
}

.ticket-thread article p {
  margin: 7px 0 0;
  white-space: pre-wrap;
}

.check-list {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
}

.check-list label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.check-list span {
  display: grid;
  gap: 3px;
}

.check-list small {
  color: var(--muted);
}

.contract-preview {
  min-height: 380px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #202a27;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.65;
}

.settings-summary,
.site-preview {
  padding: 20px;
}

.site-hero {
  margin-bottom: 18px;
  padding: 28px;
  border-radius: 12px;
  background: linear-gradient(135deg, #18342d, #247854);
  color: #fff;
}

.site-hero h2 {
  margin: 0 0 8px;
}

.site-hero p:last-child {
  margin: 0;
  opacity: .8;
}

.compact-metrics {
  margin-bottom: 14px;
}

.compact-metrics .metric-card {
  grid-column: span 1;
}

.data-table a {
  color: var(--brand);
  font-weight: 750;
}

.modal-body .data-table {
  min-width: 620px;
}

.login-links {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  font-size: .82rem;
}

.login-links a {
  color: var(--brand);
  font-weight: 750;
  text-decoration: none;
}

/* Sidebar agrupado colapsável (accordion) — mesmo estilo/cores dos itens */
.side-group-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 3px 0;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  color: #dbe8e3;
  font: inherit;
  font-size: .89rem;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.side-group-toggle:hover {
  background: rgba(255, 255, 255, .11);
  color: #fff;
}

.side-group-toggle .nav-icon {
  color: #8fd5b8;
  transition: color .18s, transform .18s;
}

.side-group-toggle:hover .nav-icon,
.side-group.active-group > .side-group-toggle .nav-icon {
  color: #c4f5df;
}

.side-group.active-group > .side-group-toggle {
  color: #fff;
}

.side-group-label {
  flex: 1;
}

.nav-caret {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin-right: 3px;
  border-right: 2px solid #8faaa1;
  border-bottom: 2px solid #8faaa1;
  transform: rotate(-45deg);
  transition: transform .18s;
}

.side-group.open .nav-caret {
  transform: rotate(45deg);
}

.side-group-list {
  display: none;
  margin: 1px 0 6px;
  padding-left: 9px;
  border-left: 1px solid rgba(255, 255, 255, .09);
}

.side-group.open .side-group-list {
  display: block;
}

.side-group-list a {
  font-size: .84rem;
  padding: 8px 12px;
}

.sidebar-collapsed .side-group-label,
.sidebar-collapsed .nav-caret {
  font-size: 0;
  width: 0;
  border: 0;
}

.sidebar-collapsed .side-group-list {
  display: none;
}

.sidebar-collapsed .side-group-toggle {
  justify-content: center;
}

/* Navbar: saudação, sinos de contas vencidas e alternância de tema */
.topbar-greeting {
  color: var(--muted);
  font-size: .85rem;
  font-weight: 650;
  white-space: nowrap;
  margin-right: 4px;
}

.nav-bell {
  position: relative;
}

.bell-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: .62rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  line-height: 1;
}

/* Ícones de notificação diferenciados: receber (entrada, verde) x pagar (saída, âmbar) */
#bell-receivables .ui-icon {
  color: #15704a;
}

#bell-receivables .bell-badge {
  background: #15704a;
}

#bell-payables .ui-icon {
  color: #9a6700;
}

#bell-payables .bell-badge {
  background: var(--warning);
}

.bell-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  max-height: 380px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 60;
  padding: 4px;
}

.bell-menu header {
  padding: 10px 12px;
  font-weight: 800;
  color: var(--ink);
  font-size: .84rem;
  border-bottom: 1px solid var(--line);
}

.bell-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}

.bell-item strong {
  color: var(--ink);
  font-size: .82rem;
}

.bell-item span {
  color: var(--muted);
  font-size: .75rem;
}

.bell-empty {
  padding: 14px 12px;
  margin: 0;
  color: var(--muted);
  font-size: .8rem;
}

.bell-all {
  display: block;
  padding: 10px 12px;
  color: var(--brand);
  font-weight: 750;
  font-size: .82rem;
  text-decoration: none;
}

.bell-all:hover {
  text-decoration: underline;
}

#theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] #theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] #theme-toggle .icon-moon {
  display: none;
}

/* Tema escuro */
:root[data-theme="dark"] {
  --ink: #e7efeb;
  --muted: #93a8a0;
  --line: #2b3b35;
  --surface: #16211d;
  --brand: #57c596;
  --brand-dark: #3aa87b;
  --shadow: 0 12px 34px rgba(0, 0, 0, .5);
}

:root[data-theme="dark"] body {
  background: #0f1613;
  color: #e7efeb;
}

:root[data-theme="dark"] .topbar {
  background: rgba(18, 28, 24, .96);
}

:root[data-theme="dark"] .toolbar {
  background: #131e1a;
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] .field input,
:root[data-theme="dark"] .field select,
:root[data-theme="dark"] .field textarea,
:root[data-theme="dark"] .toolbar input,
:root[data-theme="dark"] .toolbar select,
:root[data-theme="dark"] .search {
  background: #0f1613;
  border-color: #2b3b35;
  color: var(--ink);
}

:root[data-theme="dark"] .data-table th {
  background: #12211b;
  color: #8fa69d;
}

:root[data-theme="dark"] .integration-state,
:root[data-theme="dark"] .ticket-thread article,
:root[data-theme="dark"] .contract-preview,
:root[data-theme="dark"] .check-list label {
  background: #131e1a;
  color: var(--ink);
}

/* ================= Visual mais vivo (conteúdo; sidebar e ícones do nav intactos) ================= */
.button {
  transition: transform .16s, box-shadow .16s, filter .16s, background .16s;
}

.button.primary {
  background: linear-gradient(135deg, #12b886 0%, #0e9f6e 55%, #0d9488 100%);
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(16, 159, 110, .26);
}

.button.primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 12px 26px rgba(16, 159, 110, .32);
}

.button.primary:active {
  transform: translateY(0);
}

/* Cards de indicadores com faixa de cor, leve tonalizado e elevação no hover */
.metric-grid .metric-card {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  transition: transform .18s, box-shadow .18s;
}

.metric-grid .metric-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent, #10b981);
}

.metric-grid .metric-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(130% 90% at 100% 0, color-mix(in srgb, var(--accent, #10b981) 13%, transparent), transparent 62%);
  pointer-events: none;
}

.metric-grid .metric-card > * {
  position: relative;
  z-index: 1;
}

.metric-grid .metric-card span {
  color: var(--accent, #0e9f6e);
  font-weight: 800;
}

.metric-grid .metric-card strong {
  font-size: 1.9rem;
}

.metric-grid .metric-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 34px rgba(26, 56, 46, .15);
}

.metric-grid .metric-card:nth-of-type(5n+1) { --accent: #10b981; }
.metric-grid .metric-card:nth-of-type(5n+2) { --accent: #0ea5e9; }
.metric-grid .metric-card:nth-of-type(5n+3) { --accent: #8b5cf6; }
.metric-grid .metric-card:nth-of-type(5n+4) { --accent: #f59e0b; }
.metric-grid .metric-card:nth-of-type(5n+5) { --accent: #ef4476; }
.metric-grid .metric-card.warn { --accent: #f59e0b; }

/* Tabelas com cabeçalho tonalizado e destaque de linha */
.data-table th {
  background: linear-gradient(180deg, #eef7f2, #e6f2eb);
  color: #15633f;
  border-bottom: 2px solid #d3e7dd;
}

.data-table tbody tr {
  transition: background .12s;
}

.data-table tbody tr:hover {
  background: #f1f9f5;
}

/* Foco vívido nos campos */
input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus,
.toolbar input:focus,
.toolbar select:focus,
.search:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .16);
}

.panel {
  border-radius: 16px;
}

/* Realces vivos no tema escuro */
:root[data-theme="dark"] .data-table th {
  background: linear-gradient(180deg, #17271f, #132019);
  color: #6fd6a6;
  border-bottom-color: #294036;
}

:root[data-theme="dark"] .data-table tbody tr:hover {
  background: #16241f;
}

:root[data-theme="dark"] .metric-grid .metric-card:hover {
  box-shadow: 0 16px 34px rgba(0, 0, 0, .5);
}

@media (max-width: 700px) {
  .sidebar-nav a {
    font-size: .89rem;
  }

  .compact-field {
    display: grid;
  }

  .compact-field input {
    width: 100%;
  }

  .line-item {
    align-items: stretch;
    flex-direction: column;
    padding: 8px 0 14px;
  }

  .line-item .quantity {
    max-width: none;
  }

  .line-item > .button {
    margin-bottom: 0;
  }

  .integration-state {
    align-items: flex-start;
    flex-direction: column;
  }

  .contract-preview {
    min-height: 280px;
    padding: 18px;
  }
}
