/* #### Dashbosrd.css */

/* ================= GLOBAL ================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

body {
  margin: 0;
  background: #f6f9fc;
  color: #111827;
  min-width: 320px;
  overflow-x: hidden;
}

html {
  box-sizing: border-box;
  font-size: 16px;
}

/* ================= HEADER ================= */
header {
  position: fixed;
  top: 0;
  width: 100%;
  height: 68px;
  background: #ffffff;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  border-bottom: 1px solid #e5e7eb;
  z-index: 1000;
}

header img {
  height: 30px;
}

header .title {
  display: flex;
  flex-direction: column;
}

header h1 {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
}

header p {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
}

/* ================= LOGIN HEADER (LOGO LEFT, TITLE RIGHT) ================= */
.login-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 24px;
}

.login-header .title {
  margin-left: auto;
  text-align: right;
}

/* ================= USER INFO SECTION ================= */
.user-info-section {
  position: fixed;
  top: 16px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 10001;
}

.user-info-section .user-name {
  font-size: 13px;
  color: #111827;
  font-weight: 500;
}

.user-info-section .divider {
  width: 1px;
  height: 20px;
  background: #d1d5db;
}

.user-info-section .logout-btn {
  padding: 4px 11px;
  background: transparent;
  color: #2563eb;
  text-decoration: none;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.2s ease;
  border: 1px solid #2563eb;
  display: inline-block;
}

.user-info-section .logout-btn:hover {
  background: #eff6ff;
  color: #1d4ed8;
}

/* ================= LOGOUT VISIBILITY CONTROL ================= */
@media (min-width: 769px) {
  .mobile-logout {
    display: none;
  }
}

/* ================= SIDEBAR TOGGLE BUTTON ================= */
.sidebar-toggle-btn {
  position: fixed;
  left: 14px;
  top: 76px;
  width: 22px;
  height: 22px;
  background: #ffffff;
  border: 1px solid #6b7280;
  border-radius: 7px;
  box-shadow: 0 1px 4px rgba(17, 24, 39, 0.12);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: all 0.3s ease;
  color: #374151;
  font-size: 12px;
  padding: 0;
}

.sidebar-toggle-btn svg {
  width: 12px;
  height: 12px;
}

.sidebar-toggle-btn .toggle-icon {
  display: none;
}

/* Closed = hamburger menu, open = chevron pointing out to collapse */
.sidebar-toggle-btn:not(.open) .toggle-icon-menu,
.sidebar-toggle-btn.open .toggle-icon-close {
  display: block;
}

.sidebar-toggle-btn:hover {
  background: #f9fafb;
  border-color: #4b5563;
  box-shadow: 0 2px 6px rgba(17, 24, 39, 0.16);
  transform: scale(1.02);
}

.sidebar-toggle-btn.open {
  left: calc(280px - 38px);
  transform: none;
  width: 22px;
  height: 22px;
  font-size: 12px;
  border: 1px solid #6b7280;
}

.suggestions-toggle-btn {
  left: auto !important;
  right: 14px;
}

.suggestions-toggle-btn.open {
  /* Mirror history icon: same inset inside the chat-facing edge. */
  left: auto !important;
  right: calc(280px - 38px);
  transform: none;
}

.suggestions-toggle-btn:hover {
  transform: scale(1.02);
}

.suggestions-toggle-btn.open:hover {
  transform: none;
}

/* ================= SIDEBAR ================= */
.sidebar {
  position: fixed;
  top: 56px;
  bottom: 0;
  left: 0;
  width: 280px;
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 90;
  transition: transform 0.3s ease, visibility 0.3s ease;
  transform: translateX(0);
  visibility: visible;
}

.history-sidebar {
  left: 0;
  right: auto;
}

.suggestions-sidebar {
  left: auto !important;
  right: 0;
  border-right: none;
  border-left: 1px solid #e5e7eb;
  /* Keep this panel animating only on the X axis from the right edge. */
  transition: transform 0.3s ease, visibility 0.3s ease;
}

.history-sidebar.collapsed,
.sidebar.history-sidebar.collapsed {
  transform: translateX(-100%);
  visibility: hidden;
}

.suggestions-sidebar.collapsed,
.sidebar.suggestions-sidebar.collapsed {
  transform: translateX(100%);
  visibility: hidden;
}

.history-sidebar.open,
.suggestions-sidebar.open,
.sidebar.history-sidebar.open,
.sidebar.suggestions-sidebar.open {
  transform: translateX(0);
  visibility: visible;
}

/* Tablet + mobile should start collapsed and overlay when opened */
@media (max-width: 1024px) {
  .history-sidebar,
  .sidebar.history-sidebar {
    transform: translateX(-100%);
    visibility: hidden;
  }

  .suggestions-sidebar,
  .sidebar.suggestions-sidebar {
    transform: translateX(100%);
    visibility: hidden;
  }

  .history-sidebar.open,
  .sidebar.history-sidebar.open,
  .suggestions-sidebar.open,
  .sidebar.suggestions-sidebar.open {
    transform: translateX(0);
    visibility: visible;
    z-index: 1002;
  }

  #chat {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    padding: 0 16px;
    max-width: 100%;
  }

  footer {
    left: 0;
    right: 0;
    width: auto;
  }

  .sidebar-overlay {
    display: none;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .sidebar-toggle-btn.open {
    left: calc(280px - 38px);
  }

  .suggestions-toggle-btn.open {
    left: auto !important;
    right: calc(280px - 38px);
    transform: none;
  }
}

