/* ============================================================
   CloudVenix — Shell + page layout
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  transition: grid-template-columns var(--t) var(--ease);
}
.app.collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

/* ---------- Sidebar ---------- */
.sidebar {
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
  z-index: 40;
}
.sb-brand {
  display: flex; align-items: center; gap: 10px;
  height: var(--topbar-h); padding: 0 var(--sp-4);
  border-bottom: 1px solid var(--line);
  flex: none;
}
.sb-logo {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--primary), oklch(0.55 0.17 312));
  box-shadow: var(--sh-sm), inset 0 1px 0 rgba(255,255,255,0.25);
}
.sb-logo svg { width: 19px; height: 19px; color: #fff; }
.sb-word { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; }
.sb-word .v { color: var(--primary-text); }
.sb-tag { font-size: 9px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint); white-space: nowrap; }

.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: var(--sp-3) var(--sp-3) var(--sp-4); }
.sb-group-label { font-size: 9.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); padding: var(--sp-4) var(--sp-3) var(--sp-2); white-space: nowrap; }
.sb-item {
  display: flex; align-items: center; gap: 11px;
  height: 38px; padding: 0 11px; margin-bottom: 2px;
  border-radius: var(--r-sm);
  color: var(--text-2); font-size: var(--fs-sm); font-weight: 600;
  position: relative; white-space: nowrap; cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.sb-item svg { width: 18px; height: 18px; flex: none; }
.sb-item:hover { background: var(--surface-3); color: var(--text); }
.sb-item.on { background: var(--primary-soft); color: var(--primary-text); }
.sb-item.on::before { content: ''; position: absolute; left: -3px; top: 8px; bottom: 8px; width: 3px; border-radius: 99px; background: var(--primary); }
.sb-item .sb-count { margin-left: auto; font-family: var(--font-mono); font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 99px; background: var(--surface-3); color: var(--text-3); }
.sb-item.on .sb-count { background: color-mix(in oklch, var(--primary) 16%, transparent); color: var(--primary-text); }
.sb-item .sb-lock { margin-left: auto; opacity: 0.5; }

.collapsed .sb-word, .collapsed .sb-tag, .collapsed .sb-group-label,
.collapsed .sb-item span, .collapsed .sb-count, .collapsed .sb-lock,
.collapsed .sb-foot-meta { display: none; }
.collapsed .sb-brand { justify-content: center; padding: 0; }
.collapsed .sb-item { justify-content: center; padding: 0; }
.collapsed .sb-foot { justify-content: center; }

.sb-foot { display: flex; align-items: center; gap: 10px; padding: var(--sp-3); border-top: 1px solid var(--line); flex: none; }
.sb-foot-meta { min-width: 0; flex: 1; }
.sb-env { font-size: 10px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }

/* ---------- Topbar ---------- */
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow: hidden; background: var(--bg); }
.topbar {
  display: flex; align-items: center; gap: var(--sp-3);
  height: var(--topbar-h); padding: 0 var(--sp-5);
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--surface) 80%, transparent);
  backdrop-filter: blur(8px);
  flex: none; z-index: 30;
}
.topbar .tb-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar .tb-ico { width: 30px; height: 30px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex: none; }
.topbar .tb-ico svg { width: 17px; height: 17px; }
.topbar h2 { font-size: var(--fs-h2); font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.topbar .tb-crumb { font-size: var(--fs-xs); color: var(--text-faint); font-family: var(--font-mono); }

.iconbtn { width: 36px; height: 36px; border-radius: var(--r-sm); display: grid; place-items: center; color: var(--text-2); position: relative; transition: background var(--t-fast), color var(--t-fast); }
.iconbtn:hover { background: var(--surface-3); color: var(--text); }
.iconbtn svg { width: 18px; height: 18px; }
.iconbtn .ping { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--error); box-shadow: 0 0 0 2px var(--surface); }

/* user chip */
.userchip { display: flex; align-items: center; gap: 9px; padding: 4px 8px 4px 4px; border-radius: var(--r-full); cursor: pointer; transition: background var(--t-fast); border: 1px solid transparent; }
.userchip:hover { background: var(--surface-3); border-color: var(--border); }
.userchip .uc-meta { line-height: 1.15; text-align: left; }
.userchip .uc-name { font-size: var(--fs-xs); font-weight: 700; }
.userchip .uc-mail { font-size: 10px; color: var(--text-3); font-family: var(--font-mono); }

/* dropdown menu */
.menu { position: absolute; top: calc(100% + 6px); right: 0; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--sh-lg); padding: 6px; z-index: 100; animation: pop var(--t-fast) var(--ease); }
.menu-item { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: var(--r-xs); font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; width: 100%; }
.menu-item:hover { background: var(--surface-3); color: var(--text); }
.menu-item svg { width: 16px; height: 16px; }
.menu-item.danger { color: var(--error-text); }
.menu-item.danger:hover { background: var(--error-soft); }
.menu-sep { height: 1px; background: var(--line); margin: 5px 0; }
.menu-head { padding: 9px 10px 7px; }

/* theme toggle pill */
.theme-toggle { display: inline-flex; padding: 3px; background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--r-full); gap: 2px; }
.theme-toggle button { width: 30px; height: 26px; border-radius: 99px; display: grid; place-items: center; color: var(--text-3); transition: all var(--t-fast); }
.theme-toggle button svg { width: 15px; height: 15px; }
.theme-toggle button.on { background: var(--surface); color: var(--primary-text); box-shadow: var(--sh-xs); }

/* ---------- Page scroll area ---------- */
.page { flex: 1; overflow-y: auto; }
.page-in { max-width: 1320px; margin: 0 auto; padding: var(--sp-6) var(--sp-7) var(--sp-9); }
.page-in.wide { max-width: 1560px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-6); flex-wrap: wrap; }
.page-title { font-size: var(--fs-h1); font-weight: 800; letter-spacing: -0.02em; }
.page-sub { font-size: var(--fs-sm); color: var(--text-3); margin-top: 3px; }
.page-actions { display: flex; align-items: center; gap: var(--sp-3); }

.toolbar { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.searchbox { width: 280px; max-width: 100%; }

@media (max-width: 1100px) {
  .app { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }
  .app .sb-word, .app .sb-tag, .app .sb-group-label, .app .sb-item span, .app .sb-count, .app .sb-lock, .app .sb-foot-meta { display: none; }
  .app .sb-brand { justify-content: center; padding: 0; }
  .app .sb-item { justify-content: center; padding: 0; }
  .page-in { padding: var(--sp-5) var(--sp-4) var(--sp-8); }
}
