:root {
  color-scheme: light;
  --ai-bg: #f6f8fb;
  --ai-sidebar: #ffffff;
  --ai-card: #ffffff;
  --ai-border: #e5eaf1;
  --ai-primary: #111827;
  --ai-primary-hover: #0b1220;
  --ai-accent: #475569;
  --ai-brand-blue: #2259ad;
  --ai-brand-blue-dark: #103f86;
  --ai-text: #111827;
  --ai-text-soft: #374151;
  --ai-muted: #6b7280;
  --ai-muted-light: #9ca3af;
  --ai-soft-blue: #f3f6fa;
  --ai-soft-cyan: #eef2f7;
  --ai-warning: #8a5a00;
  --ai-warning-bg: #fff8e8;
  --ai-danger: #be123c;
  --ai-danger-bg: #fff1f2;
  --ai-shadow: 0 18px 50px rgba(17, 24, 39, 0.08);
  --ai-shadow-soft: 0 16px 36px rgba(17, 24, 39, 0.07);
  --ai-radius-lg: 24px;
  --ai-radius-md: 16px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ai-bg);
  color: var(--ai-text-soft);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

body.is-mobile-menu-open {
  overflow: hidden;
}

.mobile-topbar,
.mobile-backdrop,
.mobile-drawer-head,
.mobile-empty-title {
  display: none;
}

.access-gate {
  min-height: 100vh;
  padding: 24px;
  place-items: center;
  background: var(--ai-bg);
}

body.is-access-locked .ai-page {
  display: none;
}

body.is-access-locked .access-gate:not([hidden]) {
  display: grid;
}

.access-gate-card {
  display: grid;
  width: min(100%, 420px);
  justify-items: center;
  padding: 34px 30px;
  border: 1px solid var(--ai-border);
  border-radius: 24px;
  background: #ffffff;
  box-shadow: var(--ai-shadow);
  text-align: center;
}

.access-gate-icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 18px;
  place-items: center;
  border: 1px solid var(--ai-border);
  border-radius: 18px;
  background: #ffffff;
}

.access-gate-icon img {
  display: block;
  width: 46px;
  height: 46px;
  object-fit: contain;
}

.access-gate h1 {
  margin: 0;
  color: var(--ai-text);
  font-size: 24px;
  font-weight: 900;
  line-height: 1.25;
}

.access-gate p {
  margin: 12px 0 0;
  color: var(--ai-text-soft);
  font-size: 15px;
  line-height: 1.65;
}

.access-gate-note {
  max-width: 320px;
  color: var(--ai-muted) !important;
  font-size: 13px !important;
}

.test-entry {
  display: grid;
}

.test-entry-card {
  width: min(100%, 460px);
}

.test-entry-form {
  display: grid;
  width: 100%;
  gap: 12px;
  margin-top: 22px;
  text-align: left;
}

.test-entry-form label {
  color: var(--ai-text);
  font-size: 13px;
  font-weight: 800;
}

.test-entry-form input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid #d7e0ec;
  border-radius: 14px;
  background: #ffffff;
  color: var(--ai-text);
  font: inherit;
  outline: none;
}

.test-entry-form input:focus {
  border-color: var(--ai-brand-blue);
  box-shadow: 0 0 0 4px rgba(34, 89, 173, 0.12);
}

.test-entry-message {
  min-height: 22px;
  margin-top: 16px !important;
  font-size: 13px !important;
  font-weight: 700;
}

.test-entry-message[data-state="error"] {
  color: var(--ai-danger) !important;
}

.test-entry-message[data-state="info"] {
  color: var(--ai-muted) !important;
}

button,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.ai-page {
  width: min(100%, 1240px);
  margin: 0 auto;
  padding: 24px;
}

.ai-shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  column-gap: 22px;
  row-gap: 0;
  align-items: stretch;
  min-height: calc(100vh - 48px);
}

