/* ── App Layout ────────────────────────────────── */
#app { min-height: 100vh; min-height: 100dvh; }

.app-shell {
  display: grid;
  grid-template-columns: var(--g-sidebar) minmax(0, 1fr);
  min-height: 100vh; min-height: 100dvh;
}

/* ── Sidebar ───────────────────────────────────── */
.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh; height: 100dvh;
  border-right: 1px solid var(--g-border);
  background: var(--g-surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 30;
}

.sidebar-header {
  padding: 24px 20px 0;
  flex-shrink: 0;
}

.sidebar-close { display: none; }

.brand-logo {
  width: 130px;
  height: auto;
  margin-bottom: 8px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 20px 12px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-divider {
  height: 1px;
  background: var(--g-border);
  margin: 8px 8px;
}

.nav-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border-radius: var(--g-radius-sm);
  padding: 9px 12px;
  text-align: left;
  color: var(--g-muted);
  font-size: .875rem;
  font-weight: 500;
  transition: background var(--g-duration) var(--g-ease),
              color var(--g-duration) var(--g-ease);
}

.nav-button:hover:not(:disabled):not(.is-disabled) {
  background: var(--g-surface-2);
  color: var(--g-text);
}

.nav-button.is-active,
.nav-button[aria-current="page"] {
  background: var(--g-surface-2);
  color: var(--g-text);
  font-weight: 600;
}

.nav-button.is-active::before,
.nav-button[aria-current="page"]::before {
  content: '';
  position: absolute;
  left: 0;
  width: 3px;
  height: 20px;
  background: var(--g-accent);
  border-radius: 0 3px 3px 0;
}

.nav-button { position: relative; }

.nav-button:disabled,
.nav-button.is-disabled {
  cursor: not-allowed;
  opacity: .35;
}

.nav-icon {
  display: flex;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-icon svg { width: 100%; height: 100%; }

/* ── Sidebar Footer ────────────────────────────── */
.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--g-border);
  flex-shrink: 0;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--g-radius-sm);
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--g-surface-3);
  color: var(--g-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .72rem; color: var(--g-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Mobile Sidebar Overlay ────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 29;
  opacity: 0;
  transition: opacity var(--g-duration) var(--g-ease);
}

.sidebar-overlay.is-visible {
  display: block;
  opacity: 1;
}

/* ── Main Area ─────────────────────────────────── */
.app-main { min-width: 0; background: var(--g-bg); }

/* ── Top Bar ───────────────────────────────────── */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--g-topbar);
  padding: 0 24px;
  border-bottom: 1px solid var(--g-border);
  background: rgba(12,16,23,.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.topbar-menu-btn {
  display: none;
  width: 36px; height: 36px;
  padding: 6px;
  border-radius: var(--g-radius-xs);
  color: var(--g-muted);
}

.topbar-menu-btn:hover { background: var(--g-surface-2); color: var(--g-text); }
.topbar-menu-btn svg { width: 100%; height: 100%; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.topbar-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--g-radius-sm);
  color: var(--g-muted);
  transition: background var(--g-duration) var(--g-ease), color var(--g-duration) var(--g-ease);
}

.topbar-btn:hover { background: var(--g-surface-2); color: var(--g-text); }
.topbar-btn svg { width: 20px; height: 20px; }