/* Desktop layout: sidebar is persistently visible unless collapsed */
@media (min-width: 1025px) {
  .history-sidebar:not(.collapsed),
  .sidebar.history-sidebar:not(.collapsed) {
    transform: translateX(0);
    visibility: visible;
  }

  .suggestions-sidebar:not(.collapsed),
  .sidebar.suggestions-sidebar:not(.collapsed) {
    transform: translateX(0);
    visibility: visible;
  }

  .history-sidebar.collapsed,
  .sidebar.history-sidebar.collapsed {
    transform: translateX(-100%);
    visibility: hidden;
  }

  .suggestions-sidebar.collapsed,
  .sidebar.suggestions-sidebar.collapsed {
    transform: translateX(100%);
    visibility: hidden;
  }

  #chat {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    max-width: 100%;
  }

  body.history-sidebar-open #chat {
    margin-left: 280px;
    width: calc(100% - 280px);
    max-width: calc(100% - 280px);
  }

  body.suggestions-sidebar-open #chat {
    margin-right: 280px;
    width: calc(100% - 280px);
    max-width: calc(100% - 280px);
  }

  body.history-sidebar-open.suggestions-sidebar-open #chat {
    margin-left: 280px;
    margin-right: 280px;
    width: calc(100% - 560px);
    max-width: calc(100% - 560px);
  }

  body.history-sidebar-open footer {
    left: 280px;
  }

  body.suggestions-sidebar-open footer {
    right: 280px;
  }
}

.sidebar-header h3 {
  margin: 0 0 16px 0;
  font-size: 12px;
  font-weight: 700;
  color: #111827;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-category {
  margin-bottom: 12px;
}

.sidebar-category-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 4px 0;
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  user-select: none;
}

.sidebar-category-toggle::-webkit-details-marker {
  display: none;
}

.sidebar-category-chevron {
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid #9ca3af;
  flex-shrink: 0;
  transform: rotate(0deg);
  transition: transform 0.15s ease;
}

.sidebar-category[open] .sidebar-category-chevron {
  transform: rotate(90deg);
}

.sidebar-category-label {
  flex: 1;
  min-width: 0;
}

.sidebar-category ul {
  margin-top: 8px;
}

.sidebar-category h4,
.sidebar-category h5 {
  margin: 0 0 10px 0;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
}

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar li {
  margin-bottom: 8px;
}

.question-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: #f3f4f6;
  border: 1px solid transparent;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.4;
}

.sidebar-title {
  font-size: 15px;
  font-weight: 600;
  color: #111;
}

.sidebar-header {
  flex-shrink: 0;
  margin-bottom: 0;
  padding: 18px 20px 14px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  z-index: 2;
}

.suggestions-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-left: 24px;
  padding-right: 24px;
  min-height: 58px;
}

.suggestions-sidebar-header .sidebar-title {
  width: 100%;
  text-align: center;
  line-height: 1.3;
}

.history-sidebar-header .sidebar-title {
  text-align: left;
}

.sidebar-scroll-area {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 20px 20px;
}

.new-chat-btn {
  width: 100%;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid #2563eb;
  border-radius: 8px;
  background: #2563eb;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.new-chat-btn:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.sidebar-section-title {
  margin: 0 0 12px;
  padding-top: 0;
  border-top: none;
  font-size: 12px;
  font-weight: 700;
  color: #111827;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chat-history-list {
  margin-bottom: 0;
}

.chat-history-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.chat-session-item {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.chat-session-btn {
  display: block;
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f8fafc;
  color: #374151;
  text-align: left;
  cursor: pointer;
}

.chat-session-btn:hover,
.chat-session-btn.active {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.chat-session-title,
.chat-session-preview {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-session-title {
  font-size: 12px;
  font-weight: 700;
}

.chat-session-preview {
  margin-top: 3px;
  font-size: 11px;
  color: #6b7280;
}

.delete-chat-btn {
  width: 28px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f3f4f6;
  color: #6b7280;
  cursor: pointer;
}

.delete-chat-btn:hover {
  background: #fee2e2;
  color: #b91c1c;
}

.chat-history-empty {
  color: #6b7280;
  font-size: 12px;
  line-height: 1.4;
}

.chat-history-loading {
  display: flex;
  align-items: center;
  min-height: 42px;
  color: #6b7280;
  font-size: 12px;
}

.chat-history-loading .loader-text {
  font-size: 12px;
}

.chat-switch-loader {
  display: flex;
  justify-content: flex-start;
  margin-top: 8px;
}

.chat-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-modal[hidden] {
  display: none !important;
}

.chat-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
}

.chat-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100vw - 32px));
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.2);
  padding: 20px;
}

.chat-modal-dialog h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}

.chat-modal-dialog p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #4b5563;
}