.ai-sidebar {
  display: flex;
  grid-column: 1;
  grid-row: 1;
  flex-direction: column;
  gap: 18px;
  height: 100%;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--ai-border);
  border-radius: var(--ai-radius-lg);
  background: var(--ai-sidebar);
  box-shadow: var(--ai-shadow);
}

.ai-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-bottom: 4px;
}

.ai-brand-icon {
  display: grid;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  overflow: hidden;
  place-items: center;
  border: 1px solid var(--ai-border);
  border-radius: 16px;
  background: #ffffff;
}

.ai-brand-icon img {
  display: block;
  width: 42px;
  height: 42px;
  object-fit: contain;
}

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

.ai-brand h1 {
  margin: 0;
  color: var(--ai-text);
  font-size: 21px;
  font-weight: 900;
  line-height: 1.15;
}

.ai-brand p {
  margin: 6px 0 0;
  color: var(--ai-muted);
  font-size: 13px;
  line-height: 1.45;
}

.sidebar-group {
  display: grid;
  gap: 10px;
}

.section-title,
.field-label,
.composer-label,
.attachment-title {
  margin: 0;
  color: var(--ai-text);
  font-size: 13px;
  font-weight: 900;
}

.quota-card {
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--ai-border);
  border-radius: var(--ai-radius-md);
  background: #fbfcfe;
}

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

.quota-card-head span {
  color: var(--ai-text);
  font-size: 13px;
  font-weight: 900;
}

.quota-card-head small {
  color: var(--ai-muted-light);
  font-size: 12px;
  font-weight: 700;
}

.quota-number {
  display: block;
  color: var(--ai-primary);
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
}

.quota-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f7;
}

.quota-progress-bar {
  display: block;
  width: 16%;
  height: 100%;
  border-radius: inherit;
  background: var(--ai-accent);
  transition: width 0.24s ease;
}

.quota-helper,
.model-hint,
.search-card p,
.search-control small,
.privacy-note,
.attachment-panel p,
#modelMeta {
  color: var(--ai-muted);
  font-size: 13px;
  line-height: 1.55;
}

.quota-helper {
  margin: 0;
}

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

.quota-stats span {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #e6eaf0;
  border-radius: 12px;
  background: #ffffff;
}

.quota-stats small,
.quota-stats strong {
  display: block;
}

.quota-stats small {
  color: var(--ai-muted-light);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.quota-stats strong {
  margin-top: 4px;
  overflow: hidden;
  color: var(--ai-text);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setting-block {
  display: grid;
  gap: 9px;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--ai-border);
  background: #ffffff;
  color: var(--ai-text);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

select {
  height: 42px;
  padding: 0 12px;
  border-radius: 12px;
}

#modelSelect {
  font-size: 14px;
  font-weight: 750;
  line-height: 1.2;
}

#modelSelect option {
  font-size: 14px;
}

textarea {
  min-height: 126px;
  max-height: 280px;
  padding: 10px 2px;
  resize: vertical;
  border: 0;
  border-radius: 0;
  background: transparent;
  line-height: 1.65;
}

textarea::placeholder {
  color: var(--ai-muted-light);
}

select:focus {
  border-color: #c7d0dc;
  box-shadow: 0 0 0 4px rgba(17, 24, 39, 0.06);
}

textarea:focus {
  box-shadow: none;
}

.model-hint {
  min-height: 52px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
}

.search-card {
  padding: 14px;
  border: 1px solid var(--ai-border);
  border-radius: var(--ai-radius-md);
  background: #ffffff;
  transition: border-color 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}

.search-card.is-active {
  border-color: #cfd8e3;
  background: #f8fafc;
}

.search-card.is-disabled {
  opacity: 0.62;
}

.search-card p {
  margin: 10px 0 0;
}

.search-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  column-gap: 12px;
  align-items: center;
}

.search-control span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.search-control strong {
  color: var(--ai-text);
  font-size: 14px;
  font-weight: 900;
}

