:root {
  --sidebar-bg: #171717;
  --sidebar-panel: #202124;
  --sidebar-line: rgba(255, 255, 255, 0.08);
  --bg: #f3f5f8;
  --panel: #ffffff;
  --panel-muted: #f7f8fb;
  --line: #e4e8ef;
  --line-strong: #d6dce6;
  --text: #111827;
  --muted: #677489;
  --accent: #10a37f;
  --accent-soft: rgba(16, 163, 127, 0.12);
  --danger: #cf3f4f;
  --danger-soft: rgba(207, 63, 79, 0.12);
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis: none;
  text-rendering: geometricPrecision;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(16, 163, 127, 0.08), transparent 28%),
    linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  background: none;
  padding: 0;
}

.hidden {
  display: none !important;
}

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

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  padding: 20px 18px;
  color: #f8fafc;
  background:
    radial-gradient(circle at top, rgba(16, 163, 127, 0.16), transparent 30%),
    linear-gradient(180deg, #1a1b1f 0%, var(--sidebar-bg) 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-head,
.sidebar-section,
.sidebar-foot {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--sidebar-line);
  border-radius: 24px;
}

.sidebar-head {
  padding: 18px;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.brand-mark {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, #10a37f 0%, #13c296 100%);
  color: #f8fafc;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.brand-copy {
  min-width: 0;
}

.brand-copy h1,
.header-copy h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.brand-copy p,
.header-copy p {
  margin: 0;
}

.brand-eyebrow,
.header-eyebrow,
.section-label {
  color: rgba(248, 250, 252, 0.66);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.brand-copy h1 {
  margin-top: 6px;
  font-size: 18px;
}

.brand-copy #sidebarStatus {
  margin-top: 10px;
  color: rgba(248, 250, 252, 0.75);
  font-size: 13px;
}

.brand-tier {
  margin-top: 8px !important;
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: #d7fff4;
  background: rgba(16, 163, 127, 0.16);
  border: 1px solid rgba(16, 163, 127, 0.24);
}

.new-thread-btn,
.send-btn,
.upload-pill,
.quick-card,
.message-action,
.thread-ghost-btn,
.icon-btn,
.utility-btn,
.modal-close-btn,
.modal-tab {
  transition:
    transform 0.18s ease,
    background-color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.new-thread-btn,
.send-btn {
  width: 100%;
  margin-top: 16px;
  padding: 13px 16px;
  border-radius: 16px;
  color: #ffffff;
  cursor: pointer;
  background: linear-gradient(135deg, #10a37f 0%, #0f8b6d 100%);
  box-shadow: 0 18px 35px rgba(16, 163, 127, 0.22);
}

.new-thread-btn:hover,
.send-btn:hover,
.upload-pill:hover,
.quick-card:hover,
.message-action:hover,
.thread-ghost-btn:hover,
.icon-btn:hover,
.utility-btn:hover,
.modal-close-btn:hover,
.modal-tab:hover {
  transform: translateY(-1px);
}

.sidebar-utility-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.utility-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--sidebar-line);
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.utility-btn:disabled {
  color: #607287;
  border-color: #d4dde8;
  background: #eef3f8;
  cursor: not-allowed;
  opacity: 1;
}

.danger-btn {
  border-color: rgba(207, 63, 79, 0.24);
  color: var(--danger);
  background: rgba(207, 63, 79, 0.08);
}

.danger-btn:disabled {
  color: #8a5e67;
  border-color: #e4cdd3;
  background: #f6e8ec;
}

.hero-note {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(16, 163, 127, 0.12);
  background: rgba(255, 255, 255, 0.76);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.search-shell {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--sidebar-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.search-icon {
  color: rgba(248, 250, 252, 0.6);
  font-size: 15px;
}

.search-input,
.username-input,
.control-select select,
textarea {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
}

.search-input::placeholder,
.username-input::placeholder,
textarea::placeholder {
  color: #98a2b3;
}

.sidebar-section {
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px 12px 12px;
}

.thread-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 340px);
  overflow: auto;
}

.thread-item,
.thread-empty {
  border-radius: 18px;
}

.thread-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 6px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
}

.thread-item.active {
  border-color: rgba(16, 163, 127, 0.28);
  background: rgba(16, 163, 127, 0.09);
}

.thread-main {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 14px;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.thread-main strong,
.thread-main span,
.thread-main em {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-main strong {
  font-size: 14px;
  font-weight: 600;
}

.thread-main span {
  margin-top: 6px;
  color: rgba(248, 250, 252, 0.66);
  font-size: 12px;
}

.thread-main em {
  margin-top: 6px;
  color: rgba(248, 250, 252, 0.42);
  font-size: 11px;
  font-style: normal;
}

.thread-item-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
}

.thread-ghost-btn {
  padding: 8px 10px;
  border-radius: 12px;
  color: rgba(248, 250, 252, 0.72);
  border: 1px solid var(--sidebar-line);
  cursor: pointer;
}

.thread-ghost-btn.danger:hover {
  color: #ffffff;
  background: rgba(207, 63, 79, 0.14);
  border-color: rgba(207, 63, 79, 0.34);
}

.thread-empty {
  padding: 16px;
  color: rgba(248, 250, 252, 0.55);
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
  font-size: 13px;
}

.sidebar-foot {
  padding: 16px 18px;
}

.sidebar-foot strong {
  display: block;
  font-size: 13px;
}

.sidebar-foot p {
  margin: 8px 0 0;
  color: rgba(248, 250, 252, 0.62);
  font-size: 12px;
  line-height: 1.6;
}

.sidebar-scrim {
  display: none;
}

.workspace {
  min-width: 0;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  transition:
    padding 0.18s ease,
    border-color 0.18s ease,
    background-color 0.18s ease;
}

.header-main {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  min-width: 0;
}

.header-copy {
  min-width: 0;
}

.header-eyebrow {
  color: var(--muted);
}

.header-copy h2 {
  margin-top: 6px;
  font-size: 28px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#statusLine {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
}

.settings-toggle-btn {
  min-width: 124px;
}

.header-control-panel {
  padding: 12px 24px 0;
}

.header-control-grid {
  max-width: 940px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.06);
}

.control-pill,
.username-input {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.control-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
}

.control-select span {
  color: var(--muted);
  font-size: 13px;
}

.control-select select {
  min-width: 92px;
  padding-right: 6px;
  color: var(--text);
}

.settings-option-hint {
  margin: -2px 2px 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.control-grid-compact > .settings-option-hint {
  grid-column: 1;
  margin-top: -2px;
}

.toggle-pill {
  cursor: pointer;
}

.toggle-pill input {
  accent-color: var(--accent);
}

.username-input {
  width: 220px;
  padding: 0 14px;
}

.upload-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  color: var(--text);
  cursor: pointer;
}

.upload-pill input {
  display: none;
}

.welcome-panel,
.file-tray,
.chat-messages,
.composer-wrap {
  padding-left: 24px;
  padding-right: 24px;
}

.welcome-panel {
  padding-top: 22px;
}

.hero-card,
.quick-card,
.composer-card,
.file-chip,
.message-body {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero-card {
  max-width: 940px;
  margin: 0 auto;
  padding: 24px 26px;
  border-radius: 28px;
}

.hero-metrics {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-metrics span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(16, 163, 127, 0.12);
  background: rgba(248, 250, 252, 0.94);
  color: #475569;
  font-size: 13px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  max-width: 100%;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  white-space: normal;
}

.hero-card h3 {
  margin: 16px 0 0;
  font-size: 30px;
  line-height: 1.2;
}

.hero-card p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.quick-cards {
  max-width: 940px;
  margin: 16px auto 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.quick-card {
  padding: 18px;
  border-radius: 20px;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.quick-card strong,
.quick-card span {
  display: block;
}

.quick-card strong {
  font-size: 16px;
}

.quick-card span {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}

.file-tray {
  padding-top: 18px;
  padding-bottom: 8px;
}

.file-tray.hidden {
  display: none !important;
}

.file-tray-inner {
  max-width: 940px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.file-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 6px 6px 14px;
  border-radius: 18px;
  transition:
    padding 0.18s ease,
    border-radius 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.file-chip-focused {
  border-color: rgba(15, 118, 110, 0.36);
  box-shadow:
    0 16px 32px rgba(15, 23, 42, 0.08),
    0 0 0 2px rgba(15, 118, 110, 0.18);
  transform: translateY(-1px);
}

.file-chip-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  text-align: left;
  color: inherit;
}

.file-chip-main strong,
.file-chip-main span,
.file-chip-main em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-chip-main strong {
  font-size: 14px;
}

.file-chip-main span {
  color: var(--muted);
  font-size: 12px;
}

.file-chip-main em {
  color: #8a94a6;
  font-size: 11px;
  font-style: normal;
}

.file-chip-main .file-vision-status,
.knowledge-item .file-vision-status {
  display: block;
  width: fit-content;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-chip-main .file-vision-status.vision,
.knowledge-item .file-vision-status.vision {
  color: #0f766e;
  background: rgba(13, 148, 136, 0.1);
}

.file-chip-main .file-vision-status.fallback,
.knowledge-item .file-vision-status.fallback {
  color: #92400e;
  background: rgba(245, 158, 11, 0.16);
}

.file-chip-main .file-vision-status.failed,
.knowledge-item .file-vision-status.failed {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.12);
}

.knowledge-item .file-vision-status {
  margin-top: 6px;
}

.file-chip-remove {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  background: var(--panel-muted);
}

.file-chip-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.file-chip-secondary {
  flex: 0 0 auto;
  min-width: 72px;
  height: 34px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(36, 75, 112, 0.2);
  color: #244b70;
  background: rgba(244, 247, 250, 0.92);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.file-chip-secondary:hover {
  border-color: rgba(36, 75, 112, 0.34);
  background: #fff;
}

.file-chip-secondary:disabled {
  cursor: wait;
  opacity: 0.72;
}

.file-chip-secondary.icon-action,
.file-chip-remove.icon-action,
.inline-action.icon-action {
  position: relative;
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  font-size: 0;
}

.file-chip-remove.icon-action,
.inline-action.icon-action.danger {
  color: #c46f66;
  border-color: rgba(163, 32, 23, 0.12);
  background: rgba(163, 32, 23, 0.06);
}

.file-chip-remove.icon-action:hover,
.file-chip-remove.icon-action:focus-visible,
.inline-action.icon-action.danger:hover,
.inline-action.icon-action.danger:focus-visible {
  color: #9f3028;
  border-color: rgba(163, 32, 23, 0.18);
  background: rgba(163, 32, 23, 0.08);
}

.table-analysis-modal-card {
  max-width: 820px;
}

.table-analysis-panel {
  display: grid;
  gap: 14px;
  max-height: min(58vh, 560px);
  overflow: auto;
}

.analysis-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.analysis-summary-card,
.analysis-sheet-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.analysis-summary-card {
  padding: 12px;
}

.analysis-summary-card span,
.analysis-sheet-head span {
  color: var(--muted);
  font-size: 12px;
}

.analysis-summary-card strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 20px;
}

.analysis-sheet-list {
  display: grid;
  gap: 12px;
}

.analysis-sheet-card {
  padding: 14px;
}

.analysis-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.analysis-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.analysis-chip-list span {
  padding: 5px 8px;
  border-radius: 999px;
  color: #244b70;
  background: #eef3f8;
  font-size: 12px;
}

.analysis-detail-block {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.analysis-detail-block b {
  display: block;
  margin-bottom: 5px;
  color: var(--text);
}

.analysis-detail-block p {
  margin: 3px 0;
}

.dashboard-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-card {
  display: grid;
  gap: 12px;
}

.dashboard-wide-card {
  min-width: 0;
}

.dashboard-list,
.dashboard-bar-list,
.dashboard-sample-list {
  display: grid;
  gap: 8px;
}

.dashboard-list div,
.dashboard-bar-row {
  display: grid;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.dashboard-list div {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 12px;
  background: #f4f7fa;
}

.dashboard-list span,
.dashboard-bar-row span,
.dashboard-bar-row em {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-list strong {
  color: var(--text);
  font-size: 13px;
}

.dashboard-bar-row {
  grid-template-columns: 64px minmax(0, 1fr) 42px;
}

.dashboard-bar-row b {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6ebf1;
}

.dashboard-bar-row b::after {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--bar-width, 0%);
  border-radius: inherit;
  background: #2f4c74;
  content: "";
}

.dashboard-table {
  display: grid;
  gap: 6px;
  overflow-x: auto;
}

.dashboard-table-head,
.dashboard-table-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.4fr) 70px 92px 92px 90px;
  gap: 8px;
  min-width: 560px;
  align-items: center;
}

.dashboard-table-head {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-table-row {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 12px;
  background: #f4f7fa;
  color: var(--text);
  font-size: 12px;
}

.dashboard-table-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-sample-list article {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f4f7fa;
}

.dashboard-sample-list strong {
  color: var(--text);
  font-size: 13px;
}

.dashboard-sample-list span,
.dashboard-sample-list p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.file-chip-remove:hover {
  color: var(--danger);
  border-color: rgba(207, 63, 79, 0.28);
  background: var(--danger-soft);
}

.chat-messages {
  min-height: 0;
  overflow: auto;
  padding-top: 8px;
  padding-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  transition: padding-top 0.18s ease;
}

.message {
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: max-width 0.18s ease;
}

.message.user {
  align-items: flex-end;
}

.message.user .message-head {
  justify-content: flex-end;
}

.message.user .message-meta {
  align-items: flex-end;
  text-align: right;
}

.message.user .message-content {
  align-self: flex-end;
  max-width: min(100%, 760px);
}

.message-head {
  display: flex;
  gap: 12px;
  align-items: center;
}

.message-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 13px;
  font-weight: 700;
}

.message.user .message-avatar {
  background: var(--accent);
}

.message-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.message-role {
  font-size: 14px;
  font-weight: 600;
}

.message-time {
  color: var(--muted);
  font-size: 12px;
}

.message-content {
  min-width: 0;
  max-width: min(100%, 880px);
}

.message-body {
  padding: 18px 20px;
  border-radius: 24px;
  line-height: 1.72;
  word-break: break-word;
  overflow-wrap: anywhere;
  transition:
    padding 0.18s ease,
    border-radius 0.18s ease,
    box-shadow 0.18s ease;
}

.rich-text {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rich-text p,
.rich-text pre,
.rich-text ul,
.rich-text ol,
.rich-text blockquote,
.rich-text h2,
.rich-text h3,
.rich-text h4 {
  margin: 0;
}

.rich-text p {
  line-height: 1.82;
}

.rich-text-pending p {
  white-space: pre-wrap;
}

.rich-text h2,
.rich-text h3,
.rich-text h4 {
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #0f172a;
}

.rich-text h2 {
  margin-top: 6px;
  font-size: 24px;
  line-height: 1.28;
}

.rich-text h3 {
  margin-top: 4px;
  font-size: 20px;
  line-height: 1.34;
}

.rich-text h4 {
  font-size: 17px;
  line-height: 1.38;
}

.rich-text ul,
.rich-text ol {
  padding-left: 24px;
  display: grid;
  gap: 10px;
}

.rich-text hr {
  width: 100%;
  height: 1px;
  margin: 2px 0;
  border: 0;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0), rgba(148, 163, 184, 0.72), rgba(148, 163, 184, 0));
}

.rich-text li {
  line-height: 1.78;
}

.rich-text li.markdown-heading-item {
  font-size: 1.05em;
  line-height: inherit;
}

.rich-text li.markdown-heading-item strong {
  font-size: inherit;
  line-height: inherit;
}

.rich-text blockquote {
  padding: 14px 16px;
  border-left: 4px solid rgba(16, 163, 127, 0.44);
  border-radius: 0 18px 18px 0;
  background: linear-gradient(135deg, rgba(16, 163, 127, 0.08), rgba(15, 118, 110, 0.04));
  color: #134e4a;
}

.rich-text strong {
  font-weight: 800;
  color: #0f172a;
}

.rich-text em {
  font-style: italic;
  color: #475569;
}

.rich-text code {
  padding: 2px 7px;
  border-radius: 8px;
  background: #e9eef5;
  color: #0f172a;
  font-size: 0.95em;
  font-family: "SFMono-Regular", "Consolas", "Liberation Mono", monospace;
}

.rich-text a {
  color: #0f766e;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.rich-text .inline-image-link {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rich-text .inline-image-link img {
  width: 100%;
  max-width: min(100%, 520px);
  max-height: 360px;
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.95) 0%, rgba(237, 242, 247, 0.95) 100%);
}

.rich-text pre {
  overflow: auto;
  max-width: 100%;
  padding: 14px 16px;
  border-radius: 18px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 13px;
  line-height: 1.6;
}

.code-block-card {
  border-radius: 18px;
  overflow: hidden;
  background: #0f172a;
}

.code-block-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
}

