/* ════════════════════════════════════════════════
   HD Tax Hub — Componentes (Fase 1 · Fundação)
   PARTE 1 · COMPONENTES NOVOS (Sistema HD)
   ════════════════════════════════════════════════ */

/* ── Helpers tipográficos ── */
.kicker {
  font-family: var(--font-body);
  font-size: var(--fs-kicker);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--hd-blue);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.kicker::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--hd-orange);
  box-shadow: 0 0 0 3px rgba(250, 167, 74, 0.18);
}

.display {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-display);
  line-height: 1;
  letter-spacing: -0.035em;
  color: var(--ink);
  margin: 0 0 10px;
}
.display em {
  font-style: normal;
  font-weight: 700;
  color: var(--hd-red);
}

.sub {
  font-family: var(--font-italic);
  font-style: italic;
  font-size: var(--fs-sub);
  color: var(--ink-dim);
  line-height: 1.4;
  max-width: 520px;
  margin: 0 0 32px;
}

.hd-mark {
  display: inline-flex;
  align-items: baseline;
  font-family: var(--font-body);
  font-weight: 900;
  font-size: 18px;
  letter-spacing: -0.04em;
  color: #fff;
}
.hd-mark__dot {
  color: var(--hd-orange);
  margin-left: 1px;
}

/* ── Faixa azul→laranja (assinatura HD) ── */
.accent-strip {
  height: 4px;
  background: linear-gradient(90deg, var(--hd-blue) 0%, var(--hd-orange) 100%);
}

/* ── hd-card ── */
.hd-card {
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  box-shadow: var(--shadow-card);
  transition:
    transform var(--dur-base) var(--ease-overshoot),
    box-shadow var(--dur-base) ease,
    border-color var(--dur-base) ease;
}
.hd-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-card-hover);
}
.hd-card--no-hover { transition: none; }
.hd-card--no-hover:hover { transform: none; box-shadow: var(--shadow-card); }

.hd-card-header {
  background: var(--hd-navy);
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
}
.hd-card-header__left  { display: flex; align-items: center; gap: 14px; }
.hd-card-header__right { display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  font-weight: 600;
}
.hd-card-header__divider { width: 1px; height: 18px; background: rgba(255,255,255,0.2); }
.hd-card-header__title {
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  letter-spacing: 0.02em;
  margin: 0;
}
.hd-card-header__orange-bar {
  width: 3px; height: 14px;
  background: var(--hd-orange);
  border-radius: 2px;
}

.hd-card__body {
  padding: 44px 44px 40px;
  position: relative;
}
.hd-card__body.has-red-bar::before {
  content: ''; position: absolute;
  left: 0; top: 0; width: 4px; height: 100%;
  background: var(--hd-red);
  opacity: 0.85;
}
.hd-card__body.has-orange-wedge::after {
  content: ''; position: absolute;
  right: 0; bottom: 0; width: 80px; height: 80px;
  background: linear-gradient(135deg, transparent 50%, var(--hd-orange) 50%);
  opacity: 0.18;
  pointer-events: none;
}

/* ── kpi ── */
.kpi {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px 20px 20px;
  position: relative;
  transition: transform var(--dur-fast) ease,
              border-color var(--dur-fast) ease,
              box-shadow var(--dur-fast) ease;
  overflow: hidden;
}
.kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
}
.kpi--blue::before   { background: var(--hd-blue); }
.kpi--orange::before { background: var(--hd-orange); }
.kpi--red::before    { background: var(--hd-red); }
.kpi--blue   { background: linear-gradient(180deg, var(--hd-blue-50) 0%, var(--surface) 70%); }
.kpi--orange { background: linear-gradient(180deg, var(--hd-orange-50) 0%, var(--surface) 70%); }
.kpi--red    { background: linear-gradient(180deg, var(--hd-red-50) 0%, var(--surface) 70%); }
.kpi:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-kpi-hover);
}
.kpi--blue:hover   { border-color: var(--hd-blue); }
.kpi--orange:hover { border-color: var(--hd-orange); }
.kpi--red:hover    { border-color: var(--hd-red); }

