/* ChatHive 通信壳：左图标栏 + 可选中间栏（#tt-chathive-aside）+ 主区。
   中间栏空时主区只让导航宽；插件 Teleport 填入后按 nav + aside。
   vendor `transition: all` 特异性很高，必须对等选择器 + !important，否则进壳会方变圆、主区抖。 */

.chathive-navigation-brand.tt-appcenter-btn {
  width: 100%;
  height: 3.5rem;
  border-radius: 0;
}

html[data-tt-shell="chathive"] .chathive-navigation .nav-pills {
  --chathive-nav-pills-border-radius: 50%;
  --chathive-nav-pills-link-active-bg: var(--tt-primary);
  --chathive-nav-pills-link-active-color: var(--tt-accent-ink);
}

html[data-tt-shell="chathive"] body .chathive-navigation,
html[data-tt-shell="chathive"] body .chathive-navigation .chathive-navigation-body .nav-item .nav-link,
html[data-tt-shell="chathive"] body .chathive-navigation .chathive-navigation-body .nav-item .nav-link:hover,
html[data-tt-shell="chathive"] body .chathive-navigation .chathive-navigation-footer .nav-link,
html[data-tt-shell="chathive"] body .chathive-content,
html[data-tt-shell="chathive"] body .chathive-content .chathive-content-body {
  transition: none !important;
}

html[data-tt-shell="chathive"] body .chathive-content {
  margin-left: var(--chathive-navigation-width, 6rem) !important;
}

html[data-tt-shell="chathive"] body:has(#tt-chathive-aside > .tt-aside-pane.is-front > *) .chathive-content {
  margin-left: calc(var(--chathive-navigation-width, 6rem) + var(--chathive-asidebar-width, 25rem)) !important;
}

html[data-tt-shell="chathive"] #tt-chathive-aside:not(:has(> .tt-aside-pane.is-front > *)) {
  display: none !important;
}

html[data-tt-shell="chathive"] .tt-chathive-aside-toggler {
  display: none;
}

html[data-tt-shell="chathive"] body:has(#tt-chathive-aside > .tt-aside-pane.is-front > *) .tt-chathive-aside-toggler {
  display: inline-flex;
}

@media (min-width: 992px) {
  html[data-tt-shell="chathive"] .tt-chathive-aside-toggler {
    display: none !important;
  }
  /* 压过 vendor <1200 的 overlay 隐藏，992–1199 也持久显示中间栏 */
  html[data-tt-shell="chathive"] #tt-chathive-aside:has(> .tt-aside-pane.is-front > *) {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    margin-left: var(--chathive-navigation-width, 6rem);
  }
}

@media (max-width: 991.98px) {
  html[data-tt-shell="chathive"] body .chathive-content,
  html[data-tt-shell="chathive"] body:has(#tt-chathive-aside > .tt-aside-pane.is-front > *) .chathive-content {
    margin-left: 0 !important;
  }
  html[data-tt-shell="chathive"] #tt-chathive-aside:has(> .tt-aside-pane.is-front > *) {
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateX(-100%) !important;
  }
  html[data-tt-shell="chathive"] body.chathive-asidebar-open #tt-chathive-aside:has(> .tt-aside-pane.is-front > *) {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
  }
}

html[data-tt-shell="chathive"] body .chathive-navigation .chathive-navigation-body .nav-item .nav-link,
html[data-tt-shell="chathive"] body .chathive-navigation .chathive-navigation-footer .nav-link {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 3rem !important;
  height: 3rem !important;
  min-width: 3rem;
  min-height: 3rem;
  padding: 0.5rem !important;
  border-radius: 50% !important;
}

body .chathive-navigation .chathive-navigation-body .nav-item .nav-link .bi,
body .chathive-navigation .chathive-navigation-footer .nav-link .bi,
body .chathive-navigation .chathive-navigation-body .nav-item .nav-link .tt-icon,
body .chathive-navigation .chathive-navigation-footer .nav-link .tt-icon {
  display: inline-block;
  line-height: 1;
  font-size: 1.25rem;
  width: 1.25rem;
  height: 1.25rem;
  color: inherit;
}

