.chat-view {
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 10px;
  height: calc(100vh - 112px);
}

/* Modern wide chat overrides */
.chat-view {
  width: min(1320px, 100%);
  height: calc(100vh - 79px);
  gap: 12px;
  padding: 18px 22px 22px;
}

.chat-feed {
  gap: 14px;
}

.bubble {
  max-width: min(860px, 74%);
  border-radius: 8px;
  padding: 13px 15px;
}

.bubble.ai {
  background: #fff;
  border: 1px solid #e5e7eb;
}

.bubble.user {
  max-width: min(680px, 58%);
}

.composer {
  border-radius: 8px;
}

.bubble-options {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.bubble-option {
  display: grid;
  gap: 3px;
  width: 100%;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  padding: 9px 10px;
  background: #f8fbff;
  color: #1f2937;
  text-align: left;
  cursor: pointer;
}

.bubble-option:hover {
  border-color: #93c5fd;
  background: #eff6ff;
}

.bubble-option span {
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
}

.bubble-visuals,
.chat-visual,
.chat-table-shell,
.chat-table-wrap,
.chat-pie-wrap,
.chat-chart-legend {
  white-space: normal;
}

.bubble-visuals {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.chat-visual {
  max-width: 100%;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.chat-visual-title {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  color: #111827;
  font-size: 13px;
  font-weight: 800;
}

.chat-visual-note {
  padding: 8px 12px 10px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.4;
}

.chat-table-shell {
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.chat-visual .chat-table-shell {
  border-width: 0;
  border-radius: 0;
}

.chat-table-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
}

.chat-table-action {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid #dbe3ee;
  border-radius: 6px;
  background: #fff;
  color: #475569;
  cursor: pointer;
}

.chat-table-action:hover {
  border-color: #94a3b8;
  color: #111827;
}

.chat-table-action.copied {
  border-color: #16a34a;
  color: #15803d;
  background: #f0fdf4;
}

.chat-table-action svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.chat-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.chat-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  background: #fff;
}

.chat-table th,
.chat-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 9px 10px;
  color: #1f2937;
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
  vertical-align: top;
}

.chat-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #475569;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.chat-table.comparison td:first-child {
  font-weight: 800;
  color: #111827;
}

.chat-heading {
  margin: 10px 0 4px;
  color: #111827;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
}

.bubble-body code {
  border-radius: 5px;
  padding: 1px 4px;
  background: #f1f5f9;
  color: #0f172a;
  font-size: 0.92em;
}

.chat-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 320px;
  padding: 10px;
  background: #fff;
}

.chat-chart-svg.bar rect {
  fill: #2563eb;
}

.chat-chart-svg.bar text,
.chat-chart-svg.line text {
  fill: #64748b;
  font-size: 11px;
}

.chat-chart-svg.line path {
  fill: none;
  stroke: #0f766e;
  stroke-width: 3;
}

.chat-chart-svg.line circle {
  fill: #0f766e;
}

.chat-pie-wrap {
  display: grid;
  grid-template-columns: minmax(140px, 180px) 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
}

.chat-chart-svg.pie {
  max-height: 180px;
  padding: 0;
  transform: rotate(-90deg);
}

.chat-chart-legend {
  display: grid;
  gap: 6px;
  color: #475569;
  font-size: 12px;
}

.chat-chart-legend span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.chat-chart-legend i {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 2px;
}

.thinking-bubble {
  min-width: 260px;
}

.thinking-content {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #475569;
}

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

.thinking-dots i {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #2563eb;
  animation: thinkingPulse 900ms ease-in-out infinite;
}

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

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

