/* Visual language shared with the Tropical Forages Research Assistant:
   forage greens, green gradient header, white translucent panels with green-tinted borders,
   rounded shapes and small bold uppercase labels. Light is the default; body.dark_theme switches. */

:root {
  --font_sans: 'Geist', Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font_mono: 'Geist Mono', ui-monospace, monospace;

  --bg_app: #f3f7f4;
  --bg_panel: #ffffff;
  --bg_surface: #f6faf7;
  --bg_surface_elevated: #e8f3eb;
  --bg_glass: rgba(255, 255, 255, 0.72);

  --border_subtle: rgba(53, 175, 97, 0.2);
  --border_highlight: rgba(53, 175, 97, 0.45);

  --text_main: #0a1d11;
  --text_muted: #3f5a48;
  --text_dim: #6b8574;

  /* Brand colors: forage green (primary), deep green, TF gold, TF olive, Alliance navy */
  --accent_primary: #35af61;
  --accent_primary_rgb: 53, 175, 97;
  --accent_primary_strong: #1b6535;
  --accent_deep: #132c1c;
  --accent_gold: #dcaa30;
  --accent_olive: #737f36;
  --accent_navy: #1d4f91;
  --accent_amber: #b45309;
  --accent_amber_rgb: 217, 119, 6;
  --accent_danger: #dc2626;

  --header_bg: linear-gradient(135deg, #1b6535 0%, #8cb927 100%);
  --code_bg: #0f2418;
  --code_text: #d6f5df;

  --radius_sm: 8px;
  --radius_md: 12px;
  --radius_lg: 18px;
  --radius_full: 9999px;

  --shadow_subtle: 0 4px 14px rgba(19, 44, 28, 0.06);
  --shadow_prominent: 0 14px 36px rgba(19, 44, 28, 0.12);
  --shadow_primary: 0 8px 22px rgba(53, 175, 97, 0.25);

  --chat_panel_width: 420px;
  --header_height: 60px;

  --transition_speed: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

body.dark_theme {
  --bg_app: #070f0b;
  --bg_panel: #0e1d13;
  --bg_surface: #0b1811;
  --bg_surface_elevated: #14291c;
  --bg_glass: rgba(11, 24, 17, 0.78);

  --border_subtle: rgba(66, 211, 109, 0.18);
  --border_highlight: rgba(66, 211, 109, 0.42);

  --text_main: #f2f8f3;
  --text_muted: #b8cfc0;
  --text_dim: #7d9a87;

  --accent_primary: #42d36d;
  --accent_primary_rgb: 66, 211, 109;
  --accent_primary_strong: #8be0a6;
  --accent_deep: #ecf3e6;
  --accent_amber: #f59e0b;
  --accent_amber_rgb: 245, 158, 11;
  --accent_danger: #f87171;

  --header_bg: linear-gradient(135deg, #061f0e 0%, #245e2f 100%);
  --code_bg: #04100a;

  --shadow_subtle: 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow_prominent: 0 14px 36px rgba(0, 0, 0, 0.5);
  --shadow_primary: 0 8px 22px rgba(66, 211, 109, 0.18);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  font-family: var(--font_sans);
  background-color: var(--bg_app);
  color: var(--text_main);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s ease;
}

button, input, textarea {
  font-family: inherit;
}

/* Top Header: green gradient bar with white content */
.top_header {
  height: var(--header_height);
  background: var(--header_bg);
  border-bottom: 1px solid var(--border_subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  z-index: 50;
  position: relative;
  color: #ffffff;
}

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

.studio_logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.studio_logo img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.studio_brand_name {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffffff;
  white-space: nowrap;
}

.studio_sub_brand {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 500;
  white-space: nowrap;
}

.header_center {
  display: flex;
  align-items: center;
  min-width: 0;
}

.space_status_pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 6px 14px;
  border-radius: var(--radius_full);
  font-size: 12px;
  color: #ffffff;
  min-width: 0;
}

.live_pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background-color: var(--accent_primary);
  box-shadow: 0 0 0 3px rgba(var(--accent_primary_rgb), 0.25);
  animation: live_pulse 1.8s ease-in-out infinite;
}

.top_header .live_pulse {
  background-color: #c9f7d6;
  box-shadow: 0 0 0 3px rgba(201, 247, 214, 0.25);
}

@keyframes live_pulse {
  50% { opacity: 0.45; }
}

.space_status_title {
  color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.space_status_val {
  color: #ffffff;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Data server status dot: green connected, amber demo, red error, grey while checking */
.space_status_pill.status_demo .live_pulse {
  background-color: #fcd34d;
  box-shadow: 0 0 0 3px rgba(252, 211, 77, 0.3);
}

.space_status_pill.status_error .live_pulse {
  background-color: #fca5a5;
  box-shadow: 0 0 0 3px rgba(252, 165, 165, 0.3);
  animation: none;
}

.space_status_pill.status_checking .live_pulse {
  background-color: rgba(255, 255, 255, 0.6);
  box-shadow: none;
}

.header_actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.dock_control_group {
  display: flex;
  background-color: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius_md);
  padding: 3px;
  gap: 3px;
}

/* Icon-only dock buttons; the title attribute gives the tooltip */
.header_tool_btn {
  background: transparent;
  border: 1px solid transparent;
  color: rgba(255, 255, 255, 0.88);
  width: 32px;
  height: 30px;
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.header_tool_btn:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.16);
}

.header_tool_btn.active {
  background-color: rgba(255, 255, 255, 0.92);
  color: var(--accent_primary_strong);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

body.dark_theme .header_tool_btn.active {
  color: #1b6535;
}

.header_icon_btn {
  background-color: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.header_icon_btn:hover {
  background-color: rgba(255, 255, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Workspace Container */
.workspace_container {
  display: flex;
  height: calc(100vh - var(--header_height));
  width: 100vw;
  position: relative;
  overflow: hidden;
}

/* Docking Orientations */
body.layout_dock_right .workspace_container {
  flex-direction: row;
}

body.layout_dock_left .workspace_container {
  flex-direction: row-reverse;
}

/* Large Visualization Canvas Stage */
.canvas_stage {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--bg_app);
  overflow-y: auto;
  padding: 18px 24px 24px;
  gap: 16px;
  min-width: 0;
  transition: all var(--transition_speed);
}

/* Canvas Header Card */
.canvas_header_card {
  background-color: var(--bg_glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border_subtle);
  border-radius: var(--radius_lg);
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow_subtle);
}

.canvas_title_row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.canvas_tag {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent_primary);
  margin-bottom: 4px;
}

.canvas_main_title {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent_deep);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.canvas_meta_group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.meta_chip {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: var(--radius_full);
}

.warehouse_chip {
  background-color: rgba(var(--accent_primary_rgb), 0.1);
  color: var(--accent_primary_strong);
  border: 1px solid var(--border_highlight);
}

.latency_chip {
  background-color: var(--bg_surface);
  color: var(--text_muted);
  border: 1px solid var(--border_subtle);
  font-family: var(--font_mono);
  font-weight: 500;
}

.canvas_tabs_row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border_subtle);
  padding-top: 12px;
}

.canvas_nav_tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.canvas_tab_btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text_muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 7px 14px;
  border-radius: var(--radius_md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.canvas_tab_btn:hover {
  color: var(--accent_primary_strong);
  background-color: rgba(var(--accent_primary_rgb), 0.08);
}

.canvas_tab_btn.active {
  background-color: rgba(var(--accent_primary_rgb), 0.12);
  border-color: var(--border_highlight);
  color: var(--accent_primary_strong);
}

.canvas_actions_group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.canvas_action_pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg_panel);
  border: 1px solid var(--border_subtle);
  color: var(--text_muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 7px 12px;
  border-radius: var(--radius_md);
  cursor: pointer;
  transition: all 0.15s ease;
}

.canvas_action_pill:hover {
  color: var(--accent_primary_strong);
  border-color: var(--accent_primary);
}

/* KPI Metric Cards Grid */
.kpi_metric_grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.kpi_card {
  background-color: var(--bg_panel);
  border: 1px solid var(--border_subtle);
  border-left: 4px solid var(--accent_primary);
  border-radius: var(--radius_md);
  padding: 16px 18px;
  box-shadow: var(--shadow_subtle);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi_card:nth-child(4n + 2) { border-left-color: var(--accent_gold); }
.kpi_card:nth-child(4n + 3) { border-left-color: var(--accent_navy); }
.kpi_card:nth-child(4n + 4) { border-left-color: var(--accent_olive); }

.kpi_card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow_prominent);
}

