:root {
  --neon: #D4FF00;
  --neon-dim: rgba(212, 255, 0, 0.15);
  --green: #34D399;
  --red: #F87171;
  --amber: #FBBF24;
  --white: #FFFFFF;
  --black: #000000;
  --black2: #050505;
  --black3: #0A0A0A;
  --black4: #101010;
  --surface: rgba(255, 255, 255, 0.03);
  --surface2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.1);
  --border-light: rgba(255, 255, 255, 0.2);
  --muted: #888888;
  --muted2: #AAAAAA;
  --font-h: 'Inter', sans-serif;
  --font-b: 'Inter', sans-serif;
}

.logo-nexus {
  filter: url(#remove-black) brightness(1.2);
  height: 60px;
  width: auto;
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700;900&display=swap');

* {
  margin: 0; padding: 0; box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--black);
  color: var(--white);
  font-family: var(--font-b);
  overflow-x: hidden;
  line-height: 1.5;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--black); }
::-webkit-scrollbar-thumb { background: var(--surface); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* Layout */
#app { display: none; min-height: 100vh; padding-top: 60px; }

/* Login Screen */
#login-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

.nexus-bg {
  position: fixed; inset: 0; z-index: -1;
  background: radial-gradient(circle at center, #111 0%, #000 100%);
}

.nexus-glow {
  position: fixed; top: 50%; left: 50%;
  width: 800px; height: 800px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
  z-index: -1;
}

.login-box {
  padding: 40px; 
  border-radius: 12px;
  display: flex; flex-direction: column; gap: 24px;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 40px 100px rgba(0,0,0,0.8);
  position: relative; z-index: 10;
}

.login-sub {
  font-family: var(--font-h); font-weight: 500; font-size: 11px;
  letter-spacing: 5px; color: var(--muted); text-transform: uppercase;
  text-align: center;
}

.login-box input {
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white); padding: 14px 18px; border-radius: 999px;
  font-family: var(--font-h); font-size: 14px; outline: none;
  transition: all .2s;
}

.login-box input:focus { border-color: var(--white); background: rgba(255, 255, 255, 0.08); }

.login-box button {
  background: var(--white); color: var(--black); border: none;
  padding: 14px; border-radius: 999px; font-weight: 700;
  letter-spacing: 1px; cursor: pointer; transition: all .3s;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(255,255,255,0.1);
}

.login-box button:hover { 
  transform: translateY(-2px);
  background: #f0f0f0;
  box-shadow: 0 12px 32px rgba(255,255,255,0.2);
}

.login-err { color: var(--red); font-size: 12px; display: none; margin-top: 10px; }

/* Topbar */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 60px;
  background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; width: 100%; height: 100%;
  display: flex; align-items: center; padding: 0 24px;
}
.topbar-logo { margin-right: 40px; }
.nav-tabs { display: flex; gap: 8px; flex: 1; }
.nav-tab {
  background: none; border: none; color: var(--muted);
  padding: 8px 16px; border-radius: 4px; cursor: pointer;
  font-family: var(--font-h); font-size: 13px; font-weight: 700;
  display: flex; align-items: center; gap: 8px; transition: .2s;
}
.nav-tab:hover { color: var(--white); background: var(--surface); }
.nav-tab.active { color: var(--neon); background: none; }
.topbar-right {
  font-family: var(--font-h); font-size: 11px; font-weight: 700;
  color: var(--muted2); letter-spacing: 1px; text-transform: uppercase;
}

/* UI Elements */
.content { padding: 40px 24px; max-width: 1280px; margin: 0 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.section-title {
  font-family: var(--font-h); font-size: 12px; font-weight: 500;
  letter-spacing: 0.2em; color: var(--muted); margin-bottom: 8px;
  text-transform: uppercase;
}
.section-sub {
  font-family: var(--font-h); font-size: 42px; font-weight: 500;
  color: var(--white); margin-bottom: 0;
  letter-spacing: -0.05em; line-height: 1.1;
  position: relative; z-index: 2;
}
.section-sub-caption {
  font-family: var(--font-h); font-size: 18px; font-weight: 400;
  color: rgba(255,255,255,0.5); letter-spacing: -0.01em;
  position: relative; z-index: 2;
}

.header-glow {
  position: absolute; top: -100px; left: -100px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,0.03) 0%, transparent 70%);
  filter: blur(40px);
  pointer-events: none;
  z-index: 1;
}

