:root {
  color-scheme: light;
  --brand-blue: #4b86fe;
  --brand-blue-deep: #2f6fec;
  --brand-dark: #11161a;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --surface-strong: #eef2f6;
  --text: var(--brand-dark);
  --text-muted: #647183;
  --border: #dfe5ec;
  --border-strong: #cbd4df;
  --primary: var(--brand-blue);
  --primary-hover: var(--brand-blue-deep);
  --primary-soft: #edf4ff;
  --success: #13795b;
  --success-soft: #e8f7f1;
  --warning: #8a5700;
  --warning-soft: #fff5d9;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --sidebar-width: 348px;
  --shadow: 0 18px 50px rgba(17, 22, 26, 0.08);
  --radius-large: 20px;
  --radius-medium: 13px;
  --radius-small: 10px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button,
input[type="checkbox"] {
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
}

:focus-visible {
  outline: 3px solid rgba(75, 134, 254, 0.3);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 9px 13px;
  color: #fff;
  background: var(--primary);
  border-radius: var(--radius-small);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

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

[hidden] {
  display: none !important;
}

.auth-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 15%, rgba(75, 134, 254, 0.2), transparent 34%),
    radial-gradient(circle at 85% 85%, rgba(75, 134, 254, 0.1), transparent 30%),
    var(--bg);
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.auth-card {
  position: relative;
  width: min(420px, 100%);
  padding: 40px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 30px 90px rgba(17, 22, 26, 0.14);
}

.auth-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--brand-blue), #8bb3ff);
  content: "";
}

.auth-card h1 {
  margin: 10px 0 8px;
  font-size: 30px;
  letter-spacing: -0.03em;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.auth-brand .t2o-logo {
  width: 82px;
}

.auth-brand span {
  padding-left: 14px;
  border-left: 1px solid var(--border-strong);
  font-weight: 760;
}

.auth-mark {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 20px;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #1769e0, #0f4da4);
  border-radius: 16px;
  font-weight: 850;
}

.auth-copy {
  margin: 0 0 24px;
  color: var(--text-muted);
}

.auth-form {
  display: grid;
  gap: 18px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  padding: 11px 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-small);
}

.auth-form input:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(75, 134, 254, 0.13);
  outline: 0;
}

.microsoft-oauth-card {
  width: min(620px, 100%);
}

.oauth-steps {
  display: grid;
  gap: 9px;
  margin: 0 0 24px;
  padding-left: 22px;
  color: var(--text-muted);
}

.oauth-response-form {
  margin-top: 22px;
}

.oauth-response-form textarea {
  width: 100%;
  padding: 12px;
  resize: vertical;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-small);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.oauth-response-form textarea:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(75, 134, 254, 0.13);
  outline: 0;
}

.oauth-back-link {
  display: block;
  margin-top: 22px;
  color: var(--text-muted);
  text-align: center;
}

.user-session {
  position: fixed;
  z-index: 30;
  top: 14px;
  right: 16px;
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 7px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(17, 22, 26, 0.1);
  backdrop-filter: blur(14px);
}

.session-separator {
  width: 1px;
  height: 26px;
  margin: 0 5px;
  background: var(--border);
}

.session-user {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding: 0 7px;
}

.session-avatar {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--brand-dark);
  background: var(--primary-soft);
  border: 1px solid #d8e6ff;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 850;
}

.session-name {
  max-width: 180px;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-session form {
  margin: 0;
}

body:not([data-platform]) #new-conversation {
  display: none;
}

body[data-platform] .user-session {
  top: 0;
  right: 0;
  left: var(--sidebar-width);
  min-height: 72px;
  justify-content: flex-end;
  padding: 12px clamp(20px, 3vw, 44px);
  background: rgba(255, 255, 255, 0.92);
  border-width: 0 0 1px;
  border-radius: 0;
  box-shadow: 0 4px 20px rgba(17, 22, 26, 0.04);
}

body[data-platform] #new-conversation {
  color: #174aab;
  background: var(--primary-soft);
  border-color: #d6e5ff;
}

.history-dialog {
  width: min(680px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 28px));
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
}

.history-dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(2px);
}

