/* ════════════════════════════════════════════════════════════════
   THINK LAB — REDESIGN DA INTERFACE DO JOGO (app shell)
   ----------------------------------------------------------------
   Mesmo vocabulário de classes de base.css / layout.css /
   components.css — pensado para ser portado de volta ao app real.
   Direção: alinhar o app à linguagem da landing (Instrument Sans /
   Instrument Serif / JetBrains Mono), hairlines no lugar de sombras
   pesadas, navy-tinta + um único acento âmbar usado com parcimônia.
   ════════════════════════════════════════════════════════════════ */

:root {
  /* Brand */
  --primary: #232e7d;
  --primary-light: #3a47a8;
  --primary-dark: #161d52;
  --primary-tint: rgba(35, 46, 125, 0.06);
  --accent: #a8741f;
  --accent-light: #e8c27a;

  /* Ink topbar (eco da landing) */
  --ink: #0e1117;
  --ink-line: rgba(255, 255, 255, 0.09);
  --ink-text: #e7ebf2;
  --ink-dim: #8d95a6;

  /* Semantic */
  --success: #1e7a4d;
  --success-light: #e9f5ee;
  --danger: #b3362e;
  --danger-light: #fbeeec;
  --warning: #a8741f;
  --warning-light: #faf3e4;
  --info: #2b6cb0;
  --info-light: #eaf2fa;

  /* Surfaces */
  --bg: #f4f5f8;
  --bg-alt: #eceef3;
  --card: #ffffff;
  --card-hover: #fafbfd;
  --overlay: rgba(14, 17, 23, 0.5);

  /* Text */
  --text: #181b27;
  --text-secondary: #3e4354;
  --muted: #6e7484;
  --muted-light: #9ba1af;

  /* Borders */
  --border: #e3e6ed;
  --border-light: #edeff4;
  --border-focus: var(--primary-light);

  /* Decorative */
  --gold: #a8741f;
  --gold-light: #e8c27a;

  /* Layout */
  --sidebar-width: 248px;
  --topbar-height: 56px;
  --footer-height: 34px;
  --content-max: 1320px;

  /* Elevation — quase plana, hairline first */
  --shadow-sm: 0 1px 2px rgba(20, 24, 40, 0.04);
  --shadow: 0 2px 6px rgba(20, 24, 40, 0.05);
  --shadow-md: 0 8px 24px rgba(20, 24, 40, 0.08);
  --shadow-lg: 0 24px 48px rgba(20, 24, 40, 0.14);

  /* Radius */
  --radius-sm: 7px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --transition: 0.18s ease;
  --transition-slow: 0.32s ease;

  --z-sidebar: 100;
  --z-footer: 150;
  --z-topbar: 200;
  --z-modal: 1000;
  --z-toast: 2000;

  /* Type */
  --font: 'Instrument Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--primary-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary); }
img, svg { display: block; max-width: 100%; }
ul, ol { list-style: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.3; color: var(--text); letter-spacing: -0.01em; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--muted-light); }
::selection { background: rgba(58, 71, 168, 0.18); }

/* Rótulo técnico em mono — usado em labels, eyebrows, theads */
.mono-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* ════════════════════════════════════════
   TOPBAR — barra de tinta, eco da landing
   ════════════════════════════════════════ */
#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  background: var(--ink);
  border-bottom: 1px solid var(--ink-line);
  display: flex;
  align-items: center;
  padding: 0 1rem 0 0;
  gap: 0.85rem;
  z-index: var(--z-topbar);
}

#btn-menu {
  width: var(--topbar-height);
  height: var(--topbar-height);
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none;
  color: var(--ink-dim);
  border-right: 1px solid var(--ink-line);
  transition: color var(--transition), background var(--transition);
}
#btn-menu:hover { color: var(--ink-text); background: rgba(255,255,255,0.04); }
#btn-menu .hamburger { width: 18px; height: 12px; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
#btn-menu .hamburger span { display: block; height: 1.5px; background: currentColor; border-radius: 2px; }

.topbar-logo {
  display: flex; align-items: baseline; gap: 0.45rem;
  font-size: 1rem; font-weight: 600; color: var(--ink-text);
  letter-spacing: -0.01em; flex-shrink: 0; line-height: 1;
}
.topbar-logo::before {
  content: '';
  width: 10px; height: 10px;
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  border-radius: 3px;
  align-self: center;
}
.topbar-logo span {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  color: var(--accent-light);
  font-size: 1.05rem;
}

