/* Application shell */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .2s var(--ease); }
.app.collapsed { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden;
  background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; z-index: 30;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px; height: var(--topbar-h); border-bottom: 1px solid rgba(255,255,255,.08); flex: none; }
.brand img, .brand .logo { width: 34px; height: 34px; border-radius: 8px; flex: none; object-fit: cover; }
.brand .logo { background: var(--royal-600); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; }
.brand-text { min-width: 0; }
.brand-text b { display: block; color: #fff; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { display: block; font-size: 11px; color: #8fa2c4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav { padding: 8px 10px 16px; flex: 1; }
.nav-group { margin-top: 12px; }
.nav-group-title { font-size: 11px; color: #7d8fb0; padding: 6px 10px; white-space: nowrap; overflow: hidden; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--r-md);
  color: var(--sidebar-text); font-size: 13.5px; text-decoration: none; white-space: nowrap; position: relative;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--sidebar-active); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #6f9bff; }
.nav a .count { margin-left: auto; background: var(--royal-600); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 7px; line-height: 18px; }
.app.collapsed .brand-text, .app.collapsed .nav-group-title, .app.collapsed .nav a span, .app.collapsed .nav a .count, .app.collapsed .sidebar-foot span { display: none; }
.app.collapsed .nav a { justify-content: center; }
.sidebar-foot { padding: 10px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 11px; color: #7d8fb0; display: flex; gap: 8px; align-items: center; }
.sidebar-foot svg { width: 14px; height: 14px; flex: none; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-5);
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar .icon-btn { flex: none; }
.global-search { position: relative; flex: 1; max-width: 460px; }
.global-search input { width: 100%; padding-left: 36px; background: var(--surface-2); border-color: transparent; }
.global-search input:focus { background: var(--surface); border-color: var(--accent); }
.global-search > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); max-height: 420px; overflow: auto; padding: 6px; }
.search-results .sr-group { font-size: 11px; color: var(--text-3); padding: 8px 10px 4px; }
.search-results button { display: flex; width: 100%; text-align: left; gap: 10px; align-items: center; padding: 8px 10px; border: 0; background: none; border-radius: var(--r-md); color: var(--text); cursor: pointer; font: inherit; }
.search-results button:hover, .search-results button:focus { background: var(--surface-2); }
.search-results button small { display: block; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }
.bell { position: relative; }
.bell .dot { position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--red); color: #fff; font-size: 10px; display: grid; place-items: center; font-weight: 600; }
.profile-btn { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); cursor: pointer; color: var(--text); font: inherit; }
.profile-btn .who { text-align: left; line-height: 1.2; }
.profile-btn .who b { display: block; font-size: 13px; }
.profile-btn .who small { font-size: 11px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; }

.content { padding: var(--sp-5) var(--sp-6) var(--sp-8); flex: 1; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-5); flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head .sub { color: var(--text-3); font-size: 13px; margin-top: 2px; }
.page-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.breadcrumb { font-size: 12px; color: var(--text-3); display: flex; gap: 6px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.breadcrumb a { color: var(--text-3); }
.breadcrumb svg { width: 12px; height: 12px; }

.footer { padding: 14px var(--sp-6); border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--surface); }

.demo-banner { background: var(--amber-bg); color: var(--amber); font-size: 12px; padding: 6px var(--sp-6); display: flex; gap: 8px; align-items: center; border-bottom: 1px solid #f1dcb3; }
.demo-banner svg { width: 14px; height: 14px; flex: none; }
.scrim { display: none; }
