/* ==========================================================================
   HINODE BRAND DESIGN SYSTEM — OFFICIAL DARK MODE (OPERATE EDITION)
   Extraído de Guiademarca.pdf (págs. 8-12, 16) e https://www.hinode.com.br/
   Refinado para Modo Operate: precisão tipográfica, tabular-nums e 1px borders
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&family=Poppins:wght@400;500;600;700;800&display=swap');

@font-face {
  font-family: 'Codec Warm';
  src: url('https://hinodeonlineio.vtexassets.com/assets/vtex/assets-builder/hinodeonlineio.store-theme/8.1.59/fonts/CodecWarm-Light___4902bab6771c75d85a4536a4e6964330.woff2') format('woff2');
  font-weight: 300 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* Cores Oficiais Guia de Marca Hinode */
  --hnd-yellow: #FED832;        /* Pantone 116C - Amarelo Sol Hinode */
  --hnd-yellow-hover: #FFE35E;
  --hnd-yellow-subtle: rgba(254, 216, 50, 0.12);
  --hnd-yellow-border: rgba(254, 216, 50, 0.35);

  --hnd-purple: #751CEC;        /* Pantone 2091C - Lilás Institucional */
  --hnd-purple-hover: #6415CE;
  --hnd-purple-subtle: rgba(117, 28, 236, 0.16);
  --hnd-purple-border: rgba(117, 28, 236, 0.42);

  --hnd-navy: #3A334F;          /* Azul Escuro Guia de Marca (R:58 G:51 B:79) */
  --hnd-offwhite: #F9F9F0;      /* Off-white Guia de Marca (R:249 G:249 B:240) */
  --hnd-sand: #E2D6BC;          /* Areia Guia de Marca (R:226 G:214 B:188) */
  --hnd-gold: #AA8232;          /* Dourado Solar hinode.com.br */

  /* Superfícies Dark Mode derivadas de #3A334F (Camadas de Profundidade Operate) */
  --bg-canvas: #110E1A;
  --bg-sidebar: #161222;
  --bg-surface: #1E192D;
  --bg-surface-elevated: #251F38;
  --bg-surface-hover: #2E2744;
  --bg-input: #141020;

  /* Bordas e Divisores (Estritamente 1px) */
  --border-subtle: rgba(226, 214, 188, 0.09);
  --border-default: #332C47;
  --border-strong: #433B5C;

  /* Hierarquia de Texto (Contraste WCAG AA/AAA verificado sobre #1E192D e #110E1A) */
  --text-primary: #F9F9F0;      /* >15:1 */
  --text-secondary: #D2CADE;    /* >9.5:1 */
  --text-sand: #E2D6BC;         /* >11:1 */
  --text-muted: #9E94B6;        /* >5.2:1 sobre #1E192D (corrige antigo #8E84A6) */

  /* Semântica de Estado */
  --state-ok-bg: rgba(16, 185, 129, 0.14);
  --state-ok-text: #34D399;
  --state-ok-border: rgba(52, 211, 153, 0.35);

  --state-warn-bg: rgba(245, 158, 11, 0.15);
  --state-warn-text: #FBBF24;
  --state-warn-border: rgba(251, 191, 36, 0.35);

  --state-danger-bg: rgba(244, 63, 94, 0.15);
  --state-danger-text: #FDA4AF;
  --state-danger-border: rgba(251, 113, 133, 0.38);

  /* Tipografia Oficial Hinode: Poppins & Codec Warm para UI; IBM Plex Mono para dados tabulares */
  --font-brand: 'Poppins', 'Codec Warm', sans-serif;
  --font-sans: 'Poppins', 'Codec Warm', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  caret-color: var(--hnd-yellow);
}

/* Superfícies nativas do navegador tematizadas (Craft Floor) */
::selection {
  background-color: rgba(254, 216, 50, 0.26);
  color: var(--hnd-offwhite);
}

