/* ---------- App shell: sidebar + header + content ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--night);
  color: #cfe3e0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  padding: 20px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; color: #fff; text-decoration: none; }
.brand:hover { text-decoration: none; color: #fff; }
.brand-mark { width: 34px; height: 34px; flex-shrink: 0; }
.brand-word { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; letter-spacing: -.02em; }
.brand-word .denta { color: #fff; }
.brand-word .flow { color: #7fd3c9; font-weight: 400; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r);
  color: #b9d1cd; font-weight: 500; text-decoration: none;
}
.nav a:hover { background: var(--night-2); color: #fff; }
.nav a.active { background: #1c4b51; color: #fff; box-shadow: inset 3px 0 0 #7fd3c9; }
.nav-group { margin-top: 18px; padding: 0 12px 6px; font-size: .78rem; color: #6f9590; }

.sidebar-foot { margin-top: auto; padding: 12px; border-top: 1px solid #1d4248; font-size: .8rem; color: #6f9590; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--header-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.clinic-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.clinic-logo { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); }
.clinic-monogram {
  width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center;
  background: var(--teal-tint); color: var(--teal-deep); font-family: var(--font-display); font-weight: 600;
}
.clinic-name { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clinic-sub { font-size: .8rem; color: var(--muted); }
.topbar-search { margin-left: auto; position: relative; width: min(340px, 34vw); }
.topbar-search input { padding-left: 38px; background: var(--enamel); }
.topbar-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border-radius: 999px; border: 1px solid var(--line); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--night); color: #fff; font-size: .78rem; font-weight: 600;
}
.user-meta { line-height: 1.2; }
.user-meta b { font-size: .88rem; font-weight: 600; display: block; }
.user-meta span { font-size: .75rem; color: var(--muted); }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  color: var(--ink-soft); background: transparent; border: 0; cursor: pointer;
}
.icon-btn:hover { background: var(--grey-tint); color: var(--ink); }
.menu-toggle, .search-link { display: none; }

.content { padding: 28px; width: 100%; max-width: 1320px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

.footer { margin-top: auto; padding: 18px 28px; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 50;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-pop); }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(13, 43, 48, .4); z-index: 40; }
  .menu-toggle, .search-link { display: inline-grid; }
  .search-link { margin-left: auto; }
  .topbar { padding: 0 14px; gap: 10px; }
  .clinic-sub { display: none; }
  .topbar-search, .user-meta { display: none; }
  .content { padding: 18px 14px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