.code-copy-btn {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.text-block-card {
  border: 1px solid #dce5f0;
  background: #f8fbff;
}

.text-block-card .code-block-head {
  color: #52647a;
  background: #eef4fb;
}

.text-block-card .code-copy-btn {
  color: #244b70;
  border-color: rgba(36, 75, 112, 0.18);
  background: #ffffff;
}

.text-block-card pre {
  background: #ffffff;
  color: #1f3148;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.78;
  white-space: pre-wrap;
}

.text-block-card pre code {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 1em;
}

.table-wrap {
  width: 100%;
  max-height: min(58vh, 560px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  overscroll-behavior: contain;
}

.rich-text table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #ffffff;
}

.rich-text th,
.rich-text td {
  max-width: 360px;
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.rich-text th:last-child,
.rich-text td:last-child {
  border-right: 0;
}

.rich-text th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  font-size: 13px;
  font-weight: 700;
}

.message.assistant.streaming .message-body {
  box-shadow:
    var(--shadow),
    0 0 0 1px rgba(16, 163, 127, 0.18);
}

.message.user .message-body {
  background: #111827;
  border-color: transparent;
  color: #f8fafc;
}

.message.user .rich-text h2,
.message.user .rich-text h3,
.message.user .rich-text h4,
.message.user .rich-text strong,
.message.user .rich-text code,
.message.user .rich-text em {
  color: #f8fafc;
}

.message.user .rich-text code {
  background: rgba(255, 255, 255, 0.14);
}

.message.user .rich-text blockquote {
  background: rgba(255, 255, 255, 0.08);
  border-left-color: rgba(255, 255, 255, 0.28);
  color: rgba(248, 250, 252, 0.92);
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
  position: relative;
  z-index: 32;
}

.message-next-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 9px;
  max-width: 100%;
}

.next-action-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  max-width: 100%;
}

.next-action-edit {
  flex: 0 0 auto;
  width: 22px;
  min-height: 28px;
  margin-top: 1px;
  padding: 0;
  border: 0;
  color: #315a9f;
  background: transparent;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  opacity: 0.78;
}

.next-action-edit svg {
  display: block;
  width: 18px;
  height: 18px;
  margin: 5px 2px;
}

.next-action-edit:hover {
  color: #123a7e;
  opacity: 1;
  background: transparent;
}

.next-action-link {
  max-width: min(100%, 680px);
  min-height: 30px;
  padding: 7px 12px;
  border-radius: 12px;
  border: 1px solid rgba(24, 63, 132, 0.08);
  color: #163b7a;
  background: #f3f6fb;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
}

.next-action-link::after {
  content: " →";
  color: #183f84;
  font-weight: 900;
}

.next-action-link:hover {
  border-color: rgba(24, 63, 132, 0.2);
  color: #0f316c;
  background: #eaf1fb;
}


.image-error-card {
  display: grid;
  gap: 8px;
  padding: 14px 15px;
  border-radius: 18px;
  border: 1px solid rgba(188, 94, 42, 0.18);
  background: linear-gradient(180deg, #fff8ed 0%, #fffdf9 100%);
}

.image-error-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.image-error-title {
  color: #8a3516;
  font-size: 15px;
  font-weight: 900;
}

.image-error-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  color: #9a3412;
  background: rgba(188, 94, 42, 0.1);
  border: 1px solid rgba(188, 94, 42, 0.14);
  font-size: 12px;
  font-weight: 900;
}

.image-error-message,
.image-error-notice {
  margin: 0;
  color: #5e351d;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
}

.image-error-notice {
  color: #7b421b;
}

.image-error-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: #7d654f;
  font-size: 12px;
  font-weight: 700;
}

.retry-prompt-panel {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(188, 94, 42, 0.16);
  background: #fff8ed;
}

.retry-prompt-hint {
  color: #7b421b;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.retry-prompt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.retry-prompt-btn {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(24, 63, 132, 0.12);
  background: #ffffff;
  color: #163b7a;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.retry-prompt-btn:hover {
  background: #eef4ff;
}

.code-copy-btn.icon-action,
.retry-prompt-btn.icon-action {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  font-size: 0;
}

.code-copy-btn.icon-action {
  color: #dbe7f5;
}

.text-block-card .code-copy-btn.icon-action {
  color: #2f4c74;
}

.message-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.tool-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(16, 163, 127, 0.18);
  color: #0f766e;
  background: rgba(16, 163, 127, 0.08);
  font-size: 12px;
}

.tool-chip.previewable {
  cursor: pointer;
}

.tool-chip.danger {
  border-color: rgba(207, 63, 79, 0.24);
  color: #b42318;
  background: rgba(207, 63, 79, 0.08);
}

.tool-preview {
  margin-top: 10px;
  padding: 16px 16px 14px;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 249, 252, 0.98) 100%);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
  color: #334155;
}

.tool-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.tool-preview-head strong {
  font-size: 14px;
}

.tool-preview-close {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.88);
  color: #475569;
  font-size: 12px;
  cursor: pointer;
}

.tool-preview-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12px;
  line-height: 1.6;
  word-break: break-word;
}

.tool-preview-row,
.tool-preview-summary,
.tool-preview-error {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(241, 245, 249, 0.76);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.tool-preview-row span,
.tool-preview-summary span,
.tool-preview-error span {
  color: #64748b;
  font-size: 11px;
  letter-spacing: 0.02em;
}

.tool-preview-row strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 600;
}

.tool-preview-body a {
  color: #0f766e;
  text-decoration: underline;
  word-break: break-all;
}

.tool-preview-error {
  color: #b42318;
  background: rgba(207, 63, 79, 0.08);
  border-color: rgba(207, 63, 79, 0.14);
}

.tool-preview-summary p,
.tool-preview-error p {
  margin: 0;
  white-space: pre-wrap;
}

.image-result-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 248, 252, 0.98) 100%);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.image-result-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.image-result-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.image-result-head strong {
  display: block;
  font-size: 16px;
  line-height: 1.3;
}

.image-result-head span {
  display: block;
  margin-top: 4px;
  color: #64748b;
  font-size: 13px;
  word-break: break-all;
}

.image-result-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  color: #0f766e;
  background: rgba(15, 118, 110, 0.08);
  text-decoration: none;
  white-space: nowrap;
}

.image-result-preview {
  width: 100%;
  max-height: 480px;
  object-fit: contain;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.95) 0%, rgba(237, 242, 247, 0.95) 100%);
}

.image-result-prompt {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(241, 245, 249, 0.86);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.image-result-prompt-label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.08);
  color: #0f766e;
  font-size: 12px;
  font-weight: 600;
}

.image-result-prompt p {
  margin: 10px 0 0;
  color: #334155;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.image-result-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.image-result-fact {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.94);
  border: 1px solid rgba(226, 232, 240, 0.95);
}

.image-result-fact-label {
  color: #64748b;
  font-size: 11px;
  letter-spacing: 0.02em;
}

.image-result-fact strong {
  color: #0f172a;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.image-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.image-card-action {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--panel-muted);
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;
}

.image-card-action:hover {
  border-color: rgba(15, 118, 110, 0.18);
  color: #0f172a;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.06);
}

.image-card-action.primary {
  border-color: rgba(15, 118, 110, 0.16);
  color: #0f766e;
  background: rgba(15, 118, 110, 0.08);
}

.image-result-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.image-result-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(16, 163, 127, 0.1);
  color: #0f766e;
  font-size: 12px;
}

.image-result-badge.subtle {
  background: rgba(15, 23, 42, 0.06);
  color: #475569;
}

.image-result-foot code {
  padding: 4px 8px;
  border-radius: 10px;
  background: #eef2f7;
  color: #475569;
  font-size: 12px;
  word-break: break-all;
}

.message-action {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--panel-muted);
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;
}

.message-action:hover {
  border-color: rgba(15, 118, 110, 0.18);
  color: #0f172a;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.06);
}

.message-export-wrap {
  position: relative;
  display: inline-flex;
}

.message-export-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 80;
  min-width: 232px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: rgba(255, 255, 255, 0.99);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.14);
}

.message-export-title {
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
}

.message-export-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.message-export-menu .message-action {
  justify-content: center;
  min-height: 40px;
  padding: 0 10px;
  font-size: 12px;
}

