/* ==========================================================================
   Canonical Noah Workspace Shell & Sidebar
   Shared across Dashboard, Support, and API Docs
   ========================================================================== */

.dashboard-app {
  position: relative;
  min-height: 100vh;
}

/* --------------------------------------------------------------------------
   Canonical Workspace Sidebar
   -------------------------------------------------------------------------- */
.dashboard-sidebar {
  position: fixed;
  inset: 16px auto 16px 16px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: 268px;
  padding: 17px 14px 14px;
  border: 1px solid var(--noah-border);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(18, 18, 21, .97), rgba(11, 11, 14, .95));
  box-shadow: var(--noah-shadow);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  transition: transform .3s var(--noah-ease);
}

.sidebar-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 7px 18px;
}

.dashboard-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--noah-text);
  font: 700 16px var(--noah-font-mono);
  letter-spacing: -.04em;
  text-decoration: none;
}

.dashboard-brand.noah-brand-pill {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.dashboard-brand-mark.noah-brand-mark {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 10px 10px 10px 4px;
  color: #111;
  background: var(--noah-lime);
  font: 700 14px/1 var(--noah-font-mono);
  transform: rotate(-8deg);
}

.dashboard-brand .noah-brand-word {
  font: 800 17px/1.5 var(--noah-font-sans);
}

.sidebar-collapse,
.mobile-menu-button,
.topbar-icon-button,
.topbar-user,
.user-menu-button,
.text-button {
  border: 0;
  color: var(--noah-muted);
  background: transparent;
}

.topbar-icon-button,
.user-menu-button {
  min-width: 44px;
  min-height: 44px;
}

.sidebar-collapse {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  cursor: pointer;
}

.sidebar-collapse:hover,
.mobile-menu-button:hover,
.topbar-icon-button:hover,
.topbar-user:hover,
.user-menu-button:hover,
.text-button:hover {
  color: var(--noah-text);
  background: rgba(255, 255, 255, .06);
}

.sidebar-collapse svg,
.mobile-menu-button svg,
.topbar-icon-button svg,
.topbar-user svg,
.user-menu-button svg,
.text-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-open-chat,
.new-chat-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 43px;
  margin-bottom: 22px;
  border-radius: 13px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.sidebar-open-chat svg,
.new-chat-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* --------------------------------------------------------------------------
   Workspace Navigation Items
   -------------------------------------------------------------------------- */
.dashboard-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.nav-label {
  padding: 0 10px 7px;
  color: var(--noah-soft);
  font: 600 10px var(--noah-font-mono);
  letter-spacing: .13em;
  text-transform: uppercase;
}

.nav-label-spaced {
  margin-top: 21px;
}

.dashboard-nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--noah-muted);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: color .2s var(--noah-ease), background .2s var(--noah-ease), border-color .2s var(--noah-ease), transform .2s var(--noah-ease);
}

a.dashboard-nav-item {
  text-decoration: none;
}

.dashboard-nav-item svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dashboard-nav-item:hover {
  color: var(--noah-text);
  background: rgba(255, 255, 255, .05);
  border-color: var(--noah-border);
  transform: translateX(2px);
}

.dashboard-nav-item.active {
  color: #07110d;
  border-color: transparent;
  background: linear-gradient(135deg, var(--noah-lime), var(--noah-cyan));
  box-shadow: 0 10px 24px rgba(34, 197, 94, .13);
}

.dashboard-nav-item.active svg {
  stroke: #07110d;
}

.nav-count {
  min-width: 21px;
  margin-left: auto;
  padding: 3px 6px;
  border-radius: 999px;
  color: var(--noah-muted);
  background: rgba(255, 255, 255, .08);
  font: 600 10px var(--noah-font-mono);
  text-align: center;
}

.dashboard-nav-item.active .nav-count {
  color: #07110d;
  background: rgba(7, 17, 13, .12);
}

/* --------------------------------------------------------------------------
   Sidebar Bottom: Mini Credits & User Identity
   -------------------------------------------------------------------------- */
.sidebar-bottom {
  display: grid;
  gap: 13px;
  margin-top: auto;
  padding-top: 16px;
}

.sidebar-credit-mini {
  padding: 13px;
  border: 1px solid var(--noah-border);
  border-radius: 15px;
  background: rgba(255, 255, 255, .035);
}

.mini-credit-head,
.mini-credit-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--noah-muted);
  font: 10px var(--noah-font-mono);
}

.mini-credit-head {
  margin-bottom: 10px;
  color: var(--noah-text);
}