.kpi_title {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text_dim);
  margin-bottom: 6px;
}

.kpi_value {
  font-size: 26px;
  font-weight: 800;
  color: var(--accent_deep);
  letter-spacing: -0.02em;
}

.kpi_subtext {
  font-size: 12px;
  color: var(--text_muted);
  margin-top: 4px;
  font-weight: 500;
}

/* Canvas Body Panel */
.canvas_body_panel {
  flex: 1;
  background-color: var(--bg_panel);
  border: 1px solid var(--border_subtle);
  border-radius: var(--radius_lg);
  padding: 20px;
  box-shadow: var(--shadow_subtle);
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.view_panel {
  display: none;
  width: 100%;
  height: 100%;
}

.view_panel.active {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Chart Studio View */
.chart_toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border_subtle);
}

.chart_type_selector {
  display: flex;
  align-items: center;
  gap: 6px;
}

.selector_label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text_dim);
  margin-right: 6px;
}

.chart_type_btn {
  background-color: var(--bg_surface);
  border: 1px solid var(--border_subtle);
  color: var(--text_muted);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius_full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chart_type_btn:hover {
  color: var(--accent_primary_strong);
  border-color: var(--border_highlight);
}

.chart_type_btn.active {
  background-color: var(--accent_primary);
  color: #ffffff;
  border-color: var(--accent_primary);
  box-shadow: var(--shadow_primary);
}

body.dark_theme .chart_type_btn.active {
  color: #04120a;
}

.chart_legend_note {
  font-size: 11px;
  color: var(--text_dim);
}

.chart_stage_container {
  flex: 1;
  position: relative;
  min-height: 380px;
  width: 100%;
}

/* Table View */
.table_toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.table_search_box {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg_surface);
  border: 1px solid var(--border_subtle);
  color: var(--text_dim);
  padding: 7px 12px;
  border-radius: var(--radius_full);
  width: 260px;
  max-width: 100%;
  transition: border-color 0.15s ease;
}

