/* ==========================================================================
 * 02-estructura.css · parte 2/11 — Estructura principal y cabecera de empresa
 * Orden de carga obligatorio (reproduce la cascada del styles.css original).
 * No reordenar los <link> ni mover reglas entre partes sin revisar la cascada.
 * ========================================================================== */

/* ── Estructura principal ─────────────────────────────────────── */
.app-shell { min-height: 100vh; }
.topbar { position: fixed; top: 0; right: 0; left: 0; z-index: 20; display: flex; height: var(--topbar-height); align-items: center; background: var(--topbar); color: #fff; }
.brand-area { display: flex; width: var(--sidebar-width); height: 100%; flex: 0 0 var(--sidebar-width); align-items: center; justify-content: space-between; padding: 0 12px 0 24px; border-right: 1px solid #334155; }
.brand-lockup { display: flex; align-items: center; gap: 8px; min-width: 0; color: #fff; }
.brand-lockup strong { overflow: hidden; font-size: 16px; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }
.brand-mark, .cifra-symbol { color: var(--accent); }
.topbar .brand-mark { color: var(--accent-light); }
.brand-mark { display: block; width: 20px; height: 20px; flex: 0 0 auto; }
.collapse-button, .settings-button { display: inline-grid; width: 25px; height: 25px; place-items: center; border: 0; border-radius: 3px; background: transparent; color: var(--muted-2); }
.collapse-button:hover, .settings-button:hover { background: #334155; color: #fff; }
.collapse-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }
.search-wrap { position: relative; display: flex; width: min(685px, 48vw); height: 48px; align-items: center; margin-left: 16px; border-radius: 8px; background: var(--surface); color: #8c949c; }
.search-wrap > svg { width: 20px; height: 20px; margin-left: 15px; fill: none; stroke: #6a7784; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.search-wrap input { width: 100%; height: 100%; border: 0; outline: 0; padding: 0 12px 0 9px; border-radius: inherit; background: transparent; color: var(--ink); font-size: 16px; font-weight: 600; }
.search-wrap input::placeholder { color: #9ba1a7; opacity: 1; }
.search-shortcut { display: grid; width: 40px; height: 100%; place-items: center; color: #65717c; font-size: 21px; }
.search-results { position: absolute; top: 52px; right: 0; left: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); box-shadow: 0 8px 22px rgba(0,0,0,.18); color: var(--ink); }
.search-result { display: flex; align-items: center; justify-content: flex-start; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); font-size: 13px; width: 100%; border-left: 0; border-right: 0; border-top: 0; background: transparent; text-align: left; }
.search-result:last-child { border-bottom: 0; }
.search-result:hover { background: var(--accent-faint); }
.search-result strong { margin-left: auto; color: var(--accent-dark); font-size: 12px; }
.search-result span { color: var(--muted); }
.search-result-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result-pf-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  color: var(--info-text);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 6px;
}
.search-result-logo { width: 24px; height: 24px; flex: 0 0 24px; border-radius: 4px; object-fit: cover; }
.search-result-logo-fallback { display: grid; place-items: center; background: var(--surface-3); color: #8c949c; font-size: 11px; font-weight: 700; }
.search-empty { padding: 11px 14px; color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 11px; margin-left: auto; padding: 0 14px 0 12px; }
.promo-button { min-height: 36px; padding: 0 16px; border: 0; border-radius: 9px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 700; white-space: nowrap; }
.promo-button:hover { background: #6366f1; }
.ghost-button { min-height: 36px; padding: 0 14px; border: 1px solid #475569; border-radius: 9px; background: transparent; color: #fff; font-size: 13px; font-weight: 700; white-space: nowrap; }
.ghost-button:hover { background: #334155; color: #fff; }
.user-chip { display: flex; min-height: 38px; align-items: center; gap: 9px; padding: 0 9px 0 5px; border-radius: 9px; background: #334155; }
.user-avatar { display: grid; width: 27px; height: 27px; flex: 0 0 27px; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; font-size: 9px; font-weight: 700; text-transform: uppercase; }
.user-email { max-width: 150px; overflow: hidden; color: #ddd; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.user-logout { border: 0; background: transparent; color: #a8a8a8; font-size: 17px; line-height: 1; }
.user-logout:hover { color: #fff; }
.settings-button { width: 30px; height: 30px; color: var(--accent-light); }
.settings-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.sidebar { position: fixed; top: var(--topbar-height); bottom: 0; left: 0; z-index: 15; display: flex; width: var(--sidebar-width); flex-direction: column; overflow: hidden auto; border-right: 1px solid var(--line); background: var(--surface-2); transition: width .2s ease, transform .2s ease; }
.main-nav { padding: 10px 11px 20px; }
.nav-link { display: flex; min-height: 31px; align-items: center; gap: 11px; overflow: hidden; padding: 0 12px; border-radius: 8px; color: var(--ink-2); font-size: 13.5px; white-space: nowrap; }
.nav-link:hover { background: var(--surface-3); color: #131313; }
.nav-link.active { background: var(--accent-soft); color: var(--accent-dark); }
.nav-link svg { width: 16px; height: 16px; flex: 0 0 16px; fill: none; stroke: #68727a; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.55; }
.nav-link.active svg { stroke: var(--accent); }
.nav-link > span { overflow: hidden; text-overflow: ellipsis; }
.nav-section { margin-top: 13px; }
.nav-section-title { display: flex; align-items: center; gap: 5px; padding: 0 13px 6px; color: #81868b; font-size: 12px; }
.nav-section-title span { font-size: 14px; }
.new-badge { margin-left: auto; padding: 3px 6px; border: 1px solid var(--accent-light); border-radius: 10px; color: var(--accent); font-size: 9px; font-weight: 700; }
.nav-arrow { margin-left: auto; color: #70767c; font-size: 20px; font-style: normal; line-height: 1; }
.sidebar-footer { margin-top: auto; padding: 10px 12px; border-top: 1px solid #ddd; display: flex; flex-direction: column; gap: 8px; }

/* Cabecera de la empresa dentro del menú lateral */
.company-nav-head { display: flex; align-items: center; gap: 9px; margin: 16px 11px 2px; padding: 8px 9px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 8px; background: var(--surface-3); }
.company-nav-logo { display: grid; width: 30px; height: 30px; flex: 0 0 30px; place-items: center; border-radius: 6px; background: var(--accent-soft); color: var(--accent-dark); font-size: 13px; font-weight: 700; }
.company-nav-copy { min-width: 0; flex: 1; }
.company-nav-copy strong { display: block; overflow: hidden; color: var(--ink-2); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.company-nav-copy small { display: block; margin-top: 1px; color: var(--muted-2); font-size: 9.5px; }
.app-shell.sidebar-collapsed .company-nav-head { display: none; }
.account-card { display: flex; align-items: center; gap: 9px; }
.avatar { display: grid; width: 29px; height: 29px; flex: 0 0 29px; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; font-size: 9px; font-weight: 700; }
.account-card div { min-width: 0; flex: 1; }
.account-card strong, .account-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-card strong { font-size: 11px; }
.account-card small { margin-top: 2px; color: var(--soft-muted); font-size: 10px; }
.account-card button { border: 0; background: transparent; color: #929292; font-size: 14px; }
.account-action { color: var(--accent-dark) !important; font-size: 12px !important; font-weight: 700; }
.account-action:hover { color: var(--accent-ink) !important; }
.sidebar-legal-links { display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 2px 2px 0; font-size: 10px; }
.sidebar-legal-links a { color: var(--soft-muted); text-decoration: none; }
.sidebar-legal-links a:hover { color: var(--accent-dark); text-decoration: underline; }
.backdrop { display: none; }

.main-content { min-height: 100vh; margin-left: var(--sidebar-width); padding-top: var(--topbar-height); background: var(--surface); transition: margin-left .2s ease; }
.content-wrap { max-width: 1700px; margin: 0 auto; }
