:root {
  --bg: #f5f6f8; --surface: #ffffff; --surface2: #eef0f4;
  --border: #dde1e9; --text: #1a1d26; --muted: #6b7280;
  --accent: #2563eb; --accent-dim: #93c5fd; --green: #059669;
  --amber: #d97706; --red: #dc2626;
  --sidebar-w: 260px; --params-w: 340px; --topbar-h: 52px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
html, body, button, input, table, th, td, h1, h2, h3, h4 {
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
}
strong, b { font-weight: 500; }
body { background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; }

/* Top bar */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 0.75rem; z-index: 200;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 0.5rem; flex: 1; min-width: 0; }
.topbar-left { justify-content: flex-start; }
.topbar-right { justify-content: flex-end; }
.topbar-center {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; justify-content: center;
}
body.view-escenario .topbar-btn.modelo-only { visibility: hidden; pointer-events: none; }
.topbar-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border: none; background: transparent;
  color: var(--muted); border-radius: 8px; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.topbar-btn:hover { background: var(--surface2); color: var(--text); }
.topbar-btn.active { color: var(--accent); background: rgba(37, 99, 235, 0.08); }
.topbar-btn svg { width: 20px; height: 20px; }
.topbar-logo {
  display: inline-flex; align-items: center; gap: 0.35rem;
  text-decoration: none; color: var(--text); font-weight: 500; font-size: 0.95rem;
}
.topbar-logo-sub { color: var(--muted); font-weight: 400; }
.lang-dropdown { position: relative; }
.lang-dropdown-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  height: 36px; padding: 0 0.65rem; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); border-radius: 8px;
  cursor: pointer; font-size: 0.82rem; font-weight: 500; transition: all 0.15s;
}
.lang-dropdown-btn:hover { background: var(--surface2); border-color: #c8ced8; }
.lang-dropdown-btn svg { width: 14px; height: 14px; color: var(--muted); }
.lang-dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 148px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(26, 29, 38, 0.1); padding: 0.35rem;
  display: none; z-index: 300;
}
.lang-dropdown.open .lang-dropdown-menu { display: block; }
.lang-option {
  display: flex; align-items: center; gap: 0.5rem; width: 100%;
  padding: 0.5rem 0.65rem; border: none; background: transparent;
  color: var(--text); border-radius: 7px; cursor: pointer;
  font-size: 0.82rem; text-align: left; transition: background 0.15s;
}
.lang-option:hover { background: var(--surface2); }
.lang-option.active { background: rgba(37, 99, 235, 0.08); color: var(--accent); font-weight: 500; }

/* Sidebar izquierdo */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w); background: var(--bg);
  border-right: 1px solid var(--border); position: fixed;
  top: var(--topbar-h); left: 0; height: calc(100vh - var(--topbar-h));
  overflow-y: auto; display: flex; flex-direction: column; z-index: 100;
  transition: transform 0.22s ease;
}
body.sidebar-left-closed .sidebar { transform: translateX(-100%); }
nav { flex: 1; padding: 0.75rem 0; }
nav a { display: block; padding: 0.5rem 1rem; color: var(--muted); text-decoration: none; font-size: 0.82rem; transition: all 0.15s; }
nav a:hover, nav a.active { color: var(--text); background: rgba(0,0,0,0.04); }
nav a .num { color: var(--accent); font-weight: 500; margin-right: 0.4rem; }

/* Contenido central */
.main {
  margin-left: var(--sidebar-w); margin-right: var(--params-w);
  margin-top: var(--topbar-h);
  padding: 2rem 2.5rem 4rem; min-height: calc(100vh - var(--topbar-h));
  transition: margin 0.22s ease;
}
body.sidebar-left-closed .main { margin-left: 0; }
body.sidebar-right-closed .main { margin-right: 0; }
#app-modelo .main > * { max-width: 980px; width: 100%; margin-left: auto; margin-right: auto; }
section { margin-bottom: 96px; scroll-margin-top: calc(var(--topbar-h) + 1rem); }