.notif-badge {
  position: absolute;
  top: 6px; right: 6px;
  min-width: 16px; height: 16px;
  border-radius: 99px;
  background: var(--g-danger);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.notification-wrap { position: relative; }
.notification-backdrop { display: none; }
.notification-panel {
  position: fixed;
  top: calc(var(--g-topbar) + 10px);
  right: 24px;
  width: min(410px, calc(100vw - 32px));
  max-height: min(70vh, 620px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 90;
  border: 1px solid color-mix(in srgb, var(--g-border) 80%, transparent);
  border-radius: var(--g-radius-md);
  background: color-mix(in srgb, var(--g-surface) 96%, #000);
  box-shadow: 0 24px 64px rgba(0,0,0,.48), 0 4px 18px rgba(0,0,0,.28);
}
.notification-panel[hidden],
.notification-backdrop[hidden] { display: none !important; }
.notification-panel-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--g-border);
}
.notification-heading,
.notification-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.notification-heading strong { font-size: .95rem; }
.notification-unread-count {
  padding: 3px 7px;
  border-radius: 99px;
  color: var(--g-accent);
  background: color-mix(in srgb, var(--g-accent) 12%, transparent);
  font-size: .68rem;
  font-weight: 700;
}
.notification-close {
  display: none;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: var(--g-radius-sm);
  color: var(--g-muted);
}
.notification-close:hover { color: var(--g-text); background: var(--g-surface-2); }
.notification-close {
  min-width: 32px;
  min-height: 32px;
  flex: 0 0 32px;
  overflow: hidden;
}
.notification-close > svg {
  display: block;
  width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  flex: none;
}
.notification-sheet-handle { display: none; }
.btn-link {
  color: var(--g-accent);
  font-size: .78rem;
  font-weight: 600;
}
.btn-link:hover { text-decoration: underline; }
.notification-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--g-border) transparent;
}
.notification-group-label {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 16px 6px;
  color: var(--g-muted);
  background: color-mix(in srgb, var(--g-surface) 96%, #000);
  border-bottom: 1px solid color-mix(in srgb, var(--g-border) 65%, transparent);
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.notification-item {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 8px;
  align-items: start;
  width: 100%;
  gap: 10px;
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid color-mix(in srgb, var(--g-border) 72%, transparent);
  transition: background var(--g-duration) var(--g-ease);
}
.notification-item:hover { background: var(--g-surface-2); }
.notification-item.is-unread {
  background: color-mix(in srgb, var(--g-accent) 8%, var(--g-surface));
}
.notification-type-icon {
  display: flex;
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  flex: 0 0 34px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 10px;
  color: var(--g-accent);
  background: color-mix(in srgb, var(--g-accent) 10%, var(--g-surface-2));
}
.notification-type-icon > svg {
  display: block;
  width: 17px !important;
  height: 17px !important;
  max-width: 17px !important;
  max-height: 17px !important;
  flex: none;
}
.notification-copy { display: grid; min-width: 0; gap: 3px; }
.notification-title {
  overflow: hidden;
  color: var(--g-text);
  font-size: .84rem;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notification-item.is-unread .notification-title { font-weight: 700; }
.notification-body {
  display: -webkit-box;
  overflow: hidden;
  color: var(--g-muted);
  font-size: .77rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.notification-time { color: var(--g-muted); font-size: .68rem; opacity: .82; }
.notification-unread-dot {
  width: 7px;
  height: 7px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--g-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--g-accent) 12%, transparent);
}
.notification-empty,
.notification-error,
.notification-loading {
  min-height: 180px;
  padding: 30px 24px;
  text-align: center;
}
.notification-empty,
.notification-error {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  color: var(--g-muted);
  font-size: .78rem;
  line-height: 1.5;
}
.notification-empty strong,
.notification-error strong { color: var(--g-text); font-size: .86rem; }
.notification-empty-icon {
  display: flex;
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  flex: 0 0 42px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 4px;
  border-radius: 50%;
  color: var(--g-muted);
  background: var(--g-surface-2);
}
.notification-empty-icon > svg {
  display: block;
  width: 19px !important;
  height: 19px !important;
  max-width: 19px !important;
  max-height: 19px !important;
  flex: none;
}
.notification-loading { display: grid; min-height: 160px; gap: 10px; }
.notification-skeleton {
  height: 54px;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--g-surface-2), color-mix(in srgb, var(--g-surface-2) 60%, var(--g-border)), var(--g-surface-2));
  background-size: 220% 100%;
  animation: notification-shimmer 1.4s ease infinite;
}
@keyframes notification-shimmer {
  to { background-position: -220% 0; }
}
.notification-popup-container {
  position: fixed;
  top: calc(var(--g-topbar) + 14px);
  right: 24px;
  z-index: 95;
  display: flex;
  width: min(380px, calc(100vw - 32px));
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}
.notification-popup {
  position: relative;
  display: grid;
  width: 100%;
  min-width: 0;
  max-width: 380px;
  grid-template-columns: minmax(0, 1fr) 34px;
  overflow: hidden;
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius-md);
  background: color-mix(in srgb, var(--g-surface) 97%, #000);
  box-shadow: 0 18px 46px rgba(0,0,0,.42);
  opacity: 0;
  pointer-events: auto;
  transform: translateY(-10px) scale(.98);
  transition: opacity .2s var(--g-ease), transform .2s var(--g-ease);
}
.notification-popup.is-visible { opacity: 1; transform: translateY(0) scale(1); }
.notification-popup-main {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  overflow: hidden;
  padding: 13px 10px 13px 14px;
  text-align: left;
}
.notification-popup-main .notification-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
  overflow: hidden;
}
.notification-popup-main strong {
  overflow: hidden;
  color: var(--g-text);
  font-size: .83rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notification-popup-main .notification-copy > span {
  display: -webkit-box;
  overflow: hidden;
  color: var(--g-muted);
  font-size: .75rem;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.notification-popup-main small { color: var(--g-muted); font-size: .66rem; opacity: .8; }
.notification-popup-close {
  display: flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  margin: 7px 7px 0 0;
  border-radius: 8px;
  color: var(--g-muted);
}
.notification-popup-close:hover { color: var(--g-text); background: var(--g-surface-2); }
.notification-popup-close {
  min-width: 34px;
  min-height: 34px;
  flex: 0 0 34px;
  overflow: hidden;
}
.notification-popup-close > svg {
  display: block;
  width: 16px !important;
  height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  flex: none;
}

/* ── Content Area ──────────────────────────────── */
.app-content {
  width: min(100%, var(--g-content));
  margin: 0 auto;
  padding: 28px 28px 48px;
  transition: opacity var(--g-duration) var(--g-ease);
}

.app-content.is-loading { opacity: .5; pointer-events: none; }

.nav-list a.nav-button { text-decoration: none; }