.table_search_box:focus-within {
  border-color: var(--accent_primary);
}

.table_search_box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text_main);
  font-size: 13px;
  width: 100%;
}

.row_counter {
  font-size: 12px;
  color: var(--text_dim);
}

.table_scroll_wrapper {
  flex: 1;
  overflow: auto;
  border: 1px solid var(--border_subtle);
  border-radius: var(--radius_md);
}

.bespoke_data_table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.bespoke_data_table th {
  background-color: var(--bg_surface_elevated);
  color: var(--accent_deep);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border_highlight);
  position: sticky;
  top: 0;
  z-index: 1;
}

.bespoke_data_table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border_subtle);
  color: var(--text_main);
}

.bespoke_data_table tbody tr:nth-child(even) td {
  background-color: rgba(var(--accent_primary_rgb), 0.03);
}

.bespoke_data_table tr:hover td {
  background-color: rgba(var(--accent_primary_rgb), 0.08);
}

/* SQL Studio View */
.sql_studio_header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.sql_status_meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dialect_pill {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background-color: rgba(var(--accent_primary_rgb), 0.12);
  color: var(--accent_primary_strong);
  padding: 4px 9px;
  border-radius: var(--radius_full);
}

.catalog_scope {
  font-size: 12px;
  color: var(--text_dim);
}

.copy_btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg_panel);
  border: 1px solid var(--border_subtle);
  color: var(--text_muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 7px 12px;
  border-radius: var(--radius_md);
  cursor: pointer;
  transition: all 0.15s ease;
}

.copy_btn:hover {
  color: var(--accent_primary_strong);
  border-color: var(--accent_primary);
}

.sql_code_stage {
  flex: 1;
  background-color: var(--code_bg);
  border: 1px solid var(--border_subtle);
  border-radius: var(--radius_md);
  padding: 16px 20px;
  overflow: auto;
}

.syntax_sql {
  font-family: var(--font_mono);
  font-size: 13px;
  line-height: 1.65;
  color: var(--code_text);
}

