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

:root {
  color-scheme: light;
  font-family: 'Inter', system-ui, "Segoe UI", Roboto, sans-serif;
  background: #f8fafc;
  color: #0f172a;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(145deg, #f0f4f8 0%, #f8fafc 100%);
}

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

button {
  border: 0;
  border-radius: 999px;
  padding: 0.6rem 1.2rem;
  background: #000000;
  color: #fff;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

button.secondary {
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #e2e8f0;
}

button.secondary:hover {
  background: #e2e8f0;
}

button.danger {
  background: #fee2e2;
  color: #ef4444;
  border: 1px solid #fecaca;
}

button.danger:hover {
  background: #fecaca;
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 0.85rem 1.2rem;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.1);
}

textarea {
  resize: vertical;
}

#app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 1.25rem;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  padding: 1.25rem;
  box-sizing: border-box;
}

.card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 24px;
  padding: 1.25rem;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.04);
  backdrop-filter: blur(20px);
}

.brand h1,
.card h2 {
  margin: 0 0 0.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand p,
.muted {
  margin: 0;
  color: #64748b;
}

.quota-status {
  flex-shrink: 0;
  margin-left: auto;
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.workspace,
.menu-toolbar {
  display: flex;
  gap: 0.75rem;
}

.topbar {
  position: relative;
  z-index: 50;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "brand nav";
  align-items: center;
  padding: 0.5rem 1.5rem;
  gap: 1rem 1.5rem;
}

.brand {
  grid-area: brand;
  display: flex;
  align-items: center;
}

.brand h1 {
  margin: 0;
  font-size: 1.5rem;
  color: #0f172a;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.topbar-nav {
  grid-area: nav;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-width: 0;
}

.top-menu {
  display: flex;
  gap: 1.5rem;
  flex: 1;
  min-width: 0;
  align-items: center;
}

.mobile-menu-btn {
  display: none;
  grid-area: toggle;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0.5rem;
  border-radius: 12px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  box-shadow: none;
  transform: none;
}

.mobile-menu-btn:hover,
.mobile-menu-btn:focus-visible {
  background: #e2e8f0;
  transform: none;
  box-shadow: none;
  outline: none;
}

.mobile-menu-btn__bar {
  display: block;
  width: 100%;
  height: 2px;
  background: #0f172a;
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.topbar.is-menu-open .mobile-menu-btn__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.topbar.is-menu-open .mobile-menu-btn__bar:nth-child(2) {
  opacity: 0;
}

.topbar.is-menu-open .mobile-menu-btn__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.dropdown {
  position: relative;
}

.dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 500;
  list-style: none;
  color: #475569;
  transition: all 0.2s ease;
}

.dropdown-toggle:hover {
  background: rgba(241, 245, 249, 0.8);
  color: #0f172a;
}

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

.dropdown[open] .dropdown-toggle {
  color: #0f172a;
  background: #f1f5f9;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.75rem;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
  width: 360px;
  padding: 1.5rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.menu-badge {
  min-width: 1.5rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  text-align: center;
  background: #f1f5f9;
  color: #0f172a;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid #e2e8f0;
}

.menu-badge--trip-label {
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-toolbar {
  align-items: center;
  justify-content: space-between;
}

.thread-item-row {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
}

.thread-item-row .thread-item {
  flex: 1;
  min-width: 0;
}

.thread-delete-btn {
  flex-shrink: 0;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.thread-delete-btn:hover,
.thread-delete-btn:focus-visible {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fca5a5;
  outline: none;
}

.thread-delete-btn:disabled {
  cursor: wait;
  opacity: 0.55;
}

.text-sm {
  font-size: 0.85rem;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

.top-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex-shrink: 0;
}

.panel-actions button {
  padding: 0.28rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.25;
}

.panel-actions button:hover {
  transform: none;
  box-shadow: none;
}

.row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.section-header-titles {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  min-width: 0;
}

.section-header-titles h2 {
  margin: 0;
  flex-shrink: 0;
}

.section-header-block {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.section-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  min-width: 0;
}

.section-header-row h2 {
  margin: 0;
  flex-shrink: 0;
}

.section-header-block .panel-actions {
  flex: 1;
  justify-content: flex-end;
  min-width: 0;
}

.section-header--foldable {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  flex-shrink: 0;
}

.section-header--foldable .section-header-titles,
.section-header--foldable .section-header-block {
  flex: 1;
  min-width: 0;
}

.panel-fold-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.5rem;
  min-width: 2.25rem;
  border-radius: 12px;
  line-height: 1;
  margin-top: 0.1rem;
}

.panel-fold-btn:hover {
  transform: none;
}

.fold-chevron {
  display: block;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(135deg);
  transition: transform 0.2s ease;
}

.foldable-panel:not(.is-folded) .fold-chevron {
  transform: rotate(225deg);
}

.foldable-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.foldable-body--map {
  min-height: 180px;
}

.foldable-panel.is-folded .foldable-body {
  display: none;
}

.foldable-panel.is-folded {
  align-self: stretch;
}

.foldable-panel.is-folded .section-header--foldable {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
  padding-bottom: 0.25rem;
  height: 100%;
  min-height: 0;
}

.foldable-panel.is-folded .section-header-titles,
.foldable-panel.is-folded .section-header-block {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.foldable-panel.is-folded .section-header-titles h2,
.foldable-panel.is-folded .section-header-row h2 {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
}

.foldable-panel.is-folded .section-header-row {
  flex-direction: column;
  align-items: center;
}

.foldable-panel.is-folded .panel-actions {
  display: none;
}

.foldable-panel.is-folded .panel-updated {
  display: none;
}

.foldable-panel.is-folded .panel-fold-btn {
  margin-top: 0;
}

.panel-updated {
  display: block;
  font-size: 0.75rem;
  line-height: 1.3;
  text-align: left;
  min-width: 0;
}

.panel-updated:empty {
  display: none;
}

.actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.workspace {
  --chat-frac: 0.54;
  --workspace-split-size: 0.9rem;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  min-height: 0;
  overflow: hidden;
}

.workspace > .conversation-card {
  flex: 0 0 calc((100% - var(--workspace-split-size)) * var(--chat-frac));
  min-width: min(28rem, 100%);
}

.workspace > .companion-panel {
  flex: 0 0 calc((100% - var(--workspace-split-size)) * (1 - var(--chat-frac)));
  min-width: 0;
}

.workspace-split {
  flex: 0 0 var(--workspace-split-size);
  width: var(--workspace-split-size);
  min-height: 120px;
  align-self: stretch;
  cursor: col-resize;
  touch-action: none;
  border-radius: 8px;
  background: transparent;
  position: relative;
  z-index: 1;
}

.workspace-split::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  border-radius: 1px;
  background: rgba(148, 163, 184, 0.45);
  transition: background 0.15s ease, width 0.15s ease;
}

.workspace-split:hover::after,
.workspace-split:focus-visible::after {
  background: rgba(15, 23, 42, 0.35);
  width: 3px;
}

.workspace-split:focus-visible {
  outline: none;
}

.workspace-split:focus-visible::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 10px;
  border: 2px solid rgba(148, 163, 184, 0.6);
  pointer-events: none;
}

.panel {
  min-width: 0;
  min-height: 0;
}

.thread-list,
.saved-list,
.chat-log,
.summary-output,
.itinerary-output {
  overflow: auto;
}

/* Custom Scrollbar for modern look */
::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #94a3b8;
}

.thread-list,
.saved-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 220px;
  min-height: 78px;
}

.thread-item,
.saved-item {
  width: 100%;
  text-align: left;
  padding: 1rem;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #f1f5f9;
  cursor: pointer;
  color: #0f172a;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.02);
}

.thread-item:hover,
.saved-item:hover {
  background: #f8fafc;
  transform: translateY(-1px);
}

.thread-item-row.active .thread-item {
  border-color: #000000;
  background: #f8fafc;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.saved-item {
  background: #ffffff;
}

.empty-state {
  padding: 1.5rem 1rem;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  color: #64748b;
  background: rgba(248, 250, 252, 0.5);
  text-align: center;
  font-size: 0.95rem;
}

.conversation-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  align-content: stretch;
}