.message-action[disabled] {
  opacity: 0.65;
  cursor: wait;
}

.message-action.icon-action,
.image-card-action.icon-action,
.image-preview-action.icon-action,
.code-copy-btn.icon-action,
.retry-prompt-btn.icon-action,
.file-chip-secondary.icon-action,
.file-chip-remove.icon-action,
.inline-action.icon-action {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 15px;
  border-color: rgba(18, 34, 51, 0.08);
  color: #163040;
  background: rgba(247, 249, 251, 0.94);
}

.message-action.icon-action:hover,
.message-action.icon-action:focus-visible,
.message-action.icon-action[aria-expanded="true"],
.image-card-action.icon-action:hover,
.image-card-action.icon-action:focus-visible,
.image-preview-action.icon-action:hover,
.image-preview-action.icon-action:focus-visible,
.code-copy-btn.icon-action:hover,
.code-copy-btn.icon-action:focus-visible,
.retry-prompt-btn.icon-action:hover,
.retry-prompt-btn.icon-action:focus-visible,
.file-chip-secondary.icon-action:hover,
.file-chip-secondary.icon-action:focus-visible,
.file-chip-remove.icon-action:hover,
.file-chip-remove.icon-action:focus-visible,
.inline-action.icon-action:hover,
.inline-action.icon-action:focus-visible {
  color: #243f63;
  border-color: rgba(47, 76, 116, 0.24);
  background: #edf3fb;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.07);
}

.image-card-action.icon-action.primary,
.image-preview-action.icon-action.primary {
  border-color: rgba(15, 118, 110, 0.16);
  color: #0f766e;
  background: rgba(15, 118, 110, 0.08);
}

.message-action.icon-action:disabled,
.image-card-action.icon-action:disabled,
.image-preview-action.icon-action:disabled,
.code-copy-btn.icon-action:disabled,
.retry-prompt-btn.icon-action:disabled,
.file-chip-secondary.icon-action:disabled,
.file-chip-remove.icon-action:disabled,
.inline-action.icon-action:disabled {
  opacity: 0.72;
  transform: none;
  cursor: default;
}

.message-action.icon-action.is-busy .message-action-icon,
.image-card-action.icon-action.is-busy .message-action-icon,
.image-preview-action.icon-action.is-busy .message-action-icon,
.code-copy-btn.icon-action.is-busy .message-action-icon,
.retry-prompt-btn.icon-action.is-busy .message-action-icon {
  opacity: 0.62;
}

.message-action-icon,
.message-action-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}

.message-action.icon-action::after,
.image-card-action.icon-action::after,
.image-preview-action.icon-action::after,
.code-copy-btn.icon-action::after,
.retry-prompt-btn.icon-action::after,
.file-chip-secondary.icon-action::after,
.file-chip-remove.icon-action::after,
.inline-action.icon-action::after {
  content: attr(data-action-label);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 120;
  max-width: 128px;
  padding: 5px 8px;
  border-radius: 999px;
  color: #f8fafc;
  background: rgba(15, 23, 42, 0.9);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.image-card-action.icon-action.no-action-tooltip::after,
.image-preview-action.icon-action.no-action-tooltip::after,
.file-chip-secondary.icon-action.no-action-tooltip::after,
.file-chip-remove.icon-action.no-action-tooltip::after,
.inline-action.icon-action.no-action-tooltip::after {
  display: none;
}

.message-action.icon-action:hover::after,
.message-action.icon-action:focus-visible::after,
.image-card-action.icon-action:hover::after,
.image-card-action.icon-action:focus-visible::after,
.image-preview-action.icon-action:hover::after,
.image-preview-action.icon-action:focus-visible::after,
.code-copy-btn.icon-action:hover::after,
.code-copy-btn.icon-action:focus-visible::after,
.retry-prompt-btn.icon-action:hover::after,
.retry-prompt-btn.icon-action:focus-visible::after,
.file-chip-secondary.icon-action:hover::after,
.file-chip-secondary.icon-action:focus-visible::after,
.file-chip-remove.icon-action:hover::after,
.file-chip-remove.icon-action:focus-visible::after,
.inline-action.icon-action:hover::after,
.inline-action.icon-action:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.message-export-menu .message-action.export-action {
  justify-content: center;
  gap: 0;
  padding: 0 12px;
  border-radius: 14px;
  font-weight: 700;
  color: #1f3148;
}

.export-action-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-wrap {
  padding-bottom: 24px;
  background: linear-gradient(180deg, rgba(243, 245, 248, 0) 0%, rgba(243, 245, 248, 0.92) 18%, rgba(243, 245, 248, 1) 100%);
  transition: padding-bottom 0.18s ease;
}

.composer-card {
  max-width: 940px;
  margin: 0 auto;
  border-radius: 28px;
  padding: 16px 18px 16px 20px;
  min-width: 0;
  transition:
    max-width 0.18s ease,
    border-radius 0.18s ease,
    padding 0.18s ease,
    box-shadow 0.18s ease;
}

.composer-card.drag-active,
.chat-messages.drag-active {
  box-shadow:
    var(--shadow),
    0 0 0 2px rgba(16, 163, 127, 0.22);
}

.secondary-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel);
  cursor: pointer;
}

.composer-button-group {
  display: flex;
  gap: 10px;
  align-items: center;
}

textarea {
  resize: none;
  min-height: 28px;
  max-height: 240px;
  padding: 4px 0 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
}

.composer-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-top: 14px;
}

.composer-state {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.stream-status,
.external-link-hint,
.memory-warning,
.composer-tip {
  font-size: 13px;
}

.stream-status {
  color: var(--muted);
}

.stream-status.fading {
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.stream-status.live {
  color: var(--accent);
}

.stream-status.done {
  color: #0f766e;
}

.external-link-hint {
  color: #0f766e;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(16, 163, 127, 0.1);
  border: 1px solid rgba(16, 163, 127, 0.16);
}

.stream-status.error,
.memory-warning {
  color: var(--danger);
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.composer-tip {
  color: var(--muted);
}

.send-btn {
  width: auto;
  min-width: 100px;
  margin-top: 0;
}

.send-btn:disabled {
  opacity: 0.72;
  cursor: wait;
}

.icon-btn {
  width: 42px;
  height: 42px;
  display: none;
  place-items: center;
  border-radius: 14px;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel);
  cursor: pointer;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 28px 16px;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(8px);
}

.modal-card {
  width: min(860px, 100%);
  max-height: min(86vh, 960px);
  display: grid;
  grid-template-rows: auto auto auto auto 1fr auto;
  gap: 14px;
  padding: 22px;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.18);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.modal-eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.modal-head h3 {
  margin: 8px 0 0;
  font-size: 24px;
}

.modal-close-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--panel-muted);
  cursor: pointer;
}

.modal-hint,
.modal-status {
  color: var(--muted);
  line-height: 1.65;
}

.modal-hint {
  margin: 0;
}

.modal-status {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: #f5f8fc;
  border: 1px solid var(--line);
  font-size: 13px;
}

.modal-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-tab {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--panel-muted);
  cursor: pointer;
}

.modal-tab.active {
  color: var(--accent);
  border-color: rgba(16, 163, 127, 0.24);
  background: var(--accent-soft);
}

.modal-panel {
  min-height: 180px;
  overflow: auto;
  padding-right: 6px;
}

.memory-list,
.knowledge-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.memory-item,
.knowledge-item,
.empty-state {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel-muted);
  min-width: 0;
}

.memory-item-head,
.knowledge-item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
}

.memory-item-head > div:first-child,
.knowledge-item-main {
  min-width: 0;
  flex: 1 1 auto;
}

.knowledge-item-head .inline-actions,
.memory-item-head .inline-actions {
  flex: 0 0 auto;
}