/* Dockable Chat Panel */
.dockable_chat_panel {
  width: var(--chat_panel_width);
  height: 100%;
  background-color: var(--bg_glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid var(--border_subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: var(--shadow_prominent);
  transition: transform var(--transition_speed), width var(--transition_speed), margin var(--transition_speed);
  position: relative;
  z-index: 40;
}

body.layout_dock_left .dockable_chat_panel {
  border-left: none;
  border-right: 1px solid var(--border_subtle);
}

body.chat_collapsed .dockable_chat_panel {
  width: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  border: none !important;
}

.chat_panel_header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border_subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg_panel);
}

.chat_panel_title_block {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Rounded green icon tile, like the chatbot's panel header */
.chat_indicator {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  flex-shrink: 0;
  background-color: var(--accent_primary);
  box-shadow: var(--shadow_primary);
  position: relative;
}

.chat_indicator::after {
  content: "";
  position: absolute;
  inset: 8px 7px 9px;
  border: 2px solid #ffffff;
  border-radius: 4px 4px 4px 1px;
}

.chat_panel_title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent_deep);
}

.chat_panel_subtitle {
  font-size: 11px;
  color: var(--text_dim);
}

.panel_dock_toggles {
  display: flex;
  gap: 4px;
}

.panel_control_btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text_muted);
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.panel_control_btn:hover {
  color: #ffffff;
  background-color: var(--accent_primary);
}

/* Prompt Suggestions Rail: suggestion cards like the chatbot's welcome screen */
.prompt_suggestions_rail {
  padding: 12px 16px;
  background-color: var(--bg_surface);
  border-bottom: 1px solid var(--border_subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rail_label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text_dim);
}

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

.prompt_pill {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  background-color: var(--bg_panel);
  border: 1px solid var(--border_subtle);
  color: var(--accent_deep);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  padding: 9px 10px;
  border-radius: var(--radius_md);
  cursor: pointer;
  transition: all 0.15s ease;
}

.prompt_pill::before {
  content: "";
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--accent_primary);
  background: radial-gradient(circle, var(--accent_primary) 0 2px, transparent 3px);
}

.prompt_pill:hover {
  border-color: var(--accent_primary);
  background-color: rgba(var(--accent_primary_rgb), 0.06);
  transform: translateY(-1px);
}

/* Chat Messages Feed */
.chat_messages_scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat_bubble {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 92%;
}

.chat_bubble.user {
  align-self: flex-end;
}

.chat_bubble.agent {
  align-self: flex-start;
  width: 100%;
}

.bubble_user_content {
  background-color: rgba(var(--accent_primary_rgb), 0.12);
  border: 1px solid var(--border_highlight);
  color: var(--text_main);
  padding: 10px 14px;
  border-radius: 16px 16px 4px 16px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
}

.bubble_agent_card {
  background-color: var(--bg_panel);
  border: 1px solid var(--border_subtle);
  border-radius: 4px 16px 16px 16px;
  padding: 14px;
  box-shadow: var(--shadow_subtle);
}

.agent_card_top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.agent_label_tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent_primary_strong);
  background: rgba(var(--accent_primary_rgb), 0.12);
  padding: 3px 8px;
  border-radius: var(--radius_full);
}

.agent_time_tag {
  font-size: 11px;
  color: var(--text_dim);
  font-family: var(--font_mono);
}

.agent_thought_steps {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  padding: 8px 10px;
  background-color: var(--bg_surface);
  border-radius: var(--radius_sm);
  border: 1px solid var(--border_subtle);
}

.thought_step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent_primary_strong);
}

.thought_check {
  font-size: 10px;
  font-weight: bold;
}

.agent_summary_text {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text_main);
}

.agent_summary_text strong {
  color: var(--accent_deep);
}

.view_in_canvas_btn {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg_panel);
  border: 1px solid var(--border_subtle);
  color: var(--text_muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 6px 11px;
  border-radius: var(--radius_full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.view_in_canvas_btn:hover {
  color: #ffffff;
  background-color: var(--accent_primary);
  border-color: var(--accent_primary);
}

/* Chat Input Dock */
.chat_input_dock {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border_subtle);
  background-color: var(--bg_panel);
}

.chat_textarea_wrapper {
  background-color: var(--bg_panel);
  border: 1.5px solid var(--border_highlight);
  border-radius: 20px;
  padding: 12px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow_subtle);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.chat_textarea_wrapper:focus-within {
  border-color: var(--accent_primary);
  box-shadow: 0 0 0 4px rgba(var(--accent_primary_rgb), 0.12);
}

#chat_prompt_input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text_main);
  font-family: var(--font_sans);
  font-size: 14px;
  resize: none;
  max-height: 80px;
}

