/* Zhongzhuan brand layer.
   Keep New API's native light/dark theme intact; only add precise polish. */
:root {
  --zz-accent: #13c8b6;
  --zz-accent-2: #2f7cf6;
  --zz-accent-3: #7561ff;
  --zz-radius: 8px;
  --zz-line-soft: color-mix(in srgb, currentColor 14%, transparent);
  --zz-line-strong: color-mix(in srgb, #13c8b6 36%, transparent);
  --zz-surface-soft: color-mix(in srgb, currentColor 5%, transparent);
  --zz-surface-active: color-mix(in srgb, #13c8b6 14%, transparent);
}

html,
body,
#root {
  letter-spacing: 0 !important;
}

body,
button,
input,
textarea,
select {
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif !important;
  letter-spacing: 0 !important;
}

/* Brand */
img[src="/logo.png"],
img[src*="/logo.png"],
img[src*="logo.png"] {
  border-radius: 50% !important;
  object-fit: cover !important;
  box-shadow: 0 0 0 1px color-mix(in srgb, currentColor 18%, transparent) !important;
}

a[href="/"] img,
header img[src*="logo"],
nav img[src*="logo"] {
  width: 34px;
  height: 34px;
}

/* Top navigation: cleaner and flatter, without changing theme colors. */
header,
.ant-layout-header,
.semi-layout-header {
  border-bottom: 1px solid var(--zz-line-soft) !important;
  box-shadow: none !important;
  backdrop-filter: saturate(130%) blur(10px);
}

header a,
nav a,
.ant-menu-horizontal .ant-menu-item,
.semi-navigation-horizontal .semi-navigation-item {
  border-radius: var(--zz-radius) !important;
  font-weight: 700 !important;
  transition: background-color .16s ease, color .16s ease, border-color .16s ease !important;
}

header a:hover,
nav a:hover,
.ant-menu-horizontal .ant-menu-item:hover,
.semi-navigation-horizontal .semi-navigation-item:hover {
  background: var(--zz-surface-soft) !important;
}

/* Sidebar: single selected pill, no rectangle-inside-rectangle effect. */
aside,
.ant-layout-sider,
.semi-layout-sider,
[class*="Sider"],
[class*="Sidebar"] {
  border-right: 1px solid var(--zz-line-soft) !important;
  box-shadow: none !important;
}

.ant-layout-sider::before,
.ant-layout-sider::after,
.semi-layout-sider::before,
.semi-layout-sider::after,
aside::before,
aside::after {
  box-shadow: none !important;
  filter: none !important;
}

.ant-menu,
.semi-navigation-list {
  background: transparent !important;
}

.ant-menu-item,
.ant-menu-submenu-title,
.semi-navigation-item {
  min-height: 36px !important;
  margin: 3px 10px !important;
  padding-inline: 14px !important;
  border: 1px solid transparent !important;
  border-radius: var(--zz-radius) !important;
  background: transparent !important;
  box-shadow: none !important;
}

.ant-menu-item::after,
.ant-menu-submenu-title::after,
.semi-navigation-item::after {
  display: none !important;
}

.ant-menu-item .ant-menu-title-content,
.ant-menu-submenu-title .ant-menu-title-content,
.semi-navigation-item-text,
.semi-navigation-item-icon {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.ant-menu-item:hover,
.ant-menu-submenu-title:hover,
.semi-navigation-item:hover {
  background: var(--zz-surface-soft) !important;
  border-color: var(--zz-line-soft) !important;
}

.ant-menu-item-selected,
.ant-menu-submenu-selected > .ant-menu-submenu-title,
.semi-navigation-item-selected {
  background: var(--zz-surface-active) !important;
  border-color: var(--zz-line-strong) !important;
  color: var(--zz-accent-2) !important;
  box-shadow: none !important;
}

/* The sidebar collapse button was picking up the old glowing primary button style. */
aside button,
.ant-layout-sider button,
.semi-layout-sider button,
[class*="collapse"],
[class*="Collapse"] {
  box-shadow: none !important;
  filter: none !important;
  text-shadow: none !important;
}

aside .ant-btn-primary,
.ant-layout-sider .ant-btn-primary,
.semi-layout-sider .semi-button-primary,
aside .semi-button-primary {
  background: transparent !important;
  border-color: var(--zz-line-soft) !important;
  color: inherit !important;
}

/* Controls: modest polish only, no theme token override. */
button,
.ant-btn,
.semi-button,
[role="button"] {
  border-radius: var(--zz-radius) !important;
  letter-spacing: 0 !important;
  box-shadow: none;
}

.ant-btn-primary,
.semi-button-primary,
button[type="submit"] {
  border-color: transparent !important;
  background: linear-gradient(100deg, var(--zz-accent), var(--zz-accent-2) 58%, var(--zz-accent-3)) !important;
  color: #fff !important;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--zz-accent-2) 22%, transparent) !important;
}

.ant-btn-primary:hover,
.semi-button-primary:hover,
button[type="submit"]:hover {
  filter: saturate(1.08) brightness(1.03);
}

input,
textarea,
.ant-input,
.ant-input-affix-wrapper,
.ant-select-selector,
.ant-picker,
.semi-input,
.semi-input-wrapper,
.semi-select-selection {
  border-radius: var(--zz-radius) !important;
  box-shadow: none !important;
}

.ant-input-affix-wrapper-focused,
.ant-select-focused .ant-select-selector,
.semi-input-wrapper-focus {
  border-color: var(--zz-accent) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--zz-accent) 18%, transparent) !important;
}