.kpi__label {
  font-family: var(--font-body);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
  font-weight: 700;
  margin-bottom: 10px;
}
.kpi__value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  color: var(--ink);
  font-feature-settings: "tnum";
  letter-spacing: -0.025em;
  line-height: 1;
  margin-bottom: 8px;
}
.kpi__unit {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--ink-dim);
  font-weight: 500;
  letter-spacing: -0.01em;
}
.kpi__delta {
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.kpi--blue   .kpi__delta { color: var(--hd-blue); }
.kpi--orange .kpi__delta { color: #b76a1a; }
.kpi--red    .kpi__delta { color: var(--hd-red); }

/* ── status-block + badge ── */
.status-block {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  background: rgba(26, 37, 53, 0.025);
}
.status-block__label {
  font-family: var(--font-body);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
  font-weight: 700;
  margin-bottom: 12px;
}
.status-block__row { display: flex; flex-wrap: wrap; gap: 8px; }

.badge {
  font-family: var(--font-body);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid;
}
.badge__dot { width: 7px; height: 7px; border-radius: 50%; }
.badge--confirmada   { background: #DCFCE7; color: #166534; border-color: #BBF7D0; }
.badge--confirmada   .badge__dot { background: #166534; }
.badge--em-analise   { background: var(--hd-blue-50); color: #1E40AF; border-color: #BFDBFE; }
.badge--em-analise   .badge__dot { background: var(--hd-blue); }
.badge--identificada { background: var(--hd-orange-50); color: #854D0E; border-color: #FCD34D; }
.badge--identificada .badge__dot { background: var(--hd-orange); }
.badge--descartada   { background: #F1F5F9; color: #64748B; border-color: #CBD5E1; }
.badge--descartada   .badge__dot { background: #94A3B8; }

/* ── ink-btn ── */
.ink-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 1.5px solid var(--border-strong);
  color: var(--border-strong);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 14px 26px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: color var(--dur-base) ease, border-color var(--dur-base) ease;
}
.ink-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--hd-red);
  transform: translateY(102%);
  transition: transform var(--dur-slow) var(--ease-ink);
  z-index: -1;
}
.ink-btn > * { position: relative; z-index: 1; }
.ink-btn:hover { color: #fff; border-color: var(--hd-red); }
.ink-btn:hover::before { transform: translateY(0); }
.ink-btn__arrow {
  display: inline-block;
  transition: transform var(--dur-base) var(--ease-out);
}
.ink-btn:hover .ink-btn__arrow { transform: translateX(5px) rotate(-8deg); }
.ink-btn--dark { border-color: var(--hd-cream); color: var(--hd-cream); }

/* ── ghost-btn ── */
.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--hd-blue);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  padding: 13px 22px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.ghost-btn:hover {
  background: var(--hd-blue-50);
  border-color: var(--hd-blue);
  color: var(--hd-navy);
}

/* ── kpi--neutral (Fase 2) ── */
.kpi--neutral::before { background: var(--ink-dim); }
.kpi--neutral { background: linear-gradient(180deg, rgba(26,37,53,0.04) 0%, var(--surface) 70%); }
.kpi--neutral:hover { border-color: var(--ink-dim); }
.kpi--neutral .kpi__delta { color: var(--ink-dim); }

/* ── seg-toggle (Fase 2) — segmented control ── */
.seg-toggle {
  display: inline-flex;
  background: rgba(26, 37, 53, 0.06);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}
.seg-toggle__btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-dim);
  white-space: nowrap;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.seg-toggle__btn:hover { color: var(--ink); }
.seg-toggle__btn--on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(26, 37, 53, 0.12);
}

/* ── chip (Fase 2) — filtro com contagem ── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  background: rgba(26, 37, 53, 0.06);
  color: var(--ink-dim);
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.chip:hover { color: var(--ink); }
.chip--active { background: var(--hd-navy); color: #fff; }
.chip__count {
  font-size: 10.5px;
  font-weight: 700;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.10);
  line-height: 1.6;
}
.chip--active .chip__count { background: rgba(255, 255, 255, 0.22); }

/* ── hd-modal (Fase 4) — overlay + card de modal ── */
.hd-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(26, 37, 53, 0.45);
  backdrop-filter: blur(2px);
}
.hd-modal.hidden { display: none; }
.hd-modal__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card-hover);
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
}
.hd-modal__header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.hd-modal__title {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}
.hd-modal__close {
  background: transparent;
  border: none;
  color: var(--ink-dim);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
}
.hd-modal__close:hover { color: var(--ink); background: rgba(26,37,53,0.05); }
.hd-modal__body { padding: 1.5rem; }
.hd-modal__footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
}