.search-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.search-control i {
  position: relative;
  display: block;
  justify-self: center;
  align-self: center;
  box-sizing: border-box;
  width: 44px;
  height: 24px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #f8fafc;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.search-control i::after {
  position: absolute;
  box-sizing: border-box;
  top: 50%;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #94a3b8;
  content: "";
  transform: translateY(-50%);
  transition: transform 0.18s ease, background 0.18s ease;
}

.search-control input:checked + i {
  border-color: var(--ai-accent);
  background: var(--ai-soft-cyan);
}

.search-control input:checked + i::after {
  transform: translate(20px, -50%);
  background: var(--ai-accent);
}

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

.quick-task {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid var(--ai-border);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--ai-text-soft);
  font-size: 13px;
  font-weight: 800;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.quick-task:hover {
  border-color: #cbd5e1;
  background: #eef2f7;
  color: var(--ai-primary);
}

.safety-group {
  margin-top: 2px;
}

@media (min-width: 768px) {
  .safety-group {
    margin-top: auto;
  }
}

.privacy-note {
  margin: 0;
  padding: 12px 13px;
  border: 1px solid #f3e5bf;
  border-radius: var(--ai-radius-md);
  background: var(--ai-warning-bg);
  color: #7c5a16;
}

.ai-main {
  display: contents;
}

.chat-form {
  display: flex;
  grid-column: 2;
  grid-row: 1;
  height: 100%;
  min-height: 0;
  flex: 1;
}

.ai-card {
  border: 1px solid var(--ai-border);
  border-radius: var(--ai-radius-lg);
  background: var(--ai-card);
  box-shadow: var(--ai-shadow);
}

.chat-workspace {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 700px;
  overflow: hidden;
  flex-direction: column;
  flex: 1;
}

.chat-panel-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--ai-border);
  background: #ffffff;
}

.ai-card-title {
  margin: 0;
  color: var(--ai-text);
  font-size: 16px;
  font-weight: 900;
}

#modelMeta {
  margin: 5px 0 0;
}

.response-actions,
.composer-left,
.composer-right {
  display: flex;
  gap: 10px;
  align-items: center;
}

.response-actions {
  flex: 0 0 auto;
}

.chat-history {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  padding: 24px;
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
}

.error-box {
  margin-bottom: 14px;
  padding: 13px 15px;
  border: 1px solid #fecdd3;
  border-radius: var(--ai-radius-md);
  background: var(--ai-danger-bg);
  color: var(--ai-danger);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.6;
  white-space: pre-wrap;
}

.response-body {
  flex: 1;
  min-height: 360px;
  max-height: none;
  overflow: auto;
  color: var(--ai-text-soft);
  font-size: 15px;
  line-height: 1.75;
  white-space: normal;
}

.response-body.is-empty {
  display: grid;
  place-items: center;
  white-space: normal;
}

.empty-state {
  display: grid;
  width: min(100%, 640px);
  gap: 20px;
  padding: 20px 18px 24px;
  text-align: center;
}

.empty-state-core {
  display: grid;
  justify-items: center;
}

.empty-icon {
  display: inline-grid;
  width: 58px;
  height: 58px;
  place-items: center;
  margin-bottom: 16px;
  border: 1px solid #e0e7f0;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.06);
}

.empty-icon img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.empty-state h3 {
  margin: 0;
  color: var(--ai-text);
  font-size: 23px;
  font-weight: 900;
}

.empty-state p {
  margin: 10px auto 0;
  color: var(--ai-muted);
  font-size: 15px;
  line-height: 1.7;
}

.btn-soft,
.attachment-button,
.attachment-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d8e0ea;
  border-radius: 999px;
  background: var(--ai-soft-blue);
  color: #334155;
  font-weight: 800;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.btn-soft {
  height: 38px;
  gap: 8px;
  padding: 0 16px;
  font-size: 13px;
}

