/* App shell: dark slate sidebar on desktop, slide-in drawer on phones. */
.shell { min-height: 100dvh; display: grid; grid-template-columns: var(--sidebar-w) 1fr; }

.sidebar {
  background: var(--ink);
  color: #d5dde5;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100dvh;
  padding: 1.1rem 0.8rem;
  gap: 0.25rem;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 0.7rem; padding: 0.25rem 0.5rem 1rem; color: #fff; text-decoration: none; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; background: var(--tag); color: var(--tag-ink);
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 1.15rem;
  clip-path: polygon(0 0, 78% 0, 100% 22%, 100% 100%, 0 100%); /* a price tag with a cut corner */
}
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; line-height: 1.15; overflow-wrap: anywhere; }
.brand-sub { font-size: 0.78rem; color: #9fb0c0; font-weight: 400; }

.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-group { margin: 0.9rem 0.6rem 0.3rem; font-size: 0.78rem; color: #8ea0b2; }
.nav-link {
  display: flex; align-items: center; gap: 0.8rem; min-height: 44px; padding: 0.55rem 0.7rem;
  border-radius: 10px; color: #d5dde5; text-decoration: none; font-weight: 550; position: relative;
}
.nav-link:hover { background: rgb(255 255 255 / 0.07); color: #fff; }
.nav-link.active { background: rgb(255 255 255 / 0.12); color: #fff; }
.nav-link.active::before {
  content: ""; position: absolute; left: -0.8rem; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--tag);
}
.sidebar-foot { border-top: 1px solid rgb(255 255 255 / 0.12); padding-top: 0.8rem; margin-top: 0.5rem; display: grid; gap: 0.35rem; }
.me { display: flex; align-items: center; gap: 0.7rem; padding: 0.3rem 0.5rem; color: #fff; text-decoration: none; border-radius: 10px; }
.me:hover { background: rgb(255 255 255 / 0.07); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--tag-soft); color: var(--tag-ink);
  display: grid; place-items: center; font-weight: 700; font-size: 0.85rem; flex: none;
}
.me-name { font-weight: 600; line-height: 1.2; }
.me-role { font-size: 0.8rem; color: #9fb0c0; }
.logout { width: 100%; background: none; border: 0; text-align: left; font-weight: 550; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.page { padding: 1.75rem clamp(1rem, 3vw, 2.5rem) 4rem; width: 100%; max-width: 1180px; }
.page-narrow { max-width: 720px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.page-head p { color: var(--ink-2); margin-top: 0.25rem; max-width: 60ch; }
.page-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--ink-2); text-decoration: none; font-weight: 550; margin-bottom: 0.6rem; }
.back:hover { color: var(--ink); }

.scrim { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw);
    transform: translateX(-102%); transition: transform 0.22s ease; box-shadow: var(--shadow-lift);
  }
  .shell[data-drawer-open-value="true"] .sidebar { transform: none; }
  .shell[data-drawer-open-value="true"] .scrim { display: block; position: fixed; inset: 0; background: rgb(24 34 46 / 0.5); z-index: 25; }
  .topbar {
    display: flex; align-items: center; gap: 0.75rem; position: sticky; top: 0; z-index: 20;
    background: var(--ink); color: #fff; padding: 0.5rem 0.8rem; min-height: 56px;
  }
  .topbar-title { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .icon-btn { width: 44px; height: 44px; border-radius: 10px; border: 0; background: rgb(255 255 255 / 0.1); color: #fff; display: grid; place-items: center; }
  .page { padding-top: 1.2rem; }
}

/* Sign-in and error pages */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem; background:
  radial-gradient(circle at 12% 8%, var(--tag-soft) 0 18%, transparent 18.2%),
  var(--canvas); }
.auth-card { width: min(100%, 420px); background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 2rem; }
.auth-card .brand { color: var(--ink); padding: 0 0 1.4rem; }
.auth-card .brand-sub { color: var(--ink-3); }
.auth-card h1 { margin-bottom: 0.3rem; }
.auth-card .lead { color: var(--ink-2); margin-bottom: 1.4rem; }

/* Business picker */
.auth-card:has(.biz-grid) { width: min(100%, 640px); }
.biz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.9rem; }
.biz-card {
  display: grid; gap: 0.2rem; justify-items: start; padding: 1.1rem; border: 1.5px solid var(--line-strong); border-radius: var(--radius-lg);
  text-decoration: none; color: var(--ink); background: var(--surface); transition: border-color 0.12s, box-shadow 0.12s, transform 0.08s;
}
.biz-card:hover { border-color: var(--ink); box-shadow: var(--shadow); text-decoration: none; }
.biz-card:active { transform: scale(0.98); }
.biz-card .brand-mark { margin-bottom: 0.6rem; }
.biz-name { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; line-height: 1.2; overflow-wrap: anywhere; }
.biz-role { color: var(--ink-3); font-size: 0.92rem; }

/* Hide / show the menu (desktop). The choice is kept per computer; when hidden, a slim rail keeps the button.
   Everything animates (0.25 s) so the menu glides away instead of vanishing. */
.menu-toggle {
  position: absolute; top: 1.35rem; right: 0.6rem; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px;
  background: rgb(255 255 255 / 0.08); color: #d5dde5; display: grid; place-items: center; z-index: 1;
  transition: right 0.25s ease, top 0.25s ease, width 0.25s ease, height 0.25s ease, background 0.12s;
}
.menu-toggle:hover { background: rgb(255 255 255 / 0.18); color: #fff; }
.menu-toggle span { display: grid; place-items: center; }
.menu-toggle .icon { display: block; width: 20px; height: 20px; }
.menu-toggle .when-hidden { display: none; }
.sidebar .brand { padding-right: 2.8rem; }

@media (min-width: 901px) {
  .shell { transition: grid-template-columns 0.25s ease; }
  .sidebar { transition: padding 0.25s ease; overflow: hidden; }
  /* Keep the menu at full width while it slides, so its text is clipped instead of re-wrapping. */
  .sidebar > :not(.menu-toggle) {
    width: calc(var(--sidebar-w) - 1.6rem); flex-shrink: 0;
    opacity: 1; visibility: visible; transition: opacity 0.18s ease 0.08s, visibility 0s;
  }
  html[data-menu="hidden"] .shell { grid-template-columns: 56px 1fr; }
  html[data-menu="hidden"] .sidebar { padding-left: 0.35rem; padding-right: 0.35rem; }
  html[data-menu="hidden"] .sidebar > :not(.menu-toggle) { opacity: 0; visibility: hidden; transition: opacity 0.12s ease, visibility 0s 0.12s; pointer-events: none; }
  html[data-menu="hidden"] .menu-toggle { right: 6px; top: calc(1.35rem - 3px); width: 44px; height: 44px; }
  html[data-menu="hidden"] .menu-toggle .when-open { display: none; }
  html[data-menu="hidden"] .menu-toggle .when-hidden { display: grid; }
}
@media (max-width: 900px) {
  .menu-toggle { display: none; }
  .sidebar .brand { padding-right: 0.5rem; }
}

.nav-badge { margin-left: auto; background: var(--tag); color: var(--tag-ink); font-weight: 800; font-size: 0.82rem; min-width: 24px; padding: 0 0.45rem; text-align: center; border-radius: 999px; }