.scroll-wrap {
  position: relative;
  min-height: 0;
  height: 100%;
}

.scroll-arrow {
  position: absolute;
  right: 10px;
  z-index: 5;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: rgba(248, 250, 252, 0.9);
  color: #0f172a;
  font-weight: 800;
  font-size: 0.75rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  user-select: none;
}

.scroll-arrow:hover,
.scroll-arrow:focus-visible {
  background: rgba(226, 232, 240, 0.95);
  border-color: #94a3b8;
  outline: none;
}

.scroll-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

.scroll-arrow--up {
  top: 10px;
}

.scroll-arrow--down {
  bottom: 10px;
}

.companion-panel,
.summary-card,
.itinerary-card,
.map-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.companion-panel {
  gap: 0.85rem;
  padding: 0.9rem;
}

.companion-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.25rem;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: #f8fafc;
  flex-shrink: 0;
}

.companion-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0.55rem 0.75rem;
  border-radius: 14px;
  background: transparent;
  color: #475569;
  box-shadow: none;
  font-weight: 600;
}

.companion-tab:hover,
.companion-tab:focus-visible {
  transform: none;
  box-shadow: none;
  background: #e2e8f0;
  outline: none;
}

.companion-tab.is-active {
  background: #0f172a;
  color: #ffffff;
}