.btn-soft:hover:not(:disabled),
.attachment-button:hover,
.attachment-remove:hover {
  border-color: #cbd5e1;
  background: #e8edf3;
  color: #111827;
}

.btn-soft:disabled {
  opacity: 0.5;
}

.response-body.is-loading {
  display: grid;
  place-items: center;
  white-space: normal;
}

.thinking-summary {
  max-width: 880px;
  margin: 0 0 20px;
  padding: 0;
  background: transparent;
  color: var(--ai-muted);
  font-size: 14px;
  line-height: 1.72;
}

.thinking-label {
  display: flex;
  gap: 9px;
  align-items: center;
  margin-bottom: 7px;
  color: var(--ai-muted);
  font-size: 13px;
  font-weight: 700;
}

.thinking-mark {
  display: inline-grid;
  width: 28px;
  height: 18px;
  place-items: center;
}

.thinking-mark img {
  display: block;
  width: 28px;
  height: 28px;
  filter: grayscale(1);
  opacity: 0.26;
  object-fit: contain;
}

.thinking-bubble {
  margin-left: 10px;
  padding: 15px 18px 16px;
  border-left: 1px solid #e5eaf1;
  border-radius: 0 16px 16px 0;
  background: #ffffff;
  color: #4b5563;
  box-shadow: 0 12px 28px rgba(17, 24, 39, 0.04);
}

.thinking-bubble p {
  margin: 0;
}

.thinking-bubble p + p {
  margin-top: 12px;
}

.assistant-message {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 14px;
  align-items: flex-start;
  max-width: 880px;
}

.assistant-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--ai-border);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(17, 24, 39, 0.06);
}

.assistant-avatar img {
  width: 29px;
  height: 29px;
  object-fit: contain;
}

.answer-prose {
  min-width: 0;
  color: #1f2937;
  font-size: 15px;
  line-height: 1.82;
  overflow-wrap: anywhere;
}

.answer-prose > *:first-child {
  margin-top: 0;
}

.answer-prose > *:last-child {
  margin-bottom: 0;
}

.answer-prose p {
  margin: 0 0 12px;
}

.answer-prose h3,
.answer-prose h4,
.answer-prose h5 {
  margin: 18px 0 8px;
  color: var(--ai-text);
  font-weight: 900;
  line-height: 1.35;
}

.answer-prose h3 {
  font-size: 18px;
}

.answer-prose h4 {
  font-size: 16px;
}

.answer-prose h5 {
  font-size: 15px;
}

.answer-prose ul,
.answer-prose ol {
  display: grid;
  gap: 7px;
  margin: 8px 0 14px;
  padding-left: 22px;
}

.answer-prose li::marker {
  color: var(--ai-brand-blue);
  font-weight: 900;
}

.answer-table-wrap {
  max-width: 100%;
  margin: 12px 0 16px;
  overflow-x: auto;
  border: 1px solid #dbe4ef;
  border-radius: 14px;
  background: #ffffff;
}

.answer-prose table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.55;
}

.answer-prose th,
.answer-prose td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5eaf1;
  text-align: left;
  vertical-align: top;
}

.answer-prose th {
  background: #f8fafc;
  color: var(--ai-text);
  font-weight: 900;
  white-space: nowrap;
}

.answer-prose td {
  color: #334155;
}

.answer-prose tbody tr:last-child td {
  border-bottom: 0;
}

.answer-prose strong {
  color: var(--ai-text);
  font-weight: 900;
}

.answer-prose a {
  color: var(--ai-brand-blue-dark);
  font-weight: 800;
  text-decoration: none;
}

.answer-prose a:hover {
  text-decoration: underline;
}

.answer-prose code {
  padding: 2px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #f8fafc;
  color: #0f172a;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.code-block {
  margin: 14px 0;
  overflow: auto;
  border: 1px solid #1f2937;
  border-radius: 16px;
  background: #0f172a;
  color: #e5e7eb;
}