.memory-item-head strong,
.knowledge-item-head strong {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.memory-item-head span,
.knowledge-item-head span {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.memory-item p,
.knowledge-item p {
  color: var(--muted);
}

.memory-item p,
.knowledge-item p {
  margin: 10px 0 0;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.knowledge-item p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-action {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #ffffff;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}


body.sending .composer-card {
  box-shadow:
    var(--shadow),
    0 0 0 1px rgba(16, 163, 127, 0.14);
}

body.chat-active .workspace-header {
  padding-top: 16px;
  padding-bottom: 12px;
  background: rgba(255, 255, 255, 0.9);
}

body.chat-active .header-copy h2 {
  font-size: 24px;
}

body.chat-active #statusLine {
  margin-top: 6px;
  font-size: 13px;
}

body.chat-active .chat-messages {
  padding-top: 18px;
}

body.chat-active .message {
  max-width: 900px;
}

body.chat-active .message-body {
  padding: 16px 18px;
  border-radius: 22px;
}

body.chat-active .file-tray-inner {
  max-width: 900px;
  gap: 8px;
}

body.chat-active .file-chip {
  padding: 5px 5px 5px 12px;
  border-radius: 16px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.05);
}

body.chat-active .file-chip-main strong {
  font-size: 13px;
}

body.chat-active .file-chip-main span,
body.chat-active .file-chip-main em {
  font-size: 11px;
}

body.chat-active .message-tools,
body.chat-active .message-actions {
  gap: 6px;
  margin-top: 8px;
}

body.chat-active .tool-chip,
body.chat-active .message-action {
  min-height: 28px;
  padding: 0 10px;
  font-size: 11px;
}

body.chat-active .message-export-menu {
  gap: 8px;
  padding: 10px;
  border-radius: 16px;
}

body.chat-active .message-head {
  gap: 10px;
}

body.chat-active .message-avatar {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  font-size: 12px;
}

body.chat-active .message-role {
  font-size: 13px;
}

body.chat-active .message-time {
  font-size: 11px;
}

body.chat-active .composer-wrap {
  padding-bottom: 18px;
}

body.chat-active .composer-card {
  max-width: 900px;
  border-radius: 24px;
  padding: 14px 16px 14px 18px;
}

body.header-panel-open .headerPanelToggleBtn,
body.header-panel-open .settings-toggle-btn {
  border-color: rgba(16, 163, 127, 0.24);
  background: rgba(16, 163, 127, 0.08);
  color: #0f766e;
}

@media (max-width: 1280px) {
  .quick-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .workspace-header {
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .header-control-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .username-input {
    width: min(320px, 100%);
  }
}

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(360px, calc(100vw - 48px));
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 24;
    display: block;
    opacity: 0;
    pointer-events: none;
    background: rgba(15, 23, 42, 0.34);
    transition: opacity 0.22s ease;
  }

  .icon-btn {
    display: grid;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .header-copy h2 {
    font-size: 24px;
  }
}

@media (max-width: 768px) {
  .workspace-header,
  .welcome-panel,
  .file-tray,
  .chat-messages,
  .composer-wrap {
    padding-left: 16px;
    padding-right: 16px;
  }

  .hero-card {
    padding: 22px 20px;
  }

  .hero-card h3 {
    font-size: 24px;
  }

  .hero-metrics {
    gap: 8px;
  }

  .hero-metrics span {
    min-height: 30px;
    font-size: 12px;
  }

  .quick-cards {
    grid-template-columns: 1fr;
  }

  .composer-row,
  .composer-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .send-btn {
    width: 100%;
  }

  .composer-tip {
    text-align: center;
  }

  .external-link-hint {
    text-align: center;
  }

  .sidebar-utility-row,
  .modal-actions {
    grid-template-columns: 1fr;
  }

  .username-input {
    width: 100%;
    grid-column: 1 / -1;
  }

  .upload-pill {
    width: 100%;
  }

  .header-control-panel {
    padding-left: 16px;
    padding-right: 16px;
  }

  .header-control-grid {
    grid-template-columns: 1fr;
  }

  .modal-card {
    padding: 18px;
  }

  .modal-head,
  .memory-item-head,
  .knowledge-item-head,
  .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .modal-actions .utility-btn,
  .inline-action {
    width: 100%;
    justify-content: center;
  }
}

/* 2026-05 V1 AI desktop refresh */
:root {
  --sidebar-bg: #0f1720;
  --sidebar-panel: rgba(255, 255, 255, 0.05);
  --sidebar-line: rgba(255, 255, 255, 0.1);
  --bg: #ecf1f5;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-muted: #f3f6f9;
  --line: rgba(15, 23, 42, 0.08);
  --line-strong: rgba(15, 23, 42, 0.14);
  --text: #102033;
  --muted: #5f6f82;
  --accent: #0f8f78;
  --accent-strong: #0a6657;
  --accent-soft: rgba(15, 143, 120, 0.12);
  --danger: #bb4158;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
}

body {
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(15, 143, 120, 0.12), transparent 26%),
    radial-gradient(circle at top right, rgba(16, 32, 51, 0.06), transparent 22%),
    linear-gradient(180deg, #f5f8fb 0%, var(--bg) 100%);
}

.workspace {
  grid-template-rows: auto auto 1fr auto;
}

.sidebar {
  gap: 18px;
  padding: 18px;
  background:
    radial-gradient(circle at top left, rgba(15, 143, 120, 0.18), transparent 26%),
    linear-gradient(180deg, #16202b 0%, #0e151d 100%);
}

.sidebar-head,
.sidebar-section,
.sidebar-foot {
  background: var(--sidebar-panel);
  border-color: var(--sidebar-line);
  backdrop-filter: blur(16px);
}

.brand {
  align-items: center;
}

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background:
    linear-gradient(145deg, #11a38c 0%, #0d735f 100%);
  box-shadow: 0 14px 24px rgba(15, 143, 120, 0.26);
}

.brand-copy h1 {
  font-size: 24px;
  line-height: 1.18;
  letter-spacing: -0.03em;
}

.brand-copy #sidebarStatus {
  margin-top: 8px;
}

.sidebar-intro-copy {
  margin-top: 16px;
  padding: 14px 15px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-intro-copy p,
.section-caption,
.foot-kicker {
  margin: 0;
}

.sidebar-intro-copy p {
  color: rgba(248, 250, 252, 0.72);
  font-size: 13px;
  line-height: 1.65;
}

.sidebar-signal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.sidebar-signal-grid span {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(248, 250, 252, 0.84);
  font-size: 12px;
}

.search-shell {
  margin-top: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-head,
.sidebar-section,
.sidebar-foot,
.hero-card,
.quick-panel,
.file-chip,
.message-body,
.composer-card,
.header-control-grid,
.control-section,
.panel-note-card,
.modal-card,
.knowledge-item,
.memory-item,
.tool-preview,
.image-result-card {
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.07);
}

.sidebar {
  padding: 22px 18px 18px;
  background:
    radial-gradient(circle at top left, rgba(228, 168, 83, 0.16), transparent 30%),
    radial-gradient(circle at 18% 16%, rgba(15, 143, 120, 0.2), transparent 24%),
    linear-gradient(180deg, #16181c 0%, #101216 100%);
}

.sidebar-head,
.sidebar-section,
.sidebar-foot {
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
}

.sidebar-head {
  padding: 20px;
}

.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, #0f8f78 0%, #2dbba1 58%, #e0b164 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.26);
}

.brand-copy h1 {
  margin-top: 8px;
  font-size: 22px;
  letter-spacing: -0.04em;
}

.brand-copy #sidebarStatus {
  margin-top: 12px;
  color: rgba(248, 250, 252, 0.82);
}

.brand-tier {
  margin-top: 10px !important;
  color: #f9f1dc;
  background: rgba(224, 177, 100, 0.14);
  border-color: rgba(224, 177, 100, 0.18);
}

.sidebar-intro-copy {
  margin-top: 18px;
}

.sidebar-intro-copy p {
  margin: 0;
  color: rgba(248, 250, 252, 0.78);
  font-size: 14px;
  line-height: 1.7;
}

.sidebar-signal-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.sidebar-signal-grid span {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 16px;
  color: rgba(248, 250, 252, 0.92);
  font-size: 13px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.search-shell {
  margin-top: 18px;
  border-radius: 18px;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-section {
  padding: 18px 14px 14px;
}

.sidebar-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.section-caption {
  margin: 6px 0 0;
  color: rgba(248, 250, 252, 0.56);
  font-size: 12px;
  line-height: 1.6;
}

.thread-create-btn,
.header-action-btn,
.header-primary-btn,
.composer-tool,
.send-btn,
.thread-ghost-btn,
.message-action,
.image-card-action,
.utility-btn,
.modal-tab {
  transition:
    transform 0.18s ease,
    background-color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    color 0.18s ease;
}

.thread-create-btn,
.header-primary-btn,
.send-btn {
  box-shadow: 0 16px 34px rgba(15, 143, 120, 0.2);
}

.thread-create-btn {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  color: #ffffff;
  background: linear-gradient(135deg, #0f8f78 0%, #0c6f5d 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.thread-list {
  margin-top: 16px;
  max-height: calc(100vh - 432px);
}

.thread-item,
.thread-empty {
  border-radius: 22px;
}

.thread-item {
  padding: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.thread-item.active {
  background: linear-gradient(135deg, rgba(15, 143, 120, 0.18) 0%, rgba(224, 177, 100, 0.1) 100%);
  border-color: rgba(15, 143, 120, 0.22);
}

.thread-main {
  padding: 13px 14px;
  border-radius: 16px;
}

.thread-main strong {
  font-size: 14px;
  font-weight: 700;
}

.thread-main span {
  margin-top: 6px;
  color: rgba(248, 250, 252, 0.7);
}

.thread-main em {
  margin-top: 8px;
  color: rgba(248, 250, 252, 0.44);
  font-size: 11px;
  font-style: normal;
}

.thread-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.thread-ghost-btn {
  min-width: 42px;
  min-height: 42px;
  padding: 0 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(248, 250, 252, 0.82);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.thread-ghost-btn.danger {
  color: #ffffff;
  border-color: #b42318;
  background: #b42318;
  font-weight: 800;
}

.thread-ghost-btn.danger:hover {
  color: #ffffff;
  border-color: #971b12;
  background: #971b12;
}

.sidebar-foot {
  padding: 18px;
}

.foot-kicker {
  margin: 0;
  color: rgba(248, 250, 252, 0.44);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-foot strong {
  display: block;
  margin-top: 10px;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.sidebar-foot p {
  margin: 10px 0 0;
  color: rgba(248, 250, 252, 0.7);
  line-height: 1.7;
}

.workspace {
  background:
    radial-gradient(circle at top right, rgba(224, 177, 100, 0.12), transparent 26%),
    linear-gradient(180deg, #f7f4ed 0%, #eff3f6 56%, #edf2f4 100%);
}

.workspace-header {
  position: sticky;
  top: 0;
  z-index: 14;
  align-items: center;
  padding: 20px 34px 18px;
  border-bottom: 1px solid rgba(18, 34, 51, 0.06);
  background: rgba(247, 244, 237, 0.78);
  backdrop-filter: blur(26px);
}

.header-main {
  align-items: center;
}

.header-copy h2 {
  font-size: 34px;
  letter-spacing: -0.05em;
}

#statusLine {
  color: #617286;
  font-size: 13px;
}

.header-actions {
  gap: 10px;
  align-items: center;
}

.header-action-btn,
.header-primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 600;
}

.header-action-btn {
  border: 1px solid rgba(18, 34, 51, 0.08);
  color: #163040;
  background: rgba(255, 255, 255, 0.7);
}

.header-primary-btn {
  min-width: 138px;
  color: #ffffff;
  background:
    linear-gradient(135deg, #102f43 0%, #0f8f78 72%, #3ab396 100%);
  border: 1px solid rgba(15, 143, 120, 0.14);
}

.header-control-panel,
.welcome-panel,
.file-tray,
.chat-messages,
.composer-wrap {
  padding-left: 34px;
  padding-right: 34px;
}

.header-control-panel {
  padding-top: 14px;
}

.header-control-grid {
  max-width: 1200px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.05fr) 320px;
  gap: 16px;
  padding: 18px;
  border-radius: 30px;
  border: 1px solid rgba(18, 34, 51, 0.06);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.88) 0%, rgba(247, 244, 237, 0.84) 100%);
  backdrop-filter: blur(22px);
}

.control-section,
.panel-note-card {
  border-radius: 24px;
  padding: 18px;
  border: 1px solid rgba(18, 34, 51, 0.06);
  background: rgba(255, 255, 255, 0.8);
}

.control-section-head strong,
.panel-note-card h4 {
  display: block;
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.03em;
}

.control-section-head span,
.panel-note-card p {
  display: block;
  margin-top: 7px;
  color: #617286;
  font-size: 13px;
  line-height: 1.7;
}

.control-section-body {
  margin-top: 16px;
}

.control-grid-compact {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.control-grid-stack {
  display: grid;
  gap: 12px;
}

.control-inline-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

.verify-btn {
  min-width: 124px;
  white-space: nowrap;
}

.full-span {
  width: 100%;
}

.control-pill,
.username-input {
  min-height: 54px;
  border-radius: 18px;
  border: 1px solid rgba(18, 34, 51, 0.08);
  background: rgba(247, 249, 251, 0.92);
}

.control-pill {
  padding: 0 16px;
}

.toggle-pill {
  justify-content: space-between;
  white-space: nowrap;
}

.username-input {
  width: 100%;
  padding: 0 16px;
}

.panel-note-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(224, 177, 100, 0.18), transparent 34%),
    linear-gradient(160deg, rgba(16, 47, 67, 0.94) 0%, rgba(15, 143, 120, 0.92) 100%);
  color: #ffffff;
}

.panel-note-kicker {
  margin: 0;
  color: rgba(249, 241, 220, 0.8);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-note-card h4 {
  margin-top: 10px;
  color: #ffffff;
  font-size: 22px;
  line-height: 1.18;
}

.panel-note-card p {
  color: rgba(255, 255, 255, 0.82);
}

.welcome-panel {
  padding-top: 28px;
}

.hero-card,
.quick-panel {
  max-width: 1200px;
}

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 34px;
  border-radius: 36px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  background:
    radial-gradient(circle at 12% 14%, rgba(15, 143, 120, 0.16), transparent 24%),
    radial-gradient(circle at 92% 8%, rgba(224, 177, 100, 0.18), transparent 24%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.98) 0%, rgba(245, 242, 235, 0.95) 54%, rgba(237, 243, 246, 0.98) 100%);
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) 380px;
  gap: 24px;
}

.hero-copy {
  min-width: 0;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  color: #0f725f;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(15, 143, 120, 0.12);
}

.hero-card h3 {
  margin: 18px 0 0;
  font-size: 46px;
  line-height: 1.02;
  letter-spacing: -0.06em;
  max-width: 13ch;
}

.hero-card p {
  margin: 16px 0 0;
  max-width: 64ch;
  color: #4f6073;
  font-size: 15px;
  line-height: 1.82;
}

.hero-metrics {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-metrics span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  color: #163040;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(18, 34, 51, 0.06);
}

.hero-note {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(15, 143, 120, 0.12);
  background: rgba(255, 255, 255, 0.72);
  color: #526477;
  font-size: 13px;
  line-height: 1.7;
}

.hero-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hero-side-card,
.hero-mini-card {
  border-radius: 24px;
  padding: 18px;
  border: 1px solid rgba(18, 34, 51, 0.06);
  background: rgba(255, 255, 255, 0.72);
}

.hero-side-timeline {
  background:
    linear-gradient(180deg, rgba(16, 47, 67, 0.95) 0%, rgba(17, 67, 83, 0.94) 100%);
  color: #ffffff;
}

.hero-side-kicker {
  margin: 0;
  color: rgba(249, 241, 220, 0.8);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-flow {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 14px;
}

.hero-flow li {
  position: relative;
  padding-left: 18px;
}

.hero-flow li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #e0b164;
  box-shadow: 0 0 0 6px rgba(224, 177, 100, 0.14);
}

.hero-flow li strong,
.hero-mini-card strong {
  display: block;
  font-size: 15px;
}

.hero-flow li span {
  display: block;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  line-height: 1.68;
}

.hero-mini-card strong {
  color: #143345;
}

.hero-mini-card span {
  display: block;
  margin-top: 6px;
  color: #617286;
  font-size: 13px;
  line-height: 1.66;
}

.hero-side-strip {
  display: grid;
  gap: 12px;
}

.quick-panel {
  margin: 18px auto 0;
  padding: 22px 24px 24px;
  border-radius: 32px;
  border: 1px solid rgba(255, 255, 255, 0.84);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.82) 0%, rgba(246, 241, 233, 0.82) 100%);
}

.quick-panel-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.quick-panel-head strong {
  font-size: 24px;
  letter-spacing: -0.04em;
}

.quick-panel-head span,
.quick-panel-kicker {
  color: #617286;
}

.quick-panel-kicker {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.quick-cards {
  max-width: none;
  margin-top: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.quick-card {
  min-height: 194px;
  padding: 18px;
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.96) 0%, rgba(241, 245, 247, 0.96) 100%);
  text-align: left;
}

.quick-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
}

.quick-card-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: rgba(15, 143, 120, 0.08);
  color: #0d725f;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.quick-card strong {
  margin-top: 18px;
  font-size: 19px;
  letter-spacing: -0.03em;
}