.card {
  background: rgba(255, 255, 255, 0.03); 
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px; padding: 24px; position: relative; overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
}
.card-label {
  font-family: var(--font-h); font-size: 11px; font-weight: 500;
  letter-spacing: 0.02em; color: var(--muted2); margin-bottom: 8px;
}
.card-val {
  font-family: var(--font-h); font-size: 28px; font-weight: 500;
  color: var(--white); margin: 0; line-height: 1.2;
  letter-spacing: -0.02em;
}

.badge {
  display: inline-flex; align-items: center; padding: 4px 8px;
  border-radius: 4px; font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 1px;
}
.badge-saudavel { background: rgba(52, 211, 153, 0.15); color: var(--green); }
.badge-risco { background: rgba(248, 113, 113, 0.15); color: var(--red); }
.badge-atencao { background: rgba(251, 191, 36, 0.15); color: var(--amber); }
.badge-superado { background: var(--neon-dim); color: var(--neon); }
.badge-neutro { background: var(--surface2); color: var(--muted2); }

/* Grid / List */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* Table */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 16px 12px; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.5px; border-bottom: 1px solid var(--border); }
td { padding: 16px 12px; border-bottom: 1px solid rgba(255,255,255,0.02); font-size: 13px; }
tr:hover td { background: rgba(255,255,255,0.01); }

/* Progress */
.progress-wrap { margin-top: 12px; }
.progress-label { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin-bottom: 6px; font-family: var(--font-h); font-weight: 700; }
.progress-bar { height: 2px; background: rgba(255,255,255,0.05); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 2px; transition: width .5s cubic-bezier(0.4, 0, 0.2, 1); }
.fill-neon { background: var(--neon); box-shadow: 0 0 8px var(--neon); }
.fill-green { background: var(--green); }
.fill-amber { background: var(--amber); }
.fill-red { background: var(--red); }

/* Custom */
.stat-chip {
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 140px;
  backdrop-filter: blur(10px);
}
.stat-chip-val { font-family: var(--font-h); font-size: 18px; font-weight: 900; color: var(--white); line-height: 1.2; }
.stat-chip-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.5px; margin-top: 4px; font-weight: 700; }

.pillar-header { display: flex; align-items: center; gap: 12px; margin: 32px 0 16px; }
.pillar-label { font-family: var(--font-h); font-weight: 900; font-size: 12px; letter-spacing: 3px; color: var(--muted2); text-transform: uppercase; }
.pillar-line { flex: 1; height: 1px; background: linear-gradient(90deg, var(--border), transparent); }

.okr-card { background: var(--black2); border: 1px solid var(--border); border-radius: 8px; padding: 20px; transition: .2s; }
.okr-card:hover { border-color: var(--border-light); transform: translateY(-2px); }
.okr-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.okr-card-title { font-family: var(--font-h); font-weight: 800; font-size: 15px; color: var(--white); margin-bottom: 4px; }
.okr-card-meta { font-size: 11px; color: var(--muted2); }

.okr-chart-wrap { height: 120px; margin-top: 10px; }

.narrative { font-size: 12px; color: var(--muted2); line-height: 1.6; font-style: italic; border-left: 2px solid var(--border); padding-left: 12px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px; border-radius: 4px; font-family: var(--font-h);
  font-size: 12px; font-weight: 800; cursor: pointer; transition: .2s;
  border: none; outline: none; gap: 8px; letter-spacing: 1px;
}
.btn-sm { padding: 6px 14px; font-size: 11px; }
.btn-neon { background: var(--neon); color: var(--black); }
.btn-neon:hover { opacity: .85; }
.btn-outline { background: none; border: 1px solid var(--border); color: var(--white); }
.btn-outline:hover { background: var(--surface); border-color: var(--muted); }
.btn-red { background: rgba(248, 113, 113, 0.2); color: var(--red); border: 1px solid var(--red); }

