*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --tcy-bg: #ffffff;
  --tcy-surface: #ffffff;
  --tcy-surface-strong: #ffffff;
  --tcy-border: rgba(15, 23, 42, 0.08);
  --tcy-text: #0f172a;
  --tcy-muted: #64748b;
  --tcy-primary: #0052d9;
  --tcy-primary-soft: rgba(0, 82, 217, 0.08);
  --tcy-success: #059669;
  --tcy-danger: #dc2626;
  --tcy-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}

html {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--tcy-text);
  background: #ffffff;
}

#app {
  min-height: 100vh;
}

a {
  color: inherit;
}

/* Keep TDesign controls stable in desktop browsers and the mobile WebView. */
.t-button {
  min-height: 38px;
  line-height: 1.2;
  white-space: nowrap;
}

.t-button .t-icon,
.t-button .t-button__content {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.t-button .t-icon {
  flex: 0 0 auto;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.38);
}

.tcy-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.tcy-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  border-right: 1px solid var(--tcy-border);
  background: #ffffff;
  backdrop-filter: blur(18px);
	z-index: 40;
	display: flex;
	flex-direction: column;
	transition: width .2s ease, transform .2s ease;
}

.tcy-sidebar.is-collapsed {
  width: 84px;
  padding-inline: 10px;
}

.tcy-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 18px;
  text-decoration: none;
}

.tcy-brand-mark {
  width: 42px;
  height: 42px;
  display: block;
  border-radius: 10px;
  object-fit: cover;
  background: #e8f1ff;
}

.tcy-brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tcy-brand-copy strong {
  font-size: 15px;
  line-height: 1.2;
}

.tcy-brand-copy small {
  margin-top: 4px;
  color: var(--tcy-muted);
  font-size: 12px;
}

.tcy-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: calc(100vh - 154px);
  padding: 4px 4px 10px;
  overflow-y: auto;
}

.tcy-nav-group {
	width: 100%;
	min-height: 42px;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: #475569;
	font: inherit;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0;
	cursor: pointer;
	text-align: left;
}

.tcy-nav-group:hover,
.tcy-nav-section.is-open > .tcy-nav-group { background: #f8fafc; color: var(--tcy-primary); }
.tcy-nav-group-label { flex: 1; }
.tcy-nav-chevron { transition: transform .18s ease; }
.tcy-nav-section.is-open .tcy-nav-chevron { transform: rotate(180deg); }
.tcy-nav-children { display: none; padding: 3px 0 5px 14px; }
.tcy-nav-section.is-open .tcy-nav-children { display: grid; gap: 3px; }
.tcy-nav-group.is-compact { justify-content: center; padding-inline: 8px; }
.tcy-sidebar.is-collapsed .tcy-nav-children { padding-left: 0; }

.tcy-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
	padding: 9px 12px;
  border-radius: 6px;
  color: #334155;
  text-decoration: none;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.tcy-nav-item:hover {
  color: var(--tcy-primary);
  background: rgba(0, 82, 217, 0.06);
  transform: translateX(2px);
}

.tcy-nav-item.active {
  color: var(--tcy-primary);
  background: rgba(0, 82, 217, 0.1);
  box-shadow: inset 3px 0 0 var(--tcy-primary);
}

.tcy-nav-item.is-collapsed {
  justify-content: center;
  padding-inline: 8px;
}

.tcy-nav-icon {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 20px;
  line-height: 1;
}

.tcy-mobile-close,
.tcy-sidebar-backdrop { display: none; }

.tcy-logout {
  display: block;
  margin: 14px 8px 4px;
  padding: 12px 14px;
  border-radius: 6px;
  text-align: center;
  text-decoration: none;
  color: var(--tcy-danger);
  background: rgba(220, 38, 38, 0.06);
  border: 1px solid rgba(220, 38, 38, 0.08);
  font-weight: 700;
}

.tcy-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.tcy-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 26px;
  border-bottom: 1px solid var(--tcy-border);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
}

.tcy-header-left,
.tcy-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.tcy-header-copy {
  display: flex;
  flex-direction: column;
}

.tcy-header-copy strong {
  font-size: 18px;
  line-height: 1.2;
}

.tcy-header-copy small,
.tcy-header-user {
  color: var(--tcy-muted);
  font-size: 12px;
}

.tcy-content {
  flex: 1;
  padding: 28px;
  min-width: 0;
  background: #ffffff;
}

.tcy-footer {
  margin-top: 24px;
  padding: 16px 4px 4px;
  color: var(--tcy-muted);
  text-align: center;
  font-size: 12px;
}

.tcy-page {
  display: grid;
  gap: 18px;
}

.tcy-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.tcy-page-copy h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

.tcy-page-copy p {
  margin: 8px 0 0;
  color: var(--tcy-muted);
  line-height: 1.7;
}

.tcy-surface-card {
  border-radius: 8px;
  background: var(--tcy-surface);
  border: 1px solid var(--tcy-border);
  box-shadow: none;
}

.tcy-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.tcy-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 6px;
}