.quick-card span {
  margin-top: 10px;
  color: #617286;
  font-size: 14px;
  line-height: 1.65;
}

.file-tray,
.chat-messages {
  padding-top: 18px;
}

.file-tray-inner,
.message,
.composer-card,
.header-control-grid,
.hero-card,
.quick-panel {
  max-width: 1200px;
}

.file-tray-inner {
  display: grid;
  gap: 12px;
}

.file-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 10px;
  padding: 10px 10px 10px 16px;
  border-radius: 22px;
  border: 1px solid rgba(18, 34, 51, 0.06);
  background: rgba(255, 255, 255, 0.84);
}

.file-chip-main {
  padding: 4px 0;
}

.file-chip-main strong {
  font-size: 14px;
}

.file-chip-main span,
.file-chip-main em {
  color: #617286;
}

.file-chip-main em {
  margin-top: 6px;
}

.file-chip-remove {
  width: 42px;
  height: 42px;
  align-self: center;
  border-radius: 14px;
  color: #8a96a4;
  background: rgba(18, 34, 51, 0.04);
}

.chat-messages {
  padding-bottom: 8px;
}

.message {
  gap: 14px;
}

.message-head {
  padding-top: 6px;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 15px;
  background:
    linear-gradient(135deg, #102f43 0%, #0f8f78 100%);
  color: #ffffff;
  font-weight: 700;
}

.message.user .message-avatar {
  background: linear-gradient(135deg, #e7ecef 0%, #d8e1e7 100%);
  color: #163040;
}

.message-body {
  padding: 22px 24px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(18, 34, 51, 0.05);
}

.message.assistant .message-body {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(247, 244, 237, 0.9) 100%);
}

.message-actions {
  gap: 8px;
}

.message-action,
.image-card-action {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(18, 34, 51, 0.08);
  background: rgba(247, 249, 251, 0.94);
  color: #163040;
  cursor: pointer;
}

.message-action:hover,
.image-card-action:hover,
.header-action-btn:hover,
.composer-tool:hover,
.thread-create-btn:hover,
.thread-ghost-btn:hover,
.utility-btn:hover,
.modal-tab:hover {
  transform: translateY(-1px);
}

.message-action.icon-action,
.image-card-action.icon-action,
.image-preview-action.icon-action {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.message-export-menu {
  border-radius: 18px;
  border-color: rgba(18, 34, 51, 0.08);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.1);
}

.tool-chip {
  border-radius: 999px;
  background: rgba(15, 143, 120, 0.08);
  border-color: rgba(15, 143, 120, 0.12);
}

.tool-chip.danger {
  background: rgba(185, 66, 91, 0.08);
}

.tool-preview {
  margin-top: 12px;
  border-radius: 20px;
  border: 1px solid rgba(18, 34, 51, 0.08);
  background: rgba(247, 249, 251, 0.94);
}

.image-result-card {
  border-radius: 24px;
  border: 1px solid rgba(18, 34, 51, 0.06);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(247, 244, 237, 0.94) 100%);
}

.image-result-head,
.image-result-foot {
  gap: 12px;
}

.image-result-download {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 14px;
  color: #ffffff;
  background: linear-gradient(135deg, #102f43 0%, #0f8f78 100%);
}

.image-result-prompt,
.image-result-facts {
  border-radius: 18px;
}

.image-result-badge {
  color: #0f725f;
  background: rgba(15, 143, 120, 0.08);
}

.composer-wrap {
  padding-top: 12px;
  padding-bottom: 28px;
}

.composer-card {
  border-radius: 32px;
  padding: 18px 20px 20px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(246, 241, 233, 0.92) 100%);
}

.composer-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(18, 34, 51, 0.06);
}

.composer-toolbar-main {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.composer-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 15px;
  border-radius: 14px;
  border: 1px solid rgba(18, 34, 51, 0.08);
  color: #173344;
  background: rgba(248, 249, 251, 0.96);
  cursor: pointer;
  font-weight: 600;
}

.composer-upload-tool input {
  display: none;
}

.composer-image-tool {
  color: #0f725f;
  border-color: rgba(15, 143, 120, 0.14);
  background: rgba(15, 143, 120, 0.08);
}

#composerInput {
  min-height: 74px;
  font-size: 16px;
  line-height: 1.7;
}

.composer-row {
  margin-top: 16px;
  align-items: center;
}

.composer-state,
.composer-actions {
  gap: 8px;
}

.stream-status,
.composer-tip,
.external-link-hint,
.memory-warning {
  font-size: 12px;
}

.stream-status {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(18, 34, 51, 0.05);
}

.send-btn {
  min-width: 126px;
  min-height: 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, #102f43 0%, #0f8f78 72%, #3ab396 100%);
}

.modal-card {
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 241, 233, 0.96) 100%);
}

body.header-panel-open .header-primary-btn {
  background: rgba(255, 255, 255, 0.92);
  color: #0f725f;
  border-color: rgba(15, 143, 120, 0.18);
  box-shadow: none;
}

body.chat-active .workspace-header {
  padding-top: 14px;
  padding-bottom: 14px;
}

body.chat-active .header-copy h2 {
  font-size: 28px;
}

body.chat-active .composer-card {
  border-radius: 28px;
}

@media (max-width: 1280px) {
  .hero-layout,
  .header-control-grid {
    grid-template-columns: 1fr;
  }

  .hero-card h3 {
    max-width: none;
  }

  .quick-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1040px) {
  .workspace-header,
  .header-control-panel,
  .welcome-panel,
  .file-tray,
  .chat-messages,
  .composer-wrap {
    padding-left: 18px;
    padding-right: 18px;
  }

  .header-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

@media (max-width: 768px) {
  .brand-copy h1 {
    font-size: 20px;
  }

  .sidebar-section-head,
  .quick-panel-head,
  .composer-toolbar,
  .composer-row,
  .composer-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .control-inline-row,
  .control-grid-compact,
  .quick-cards {
    grid-template-columns: 1fr;
  }

  .hero-card,
  .quick-panel,
  .composer-card {
    padding: 22px 18px;
  }

  .hero-card h3 {
    font-size: 32px;
  }

  .send-btn,
  .header-primary-btn,
  .header-action-btn,
  .composer-tool {
    width: 100%;
  }
}

/* 20260502i workstation refresh */
:root {
  --sidebar-bg: #eef2f7;
  --sidebar-panel: #ffffff;
  --sidebar-line: #d5ddea;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-muted: #f4f7fb;
  --line: #d8e0eb;
  --line-strong: #c4cfdd;
  --text: #1f232b;
  --muted: #66758a;
  --accent: #47658a;
  --accent-strong: #2f4c74;
  --accent-soft: #e7eef8;
  --shadow: 0 16px 36px rgba(24, 39, 75, 0.08);
}

body {
  background: var(--bg);
}

.app-shell {
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  grid-template-columns: 320px minmax(0, 1fr);
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 0 minmax(0, 1fr);
}

.sidebar {
  height: 100dvh;
  padding: 18px 16px;
  gap: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, #dce5ef 0%, #cfd9e5 100%);
  color: var(--text);
  border-right: 1px solid #c2cfde;
}

.sidebar-fixed {
  flex: 0 0 auto;
  display: grid;
  gap: 12px;
}

.sidebar-primary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  flex: 0 0 auto;
  margin-top: 12px;
}

.sidebar-head,
.sidebar-section {
  border-radius: 20px;
  border: 1px solid rgba(191, 206, 222, 0.82);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: none;
}

.sidebar-head {
  padding: 13px 14px;
}

.brand {
  align-items: flex-start;
  gap: 12px;
}

.brand-mark {
  width: 58px;
  height: 58px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent-strong);
  display: grid;
  place-items: center;
  border: 0;
  flex: 0 0 auto;
}

.brand-mark svg {
  width: 58px;
  height: 58px;
}

.brand-copy h1 {
  margin-top: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.brand-eyebrow,
.section-label {
  color: var(--muted);
  font-size: 12px;
}

.brand-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.brand-copy #sidebarStatus {
  margin-top: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.brand-tier {
  margin-top: 0 !important;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  color: var(--accent-strong);
  background: #edf4fc;
  border: 1px solid #d4dfef;
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
}

.thread-create-btn,
.send-btn,
.sidebar-action-btn,
.header-action-btn,
.composer-secondary-btn,
.message-action,
.image-preview-action,
.thread-ghost-btn,
.icon-btn,
.utility-btn,
.modal-close-btn,
.modal-tab {
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background-color 0.16s ease,
    box-shadow 0.16s ease;
}

.thread-create-btn {
  width: 100%;
  margin-top: 0;
  padding: 12px 16px;
  border-radius: 16px;
  color: #f8fbff;
  cursor: pointer;
  background: var(--accent-strong);
  box-shadow: none;
}

.sidebar-primary-btn.active,
.sidebar-primary-btn[aria-pressed="true"] {
  color: #f8fbff;
  background: var(--accent-strong);
  border-color: transparent;
  box-shadow: none;
}

.sidebar-new-thread-btn:focus,
.sidebar-new-thread-btn:focus-visible,
.sidebar-primary-btn:focus,
.sidebar-primary-btn:focus-visible,
.sidebar-feedback-btn:focus,
.sidebar-feedback-btn:focus-visible {
  outline: none;
  box-shadow: none;
}

.sidebar-new-thread-btn {
  min-height: 46px;
}

.sidebar-feedback-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  margin-top: 8px;
}

.sidebar-feedback-btn:hover {
  filter: brightness(1.02);
}

.feedback-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #d9392e;
  box-shadow: 0 0 0 3px rgba(217, 57, 46, 0.14);
}

.feedback-unread-dot.hidden {
  display: none;
}

.sidebar-primary-btn {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
}

.sidebar-action-stack {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.sidebar-action-stack-bottom {
  margin-top: 14px;
  grid-template-columns: 1fr 1fr;
}

.sidebar-action-btn {
  min-height: 42px;
  padding: 0 8px;
  border-radius: 14px;
  border: 1px solid #d7e0ea;
  color: var(--text);
  background: #f7faff;
  cursor: pointer;
  min-width: 0;
  font-size: 11.5px;
  line-height: 1;
  white-space: nowrap;
  word-break: normal;
}

.sidebar-action-btn-strong {
  min-height: 46px;
  font-size: 14px;
  font-weight: 600;
}

.sidebar-action-btn-primary {
  color: var(--accent-strong);
  border-color: #d4deec;
  background: #edf3fb;
}

.search-shell {
  margin-top: 0;
  padding: 11px 13px;
  border-radius: 14px;
  background: #f6f9fd;
  border: 1px solid #d8e1ec;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.search-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: #405778;
}

.search-icon svg {
  width: 16px;
  height: 16px;
}

.search-input {
  color: var(--text);
}

.search-input::placeholder {
  color: #8b98a9;
}

.sidebar-section {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 7px 14px 14px;
  overflow: hidden;
}

.sidebar-section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 7px;
}

.section-caption {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.thread-list {
  min-height: 0;
  flex: 1 1 auto;
  margin-top: 0;
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0 4px 0 0;
  gap: 6px;
}

.thread-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.thread-item,
.thread-empty {
  border-radius: 16px;
  background: #f7faff;
}

.thread-item {
  padding: 4px;
  border: 1px solid #dde4ee;
}

.thread-item.active {
  border-color: #c9d7ea;
  background: #e7eff9;
}

.thread-main {
  padding: 9px 10px 9px 12px;
  border-radius: 12px;
}

.thread-main strong {
  font-size: 13px;
}

.thread-main span {
  margin-top: 4px;
  font-size: 11px;
}

.thread-main em {
  margin-top: 4px;
  font-size: 10px;
}

.thread-main strong {
  color: var(--text);
}

.thread-main span {
  color: var(--muted);
}

.thread-item-actions {
  gap: 6px;
}

.thread-ghost-btn {
  min-width: 34px;
  min-height: 30px;
  padding: 0 8px;
  border-radius: 10px;
  border: 1px solid #dce4ee;
  color: #6a788b;
  background: #ffffff;
  font-size: 11px;
}

.thread-ghost-btn.danger {
  color: #ffffff;
  border-color: #b42318;
  background: #b42318;
  font-weight: 900;
}

.workspace {
  height: 100dvh;
  min-height: 100dvh;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background: #f6f8fb;
  overflow-y: auto;
  overscroll-behavior-y: contain;
}

.workspace-header {
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 248, 251, 0.96);
  backdrop-filter: blur(10px);
}

.workspace-header-inner {
  max-width: none;
  margin: 0;
}