/* Forms */
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-label { font-size: 11px; font-weight: 700; color: var(--muted2); text-transform: uppercase; letter-spacing: 1px; }
.form-input {
  background: var(--black2); border: 1px solid var(--border); border-radius: 4px;
  color: var(--white); padding: 10px 14px; font-family: var(--font-b); font-size: 13px;
  outline: none; transition: .2s;
}
.form-input:focus { border-color: var(--neon); background: var(--black3); }
.form-hint { font-size: 10px; color: var(--muted); margin-top: 2px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.toggle-wrap { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.toggle { width: 36px; height: 20px; background: var(--surface2); border-radius: 10px; position: relative; transition: .3s; }
.toggle-knob { width: 14px; height: 14px; background: var(--muted); border-radius: 50%; position: absolute; top: 3px; left: 3px; transition: .3s; }
.toggle.active { background: var(--neon); }
.toggle.active .toggle-knob { left: 19px; background: var(--black); }
.toggle-label { font-size: 13px; color: var(--white); font-weight: 700; }

/* Modals */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85);
  backdrop-filter: blur(4px); display: none; align-items: center;
  justify-content: center; z-index: 2000;
}
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 32px; width: 100%; max-width: 500px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}
.modal-title { font-family: var(--font-h); font-size: 18px; font-weight: 900; color: var(--white); margin-bottom: 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; margin-top: 32px; }

/* Loading */
.loading-overlay {
  position: fixed; inset: 0; background: var(--black);
  z-index: 10000; display: none; align-items: center; justify-content: center;
  pointer-events: none;
}
.loading-overlay[style*="display: flex"] {
  pointer-events: auto;
}
.spinner { width: 40px; height: 40px; border: 3px solid var(--surface); border-top-color: var(--neon); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
#toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  padding: 12px 24px; border-radius: 8px; font-weight: 700; font-size: 13px;
  z-index: 10001; display: none; min-width: 200px; text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  animation: slideUp .3s ease-out;
  pointer-events: none;
}
@keyframes slideUp { from { transform: translate(-50%, 20px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* Tab Filters */
.view-toggle { background: var(--black3); border: 1px solid var(--border); border-radius: 6px; padding: 3px; display: flex; gap: 2px; }
.view-toggle-btn {
  background: none; border: none; color: var(--muted); font-size: 11px;
  font-weight: 800; padding: 6px 12px; border-radius: 4px; cursor: pointer; transition: .2s;
}
.view-toggle-btn.active { background: var(--surface2); color: var(--white); }

/* Period Picker */
.period-picker-wrap { position: relative; }
.period-btn {
  background: var(--black3); border: 1px solid var(--border); border-radius: 6px;
  height: 34px; padding: 0 12px; display: flex; align-items: center; gap: 8px;
  cursor: pointer; color: var(--white); font-family: var(--font-h); font-size: 11px; font-weight: 900;
}
.period-btn:hover { border-color: var(--muted); }
.period-btn-icon { color: var(--muted); font-size: 10px; }

.period-dropdown {
  position: absolute; top: calc(100% + 12px); left: 50%; transform: translateX(-50%); width: 340px;
  background: #0f0f0f; border: 1px solid rgba(255,255,255,0.08); border-radius: 16px;
  padding: 24px; box-shadow: 0 24px 80px rgba(0,0,0,0.95); z-index: 1100;
  display: none;
}
.period-dropdown::before {
  content: ''; position: absolute; top: -6px; left: 50%; transform: translateX(-50%) rotate(45deg);
  width: 12px; height: 12px; background: #0f0f0f; border-left: 1px solid rgba(255,255,255,0.08); border-top: 1px solid rgba(255,255,255,0.08);
}
.period-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 24px; }
.period-preset-btn {
  background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.04); color: var(--muted2);
  font-size: 11px; font-weight: 600; padding: 8px 0; border-radius: 6px; cursor: pointer; transition: all .2s;
}
.period-preset-btn:hover { background: rgba(255,255,255,0.06); color: var(--white); border-color: rgba(255,255,255,0.1); }
.period-months-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; font-weight: 700; }
.period-months { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.period-month-btn {
  background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.04); color: var(--muted2);
  font-size: 11px; font-weight: 600; padding: 10px 0; border-radius: 6px; cursor: pointer; transition: all .2s;
}
.period-month-btn:hover { background: rgba(255,255,255,0.06); color: var(--white); }
.period-month-btn.selected { 
  background: rgba(212, 255, 0, 0.1); color: var(--neon); 
  border-color: rgba(212, 255, 0, 0.3); box-shadow: 0 0 12px rgba(212, 255, 0, 0.1);
}
.period-month-btn.in-range { 
  background: rgba(212, 255, 0, 0.03); color: rgba(212, 255, 0, 0.8); 
  border-color: rgba(212, 255, 0, 0.1); 
}
.period-apply {
  width: 100%; margin-top: 24px; background: var(--neon); color: var(--black);
  border: none; border-radius: 8px; padding: 12px; font-weight: 800; font-size: 12px;
  cursor: pointer; letter-spacing: 1px; transition: all .2s;
}
.period-apply:hover {
  box-shadow: 0 4px 16px rgba(212, 255, 0, 0.2);
  transform: translateY(-1px);
}