.chat-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.chat-modal-btn {
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.chat-modal-btn-secondary {
  background: #f3f4f6;
  border-color: #e5e7eb;
  color: #374151;
}

.chat-modal-btn-secondary:hover {
  background: #e5e7eb;
}

.chat-modal-btn-danger {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

.chat-modal-btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.question-btn:hover {
  background: #e5e7eb;
  color: #111827;
  border-color: #d1d5db;
}

/* ================= CHAT AREA ================= */
#chat {
  max-width: 1100px;
  width: 100%;
  margin: 80px auto 140px;
  padding: 0 16px;
  min-height: calc(100vh - 220px);
  overflow-y: auto;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

#chat.sidebar-collapsed {
  margin-left: auto;
  width: 100%;
  margin-right: auto;
}

/* Desktop layout (sidebar as persistent panel) */
@media (min-width: 1025px) {
  #chat {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    max-width: 100%;
    padding: 0 40px;
  }

  body.history-sidebar-open #chat {
    margin-left: 280px;
    width: calc(100% - 280px);
    max-width: calc(100% - 280px);
  }

  body.suggestions-sidebar-open #chat {
    margin-right: 280px;
    width: calc(100% - 280px);
    max-width: calc(100% - 280px);
  }

  body.history-sidebar-open.suggestions-sidebar-open #chat {
    margin-left: 280px;
    margin-right: 280px;
    width: calc(100% - 560px);
    max-width: calc(100% - 560px);
  }
}


/* ================= MESSAGES ================= */
.message {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 1.5;
}

.user {
  background: #2563eb;
  color: #ffffff;
  margin-left: auto;
  max-width: 70%;
}

.ai {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  max-width: 90%;
}

.welcome-message {
  max-width: min(720px, 100%);
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

#chat.chat-welcome {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 220px);
}

#chat.chat-welcome .welcome-message {
  margin-top: 0;
  margin-bottom: 0;
}

/* ================= KPI ================= */
.kpi-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin: 16px 0;
}

.kpi-row .kpi {
  min-width: 0;
}

/* Dynamic KPI widths based on total card count */
.kpi-row[data-count="1"] .kpi {
  flex: 0 1 280px;
  max-width: 100%;
}

.kpi-row[data-count="2"] .kpi {
  flex: 1 1 calc(50% - 6px);
  max-width: calc(50% - 6px);
}

.kpi-row[data-count="3"] .kpi {
  flex: 1 1 calc(33.333% - 8px);
  max-width: calc(33.333% - 8px);
}

.kpi-row[data-count="4"] .kpi {
  flex: 1 1 calc(50% - 6px);
  max-width: calc(50% - 6px);
}

.kpi-row[data-count="5"] .kpi,
.kpi-row[data-count="6"] .kpi {
  flex: 1 1 calc(33.333% - 8px);
  max-width: calc(33.333% - 8px);
}

.kpi-row[data-count="7"] .kpi,
.kpi-row[data-count="8"] .kpi {
  flex: 1 1 calc(25% - 9px);
  max-width: calc(25% - 9px);
}

.kpi-row[data-count="9"] .kpi,
.kpi-row[data-count="10"] .kpi,
.kpi-row[data-count="11"] .kpi,
.kpi-row[data-count="12"] .kpi {
  flex: 1 1 calc(25% - 9px);
  max-width: calc(25% - 9px);
}

.kpi {
  background: #ffffff;
  padding: 14px;
  border-radius: 12px;
  text-align: center;
  border: 1px solid #e5e7eb;
}

.kpi h3 {
  margin: 0;
  font-size: 13px;
  color: #6b7280;
}

.kpi p {
  margin: 6px 0 0;
  font-size: 18px;
  font-weight: 700;
}

/* ================= CHARTS ================= */
.chart-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 20px;
}

/* 1 chart: full width */
.chart-grid[data-count="1"] {
  grid-template-columns: 1fr;
}