a {
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 2px solid var(--hnd-yellow);
  outline-offset: 2px;
}

/* Em modo Operate, títulos, labels e botões usam a mesma sans técnica (Inter) */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.font-brand {
  font-family: var(--font-brand);
}

.font-mono-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 1;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* Scrollbar elegante no modo escuro */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-canvas);
}
::-webkit-scrollbar-thumb {
  background: var(--hnd-navy);
  border-radius: 9999px;
  border: 2px solid var(--bg-canvas);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--hnd-purple);
}

/* ==================== CARDS E SUPERFÍCIES (1PX BORDERS) ==================== */

.hnd-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.48);
}

.hnd-card.overflow-hidden {
  padding: 0;
}

.hnd-card-elevated {
  background: linear-gradient(160deg, var(--bg-surface-elevated) 0%, var(--bg-surface) 100%);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 10px 28px -10px rgba(0, 0, 0, 0.52);
}

.hnd-card-interactive {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 16px;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}
.hnd-card-interactive:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-strong);
}
.hnd-card-interactive[aria-pressed="true"],
.hnd-card-interactive.is-selected {
  background: var(--bg-surface-elevated);
  border-color: var(--hnd-yellow);
  outline: 1px solid rgba(254, 216, 50, 0.35);
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.5);
}

/* ==================== BOTÕES OFICIAIS (OPERATE) ==================== */

.btn-hnd-solar,
.btn-hnd-purple,
.btn-hnd-outline,
.btn-hnd-danger {
  font-family: var(--font-sans);
  font-weight: 600;
  border-radius: 10px;
  min-height: 36px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
}