.companion-tab[data-companion-tab="chat"] {
  display: none;
}

.companion-tab-panel {
  flex: 1 1 auto;
  min-height: 0;
  gap: 0.75rem;
}

.companion-tab-panel[hidden] {
  display: none !important;
}

.companion-tab-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.companion-tab-body--map {
  min-height: 240px;
}

.chat-log {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 0;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
}

.message {
  padding: 0.75rem 1rem;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid #e8e8e8;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  min-width: 0;
}

.message-user {
  background: #ffffff;
  border: 1px solid #e8e8e8;
  align-self: flex-end;
  max-width: min(78%, 520px);
  width: fit-content;
  border-bottom-right-radius: 4px;
}

.message-user .message-header {
  flex-direction: row-reverse;
}

.message-user .message-body {
  text-align: right;
}

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

.message-assistant {
  background: #ffffff;
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  border-bottom-left-radius: 4px;
  border: 1px solid #e8e8e8;
}

.message-pending .message-body {
  color: #94a3b8;
  font-style: italic;
}

.message-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  color: #64748b;
  font-size: 0.9rem;
}

.message-body {
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: #334155;
}

.message-body .md-table-wrap {
  overflow-x: auto;
  margin: 0.75rem 0;
  max-width: 100%;
  white-space: normal;
}

.message-body .md-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.85rem;
  line-height: 1.4;
  table-layout: auto;
}

.message-body .md-table th,
.message-body .md-table td {
  border: 1px solid #e2e8f0;
  padding: 0.5rem 0.65rem;
  text-align: left;
  vertical-align: top;
  white-space: normal;
  word-break: break-word;
}

.message-body .md-table th {
  background: #f1f5f9;
  font-weight: 600;
}

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

.message-body .md-table th:first-child,
.message-body .md-table td:first-child {
  text-align: center;
  white-space: nowrap;
  width: 2rem;
}

.message-body .md-table th:last-child,
.message-body .md-table td:last-child {
  text-align: right;
  white-space: nowrap;
}

.message-body a,
.summary-output a,
.itinerary-output a {
  color: #000000;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.image-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.image-card {
  width: 180px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
}

.image-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.image-card figcaption {
  padding: 0.75rem;
  font-size: 0.85rem;
  color: #475569;
}

.chat-input-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: flex-end;
  background: #ffffff;
  padding: 0.5rem 0.5rem 0.5rem 1.25rem;
  border-radius: 24px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-input-bar:focus-within {
  border-color: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.1);
}

.chat-input-bar textarea {
  border: none;
  background: transparent;
  padding: 0.5rem 0;
  box-shadow: none;
  border-radius: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: none;
  max-height: 120px;
  overflow-y: auto;
}