/* Dropdowns and popovers should follow the current theme, but stay readable. */
.ant-select-dropdown,
.ant-dropdown,
.ant-popover-inner,
.semi-select-option-list,
.semi-dropdown,
.semi-popover-wrapper {
  border-radius: var(--zz-radius) !important;
  box-shadow: 0 14px 38px color-mix(in srgb, #000 18%, transparent) !important;
}

.ant-select-item,
.ant-dropdown-menu-item,
.semi-select-option,
.semi-dropdown-item {
  border-radius: 6px !important;
}

.ant-select-item-option-active,
.ant-dropdown-menu-item-active,
.semi-select-option-focused,
.semi-dropdown-item:hover {
  background: var(--zz-surface-soft) !important;
}

.ant-select-item-option-selected,
.semi-select-option-selected {
  background: var(--zz-surface-active) !important;
  color: inherit !important;
}

/* Cards and tables: keep New API colors, tighten only borders/radius. */
.ant-card,
.semi-card,
.ant-table-wrapper,
.semi-table-container,
.ant-modal-content,
.semi-modal-content {
  border-radius: var(--zz-radius) !important;
  border-color: var(--zz-line-soft) !important;
}

.ant-table-thead > tr > th,
.semi-table-thead > .semi-table-row > .semi-table-row-head {
  font-weight: 700 !important;
}

.ant-alert,
.semi-alert,
.semi-banner {
  border-radius: var(--zz-radius) !important;
}

.ant-tag,
.semi-tag,
.ant-badge,
.semi-badge {
  border-radius: 999px !important;
}

/* Dark-mode-only depth. This intentionally does not affect light mode. */
html[theme-mode="dark"] body,
html[data-theme="dark"] body,
body[theme-mode="dark"],
body[data-theme="dark"],
body.dark {
  background-image:
    radial-gradient(circle at 18% -10%, rgba(19,200,182,.12), transparent 24%),
    radial-gradient(circle at 82% -8%, rgba(117,97,255,.14), transparent 26%) !important;
  background-attachment: fixed !important;
}

html[theme-mode="dark"] header,
html[data-theme="dark"] header,
body[theme-mode="dark"] header,
body[data-theme="dark"] header,
body.dark header,
html[theme-mode="dark"] .ant-layout-header,
html[data-theme="dark"] .ant-layout-header,
body[theme-mode="dark"] .ant-layout-header,
body[data-theme="dark"] .ant-layout-header,
body.dark .ant-layout-header {
  background: color-mix(in srgb, #050812 82%, transparent) !important;
}

html[theme-mode="dark"] .ant-card,
html[data-theme="dark"] .ant-card,
body[theme-mode="dark"] .ant-card,
body[data-theme="dark"] .ant-card,
body.dark .ant-card,
html[theme-mode="dark"] .semi-card,
html[data-theme="dark"] .semi-card,
body[theme-mode="dark"] .semi-card,
body[data-theme="dark"] .semi-card,
body.dark .semi-card {
  box-shadow: 0 12px 36px rgba(0,0,0,.24) !important;
}

/* Mobile compactness. */
@media (max-width: 720px) {
  .ant-menu-item,
  .ant-menu-submenu-title,
  .semi-navigation-item {
    margin-inline: 6px !important;
  }
}

/* Final sidebar cleanup: nested utility backgrounds inside menu rows should not create a second rectangle. */
aside .ant-menu-item > *,
aside .ant-menu-submenu-title > *,
aside .semi-navigation-item > *,
.ant-layout-sider .ant-menu-item > *,
.ant-layout-sider .ant-menu-submenu-title > *,
.semi-layout-sider .semi-navigation-item > * {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

aside .ant-menu-item-selected > *,
aside .semi-navigation-item-selected > *,
.ant-layout-sider .ant-menu-item-selected > *,
.semi-layout-sider .semi-navigation-item-selected > * {
  color: inherit !important;
}

/* Keep the collapse area quiet in both themes. */
aside [class*="bottom"],
aside [class*="Bottom"],
.ant-layout-sider [class*="bottom"],
.semi-layout-sider [class*="bottom"] {
  box-shadow: none !important;
  filter: none !important;
}

/* Sidebar selected row should render as one complete pill. */
aside .semi-navigation-list,
aside .ant-menu,
.ant-layout-sider .ant-menu,
.semi-layout-sider .semi-navigation-list {
  overflow: visible !important;
  padding-right: 8px !important;
}

aside .semi-navigation-item,
aside .ant-menu-item,
aside .ant-menu-submenu-title,
.ant-layout-sider .ant-menu-item,
.ant-layout-sider .ant-menu-submenu-title,
.semi-layout-sider .semi-navigation-item {
  width: calc(100% - 20px) !important;
  max-width: calc(100% - 20px) !important;
  box-sizing: border-box !important;
  overflow: visible !important;
}

aside .semi-navigation-item-selected,
aside .ant-menu-item-selected,
.ant-layout-sider .ant-menu-item-selected,
.semi-layout-sider .semi-navigation-item-selected {
  background-clip: padding-box !important;
  outline: 1px solid var(--zz-line-strong) !important;
  outline-offset: -1px !important;
  border-color: transparent !important;
}

aside .semi-navigation-item-selected > *,
aside .ant-menu-item-selected > *,
.ant-layout-sider .ant-menu-item-selected > *,
.semi-layout-sider .semi-navigation-item-selected > * {
  width: auto !important;
  min-width: 0 !important;
  overflow: visible !important;
}

/* Chat submenu: show complete readable labels and keep the entries clickable. */
aside .semi-navigation-item-text,
aside .ant-menu-title-content,
.ant-layout-sider .ant-menu-title-content,
.semi-layout-sider .semi-navigation-item-text {
  min-width: 0 !important;
  max-width: none !important;
}

aside .semi-navigation-sub,
aside .semi-navigation-sub-wrap,
aside .ant-menu-sub,
.ant-layout-sider .ant-menu-sub,
.semi-layout-sider .semi-navigation-sub {
  width: 100% !important;
  max-width: 100% !important;
  overflow: visible !important;
}

aside .semi-navigation-sub .semi-navigation-item,
aside .ant-menu-sub .ant-menu-item,
.ant-layout-sider .ant-menu-sub .ant-menu-item,
.semi-layout-sider .semi-navigation-sub .semi-navigation-item {
  width: calc(100% - 20px) !important;
  max-width: calc(100% - 20px) !important;
  min-height: 34px !important;
  padding-left: 44px !important;
  padding-right: 10px !important;
  cursor: pointer !important;
  pointer-events: auto !important;
}

aside .semi-navigation-sub .semi-navigation-item-text,
aside .ant-menu-sub .ant-menu-title-content,
.ant-layout-sider .ant-menu-sub .ant-menu-title-content,
.semi-layout-sider .semi-navigation-sub .semi-navigation-item-text {
  display: block !important;
  width: 100% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* Give the chat submenu action button the same full-row behavior. */
aside .semi-navigation-sub button,
aside .ant-menu-sub button,
.ant-layout-sider .ant-menu-sub button,
.semi-layout-sider .semi-navigation-sub button {
  width: calc(100% - 64px) !important;
  min-height: 34px !important;
  margin-left: 44px !important;
  justify-content: center !important;
  pointer-events: auto !important;
}