@keyframes thinkingPulse {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (max-width: 900px) {
  .chat-view {
    height: calc(100vh - 50px);
    padding: 22px 16px 20px;
  }

  .bubble {
    border-radius: 8px;
    padding: 14px 16px;
  }

  .btn.send,
  .composer {
    border-radius: 8px;
  }

  .bubble-options {
    display: grid;
  }

  .chat-table {
    min-width: 440px;
  }

  .chat-pie-wrap {
    grid-template-columns: 1fr;
  }
}

.mobile-chat-hero {
  display: none;
}

.chat-feed {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

.message-row {
  display: flex;
  width: 100%;
}

.message-row.ai {
  justify-content: flex-start;
}

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

.bubble {
  display: inline-block;
  width: fit-content;
  max-width: min(560px, 62%);
  border-radius: 16px;
  padding: 10px 12px;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.bubble.ai {
  justify-self: start;
  background: #eef2f7;
}

.bubble.user {
  background: #2563eb;
  color: #fff;
  max-width: min(420px, 50%);
}

.bubble-head {
  font-size: 11px;
  color: #64748b;
  font-weight: 700;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bubble.user .bubble-head {
  color: rgba(255, 255, 255, 0.8);
}

.bubble-body {
  line-height: 1.45;
  white-space: pre-wrap;
}

.bubble-meta {
  margin-top: 8px;
  font-size: 10px;
  line-height: 1.35;
  color: #64748b;
}

.bubble-sources {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(100, 116, 139, 0.16);
}

.bubble-sources-title {
  margin: 0 0 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.bubble-sources ul {
  margin: 0;
  padding-left: 16px;
}

.bubble-sources li {
  margin: 2px 0;
  font-size: 11px;
  line-height: 1.35;
}

.bubble-sources a {
  color: #1d4ed8;
  text-decoration: none;
}

.composer {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 6px 8px 8px;
}

.composer-input-row {
  display: flex;
  align-items: flex-end;
  gap: 4px;
}

.composer textarea {
  border: none;
  resize: none;
  max-height: 130px;
  min-height: 40px;
  padding: 9px 10px;
  font-family: inherit;
  flex: 1;
}

.composer textarea:focus {
  outline: none;
}

/* Paperclip attach button */
.composer-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  color: #6b7280;
  flex-shrink: 0;
  margin-bottom: 3px;
  transition: background 0.1s, color 0.1s;
}

.composer-icon-btn:hover {
  background: #f3f4f6;
  color: #2563eb;
}

.composer-icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* File attach chip */
.attach-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  color: #15803d;
  margin-bottom: 4px;
}

.attach-chip svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.attach-chip-remove {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  color: #6b7280;
  padding: 0;
  line-height: 1;
  margin-left: 2px;
}

.attach-chip-remove:hover { color: #dc2626; }

/* Mention chips row */
.mention-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 4px 2px;
}

.mention-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  font-size: 11px;
  color: #1d4ed8;
  padding: 2px 8px 2px 6px;
}

.mention-chip svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.mention-chip-remove {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: #93c5fd;
  padding: 0;
  line-height: 1;
}

.mention-chip-remove:hover { color: #dc2626; }

/* @mention dropdown */
.mention-dropdown {
  position: fixed;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
  max-height: 240px;
  overflow-y: auto;
  z-index: 9998;
  padding: 4px;
}

.mention-item {
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.1s;
}

.mention-item:hover,
.mention-item.focused {
  background: #f3f4f6;
}

.mention-item-title {
  font-size: 13px;
  font-weight: 500;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mention-item-type {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 1px;
}

.btn.send {
  align-self: end;
  min-width: 82px;
}

@media (max-width: 900px) {
  body {
    background: #f7f9fc;
  }

  .chat-view {
    height: calc(100vh - 58px);
    grid-template-rows: auto 1fr auto;
    gap: 12px;
    padding: 46px 20px 24px;
    overflow: hidden;
  }

  .mobile-chat-hero {
    display: grid;
    justify-items: center;
    gap: 8px;
    margin: 14px 0 28px;
    text-align: center;
  }

  .mobile-chat-avatar {
    width: 58px;
    height: 58px;
    border-radius: 999px;
    background:
      radial-gradient(circle at 50% 42%, rgba(56, 189, 248, 0.95) 0 5%, transparent 6%),
      radial-gradient(circle at 50% 50%, rgba(14, 165, 233, 0.22), transparent 52%),
      linear-gradient(135deg, #0f172a, #052e36);
    box-shadow: 0 0 0 3px rgba(47, 110, 234, 0.08), 0 8px 24px rgba(15, 23, 42, 0.18);
  }

  .mobile-chat-hero h3 {
    margin: 8px 0 0;
    color: #2f343b;
    font-size: 21px;
    line-height: 1.2;
  }

  .mobile-chat-hero p {
    max-width: 260px;
    margin: 0;
    color: #89919d;
    font-size: 14px;
    line-height: 1.45;
    font-weight: 700;
  }

  .chat-feed {
    gap: 28px;
    padding: 0 0 6px;
  }

  .bubble {
    max-width: 82%;
    border-radius: 24px;
    padding: 18px 20px;
    font-size: 15px;
    line-height: 1.45;
    box-shadow: none;
  }

  .bubble.ai {
    background: #e9edf2;
    color: #4b5563;
    border-bottom-left-radius: 8px;
  }

  .bubble.user {
    max-width: 80%;
    background: #075bd8;
    border-bottom-right-radius: 8px;
  }

  .bubble-head,
  .bubble-meta,
  .bubble-sources {
    display: none;
  }

  .message-row {
    position: relative;
  }

  .message-row[data-time]::after {
    content: attr(data-time);
    position: absolute;
    bottom: -18px;
    color: #9ca3af;
    font-size: 10px;
    font-weight: 700;
  }

  .message-row.ai::after {
    left: 8px;
  }

  .message-row.user::after {
    right: 8px;
  }

  .composer {
    grid-template-columns: 36px 1fr 30px 46px;
    gap: 6px;
    align-items: center;
    min-height: 58px;
    border: 0;
    border-radius: 999px;
    padding: 7px 8px 7px 14px;
    box-shadow: 0 12px 28px rgba(148, 163, 184, 0.2);
  }

  .composer::before {
    content: "+";
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    color: #94a3b8;
    font-size: 25px;
    font-weight: 300;
  }

  .composer::after {
    content: "";
    grid-column: 3;
    width: 18px;
    height: 22px;
    justify-self: center;
    background:
      linear-gradient(#94a3b8, #94a3b8) center bottom / 12px 2px no-repeat,
      radial-gradient(ellipse at center, #94a3b8 0 55%, transparent 56%);
    border-radius: 999px;
    opacity: 0.85;
  }

  .composer textarea {
    min-height: 36px;
    padding: 9px 2px;
    background: transparent;
    color: #475569;
  }

  .composer textarea::placeholder {
    color: #b5bdc9;
    font-weight: 700;
  }

  .btn.send {
    grid-column: 4;
    min-width: 0;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    padding: 0;
    align-self: center;
    font-size: 0;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.24);
  }

  .btn.send::before {
    content: ">";
    font-size: 26px;
    line-height: 1;
    font-weight: 700;
  }
}

/* Final chat overrides */
.chat-view {
  width: min(1320px, 100%);
  height: calc(100vh - 79px);
  gap: 12px;
  padding: 18px 22px 22px;
}

.chat-feed {
  gap: 14px;
}

.bubble {
  max-width: min(860px, 74%);
  border-radius: 8px;
  padding: 13px 15px;
}

.bubble.ai {
  background: #fff;
  border: 1px solid #e5e7eb;
}

.bubble.user {
  max-width: min(680px, 58%);
}

.composer {
  border-radius: 8px;
}

.bubble-options {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.bubble-option {
  display: grid;
  gap: 3px;
  width: 100%;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  padding: 9px 10px;
  background: #f8fbff;
  color: #1f2937;
  text-align: left;
  cursor: pointer;
}

.bubble-option:hover {
  border-color: #93c5fd;
  background: #eff6ff;
}

.bubble-option span {
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
}

@media (max-width: 900px) {
  .chat-view {
    height: calc(100vh - 50px);
    padding: 22px 16px 20px;
  }

  .bubble {
    border-radius: 8px;
    padding: 14px 16px;
  }

  .btn.send,
  .composer {
    border-radius: 8px;
  }

  .bubble-options {
    display: grid;
  }
}

/* Native mobile chat */
@media (max-width: 900px) {
  .chat-view {
    width: 100%;
    max-width: 100%;
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: 1fr auto;
    gap: 0;
    padding: 0;
    overflow: hidden;
    background: #ece5dd;
  }

  .mobile-chat-hero {
    display: none;
  }

  .chat-feed {
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-width: none;
    padding: 10px 10px calc(82px + env(safe-area-inset-bottom, 0px));
    background: #ece5dd;
  }

  .chat-feed::-webkit-scrollbar {
    display: none;
  }

  .message-row {
    position: relative;
    display: flex;
    width: 100%;
    align-items: flex-end;
    gap: 5px;
    padding-bottom: 15px;
  }

  .message-row.ai {
    justify-content: flex-start;
  }

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

  .message-row.ai::before {
    content: "";
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    margin-bottom: 17px;
    border-radius: 999px;
    background:
      radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.78) 0 18%, transparent 19%),
      #1a3c6e;
  }

  .message-row[data-time]::after {
    content: attr(data-time);
    position: absolute;
    bottom: 0;
    color: rgba(0, 0, 0, 0.42);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
  }

  .message-row.ai::after {
    left: 31px;
  }

  .message-row.user::after {
    right: 2px;
  }

  .bubble {
    position: relative;
    display: inline-block;
    width: fit-content;
    max-width: calc(100% - 36px);
    border: 0;
    border-radius: 0 12px 12px;
    padding: 8px 11px 7px;
    background: #fff;
    color: #111;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    font-size: 14px;
    line-height: 1.48;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .bubble::before {
    content: "";
    position: absolute;
    top: 0;
    left: -7px;
    width: 0;
    height: 0;
    border-top: 8px solid #fff;
    border-left: 8px solid transparent;
  }

  .bubble.ai {
    background: #fff;
    color: #111;
    border: 0;
  }

  .bubble.user {
    max-width: 88%;
    border-radius: 12px 0 12px 12px;
    background: #1a3c6e;
    color: #fff;
  }

  .bubble.user::before {
    right: -7px;
    left: auto;
    border-top-color: #1a3c6e;
    border-right: 8px solid transparent;
    border-left: 0;
  }

  .bubble-head {
    display: none;
  }

  .bubble-body {
    line-height: 1.5;
    white-space: pre-wrap;
  }

  .bubble-body strong {
    color: #1a3c6e;
    font-weight: 700;
  }

  .bubble.user .bubble-body strong {
    color: #fff;
  }

  .bubble-meta,
  .bubble-sources {
    display: block;
    color: rgba(0, 0, 0, 0.46);
  }

  .bubble-sources {
    border-top-color: rgba(0, 0, 0, 0.08);
  }

  .bubble-sources a {
    color: #1a3c6e;
    font-weight: 700;
  }

  .thinking-bubble {
    min-width: 0;
    padding: 12px 14px;
  }

  .thinking-content {
    color: #64748b;
  }

  .thinking-dots i {
    background: #1a3c6e;
  }

  .bubble-options {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 9px;
  }

  .bubble-option {
    width: auto;
    min-height: 32px;
    border-radius: 8px;
    padding: 6px 10px;
    background: #f8fafc;
    border-color: rgba(26, 60, 110, 0.2);
  }

  .bubble-option span {
    display: none;
  }

  .bubble-visuals {
    max-width: 100%;
    overflow: hidden;
  }

  .chat-visual {
    max-width: 100%;
    border-radius: 8px;
  }

  .chat-table {
    min-width: 480px;
  }

  .composer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 850;
    min-height: 58px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
    border: 0;
    border-top: 0.5px solid rgba(0, 0, 0, 0.1);
    border-radius: 0;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    background: #f0ede8;
    box-shadow: none;
  }

  .composer::before {
    content: none;
  }

  .composer::after {
    content: none;
  }

  .composer textarea {
    min-height: 42px;
    max-height: 120px;
    border: 0;
    border-radius: 20px;
    padding: 11px 14px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    color: #111;
    font-size: 16px;
    line-height: 1.25;
  }

  .composer textarea::placeholder {
    color: #b0aba5;
    font-size: 14px;
    font-weight: 500;
  }

  .btn.send {
    width: 44px;
    height: 44px;
    min-width: 0;
    display: flex;
    place-items: center;
    align-items: center;
    justify-content: center;
    align-self: center;
    justify-self: center;
    border-radius: 999px;
    padding: 0;
    background: #1a3c6e;
    box-shadow: 0 2px 8px rgba(26, 60, 110, 0.35);
    color: transparent;
    font-size: 0;
    transform: none;
  }

  .btn.send::before {
    content: "";
    width: 0;
    height: 0;
    display: block;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 13px solid #fff;
    transform: translateX(2px);
  }

  .btn.send:active {
    transform: scale(0.94);
  }
}

/* ── GULE v1.0 — Chat Layout, Sessions, Mode Toolbar, Export ── */

.chat-view {
  grid-template-rows: 1fr;
  padding: 0;
}

.chat-layout {
  display: flex;
  height: calc(100vh - 79px);
  gap: 0;
  overflow: hidden;
}

/* Sessions panel */
.sessions-panel {
  width: 220px;
  min-width: 180px;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  background: #f9fafb;
  overflow: hidden;
  flex-shrink: 0;
}

.sessions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 8px;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  border-bottom: 1px solid #e5e7eb;
}

.sessions-list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  overflow-y: auto;
  flex: 1;
}

.session-group-label {
  font-size: 10px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 12px 4px;
  list-style: none;
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 8px 7px 12px;
  cursor: pointer;
  border-left: 3px solid transparent;
  border-radius: 0 6px 6px 0;
  transition: background 0.15s, border-left-color 0.15s;
  gap: 4px;
  position: relative;
}

.session-item:hover {
  background: #f0f2f5;
  border-left-color: #d1d5db;
}

.session-item:hover .session-title {
  color: #1d4ed8;
}

.session-item:hover .session-date {
  opacity: 0;
}

.session-item:hover .session-menu-btn {
  opacity: 1;
}

.session-item.active {
  background: #eff6ff;
  border-left-color: #2563eb;
}

.session-item.active:hover {
  background: #dbeafe;
  border-left-color: #2563eb;
}

.session-item.active:hover .session-title {
  color: #1e40af;
}

.session-item.pinned {
  border-left-color: #f59e0b;
}

.session-item.pinned:hover {
  border-left-color: #d97706;
}

.session-item.pinned.active {
  border-left-color: #2563eb;
}

.session-item-body {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.session-pin-icon {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  fill: #f59e0b;
}

.session-title {
  font-size: 12px;
  font-weight: 500;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s;
}

.session-meta {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.session-date {
  font-size: 10px;
  color: #9ca3af;
  transition: opacity 0.15s;
}

.session-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transition: opacity 0.1s, background 0.1s;
  color: #6b7280;
}

.session-menu-btn:hover {
  background: #e5e7eb;
  color: #111827;
}

.session-menu-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.sessions-empty {
  font-size: 12px;
  color: #9ca3af;
  padding: 16px 12px;
  text-align: center;
  list-style: none;
}

/* Session context menu */
.session-ctx-menu {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 160px;
  padding: 4px;
  display: flex;
  flex-direction: column;
}

.session-ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  color: #374151;
  text-align: left;
  width: 100%;
  transition: background 0.1s;
}

.session-ctx-item:hover {
  background: #f3f4f6;
}

.session-ctx-item.danger {
  color: #dc2626;
}

.session-ctx-item.danger:hover {
  background: #fef2f2;
}

.session-ctx-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Session title hover tooltip */
.session-tooltip {
  position: fixed;
  transform: translateY(-50%);
  background: #1f2937;
  color: #f9fafb;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.4;
  max-width: 220px;
  white-space: normal;
  word-break: break-word;
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 9999;
}

.session-tooltip.visible {
  opacity: 1;
}

/* Session title typing / blinking cursor animation */
.session-title--typing::after {
  content: '|';
  margin-left: 1px;
  color: #2563eb;
  animation: session-cursor-blink 0.7s step-end infinite;
}

@keyframes session-cursor-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* Chat main area */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 16px 20px 20px;
  gap: 10px;
}

/* Mode toolbar */
.mode-toolbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.mode-pill {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.mode-pill:hover {
  border-color: #2563eb;
  color: #2563eb;
}

.mode-pill.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

/* Adjust chat-feed and composer inside chat-main */
.chat-main .chat-feed {
  flex: 1;
  overflow-y: auto;
}

.chat-main .composer {
  margin-top: 0;
  flex-shrink: 0;
}

/* Export bar */
.bubble-export {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #f3f4f6;
}

.export-label {
  font-size: 11px;
  color: #9ca3af;
}

.export-btn {
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  font-size: 11px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.12s;
}

.export-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
  background: #eff6ff;
}

/* Small button variant */
.btn.soft.small {
  padding: 3px 8px;
  font-size: 11px;
}

/* Mobile: hide sessions panel */
@media (max-width: 768px) {
  .sessions-panel { display: none; }
  .chat-main { padding: 10px 12px 14px; }
}