.header-main {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.header-thread-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.workspace-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1.5px solid #161a22;
  background: #fffdf9;
  color: #111827;
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.04);
}

.icon-btn.workspace-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.workspace-icon-btn:hover {
  background: #f6f1e8;
  border-color: #0f172a;
  box-shadow: 0 8px 18px rgba(24, 39, 75, 0.08);
}

.workspace-icon-btn svg {
  width: 22px;
  height: 22px;
}

.icon-btn.workspace-icon-btn svg {
  width: 22px;
  height: 22px;
}

.header-copy {
  display: grid;
  gap: 4px;
}

.header-copy h2 {
  margin-top: 0;
  font-size: 24px;
  line-height: 1.15;
}

#statusLine,
.header-eyebrow {
  color: var(--muted);
}

#statusLine {
  display: none;
}

.header-eyebrow {
  display: none;
}

.sidebar-toggle {
  display: grid;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fffdf9;
  color: var(--text);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.header-control-grid {
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: #fffdf9;
  box-shadow: var(--shadow);
}

.control-section-head span {
  color: var(--muted);
}

.control-pill,
.username-input {
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fffdf9;
  box-shadow: none;
}

.toggle-pill input {
  accent-color: var(--accent);
}

.header-action-btn {
  min-height: 46px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fffdf9;
  color: var(--text);
  cursor: pointer;
}

.settings-modal-card {
  width: min(680px, 100%);
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  max-height: min(90dvh, 960px);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.settings-modal-card .header-control-grid {
  min-height: 0;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 0 0 10px;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  -webkit-overflow-scrolling: touch;
}

.settings-member-note {
  min-width: 0;
  margin: -2px 0 2px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid #d8e1ec;
  background: #f6f9fd;
  color: #465a73;
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

#headerPanelStatus.modal-status {
  min-width: 0;
  max-width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
}

.usage-panel {
  display: grid;
  gap: 10px;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid #d8e1ec;
  background: #ffffff;
  color: #2e4058;
}

.usage-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.usage-panel-head strong {
  font-size: 14px;
  line-height: 1.25;
}

.usage-panel-head span {
  min-width: 0;
  overflow: hidden;
  color: #607189;
  font-size: 12px;
  line-height: 1.35;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}


.usage-token-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 9px 10px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.usage-token-row div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.usage-token-row b {
  color: #0f766e;
  font-size: 19px;
  line-height: 1.05;
}

.usage-token-row em,
.usage-token-row span {
  color: #64748b;
  font-size: 11px;
  font-style: normal;
  line-height: 1.2;
  white-space: nowrap;
}

.usage-token-bar {
  overflow: hidden;
  height: 7px;
  border-radius: 999px;
  background: #e2e8f0;
}

.usage-token-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #14b8a6, #f59e0b);
}

.usage-quota-warning {
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #9a3412;
  font-size: 12px;
  line-height: 1.45;
}

.usage-upgrade-btn {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.usage-upgrade-btn:hover,
.usage-upgrade-btn:focus-visible {
  border-color: #fb923c;
  background: #ffedd5;
  outline: none;
}

.usage-panel-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.usage-panel-grid span {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px 10px;
  border-radius: 12px;
  background: #f4f7fb;
}

.usage-panel-grid b {
  overflow: hidden;
  color: #22364f;
  font-size: 16px;
  line-height: 1.1;
  text-overflow: ellipsis;
}

.usage-panel-grid em {
  color: #65758a;
  font-size: 11px;
  font-style: normal;
  line-height: 1.2;
  white-space: nowrap;
}

.settings-modal-card .control-section {
  display: grid;
  gap: 12px;
  padding: 15px;
  border-radius: 18px;
  border: 1px solid rgba(213, 224, 238, 0.78);
  background: rgba(249, 251, 254, 0.82);
}

.settings-modal-card .control-section-head {
  display: grid;
  gap: 6px;
}

.settings-modal-card .control-section-head strong {
  font-size: 16px;
  line-height: 1.25;
}

.settings-modal-card .control-section-head span {
  margin-top: 0;
  font-size: 12.5px;
  line-height: 1.6;
}

.settings-modal-card .compact-section {
  gap: 10px;
}

.settings-modal-card .compact-section-head {
  gap: 0;
}

.settings-modal-card .control-section-body {
  margin-top: 0;
}

.settings-modal-card .control-grid-compact,
.settings-modal-card .control-grid-stack {
  gap: 12px;
}

.settings-modal-card .control-pill,
.settings-modal-card .username-input,
.settings-modal-card .header-action-btn {
  min-height: 44px;
}

.settings-modal-card .control-pill {
  padding: 0 14px;
}

.settings-modal-card .control-select {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
}

.settings-modal-card .control-select span {
  margin: 0;
  white-space: nowrap;
}

.settings-modal-card .control-select select {
  min-width: 0;
}

.settings-modal-card .toggle-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
}

.settings-modal-card .toggle-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-modal-card .control-inline-row {
  grid-template-columns: minmax(0, 1fr) 124px;
}

.settings-modal-card .settings-action-row {
  justify-content: flex-start;
}

.settings-action-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.settings-export-btn {
  min-width: 132px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#memoryModal .modal-card {
  width: min(760px, 100%);
}

#memoryModal .modal-head,
#headerControlPanel .modal-head {
  align-items: flex-start;
}

#memoryModal .modal-head > div,
#headerControlPanel .modal-head > div {
  min-width: 0;
}

#memoryModal .modal-head h3,
#headerControlPanel .modal-head h3 {
  line-height: 1.18;
  word-break: keep-all;
}

#memoryModal .modal-hint,
#headerControlPanel .modal-hint {
  font-size: 13px;
}

#memoryModal .modal-actions {
  justify-content: flex-end;
}

#memoryModal .modal-actions .modal-primary-btn,
#memoryModal .modal-actions .modal-secondary-btn {
  min-width: 120px;
}

.feedback-modal-card {
  width: min(620px, 100%);
  grid-template-rows: auto auto auto auto auto;
}

.feedback-thread {
  max-height: 220px;
  overflow: auto;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d8e1ec;
  border-radius: 18px;
  background: #f7faff;
}

.feedback-message {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid #dce4ef;
  background: #ffffff;
}

.feedback-message.admin {
  border-color: #cfdced;
  background: #edf3fb;
}

.feedback-message-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #617089;
  font-size: 12px;
}

.feedback-message-meta b {
  color: #2f4c74;
}

.feedback-message p {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
}

.feedback-input {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1.5px solid #d5deea;
  background: #ffffff;
  color: var(--text);
  line-height: 1.65;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.feedback-input:focus {
  border-color: #2f4c74;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(47, 76, 116, 0.12);
}

.modal-primary-btn,
.modal-secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  min-width: 118px;
  padding: 0 16px;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

.modal-primary-btn {
  color: #f8fbff;
  border: 1px solid #2f4c74;
  background: #2f4c74;
}

.modal-secondary-btn {
  color: #2f4c74;
  border: 1px solid #cfd9e7;
  background: #f6f9fd;
}

.modal-primary-btn:hover,
.modal-secondary-btn:hover {
  transform: translateY(-1px);
}

.modal-primary-btn:disabled,
.modal-secondary-btn:disabled {
  cursor: not-allowed;
  opacity: 0.68;
  transform: none;
}

.feedback-submit-btn {
  min-width: 120px;
}

#headerPanelStatus {
  margin-top: 2px;
}

#headerPanelStatus.hidden {
  display: none;
}

#headerPanelStatus.done {
  color: #215d4f;
  background: #e8f5f1;
  border-color: #c7e2da;
}

#headerPanelStatus.error {
  color: #8e3145;
  background: #fbecef;
  border-color: #efcdd5;
}

@media (max-width: 900px) {
  .settings-modal-card .header-control-grid {
    grid-template-columns: 1fr;
  }

  .settings-modal-card .control-inline-row {
    grid-template-columns: 1fr;
  }

  .usage-panel-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .usage-panel-head span {
    max-width: 100%;
    text-align: left;
  }

  .usage-panel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-modal-card .settings-action-row {
    justify-content: stretch;
  }

  .settings-modal-card .settings-action-row .header-action-btn,
  .settings-modal-card .verify-btn {
    width: 100%;
  }
}

.workspace-scroll {
  min-height: 0;
  overflow: visible;
  padding-bottom: 16px;
}

.welcome-panel,
.file-tray,
.chat-messages {
  padding-left: 24px;
  padding-right: 24px;
}

.welcome-panel {
  padding-top: 20px;
}

.hero-card,
.quick-panel,
.composer-card,
.file-chip,
.message-body,
.modal-card {
  box-shadow: var(--shadow);
}

.hero-card {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 30px;
  border-radius: 24px;
  border: 1px solid #dde5ef;
  background: #fcfdff;
}

.hero-layout {
  display: block;
}

.hero-badge {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 12px;
}

.hero-card h3 {
  max-width: none;
  margin: 16px 0 0;
  font-size: 40px;
  line-height: 1.08;
  letter-spacing: -0.05em;
  color: #1f232b;
}

.hero-card p {
  margin-top: 12px;
  max-width: 720px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.68;
}

.hero-note {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #dbe5f0;
  background: #f3f8ff;
  color: #53657a;
  font-size: 13px;
}

.quick-panel {
  max-width: 1180px;
  margin: 18px auto 0;
  padding: 18px 18px 16px;
  border-radius: 20px;
  border: 1px solid #dde5ef;
  background: #fcfdff;
}

.quick-panel-head {
  margin-bottom: 10px;
}

.quick-panel-head strong {
  font-size: 18px;
  letter-spacing: -0.03em;
  color: #1f232b;
}

.quick-panel-kicker {
  color: var(--muted);
  font-size: 12px;
}

.quick-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-height: 178px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 2px 4px 0 0;
  overscroll-behavior: contain;
}

.quick-cards::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.quick-card {
  position: relative;
  min-height: 0;
  height: 82px;
  padding: 12px 15px;
  border-radius: 16px;
  border: 1px solid #dde5ef;
  background: #ffffff;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  overflow: hidden;
}

.quick-card-add {
  border-style: dashed;
  background: #f7fafc;
}

.quick-card-add .quick-card-icon {
  color: #263f61;
}

.quick-card .quick-card-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid #d7e0ec;
  background: #ffffff;
  color: #6a7a8e;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
}

.quick-card .quick-card-delete:hover,
.quick-card .quick-card-delete:focus-visible {
  color: #9f2f2f;
  border-color: #eccaca;
  background: #fff7f7;
  outline: none;
}

.quick-card:hover {
  transform: translateY(-2px);
  border-color: #c9d7ea;
  box-shadow: 0 12px 24px rgba(24, 39, 75, 0.08);
}

.quick-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  flex-wrap: nowrap;
  margin-top: 0;
}

.quick-card .quick-card-head,
.quick-card .quick-card-icon {
  display: inline-flex;
}

.quick-card-icon {
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  color: var(--accent-strong);
  flex: 0 0 auto;
  margin-top: 0;
}

.quick-card-icon svg {
  width: 24px;
  height: 24px;
}

