/* App shell for the customer portal (/app) and admin (/admin): sidebar + topbar + content. */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 16px 12px;
  border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 700; font-size: 16px;
  letter-spacing: -.01em; color: var(--ink); text-decoration: none !important; }
.side .brand img { width: 30px; height: 30px; }
.side .brand small { display: block; font: 600 10.5px/1 var(--mono); color: var(--mute); letter-spacing: .08em; text-transform: uppercase; margin-top: 3px; }
.side .group { font: 600 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); padding: 16px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border-radius: var(--r-sm);
  color: var(--ink-2); font-weight: 500; font-size: 14px; text-decoration: none !important; position: relative; }
.nav-item svg { width: 18px; height: 18px; flex: none; color: var(--mute); }
.nav-item:hover { background: var(--sunken); color: var(--ink); }
.nav-item.is-active { background: var(--sunken); color: var(--ink); font-weight: 600; }
.nav-item.is-active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.nav-item.is-active svg { color: var(--ink); }
.nav-item .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--brand);
  color: #fff; font: 700 11px/20px var(--font); text-align: center; }
.side .foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.credit-box { padding: 14px; border-radius: var(--r); background: var(--night); color: #e9edf1; margin: 8px 0 12px;
  background-image: linear-gradient(var(--night-line) 1px, transparent 1px), linear-gradient(90deg, var(--night-line) 1px, transparent 1px);
  background-size: 16px 16px; }
.credit-box .k { font-size: 12px; color: #9aa7b4; }
.credit-box .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.credit-box .btn { margin-top: 10px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 28px;
  background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topbar .crumbs { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--mute); min-width: 0; }
.topbar .crumbs b { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .menu-btn { display: none; }
.content { padding: 28px 32px; max-width: none; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 26px; letter-spacing: -.02em; }
.page-head p { color: var(--mute); margin-top: 4px; font-size: 14.5px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpis .card { padding: 18px 20px; }
.user-menu { position: relative; }
.user-menu > button { display: flex; align-items: center; gap: 10px; border: 1px solid transparent; background: none; padding: 4px 8px 4px 4px;
  border-radius: 999px; cursor: pointer; color: var(--ink); font: 600 14px var(--font); }
.user-menu > button:hover { background: var(--sunken); }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--sh-3); padding: 6px; z-index: 40; }
.menu-pop a, .menu-pop button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm);
  border: 0; background: none; font: 500 14px var(--font); color: var(--ink-2); cursor: pointer; text-decoration: none !important; text-align: left; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--sunken); color: var(--ink); }
.menu-pop svg { width: 16px; height: 16px; }
.menu-pop .sep { height: 1px; background: var(--line); margin: 6px 0; }
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--mute); }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 70; left: 0; width: 270px; transform: translateX(-100%); transition: transform .22s var(--ease); box-shadow: var(--sh-3); }
  .shell.nav-open .side { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(10,14,19,.4); z-index: 60; }
  .topbar { padding: 0 16px; } .topbar .menu-btn { display: inline-flex; }
  .content { padding: 20px 16px; }
}
@media (max-width: 520px) { .kpis { grid-template-columns: 1fr 1fr; gap: 10px; } .kpis .card { padding: 14px; } .stat .v { font-size: 21px; } }