.chat-input-bar textarea:focus {
  box-shadow: none;
  outline: none;
}

.chat-input-bar button {
  border-radius: 999px;
  padding: 0.75rem 1.5rem;
  margin: 0;
  background: #0f172a;
  color: #ffffff;
  font-weight: 600;
}

.chat-input-bar button:hover {
  background: #1e293b;
}

.summary-output,
.itinerary-output {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  white-space: pre-wrap;
  margin: 0;
  line-height: 1.6;
  border-radius: 16px;
  padding: 1rem 1.1rem;
  color: #334155;
  background: #ffffff;
  border: 1px solid #e8e8e8;
}

/* Structured booking summary (HTML) */
.summary-output--rich,
.itinerary-output--rich {
  white-space: normal;
  font-size: 0.9375rem;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0.01em;
}

/* Both classes are on #summary-output; keep normal wrapping so <ul>/<button> layout is not broken. */
.summary-output.summary-output--rich,
.itinerary-output.itinerary-output--rich {
  white-space: normal;
}

.summary-doc {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.summary-preamble {
  padding-bottom: 0.25rem;
  border-bottom: 1px dashed #e2e8f0;
  margin-bottom: 0.25rem;
}

.summary-section {
  padding-bottom: 1rem;
  border-bottom: 1px solid #f1f5f9;
}

.summary-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.summary-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.65rem 0;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0.04em;
  color: #0f172a;
  line-height: 1.3;
}

.summary-section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  line-height: 1;
  flex-shrink: 0;
}

.summary-section-label {
  font-weight: 700;
}

.summary-section-body {
  padding-left: 0.15rem;
}

.summary-pin-hint {
  margin: 0 0 0.55rem 0;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  line-height: 1.45;
}

.summary-plain-nudge {
  margin: 0 0 0.65rem 0;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  line-height: 1.45;
}

.summary-bullet-list {
  margin: 0;
  padding-left: 1.2rem;
  list-style-type: disc;
  color: #334155;
}

.summary-bullet-list .summary-li {
  margin: 0 0 0.4rem 0;
  padding-left: 0.15rem;
  line-height: 1.55;
}

.summary-bullet-list .summary-li::marker {
  color: #94a3b8;
}

.summary-bullet-list--pinnable .summary-li--pinnable {
  list-style: none;
  margin-left: -0.35rem;
  padding-left: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.35rem;
  row-gap: 0.25rem;
}

.summary-bullet-list--pinnable .summary-li--pinnable::marker {
  content: none;
}