.tcy-table-wrap .t-table {
  min-width: 100%;
}

.tcy-avatar,
.tcy-thumb {
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #f8fafc;
}

.tcy-avatar {
  width: 38px;
  height: 38px;
}

.tcy-thumb {
  width: 52px;
  height: 52px;
}

.mono {
  font-family: "JetBrains Mono", "Consolas", monospace;
}

.clip1 {
  display: inline-block;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clip2 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.tcy-detail-dialog .t-dialog__body {
  max-height: min(70vh, 720px);
  overflow: auto;
}

.t-dialog__body {
  max-height: min(70vh, 720px);
  overflow: auto;
}

.tcy-post-detail {
  display: grid;
  gap: 18px;
}

.tcy-detail-title {
  margin: 0;
  color: var(--tcy-text);
  font-size: 20px;
  line-height: 1.45;
}

.tcy-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--tcy-muted);
  font-size: 13px;
}

.tcy-detail-content {
  padding: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.8;
  border: 1px solid var(--tcy-border);
  border-radius: 6px;
  background: #fff;
}

.tcy-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.tcy-media-grid img,
.tcy-detail-video {
  width: 100%;
  max-height: 440px;
  object-fit: contain;
  border-radius: 6px;
  background: #111827;
}

.tcy-user-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--tcy-border);
}

.tcy-user-summary .tcy-avatar {
  width: 64px;
  height: 64px;
}

.tcy-chat-detail {
  display: grid;
  gap: 16px;
}

.tcy-chat-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--tcy-border);
  border-radius: 6px;
}

.tcy-chat-head div:last-child {
  text-align: right;
}

.tcy-chat-head strong,
.tcy-chat-head span:not(.tcy-chat-arrow) {
  display: block;
}

.tcy-chat-head span:not(.tcy-chat-arrow),
.tcy-message-meta {
  margin-top: 4px;
  color: var(--tcy-muted);
  font-size: 12px;
}

.tcy-chat-arrow {
  color: var(--tcy-primary);
  font-size: 20px;
}

.tcy-message-list {
  display: grid;
  gap: 14px;
  max-height: 520px;
  padding: 4px;
  overflow: auto;
}

.tcy-message-row {
  display: flex;
  flex-direction: column;
  max-width: 78%;
}

.tcy-message-row.from-a {
  align-self: start;
}

.tcy-message-row.from-b {
  align-self: end;
  align-items: end;
}

.tcy-message-bubble {
  margin-top: 5px;
  padding: 10px 12px;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--tcy-border);
  border-radius: 6px;
  background: #f8fafc;
  line-height: 1.6;
}

.tcy-message-row.from-b .tcy-message-bubble {
  border-color: #cfe0ff;
  background: #edf4ff;
}

.detail-card {
  padding: 14px 16px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.detail-card label {
  display: block;
  margin-bottom: 6px;
  color: var(--tcy-muted);
  font-size: 12px;
}

.tcy-upload-field {
  display: grid;
  gap: 10px;
}

.tcy-upload-input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px dashed rgba(15, 23, 42, 0.16);
  border-radius: 10px;
  background: #f8fafc;
}

.tcy-upload-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tcy-upload-path {
  min-width: 0;
  color: var(--tcy-muted);
  word-break: break-all;
}

.tcy-upload-preview {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #f8fafc;
}

.tcy-audio-player {
  display: block;
  width: min(100%, 420px);
  height: 42px;
  margin-top: 10px;
}

.tcy-audio-player-compact {
  width: 220px;
  margin-top: 0;
}

.tcy-moderator-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.tcy-moderator-toolbar .t-input {
  flex: 1;
}

.tcy-moderator-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.tcy-moderator-panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  background: #f8fafc;
}

.tcy-moderator-panel h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.tcy-moderator-list {
  display: grid;
  gap: 10px;
}

.tcy-moderator-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.tcy-moderator-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
	flex: 1;
}

.tcy-moderator-user strong,
.tcy-moderator-user .mono {
  display: block;
	min-width: 0;
	overflow-wrap: anywhere;
}

.tcy-moderator-user > div {
	min-width: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}

.form-grid .span-2 {
  grid-column: 1 / -1;
}

.tcy-empty {
  padding: 40px 16px;
}

.tcy-fadein {
  animation: tcyFadeIn 0.22s ease-out both;
}

@keyframes tcyFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .tcy-shell {
    grid-template-columns: 84px minmax(0, 1fr);
  }


	.tcy-sidebar.is-collapsed .tcy-brand-copy { display: none; }
}

@media (max-width: 760px) {
	.tcy-moderator-toolbar {
		align-items: stretch;
		flex-direction: column;
	}

	.tcy-moderator-grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.tcy-moderator-panel {
		padding: 12px;
		border-radius: 8px;
	}

	.tcy-moderator-item {
		padding: 10px;
		border-radius: 6px;
	}
}