.topbar-divider { width: 1px; height: 22px; background: var(--ink-line); flex-shrink: 0; }

/* Empresa */
.topbar-company {
  display: flex; align-items: center; gap: 0.5rem;
  border: 1px solid var(--ink-line);
  border-radius: var(--radius-full);
  padding: 0.22rem 0.8rem 0.22rem 0.28rem;
  flex-shrink: 0;
  transition: border-color var(--transition);
}
.topbar-company:hover { border-color: rgba(255,255,255,0.2); }
.topbar-company-icon {
  width: 22px; height: 22px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.62rem; font-weight: 700; color: #fff;
  font-family: var(--font-mono);
}
.topbar-company-text {
  display: flex; flex-direction: column; justify-content: center;
  line-height: 1.15; min-width: 0;
}
#topbar-company-name {
  color: var(--ink-text); font-size: 0.8rem; font-weight: 500;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-student-name {
  color: var(--ink-dim); font-size: 0.64rem; font-weight: 500;
  letter-spacing: 0.01em;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Rodada */
.topbar-round {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-light);
  border: 1px solid rgba(232, 194, 122, 0.28);
  background: rgba(232, 194, 122, 0.07);
  padding: 0.28rem 0.7rem;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.topbar-spacer { flex: 1; }

.topbar-status {
  display: flex; align-items: center; gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-dim); flex-shrink: 0;
}
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.status-dot.connected { background: #73d1a3; box-shadow: 0 0 8px rgba(115, 209, 163, 0.7); }
.status-dot.disconnected { background: #e07a72; }
.status-dot.connecting { background: var(--accent-light); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.topbar-actions { display: flex; align-items: center; gap: 0.65rem; flex-shrink: 0; }
.topbar-username { color: var(--ink-dim); font-size: 0.78rem; }
#btn-logout {
  background: transparent;
  border: 1px solid var(--ink-line);
  color: var(--ink-text);
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem; font-weight: 500;
  display: flex; align-items: center; gap: 0.35rem;
  transition: border-color var(--transition), background var(--transition);
}
#btn-logout:hover { border-color: rgba(255,255,255,0.25); background: rgba(255,255,255,0.05); }

/* ════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════ */
#sidebar {
  position: fixed;
  top: var(--topbar-height); left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--topbar-height) - var(--footer-height));
  background: var(--card);
  border-right: 1px solid var(--border);
  overflow-y: auto; overflow-x: hidden;
  z-index: var(--z-sidebar);
  display: flex; flex-direction: column;
  transition: transform var(--transition-slow);
}

.sidebar-header { padding: 1rem 0.9rem 0.85rem; border-bottom: 1px solid var(--border-light); }
.sidebar-game-info {
  background: var(--ink);
  border-radius: var(--radius);
  padding: 0.8rem 0.95rem;
  color: var(--ink-text);
  position: relative;
  overflow: hidden;
}
.sidebar-game-info::after {
  content: '';
  position: absolute; right: -28px; top: -28px;
  width: 76px; height: 76px; border-radius: 50%;
  background: radial-gradient(circle, rgba(58, 71, 168, 0.55), transparent 70%);
  filter: blur(6px);
}
.sidebar-game-label {
  font-family: var(--font-mono);
  font-size: 0.6rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--ink-dim);
  margin-bottom: 0.3rem;
}
.sidebar-game-name { font-size: 0.88rem; font-weight: 600; line-height: 1.3; }
.sidebar-game-status {
  font-family: var(--font-mono);
  font-size: 0.64rem; color: var(--accent-light);
  margin-top: 0.35rem; letter-spacing: 0.04em;
  display: flex; align-items: center; gap: 0.35rem;
}
.sidebar-game-status::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: #73d1a3; }

.sidebar-nav { padding: 0.6rem 0 0.75rem; flex: 1; }
.sidebar-section { margin-bottom: 0.35rem; }
.sidebar-section-label {
  font-family: var(--font-mono);
  font-size: 0.6rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--muted-light);
  padding: 0.75rem 1.1rem 0.35rem;
}