.history-dialog-card {
  display: flex;
  max-height: min(760px, calc(100vh - 28px));
  flex-direction: column;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.history-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.history-dialog-header h2 {
  margin: 2px 0 0;
  font-size: 24px;
}

.history-dialog-header .button {
  min-width: 40px;
  padding: 5px;
  font-size: 24px;
}

.history-dialog-copy {
  margin: 12px 0 16px;
  color: var(--text-muted);
}

.history-list {
  display: grid;
  min-height: 0;
  margin: 0 -5px 14px;
  padding: 0 5px;
  gap: 7px;
  overflow-y: auto;
  list-style: none;
}

.history-item-button {
  display: grid;
  width: 100%;
  gap: 7px;
  padding: 13px 14px;
  color: var(--text);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  text-align: left;
}

.history-item-button:hover {
  background: var(--primary-soft);
  border-color: #b7cdf1;
}

.history-item-title {
  overflow: hidden;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  color: var(--text-muted);
  font-size: 12px;
}

.history-item-mode {
  justify-self: start;
  padding: 2px 7px;
  color: var(--success);
  background: var(--success-soft);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
}

.history-item-mode.read-only {
  color: var(--warning);
  background: var(--warning-soft);
}

.platform-gate {
  display: grid;
  min-height: 100vh;
  padding: 32px 20px;
  place-items: center;
  background:
    radial-gradient(circle at 15% 15%, rgba(23, 105, 224, 0.12), transparent 34%),
    radial-gradient(circle at 85% 85%, rgba(138, 83, 196, 0.1), transparent 30%),
    var(--bg);
}

.platform-picker {
  width: min(820px, 100%);
  padding: clamp(24px, 4vw, 40px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.platform-picker h1 {
  max-width: 620px;
  margin-bottom: 12px;
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.12;
}

.platform-picker-copy {
  max-width: 640px;
  margin-bottom: 28px;
  color: var(--text-muted);
  font-size: 16px;
}

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

.platform-card {
  display: grid;
  min-height: 104px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  color: var(--text);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  text-align: left;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.platform-card:not(:disabled):hover,
.platform-card:not(:disabled):focus-visible {
  border-color: var(--primary);
  box-shadow: 0 10px 24px rgba(19, 33, 56, 0.1);
  transform: translateY(-2px);
}

.platform-card.meta:not(:disabled):hover,
.platform-card.meta:not(:disabled):focus-visible {
  border-color: #8652c7;
}

.platform-card-mark,
.welcome-platform-mark {
  display: grid;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #1769e0, #0f4da4);
  border-radius: 15px;
  font-size: 15px;
  font-weight: 850;
}

.platform-card.meta .platform-card-mark {
  background: linear-gradient(145deg, #8a53c6, #6640a5);
}

.platform-card strong,
.platform-card small {
  display: block;
}

.platform-card strong {
  margin-bottom: 6px;
  font-size: 18px;
}

.platform-card small {
  color: var(--text-muted);
  line-height: 1.45;
}

.platform-card-arrow {
  color: var(--text-muted);
  font-size: 24px;
}

.platform-picker > .read-only-badge {
  margin-top: 24px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 24px 22px 18px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

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

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #1769e0, #0f4da4);
  border-radius: 12px;
  box-shadow: 0 7px 16px rgba(23, 105, 224, 0.25);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.platform-switcher {
  margin-top: 20px;
}

.platform-switcher-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.platform-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  max-height: 156px;
  padding: 4px;
  overflow-y: auto;
  background: var(--surface-strong);
  border-radius: 10px;
  scrollbar-color: #c6ced8 transparent;
  scrollbar-width: thin;
}

.platform-tabs button {
  min-height: 34px;
  padding: 6px 9px;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 720;
}

.platform-tabs button.active {
  color: var(--primary);
  background: var(--surface);
  box-shadow: 0 2px 6px rgba(19, 33, 56, 0.08);
}

body[data-platform="meta"] .brand-mark,
body[data-platform="meta"] .welcome-platform-mark {
  background: linear-gradient(145deg, #8a53c6, #6640a5);
  box-shadow: 0 7px 16px rgba(102, 64, 165, 0.22);
}

.read-only-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 7px;
  margin-top: 20px;
  padding: 6px 10px;
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid #bce8d8;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: var(--success);
  border-radius: 50%;
}

.account-panel {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  margin-top: 26px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-heading h2,
.conversation-heading h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}

.selection-count {
  min-width: 52px;
  padding: 4px 8px;
  color: var(--text-muted);
  background: var(--surface-strong);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  text-align: center;
}

.selection-count.at-limit {
  color: var(--warning);
  background: var(--warning-soft);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  color: var(--text-muted);
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.search-box:focus-within {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 105, 224, 0.12);
}

.search-box svg,
.button svg,
.welcome-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.search-box input {
  width: 100%;
  min-width: 0;
  padding: 9px 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
}

.search-box input::placeholder,
.composer textarea::placeholder {
  color: #8a95a6;
}

.account-actions {
  display: flex;
  gap: 6px;
  margin-top: 9px;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  font-weight: 700;
  line-height: 1.2;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 100ms ease;
}

.button:not(:disabled):active {
  transform: translateY(1px);
}

.button:disabled {
  opacity: 0.55;
}

.button-primary {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.button-primary:not(:disabled):hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.button-secondary {
  color: #344054;
  background: var(--surface);
  border-color: var(--border-strong);
}

.button-secondary:not(:disabled):hover {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: #b7cdf1;
}

.button-quiet {
  color: var(--text-muted);
  background: transparent;
}

.button-quiet:not(:disabled):hover {
  color: var(--text);
  background: var(--surface-strong);
}

.button-small {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 12px;
}

.button-full {
  width: 100%;
}

.inline-status {
  margin: 12px 2px 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.account-list {
  flex: 1;
  min-height: 120px;
  margin: 2px -5px 0;
  padding: 0 5px 8px;
  list-style: none;
  overflow: auto;
  scrollbar-color: #c6ced8 transparent;
  scrollbar-width: thin;
}

.account-item {
  margin: 3px 0;
}

.account-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-medium);
  transition: background 150ms ease, border-color 150ms ease;
}

.account-option:hover {
  background: var(--surface-subtle);
  border-color: var(--border);
}

.account-option.selected {
  background: var(--primary-soft);
  border-color: #bcd1f3;
}

.account-option.unavailable {
  opacity: 0.58;
}

.account-option input {
  width: 16px;
  height: 16px;
  margin: 3px 0 0;
  accent-color: var(--primary);
}

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

.account-name {
  display: block;
  overflow: hidden;
  font-size: 13px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
}

.account-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.account-badge {
  padding: 2px 5px;
  color: #475467;
  background: var(--surface-strong);
  border-radius: 5px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.account-badge.manager {
  color: #0f5e9c;
  background: #dff2ff;
}

.account-badge.test {
  color: #704f00;
  background: #fff1c2;
}

.empty-state {
  margin: 15px 5px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.sidebar-footer {
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.sidebar-footer p {
  margin: 9px 0 0;
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
}

.sidebar-footer .catalog-help {
  line-height: 1.45;
  text-align: left;
}

.catalog-help strong {
  color: var(--text);
  font-weight: 700;
}

.main-content {
  display: flex;
  width: 100%;
  max-width: 1160px;
  min-width: 0;
  min-height: 100vh;
  flex-direction: column;
  justify-self: center;
  padding: 0 44px 22px;
}

.conversation-header {
  display: flex;
  min-height: 88px;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
  border-bottom: 1px solid var(--border);
}

.scope-bar {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 13px 0;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.scope-bar > span:first-child {
  flex: 0 0 auto;
  padding-top: 5px;
  font-weight: 700;
}

.account-tags {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 6px;
}

.account-tag,
.tag-placeholder {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 4px 9px;
  border-radius: 999px;
}

.account-tag {
  max-width: 280px;
  color: #174f95;
  background: var(--primary-soft);
  font-weight: 700;
}

.account-tag span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-placeholder {
  padding-left: 0;
  color: #8a95a6;
}

.conversation-notice {
  margin-top: 14px;
}

.composer.read-only {
  opacity: 0.72;
}

.alert {
  padding: 10px 12px;
  border: 1px solid;
  border-radius: var(--radius-small);
  font-size: 12px;
}

.alert-error {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #f4c7c3;
}

.alert-success {
  color: #08755b;
  background: #e9f8f3;
  border-color: #a8dfcf;
}

.alert-warning {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: #edd79a;
}

.messages {
  display: flex;
  flex: 1;
  min-height: 360px;
  flex-direction: column;
  gap: 22px;
  padding: 30px 0 24px;
}

.welcome-card {
  width: min(760px, 100%);
  margin: auto;
  padding: 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow);
}

.welcome-icon {
  display: grid;
  width: 50px;
  height: 50px;
  margin-bottom: 18px;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 14px;
}

.welcome-platform-mark {
  margin-bottom: 18px;
}

.welcome-card h3 {
  margin-bottom: 10px;
  font-size: clamp(20px, 3vw, 26px);
  line-height: 1.25;
}

.welcome-card > p:not(.eyebrow) {
  max-width: 660px;
  margin-bottom: 22px;
  color: var(--text-muted);
}

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

.example-prompt {
  min-height: 48px;
  padding: 10px 12px;
  color: #344054;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.example-prompt:hover {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: #b7cdf1;
}

.chat-message {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 11px;
  width: min(850px, 100%);
}

.chat-message.user {
  grid-template-columns: minmax(0, 1fr) 34px;
  align-self: flex-end;
}

.message-avatar,
.assistant-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #fff;
  background: #23334e;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 800;
}

.chat-message.user .message-avatar {
  grid-column: 2;
  color: #174f95;
  background: var(--primary-soft);
}

.message-body {
  min-width: 0;
}

.chat-message.user .message-body {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
}

.message-role {
  margin: 0 0 5px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 720;
}

.chat-message.user .message-role {
  text-align: right;
}

.message-content {
  padding: 13px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px 13px 13px 13px;
  box-shadow: 0 3px 10px rgba(19, 33, 56, 0.04);
  overflow-wrap: anywhere;
}

.chat-message.user .message-content {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  border-radius: 13px 4px 13px 13px;
}

.message-content > :first-child {
  margin-top: 0;
}

.message-content > :last-child {
  margin-bottom: 0;
}

.message-content p,
.message-content ul,
.message-content ol,
.message-content blockquote,
.message-content pre {
  margin: 0 0 10px;
}

.message-content ul,
.message-content ol {
  padding-left: 22px;
}

.message-content h2,
.message-content h3,
.message-content h4 {
  margin: 18px 0 7px;
  line-height: 1.3;
}

.message-content h2 {
  font-size: 18px;
}

.message-content h3 {
  font-size: 16px;
}

.message-content h4 {
  font-size: 14px;
}

.message-content code {
  padding: 2px 5px;
  color: #9f2d57;
  background: #f7eef2;
  border-radius: 5px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.9em;
}

.message-content pre {
  padding: 12px;
  color: #e6edf5;
  background: #162033;
  border-radius: var(--radius-small);
  overflow: auto;
}

.message-content pre code {
  padding: 0;
  color: inherit;
  background: transparent;
}

.message-content blockquote {
  padding-left: 12px;
  color: var(--text-muted);
  border-left: 3px solid #b7cdf1;
}

.message-content a {
  color: var(--primary);
  text-underline-offset: 2px;
}

.markdown-table-wrapper {
  max-width: 100%;
  margin: 4px 0 12px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface);
}

.markdown-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  color: var(--text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.markdown-table th,
.markdown-table td {
  padding: 9px 11px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  white-space: nowrap;
}

.markdown-table th:last-child,
.markdown-table td:last-child {
  border-right: 0;
}

.markdown-table thead th {
  background: var(--surface-strong);
  font-weight: 700;
}

.markdown-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.markdown-table tbody tr:last-child td {
  border-bottom: 0;
}

.chat-message.user .message-content a,
.chat-message.user .message-content code {
  color: inherit;
}

.query-details {
  margin-top: 8px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
}

.query-details summary {
  padding: 9px 12px;
  color: #475467;
  cursor: pointer;
  font-size: 12px;
  font-weight: 720;
}

.query-details-content {
  display: grid;
  gap: 12px;
  padding: 3px 12px 12px;
  border-top: 1px solid var(--border);
}

.query-detail-section {
  min-width: 0;
}

.query-detail-section h4 {
  margin: 10px 0 5px;
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.query-detail-section ul {
  margin: 0;
  padding-left: 18px;
}

.query-code {
  margin: 6px 0 0;
  padding: 9px;
  color: #25344d;
  background: #eef2f6;
  border-radius: 6px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 11px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.loading-message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  padding: 11px 12px;
  color: var(--text-muted);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  font-size: 12px;
}

.progress-copy {
  flex: 1;
  min-width: 0;
}

.progress-current-row {
  display: flex;
  min-height: 24px;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-weight: 700;
}

.progress-completed {
  display: grid;
  gap: 3px;
  margin: 5px 0 0;
  padding: 0;
  color: var(--text-muted);
  font-size: 11px;
  list-style: none;
}

.progress-completed li::before {
  margin-right: 6px;
  color: var(--success);
  content: "✓";
}

.cancel-request {
  flex: 0 0 auto;
  min-height: 30px;
  padding-block: 5px;
}

.typing-dots {
  display: inline-flex;
  gap: 3px;
}

.typing-dots i {
  width: 5px;
  height: 5px;
  background: var(--primary);
  border-radius: 50%;
  animation: typing 1.1s infinite ease-in-out;
}

.typing-dots i:nth-child(2) {
  animation-delay: 140ms;
}

.typing-dots i:nth-child(3) {
  animation-delay: 280ms;
}

@keyframes typing {
  0%,
  70%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }

  35% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow);
}

.composer:focus-within {
  border-color: #9bbcea;
  box-shadow: 0 0 0 3px rgba(23, 105, 224, 0.1), var(--shadow);
}

.composer-input {
  min-width: 0;
}

.composer textarea {
  display: block;
  width: 100%;
  max-height: 200px;
  min-height: 66px;
  padding: 4px 5px 5px;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  line-height: 1.45;
  resize: vertical;
}

.composer-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 5px 0;
  color: var(--text-muted);
  font-size: 10px;
}

kbd {
  padding: 1px 4px;
  color: #475467;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--border-strong);
  font-family: inherit;
  font-size: 9px;
}

.send-button {
  align-self: end;
  min-width: 96px;
}

.privacy-note {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 10px;
  text-align: center;
}

.message-charts {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.chart-card {
  min-width: 0;
  margin: 0;
  padding: 18px;
  overflow: hidden;
  background: linear-gradient(145deg, var(--surface) 0%, var(--surface-subtle) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.07);
}

.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.chart-title {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.35;
}

.chart-subtitle,
.chart-summary {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.chart-summary {
  margin: 12px 0 0;
}

.chart-export {
  flex: 0 0 auto;
  white-space: nowrap;
}

.chart-visual {
  position: relative;
  width: 100%;
  height: 320px;
  padding: 8px 2px 0;
}

.chart-pie .chart-visual {
  max-width: 600px;
  height: 360px;
  margin-inline: auto;
}

.chart-visual-fallback {
  display: grid;
  height: auto;
  min-height: 72px;
  place-items: center;
  padding: 16px;
  background: var(--surface-subtle);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-medium);
}

.chart-fallback {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.chart-data {
  margin-top: 14px;
  border-top: 1px solid var(--border);
}

.chart-data > summary {
  width: max-content;
  padding-top: 12px;
  color: var(--primary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.chart-table-controls {
  display: flex;
  min-height: 32px;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.chart-copy-status {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}

.chart-copy-source {
  position: fixed;
  inset: -9999px auto auto -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.chart-table-wrapper {
  margin-top: 10px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
}

.chart-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.chart-table caption {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.chart-table th,
.chart-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

.chart-table th:first-child,
.chart-table td:first-child {
  text-align: left;
}

.chart-table thead th {
  background: var(--surface-strong);
  font-weight: 700;
}

.chart-table tbody tr:last-child > * {
  border-bottom: 0;
}

/* Branded visual system: t2ó */
.t2o-logo {
  display: block;
  width: 74px;
  height: auto;
}

.platform-gate {
  background:
    radial-gradient(circle at 12% 18%, rgba(75, 134, 254, 0.18), transparent 30%),
    radial-gradient(circle at 88% 82%, rgba(75, 134, 254, 0.1), transparent 28%),
    linear-gradient(135deg, #f9fbff 0%, #f3f6fa 52%, #f8fafc 100%);
}

.platform-picker {
  position: relative;
  overflow: hidden;
  border-color: rgba(203, 212, 223, 0.85);
  box-shadow: 0 30px 90px rgba(17, 22, 26, 0.12);
}

.platform-picker::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--brand-blue), #76a5ff 65%, #b8d0ff);
  content: "";
}

.platform-picker-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}

.platform-picker-brand .t2o-logo {
  width: 88px;
}

.platform-picker-brand span {
  padding-left: 14px;
  color: var(--brand-dark);
  border-left: 1px solid var(--border-strong);
  font-size: 14px;
  font-weight: 760;
  letter-spacing: 0.01em;
}

.platform-picker h1 {
  color: var(--brand-dark);
  letter-spacing: -0.035em;
}

.platform-card {
  background: #fbfcfe;
  border-color: #e1e7ee;
  box-shadow: 0 4px 14px rgba(17, 22, 26, 0.025);
}

.platform-card:not(:disabled):hover,
.platform-card:not(:disabled):focus-visible,
.platform-card.meta:not(:disabled):hover,
.platform-card.meta:not(:disabled):focus-visible {
  background: linear-gradient(135deg, #ffffff, var(--primary-soft));
  border-color: var(--brand-blue);
  box-shadow: 0 14px 30px rgba(75, 134, 254, 0.14);
}

.platform-card-mark,
.platform-card.meta .platform-card-mark {
  color: #fff;
  background: var(--brand-dark);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.platform-card:not(:disabled):hover .platform-card-mark,
.platform-card:not(:disabled):focus-visible .platform-card-mark {
  background: var(--brand-blue);
}

.platform-card-arrow {
  transition: color 150ms ease, transform 150ms ease;
}

.platform-card:not(:disabled):hover .platform-card-arrow,
.platform-card:not(:disabled):focus-visible .platform-card-arrow {
  color: var(--brand-blue);
  transform: translateX(3px);
}

.app-shell {
  background:
    radial-gradient(circle at 78% 18%, rgba(75, 134, 254, 0.055), transparent 24%),
    var(--bg);
}

.sidebar {
  padding: 22px 20px 16px;
  border-right-color: #dce3eb;
  box-shadow: 8px 0 30px rgba(17, 22, 26, 0.025);
}

.brand {
  justify-content: space-between;
  gap: 16px;
}

.brand-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.brand-identity .t2o-logo {
  width: 62px;
  flex: 0 0 auto;
}

.brand-identity > div {
  min-width: 0;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

.brand-identity h1 {
  overflow: hidden;
  font-size: 16px;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-mark,
body[data-platform="meta"] .brand-mark {
  width: 34px;
  height: 34px;
  color: #fff;
  background: var(--brand-dark);
  border: 3px solid var(--primary-soft);
  border-radius: 11px;
  box-shadow: none;
  font-size: 10px;
}

.platform-switcher {
  margin-top: 24px;
}

.platform-tabs {
  gap: 5px;
  padding: 5px;
  background: #f0f3f7;
  border: 1px solid #e7ebf0;
  border-radius: 13px;
}

.platform-tabs button {
  border-radius: 9px;
}

.platform-tabs button.active {
  color: #174aab;
  background: #fff;
  box-shadow: 0 5px 14px rgba(17, 22, 26, 0.08), inset 0 -2px 0 var(--brand-blue);
}

.read-only-badge {
  color: #08785e;
  background: #edfbf6;
  border-color: #c7eee1;
}

.account-panel {
  margin-top: 24px;
}

.search-box {
  background: #f8fafc;
}

.search-box:focus-within {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(75, 134, 254, 0.13);
}

.account-option {
  border-radius: 12px;
}

.account-option.selected {
  background: linear-gradient(135deg, #f1f6ff, #e8f1ff);
  border-color: #b8d0ff;
  box-shadow: inset 3px 0 0 var(--brand-blue);
}

.sidebar-footer .button {
  min-height: 42px;
}

body[data-platform] .main-content {
  max-width: 1220px;
  padding-top: 72px;
}

.conversation-header {
  min-height: 102px;
  border-bottom: 0;
}

.conversation-heading {
  min-width: 0;
  padding: 20px 0 16px;
}

.conversation-heading h2 {
  max-width: 920px;
  overflow-wrap: anywhere;
  font-size: clamp(18px, 2vw, 22px);
  letter-spacing: -0.025em;
  line-height: 1.32;
}

.scope-bar {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: 0 5px 18px rgba(17, 22, 26, 0.035);
  backdrop-filter: blur(10px);
}

.account-tag {
  color: #174aab;
  background: #eaf2ff;
  border: 1px solid #d8e6ff;
}

.conversation-notice {
  border-radius: 12px;
}

.messages {
  gap: 26px;
  padding-top: 34px;
}

.welcome-card {
  position: relative;
  overflow: hidden;
  padding: 34px;
  border-color: #d9e1e9;
  box-shadow: 0 24px 70px rgba(17, 22, 26, 0.1);
}

.welcome-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand-blue), #8bb3ff);
  content: "";
}

.welcome-platform-mark,
body[data-platform="meta"] .welcome-platform-mark {
  background: var(--brand-dark);
  box-shadow: 0 10px 24px rgba(17, 22, 26, 0.16);
}

.example-prompt {
  background: #fbfcfe;
  border-radius: 11px;
}

.example-prompt:hover {
  color: #174aab;
  background: var(--primary-soft);
  border-color: #b8d0ff;
}

.message-avatar,
.assistant-avatar {
  background: var(--brand-dark);
  border-radius: 11px;
  box-shadow: 0 6px 14px rgba(17, 22, 26, 0.12);
}

.chat-message.user .message-avatar {
  color: #174aab;
  background: var(--primary-soft);
  border: 1px solid #d8e6ff;
  box-shadow: none;
}

.message-content {
  padding: 15px 17px;
  border-color: #dfe5ec;
  border-radius: 5px 17px 17px 17px;
  box-shadow: 0 8px 26px rgba(17, 22, 26, 0.055);
}

.chat-message.user .message-content {
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-deep));
  border-color: transparent;
  border-radius: 17px 5px 17px 17px;
  box-shadow: 0 10px 24px rgba(75, 134, 254, 0.2);
}

.markdown-table-wrapper {
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(17, 22, 26, 0.035);
}

.markdown-table thead th,
.chart-table thead th {
  color: #23334e;
  background: #edf4ff;
}

.markdown-table tbody tr:nth-child(even) {
  background: #f8fafd;
}

.query-details {
  border-radius: 12px;
}

.composer {
  padding: 14px;
  border-color: #d4dde7;
  border-radius: 19px;
  box-shadow: 0 20px 55px rgba(17, 22, 26, 0.12);
}

.composer:focus-within {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 4px rgba(75, 134, 254, 0.12), 0 20px 55px rgba(17, 22, 26, 0.12);
}

.send-button {
  min-width: 104px;
  border-radius: 12px;
}

.chart-card {
  border-radius: 18px;
  box-shadow: 0 14px 38px rgba(17, 22, 26, 0.08);
}

.history-dialog-card {
  border-top: 4px solid var(--brand-blue);
  box-shadow: 0 30px 90px rgba(17, 22, 26, 0.24);
}

.history-item-button {
  background: #fbfcfe;
}

.history-item-button:hover {
  background: var(--primary-soft);
  border-color: #b8d0ff;
}

@media (max-width: 1100px) {
  .user-session,
  body[data-platform] .user-session {
    position: static;
    left: auto;
    width: max-content;
    max-width: calc(100% - 20px);
    min-height: auto;
    justify-content: flex-end;
    margin: 8px 10px 0 auto;
    padding: 7px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(17, 22, 26, 0.08);
  }

  body[data-platform] .main-content {
    padding-top: 0;
  }
}

@media (max-width: 900px) {
  :root {
    --sidebar-width: 310px;
  }

  .sidebar {
    padding-inline: 16px;
  }

  .main-content {
    padding-inline: 24px;
  }

  .example-prompts {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .platform-gate {
    padding: 16px 12px;
    place-items: start center;
  }

  .platform-picker {
    padding: 22px 18px;
  }

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

  .platform-card {
    min-height: 94px;
  }

  .user-session {
    position: static;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin: 8px 10px 0 auto;
  }

  .session-name {
    display: none;
  }

  .history-dialog-card {
    padding: 18px;
  }

  .platform-tabs {
    display: flex;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
  }

  .platform-tabs button {
    flex: 0 0 auto;
    scroll-snap-align: start;
    white-space: nowrap;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    overflow: visible;
  }

  .account-list {
    min-height: 180px;
    max-height: min(320px, 40vh);
  }

  .main-content {
    min-height: auto;
    padding: 0 16px 18px;
  }

  .conversation-header {
    min-height: 76px;
  }

  .scope-bar {
    flex-direction: column;
    gap: 5px;
  }

  .welcome-card {
    padding: 22px;
  }

  .chart-card {
    padding: 14px;
  }

  .chart-header {
    align-items: stretch;
    flex-direction: column;
  }

  .chart-export {
    align-self: flex-start;
  }

  .chart-visual,
  .chart-pie .chart-visual {
    height: 280px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