#chat_prompt_input::placeholder {
  color: var(--text_dim);
}

.input_action_bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.enter_hint {
  font-size: 10px;
  color: var(--text_dim);
}

.submit_query_btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: var(--accent_primary);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: var(--shadow_primary);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.submit_query_btn:hover {
  transform: scale(1.06);
  background-color: var(--accent_primary_strong);
}

/* Settings Modal */
.modal_backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(10, 29, 17, 0.55);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal_backdrop.hidden {
  display: none;
}

.modal_window {
  width: 500px;
  max-width: 92vw;
  background-color: var(--bg_panel);
  border: 1px solid var(--border_highlight);
  border-radius: 20px;
  box-shadow: var(--shadow_prominent);
  overflow: hidden;
}

.modal_head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border_subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal_heading {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent_deep);
}

.modal_close_btn {
  background: transparent;
  border: none;
  color: var(--text_dim);
  cursor: pointer;
  border-radius: 8px;
  padding: 4px;
  display: flex;
}

.modal_close_btn:hover {
  color: #ffffff;
  background-color: var(--accent_danger);
}

.modal_content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form_field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form_field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text_muted);
}

.form_field input {
  background-color: var(--bg_surface);
  border: 1px solid var(--border_subtle);
  border-radius: var(--radius_sm);
  padding: 9px 12px;
  color: var(--text_main);
  font-size: 13px;
  outline: none;
  font-family: var(--font_sans);
}

.form_field input:focus {
  border-color: var(--accent_primary);
}

.field_caption {
  font-size: 11px;
  color: var(--text_dim);
  line-height: 1.5;
}

.modal_actions {
  padding: 14px 20px;
  border-top: 1px solid var(--border_subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background-color: var(--bg_surface);
}

.btn_secondary {
  background: var(--bg_panel);
  border: 1px solid var(--border_highlight);
  color: var(--accent_primary_strong);
  padding: 8px 16px;
  border-radius: var(--radius_md);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn_secondary:hover:not(:disabled) {
  border-color: var(--accent_primary);
  background-color: rgba(var(--accent_primary_rgb), 0.08);
}

.btn_secondary:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn_primary {
  background-color: var(--accent_primary);
  border: none;
  color: #ffffff;
  padding: 8px 18px;
  border-radius: var(--radius_md);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--shadow_primary);
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.btn_primary:hover {
  background-color: var(--accent_primary_strong);
  transform: translateY(-1px);
}

body.dark_theme .btn_primary,
body.dark_theme .submit_query_btn {
  color: #04120a;
}

body.dark_theme .btn_primary:hover,
body.dark_theme .submit_query_btn:hover {
  background-color: #6fe293;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(var(--accent_primary_rgb), 0.2);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent_primary);
}

/* Welcome screen before the first answer */
.canvas_empty_state {
  display: none;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 14px;
  min-height: 380px;
  padding: 40px 32px;
  background-color: var(--bg_glass);
  border: 1px solid var(--border_subtle);
  border-radius: var(--radius_lg);
  color: var(--text_muted);
  font-size: 14px;
  line-height: 1.65;
  box-shadow: var(--shadow_subtle);
}

.canvas_empty_state p {
  max-width: 620px;
}

.empty_state_logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.empty_state_title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--accent_deep);
  max-width: 560px;
}

.empty_state_hint {
  font-size: 12px;
  color: var(--text_dim);
}

.empty_state_notice {
  font-size: 12px;
  color: var(--text_muted);
}

.empty_state_notice strong {
  color: var(--accent_deep);
}

.canvas_stage.is_empty .canvas_empty_state {
  display: flex;
}

.canvas_stage.is_empty .kpi_metric_grid,
.canvas_stage.is_empty .canvas_body_panel,
.canvas_stage.is_empty .canvas_actions_group {
  display: none;
}

.canvas_stage.no_table .canvas_actions_group {
  display: none;
}

.panel_empty_note {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  font-size: 13px;
  color: var(--text_muted);
}