.sidebar-link {
  display: flex; align-items: center; gap: 0.65rem;
  width: calc(100% - 0.9rem);
  margin: 1px 0.45rem;
  padding: 0.52rem 0.7rem;
  color: var(--text-secondary);
  font-size: 0.84rem; font-weight: 500;
  border: none; background: transparent;
  border-radius: var(--radius-sm);
  text-align: left;
  position: relative;
  transition: background var(--transition), color var(--transition);
}
.sidebar-link svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.55; transition: opacity var(--transition); }
.sidebar-link:hover { background: var(--bg); color: var(--text); }
.sidebar-link:hover svg { opacity: 0.9; }
.sidebar-link.active {
  background: var(--primary-tint);
  color: var(--primary);
  font-weight: 600;
}
.sidebar-link.active svg { opacity: 1; }
.sidebar-link.active::before {
  content: '';
  position: absolute; left: -0.45rem; top: 6px; bottom: 6px;
  width: 2px; border-radius: 2px;
  background: var(--primary);
}

.sidebar-footer { padding: 0.85rem 0.9rem; border-top: 1px solid var(--border-light); }
.sidebar-round-info {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0 0.5rem;
}
.sidebar-round-info .round-label {
  font-family: var(--font-mono);
  font-size: 0.58rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted); grid-column: 1 / -1;
}
.sidebar-round-info .round-value {
  color: var(--text); font-weight: 600; font-size: 1rem;
  font-family: var(--font-mono); margin-top: 0.15rem;
}
.sidebar-round-info .round-status { color: var(--muted); font-size: 0.7rem; margin-top: 0.15rem; text-align: right; }

/* ════════════════════════════════════════
   MAIN / FOOTER / PANELS
   ════════════════════════════════════════ */
#main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  min-height: calc(100vh - var(--topbar-height) - var(--footer-height));
  padding: 1.9rem 2.2rem calc(var(--footer-height) + 1.75rem);
  transition: margin-left var(--transition-slow);
}
#content { max-width: var(--content-max); margin: 0 auto; }

#app-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--footer-height);
  background: var(--ink);
  border-top: 1px solid var(--ink-line);
  color: var(--ink-text);
  display: flex; align-items: center; justify-content: center;
  padding: 0 1rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  z-index: var(--z-footer);
}

.panel { display: none; animation: fadeIn 0.28s ease; }
.panel.active { display: block; }
/* Entrada apenas com transform — sem opacity, para que print/captura nunca fiquem em branco */
@keyframes fadeIn { from { transform: translateY(6px); } to { transform: translateY(0); } }

/* Page header */
.page-header {
  margin-bottom: 1.6rem;
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--border);
}
.page-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.64rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.page-title {
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.15;
}
.page-title em {
  font-family: var(--font);
  font-style: normal;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}
.page-subtitle { color: var(--muted); font-size: 0.85rem; margin-top: 0.3rem; }
.page-actions { display: flex; gap: 0.5rem; align-items: center; flex-shrink: 0; }

/* Grids */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.4rem;
}
.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; margin-bottom: 1.1rem; }
.full-row { grid-column: 1 / -1; }

/* ════════════════════════════════════════
   CARD
   ════════════════════════════════════════ */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 0.95rem 1.3rem 0.85rem;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem; flex-wrap: wrap;
}
.card-title {
  font-size: 0.86rem; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 0.5rem;
  letter-spacing: -0.005em;
}
.card-title svg { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; }
.card-subtitle, .card-header .form-hint { font-size: 0.72rem; color: var(--muted); margin: 0; }
.card-body { padding: 1.3rem; }
.card-footer {
  padding: 0.7rem 1.3rem;
  border-top: 1px solid var(--border-light);
  background: var(--card-hover);
  font-size: 0.76rem; color: var(--muted);
}
.card-accent-gold { border-top: 2px solid var(--gold-light); }

/* ════════════════════════════════════════
   KPI CARD — sem listras, número em destaque
   ════════════════════════════════════════ */
.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.15rem 0.95rem;
  display: flex; flex-direction: column; gap: 0.3rem;
  position: relative;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.kpi-card:hover { border-color: var(--muted-light); box-shadow: var(--shadow); }