/* ════════════════════════════════════════════════
   PARTE 2 · CLASSES LEGADAS MIGRADAS DO base.html
   (transplantadas sem renomeação para garantir
    que templates atuais continuem renderizando)
   ════════════════════════════════════════════════ */

[x-cloak] { display: none !important; }

/* ── Sidebar ── */
.sidebar { background-color: var(--sidebar-bg); }

/* Compacto de propósito: com 15 itens em quatro blocos, a barra inteira precisa
   caber numa tela de laptop sem rolar. O nav rola quando não couber, mas rolar é
   a rede, não o normal. */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.4rem 0.9rem;
  border-radius: 0.75rem;
  color: #CBD5E1;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 500;
  transition: background 0.25s ease, color 0.25s ease;
}
.sidebar-link:hover {
  background-color: var(--sidebar-hover);
  color: #ffffff;
}
.sidebar-link.active {
  background-color: var(--hd-blue);
  color: #ffffff;
}

/* Rótulo de bloco do menu. Recolhida a barra, o texto some e o rótulo vira uma
   divisória fina: sem isso os blocos se perdiam na coluna de ícones. */
.sb-group {
  margin: 0.5rem 0 0.1rem;
  padding: 0 0.9rem;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #64748B;
}
html.sb-collapsed .sb-group {
  margin: 0.6rem 0.5rem;
  padding: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.10);
}

/* Contador de pendências. Recolhida a barra vira um ponto no canto do ícone,
   porque o número não cabe e sumir esconderia justamente o que cobra decisão. */
.sb-count {
  margin-left: auto;
  min-width: 1.15rem;
  padding: 0 0.35rem;
  border-radius: 9999px;
  background: var(--hd-orange);
  color: var(--hd-navy);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.15rem;
  text-align: center;
}
.sb-nav { overflow-y: auto; min-height: 0; scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) transparent; }
.sb-nav::-webkit-scrollbar { width: 5px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 9999px; }

/* Recolher: pastilha na borda da barra, meio para fora, em vez da faixa própria
   que ocupava uma linha inteira do alto. */