/* 2 charts: side by side */
.chart-grid[data-count="2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* 3 charts: 2 top, 1 centered bottom */
.chart-grid[data-count="3"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-grid[data-count="3"] .chart-box:last-child {
  grid-column: 1 / -1;
  width: min(100%, 520px);
  justify-self: center;
}

/* 4 charts: balanced 2x2 */
.chart-grid[data-count="4"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* 5 charts: 2x2 + centered bottom */
.chart-grid[data-count="5"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-grid[data-count="5"] .chart-box:last-child {
  grid-column: 1 / -1;
  width: min(100%, 520px);
  justify-self: center;
}

/* 6 charts: 3x2 */
.chart-grid[data-count="6"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* 7+ charts: 2-column grid */
.chart-grid[data-count="7"],
.chart-grid[data-count="8"],
.chart-grid[data-count="9"],
.chart-grid[data-count="10"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-box {
  height: 260px;
  background: #ffffff;
  border-radius: 14px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
}

.chart-title {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
  text-align: center;
}

.chart-box canvas {
  flex: 1;
  min-height: 0;
}

/* ================= INPUT BAR ================= */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: auto;
  background: #ffffff;
  display: flex;
  justify-content: center;
  padding: 10px 18px;
  border-top: 1px solid #e5e7eb;
  z-index: 95;
  transition: all 0.3s ease;
}

footer.sidebar-collapsed {
  left: 0;
}

footer.suggestions-collapsed {
  right: 0;
}

.input-bar {
  width: 100%;
  max-width: 1100px;
  display: flex;
  gap: 10px;
}

textarea {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  min-height: 38px;
  max-height: 140px;
  resize: none;
  padding: 9px 14px;
  font-size: 14px;
  border-radius: 14px;
  border: 1px solid #d1d5db;
  outline: none;
  overflow-x: hidden;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #9ca3af transparent;
}

textarea::-webkit-scrollbar {
  width: 6px;
}

textarea::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 999px;
}

textarea::-webkit-scrollbar-thumb {
  background: #9ca3af;
  border-radius: 999px;
  border: 1px solid transparent;
  background-clip: padding-box;
}

textarea:focus {
  border-color: #2563eb;
}

.send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 18px;
  background: #2563eb;
  color: #ffffff;
  border: none;
  font-size: 14px;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
  transition: background 0.18s ease, transform 0.12s ease,
    box-shadow 0.18s ease;
}

.send-button:hover {
  background: #1e4ed8;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.32);
}

.send-button:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.send-button:disabled {
  background: #93c5fd;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  opacity: 0.75;
}

.send-button span.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

/* ================= LOADER ================= */
.loader {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.loader-text {
  color: #4b5563;
  transition: opacity 0.15s ease;
}

.loader-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 2px solid #d1d5db;
  border-top-color: #2563eb;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* ================= CLARIFICATION CHIPS ================= */
.ai-assumptions {
  margin-top: 8px;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.4;
}

.clarify-panel {
  margin-top: 12px;
}

.clarify-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

.clarify-chip {
  appearance: none;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 560;
  cursor: pointer;
  position: relative;
  z-index: 2;
  pointer-events: auto;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.clarify-chip:hover:not(:disabled) {
  background: #dbeafe;
  border-color: #93c5fd;
}

.clarify-chip:active:not(:disabled) {
  transform: translateY(1px);
}

.clarify-chip:disabled,
.clarify-disabled .clarify-chip,
.clarify-disabled .clarify-other-send,
.clarify-disabled .clarify-other-input {
  opacity: 0.55;
  cursor: not-allowed;
}

.clarify-other {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: min(100%, 280px);
}

.clarify-other-form {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.clarify-other-form.hidden {
  display: none;
}

.clarify-other-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  color: #111827;
  background: #fff;
}

.clarify-other-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.clarify-other-send {
  appearance: none;
  border: none;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.clarify-other-send:hover:not(:disabled) {
  background: #1e4ed8;
}

.clarify-expired {
  margin-top: 10px;
  font-size: 12px;
  color: #6b7280;
}

.message.user.clarify-reply-msg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.clarify-quote {
  margin: 0;
  padding: 6px 10px;
  border-left: 3px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.12);
  border-radius: 0 8px 8px 0;
  font-size: 12px;
  line-height: 1.4;
  opacity: 0.92;
  max-width: 100%;
  white-space: pre-wrap;
}

.clarify-choice {
  font-weight: 600;
  line-height: 1.4;
}

/* ================= AI STRUCTURED TEXT (PROFESSIONAL MARKDOWN STYLING) ================= */

.ai-text {
  display: flex;
  flex-direction: column;
  gap: 12px;
  line-height: 1.7;
}

/* Section Headings (Summary, Key Details, Analytics & Insights) */
.ai-section-heading {
  margin: 20px 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #2563eb;
  font-size: 16px;
  font-weight: 700;
  color: #1f2937;
  letter-spacing: -0.01em;
}

.ai-section-heading:first-child {
  margin-top: 0;
}

/* Period Headings (January 2025, December 2024, etc.) */
.ai-period-heading {
  margin: 16px 0 10px 0;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  background: #f3f4f6;
  padding: 8px 12px;
  border-radius: 6px;
  border-left: 3px solid #2563eb;
}

/* Bullet Point Items */
.ai-bullet-item {
  display: flex;
  gap: 10px;
  margin: 2px 0;
  /* Reduced from 6px to 2px - tighter spacing */
  padding-left: 4px;
}

.ai-bullet {
  color: #2563eb;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.ai-bullet-content {
  flex: 1;
  line-height: 1.6;
}

/* Metrics within bullet points (Label: Value) */
.ai-metric-label {
  font-weight: 600;
  color: #374151;
}

.ai-metric-value {
  color: #111827;
  font-weight: 500;
  margin-left: 4px;
}

/* Location Names (Edinburgh, London, etc.) */
.ai-location {
  color: #1f2937;
  font-weight: 600;
}

/* Regular Paragraphs */
.ai-paragraph {
  margin: 4px 0;
  /* Reduced from 8px to 4px - tighter within sections */
  line-height: 1.7;
  color: #374151;
}

.ai-paragraph strong {
  font-weight: 600;
  color: #111827;
}

/* Legacy support for old structure */
.ai-heading {
  margin-top: 18px;
  padding-top: 6px;
  border-top: 1px solid #e5e7eb;
  font-size: 15px;
  font-weight: 600;
  color: #1f4fd8;
}

.ai-row {
  display: flex;
  gap: 6px;
  padding-left: 10px;
  line-height: 1.6;
}

.ai-label {
  font-weight: 600;
  color: #111827;
}

.ai-value {
  color: #111827;
}

.ai-heading+.ai-paragraph {
  margin-top: 6px;
}

/* ================= SCROLL BUTTON ================= */
.scroll-btn {
  position: fixed;
  bottom: 90px;
  right: 30px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  color: #2563eb;
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.2s ease, transform 0.2s ease;
  opacity: 0;
  pointer-events: none;
}

.scroll-btn.show {
  opacity: 1;
  pointer-events: auto !important;
}

.scroll-btn:hover {
  background: #f9fafb;
  transform: translateY(-2px);
}

/* ================= LOGIN CONTAINER ================= */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 100px);
  padding: 40px 20px;
}

.login-box {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-title {
  text-align: center;
  margin-bottom: 30px;
}

.login-title h2 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: #111827;
}

.login-title p {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.form-group input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input::placeholder {
  color: #9ca3af;
}

.submit-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 10px;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.submit-btn:active {
  transform: translateY(0);
}

.error-message {
  background: #fee2e2;
  color: #dc2626;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
  border-left: 4px solid #dc2626;
}

.footer-text {
  text-align: center;
  font-size: 13px;
  color: #6b7280;
  margin-top: 20px;
}

/* ================= LOGIN PAGE RESPONSIVE ================= */
@media (max-width: 480px) {
  .login-box {
    padding: 30px 20px;
  }

  .login-title h2 {
    font-size: 24px;
  }
}

/* ===================================================================================== */
/* ============ RESPONSIVE DESIGN - EXACT WIREFRAME MOBILE LAYOUT ===================== */
/* ===================================================================================== */

/* ================= SIDEBAR OVERLAY (MOBILE) ================= */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 768px) {
  .sidebar-overlay {
    display: block;
  }
}

/* Tablet Landscape and Below (≤1024px) */
@media (max-width: 1024px) {
  #chat {
    margin-left: 0;
    width: 100%;
    padding: 0 16px;
    min-height: calc(100vh - 220px);
  }

  footer {
    left: 0;
    width: 100%;
  }

  .history-sidebar,
  .sidebar.history-sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    right: auto;
    width: 280px;
    transform: translateX(-100%);
    visibility: hidden;
    z-index: 1000;
  }

  .suggestions-sidebar,
  .sidebar.suggestions-sidebar {
    position: fixed;
    top: 56px;
    left: auto !important;
    right: 0;
    width: 280px;
    transform: translateX(100%);
    visibility: hidden;
    z-index: 1000;
  }

  .history-sidebar.open,
  .sidebar.history-sidebar.open {
    transform: translateX(0);
    visibility: visible;
  }

  .suggestions-sidebar.open,
  .sidebar.suggestions-sidebar.open {
    transform: translateX(0);
    visibility: visible;
  }

  .history-sidebar.collapsed,
  .sidebar.history-sidebar.collapsed {
    transform: translateX(-100%);
    visibility: hidden;
  }

  .suggestions-sidebar.collapsed,
  .sidebar.suggestions-sidebar.collapsed {
    transform: translateX(100%);
    visibility: hidden;
  }

  .chart-grid {
    grid-template-columns: 1fr !important;
  }

  .chart-grid[data-count="3"] .chart-box:last-child,
  .chart-grid[data-count="5"] .chart-box:last-child {
    grid-column: auto;
    width: 100%;
    justify-self: stretch;
  }

  .kpi-row[data-count="2"] .kpi,
  .kpi-row[data-count="3"] .kpi,
  .kpi-row[data-count="4"] .kpi,
  .kpi-row[data-count="5"] .kpi,
  .kpi-row[data-count="6"] .kpi,
  .kpi-row[data-count="7"] .kpi,
  .kpi-row[data-count="8"] .kpi {
    flex: 1 1 calc(50% - 6px);
    max-width: calc(50% - 6px);
  }
}


@media (min-width: 1025px) {
  .history-sidebar:not(.collapsed),
  .suggestions-sidebar:not(.collapsed) {
    transform: translateX(0);
    visibility: visible;
  }

  .history-sidebar.collapsed,
  .sidebar.history-sidebar.collapsed {
    transform: translateX(-100%);
    visibility: hidden;
  }

  .suggestions-sidebar.collapsed,
  .sidebar.suggestions-sidebar.collapsed {
    transform: translateX(100%);
    visibility: hidden;
  }

  .history-sidebar.open,
  .suggestions-sidebar.open {
    transform: translateX(0);
    visibility: visible;
  }
}

/* Ensure chart containers never overflow on small/mobile screens */
.chart-box {
  min-width: 0;
  width: 100%;
}

.chart-box canvas {
  width: 100% !important;
  height: 100% !important;
}


/* ===================================================================================== */
/* ========== MOBILE LAYOUT - MATCHING WIREFRAME (<768px) =============================== */
/* ===================================================================================== */
@media (max-width: 767px) {
  body {
    --mobile-header-height: 76px;
    --mobile-sidebar-width: 132px;
    --mobile-footer-height: 70px;
  }

  /* ========== HEADER - 2x2 GRID LAYOUT (MATCHING WIREFRAME) ========== */
  header {
    height: var(--mobile-header-height);
    padding: 8px 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 4px 8px;
    align-items: center;
    align-content: center;
  }

  /* Logo - Top Left */
  header img {
    height: 24px;
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }

  /* Username - Top Right */
  .user-info-section {
    position: static;
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0;
    background: transparent;
    border: none;
  }

  .user-info-section .user-name {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
  }

  .user-info-section .divider {
    display: none;
  }

  .user-info-section .logout-btn {
    display: none;
    /* Logout button will be in bottom left */
  }

  /* Title "AI Assistance" - Bottom Left */
  header .title {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    text-align: left;
  }

  header h1 {
    font-size: 13px;
    font-weight: 600;
  }

  header p {
    display: none;
  }

  /* ========== LOGOUT BUTTON - BOTTOM RIGHT (MATCHING WIREFRAME) ========== */
  header::after {
    content: '';
    grid-column: 2;
    grid-row: 2;
  }

  /* Create logout button container in header */
  .mobile-logout {
    display: none;
  }

  @supports (display: grid) {
    .mobile-logout {
      display: block;
      grid-column: 2;
      grid-row: 2;
      justify-self: end;
    }

    .mobile-logout .logout-btn {
      padding: 3px 10px;
      background: transparent;
      color: #2563eb;
      text-decoration: none;
      border-radius: 6px;
      font-size: 10px;
      font-weight: 600;
      border: 1px solid #3b82f6;
      display: inline-block;
    }
  }

  /* Keep login header in one horizontal row on mobile */
  .login-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0;
    height: 60px;
    padding: 0 14px;
  }

  .login-header img {
    height: 24px;
    grid-column: auto;
    grid-row: auto;
  }

  .login-header .title {
    grid-column: auto;
    grid-row: auto;
    justify-self: auto;
    margin-left: auto;
    text-align: right;
  }

  .login-header h1 {
    font-size: 13px;
    font-weight: 700;
  }

  .sidebar-overlay,
  .sidebar-overlay.active {
    display: none !important;
  }

  /* ========== SIDEBAR - COLLAPSIBLE PANEL (MATCHING WIREFRAME) ========== */
  .sidebar,
  .suggestions-sidebar {
    top: var(--mobile-header-height);
    bottom: 0;
    width: var(--mobile-sidebar-width);
    max-width: none;
    z-index: 1000;
    box-shadow: none;
    padding: 0;
  }

  .sidebar {
    border-right: 1px solid #d1d5db;
  }

  .suggestions-sidebar {
    border-left: 1px solid #d1d5db;
    border-right: none;
  }

  .sidebar .sidebar-title,
  .suggestions-sidebar .sidebar-title {
    font-size: 13px;
    margin-bottom: 0;
  }

  .sidebar-header {
    padding: 12px 8px 10px;
  }

  .sidebar-scroll-area {
    padding: 10px 8px 18px;
  }

  .sidebar .sidebar-category-toggle {
    margin: 0;
    font-size: 11px;
    color: #6b7280;
  }

  .sidebar .question-btn {
    font-size: 11px;
    padding: 6px 8px;
  }

  .history-sidebar.collapsed,
  .sidebar.history-sidebar.collapsed {
    transform: translateX(-100%);
    visibility: hidden;
  }

  .suggestions-sidebar.collapsed,
  .sidebar.suggestions-sidebar.collapsed {
    transform: translateX(100%);
    visibility: hidden;
  }

  .history-sidebar.open,
  .suggestions-sidebar.open,
  .sidebar.history-sidebar.open,
  .sidebar.suggestions-sidebar.open {
    transform: translateX(0);
    visibility: visible;
  }

  /* ========== SIDEBAR TOGGLE - TOP LEFT/RIGHT OF CHAT ========== */
  .sidebar-toggle-btn {
    position: fixed;
    top: calc(var(--mobile-header-height) + 12px);
    left: 8px;
    width: 20px;
    height: 20px;
    margin-top: 0;
    transform: none;
    z-index: 1002;
  }

  .suggestions-toggle-btn {
    left: auto !important;
    right: 8px;
  }

  .sidebar-toggle-btn.open {
    left: calc(var(--mobile-sidebar-width) - 32px);
    transform: none;
    width: 20px;
    height: 20px;
  }

  .suggestions-toggle-btn.open {
    left: auto !important;
    right: calc(var(--mobile-sidebar-width) - 32px);
    transform: none;
    width: 20px;
    height: 20px;
  }

  .sidebar-toggle-btn svg {
    width: 11px;
    height: 11px;
  }

  /* ========== CHAT AREA - SPLIT WHEN SIDEBAR OPEN ========== */
  #chat {
    margin-top: calc(var(--mobile-header-height) + 12px);
    margin-bottom: calc(var(--mobile-footer-height) + 12px);
    margin-left: 0;
    margin-right: 0;
    padding: 0 56px 0 56px;
    width: 100%;
    max-width: 100%;
    min-height: auto;
  }

  body.history-sidebar-open #chat {
    margin-left: var(--mobile-sidebar-width);
    width: calc(100% - var(--mobile-sidebar-width));
    padding-left: 12px;
  }

  body.suggestions-sidebar-open #chat {
    margin-right: var(--mobile-sidebar-width);
    width: calc(100% - var(--mobile-sidebar-width));
    padding-right: 12px;
  }

  body.history-sidebar-open.suggestions-sidebar-open #chat {
    margin-left: var(--mobile-sidebar-width);
    margin-right: var(--mobile-sidebar-width);
    width: calc(100% - (2 * var(--mobile-sidebar-width)));
  }

  #chat.sidebar-collapsed {
    margin-left: 0;
  }

  #chat.suggestions-collapsed {
    margin-right: 0;
  }

  /* ========== MESSAGES ========== */
  .message {
    font-size: 13px;
    padding: 10px 12px;
  }

  .user {
    max-width: 85%;
  }

  .ai {
    max-width: 95%;
  }

  /* ========== KPIs - 2 COLUMNS ========== */
  .kpi-row {
    gap: 10px;
  }

  .kpi-row[data-count="1"] .kpi {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .kpi-row[data-count="2"] .kpi,
  .kpi-row[data-count="3"] .kpi,
  .kpi-row[data-count="4"] .kpi,
  .kpi-row[data-count="5"] .kpi,
  .kpi-row[data-count="6"] .kpi,
  .kpi-row[data-count="7"] .kpi,
  .kpi-row[data-count="8"] .kpi {
    flex: 1 1 calc(50% - 5px);
    max-width: calc(50% - 5px);
  }

  .kpi {
    padding: 12px 8px;
  }

  .kpi h3 {
    font-size: 11px;
  }

  .kpi p {
    font-size: 16px;
  }

  /* ========== CHARTS - SINGLE COLUMN ========== */
  .chart-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .chart-grid[data-count="3"] .chart-box:last-child,
  .chart-grid[data-count="5"] .chart-box:last-child {
    grid-column: auto;
    width: 100%;
    justify-self: stretch;
  }

  .chart-box {
    height: 240px;
    padding: 10px;
  }

  /* ========== FOOTER - SPLIT WHEN SIDEBAR OPEN ========== */
  footer {
    left: 0;
    right: 0;
    width: auto;
    min-height: var(--mobile-footer-height);
    padding: 8px 14px;
  }

  body.history-sidebar-open footer {
    left: var(--mobile-sidebar-width);
  }

  body.suggestions-sidebar-open footer {
    right: var(--mobile-sidebar-width);
  }

  footer.sidebar-collapsed {
    left: 0;
  }

  footer.suggestions-collapsed {
    right: 0;
  }

  .input-bar {
    gap: 8px;
  }

  textarea {
    font-size: 13px;
    padding: 8px 12px;
    min-height: 36px;
  }

  .send-button {
    padding: 0 16px;
    font-size: 13px;
  }

  /* ========== SCROLL BUTTON ========== */
  .scroll-btn {
    bottom: 80px;
    right: 16px;
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
}

/* ========== MOBILE PHONES (<768px) ========== */
@media (max-width: 767px) {
  body {
    --mobile-header-height: 70px;
    --mobile-sidebar-width: 116px;
    --mobile-footer-height: 66px;
  }

  header {
    padding: 7px 10px;
    gap: 3px 6px;
  }

  header img {
    height: 20px;
  }

  .user-info-section .user-name {
    font-size: 12px;
  }

  header h1 {
    font-size: 12px;
  }

  .login-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0;
    height: 54px;
    padding: 0 10px;
  }

  .login-header img {
    height: 20px;
  }

  .login-header h1 {
    font-size: 12px;
  }

  .sidebar,
  .suggestions-sidebar {
    width: var(--mobile-sidebar-width);
  }

  .sidebar-toggle-btn {
    width: 18px;
    height: 18px;
  }

  .sidebar-toggle-btn.open {
    left: calc(var(--mobile-sidebar-width) - 30px);
  }

  .suggestions-toggle-btn.open {
    left: auto !important;
    right: calc(var(--mobile-sidebar-width) - 30px);
    transform: none;
  }

  .sidebar-toggle-btn svg {
    width: 10px;
    height: 10px;
  }

  #chat {
    margin-top: calc(var(--mobile-header-height) + 10px);
    margin-bottom: calc(var(--mobile-footer-height) + 10px);
    padding: 0 50px;
  }

  #chat.sidebar-collapsed {
    padding-left: 50px;
  }

  #chat.suggestions-collapsed {
    padding-right: 50px;
  }

  .kpi-row {
    gap: 8px;
  }

  .kpi {
    padding: 10px 6px;
  }

  .kpi h3 {
    font-size: 10px;
  }

  .kpi p {
    font-size: 14px;
  }

  .chart-box {
    height: 220px;
    padding: 8px;
  }

  .ai-heading {
    font-size: 13px;
  }

  .ai-row {
    font-size: 11px;
    padding-left: 6px;
  }

  footer {
    left: 0;
    right: 0;
    width: auto;
    padding: 7px 10px;
  }

  body.history-sidebar-open footer {
    left: var(--mobile-sidebar-width);
  }

  body.suggestions-sidebar-open footer {
    right: var(--mobile-sidebar-width);
  }

  footer.sidebar-collapsed {
    left: 0;
  }

  footer.suggestions-collapsed {
    right: 0;
  }

  textarea {
    font-size: 12px;
    padding: 7px 10px;
  }

  .send-button {
    padding: 0 14px;
    font-size: 12px;
  }

  .send-button span.icon {
    font-size: 14px;
  }

  .scroll-btn {
    bottom: 70px;
    right: 12px;
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
}