.kpi-label {
  font-family: var(--font-mono);
  font-size: 0.62rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.11em;
  color: var(--muted);
}
.kpi-value {
  font-size: 1.55rem; font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.kpi-value small { font-size: 0.85rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }

.kpi-delta {
  font-family: var(--font-mono);
  font-size: 0.68rem; font-weight: 500;
  display: inline-flex; align-items: center; gap: 0.28rem;
  width: fit-content;
  padding: 0.14rem 0.5rem;
  border-radius: var(--radius-full);
  margin-top: 0.1rem;
}
.kpi-delta.positive { color: var(--success); background: var(--success-light); }
.kpi-delta.negative { color: var(--danger); background: var(--danger-light); }
.kpi-delta.neutral  { color: var(--muted); background: var(--bg-alt); }

.kpi-card.kpi-clickable { cursor: pointer; }
.kpi-link-hint {
  font-family: var(--font-mono);
  margin-top: 0.2rem; font-size: 0.62rem;
  color: var(--primary-light);
  letter-spacing: 0.03em;
}

.kpi-section-title {
  font-family: var(--font-mono);
  font-size: 0.66rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--primary);
  margin: 0 0 0.8rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
}

/* ════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.5rem 1.05rem;
  border-radius: var(--radius-sm);
  font-size: 0.83rem; font-weight: 550;
  border: 1px solid transparent;
  transition: all var(--transition);
  line-height: 1.35;
  text-decoration: none; white-space: nowrap;
  letter-spacing: 0.005em;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-light); border-color: var(--primary-light); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #15603b; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #92291f; color: #fff; }

.btn-ghost { background: var(--card); color: var(--text-secondary); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); border-color: var(--muted-light); }

.btn-sm { padding: 0.32rem 0.75rem; font-size: 0.78rem; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-full { width: 100%; }

/* ════════════════════════════════════════
   BADGES / CHIPS
   ════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.22rem 0.6rem;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 0.62rem; font-weight: 500;
  letter-spacing: 0.07em; text-transform: uppercase;
  line-height: 1;
  border: 1px solid transparent;
}
.badge svg { width: 11px; height: 11px; }
.badge-default { background: var(--bg-alt); color: var(--text-secondary); }
.badge-primary { background: var(--primary-tint); color: var(--primary); border-color: rgba(35,46,125,0.14); }
.badge-success { background: var(--success-light); color: var(--success); border-color: rgba(30,122,77,0.16); }
.badge-warning { background: var(--warning-light); color: #7c5512; border-color: rgba(168,116,31,0.2); }
.badge-danger  { background: var(--danger-light); color: var(--danger); border-color: rgba(179,54,46,0.16); }
.badge-info    { background: var(--info-light); color: var(--info); border-color: rgba(43,108,176,0.16); }
.badge-gold    { background: rgba(232,194,122,0.16); color: #7c5512; border-color: rgba(168,116,31,0.25); }

/* ════════════════════════════════════════
   FORMS
   ════════════════════════════════════════ */
.form-group { margin-bottom: 1.05rem; }
.form-label {
  display: block;
  font-size: 0.78rem; font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  letter-spacing: 0.005em;
}
.form-label .hint { font-weight: 400; color: var(--muted-light); font-size: 0.72rem; }

.form-control, .form-select {
  display: block; width: 100%;
  padding: 0.52rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-size: 0.86rem; font-weight: 450;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none; -webkit-appearance: none;
}
input.form-control[type="number"] { font-family: var(--font-mono); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(58, 71, 168, 0.12);
}
.form-control:disabled { background: var(--bg); color: var(--muted); cursor: not-allowed; }
.form-select {
  padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236e7484' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-position: right 0.8rem center;
  background-repeat: no-repeat;
  cursor: pointer;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-hint { font-size: 0.72rem; color: var(--muted-light); margin-top: 0.3rem; line-height: 1.45; }

/* Range */
.range-wrapper { display: flex; flex-direction: column; gap: 0.4rem; }
.range-row { display: flex; align-items: center; gap: 0.75rem; }
.form-range {
  width: 100%; height: 4px;
  appearance: none; -webkit-appearance: none;
  background: var(--border);
  border-radius: var(--radius-full);
  outline: none; flex: 1;
}
.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--card);
  border: 1.5px solid var(--primary);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform var(--transition);
}
.form-range::-webkit-slider-thumb:hover { transform: scale(1.12); }
.form-range::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--card); border: 1.5px solid var(--primary);
  cursor: pointer;
}
.range-value {
  font-family: var(--font-mono);
  font-size: 0.8rem; font-weight: 600;
  color: var(--primary);
  min-width: 44px; text-align: right; flex-shrink: 0;
}

/* ════════════════════════════════════════
   TABS — segmented control
   ════════════════════════════════════════ */