.sb-fab {
  position: absolute;
  top: 1.15rem;
  right: -13px;
  width: 26px;
  height: 26px;
  border-radius: 9999px;
  background: var(--sidebar-bg);
  border: 1px solid rgba(255,255,255,0.16);
  color: #CBD5E1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 40;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.sb-fab:hover { background: var(--sidebar-hover); color: #fff; border-color: var(--hd-orange); }
.sb-fab .sb-icon-expand { display: none; }
html.sb-collapsed .sb-fab .sb-icon-collapse { display: none; }
html.sb-collapsed .sb-fab .sb-icon-expand { display: block; }

html.sb-collapsed .sidebar-link { position: relative; }
html.sb-collapsed .sb-count {
  position: absolute;
  top: 0.3rem;
  right: 0.5rem;
  min-width: 0;
  width: 0.45rem;
  height: 0.45rem;
  padding: 0;
  font-size: 0;
  line-height: 0;
}

/* ── Botões primários HD ── */
.btn-primary {
  background-color: var(--hd-blue);
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: filter 0.15s;
}
.btn-primary:hover { filter: brightness(1.1); }

.btn-outline {
  border: 1px solid #E2E8F0;
  color: #475569;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  background: white;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s;
}
.btn-outline:hover { background-color: #F8FAFC; }

/* ── Badges de regime ── */
.badge-lr { background: #EDE9FE; color: #5B21B6; font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 9999px; }
.badge-lp { background: #DBEAFE; color: #1E40AF; font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 9999px; }
.badge-sn { background: #DCFCE7; color: #166534; font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 9999px; }

/* ── Status badges ── */
.status-identificada { background: #FEF9C3; color: #854D0E; font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 9999px; }
.status-em_analise   { background: #DBEAFE; color: #1E40AF; font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 9999px; }
.status-confirmada   { background: #DCFCE7; color: #166534; font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 9999px; }
.status-descartada   { background: #F1F5F9; color: #94A3B8; font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 9999px; }

/* ── Avatar ── */
.avatar {
  width: 2rem; height: 2rem;
  border-radius: 9999px;
  background-color: #DBEAFE;
  color: var(--hd-blue);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.7rem;
  flex-shrink: 0;
}

/* ── Valor em verde ── */
.valor-verde { color: #15803D; font-weight: 700; }

/* ── Alerta laranja HD ── */
.alert-hd {
  background: #FFF7ED;
  border: 1px solid var(--hd-orange);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  color: #7C2D12;
}

/* ── Ocultar informações financeiras ── */
body.hide-financial .brl-value,
body.hide-financial .valor-verde,
body.hide-financial [data-financial] {
  filter: blur(7px);
  transition: filter 0.18s;
  user-select: none;
  cursor: help;
}
body.hide-financial .brl-value:hover,
body.hide-financial .valor-verde:hover,
body.hide-financial [data-financial]:hover {
  filter: blur(0);
}

/* ── Sidebar: ações rápidas e botão de olho ── */
.sidebar-action {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  border-radius: 0.5rem;
  color: #ffffff;
  background: rgba(98,133,172,0.15);
  border: 1px solid rgba(98,133,172,0.35);
  font-size: 0.78rem; font-weight: 600;
  text-decoration: none; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.sidebar-action:hover {
  background: rgba(98,133,172,0.30);
  border-color: rgba(98,133,172,0.6);
}
.sidebar-action svg { width: 0.85rem; height: 0.85rem; flex-shrink: 0; }

.eye-toggle {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  color: #CBD5E1;
  padding: 0.3rem 0.55rem;
  border-radius: 0.4rem;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.65rem; font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.eye-toggle:hover { background: rgba(255,255,255,0.06); color: #ffffff; }
.eye-toggle .eye-open   { display: inline; }
.eye-toggle .eye-closed { display: none; }
body.hide-financial .eye-toggle .eye-open   { display: none; }
body.hide-financial .eye-toggle .eye-closed { display: inline; }

/* ── Sidebar: recolher (só ícones) ── */
.sb-logo-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
html.sb-collapsed .sb-logo-row { flex-direction: column; justify-content: center; gap: 0.6rem; }

.sb-footer-user { display: flex; align-items: center; gap: 0.625rem; margin-bottom: 0.5rem; }
html.sb-collapsed .sb-footer-user { justify-content: center; }

.sb-logout-btn { text-align: left; }
html.sb-collapsed .sb-logout-btn { text-align: center; }

html.sb-collapsed .sb-label,
html.sb-collapsed .sb-hide-collapsed { display: none; }

html.sb-collapsed .sidebar-link,
html.sb-collapsed .sidebar-action {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
  gap: 0;
}

.sb-toggle-btn { width: 100%; justify-content: center; }
.sb-toggle-btn .sb-icon-expand { display: none; }
html.sb-collapsed .sb-toggle-btn .sb-icon-collapse { display: none; }
html.sb-collapsed .sb-toggle-btn .sb-icon-expand { display: inline; }