.panel_empty_note.hidden {
  display: none;
}

.table_empty_cell {
  color: var(--text_muted);
  text-align: center;
  padding: 24px;
}

/* Simulated data warning chip */
body.provider_mock .warehouse_chip {
  color: var(--accent_amber);
  border-color: rgba(var(--accent_amber_rgb), 0.5);
  background: rgba(var(--accent_amber_rgb), 0.12);
}

/* Chat additions */
.chat_system_note {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text_dim);
  text-align: center;
  padding: 0 12px;
}

.thinking_row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text_muted);
}

.agent_summary_text {
  white-space: pre-line;
}

.error_card {
  border-color: rgba(220, 38, 38, 0.45);
}

.error_tag {
  color: var(--accent_danger);
  background: rgba(220, 38, 38, 0.1);
}

.followup_pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.followup_pill {
  background-color: var(--bg_surface);
  border: 1px solid var(--border_subtle);
  color: var(--accent_deep);
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  padding: 5px 11px;
  border-radius: var(--radius_full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.followup_pill:hover {
  border-color: var(--accent_primary);
  background-color: rgba(var(--accent_primary_rgb), 0.08);
}

.chat_input_dock.is_busy .submit_query_btn {
  opacity: 0.5;
  cursor: wait;
}

/* Connection dialog */
.info_list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  font-size: 13px;
}

.info_list dt {
  color: var(--text_muted);
  font-weight: 600;
}

.info_list dd {
  color: var(--text_main);
  font-family: var(--font_mono);
  font-size: 12px;
  word-break: break-all;
}

/* Logos in the connection dialog */
.about_logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border_subtle);
}

.about_logos a {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 64px;
  padding: 6px 12px;
  border-radius: var(--radius_md);
  background-color: #ffffff;
  border: 1px solid var(--border_subtle);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.about_logos a:hover {
  border-color: var(--accent_primary);
  transform: translateY(-1px);
}

.about_logos img {
  height: 100%;
  width: auto;
  object-fit: contain;
}

/* The Alliance logo file has wide white margins; scale it up inside a clipped frame */
.about_logos .alliance_link {
  width: 150px;
  overflow: hidden;
}

.about_logos .alliance_logo {
  transform: scale(1.75);
}

/* Stop button replaces the send button while waiting for an answer */
.stop_query_btn {
  display: none;
  background-color: var(--bg_surface_elevated);
  color: var(--accent_deep);
  border: 1px solid var(--border_highlight);
  box-shadow: none;
}

.stop_query_btn:hover {
  border-color: var(--accent_danger);
  background-color: var(--accent_danger);
  color: #ffffff;
}

.chat_input_dock.is_busy .stop_query_btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat_input_dock.is_busy #chat_submit_btn {
  display: none;
}

.chat_input_dock.is_busy .stop_query_btn {
  opacity: 1;
  cursor: pointer;
}

/* Tablets and phones: compact header, chat panel below the canvas */
@media (max-width: 1100px) {
  .studio_brand_name {
    white-space: normal;
    line-height: 1.2;
  }
}

@media (max-width: 960px) {
  .header_center {
    display: none;
  }
}

@media (max-width: 860px) {
  :root {
    --header_height: 56px;
  }

  .top_header {
    padding: 0 12px;
  }

  .studio_sub_brand,
  .dock_control_group {
    display: none;
  }

  .workspace_container,
  body.layout_dock_right .workspace_container,
  body.layout_dock_left .workspace_container {
    flex-direction: column;
    overflow-y: auto;
  }

  .canvas_stage {
    flex: none;
    height: auto;
    overflow: visible;
    padding: 14px 16px;
  }

  .dockable_chat_panel,
  body.layout_dock_left .dockable_chat_panel {
    width: 100%;
    height: 78vh;
    flex-shrink: 0;
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--border_subtle);
  }

  .canvas_title_row {
    flex-direction: column;
  }

  .canvas_meta_group {
    justify-content: flex-start;
  }

  .empty_state_title {
    font-size: 22px;
  }
}

@media (max-width: 480px) {
  .studio_brand_name {
    font-size: 10px;
    white-space: normal;
    line-height: 1.2;
  }

  .prompt_pills {
    grid-template-columns: 1fr;
  }

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

  .table_search_box {
    width: 100%;
  }
}
