/* ============================================
   WCorp — Overlays (modals, drawers, command palette)
   ============================================ */

.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: color-mix(in oklab, var(--bg) 70%, transparent);
  backdrop-filter: blur(6px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 12vh;
  animation: ov-fade 0.16s ease;
}
.overlay[data-side="right"] { padding: 0; align-items: stretch; justify-content: flex-end; }
.overlay[data-center="true"] { align-items: center; padding-top: 0; }
@keyframes ov-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Command palette ---------- */
.cmdk {
  width: 640px; max-width: 92vw;
  background: var(--bg-1); border: 1px solid var(--line-strong);
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 32px 80px -24px rgb(0 0 0 / 0.6), 0 0 0 1px var(--line) inset;
  display: flex; flex-direction: column;
  animation: cmdk-pop 0.16s ease;
}
@keyframes cmdk-pop { from { transform: translateY(-8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.cmdk-search {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}

.cmdk-list {
  max-height: 420px; overflow-y: auto; padding: 6px;
}

.cmdk-item {
  display: grid; grid-template-columns: 28px 1fr auto auto; gap: 12px;
  align-items: center; width: 100%;
  padding: 10px 12px; border-radius: 8px;
  background: transparent; border: 0; color: var(--fg);
  font-family: var(--font-sans); font-size: 14px;
  text-align: left; cursor: pointer;
}
.cmdk-item[data-active="true"] { background: var(--accent-soft); }
.cmdk-icon {
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--bg-2); display: grid; place-items: center;
  color: var(--fg-2);
}
.cmdk-item[data-active="true"] .cmdk-icon { background: var(--accent); color: var(--accent-fg); }
.cmdk-label { font-weight: 500; }
.cmdk-sub { color: var(--fg-3); font-size: 12px; font-family: var(--font-mono); }
.cmdk-kind {
  font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--fg-3);
  padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px;
}

.cmdk-foot {
  display: flex; gap: 16px; align-items: center;
  padding: 10px 16px; border-top: 1px solid var(--line);
  background: var(--bg-2);
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-2);
}
.cmdk-foot .kbd {
  display: inline-block; padding: 1px 6px; margin-right: 4px;
  background: var(--bg-1); border: 1px solid var(--line); border-radius: 4px;
  font-family: var(--font-mono); font-size: 10px; color: var(--fg-1);
}

/* ---------- Drawer (notifications) ---------- */
.drawer {
  width: 440px; max-width: 96vw; height: 100vh;
  background: var(--bg-1); border-left: 1px solid var(--line-strong);
  display: flex; flex-direction: column;
  box-shadow: -32px 0 80px -24px rgb(0 0 0 / 0.5);
  animation: drawer-slide 0.22s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes drawer-slide { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.drawer-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 24px 24px 18px; border-bottom: 1px solid var(--line);
}
.drawer-body { flex: 1; overflow-y: auto; padding: 8px 0; }
.drawer-foot {
  display: flex; gap: 8px; padding: 12px 18px;
  border-top: 1px solid var(--line); background: var(--bg-2);
}

.notif {
  display: grid; grid-template-columns: 18px 1fr; gap: 14px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line-soft);
}
.notif:hover { background: var(--bg-hover); }
.notif-dot {
  width: 8px; height: 8px; border-radius: 50%;
  margin-top: 7px;
}
.notif-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.notif-title {
  font-family: var(--font-display); font-size: 19px; color: var(--fg);
  letter-spacing: -0.015em; line-height: 1.25;
}
.notif-text { font-size: 13px; color: var(--fg-1); margin-top: 4px; line-height: 1.5; }

/* ---------- Confirm modal ---------- */
.confirm {
  width: 480px; max-width: 92vw;
  background: var(--bg-1); border: 1px solid var(--line-strong);
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 32px 80px -24px rgb(0 0 0 / 0.6);
  animation: cmdk-pop 0.16s ease;
}
.confirm-head {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 28px 28px 16px;
}
.confirm-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent);
}
.confirm-icon[data-danger="true"] {
  background: color-mix(in oklab, var(--hot) 14%, transparent);
  color: var(--hot);
}
.confirm-body {
  padding: 0 28px 24px;
  font-family: var(--font-sans); font-size: 14px; color: var(--fg-1); line-height: 1.6;
}
.confirm-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 16px 24px; border-top: 1px solid var(--line);
  background: var(--bg-2);
}

/* ---------- Sidebar group labels ---------- */
.nav-group-label {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--fg-3);
  padding: 14px 12px 6px;
}
.nav-group-sep {
  height: 1px; background: var(--line-soft);
  margin: 8px 8px;
}
.nav-badge {
  margin-left: auto; padding: 1px 7px;
  background: var(--hot); color: #fff;
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  border-radius: 999px;
  min-width: 18px; text-align: center;
}

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 56px 1fr; }
  .sidebar .nav-label, .sidebar-brand .brand-name, .nav-group-label { display: none; }
  .topbar-title { font-size: 14px; }
  .cmd-input { min-width: 0; max-width: 220px; }
  .cmd-input span:not(.kbd) { display: none; }
  .ed-section { padding: 32px 24px !important; }
  .ed-mast { padding: 12px 24px !important; font-size: 10px !important; }
  .ed-display { font-size: 60px !important; }
  .ed-h2 { font-size: 38px !important; }
  .ed-num { grid-template-columns: 1fr !important; gap: 4px !important; }
  .drawer { width: 100vw; }
}

@media (max-width: 600px) {
  .app { grid-template-columns: 0 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 8px 12px; gap: 6px; }
  .topbar-title { display: none; }
  .ed-section [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }
  .ed-display { font-size: 44px !important; }
}

/* ---------- Empty / loading state ---------- */
.empty-state {
  text-align: center; padding: 80px 32px;
  color: var(--fg-2);
}
.empty-state-title {
  font-family: var(--font-display); font-style: italic;
  font-size: 32px; color: var(--fg);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.empty-state-sub { font-size: 13px; color: var(--fg-2); }

.skeleton {
  background: linear-gradient(90deg, var(--bg-2), var(--bg-3), var(--bg-2));
  background-size: 200% 100%;
  animation: skel 1.4s linear infinite;
  border-radius: 6px;
}
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