.tab-bar {
  display: inline-flex;
  gap: 2px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  margin: 1rem 1.3rem 0;
  overflow-x: auto;
}
.tab-btn {
  background: transparent; border: none;
  padding: 0.42rem 1rem;
  font-size: 0.8rem; font-weight: 550;
  color: var(--muted);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  display: flex; align-items: center; gap: 0.42rem;
  transition: all var(--transition);
}
.tab-btn svg { width: 14px; height: 14px; opacity: 0.7; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.tab-btn.active svg { opacity: 1; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.22s ease; }

/* ════════════════════════════════════════
   TABLES
   ════════════════════════════════════════ */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
thead th {
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.6rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.11em;
  padding: 0.55rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 0.66rem 1rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--card-hover); }

.td-right { text-align: right; }
.td-center { text-align: center; }
.td-mono { font-family: var(--font-mono); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.td-bold { font-weight: 600; }
.td-muted { color: var(--muted); font-size: 0.78rem; }

/* DRE — demonstração financeira, hairlines e indentação */
.dre-table { border-collapse: collapse; width: 100%; font-size: 0.84rem; }
.dre-table th {
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.6rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.11em;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.dre-table th:last-child { text-align: right; }
.dre-table td { padding: 0.48rem 1rem; border-bottom: 1px solid var(--border-light); }
.dre-table tr.section-header td {
  font-family: var(--font-mono);
  font-size: 0.62rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.11em;
  color: var(--primary);
  padding-top: 1rem;
  border-bottom: 1px solid var(--border);
  background: transparent;
}
.dre-table tr.subtotal-row td { font-weight: 600; color: var(--text); background: var(--card-hover); }
.dre-table tr.total-row td { font-weight: 600; border-top: 1px solid var(--border); background: var(--card-hover); }
.dre-table .indent-1 td:first-child { padding-left: 2.1rem; color: var(--text-secondary); }
.dre-table .td-value {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.dre-table .positive { color: var(--success); }
.dre-table .negative { color: var(--danger); }
.dre-table .grand-total td {
  font-weight: 650; font-size: 0.92rem;
  border-top: 2px solid var(--text);
  border-bottom: none;
  background: transparent;
  padding-top: 0.7rem;
}
.dre-table .grand-total .td-value { font-size: 0.9rem; }

/* ════════════════════════════════════════
   ALERTS / PROGRESS / RANKING
   ════════════════════════════════════════ */
.alert {
  padding: 0.8rem 1.05rem;
  border-radius: var(--radius);
  font-size: 0.84rem;
  display: flex; align-items: flex-start; gap: 0.6rem;
  border: 1px solid transparent;
  line-height: 1.5;
}
.alert svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 0.1rem; }
.alert-info    { background: var(--info-light); color: #1d4f80; border-color: rgba(43,108,176,0.2); }
.alert-success { background: var(--success-light); color: #14532d; border-color: rgba(30,122,77,0.2); }
.alert-warning { background: var(--warning-light); color: #6b4a10; border-color: rgba(168,116,31,0.25); }
.alert-danger  { background: var(--danger-light); color: #7c241e; border-color: rgba(179,54,46,0.2); }

.progress { width: 100%; height: 5px; background: var(--bg-alt); border-radius: var(--radius-full); overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: var(--radius-full); transition: width 0.5s ease; }
.progress-bar.bar-success { background: var(--success); }
.progress-bar.bar-warning { background: var(--accent); }
.progress-bar.bar-danger  { background: var(--danger); }
.progress-bar.bar-gold    { background: var(--gold-light); }

/* Ranking */
.ranking-row {
  display: flex; align-items: center; gap: 0.9rem;
  padding: 0.8rem 1.3rem;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}
.ranking-row:last-child { border-bottom: none; }
.ranking-row:hover { background: var(--card-hover); }
.ranking-row.is-you { background: var(--primary-tint); }

.ranking-position {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-weight: 600; font-size: 0.74rem;
  flex-shrink: 0;
  background: var(--bg-alt); color: var(--muted);
  border: 1px solid var(--border);
}
.ranking-position.pos-1 { background: var(--ink); color: var(--accent-light); border-color: var(--ink); }
.ranking-position.pos-2 { background: var(--card); color: var(--text); border-color: var(--muted-light); }
.ranking-position.pos-3 { background: var(--card); color: var(--accent); border-color: rgba(168,116,31,0.4); }

.ranking-company { flex: 1; min-width: 0; }
.ranking-company-name { font-weight: 600; font-size: 0.86rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking-company-sub { font-size: 0.72rem; color: var(--muted); margin-top: 0.05rem; }
.ranking-value {
  font-family: var(--font-mono);
  font-weight: 600; font-size: 0.92rem;
  color: var(--text); text-align: right;
  font-variant-numeric: tabular-nums;
}
.ranking-value.positive { color: var(--success); }
.ranking-value.negative { color: var(--danger); }
.ranking-bar-container { width: 130px; flex-shrink: 0; }

/* ════════════════════════════════════════
   DECISÕES — projetos estratégicos + impacto
   ════════════════════════════════════════ */
.decisions-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1.1rem;
  align-items: start;
}

.projects-section { margin-top: 1.6rem; }
.projects-divider {
  display: flex; align-items: center; gap: 0.75rem;
  margin-bottom: 0.9rem;
}
.projects-divider::before, .projects-divider::after {
  content: ''; height: 1px; background: var(--border); flex: 1;
}
.projects-divider span {
  font-family: var(--font-mono);
  font-size: 0.62rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.13em;
  color: var(--muted);
}
.projects-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }

.project-card {
  display: flex; gap: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  cursor: pointer;
  background: var(--card);
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  position: relative;
}
.project-card:hover { border-color: var(--muted-light); }
.project-card:has(.project-check:checked) {
  border-color: var(--primary);
  background: var(--primary-tint);
  box-shadow: 0 0 0 1px var(--primary);
}
.project-check {
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px;
  border: 1.5px solid var(--muted-light);
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 0.15rem;
  cursor: pointer;
  position: relative;
  transition: all var(--transition);
  background: var(--card);
}
.project-check:checked { background: var(--primary); border-color: var(--primary); }
.project-check:checked::after {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='8' viewBox='0 0 10 8'%3E%3Cpath d='M1 4l2.5 2.5L9 1' stroke='white' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center no-repeat;
}
.project-body { min-width: 0; }
.project-name { font-size: 0.84rem; font-weight: 600; color: var(--text); line-height: 1.35; }
.project-desc { font-size: 0.74rem; color: var(--muted); line-height: 1.5; margin-top: 0.25rem; }
.project-meta {
  display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap;
  margin-top: 0.55rem;
}
.project-cost {
  font-family: var(--font-mono);
  font-size: 0.68rem; font-weight: 600;
  color: var(--text);
  background: var(--bg-alt);
  padding: 0.16rem 0.5rem;
  border-radius: var(--radius-full);
}
.project-effect {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--success);
}

/* Painel de efeitos estimados */
.impact-panel {
  position: sticky;
  top: calc(var(--topbar-height) + 1.25rem);
  background: var(--ink);
  border-radius: var(--radius-lg);
  border: 1px solid var(--ink);
  color: var(--ink-text);
  padding: 1.2rem 1.2rem 1rem;
  display: flex; flex-direction: column; gap: 1.05rem;
}
.impact-head { display: flex; flex-direction: column; gap: 0.15rem; }
.impact-title { font-size: 0.9rem; font-weight: 600; letter-spacing: -0.01em; }
.impact-sub { font-family: var(--font-mono); font-size: 0.62rem; color: var(--ink-dim); letter-spacing: 0.05em; }

.impact-kpi { display: flex; flex-direction: column; gap: 0.25rem; padding-top: 0.9rem; border-top: 1px solid var(--ink-line); }
.impact-kpi-label {
  font-family: var(--font-mono);
  font-size: 0.6rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--ink-dim);
  display: flex; align-items: center; gap: 0.4rem;
}
.impact-kpi-value {
  font-family: var(--font-mono);
  font-size: 1.2rem; font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink-text);
}
.impact-kpi-value.positive { color: #8fdcb4; }
.impact-kpi-value.negative { color: #eba39c; }
.impact-kpi-sub { font-size: 0.7rem; color: var(--ink-dim); line-height: 1.45; }

.impact-bar { height: 4px; background: rgba(255,255,255,0.12); border-radius: var(--radius-full); overflow: hidden; margin-top: 0.2rem; }
.impact-bar-fill { height: 100%; background: var(--accent-light); border-radius: var(--radius-full); transition: width 0.4s ease; }
.impact-bar-fill.over { background: #eba39c; }

.impact-cohere { padding-top: 0.9rem; border-top: 1px solid var(--ink-line); }
.impact-cohere-list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.55rem; }
.impact-cohere-list li {
  display: flex; align-items: flex-start; gap: 0.5rem;
  font-size: 0.74rem; line-height: 1.45; color: rgba(231, 235, 242, 0.85);
}
.impact-cohere-list li::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  margin-top: 0.36rem; flex-shrink: 0;
  background: var(--ink-dim);
}
.impact-cohere-list li.ok::before { background: #73d1a3; }
.impact-cohere-list li.warn::before { background: var(--accent-light); }
.impact-cohere-list li.bad::before { background: #e07a72; }

.impact-disclaimer {
  font-size: 0.66rem; color: var(--ink-dim);
  line-height: 1.5;
  padding-top: 0.9rem; border-top: 1px solid var(--ink-line);
}

.help-btn {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1px solid var(--ink-line);
  background: transparent;
  color: var(--ink-dim);
  font-size: 0.56rem; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.help-btn:hover { color: var(--ink-text); border-color: rgba(255,255,255,0.3); }

/* Snapshot da empresa (faixa acima do formulário) */
.snapshot-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  overflow: hidden;
  margin-bottom: 1.1rem;
}
.snapshot-cell {
  padding: 0.75rem 1.05rem;
  border-right: 1px solid var(--border-light);
  display: flex; flex-direction: column; gap: 0.15rem;
}
.snapshot-cell:last-child { border-right: none; }
.snapshot-cell .s-label {
  font-family: var(--font-mono);
  font-size: 0.58rem; text-transform: uppercase; letter-spacing: 0.11em;
  color: var(--muted);
}
.snapshot-cell .s-value {
  font-family: var(--font-mono);
  font-size: 0.92rem; font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.snapshot-cell .s-value.positive { color: var(--success); }
.snapshot-cell .s-value.negative { color: var(--danger); }

/* ════════════════════════════════════════
   BRIEFING — indicadores macro
   ════════════════════════════════════════ */
.macro-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.1rem;
}
.macro-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.95rem 1.1rem;
  display: flex; flex-direction: column; gap: 0.2rem;
}
.macro-card .m-label {
  font-family: var(--font-mono);
  font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.11em;
  color: var(--muted);
}
.macro-card .m-value {
  font-family: var(--font-mono);
  font-size: 1.3rem; font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.macro-card .m-trend {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  display: flex; align-items: center; gap: 0.3rem;
}
.macro-card .m-trend.up { color: var(--success); }
.macro-card .m-trend.down { color: var(--danger); }
.macro-card .m-trend.flat { color: var(--muted); }

.event-row {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.75rem 1.3rem;
  border-bottom: 1px solid var(--border-light);
}
.event-row:last-child { border-bottom: none; }
.event-prob {
  font-family: var(--font-mono);
  font-size: 0.78rem; font-weight: 600;
  color: var(--primary);
  min-width: 44px;
  font-variant-numeric: tabular-nums;
}
.event-name { flex: 1; font-size: 0.84rem; font-weight: 550; color: var(--text); }
.event-desc { font-size: 0.74rem; color: var(--muted); margin-top: 0.1rem; }

/* ════════════════════════════════════════
   ESTADOS / MODAL / TOAST
   ════════════════════════════════════════ */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 3rem 2rem; text-align: center; gap: 0.6rem; color: var(--muted);
}
.empty-state svg { width: 40px; height: 40px; opacity: 0.3; }
.empty-state h4 { font-size: 0.95rem; font-weight: 600; color: var(--text-secondary); }
.empty-state p { font-size: 0.82rem; max-width: 300px; line-height: 1.55; }

.loading-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3rem; gap: 1rem; color: var(--muted); }
.spinner { width: 30px; height: 30px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  .decisions-layout { grid-template-columns: 1fr; }
  .impact-panel { position: static; }
}
@media (max-width: 900px) {
  .charts-row { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .projects-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  #sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
  body.sidebar-open #sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
  #main-content { margin-left: 0; padding: 1.25rem 1rem calc(var(--footer-height) + 1rem); }
  .topbar-company, .topbar-username, .topbar-divider { display: none; }
  .form-row { grid-template-columns: 1fr; }
}

body.sidebar-collapsed #sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
body.sidebar-collapsed #main-content { margin-left: 0; }

/* Chart containers */
.chart-container { position: relative; height: 240px; }
.chart-container-lg { height: 320px; }