.quick-card-head strong {
  display: block;
  min-width: 0;
  margin: 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-card strong {
  margin-top: 0;
  font-size: 16px;
  color: #1f232b;
}

.quick-card span {
  margin-top: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.42;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.custom-prompt-modal-card {
  max-width: 640px;
}

.feedback-modal-card,
.custom-prompt-modal-card {
  overflow: auto;
  overscroll-behavior: contain;
}

.custom-prompt-field {
  display: grid;
  gap: 8px;
  color: #324256;
  font-size: 13px;
  font-weight: 700;
}

.custom-prompt-input,
.custom-prompt-textarea {
  width: 100%;
  padding: 13px 15px;
  border-radius: 16px;
  border: 1.5px solid #d5deea;
  background: #ffffff;
  color: var(--text);
  outline: none;
  font: inherit;
  font-weight: 500;
  line-height: 1.6;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.custom-prompt-textarea {
  min-height: 150px;
  resize: vertical;
}

.custom-prompt-input:focus,
.custom-prompt-textarea:focus {
  border-color: #2f4c74;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(47, 76, 116, 0.12);
}

.file-tray,
.chat-messages {
  padding-top: 16px;
}

.file-tray-inner,
.message,
.composer-card {
  max-width: 1180px;
}

.file-chip {
  border-radius: 18px;
  border: 1px solid #e1d9cc;
  background: #fffdf9;
}

.file-chip-remove {
  background: #f2ede5;
  color: #6b645a;
}

.chat-messages {
  min-height: 0;
  overflow: auto;
  padding-bottom: 16px;
}

.message {
  gap: 12px;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: #2a2d33;
  color: #f8f5ef;
}

.message.user .message-avatar {
  background: #8d6a4a;
  color: #fff8f0;
}

.message-body {
  padding: 20px 22px;
  border-radius: 24px;
  background: #fffdf9;
  border: 1px solid #e4dbcf;
}

.message.assistant .message-body,
.image-result-card,
.tool-preview,
.modal-card,
.bottom-modal-card {
  background: #fffdf9;
}

.message-action,
.image-card-action {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid #ded6c9;
  background: #f7f2ea;
  color: #2b302f;
}

.tool-chip {
  border-color: #e0d3c1;
  background: #f2e9dd;
  color: #5f432c;
}

.tool-chip.danger {
  background: #f6e7e7;
}

.image-result-download {
  background: #6c4d33;
}

.image-result-badge {
  color: #5f432c;
  background: #efe4d6;
}

.composer-wrap {
  position: sticky;
  bottom: 0;
  z-index: 8;
  padding: 14px 24px 24px;
  background: rgba(246, 248, 251, 0.96);
  border-top: 1px solid var(--line);
}

.composer-card {
  padding: 14px;
  border-radius: 22px;
  border: 1px solid #cad6e4;
  background: #ffffff;
  box-shadow:
    0 8px 18px rgba(30, 50, 76, 0.07),
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.composer-input-shell {
  display: block;
}

.composer-actions,
.composer-row {
  min-width: 0;
}

@media (max-height: 560px) {
  .composer-wrap {
    padding-top: 12px;
  }

  .composer-card {
    padding: 14px;
  }

  .composer-row {
    flex-direction: column;
    align-items: stretch;
  }

  .composer-button-group {
    width: 100%;
    justify-content: stretch;
  }

  .composer-button-group > * {
    flex: 1 1 0;
  }
}

@media (max-width: 560px) {
  .modal-shell {
    padding: 10px;
    align-items: stretch;
  }

  .modal-card {
    max-height: calc(100dvh - 20px);
    padding: 16px;
    gap: 10px;
    border-radius: 22px;
  }

  .feedback-modal-card,
  .custom-prompt-modal-card {
    width: 100%;
  }

  .modal-head {
    gap: 10px;
  }

  .modal-head h3 {
    font-size: 21px;
  }

  .feedback-thread {
    max-height: 120px;
  }

  .feedback-input {
    min-height: 106px;
    max-height: 24dvh;
  }

  .custom-prompt-textarea {
    min-height: 100px;
    max-height: 28dvh;
  }

  .modal-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .modal-actions .modal-primary-btn,
  .modal-actions .modal-secondary-btn,
  .modal-actions .utility-btn {
    width: 100%;
    min-width: 0;
  }
}

.composer-plus-btn {
  width: 48px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 1px solid #d8e1ec;
  background: #f7faff;
  color: var(--accent-strong);
  cursor: pointer;
  flex: 0 0 auto;
}

.composer-plus-btn input {
  display: none;
}

.composer-plus-btn span {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  transform: translateY(-1px);
}

#composerInput {
  min-height: 82px;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid #9fb1c8;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  color: var(--text);
  box-shadow:
    0 12px 26px rgba(30, 50, 76, 0.12),
    0 2px 6px rgba(30, 50, 76, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  font-size: 15px;
  line-height: 1.65;
  resize: none;
  width: 100%;
  transition:
    border-color 0.22s ease,
    background 0.22s ease,
    box-shadow 0.22s ease,
    transform 0.22s ease;
}

#composerInput:focus {
  outline: none;
  border-color: rgba(47, 76, 116, 0.62);
  background: #ffffff;
  box-shadow:
    0 14px 30px rgba(30, 50, 76, 0.14),
    0 3px 8px rgba(30, 50, 76, 0.07),
    0 0 0 1px rgba(47, 76, 116, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
  transform: translateY(-1px);
}

#composerInput::placeholder {
  color: #8a8176;
}

.composer-row {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.composer-state {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 24px;
}

.stream-status,
.external-link-hint,
.memory-warning,
.composer-tip {
  font-size: 12px;
}

.stream-status {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef4fb;
  color: #4f6683;
}

.composer-button-group {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: nowrap;
}

.send-btn {
  min-width: 108px;
  min-height: 44px;
  border-radius: 14px;
  color: #f8fbff;
  background: var(--accent-strong);
  box-shadow: none;
  font-weight: 800;
  white-space: nowrap;
}

.send-btn.stop-btn {
  background: #8f2f2b;
  color: #fffaf8;
}

.send-btn:hover,
.thread-create-btn:hover,
.sidebar-action-btn:hover,
.header-action-btn:hover,
.message-action:hover,
.thread-ghost-btn:hover,
.utility-btn:hover,
.modal-tab:hover,
.composer-plus-btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
}

.modal-card {
  border-radius: 24px;
  border: 1px solid #e2dace;
}

body.header-panel-open .sidebar-action-btn-primary {
  background: #dfeaf7;
  color: var(--accent-strong);
}

.composer-card.drag-active,
.chat-messages.drag-active {
  border-color: #bfd0e6;
  background: #f3f8ff;
}

body.chat-active .workspace-header {
  padding-top: 14px;
  padding-bottom: 14px;
}

/* 20260503d desktop layout polish */
.sidebar-primary-actions {
  margin-top: 0;
  flex: 0 0 auto;
}

.sidebar-section .section-label {
  color: #33445a;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-transform: none;
}

.thread-ghost-btn {
  font-weight: 800;
}

.workspace {
  min-height: 0;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.workspace-header {
  position: relative;
  z-index: 16;
  flex: 0 0 auto;
}

.workspace-header-inner {
  width: 100%;
}

.header-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.header-main::after {
  content: "";
  display: block;
  width: 148px;
  height: 1px;
}

.header-thread-actions {
  justify-self: start;
  align-items: center;
  gap: 8px;
}

.header-copy {
  justify-items: center;
  text-align: center;
  min-width: 0;
}

.header-copy h2 {
  width: 100%;
  text-align: center;
}

.icon-btn.workspace-icon-btn.sidebar-toggle {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
}

.icon-btn.workspace-icon-btn.sidebar-toggle:hover {
  background: transparent;
  box-shadow: none;
}

.icon-btn.workspace-icon-btn.sidebar-toggle svg {
  width: 31px;
  height: 31px;
}

.icon-btn.workspace-icon-btn.header-new-thread-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #111827;
  box-shadow: none;
}

.icon-btn.workspace-icon-btn.header-new-thread-btn:hover {
  background: transparent;
  box-shadow: none;
}

.icon-btn.workspace-icon-btn.header-new-thread-btn svg {
  width: 31px;
  height: 31px;
}

.workspace-scroll {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 16px;
  overscroll-behavior: contain;
}

.chat-messages {
  overflow: visible;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: #2a2d33;
  color: #f8f5ef;
}

.message-avatar svg {
  width: 31px;
  height: 31px;
}

.message.user .message-avatar {
  display: none;
}

.message.user .message-body {
  color: #213248;
  background: #eaf0f7;
  border-color: #d5dfeb;
  box-shadow: 0 12px 28px rgba(47, 76, 116, 0.08);
}

.message.user .rich-text h2,
.message.user .rich-text h3,
.message.user .rich-text h4,
.message.user .rich-text strong,
.message.user .rich-text em {
  color: #1f3148;
}

.message.user .rich-text code {
  color: #1f3148;
  background: rgba(255, 255, 255, 0.62);
}

.message.user .rich-text blockquote {
  color: #33465f;
  background: rgba(255, 255, 255, 0.42);
  border-left-color: rgba(47, 76, 116, 0.26);
}

.file-tray-inner {
  width: 100%;
}

.file-chip {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  align-items: center;
}

.file-chip-actions {
  min-width: max-content;
}

.file-chip-main {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.file-chip-main strong,
.file-chip-main span,
.file-chip-main em {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-chip-main em {
  margin-top: 3px;
}

.file-chip-remove,
.modal-close-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 14px;
  border: 1px solid #d8e1ec;
  background: #f6f9fd;
  color: #5f6f83;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
}

.file-chip-remove:hover,
.modal-close-btn:hover {
  color: #9a3648;
  border-color: #efcdd5;
  background: #fbecf0;
}

.close-icon-btn {
  position: relative;
  overflow: hidden;
  font-size: 0 !important;
  line-height: 1 !important;
}

.close-icon-btn::before,
.close-icon-btn::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
}

.close-icon-btn::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.close-icon-btn::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.message.assistant.streaming.thinking .message-body {
  width: fit-content;
  min-width: 154px;
  padding: 14px 16px;
}

.thinking-indicator {
  display: inline-flex;
  align-items: flex-end;
  gap: 9px;
  color: #42546c;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
}

.thinking-dots {
  display: inline-flex;
  align-items: flex-end;
  gap: 4px;
  padding-bottom: 3px;
}

.thinking-dots i {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #52657d;
  opacity: 0.32;
  animation: thinking-dot 1.05s ease-in-out infinite;
}

.thinking-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.thinking-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes thinking-dot {
  0%, 80%, 100% {
    opacity: 0.28;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.composer-wrap {
  position: relative;
  bottom: auto;
  flex: 0 0 auto;
}

@media (max-width: 1280px) {
  .quick-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .sidebar-toggle {
    display: grid;
  }

  #statusLine {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(320px, calc(100vw - 28px));
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 32;
    background: rgba(17, 19, 24, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    display: block;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-scrim {
    opacity: 1;
    pointer-events: auto;
  }
}

body.sidebar-collapsed .sidebar {
  width: 0;
  min-width: 0;
  padding: 0;
  border-right: 0;
  overflow: hidden;
}

body.sidebar-collapsed .sidebar > * {
  display: none;
}

.thread-list .thread-item .thread-item-actions .thread-ghost-btn {
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 10px;
  border: 0;
  color: #6a788b;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.thread-list .thread-item .thread-item-actions .thread-ghost-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.thread-list .thread-item .thread-item-actions .thread-ghost-btn.danger,
.thread-list .thread-item .thread-item-actions .thread-ghost-btn[data-thread-action="delete"] {
  color: #a32017;
  background: transparent;
  text-shadow: none;
}

.file-chip-remove.icon-action,
.inline-action.danger,
.inline-action[data-memory-action="delete"],
.inline-action[data-memory-file-action="delete"] {
  color: #a32017;
  border-color: transparent;
  background: transparent;
  font-weight: 900;
  text-shadow: none;
}

.thread-list .thread-item .thread-item-actions .thread-ghost-btn.danger:hover,
.thread-list .thread-item .thread-item-actions .thread-ghost-btn[data-thread-action="delete"]:hover {
  color: #831a13;
  background: transparent;
}

.thread-list .thread-item .thread-item-actions .thread-ghost-btn:focus,
.thread-list .thread-item .thread-item-actions .thread-ghost-btn:focus-visible {
  outline: none;
  box-shadow: none;
  background: transparent;
}

.file-chip-remove.icon-action:hover,
.file-chip-remove.icon-action:focus-visible,
.inline-action.danger:hover,
.inline-action.danger:focus-visible,
.inline-action[data-memory-action="delete"]:hover,
.inline-action[data-memory-action="delete"]:focus-visible,
.inline-action[data-memory-file-action="delete"]:hover,
.inline-action[data-memory-file-action="delete"]:focus-visible {
  color: #831a13;
  border-color: transparent;
  background: rgba(163, 32, 23, 0.08);
}

@media (max-width: 768px) {
  .workspace-header,
  .welcome-panel,
  .file-tray,
  .chat-messages,
  .composer-wrap {
    padding-left: 16px;
    padding-right: 16px;
  }

  .header-control-grid,
  .quick-cards,
  .sidebar-action-stack,
  .composer-row,
  .composer-button-group {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .hero-card {
    padding: 24px 20px;
  }

  .hero-card h3 {
    font-size: 34px;
  }

  .composer-row,
  .composer-button-group {
    flex-direction: column;
    align-items: stretch;
  }
}

body.app-restoring .welcome-panel,
body.app-restoring #accessBadge {
  visibility: hidden;
}

.workspace-header,
body.chat-active .workspace-header {
  min-height: 58px;
  padding-top: 10px;
  padding-bottom: 10px;
  background: rgba(246, 248, 251, 0.96);
}

.header-copy h2,
body.chat-active .header-copy h2 {
  margin-top: 0;
  font-size: 24px;
  line-height: 1.15;
}

#statusLine,
body.chat-active #statusLine {
  margin-top: 4px;
  font-size: 12px;
}

.icon-btn.workspace-icon-btn.sidebar-toggle,
.icon-btn.workspace-icon-btn.header-new-thread-btn {
  width: 42px;
  height: 42px;
}

.icon-btn.workspace-icon-btn.sidebar-toggle svg,
.icon-btn.workspace-icon-btn.header-new-thread-btn svg {
  width: 29px;
  height: 29px;
}

.thread-list .thread-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  padding: 6px 8px;
  margin: 0;
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    background-color 0.16s ease,
    box-shadow 0.16s ease;
}

.thread-list .thread-item:hover {
  border-color: #c5d5e9;
  background: #eef5ff;
  box-shadow: 0 6px 14px rgba(24, 39, 75, 0.07);
}

.thread-list .thread-item.active:hover {
  border-color: #bdd0e8;
  background: #e3edf9;
}

.thread-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.thread-title-btn.thread-main,
.thread-preview-main.thread-main {
  width: 100%;
  min-width: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
}

.thread-title-btn.thread-main strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 760;
  line-height: 1.24;
}

.thread-preview-main.thread-main span,
.thread-preview-main.thread-main em {
  display: block;
  margin-top: 1px;
  line-height: 1.24;
}

.thread-preview-main.thread-main span {
  color: #536173;
  font-size: 12px;
}

.thread-preview-main.thread-main em {
  color: #6f7d8e;
  font-size: 11px;
}

.thread-list .thread-item .thread-item-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  position: relative;
  z-index: 3;
}

.thread-list .thread-item .thread-item-actions .thread-ghost-btn {
  position: relative;
  z-index: 4;
  width: 24px;
  min-width: 24px;
  min-height: 26px;
  padding: 0;
  border-radius: 9px;
  font-size: 10px;
  pointer-events: auto;
}


.thread-history-more {
  display: flex;
  justify-content: center;
  padding: 8px 0 14px;
}

.thread-history-more button {
  border: 1px solid rgba(16, 163, 127, 0.22);
  border-radius: 999px;
  background: rgba(16, 163, 127, 0.08);
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 14px;
}

.thread-history-more button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.thread-item.loading {
  opacity: 0.78;
}

.thread-edit-modal-card {
  width: min(520px, 100%);
  grid-template-rows: auto auto auto auto;
}

.thread-edit-field {
  display: grid;
  gap: 8px;
  color: #324256;
  font-size: 13px;
  font-weight: 700;
}

.thread-edit-input {
  width: 100%;
  padding: 13px 15px;
  border-radius: 16px;
  border: 1.5px solid #d5deea;
  background: #ffffff;
  color: var(--text);
  outline: none;
  font: inherit;
  font-weight: 500;
  line-height: 1.6;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.thread-edit-input:focus {
  border-color: #2f4c74;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(47, 76, 116, 0.12);
}

.modal-primary-btn.danger {
  color: #ffffff;
  border-color: #a32017;
  background: #a32017;
}

.modal-primary-btn.danger:hover {
  border-color: #831a13;
  background: #831a13;
}

.document-result-card {
  gap: 10px;
  border-color: rgba(37, 99, 235, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(239, 246, 255, 0.96) 100%);
}

.document-result-card .image-result-title {
  min-width: 0;
}

.document-result-card .image-result-title strong,
.document-result-card .image-result-title span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.document-result-card .image-result-title span {
  white-space: nowrap;
}

.document-result-note {
  margin: -2px 0 0;
  padding: 9px 10px;
  border: 1px solid rgba(147, 197, 253, 0.32);
  border-radius: 12px;
  background: rgba(239, 246, 255, 0.78);
  color: #1d4ed8;
  font-size: 12px;
  line-height: 1.55;
}

.document-result-actions {
  gap: 7px;
}

.message-document-attachments {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.message-document-attachments .document-result-card {
  box-shadow: none;
}

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

.image-result-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.86);
  color: inherit;
  text-decoration: none;
}

.image-result-tile img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  background: #f8fafc;
}

.image-result-tile span {
  color: #475569;
  font-size: 12px;
  word-break: break-all;
}

.feedback-attach-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.feedback-screenshot-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.model-red {
  color: #d60000;
  font-weight: 800;
}

.rich-text code,
.message.user .rich-text code {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #1e3a5f;
  font-size: 0.95em;
  font-family: "SFMono-Regular", "Consolas", "Liberation Mono", monospace;
}

.rich-text pre {
  overflow: auto;
  max-width: 100%;
  padding: 14px 16px;
  border-radius: 0;
  border: 0;
  background: transparent;
  color: #1f3148;
  font-size: 13px;
  line-height: 1.58;
}

.code-block-card {
  border: 1px solid rgba(96, 125, 159, 0.24);
  border-radius: 18px;
  overflow: hidden;
  background: #f8fbff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.code-block-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  color: #35516f;
  background: linear-gradient(180deg, #eef5fc 0%, #e8f0f8 100%);
  border-bottom: 1px solid rgba(96, 125, 159, 0.16);
  font-size: 12px;
  font-weight: 700;
}

.code-copy-btn {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  color: #1d4ed8;
  background: #ffffff;
  cursor: pointer;
  font-weight: 700;
}

.code-block-card pre {
  background: #fbfdff;
  color: #1f3148;
}

.code-block-card pre code {
  display: block;
  padding: 0;
  background: transparent;
  color: inherit;
  border-radius: 0;
}

.text-block-card {
  border-color: rgba(16, 163, 127, 0.18);
  background: #f8fffc;
}

.text-block-card .code-block-head {
  color: #0f766e;
  background: linear-gradient(180deg, #effcf8 0%, #e7f8f2 100%);
}

.text-block-card pre {
  background: #ffffff;
}

.tool-preview-row.compact {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.72);
}

.tool-preview-row.primary {
  background: rgba(236, 253, 245, 0.64);
  border-color: rgba(16, 163, 127, 0.16);
}

.tool-preview-row.compact strong {
  font-size: 12px;
  color: #0f766e;
}

.image-result-card.compact {
  gap: 10px;
  padding: 14px;
}

.image-result-preview-link {
  display: block;
  border-radius: 18px;
  overflow: hidden;
}

.image-result-actions.compact {
  padding-top: 0;
}

.image-result-direct-actions {
  justify-content: flex-start;
  gap: 8px;
}

.image-result-direct-actions .image-card-action {
  flex: 0 0 auto;
}

.image-result-card.compact .image-card-action {
  color: #244b70;
  border-color: rgba(36, 75, 112, 0.18);
  background: rgba(244, 247, 250, 0.92);
}

.image-result-card.compact .image-card-action.primary[data-image-action="download-preview"] {
  color: #0f766e;
  border-color: rgba(15, 118, 110, 0.18);
  background: rgba(15, 118, 110, 0.1);
}

.image-result-card.compact .image-card-action.primary[data-image-action="regenerate"] {
  color: #244b70;
  border-color: rgba(36, 75, 112, 0.18);
  background: rgba(244, 247, 250, 0.92);
}

.image-result-notice {
  margin: -2px 0 0;
  color: #475569;
  font-size: 12px;
  line-height: 1.45;
}

.image-result-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.image-result-badge.warning {
  color: #a16207;
  background: rgba(234, 179, 8, 0.12);
}

.image-result-grid.clean {
  grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
}

.image-result-tile.clean {
  padding: 0;
  overflow: hidden;
}

.image-result-tile.clean img {
  border-radius: 16px;
  transition: transform 0.18s ease;
}

.image-result-tile.clean:hover img {
  transform: scale(1.015);
}

.image-result-preview-link,
.image-result-tile.clean {
  border: 0;
  background: transparent;
  cursor: zoom-in;
  text-align: left;
}

.image-result-preview-error {
  display: block;
  margin: 0;
  padding: 16px;
  border: 1px dashed rgba(148, 163, 184, 0.54);
  border-radius: 16px;
  color: #64748b;
  background: rgba(248, 250, 252, 0.82);
  font-size: 12px;
  line-height: 1.5;
}

.image-result-preview-link:hover .image-result-preview,
.image-result-preview-link:focus-visible .image-result-preview {
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12);
}

.image-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 28px;
}

.image-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 13, 24, 0.68);
  backdrop-filter: blur(10px);
}