.summary-pin-btn {
  flex: 0 0 auto;
  flex-shrink: 0;
  margin: 0;
  padding: 0.2rem 0.5rem;
  border: 1px solid #94a3b8;
  border-radius: 6px;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.02em;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.summary-pin-btn:hover,
.summary-pin-btn:focus-visible {
  background: #e2e8f0;
  border-color: #64748b;
  color: #1e293b;
  outline: none;
}

.summary-pin-btn--active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.summary-pin-btn:disabled {
  cursor: wait;
  opacity: 0.55;
}

.summary-delete-btn {
  flex: 0 0 auto;
  flex-shrink: 0;
  margin: 0;
  padding: 0.2rem 0.45rem;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  background: #fef2f2;
  color: #b91c1c;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.02em;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.summary-delete-btn:hover,
.summary-delete-btn:focus-visible {
  background: #fee2e2;
  border-color: #f87171;
  color: #991b1b;
  outline: none;
}

.summary-delete-btn:disabled {
  cursor: wait;
  opacity: 0.55;
}

.summary-pin-btn-text {
  pointer-events: none;
}

.summary-li-inner {
  flex: 1;
  min-width: 0;
}

.summary-pin-mark {
  font-size: 0.85em;
  font-weight: 600;
  white-space: nowrap;
}

.summary-item-key {
  font-weight: 600;
  color: #1e293b;
}

.summary-prose {
  margin: 0 0 0.45rem 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: #475569;
}

.summary-prose:last-child {
  margin-bottom: 0;
}

.summary-plain {
  line-height: 1.65;
  color: #334155;
}

.summary-empty-line {
  margin: 0;
  font-size: 0.9rem;
}

/* Itinerary Timeline Styles */
.itinerary-timeline {
  position: relative;
  padding-left: 1.5rem;
  margin-top: 1.5rem;
}

.itinerary-timeline::before {
  content: '';
  position: absolute;
  top: 1.5rem;
  bottom: 0;
  left: 0.5rem;
  width: 2px;
  background: #e2e8f0;
  border-radius: 1px;
}

.itinerary-day-card {
  position: relative;
  margin-bottom: 2rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.itinerary-day-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.itinerary-day-card::before {
  content: '';
  position: absolute;
  top: 1.5rem;
  left: calc(-1rem - 0.4rem);
  width: 0.8rem;
  height: 0.8rem;
  background: #2563eb;
  border: 3px solid #eff6ff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #bfdbfe;
  z-index: 1;
}

.itinerary-day-title {
  margin: 0 0 0.75rem 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.itinerary-day-content {
  color: #475569;
  font-size: 0.95rem;
  line-height: 1.6;
}

.itinerary-day-content p {
  margin: 0 0 0.5rem 0;
}

.itinerary-day-content p:last-child {
  margin-bottom: 0;
}

.itinerary-day-content ul {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.itinerary-day-content li {
  margin-bottom: 0.25rem;
}

.itinerary-preamble {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 12px;
  color: #334155;
  font-size: 0.95rem;
  line-height: 1.6;
}

.itinerary-plain {
  line-height: 1.65;
  color: #334155;
}

.map-container {
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 16px;
  border: 1px solid #e8e8e8;
  background: #ffffff;
  overflow: hidden;
  z-index: 1;
}

/* Distance scale (Leaflet control) — readable on light tiles */
.map-container .leaflet-control-scale {
  margin: 0 0 10px 10px !important;
  border: 1px solid rgba(15, 23, 42, 0.18) !important;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  padding: 2px 6px 4px;
  line-height: 1.2;
}

.map-container .leaflet-control-scale-line {
  border-color: #334155 !important;
  border-width: 2px !important;
}

.map-container .leaflet-bottom .leaflet-control-scale {
  margin-bottom: 10px !important;
}

.map-airport-marker {
  background: transparent !important;
  border: none !important;
}

.map-airport-marker-img {
  display: block;
  filter: drop-shadow(0 1px 2px rgba(15, 23, 42, 0.3));
}

.map-hotel-marker {
  background: transparent !important;
  border: none !important;
}

.map-hotel-marker-img {
  display: block;
  filter: drop-shadow(0 1px 2px rgba(29, 78, 216, 0.35));
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  border-radius: 999px;
  background: #f1f5f9;
  padding: 0.4rem 0.85rem;
  color: #0f172a;
  font-weight: 500;
  font-size: 0.85rem;
  border: 1px solid #e2e8f0;
  max-width: min(28rem, 100%);
  white-space: normal;
  text-align: left;
  line-height: 1.35;
  word-break: break-word;
}

.session-band--topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  min-width: 0;
}

.session-band--footer {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.75rem 1.25rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.04);
}

.session-band-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.session-band-item span:last-child {
  min-width: 0;
  font-size: 0.9rem;
}

.session-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

.session-band-activity {
  justify-content: flex-start;
}

.session-band--footer .session-band-activity {
  flex: 1 1 auto;
  min-width: 0;
}

.session-band--footer .status-pill {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1320px) {
  .top-actions {
    justify-content: flex-start;
    min-width: 0;
  }
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand toggle"
      "nav nav";
    align-items: center;
    gap: 0.65rem;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .topbar-nav {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
  }

  .topbar.is-menu-open .topbar-nav {
    display: flex;
  }

  .top-menu {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .top-menu .dropdown {
    width: 100%;
  }

  .top-menu .dropdown-toggle {
    width: 100%;
    justify-content: space-between;
  }

  .top-menu .dropdown-menu {
    position: static;
    width: 100%;
    margin-top: 0.5rem;
    max-height: min(42vh, 18rem);
    overflow: auto;
    box-shadow: none;
  }

  .session-band--topbar {
    justify-content: flex-start;
    width: 100%;
    padding: 0.75rem 0.85rem;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
  }

  .workspace {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "tabs"
      "panel";
    gap: 0.65rem;
    overflow: hidden;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .workspace-split {
    display: none;
  }

  .companion-panel {
    display: contents;
  }

  .companion-tabs {
    grid-area: tabs;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .companion-tab[data-companion-tab="chat"] {
    display: inline-flex;
  }

  .workspace > .conversation-card,
  .companion-tab-panel {
    grid-area: panel;
    width: 100% !important;
    min-width: 0;
    min-height: 0;
  }

  .companion-tab-panel.summary-card,
  .companion-tab-panel.itinerary-card,
  .companion-tab-panel.map-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 24px;
    padding: 0.9rem;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.04);
    backdrop-filter: blur(20px);
  }

  .companion-tab-body--map {
    min-height: 220px;
  }
}

@media (max-width: 780px) {
  #app {
    padding: 0.75rem;
    gap: 0.75rem;
  }

  .menu-toolbar {
    flex-direction: column;
  }

  .session-band--footer {
    padding: 0.65rem 0.85rem;
    gap: 0.65rem;
  }

  .workspace {
    gap: 0.6rem;
  }

  .companion-tab-panel.summary-card,
  .companion-tab-panel.itinerary-card,
  .companion-tab-panel.map-card,
  .workspace > .conversation-card {
    padding: 0.65rem;
    border-radius: 20px;
  }

  .companion-tabs {
    border-radius: 16px;
  }

  .companion-tab {
    padding: 0.5rem 0.45rem;
  }
}

/* Native scrollbar arrow buttons (Chromium/WebKit only).
   Note: Firefox does not support styling native scrollbar buttons. */
.chat-log::-webkit-scrollbar-button:single-button,
.summary-output::-webkit-scrollbar-button:single-button,
.itinerary-output::-webkit-scrollbar-button:single-button {
  display: block;
  width: 22px;
  height: 22px;
  background: #f1f5f9;
  border: 3px solid transparent;
  background-clip: padding-box;
}

.chat-log::-webkit-scrollbar-button:single-button:hover,
.summary-output::-webkit-scrollbar-button:single-button:hover,
.itinerary-output::-webkit-scrollbar-button:single-button:hover {
  background: #e2e8f0;
}

.chat-log::-webkit-scrollbar-button:single-button:vertical:decrement,
.summary-output::-webkit-scrollbar-button:single-button:vertical:decrement,
.itinerary-output::-webkit-scrollbar-button:single-button:vertical:decrement {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='18 15 12 9 6 15'/%3E%3C/svg%3E");
  background-position: center;
  background-size: 14px 14px;
  background-repeat: no-repeat;
}

.chat-log::-webkit-scrollbar-button:single-button:vertical:increment,
.summary-output::-webkit-scrollbar-button:single-button:vertical:increment,
.itinerary-output::-webkit-scrollbar-button:single-button:vertical:increment {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-position: center;
  background-size: 14px 14px;
  background-repeat: no-repeat;
}

/* Ensure scrollbar sizing even if earlier rules are invalidated. */
.chat-log::-webkit-scrollbar,
.summary-output::-webkit-scrollbar,
.itinerary-output::-webkit-scrollbar {
  width: 22px;
  height: 22px;
}

.chat-log::-webkit-scrollbar-thumb,
.summary-output::-webkit-scrollbar-thumb,
.itinerary-output::-webkit-scrollbar-thumb {
  border: 5px solid transparent;
  background-clip: padding-box;
}

.confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.confirm-dialog[hidden] {
  display: none !important;
}

.confirm-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.confirm-dialog__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 26rem);
  margin: 0;
  padding: 1.25rem 1.35rem 1.1rem;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
}

.confirm-dialog__title {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.confirm-dialog__message {
  margin: 0 0 1.1rem;
  font-size: 0.95rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.confirm-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  flex-wrap: wrap;
}

body.confirm-dialog-open {
  overflow: hidden;
}