/* ========== EXTRA SMALL PHONES (≤360px) ========== */
@media (max-width: 360px) {
  body {
    --mobile-sidebar-width: 100px;
  }

  .sidebar,
  .suggestions-sidebar {
    width: var(--mobile-sidebar-width);
  }

  .sidebar-toggle-btn.open {
    left: calc(var(--mobile-sidebar-width) - 30px);
  }

  .suggestions-toggle-btn.open {
    left: auto !important;
    right: calc(var(--mobile-sidebar-width) - 30px);
    transform: none;
  }

  .kpi-row {
    gap: 8px;
  }

  .kpi-row[data-count="1"] .kpi {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .kpi-row[data-count="2"] .kpi,
  .kpi-row[data-count="3"] .kpi,
  .kpi-row[data-count="4"] .kpi,
  .kpi-row[data-count="5"] .kpi,
  .kpi-row[data-count="6"] .kpi {
    flex: 1 1 100%;
    max-width: 100%;
  }

  header h1 {
    font-size: 11px;
  }

  .user-info-section .user-name {
    font-size: 11px;
  }
}

/* ========== LANDSCAPE MOBILE ========== */
@media (max-height: 500px) and (orientation: landscape) {
  body {
    --mobile-header-height: 74px;
    --mobile-footer-height: 60px;
  }

  header {
    padding: 8px 12px;
  }

  .login-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0;
    height: 52px;
    padding: 0 10px;
  }

  .sidebar-toggle-btn {
    top: calc(var(--mobile-header-height) + 12px);
  }

  #chat {
    margin-top: calc(var(--mobile-header-height) + 10px);
  }

  footer {
    padding: 6px 12px;
  }

}