.image-preview-card {
  position: relative;
  width: min(980px, 100%);
  max-height: min(88vh, 900px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  padding: 16px;
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
}

.image-preview-head,
.image-preview-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.image-preview-head strong {
  color: #0f172a;
  font-size: 16px;
}

.image-preview-close {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #475569;
  background: rgba(15, 23, 42, 0.06);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.image-preview-body {
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  border-radius: 20px;
  background: #0f172a;
}

.image-preview-body img {
  max-width: 100%;
  max-height: calc(88vh - 150px);
  object-fit: contain;
}

.image-preview-actions {
  justify-content: flex-end;
}

.image-preview-action {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  color: #475569;
  background: rgba(248, 250, 252, 0.96);
  cursor: pointer;
}

.image-preview-action.primary {
  border-color: rgba(15, 118, 110, 0.18);
  color: #0f766e;
  background: rgba(15, 118, 110, 0.10);
}

.image-result-preview-link,
.image-result-tile.clean {
  width: 100%;
  padding: 0;
}

.image-result-card.compact .image-result-head {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.image-result-card.compact .image-card-action {
  flex: 0 0 auto;
}

.image-result-tile.clean img {
  object-fit: contain;
  background: #f8fafc;
}

.image-result-grid.clean {
  align-items: stretch;
}

.thread-loading-state {
  margin: 28px auto;
  max-width: 520px;
  border: 1px solid rgba(64, 96, 140, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  color: #33506f;
  box-shadow: 0 18px 45px rgba(38, 61, 87, 0.09);
  padding: 18px 20px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
}

.thread-loading-state.error {
  border-color: rgba(180, 57, 57, 0.22);
  color: #a13a3a;
}

/* Desktop text rendering pass: prefer real CJK glyphs and avoid compressed Chinese letterforms. */
body[data-terminal="desktop"],
body[data-terminal="desktop"] button,
body[data-terminal="desktop"] input,
body[data-terminal="desktop"] select,
body[data-terminal="desktop"] textarea {
  font-family: "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}

body[data-terminal="desktop"] .brand-copy h1,
body[data-terminal="desktop"] .header-copy h2,
body[data-terminal="desktop"] .section-label,
body[data-terminal="desktop"] .thread-title-btn.thread-main strong,
body[data-terminal="desktop"] .thread-preview-main.thread-main span,
body[data-terminal="desktop"] .thread-preview-main.thread-main em,
body[data-terminal="desktop"] .rich-text h2,
body[data-terminal="desktop"] .rich-text h3,
body[data-terminal="desktop"] .rich-text h4,
body[data-terminal="desktop"] .control-section-head strong,
body[data-terminal="desktop"] .quick-panel-head strong,
body[data-terminal="desktop"] .quick-card strong,
body[data-terminal="desktop"] .hero-card h3,
body[data-terminal="desktop"] .modal-head h3,
body[data-terminal="desktop"] .thread-edit-modal-card,
body[data-terminal="desktop"] .message-body,
body[data-terminal="desktop"] .message-action,
body[data-terminal="desktop"] .send-btn,
body[data-terminal="desktop"] .sidebar-action-btn,
body[data-terminal="desktop"] .header-action-btn,
body[data-terminal="desktop"] .modal-tab {
  letter-spacing: 0;
}

body[data-terminal="desktop"] .thread-title-btn.thread-main strong,
body[data-terminal="desktop"] .quick-card strong,
body[data-terminal="desktop"] .control-section-head strong,
body[data-terminal="desktop"] .modal-head h3 {
  font-weight: 700;
}

body[data-terminal="desktop"] .thread-preview-main.thread-main span,
body[data-terminal="desktop"] .thread-preview-main.thread-main em,
body[data-terminal="desktop"] .brand-copy #sidebarStatus,
body[data-terminal="desktop"] #statusLine,
body[data-terminal="desktop"] .quick-card span,
body[data-terminal="desktop"] .control-section-head span,
body[data-terminal="desktop"] .settings-option-hint,
body[data-terminal="desktop"] .modal-hint,
body[data-terminal="desktop"] .modal-status {
  font-weight: 400;
}

body[data-terminal="desktop"] .message-body,
body[data-terminal="desktop"] #composerInput,
body[data-terminal="desktop"] .username-input,
body[data-terminal="desktop"] .thread-edit-input,
body[data-terminal="desktop"] .custom-prompt-textarea,
body[data-terminal="desktop"] .feedback-input {
  color: #111827;
}
