/* ============================================================
   NODO Engine — Layout: Topbar, Sidebar, Shell
   ============================================================ */

/* ── APP SHELL ── */
.screen { display: none; width: 100%; height: 100%; }
.screen.active { display: flex; flex-direction: column; }

/* ── TOPBAR ── */
.topbar {
  height: 58px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 28px; gap: 14px;
  flex-shrink: 0; z-index: 50;
}
.tb-logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.tb-logo-icon {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--orange), var(--orange-light));
  border-radius: 7px; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--glow-sm);
}
.tb-logo-text span { color: var(--orange); }
.tb-spacer { flex: 1; }
.tb-actions { display: flex; align-items: center; gap: 10px; }

/* ── TENANT BAR ── */
.tenant-bar {
  height: 44px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  flex-shrink: 0;
}
.tb-back {
  display: flex; align-items: center; gap: 8px;
  padding: 0 20px; height: 100%;
  border-right: 1px solid var(--border);
  color: var(--text2); font-size: 12px;
  cursor: pointer; transition: .15s; white-space: nowrap;
}
.tb-back:hover { color: var(--orange); background: rgba(255,140,0,.04); }
.tb-tenant-info { display: flex; align-items: center; gap: 12px; padding: 0 20px; }
.tb-tenant-name { font-weight: 600; font-size: 13px; }
.tb-tenant-ruc  { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text3); }
.tb-sep         { width: 1px; height: 16px; background: var(--border); }
.tb-env {
  display: flex; align-items: center; gap: 6px;
  background: var(--yellow-bg); border: 1px solid rgba(255,200,87,.2);
  border-radius: 20px; padding: 3px 12px;
  font-size: 11px; font-weight: 600; color: var(--yellow); margin-right: 16px;
}
.tb-env.prod { background: var(--green-bg); border-color: rgba(0,196,140,.2); color: var(--green); }

/* ── PANEL BODY ── */
.panel-body { display: flex; flex: 1; overflow: hidden; }

/* ── SIDEBAR ── */
.sidebar {
  width: 232px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto; flex-shrink: 0;
  padding: 12px 0 20px;
}
.sb-section { margin-bottom: 4px; }
.sb-lbl {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .10em;
  color: var(--text3); padding: 10px 18px 5px;
}
.nav {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; color: var(--text2); cursor: pointer;
  border-left: 2px solid transparent;
  font-size: 13px; font-weight: 400; transition: .14s;
}
.nav:hover { color: var(--text); background: rgba(128,128,128,.05); }
.nav.on {
  color: var(--orange); background: rgba(255,140,0,.07);
  border-left-color: var(--orange); font-weight: 500;
}
.nav.on svg { opacity: 1; }
.nav svg { opacity: .6; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; background: var(--red-bg); color: var(--red);
  font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 10px;
  border: 1px solid rgba(255,77,77,.2);
}
.nav-badge.o { background: rgba(255,140,0,.12); color: var(--orange); border-color: rgba(255,140,0,.2); }

/* ── MAIN ── */
.main { flex: 1; overflow-y: auto; background: var(--bg); display: flex; flex-direction: column; }
.pg  { display: none; flex-direction: column; padding: 28px 32px; flex: 1; }
.pg.on { display: flex; }
.ph { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 26px; }
.ph-title { font-size: 21px; font-weight: 700; }
.ph-sub   { color: var(--text2); font-size: 13px; margin-top: 3px; }
.ph-right { display: flex; gap: 9px; align-items: center; }

/* ── EMPRESA GRID ── */
.emp-body  { flex: 1; overflow-y: auto; padding: 36px 40px; }
.emp-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 32px; }
.emp-title  { font-size: 24px; font-weight: 700; }
.emp-sub    { color: var(--text2); font-size: 13px; margin-top: 4px; }
.emp-grid   { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }

.emp-card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 10px; padding: 22px; cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .15s;
  position: relative; overflow: hidden;
}
.emp-card:hover {
  border-color: rgba(255,140,0,.35);
  box-shadow: 0 0 24px rgba(255,140,0,.09);
  transform: translateY(-2px);
}
.emp-card-glow {
  position: absolute; top: 0; right: 0; width: 100px; height: 100px;
  background: radial-gradient(circle, rgba(255,140,0,.07) 0%, transparent 70%);
  pointer-events: none;
}
.emp-card-top  { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.emp-avatar    { width: 46px; height: 46px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px; color: #000; flex-shrink: 0; }
.emp-avatar img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
.emp-info      { flex: 1; margin-left: 14px; }
.emp-name      { font-weight: 600; font-size: 15px; line-height: 1.3; margin-bottom: 4px; }
.emp-ruc       { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text3); }
.emp-stats     { display: grid; grid-template-columns: 1fr 1fr 1fr; border-top: 1px solid var(--border); padding-top: 16px; }
.emp-stat      { text-align: center; padding: 0 8px; }
.emp-stat:not(:last-child) { border-right: 1px solid var(--border); }
.emp-stat-val  { font-weight: 700; font-size: 18px; line-height: 1; }
.emp-stat-lbl  { font-size: 10px; color: var(--text3); margin-top: 3px; text-transform: uppercase; letter-spacing: .04em; }
.emp-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.emp-last      { font-size: 11px; color: var(--text3); }

/* ── LOGIN SCREEN ── */
#scr-login {
  background: var(--bg);
  align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.l-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--login-bg-grid) 1px, transparent 1px),
                    linear-gradient(90deg, var(--login-bg-grid) 1px, transparent 1px);
  background-size: 56px 56px; pointer-events: none;
}
.l-glow {
  position: absolute; width: 600px; height: 600px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,140,0,.08) 0%, transparent 65%);
  top: 50%; left: 50%; transform: translate(-50%, -50%); pointer-events: none;
}
.l-card {
  position: relative; z-index: 1;
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: 14px; padding: 48px 44px; width: 420px;
  box-shadow: var(--shadow-lg), var(--card-inset);
}
.l-logo     { display: flex; align-items: center; gap: 12px; margin-bottom: 36px; }
.l-logo-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--orange), var(--orange-light));
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--glow);
}
.l-logo-name  { font-size: 20px; font-weight: 700; line-height: 1; }
.l-logo-name span { color: var(--orange); }
.l-logo-sub   { font-size: 11px; color: var(--text3); margin-top: 3px; }
.l-title      { font-size: 22px; font-weight: 700; margin-bottom: 5px; }
.l-desc       { font-size: 13px; color: var(--text2); margin-bottom: 28px; }
.l-row        { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 22px; }
.chk          { display: flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13px; color: var(--text2); }
.chk input    { accent-color: var(--orange); width: 13px; height: 13px; }
.link-o       { color: var(--orange); font-size: 13px; }
.btn-login {
  width: 100%;
  background: linear-gradient(90deg, var(--orange), var(--orange-light));
  color: #000; font-weight: 700; font-size: 14px;
  padding: 13px; border-radius: 6px; letter-spacing: .02em;
  transition: box-shadow .2s, transform .1s;
}
.btn-login:hover  { box-shadow: var(--glow); transform: translateY(-1px); }
.btn-login:active { transform: translateY(0); }
.l-foot { text-align: center; margin-top: 26px; color: var(--text3); font-size: 11px; }

/* ── LOGIN TOPBAR (theme toggle only) ── */
.login-topbar {
  position: absolute; top: 20px; right: 20px; z-index: 10;
  display: flex; gap: 8px;
}