body .chathive-navigation .chathive-navigation-body .nav-item .nav-link.active,
body .chathive-navigation .chathive-navigation-body .nav-item .nav-link.active .bi,
body .chathive-navigation .chathive-navigation-body .nav-item .nav-link.active .tt-icon {
  color: var(--chathive-nav-pills-link-active-color, #fff);
}

html[data-tt-shell="chathive"] .chathive-navigation .chathive-chat-badge {
  position: absolute;
  top: 0.1rem;
  right: 0.05rem;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.22rem;
  border-radius: 999px;
  background: var(--bs-danger, #dc3545);
  color: #fff;
  font-size: 0.625rem;
  line-height: 1rem;
  font-weight: 600;
  text-align: center;
  pointer-events: none;
}

.chathive-main-header-right .tt-chrome {
  margin-left: auto;
}

.ch-stage {
  padding: 1rem 1.25rem 1.5rem;
  min-height: calc(100vh - var(--chathive-header-height, 5rem));
}

.chathive-shell-footer {
  flex-shrink: 0;
  padding: 0.5rem 1.25rem;
  border-top: 1px solid var(--tt-tone-border, var(--bs-border-color));
  font-size: 12px;
  color: var(--tt-tone-muted, var(--bs-secondary-color));
}

.chathive-shell-footer .app-footer-copyright {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chathive-shell-footer .app-footer-copyright a {
  color: inherit;
}

html[data-tt-shell="chathive"] .tt-plugin-stage > .hello,
html[data-tt-shell="chathive"] .tt-plugin-stage > .page {
  max-width: none;
  width: 100%;
  color: inherit;
  font-family: inherit;
  display: grid;
  gap: 1rem;
  padding: 1.25rem 1.5rem 1.5rem;
  background-color: var(--tt-tone-surface, var(--chathive-card-bg, var(--bs-body-bg)));
  border: 1px solid var(--tt-tone-border, var(--chathive-border-color, var(--bs-border-color)));
  border-radius: var(--tt-radius-lg, 0.5rem);
}

html[data-tt-shell="chathive"] .tt-plugin-stage > .tt-plugin-page {
  max-width: none;
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  font-family: inherit;
}

html[data-tt-shell="chathive"] .tt-plugin-page .card {
  background: var(--tt-tone-surface, var(--chathive-card-bg, var(--bs-body-bg)));
  border-radius: var(--tt-radius-lg, 0.5rem);
}

html[data-tt-shell="chathive"] .tt-plugin-stage .hello h1,
html[data-tt-shell="chathive"] .tt-plugin-stage .page h1,
html[data-tt-shell="chathive"] .tt-plugin-stage .ctrl-head h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
  color: inherit;
}

html[data-tt-shell="chathive"] .tt-plugin-stage .muted,
html[data-tt-shell="chathive"] .tt-plugin-stage .ctrl-head p {
  color: var(--bs-secondary-color, #6c757d);
  font-size: 0.875rem;
  margin: 0;
}

/* bare TtPanel 页头：标题与操作同排（smartadmin 壳在 base-inline 定义，chathive 补齐） */
html[data-tt-shell="chathive"] .tt-plugin-stage .ctrl-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}

html[data-tt-shell="chathive"] .tt-plugin-stage .ctrl-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

html[data-tt-shell="chathive"] .tt-plugin-stage nav.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

html[data-tt-shell="chathive"] .tt-plugin-stage nav.nav a {
  padding: 0.35rem 0.85rem;
  border-radius: var(--tt-radius-md, 0.375rem);
  color: var(--bs-secondary-color, #6c757d);
  text-decoration: none;
  font-size: var(--tt-fs-md, 0.875rem);
}

html[data-tt-shell="chathive"] .tt-plugin-stage nav.nav a.router-link-exact-active,
html[data-tt-shell="chathive"] .tt-plugin-stage nav.nav a.router-link-active {
  color: var(--tt-primary-emphasis);
  background: var(--tt-primary-subtle);
  font-weight: 600;
}

html[data-tt-shell="chathive"] .tt-plugin-stage form.row,
html[data-tt-shell="chathive"] .tt-plugin-stage form.stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  align-items: center;
}

html[data-tt-shell="chathive"] .tt-plugin-stage form.stack {
  flex-direction: column;
  align-items: stretch;
  max-width: 28rem;
}

html[data-tt-shell="chathive"] .tt-plugin-stage .hello input:not([type="checkbox"]):not([type="radio"]),
html[data-tt-shell="chathive"] .tt-plugin-stage .page input:not([type="checkbox"]):not([type="radio"]),
html[data-tt-shell="chathive"] .tt-plugin-stage .hello select,
html[data-tt-shell="chathive"] .tt-plugin-stage .page select,
html[data-tt-shell="chathive"] .tt-plugin-stage .hello textarea,
html[data-tt-shell="chathive"] .tt-plugin-stage .page textarea {
  flex: 1 1 12rem;
  min-height: var(--tt-control-h, 2.25rem);
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--tt-tone-border, var(--bs-border-color));
  border-radius: var(--tt-radius-sm, 0.25rem);
  background: var(--tt-tone-bg, var(--bs-body-bg));
  color: inherit;
}

html[data-tt-shell="chathive"] .tt-plugin-stage .hello input:focus,
html[data-tt-shell="chathive"] .tt-plugin-stage .page input:focus,
html[data-tt-shell="chathive"] .tt-plugin-stage .hello select:focus,
html[data-tt-shell="chathive"] .tt-plugin-stage .page select:focus,
html[data-tt-shell="chathive"] .tt-plugin-stage .hello textarea:focus,
html[data-tt-shell="chathive"] .tt-plugin-stage .page textarea:focus {
  outline: 0;
  border-color: var(--tt-primary);
  box-shadow: var(--tt-focus-ring);
}

html[data-tt-shell="chathive"] .tt-plugin-stage .hello button:not(.link):not(.ghost):not(.tt-shell-home-card),
html[data-tt-shell="chathive"] .tt-plugin-stage .page button:not(.link):not(.ghost):not(.tt-shell-home-card) {
  min-height: var(--tt-control-h, 2.25rem);
  padding: 0.4rem 1rem;
  border: 0;
  border-radius: var(--tt-radius-md, 0.375rem);
  background: var(--tt-primary);
  color: var(--tt-accent-ink);
  font-weight: 600;
  cursor: pointer;
}

html[data-tt-shell="chathive"] .tt-plugin-stage .hello button:not(.link):not(.ghost):not(.tt-shell-home-card):hover,
html[data-tt-shell="chathive"] .tt-plugin-stage .page button:not(.link):not(.ghost):not(.tt-shell-home-card):hover {
  background: var(--tt-primary-hover);
}

html[data-tt-shell="chathive"] .tt-plugin-stage .hello button.link,
html[data-tt-shell="chathive"] .tt-plugin-stage .page button.link,
html[data-tt-shell="chathive"] .tt-plugin-stage .page a.link {
  background: none;
  color: var(--tt-primary-link);
  border: 0;
  padding: 0 0.35rem;
}

html[data-tt-shell="chathive"] .tt-plugin-stage .hello button.ghost,
html[data-tt-shell="chathive"] .tt-plugin-stage .page button.ghost {
  background: transparent;
  color: inherit;
  border: 1px solid var(--tt-tone-border, var(--bs-border-color));
  border-radius: var(--tt-radius-md, 0.375rem);
  min-height: var(--tt-control-h, 2.25rem);
  padding: 0.4rem 1rem;
}

html[data-tt-shell="chathive"] .tt-plugin-stage .hello table,
html[data-tt-shell="chathive"] .tt-plugin-stage .page table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
}

