/* App shell: sidebar, top bar, page grid. Reused by dash and seller. */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  background: var(--sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 22px 14px;
}
.brand { display: block; padding: 0 8px 22px; }
.logo { display: block; height: auto; }
.brand .logo { width: 150px; }
.brand-word { font-weight: 800; font-size: 26px; color: var(--green-900); letter-spacing: -.03em; }
.nav { display: grid; gap: 4px; position: relative; z-index: 1; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-radius: 12px; color: var(--text); font-weight: 500;
}
.nav a:hover { background: var(--sage-100); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--sage-200); font-weight: 700; color: var(--green-900); }
.nav svg { width: 20px; height: 20px; flex: none; }
.sidebar-art { position: absolute; left: -40px; bottom: -60px; width: 300px; height: 220px; pointer-events: none; }

.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 12px 28px; background: rgba(248, 243, 235, .78);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.icon-btn.menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 640px; }
.search input {
  width: 100%; height: 44px; padding: 0 14px 0 42px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--card); font: inherit; color: var(--text);
}
.search > svg { position: absolute; left: 14px; top: 12px; width: 18px; height: 18px; color: var(--muted); }
.search-results {
  position: absolute; top: 50px; left: 0; right: 0; z-index: 30; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  max-height: 70vh; overflow: auto; padding: 8px;
}
.search-results:empty { display: none; }
.topbar-spacer { flex: 1; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--card);
}
.icon-btn svg { width: 20px; height: 20px; }
.dot { position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--orange); border: 2px solid var(--card); }
.avatar {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--green-900); color: #fff; font-weight: 700; border: 0;
}
.menu { position: relative; }
.menu-panel {
  position: absolute; right: 0; top: 52px; min-width: 240px; z-index: 30; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 8px;
}
.menu-panel a, .menu-panel button {
  display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none;
  border-radius: 10px; color: var(--text);
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--sage-100); text-decoration: none; }
.menu-head { padding: 10px 12px; color: var(--muted); font-size: 13px; }

.page { padding: 8px 28px 48px; max-width: 1480px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 10px 0 20px; }
.page-head h1 { font-size: 30px; font-weight: 800; color: var(--green-900); }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.grid { display: grid; gap: 18px; }
.kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.row-2 { grid-template-columns: 1.7fr 1fr; margin-top: 18px; }
.row-eq { grid-template-columns: 1fr 1fr; margin-top: 18px; }

.scrim { display: none; }

@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .row-2, .row-eq { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 60; inset: 0 auto 0 0; width: 280px; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: var(--shadow-lg);
  }
  .shell[data-nav-open="true"] .sidebar { transform: none; }
  .shell[data-nav-open="true"] .scrim { display: block; position: fixed; inset: 0; z-index: 50; background: rgba(10, 30, 20, .35); }
  .icon-btn.menu-btn { display: inline-grid; }
  .topbar, .page { padding-left: 16px; padding-right: 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-head h1 { font-size: 24px; }
}
@media (max-width: 480px) { .kpis { grid-template-columns: 1fr; } }

/* Bottom tab bar + floating action button (phones). Optional: enabled when a view passes bottom_nav. */
.tabbar, .fab { display: none; }
@media (max-width: 860px) {
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--card); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { display: grid; justify-items: center; gap: 2px; padding: 8px 2px 7px; min-height: 56px; color: var(--muted); font-size: 11px; font-weight: 600; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--green-900); }
  .tabbar a[aria-current="page"] svg { background: var(--sage-200); border-radius: 12px; padding: 3px 14px; width: 54px; box-sizing: content-box; height: 22px; }
  .fab {
    display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(74px + env(safe-area-inset-bottom)); z-index: 41;
    width: 56px; height: 56px; border-radius: 50%; background: var(--green-700); color: #fff; box-shadow: var(--shadow-lg);
  }
  .fab:hover { text-decoration: none; background: var(--green-900); }
  .page.has-tabbar { padding-bottom: 96px; }
  .sidebar-hide-mobile { display: none; }
}

/* Phones: 44px minimum tap targets, 16px inputs (no iOS zoom) and single-column forms. */
@media (max-width: 860px) {
  .btn, .btn.sm, .icon-btn, .tab, .pager .btn, .menu-panel a, .menu-panel button { min-height: 44px; }
  .input, .select, .textarea { min-height: 48px; font-size: 16px; }
  .check-pill, .pw-toggle { min-height: 44px; }
}
@media (max-width: 560px) {
  .form-cols, .cols-2, .filter-grid, .review-grid { grid-template-columns: 1fr !important; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .btn { width: 100%; }
}