/* Sub-tabs */
.sub-tabs { display: flex; gap: 4px; margin-bottom: 16px; background: var(--black3); padding: 4px; border-radius: 8px; width: fit-content; }
.sub-tab {
  background: none; border: none; color: var(--muted); font-size: 12px;
  font-weight: 700; padding: 8px 16px; border-radius: 6px; cursor: pointer; transition: .2s;
}
.sub-tab:hover { color: var(--white); }
.sub-tab.active { background: var(--surface); color: var(--white); box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.sub-panel { display: none; }
.sub-panel.active { display: block; }

/* Grid specific */
.client-grid-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--black2); }
.client-grid-wrap table { border-collapse: separate; border-spacing: 0; min-width: 1000px; }
.client-grid-wrap th { background: var(--black3); position: sticky; top: 0; z-index: 10; border-bottom: 2px solid var(--border); }
.client-grid-wrap td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: left; font-family: var(--font-h); }
.client-grid-wrap .td-client { position: sticky; left: 0; background: var(--black2); z-index: 5; text-align: left; font-weight: 800; font-size: 12px; border-right: 2px solid var(--black); min-width: 180px; }
.client-grid-wrap .td-num { font-size: 11px; min-width: 85px; }

.cell-editable { cursor: pointer; display: block; padding: 8px 4px; border-radius: 2px; }
.cell-editable:hover { background: var(--surface); }
.cell-zero { color: var(--muted); }
.cell-has-value { color: var(--white); font-weight: 700; }
.cell-editing { width: 100%; background: var(--white); color: var(--black); border: none; padding: 8px 4px; font-family: var(--font-h); font-weight: 800; font-size: 11px; text-align: center; }

.search-wrap { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.search-input { background: var(--black2); border: 1px solid var(--border); border-radius: 6px; color: var(--white); padding: 8px 14px; font-size: 13px; outline: none; flex: 1; min-width: 200px; }
.search-input:focus { border-color: var(--neon); }
.filter-select { background: var(--black2); border: 1px solid var(--border); border-radius: 6px; color: var(--muted2); padding: 8px 12px; font-size: 12px; outline: none; cursor: pointer; font-weight: 700; }

.month-selector { display: flex; gap: 10px; margin-bottom: 20px; align-items: center; }
.month-selector select { background: var(--black2); border: 1px solid var(--border); border-radius: 6px; color: var(--white); padding: 8px 14px; font-size: 13px; outline: none; cursor: pointer; }

/* Responsive */
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .topbar { padding: 0 12px; }
  .topbar-logo { display: none; }
  .nav-tab span { display: none; }
  .nav-tab { padding: 8px; }
  .content { padding: 24px 16px; }
  
  /* OKR cards — colapsar para 1 coluna */
  #okrs-detail-container > div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  
  /* Form grid — colapsar para 1 coluna */
  .form-grid { grid-template-columns: 1fr; }
  
  /* Tabela de clientes — scroll horizontal */
  .client-grid-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  
  /* Modal — largura total */
  .modal { max-width: 95vw; padding: 20px; }
  
  /* Section title menor */
  .section-sub { font-size: 28px; }
  
  /* Period dropdown — centralizado */
  .period-dropdown { width: 95vw; left: 50%; transform: translateX(-50%); }
  
  /* Topbar right — esconder data */
  .topbar-right { display: none; }
  
  /* Cards OKR — padding menor */
  .okr-card { padding: 14px; }
  
  /* Gráficos — altura menor */
  .okr-chart-wrap { height: 80px; }
}