.btn-hnd-solar {
  background-color: var(--hnd-yellow);
  color: #14101F;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
.btn-hnd-solar:hover:not(:disabled) {
  background-color: var(--hnd-yellow-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}
.btn-hnd-solar:active:not(:disabled) {
  transform: translateY(0);
}
.btn-hnd-solar:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-hnd-purple {
  background-color: var(--hnd-purple);
  color: var(--hnd-offwhite);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
.btn-hnd-purple:hover:not(:disabled) {
  background-color: var(--hnd-purple-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}
.btn-hnd-purple:active:not(:disabled) {
  transform: translateY(0);
}
.btn-hnd-purple:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-hnd-outline {
  background-color: rgba(58, 51, 79, 0.32);
  color: var(--hnd-offwhite);
  border: 1px solid var(--border-strong);
}
.btn-hnd-outline:hover:not(:disabled) {
  background-color: var(--bg-surface-hover);
  border-color: var(--hnd-sand);
}
.btn-hnd-outline:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-hnd-danger {
  background-color: var(--state-danger-bg);
  color: var(--state-danger-text);
  border: 1px solid var(--state-danger-border);
}
.btn-hnd-danger:hover:not(:disabled) {
  background-color: rgba(244, 63, 94, 0.26);
  border-color: #FB7185;
}

/* ==================== SEGMENTED FILTER CONTROLS ==================== */

.hnd-segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: 11px;
}

.hnd-seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.hnd-seg-btn:hover:not(.active) {
  color: var(--text-primary);
  background-color: rgba(58, 51, 79, 0.4);
}
.hnd-seg-btn.active {
  background-color: var(--hnd-yellow);
  color: #14101F;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

/* ==================== NAVEGAÇÃO LATERAL (SEM BORDER-LEFT >1PX) ==================== */

.nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 12px;
  margin-bottom: 6px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
  cursor: pointer;
}
.nav-item:hover {
  background: rgba(58, 51, 79, 0.42);
  color: var(--hnd-offwhite);
}
.nav-item.active {
  background: linear-gradient(90deg, rgba(254, 216, 50, 0.14) 0%, rgba(117, 28, 236, 0.08) 100%);
  color: var(--hnd-yellow);
  border-color: rgba(254, 216, 50, 0.32);
  font-weight: 600;
}

/* ==================== INPUTS & FORM CONTROLS ==================== */

.hnd-input {
  background-color: var(--bg-input);
  border: 1px solid var(--border-strong);
  color: var(--hnd-offwhite);
  border-radius: 9px;
  padding: 7px 12px;
  min-height: 36px;
  font-size: 0.8125rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.hnd-input::placeholder {
  color: var(--text-muted);
  opacity: 0.85;
}
.hnd-input:hover:not(:disabled):not(:focus) {
  border-color: #564C73;
}
.hnd-input:focus {
  border-color: var(--hnd-yellow);
  outline: 2px solid rgba(254, 216, 50, 0.24);
  outline-offset: 0px;
}
.hnd-input:read-only {
  background-color: rgba(20, 16, 32, 0.55);
  color: var(--text-muted);
}

/* ==================== TABELAS DE DADOS (OPERATE DENSITY) ==================== */

.hnd-table {
  border-collapse: separate;
  border-spacing: 0;
}
.hnd-table thead th {
  background-color: #251F38;
  color: var(--hnd-sand);
  font-size: 0.69rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.hnd-table tbody tr {
  transition: background-color 0.12s ease;
}
.hnd-table tbody td {
  border-bottom: 1px solid rgba(58, 51, 79, 0.45);
}
.hnd-table tbody tr:last-child td {
  border-bottom: none;
}
.hnd-table tbody tr:hover {
  background-color: rgba(58, 51, 79, 0.32);
}
.hnd-table tfoot td,
.hnd-table tfoot th {
  background-color: #181424;
  border-top: 1px solid var(--border-strong);
}

/* ==================== BADGES E INDICADORES DE STATUS ==================== */

.badge-hnd {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2.5px 9px;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.badge-ok {
  background: var(--state-ok-bg);
  color: var(--state-ok-text);
  border: 1px solid var(--state-ok-border);
}
.badge-warn {
  background: var(--state-warn-bg);
  color: var(--state-warn-text);
  border: 1px solid var(--state-warn-border);
}
.badge-danger {
  background: var(--state-danger-bg);
  color: var(--state-danger-text);
  border: 1px solid var(--state-danger-border);
}
.badge-purple {
  background: var(--hnd-purple-subtle);
  color: #D8B4FE;
  border: 1px solid var(--hnd-purple-border);
}
.badge-solar {
  background: var(--hnd-yellow-subtle);
  color: var(--hnd-yellow);
  border: 1px solid var(--hnd-yellow-border);
}
.badge-sand {
  background: rgba(226, 214, 188, 0.11);
  color: var(--hnd-sand);
  border: 1px solid rgba(226, 214, 188, 0.26);
}

/* Status Dot Indicator (Sem halo zero-offset) */
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 9999px;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot-ok { background-color: #34D399; }
.status-dot-warn { background-color: #FBBF24; }
.status-dot-danger { background-color: #FB7185; }
.status-dot-solar { background-color: #FED832; }
.status-dot-purple { background-color: #A855F7; }

/* ==================== ANIMAÇÕES E PREFERS-REDUCED-MOTION ==================== */

@keyframes pulseSolar {
  0%, 100% { filter: drop-shadow(0 0 5px rgba(254, 216, 50, 0.22)); }
  50% { filter: drop-shadow(0 0 12px rgba(254, 216, 50, 0.45)); }
}
.sol-glow {
  animation: pulseSolar 4s ease-in-out infinite;
}

.chevron-rotate {
  transition: transform 0.18s ease;
}
.is-expanded .chevron-rotate {
  transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
  .sol-glow,
  .animate-pulse,
  .animate-spin {
    animation: none !important;
  }
  .btn-hnd-solar,
  .btn-hnd-purple,
  .btn-hnd-outline,
  .hnd-card-interactive,
  .nav-item,
  .chevron-rotate {
    transition-duration: 0s !important;
    transform: none !important;
  }
}