/* ===================================================================================== */
/* ================= TABLET LAYOUT NORMALIZATION (768px-1024px) ======================== */
/* ===================================================================================== */
@media (min-width: 768px) and (max-width: 1024px) {
  body {
    --tablet-header-height: 84px;
    --tablet-sidebar-width: clamp(220px, 30vw, 280px);
    --tablet-footer-height: 84px;
  }

  header {
    height: var(--tablet-header-height);
    padding: 12px 20px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 6px 16px;
    align-items: center;
  }

  header img {
    grid-column: 1;
    grid-row: 1;
    height: 28px;
  }

  header .title {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
  }

  header h1 {
    font-size: 18px;
    line-height: 1.2;
  }

  .user-info-section {
    position: static;
    grid-column: 2;
    grid-row: 1 / span 2;
    justify-self: end;
    max-width: min(42vw, 320px);
    gap: 10px;
  }

  .user-info-section .user-name {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-logout {
    display: none;
  }

  .sidebar-overlay,
  .sidebar-overlay.active {
    display: none !important;
  }

  .sidebar,
  .suggestions-sidebar {
    top: var(--tablet-header-height);
    width: var(--tablet-sidebar-width);
    padding: 0;
    z-index: 1000;
    box-shadow: none;
  }

  .sidebar {
    left: 0;
  }

  .suggestions-sidebar {
    left: auto !important;
    right: 0;
  }

  .history-sidebar.open,
  .suggestions-sidebar.open,
  .sidebar.history-sidebar.open,
  .sidebar.suggestions-sidebar.open {
    transform: translateX(0);
    visibility: visible;
  }

  .history-sidebar.collapsed,
  .sidebar.history-sidebar.collapsed {
    transform: translateX(-100%);
    visibility: hidden;
  }

  .suggestions-sidebar.collapsed,
  .sidebar.suggestions-sidebar.collapsed {
    transform: translateX(100%);
    visibility: hidden;
  }

  .sidebar-title {
    font-size: 18px;
    margin-bottom: 0;
  }

  .sidebar .sidebar-category-toggle {
    margin: 0;
    font-size: 14px;
    line-height: 1.35;
    color: #111827;
  }

  .sidebar .question-btn {
    padding: 12px 14px;
    font-size: 15px;
    border-radius: 12px;
  }

  .sidebar-toggle-btn {
    top: calc(var(--tablet-header-height) + 14px);
    left: 16px;
    width: 28px;
    height: 28px;
    z-index: 1003;
  }

  .suggestions-toggle-btn {
    left: auto !important;
    right: 16px;
  }

  .sidebar-toggle-btn svg {
    width: 14px;
    height: 14px;
  }

  .sidebar-toggle-btn.open {
    left: calc(var(--tablet-sidebar-width) - 14px);
    width: 28px;
    height: 28px;
  }

  .suggestions-toggle-btn.open {
    left: auto !important;
    right: calc(var(--tablet-sidebar-width) - 14px);
    width: 28px;
    height: 28px;
    transform: none;
  }

  #chat {
    margin-top: calc(var(--tablet-header-height) + 20px);
    margin-bottom: calc(var(--tablet-footer-height) + 18px);
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    max-width: 100%;
    padding: 0 24px 0 64px;
    min-height: auto;
  }

  body.history-sidebar-open #chat {
    margin-left: var(--tablet-sidebar-width);
    width: calc(100% - var(--tablet-sidebar-width));
    max-width: calc(100% - var(--tablet-sidebar-width));
    padding-left: 18px;
  }

  body.suggestions-sidebar-open #chat {
    margin-right: var(--tablet-sidebar-width);
    width: calc(100% - var(--tablet-sidebar-width));
    max-width: calc(100% - var(--tablet-sidebar-width));
    padding-right: 18px;
  }

  body.history-sidebar-open.suggestions-sidebar-open #chat {
    margin-left: var(--tablet-sidebar-width);
    margin-right: var(--tablet-sidebar-width);
    width: calc(100% - (2 * var(--tablet-sidebar-width)));
    max-width: calc(100% - (2 * var(--tablet-sidebar-width)));
  }

  #chat.sidebar-collapsed {
    margin-left: 0;
  }

  #chat.suggestions-collapsed {
    margin-right: 0;
  }

  .message {
    font-size: 15px;
  }

  .user {
    max-width: min(72%, 640px);
  }

  .ai {
    max-width: min(92%, 760px);
  }

  .welcome-message {
    max-width: min(720px, 100%);
  }

  .chart-grid {
    grid-template-columns: 1fr !important;
  }

  .chart-grid[data-count="3"] .chart-box:last-child,
  .chart-grid[data-count="5"] .chart-box:last-child {
    grid-column: auto;
    width: 100%;
    justify-self: stretch;
  }

  footer {
    left: 0;
    right: 0;
    width: auto;
    min-height: var(--tablet-footer-height);
    padding: 12px 20px;
  }

  body.history-sidebar-open footer {
    left: var(--tablet-sidebar-width);
  }

  body.suggestions-sidebar-open footer {
    right: var(--tablet-sidebar-width);
  }

  footer.sidebar-collapsed {
    left: 0;
  }

  footer.suggestions-collapsed {
    right: 0;
  }

  .input-bar {
    max-width: 100%;
    gap: 12px;
  }

  textarea {
    min-height: 46px;
    font-size: 15px;
    padding: 11px 14px;
  }

  .send-button {
    min-width: 120px;
    font-size: 15px;
  }
}