.code-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 8px 14px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.14);
  background: rgba(15, 23, 42, 0.98);
}

.code-copy-button {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid rgba(203, 213, 225, 0.28);
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.88);
  color: #e5e7eb;
  font-size: 12px;
  font-weight: 900;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.code-copy-button:hover {
  border-color: rgba(203, 213, 225, 0.52);
  background: rgba(51, 65, 85, 0.95);
}

.answer-prose pre {
  margin: 0;
  overflow: auto;
  background: transparent;
}

.answer-prose pre code {
  display: block;
  padding: 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre;
}

.code-lang {
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.4;
}

.loading-state {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--ai-primary);
  font-weight: 900;
}

.loading-dots {
  display: inline-flex;
  gap: 4px;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--ai-accent);
  animation: aiPulse 1s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.12s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.24s;
}

@keyframes aiPulse {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.42;
  }

  50% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.grounding-box {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--ai-border);
  border-radius: var(--ai-radius-md);
  background: #fbfcfe;
}

.search-suggestions:empty {
  display: none;
}

.sources-box h3 {
  margin: 8px 0 10px;
  color: var(--ai-text);
  font-size: 14px;
}

.sources-box ol {
  margin: 0;
  padding-left: 20px;
}

.sources-box li {
  margin: 6px 0;
  color: var(--ai-muted);
  font-size: 14px;
  line-height: 1.5;
}

.sources-box a {
  color: #334155;
  overflow-wrap: anywhere;
}

.search-queries {
  margin: 12px 0 0;
  color: var(--ai-muted);
  font-size: 13px;
  line-height: 1.5;
}

.composer-panel {
  display: grid;
  gap: 8px;
  margin: 0 22px 22px;
  padding: 16px 18px;
  border: 1px solid #d9e2ee;
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 20px 44px rgba(17, 24, 39, 0.09);
}

.composer-panel:focus-within {
  border-color: #c7d0dc;
  box-shadow: 0 22px 50px rgba(17, 24, 39, 0.12);
}

.composer-panel.is-search-active {
  border-color: rgba(34, 89, 173, 0.62);
  box-shadow:
    0 0 0 3px rgba(34, 89, 173, 0.08),
    0 20px 44px rgba(17, 24, 39, 0.09);
}

.composer-panel.is-search-active:focus-within {
  border-color: rgba(34, 89, 173, 0.76);
  box-shadow:
    0 0 0 3px rgba(34, 89, 173, 0.12),
    0 22px 50px rgba(17, 24, 39, 0.12);
}

.tool-notice {
  margin: 0;
  padding: 9px 11px;
  border: 1px solid #f3e5bf;
  border-radius: 12px;
  background: var(--ai-warning-bg);
  color: #7c5a16;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.composer-topline {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.composer-topline span {
  color: var(--ai-muted-light);
  font-size: 12px;
  font-weight: 700;
}

.composer-label {
  width: fit-content;
}

.composer-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid #eef2f6;
}

.composer-left {
  display: grid;
  gap: 8px;
  min-width: 0;
}

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