.mini-credit-head span:last-child {
  color: var(--noah-lime);
}

.sidebar-credit-mini .noah-progress {
  height: 7px;
}

.mini-credit-foot {
  margin-top: 8px;
}

.mini-credit-caption {
  display: block;
  margin-top: 6px;
  color: var(--noah-soft, rgba(255, 255, 255, .5));
  font: 10px var(--noah-font-mono);
  line-height: 1.3;
}

.sidebar-utility-nav {
  display: grid;
  gap: 4px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 1px solid transparent;
  border-radius: 14px;
  transition: background .2s ease, border-color .2s ease;
}

.sidebar-user:hover {
  border-color: var(--noah-border);
  background: rgba(255, 255, 255, .04);
}

.user-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(134, 232, 220, .35);
  border-radius: 11px;
  color: #07110d;
  background: linear-gradient(135deg, var(--noah-cyan), var(--noah-lime));
  font: 700 13px var(--noah-font-mono);
}

.user-avatar.small {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  font-size: 11px;
}

.sidebar-user-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.sidebar-user-copy strong {
  overflow: hidden;
  color: var(--noah-text);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-copy span {
  overflow: hidden;
  color: var(--noah-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-left: auto;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   Canonical Workspace Main & Topbar
   -------------------------------------------------------------------------- */
.dashboard-main {
  min-height: 100vh;
  margin-left: 280px;
}

.dashboard-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  padding: 16px clamp(22px, 4vw, 58px);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  background: rgba(9, 9, 11, .82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.topbar-left,
.topbar-actions,
.topbar-user,
.connection-status {
  display: flex;
  align-items: center;
}

.topbar-left {
  gap: 14px;
}

.mobile-menu-button {
  display: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--noah-border);
  border-radius: 11px;
  color: var(--noah-muted);
  background: rgba(255, 255, 255, .03);
  cursor: pointer;
}

.mobile-menu-button:hover {
  color: var(--noah-text);
  background: rgba(255, 255, 255, .08);
}

.topbar-kicker {
  display: block;
  color: var(--noah-soft);
  font: 600 10px var(--noah-font-mono);
  letter-spacing: .11em;
  text-transform: uppercase;
}

.dashboard-topbar h1 {
  margin: 5px 0 0;
  color: var(--noah-text);
  font: 700 20px var(--noah-font-mono);
  letter-spacing: -.05em;
}

.topbar-actions {
  gap: 10px;
}

.connection-status {
  gap: 7px;
  color: var(--noah-muted);
  font: 10px var(--noah-font-mono);
  white-space: nowrap;
}

.connection-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--noah-amber);
  box-shadow: 0 0 10px rgba(255, 157, 103, .5);
}

.connection-status.connected i,
.connection-status.online i {
  background: var(--noah-lime);
  box-shadow: 0 0 10px rgba(34, 197, 94, .6);
}

.connection-status.error i {
  background: var(--noah-rose);
  box-shadow: 0 0 10px rgba(251, 113, 133, .6);
}

.topbar-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--noah-border);
  border-radius: 12px;
  color: var(--noah-text);
  background: rgba(255, 255, 255, .04);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease;
}

.topbar-user:hover {
  border-color: rgba(255, 255, 255, .15);
  background: rgba(255, 255, 255, .08);
}

/* --------------------------------------------------------------------------
   Sidebar Scrim (Mobile Overlay)
   -------------------------------------------------------------------------- */
.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: none;
  background: rgba(0, 0, 0, .48);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.sidebar-scrim.open {
  display: block;
}

/* --------------------------------------------------------------------------
   Responsive & Drawer Behavior
   -------------------------------------------------------------------------- */
@media (max-width: 1050px) {
  .dashboard-main {
    margin-left: 0;
  }

  .dashboard-sidebar {
    inset: 0 auto 0 0;
    width: min(292px, calc(100vw - 34px));
    border-top: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 0;
    transform: translateX(-100%);
  }

  .dashboard-sidebar.open {
    transform: none;
  }

  .sidebar-collapse,
  .mobile-menu-button {
    display: grid;
    place-items: center;
  }

  html.dashboard-drawer-open,
  body.dashboard-drawer-open {
    overflow: hidden;
    overscroll-behavior: none;
  }
}

@media (max-width: 600px) {
  .dashboard-topbar {
    padding: 12px 16px;
    min-height: 64px;
  }

  .dashboard-topbar h1 {
    font-size: 18px;
  }

  .connection-status {
    display: none;
  }
}