@media (max-width: 900px) {
  .tcy-shell {
    grid-template-columns: 1fr;
  }

  .tcy-sidebar {
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	z-index: 30;
	width: min(86vw, 320px);
	height: 100dvh;
	min-height: 100vh;
	padding: 14px 12px max(12px, env(safe-area-inset-bottom));
	overflow: visible;
	border-right: 1px solid var(--tcy-border);
	border-bottom: 0;
	transform: translateX(-102%);
	box-shadow: 12px 0 34px rgba(15,23,42,.16);
  }

  .tcy-sidebar.is-collapsed {
	width: min(86vw, 320px);
	padding-inline: 12px;
  }

	.tcy-sidebar.is-mobile-open { transform: translateX(0); }
	.tcy-sidebar-backdrop { position:fixed;inset:0;z-index:29;border:0;background:rgba(15,23,42,.42);backdrop-filter:blur(2px); }
	.tcy-sidebar-backdrop.is-visible { display:block; }
	.tcy-mobile-close { position:absolute;top:18px;right:14px;width:36px;height:36px;display:grid;place-items:center;border:0;border-radius:6px;background:#f1f5f9;color:#334155;cursor:pointer; }

  .tcy-brand {
	flex: 0 0 auto;
	padding: 4px 48px 16px 8px;
  }

  .tcy-brand-mark {
    width: 38px;
    height: 38px;
  }

  .tcy-nav {
	flex: 1;
	flex-direction: column;
	gap: 4px;
	height: auto;
	min-height: 0;
	padding: 4px;
	overflow-x: hidden;
	overflow-y: auto;
  }

  .tcy-nav::-webkit-scrollbar { display: none; }

  .tcy-nav-item,
  .tcy-nav-item.is-collapsed {
	flex: 0 0 auto;
	min-width: 0;
	min-height: 42px;
	padding: 10px 12px;
  }

	.tcy-nav-children { padding-left: 14px; }

  .tcy-nav-item.is-collapsed .tcy-nav-label,
  .tcy-nav-item .tcy-nav-label {
    display: inline;
    font-size: 13px;
    white-space: nowrap;
  }

  .tcy-logout {
	flex: 0 0 auto;
	margin: 12px 8px 0;
	padding: 12px;
	overflow: visible;
	font-size: 14px;
  }

  .tcy-logout::after {
	content: none;
  }

  .tcy-header {
	top: 0;
    padding: 14px 16px;
  }

  .tcy-content {
    padding: 18px 16px;
  }

  .tcy-page-head {
    align-items: flex-start;
  }

  .tcy-page-copy h1 {
    font-size: 22px;
  }

  .tcy-table-wrap {
    margin-inline: -4px;
    width: calc(100% + 8px);
  }

  .t-dialog {
    width: calc(100vw - 28px) !important;
    max-width: calc(100vw - 28px) !important;
  }
}

@media (max-width: 768px) {
  .tcy-header,
  .tcy-content {
    padding-left: 16px;
    padding-right: 16px;
  }

	.tcy-page-head { display: grid; grid-template-columns: minmax(0,1fr); width: 100%; }
	.tcy-page-head > .t-space { width: 100%; display: flex; flex-wrap: wrap; }
	.tcy-page-head > .t-space .t-button { flex: 1 1 132px; max-width: 100%; }
	.tcy-page-copy { min-width: 0; }
	.tcy-page-copy h1,
	.tcy-page-copy p { overflow-wrap: anywhere; }
	.tcy-surface-card,
	.tcy-page > section { max-width: 100%; min-width: 0; }

  .tcy-page-copy h1 {
    font-size: 24px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .tcy-header-copy small,
  .tcy-header-user {
    display: none;
  }

  .tcy-toolbar > .t-input,
  .tcy-toolbar > .t-select {
    width: min(100%, 280px) !important;
  }

  html {
    font-size: 16px;
  }

  body {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
  }

  .tcy-content {
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }

  .tcy-page-head,
  .tcy-toolbar {
    gap: 10px;
  }

  .tcy-toolbar > .t-input,
  .tcy-toolbar > .t-select,
  .tcy-toolbar > .t-button,
  .tcy-toolbar > .t-space {
    width: 100% !important;
    max-width: none !important;
  }

  .tcy-toolbar > .t-button {
    justify-content: center;
  }

  .t-button {
    min-height: 42px;
  }

  .tcy-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .tcy-table-wrap .t-table {
    min-width: 760px;
  }

  .t-form-item .t-input,
  .t-form-item .t-textarea,
  .t-form-item .t-select,
  .t-form-item .t-date-picker {
    font-size: 16px;
  }

  .t-dialog {
    top: auto !important;
    bottom: calc(8px + env(safe-area-inset-bottom));
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    margin: 0 10px;
  }

  .t-dialog__body {
    max-height: 66vh;
  }

  .tcy-chat-head {
    gap: 8px;
    padding: 12px;
    font-size: 13px;
  }

  .tcy-message-row {
    max-width: 92%;
  }
}

@media (max-width: 768px) {
	.tcy-page-head { display: grid !important; grid-template-columns: minmax(0,1fr) !important; width: 100% !important; }
	.tcy-page-head > * { min-width: 0; max-width: 100%; }
}