.composer-left .search-card {
  flex: 0 0 auto;
  width: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.composer-left .search-card.is-active,
.composer-left .search-card.is-disabled {
  background: transparent;
}

.composer-left .search-card p {
  display: none;
}

.composer-left .search-control {
  display: inline-grid;
  width: fit-content;
  min-height: 38px;
  grid-template-columns: auto 44px;
  column-gap: 8px;
  align-items: center;
  padding: 0 8px 0 14px;
  border: 1px solid #d8e0ea;
  border-radius: 999px;
  background: var(--ai-soft-blue);
  line-height: 1;
}

.composer-left .search-control span {
  gap: 0;
}

.composer-left .search-control strong {
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

.composer-left .search-control small {
  display: none;
}

.composer-right {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
}

.attachment-panel {
  display: grid;
  width: min(100%, 640px);
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
}

.attachment-panel.is-disabled {
  opacity: 0.68;
}

.attachment-control-row {
  display: block;
}

.attachment-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.attachment-title {
  display: block;
  margin: 0 0 3px;
}

.attachment-panel p {
  margin: 0;
}

.attachment-button {
  flex: 0 0 auto;
  height: 38px;
  min-height: 38px;
  padding: 0 16px;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.composer-tools-row .btn-soft {
  line-height: 1;
  white-space: nowrap;
}

.attachment-panel.is-disabled + .composer-tools-row .attachment-button {
  opacity: 0.62;
  cursor: not-allowed;
}

#attachmentInput {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.attachment-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.attachment-list:empty {
  display: none;
}

.attachment-list li {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--ai-border);
  border-radius: 12px;
  background: #f8fafc;
}

.attachment-list li > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.attachment-list span {
  min-width: 0;
  overflow: hidden;
  color: var(--ai-text);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-list small {
  color: var(--ai-muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.attachment-remove {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.char-count {
  color: var(--ai-muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.char-count.is-near-limit {
  color: var(--ai-danger);
}

.send-button {
  min-width: 116px;
  height: 46px;
  padding: 0 28px;
  border: 1px solid #c8d7ee;
  border-radius: 999px;
  background: #f8fbff;
  box-shadow: 0 8px 18px rgba(16, 63, 134, 0.1);
  color: var(--ai-brand-blue-dark);
  font-weight: 900;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
}

.send-button:hover:not(:disabled) {
  border-color: #9fb9df;
  background: #eef5ff;
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(16, 63, 134, 0.14);
}

.send-button:disabled {
  opacity: 0.62;
}

@media (max-width: 1199px) {
  .ai-page {
    padding: 22px 18px;
  }

  .ai-shell {
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 18px;
  }

  .ai-sidebar {
    padding: 20px;
  }

  .chat-workspace {
    min-height: 650px;
  }
}

@media (max-width: 767px) {
  html,
  body {
    min-height: 100%;
    background: #ffffff;
  }

  .ai-page {
    width: 100%;
    min-height: 100dvh;
    padding: 0;
    background: #ffffff;
  }

  .ai-shell {
    display: block;
    min-height: 100dvh;
  }

  .mobile-topbar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 70;
    display: flex;
    width: 100%;
    height: 56px;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
  }

  .mobile-icon-button {
    display: inline-grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #111827;
  }

  .mobile-menu-button {
    gap: 4px;
    align-content: center;
  }

  .mobile-menu-button span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: #111827;
  }

  .mobile-new-button img {
    width: 28px;
    height: 28px;
    object-fit: contain;
  }

  .mobile-backdrop:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 55;
    display: block;
    background: rgba(15, 23, 42, 0.28);
  }

  .ai-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 60;
    width: min(86vw, 320px);
    height: 100dvh;
    max-height: 100dvh;
    padding: 20px 20px calc(28px + env(safe-area-inset-bottom));
    overflow-x: hidden;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    border-radius: 0 24px 24px 0;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 18px 0 48px rgba(15, 23, 42, 0.18);
  }

  .mobile-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: -4px 0 14px;
  }

  .mobile-drawer-head strong {
    color: var(--ai-text);
    font-size: 18px;
    font-weight: 900;
  }

  .mobile-close-button {
    color: #475569;
    font-size: 24px;
    font-weight: 500;
    line-height: 1;
  }

  body.is-mobile-menu-open .ai-sidebar {
    transform: translateX(0);
  }

  .safety-group {
    margin-top: 0;
  }

  .chat-form {
    display: block;
    width: 100%;
    height: 100dvh;
  }

  .chat-workspace {
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
    background: #ffffff;
    box-shadow: none;
  }

  .chat-panel-header {
    display: none;
  }

  .chat-history {
    min-height: 0;
    padding: 72px 18px 142px;
    overflow-y: auto;
    background: #ffffff;
  }

  .response-body {
    min-height: 0;
    font-size: 15px;
  }

  .response-body.is-empty {
    min-height: calc(100dvh - 220px);
    place-items: center;
  }

  .empty-state {
    width: min(100%, 360px);
    padding: 0 8px;
  }

  .empty-icon,
  .empty-state p,
  .empty-state h3:not(.mobile-empty-title) {
    display: none;
  }

  .mobile-empty-title {
    display: block;
  }

  .empty-state h3 {
    color: #111827;
    font-size: 25px;
    font-weight: 500;
    line-height: 1.35;
  }

  .assistant-message {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 10px;
    max-width: 100%;
  }

  .thinking-summary {
    margin-left: 40px;
  }

  .assistant-avatar {
    width: 30px;
    height: 30px;
    border-radius: 11px;
    box-shadow: none;
  }

  .assistant-avatar img {
    width: 23px;
    height: 23px;
  }

  .composer-panel {
    position: fixed;
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 12px;
    z-index: 45;
    gap: 4px;
    margin: 0;
    padding: 10px 12px 12px;
    border-color: #d9dee8;
    border-radius: 26px;
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.16);
  }

  .composer-topline,
  .attachment-control-row > div:first-child,
  .char-count,
  #clearButton {
    display: none;
  }

  textarea {
    min-height: 42px;
    max-height: 138px;
    padding: 7px 2px;
    font-size: 16px;
    line-height: 1.55;
  }

  .tool-notice {
    padding: 7px 9px;
    font-size: 12px;
    line-height: 1.4;
  }

  .composer-footer {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    padding-top: 4px;
    border-top: 0;
  }

  .composer-left {
    display: flex;
    width: auto;
    min-width: 0;
    align-items: center;
  }

  .attachment-panel {
    display: block;
    width: auto;
  }

  .attachment-panel.is-disabled {
    display: none;
  }

  .composer-left .search-card {
    width: auto;
  }

  .composer-left .search-card.is-disabled {
    display: block;
    opacity: 0.62;
  }

  .composer-left .search-card.is-disabled .search-control {
    cursor: not-allowed;
  }

  .composer-left .search-control {
    grid-template-columns: auto 42px;
    column-gap: 6px;
    min-height: 36px;
    padding: 0 4px 0 10px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #ffffff;
  }

  .composer-left .search-control strong {
    font-size: 13px;
    font-weight: 800;
  }

  .composer-left .search-control i {
    width: 36px;
    height: 20px;
  }

  .composer-left .search-control i::after {
    left: 3px;
    width: 14px;
    height: 14px;
  }

  .composer-left .search-control input:checked + i::after {
    transform: translate(16px, -50%);
  }

  .attachment-control-row {
    display: block;
  }

  .attachment-actions {
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .composer-right {
    width: auto;
    gap: 8px;
    justify-content: flex-end;
  }

  .attachment-button {
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    border-color: #e5e7eb;
    border-radius: 999px;
    background: #ffffff;
    color: transparent;
    font-size: 0;
  }

  .attachment-button::before {
    color: #111827;
    content: "+";
    font-size: 25px;
    font-weight: 400;
    line-height: 1;
  }

  .send-button {
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    border-color: #d7e4f6;
    border-radius: 999px;
    font-size: 0;
    box-shadow: 0 6px 14px rgba(16, 63, 134, 0.1);
  }

  .send-button::before {
    content: "↑";
    font-size: 21px;
    font-weight: 900;
    line-height: 1;
  }

  .attachment-list {
    max-height: 92px;
    overflow-y: auto;
  }

  .answer-prose,
  .code-block,
  .answer-table-wrap {
    max-width: 100%;
  }

  .answer-prose pre {
    overflow-x: auto;
  }
}

@media (max-width: 520px) {
  .ai-sidebar {
    padding: 18px;
  }

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

  .attachment-list li {
    align-items: flex-start;
    flex-direction: column;
  }

  .btn-soft {
    padding: 0 14px;
  }
}