html[data-tt-shell="chathive"] .tt-plugin-stage .hello th,
html[data-tt-shell="chathive"] .tt-plugin-stage .hello td,
html[data-tt-shell="chathive"] .tt-plugin-stage .page th,
html[data-tt-shell="chathive"] .tt-plugin-stage .page td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--tt-tone-border, var(--bs-border-color));
  text-align: left;
  font-size: var(--tt-fs-md, 0.875rem);
  background: transparent;
  color: inherit;
}

html[data-tt-shell="chathive"] .tt-plugin-stage a.hit,
html[data-tt-shell="chathive"] .tt-plugin-stage a.tile,
html[data-tt-shell="chathive"] .tt-plugin-stage .tile {
  display: grid;
  gap: 0.15rem;
  padding: 0.85rem 1rem;
  border-radius: var(--tt-radius-lg, 0.5rem);
  border: 1px solid var(--tt-tone-border, var(--bs-border-color));
  background: var(--tt-tone-surface, var(--bs-body-bg));
  text-decoration: none;
  color: inherit;
}

html[data-tt-shell="chathive"] .tt-plugin-stage .bubble {
  background: var(--tt-tone-muted, var(--bs-tertiary-bg, #f8f9fa));
  border: 1px solid var(--tt-tone-border, var(--bs-border-color));
  border-radius: var(--tt-radius-lg, 0.5rem);
  padding: 0.75rem 1rem;
}

html[data-tt-shell="chathive"] .tt-plugin-stage .bubble.me {
  border-color: var(--tt-primary-border);
  background: var(--tt-primary-subtle);
}

html[data-tt-shell="chathive"] .tt-plugin-stage .error {
  color: var(--bs-danger);
}
