/* =============================================================================
   K-BOTANAS · Sidebar + Topbar (estilo Venta en Ruta)
   Requiere kb-design-system.css cargado antes que este archivo.
   ========================================================================== */

/* Layout global */
.kb-app {
  display: grid;
  grid-template-columns: var(--kb-sidebar-w) 1fr;
  min-height: 100vh;
}
@media (max-width: 880px) {
  .kb-app { grid-template-columns: 1fr; }
}

/* ============ SIDEBAR ============ */
.kb-sidebar {
  background: var(--kb-cream-soft);
  border-right: 1px solid var(--kb-line);
  display: flex; flex-direction: column;
  position: sticky; top: 0;
  height: 100vh;
  overflow: hidden;
}
@media (max-width: 880px) {
  .kb-sidebar {
    position: fixed; top: 0; left: 0;
    width: 260px; z-index: 200;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .kb-sidebar.is-open { transform: translateX(0); }
}

/* Logo / brand */
.kb-sb-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--kb-line);
  flex-shrink: 0;
}
.kb-sb-logo {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--kb-terracotta);
  color: var(--kb-cream);
  display: grid; place-items: center;
  font-family: var(--kb-font-display);
  font-weight: 600; font-size: 15px;
  flex-shrink: 0;
}
.kb-sb-brand-text { line-height: 1.2; min-width: 0; }
.kb-sb-brand-name {
  font-family: var(--kb-font-display);
  font-size: 16px;
  letter-spacing: -0.02em;
  color: var(--kb-ink);
  font-weight: 500;
}
.kb-sb-brand-sub {
  font-size: 10px;
  color: var(--kb-ink-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Sucursal */
.kb-sb-branch {
  padding: 12px 14px;
  border-bottom: 1px solid var(--kb-line);
  flex-shrink: 0;
}
.kb-sb-branch-label {
  font-size: 10px;
  color: var(--kb-ink-3);
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}
.kb-sb-branch-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 500;
  color: var(--kb-ink);
}
.kb-sb-branch-row svg { color: var(--kb-ink-3); flex-shrink: 0; }

/* Nav */
.kb-sb-nav {
  padding: 10px 8px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
.kb-sb-group { margin-bottom: 14px; }
.kb-sb-group-title {
  font-size: 10px;
  color: var(--kb-ink-4);
  letter-spacing: 0.1em;
  padding: 6px 10px;
  margin-top: 4px;
  font-weight: 500;
}

.kb-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--kb-ink-2);
  font-size: 13px;
  font-weight: 450;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s;
  border: none; background: none;
  font-family: inherit;
  width: 100%;
  text-align: left;
}
.kb-nav-item:hover { background: var(--kb-cream); }
.kb-nav-item.active {
  background: var(--kb-green-tint);
  color: var(--kb-green);
  font-weight: 600;
}
.kb-nav-item.active .kb-nav-icon { color: var(--kb-green); }
.kb-nav-item.disabled {
  cursor: default;
  opacity: .65;
}
.kb-nav-icon {
  width: 16px; height: 16px;
  color: var(--kb-ink-3);
  flex-shrink: 0;
}
.kb-nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-nav-badge {
  font-size: 10.5px;
  font-weight: 600;
  background: var(--kb-terracotta);
  color: #fbfaf5;
  padding: 1px 7px;
  border-radius: 999px;
  flex-shrink: 0;
}
.kb-nav-badge.soon {
  background: transparent;
  color: var(--kb-ink-4);
  border: 1px solid var(--kb-line-strong);
  padding: 0 5px;
  font-weight: 500;
  font-size: 9px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* Footer (user) */
.kb-sb-user {
  padding: 12px 14px;
  border-top: 1px solid var(--kb-line);
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.kb-sb-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--kb-green);
  color: #f4f1ea;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}
.kb-sb-user-meta { flex: 1; min-width: 0; }
.kb-sb-user-name { font-size: 12.5px; font-weight: 500; color: var(--kb-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-sb-user-role { font-size: 10.5px; color: var(--kb-ink-3); }
.kb-sb-logout {
  background: none; border: none;
  cursor: pointer;
  color: var(--kb-ink-4);
  padding: 4px;
  border-radius: 6px;
  display: grid; place-items: center;
  transition: background 0.12s, color 0.12s;
}
.kb-sb-logout:hover { background: var(--kb-cream); color: var(--kb-terracotta); }

/* ============ TOPBAR ============ */
.kb-topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--kb-line);
  background: var(--kb-paper);
  position: sticky; top: 0; z-index: 50;
}
.kb-topbar-mobile-btn {
  display: none;
  background: none; border: 1px solid var(--kb-line-strong);
  width: 36px; height: 36px;
  border-radius: 8px;
  cursor: pointer;
  align-items: center; justify-content: center;
  color: var(--kb-ink-2);
}
@media (max-width: 880px) {
  .kb-topbar-mobile-btn { display: inline-flex; }
}

.kb-topbar-title {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 10px;
}
.kb-topbar-title h1 {
  font-family: var(--kb-font-display);
  font-size: 22px;
  letter-spacing: -0.015em;
  font-weight: 500;
  color: var(--kb-ink);
}

.kb-topbar-search {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--kb-line);
  background: var(--kb-cream-soft);
  min-width: 220px;
}
.kb-topbar-search input {
  border: none; outline: none; background: transparent;
  font-size: 12.5px; color: var(--kb-ink);
  flex: 1;
  font-family: var(--kb-font-sans);
}
.kb-topbar-search input::placeholder { color: var(--kb-ink-4); }

.kb-topbar-bell {
  position: relative;
  background: none; border: 1px solid var(--kb-line);
  width: 36px; height: 36px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--kb-ink-2);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s;
}
.kb-topbar-bell:hover { background: var(--kb-cream-soft); }
.kb-topbar-bell-dot {
  position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px;
  background: var(--kb-terracotta);
  border-radius: 50%;
}

/* Mobile drawer overlay */
.kb-drawer-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(31,26,20,.5);
  backdrop-filter: blur(2px);
  z-index: 150;
}
.kb-drawer-overlay.is-open { display: block; }

/* Main wrapper */
.kb-main {
  min-width: 0;
  display: flex; flex-direction: column;
}
.kb-main-content {
  padding: 24px 28px 60px;
  flex: 1;
}
@media (max-width: 880px) {
  .kb-main-content { padding: 18px 16px 60px; }
}

/* Eyebrow */
.kb-eyebrow {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--kb-terracotta);
  font-weight: 600;
  margin-bottom: 8px;
}
