:root {
  --bg: #edf1f7;
  --panel: #ffffff;
  --panel-soft: #f7f9fc;
  --ink: #172033;
  --muted: #7a8497;
  --line: #dfe5ef;
  --line-strong: #cfd7e5;
  --navy: #11192b;
  --navy-2: #18233a;
  --navy-3: #202d48;
  --brand: #5065e5;
  --brand-strong: #3b4bc2;
  --brand-soft: #eef1ff;
  --success: #16845b;
  --danger: #c53e4a;
  --warning: #a46d14;
  --shadow: 0 12px 32px rgba(28, 39, 67, 0.07);
  --shadow-soft: 0 2px 9px rgba(28, 39, 67, 0.05);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; background: var(--bg); }
button, input, textarea, select { font: inherit; }
button { -webkit-font-smoothing: antialiased; }
button:disabled { cursor: wait; opacity: .62; transform: none !important; }
.hidden { display: none !important; }

/* Application chrome */
.topbar {
  height: 72px;
  background: var(--navy);
  color: #fff;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto minmax(360px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 0 25px;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 4px 20px rgba(14, 22, 40, .2);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  position: relative;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #8191ff 0%, #4156d1 74%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 7px 16px rgba(49, 72, 192, .35);
}
.brand-mark span { font-size: 12px; font-weight: 850; letter-spacing: -.03em; }
.brand-mark i {
  position: absolute;
  width: 5px;
  height: 5px;
  right: 7px;
  bottom: 7px;
  border-radius: 50%;
  background: #b8c1ff;
}
.brand strong, .brand span { display: block; }
.brand strong { font-size: 14px; letter-spacing: -.01em; }
.brand > div:last-child span { font-size: 10px; color: #aeb8ce; margin-top: 3px; }

.project-context {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #d8def1;
  min-width: 0;
  font-size: 12px;
}
.project-context strong { font-weight: 650; color: #fff; white-space: nowrap; }
.project-context > span:last-child { color: #a9b4ca; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.context-kicker { color: #7f8aa6 !important; font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.context-divider { width: 1px; height: 15px; background: #39445e; }

.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.top-actions .top-button {
  border: 1px solid #344159;
  background: #1b263d;
  color: #d8def1;
  padding: 7px 10px;
}
.top-actions .top-button:hover { background: #263453; border-color: #506084; }
.top-actions .badge { white-space: nowrap; }
.top-actions .small { padding: 6px 9px; }

.workspace-strip {
  height: 54px;
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 72px;
  z-index: 15;
  backdrop-filter: blur(12px);
}
.workspace-strip-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 25px;
}
.window-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  color: #8993a6;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .12em;
}
.window-label-icon { color: var(--brand); font-size: 17px; line-height: 1; }
.workspace-tabs { display: flex; flex: 1 1 auto; align-self: stretch; min-width: 0; gap: 2px; overflow-x: auto; }
.workspace-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: stretch;
  position: relative;
  border: 0;
  background: transparent;
  color: #7a8497;
  padding: 0 16px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.workspace-tab:hover { color: var(--ink); background: #f8f9fc; }
.workspace-tab.active { color: var(--brand-strong); }
.workspace-tab.active::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: -1px;
  left: 12px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--brand);
}
.tab-icon { font-size: 15px; color: currentColor; line-height: 1; }
.layout-controls { display: flex; align-items: center; flex: 0 0 auto; gap: 2px; padding: 3px; border: 1px solid #dbe2ee; border-radius: 8px; background: #f4f6fa; }
.layout-label { padding: 0 6px; color: #9099aa; font-size: 8px; font-weight: 850; letter-spacing: .1em; }
.layout-option { display: inline-flex; align-items: center; gap: 5px; border: 0; border-radius: 6px; background: transparent; color: #7b8597; padding: 6px 7px; cursor: pointer; font-size: 10px; white-space: nowrap; }
.layout-option span { color: currentColor; font-size: 13px; line-height: 1; }
.layout-option b { font-size: 9px; font-weight: 750; }
.layout-option:hover { background: #e9edf6; color: #3f4c68; }
.layout-option.active { background: #fff; color: var(--brand-strong); box-shadow: 0 1px 4px rgba(28,39,67,.1); }
.workspace-strip-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  color: #8a94a6;
  font-size: 10px;
  white-space: nowrap;
}
.view-menu { position: relative; flex: 0 0 auto; }
.view-menu summary { list-style: none; border: 1px solid #dbe2ee; border-radius: 7px; background: #f4f6fa; color: #56627a; padding: 7px 10px; cursor: pointer; font-size: 10px; font-weight: 750; }
.view-menu summary::-webkit-details-marker { display: none; }
.view-menu[open] summary { background: #fff; color: var(--brand-strong); }
.view-menu .layout-controls { position: absolute; top: 37px; right: 0; z-index: 25; box-shadow: var(--shadow); }
.status-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
  background: #2fba82;
  box-shadow: 0 0 0 3px rgba(47,186,130,.13);
}

/* Shell and navigation */
.shell { display: grid; grid-template-columns: 255px minmax(0, 1fr); min-height: calc(100vh - 126px); }
.sidebar {
  background: var(--navy);
  color: #d9e0ef;
  padding: 19px 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 21px;
  position: sticky;
  top: 126px;
  height: calc(100vh - 126px);
  overflow: hidden;
}
.sidebar-section.grow { display: flex; flex: 1 1 auto; min-height: 0; flex-direction: column; overflow: hidden; }
.sidebar-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 0 7px 11px;
}
.sidebar-heading strong { display: block; font-size: 11px; color: #f1f4fb; font-weight: 750; margin-top: 3px; }
.sidebar-kicker, .nav-section-label {
  display: block;
  color: #76839e;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.icon-button {
  width: 25px;
  height: 25px;
  border: 1px solid #2c3853;
  border-radius: 7px;
  background: #19243b;
  color: #acb8cf;
  cursor: pointer;
  font-size: 15px;
}
.icon-button:hover { color: white; background: #263554; }
.dataset-list { display: flex; flex-direction: column; gap: 6px; }
.dataset-item {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: #e4e9f4;
  text-align: left;
  border-radius: 9px;
  padding: 10px 10px;
  cursor: pointer;
  overflow: hidden;
  transition: .16s ease;
}
.dataset-item:hover { background: #19243b; border-color: #2c3853; }
.dataset-item.active {
  background: linear-gradient(135deg, #283867, #202d4d);
  border-color: #445991;
  box-shadow: inset 3px 0 0 #7488ff;
}
.dataset-item strong, .dataset-item span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dataset-item strong { font-size: 11px; }
.dataset-item span { font-size: 10px; color: #8d9ab4; margin-top: 4px; }
.dataset-large-badge { margin-left: 4px; color: #f3bd79; font-size: 8px; font-style: normal; letter-spacing: .06em; text-transform: uppercase; }
.dataset-dropzone {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 8px 2px 0;
  padding: 8px 9px;
  border: 1px dashed #34425f;
  border-radius: 8px;
  color: #94a1ba;
  cursor: pointer;
  font-size: 10px;
  width: calc(100% - 4px);
  background: transparent;
  text-align: left;
  font-weight: 600;
}
.dataset-dropzone:hover { color: #dfe7f7; border-color: #6676ad; background: #18243a; }
.dataset-dropzone span:first-child { font-size: 16px; line-height: 1; color: #8e9cff; }
.nav-heading { margin-bottom: 12px; }
.nav { display: flex; flex: 1 1 auto; flex-direction: column; gap: 15px; min-height: 0; overflow: auto; padding-right: 2px; }
.nav-primary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.nav-primary .nav-item { min-height: 35px; }
.sidebar-advanced { border-top: 1px solid #2a3650; padding-top: 8px; }
.sidebar-advanced summary { margin: 0 7px 5px; color: #8794ae; font-size: 9px; cursor: pointer; }
.sidebar-advanced .nav-section { gap: 2px; }
.admin-nav-item.hidden { display: none !important; }
.nav-section { display: flex; flex-direction: column; gap: 3px; }
.nav-section-label { margin: 0 9px 4px; color: #5f6c87; font-size: 8px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #aeb8cb;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  font-size: 11px;
  font-weight: 620;
  transition: .16s ease;
}
.nav-item:hover { color: #f5f7fc; background: #19243b; }
.nav-item.active { color: #fff; background: linear-gradient(90deg, #2a3a65, #202d4b); box-shadow: inset 3px 0 0 #7387ff; }
.nav-icon { width: 16px; color: #7584a4; font-size: 15px; line-height: 1; text-align: center; }
.nav-item.active .nav-icon { color: #aeb9ff; }
.sidebar-footer { border-top: 1px solid #293650; padding: 14px 7px 0; }
.active-dataset-card { display: flex; align-items: center; gap: 9px; min-width: 0; }
.active-dataset-icon {
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid #3c4c72;
  border-radius: 8px;
  color: #98a5ff;
  background: #1b2845;
  font-size: 14px;
}
.mini-label { display: block; color: #75839f; font-size: 8px; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 4px; }
.sidebar-footer strong { display: block; max-width: 175px; color: #edf1f8; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-status { display: flex; align-items: center; gap: 7px; margin-top: 13px; color: #8290aa; font-size: 9px; }
.sidebar-status kbd { margin-left: auto; border: 1px solid #34415d; border-radius: 4px; color: #7f8ca6; padding: 2px 4px; font: inherit; font-size: 8px; }

/* Main application surface */
.main { min-width: 0; padding: 29px 32px 50px; overflow: hidden; }
.tab { display: none; max-width: 1550px; margin: 0 auto; }
.tab.active { display: block; animation: window-in .18s ease-out; }
.home-hero { display: flex; align-items: stretch; justify-content: space-between; gap: 22px; padding: 24px 26px; margin-bottom: 22px; border: 1px solid #d9e2f4; border-radius: 14px; background: linear-gradient(135deg, #f8faff 0%, #eef2ff 68%, #e6ecff 100%); }
.home-hero h1 { margin: 0; color: #1e2b50; font-size: 34px; letter-spacing: -.045em; }
.home-hero p:not(.eyebrow) { max-width: 650px; margin: 9px 0 0; color: #62708b; font-size: 13px; line-height: 1.55; }
.home-status-card { display: flex; flex: 0 0 230px; flex-direction: column; justify-content: center; padding: 15px 17px; border: 1px solid rgba(116,134,202,.22); border-radius: 10px; background: rgba(255,255,255,.72); }
.home-status-card strong { color: #24345f; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-status-card > span:last-child { margin-top: 5px; color: #77839b; font-size: 10px; line-height: 1.35; }
.home-section { margin-bottom: 22px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 2px 11px; }
.section-heading h2 { margin: 0; color: #26334e; font-size: 17px; }
.goal-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.application-card { min-height: 168px; }
.application-card .goal-icon { font-size: 22px; }
.goal-card { display: flex; min-height: 168px; flex-direction: column; align-items: flex-start; padding: 16px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); box-shadow: var(--shadow-soft); cursor: pointer; text-align: left; transition: .16s ease; }
.goal-card:hover { border-color: #9eacd7; box-shadow: 0 8px 20px rgba(45,63,126,.11); transform: translateY(-2px); }
.goal-icon { display: grid; width: 33px; height: 33px; place-items: center; margin-bottom: 14px; border-radius: 9px; background: var(--brand-soft); color: var(--brand-strong); font-size: 18px; }
.goal-card strong { font-size: 13px; }
.goal-card > span:not(.goal-icon) { margin-top: 7px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.goal-card b { margin-top: auto; padding-top: 14px; color: var(--brand-strong); font-size: 10px; }
.home-secondary-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr); gap: 14px; }
.home-checklist { padding: 16px; }
.home-checklist .panel-heading { margin-bottom: 6px; }
.checklist-item { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 2px; border: 0; border-top: 1px solid #edf0f5; background: transparent; color: var(--ink); text-align: left; }
button.checklist-item { cursor: pointer; }
button.checklist-item:hover { color: var(--brand-strong); }
.checklist-item > span { display: grid; width: 23px; height: 23px; flex: 0 0 23px; place-items: center; border: 1px solid #ced7e6; border-radius: 50%; color: #74819a; font-size: 10px; font-weight: 800; }
.checklist-item.done > span { border-color: #94d0b8; background: #e9f8f0; color: var(--success); }
.checklist-item > div { min-width: 0; flex: 1; }
.checklist-item strong, .checklist-item small { display: block; }
.checklist-item strong { font-size: 10px; }
.checklist-item small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.checklist-item b { color: var(--brand-strong); font-size: 9px; }
.home-secondary-card { display: flex; flex-direction: column; justify-content: center; }
.home-secondary-card h2 { margin-bottom: 8px; }
.home-secondary-card p:not(.eyebrow) { color: var(--muted); font-size: 11px; line-height: 1.55; }
@keyframes window-in { from { opacity: .4; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
.window-chrome { display: none; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; margin: 0 -1px 14px; padding: 7px 9px 7px 11px; border-bottom: 1px solid #d8e0ec; background: linear-gradient(180deg, #f9fbfe, #eef2f8); }
.window-chrome-title, .window-chrome-actions { display: flex; align-items: center; gap: 9px; min-width: 0; }
.window-chrome-icon { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid #cdd7ee; border-radius: 6px; color: var(--brand-strong); background: #eaf0ff; font-size: 13px; }
.window-chrome-title strong, .window-chrome-title span { display: block; }
.window-chrome-title strong { color: #293651; font-size: 11px; }
.window-chrome-title div span { color: #8691a5; margin-top: 2px; font-size: 9px; }
.window-layout-hint { color: #98a2b3; font-size: 8px; }
.window-close { width: 23px; height: 23px; border: 1px solid #d5dce8; border-radius: 6px; background: #fff; color: #788398; cursor: pointer; font-size: 15px; line-height: 1; }
.window-close:hover { border-color: #dd9ca4; background: #fff2f3; color: var(--danger); }
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  padding: 1px 2px 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid #d9e0eb;
}
.eyebrow { color: var(--brand-strong); font-size: 9px; letter-spacing: .15em; font-weight: 850; margin: 0 0 8px; }
.page-heading h1 { font-size: 29px; line-height: 1.12; letter-spacing: -.035em; margin: 0; }
.page-heading p:not(.eyebrow) { max-width: 760px; color: var(--muted); font-size: 12px; line-height: 1.5; margin: 8px 0 0; }
.button-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.button {
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 9px 13px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 720;
  cursor: pointer;
  transition: .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--brand); color: white; box-shadow: 0 4px 10px rgba(80,101,229,.18); }
.button.primary:hover { background: var(--brand-strong); }
.button.secondary { background: #fff; border-color: var(--line-strong); color: #3a475f; }
.button.secondary:hover { background: #f8f9fc; border-color: #aeb9d5; }
.button.danger { background: #fff; border-color: #e6b8bf; color: #a13f4d; }
.button.danger:hover { background: #fff3f4; border-color: #d88b96; color: #8f2636; }
.button.small { padding: 7px 10px; font-size: 10px; }
.button.wide { width: 100%; margin-top: 10px; }
.upload-label input { display: none; }
.badge { border-radius: 999px; padding: 5px 9px; font-size: 10px; font-weight: 750; }
.badge.neutral { background: #2b354a; color: #dce2ef; }
.badge.success { background: #153f34; color: #8be0bd; }
.badge.danger { background: #4c2027; color: #ffb5bd; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; margin-bottom: 14px; }
.metric-card {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 15px;
  box-shadow: var(--shadow-soft);
}
.metric-card::after { content: ""; position: absolute; width: 48px; height: 48px; right: -14px; bottom: -23px; border-radius: 50%; background: var(--brand-soft); }
.metric-card span { position: relative; z-index: 1; display: block; color: var(--muted); font-size: 10px; }
.metric-card strong { position: relative; z-index: 1; display: block; margin-top: 6px; color: var(--ink); font-size: 20px; letter-spacing: -.03em; }
.two-column, .model-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.span-2 { grid-column: span 2; }
.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 17px;
  box-shadow: var(--shadow-soft);
}
.panel h2 { color: #202b42; font-size: 14px; letter-spacing: -.01em; margin: 0 0 13px; }
.panel h3 { color: #36445f; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 12px; }
.panel-heading h2 { margin: 0; }
.panel-heading p { color: var(--muted); font-size: 10px; line-height: 1.35; margin: 4px 0 0; }
.table-wrap { overflow: auto; max-height: 470px; border: 1px solid var(--line); border-radius: 8px; }
.empty-state { display: grid; place-items: center; min-height: 160px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 10px; }
th { position: sticky; top: 0; z-index: 1; background: #f4f6fa; color: #5b667b; font-weight: 780; text-align: left; }
th, td { padding: 8px 10px; border-bottom: 1px solid #edf0f4; white-space: nowrap; }
tr:hover td { background: #fafbfe; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.form-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid label, .login-dialog label { color: #566075; font-size: 10px; font-weight: 750; }
.form-grid input, .form-grid textarea, .form-grid select,
textarea, input, select {
  width: 100%;
  border: 1px solid #d4dbe7;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 9px;
  margin-top: 5px;
  outline: none;
  transition: .15s ease;
}
.form-grid input:focus, .form-grid textarea:focus, .form-grid select:focus,
textarea:focus, input:focus, select:focus { border-color: #8190e8; box-shadow: 0 0 0 3px rgba(80,101,229,.1); }
.helper { color: var(--muted); background: #f5f7fb; border-radius: 7px; padding: 10px; margin-top: 12px; font-size: 10px; line-height: 1.45; }
.code-output, .editor {
  font-family: "SFMono-Regular", Consolas, monospace;
  background: #111827;
  color: #d9e0ee;
  border: 0;
  border-radius: 8px;
  padding: 14px;
  white-space: pre-wrap;
  overflow: auto;
}
.code-output { min-height: 220px; margin: 0; }
.editor { min-height: 275px; resize: vertical; }
.result-box { border: 1px solid var(--line); border-radius: 8px; padding: 12px; max-height: 420px; overflow: auto; font-size: 11px; }
.muted { color: var(--muted); }
.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.result-stat { border: 1px solid var(--line); border-radius: 7px; padding: 10px; }
.result-stat span { display: block; color: var(--muted); font-size: 9px; }
.result-stat strong { display: block; margin-top: 4px; font-size: 15px; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.chip { border: 1px solid #dce1eb; background: #fff; color: #526079; border-radius: 999px; padding: 5px 8px; font-size: 9px; cursor: pointer; }
.chip.active { border-color: #aebaff; background: var(--brand-soft); color: #2445c7; }
.plan-output { display: flex; flex-direction: column; gap: 9px; }
.plan-step { border: 1px solid var(--line); border-radius: 9px; padding: 12px; }
.plan-step-head { display: flex; justify-content: space-between; gap: 10px; }
.plan-step code { color: #526079; font-size: 10px; }
.timeline { display: flex; flex-direction: column; }
.timeline-item { display: grid; grid-template-columns: 150px 180px 1fr; gap: 16px; padding: 11px 4px; border-bottom: 1px solid var(--line); font-size: 10px; }
.timeline-item code { white-space: pre-wrap; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat-grid > div { border: 1px solid var(--line); border-radius: 7px; padding: 10px; }
.stat-grid span, .stat-grid strong { display: block; }
.stat-grid span { color: var(--muted); font-size: 9px; }
.stat-grid strong { margin-top: 4px; font-size: 11px; }

/* Workbook window */
.main:has(#tab-workbook.active) { padding: 14px 16px 24px; }
#tab-workbook { max-width: none; }
.workbook-panel { padding: 0; overflow: hidden; border-radius: 7px; box-shadow: 0 4px 18px rgba(29,42,71,.1); }
.sheet-regression-panel { margin-top: 10px; padding: 12px; }
.workbook-toolbar {
  display: block;
  padding: 0;
  border-bottom: 1px solid #d6ddea;
  background: #f3f5f9;
}
.workbook-ribbon-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 29px;
  padding: 0 9px;
  border-bottom: 1px solid #d8deea;
  background: #e8ecf3;
}
.workbook-ribbon-tab {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-bottom: 2px solid transparent;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  background: transparent;
  color: #69758a;
  cursor: pointer;
  font-size: 10px;
  font-weight: 760;
}
.workbook-ribbon-tab:hover { color: #2f43a8; background: #f1f4fb; }
.workbook-ribbon-tab.active { border-bottom-color: var(--brand); color: #2f43a8; background: #f3f5f9; }
.workbook-ribbon-hint { margin-left: auto; color: #8994a7; font-size: 9px; white-space: nowrap; }
.workbook-ribbon-body {
  display: flex;
  align-items: stretch;
  min-height: 63px;
  overflow-x: auto;
  padding: 4px 7px 0;
  background: linear-gradient(#f7f8fb, #edf1f6);
}
.ribbon-group {
  display: flex;
  flex: 0 0 auto;
  min-width: 0;
  flex-direction: column;
  justify-content: space-between;
  padding: 0 9px 4px;
  border-right: 1px solid #d9deea;
}
.ribbon-group-wide { flex: 1 1 auto; }
.ribbon-group-tools { display: flex; align-items: center; gap: 2px; min-height: 45px; }
.ribbon-group-label { display: block; color: #8a94a6; font-size: 8px; text-align: center; }
.ribbon-command, .icon-tool, .format-tool, .add-sheet {
  min-width: 37px;
  height: 43px;
  border: 1px solid #d0d8e5;
  border-radius: 4px;
  background: #fff;
  color: #3f4b60;
  cursor: pointer;
  font-size: 11px;
}
.ribbon-command { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 2px 4px; }
.ribbon-command:hover, .icon-tool:hover, .format-tool:hover, .add-sheet:hover { border-color: #9eabd0; background: #eef1fb; }
.ribbon-command > span:last-child { color: #718096; font-size: 8px; line-height: 1; }
.ribbon-icon { display: block; color: #33415c; font-size: 16px; line-height: 1; }
.ribbon-select-wrap { display: inline-flex; flex-direction: column; justify-content: center; gap: 2px; height: 43px; padding: 0 3px; color: #718096; font-size: 8px; }
.toolbar-select { width: 66px; height: 22px; margin: 0; padding: 2px 4px; border-radius: 4px; font-size: 9px; }
.ribbon-shortcuts { align-items: flex-start; flex-wrap: wrap; align-content: center; gap: 4px 13px; color: #718096; font-size: 9px; }
.ribbon-shortcuts span { white-space: nowrap; }
.ribbon-shortcuts kbd { padding: 2px 4px; border: 1px solid #cbd4e2; border-radius: 3px; background: #fff; color: #4d5a70; font: 800 8px ui-monospace, SFMono-Regular, Menlo, monospace; }
.ribbon-mini-command { height: 23px; padding: 2px 6px; border: 1px solid #cbd4e2; border-radius: 4px; background: #fff; color: #4c5b73; cursor: pointer; font-size: 8px; white-space: nowrap; }
.ribbon-mini-command:hover { border-color: #9eabd0; background: #eef1fb; color: #2f43a8; }
.workbook-formula-row { display: flex; align-items: center; gap: 7px; min-height: 37px; padding: 5px 8px; border-top: 1px solid #d9deea; background: #fff; }
.workbook-name-box { display: flex; align-items: center; justify-content: space-between; width: 92px; height: 26px; padding: 0 7px 0 9px; border: 1px solid #cbd4e1; border-radius: 4px; background: #fff; color: #3b4961; font: 800 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.name-box-chevron { color: #8590a2; font: 13px system-ui, sans-serif; }
.formula-fx { width: 20px; color: #79859a; font: italic 700 13px Georgia, serif; text-align: center; }
.formula-bar { flex: 1; height: 26px; min-width: 0; margin: 0; padding: 4px 8px; border-radius: 4px; font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.workbook-status { min-width: 116px; color: #7b879a; font-size: 9px; text-align: right; white-space: nowrap; }
.workbook-find-bar { display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 5px 8px; border-bottom: 1px solid #d9deea; background: #f8f9fc; }
.find-label { color: #69758a; font-size: 9px; font-weight: 800; }
.workbook-find-bar input { width: min(320px, 42vw); height: 25px; margin: 0; padding: 4px 7px; border-radius: 4px; font-size: 10px; }
.find-command { width: 25px; height: 25px; border: 1px solid #cbd4e2; border-radius: 4px; background: #fff; color: #58667d; cursor: pointer; font-size: 11px; line-height: 1; }
.find-command:hover { border-color: #9eabd0; background: #eef1fb; }
.find-results { color: #8792a4; font-size: 9px; }
.workbook-filter-menu { display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 5px 8px; border-bottom: 1px solid #d9deea; background: #fffdf4; }
.workbook-filter-menu input { width: min(240px, 35vw); height: 25px; margin: 0; padding: 4px 7px; border-radius: 4px; font-size: 10px; }
.column-filter { float: right; width: 16px; height: 16px; margin: 0 2px; padding: 0; border: 0; border-radius: 3px; background: transparent; color: #728098; cursor: pointer; font-size: 10px; line-height: 1; }
.column-filter:hover, .column-filter.active { background: #dfe6ff; color: var(--brand-strong); }
.workbook-grid { overflow: auto; max-height: 620px; background: #fff; }
.main:has(#tab-workbook.active) .workbook-grid { max-height: calc(100vh - 270px); min-height: 390px; }
.sheet-table { min-width: 1100px; border-collapse: separate; border-spacing: 0; zoom: var(--sheet-zoom, 1); }
.sheet-table th, .sheet-table td { padding: 0; border-right: 1px solid #e0e5ec; border-bottom: 1px solid #e0e5ec; }
.sheet-table .grid-spacer td { height: auto; padding: 0; border: 0; background: transparent; }
.sheet-table thead th { position: sticky; top: 0; height: 25px; min-width: 96px; z-index: 3; background: #edf1f6; color: #56647b; font-size: 9px; text-align: center; }
.sheet-table thead th.corner { left: 0; min-width: 44px; z-index: 4; }
.sheet-table tbody th { position: sticky; left: 0; z-index: 2; min-width: 44px; background: #f6f8fb; color: #697386; font-size: 10px; text-align: center; }
.sheet-table td { height: 29px; }
.workbook-cell { display: block; width: 100%; height: 29px; overflow: hidden; border: 2px solid transparent !important; border-radius: 0 !important; margin: 0 !important; padding: 5px 6px !important; background: #fff !important; box-shadow: none !important; color: var(--ink); font-size: 10px; line-height: 15px; text-align: left; text-overflow: ellipsis; white-space: nowrap; user-select: none; cursor: cell; }
.workbook-cell.selected { position: relative; z-index: 1; border-color: var(--brand) !important; }
.workbook-cell.range-selected { background: #eef2ff !important; }
.workbook-cell.editing { background: #fff9e8 !important; }
.fill-handle { position: absolute; right: -4px; bottom: -4px; z-index: 3; width: 7px; height: 7px; border: 1px solid #fff; background: var(--brand); cursor: crosshair; }
.workbook-cell-editor { display: block; width: calc(100% + 2px); height: 25px; margin: -3px -1px; padding: 3px 5px; border: 0; border-radius: 0; outline: none; background: #fffdf1; color: var(--ink); font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 18px; }
.workbook-cell-editor:focus { box-shadow: none; }
.sheet-bar { display: flex; align-items: center; gap: 5px; padding: 4px 7px; border-top: 1px solid var(--line); background: #e9edf3; }
.sheet-nav-buttons { display: flex; align-items: center; gap: 1px; padding-right: 5px; border-right: 1px solid #d4dbe6; }
.sheet-nav { width: 22px; height: 22px; border: 0; border-radius: 3px; background: transparent; color: #65728a; cursor: pointer; font-size: 16px; line-height: 1; }
.sheet-nav:hover { background: #fff; color: var(--brand-strong); }
.sheet-tabs { display: flex; gap: 4px; overflow: auto; }
.sheet-tab { border: 0; border-radius: 4px; background: transparent; color: #536074; padding: 6px 11px; cursor: pointer; font-size: 10px; white-space: nowrap; }
.sheet-tab.active { background: #fff; color: var(--brand); box-shadow: 0 1px 4px rgba(0,0,0,.09); font-weight: 760; }
.workbook-statusbar { display: flex; align-items: center; justify-content: space-between; min-height: 25px; padding: 3px 8px; border-top: 1px solid #d5dce7; background: #f0f3f7; color: #7c8798; font-size: 9px; }
.workbook-zoom { display: flex; align-items: center; gap: 7px; }
.workbook-zoom input { width: 100px; height: 14px; margin: 0; padding: 0; accent-color: var(--brand); }

/* Workspace layout modes */
.main[data-layout="grid"] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; height: calc(100vh - 126px); overflow: auto; padding: 22px 26px 40px; }
.main[data-layout="grid"] .tab[data-window-open="true"] { display: block; max-width: none; margin: 0; padding: 0 16px 16px; border: 1px solid var(--line); border-radius: 12px; background: #f8faff; box-shadow: var(--shadow-soft); animation: none; }
.main[data-layout="grid"] .tab[data-window-open="false"] { display: none; }
.main[data-layout="grid"] .window-chrome { display: flex; }
.main[data-layout="grid"] .window-layout-hint { display: none; }
.main[data-layout="grid"] .page-heading { align-items: flex-start; flex-direction: column; gap: 12px; padding-top: 3px; }
.main[data-layout="grid"] .page-heading h1 { font-size: 22px; }
.main[data-layout="grid"] .page-heading p:not(.eyebrow) { font-size: 11px; }

.main[data-layout="windowed"] { position: relative; height: calc(100vh - 126px); min-height: 680px; overflow: auto; padding: 20px; }
.main[data-layout="windowed"] .tab[data-window-open="true"] { display: block; position: absolute; width: 650px; height: 510px; min-width: 430px; min-height: 300px; max-width: none; margin: 0; padding: 0 16px 16px; overflow: auto; resize: both; border: 1px solid #cbd5e5; border-radius: 12px; background: #f8faff; box-shadow: 0 18px 40px rgba(20,35,66,.17); animation: none; }
.main[data-layout="windowed"] .tab[data-window-open="false"] { display: none; }
.main[data-layout="windowed"] .window-chrome { display: flex; position: sticky; top: 0; z-index: 2; margin-left: -16px; margin-right: -16px; cursor: grab; }
.main[data-layout="windowed"] .window-chrome:active { cursor: grabbing; }
.main[data-layout="windowed"] .page-heading { padding-top: 3px; }

/* Markdown notes window --------------------------------------------------- */
.notes-shell { display: grid; grid-template-columns: minmax(185px, .24fr) minmax(320px, .9fr) minmax(360px, 1.1fr); gap: 16px; align-items: stretch; }
.notes-list-panel, .notes-editor-panel, .notes-preview-panel { min-width: 0; overflow: hidden; }
.notes-list-panel { display: flex; min-height: 600px; flex-direction: column; padding: 17px; background: linear-gradient(180deg, #fff 0%, #fbfcff 100%); }
.notes-list-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding-bottom: 13px; border-bottom: 1px solid #e2e7ef; }
.notes-list-heading .eyebrow { margin-bottom: 4px; }
.notes-list-heading h2 { margin: 0; color: #2d3a56; font-size: 15px; }
.notes-list { display: flex; flex: 1 1 auto; flex-direction: column; gap: 6px; margin-top: 12px; overflow: auto; }
.notes-list-item { display: flex; width: 100%; align-items: center; gap: 9px; min-height: 46px; padding: 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #536079; cursor: pointer; text-align: left; transition: border-color .15s ease, background .15s ease, color .15s ease; }
.notes-list-item:hover { background: #f2f5fb; color: var(--brand-strong); }
.notes-list-item.active { border-color: #bcc9f2; background: linear-gradient(135deg, #f0f3ff, #e9eeff); color: #2b3e91; box-shadow: 0 2px 7px rgba(61,75,194,.08); }
.notes-list-item-icon { display: grid; width: 25px; height: 25px; flex: 0 0 25px; place-items: center; border-radius: 6px; background: #e3e8f7; color: #6472b2; font: 700 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.notes-list-item-copy { min-width: 0; }
.notes-list-item-copy strong, .notes-list-item-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notes-list-item-copy strong { font-size: 10px; line-height: 1.25; }
.notes-list-item-copy small { margin-top: 3px; color: #8f99aa; font-size: 8px; }
.notes-list-help { margin: 12px 0 0; padding: 11px 2px 0; border-top: 1px solid #e2e7ef; color: #8b95a7; font-size: 9px; line-height: 1.5; }
.notes-editor-panel, .notes-preview-panel { display: flex; min-height: 600px; flex-direction: column; padding: 17px; }
.notes-editor-panel .panel-heading, .notes-preview-panel .panel-heading { flex: 0 0 auto; }
.notes-title-label { display: block; color: #566075; font-size: 10px; font-weight: 750; }
.notes-title-input { margin-top: 6px; padding: 9px 10px; border-color: #d2dbe8; font-size: 12px; font-weight: 700; }
.notes-toolbar { display: flex; align-items: center; gap: 5px; margin: 10px 0 8px; padding: 5px; border: 1px solid #dfe4ed; border-radius: 7px; background: #f7f9fc; overflow-x: auto; }
.notes-tool { min-height: 27px; padding: 3px 9px; border: 1px solid #d3dbe8; border-radius: 5px; background: #fff; color: #526079; cursor: pointer; font-size: 9px; font-weight: 700; white-space: nowrap; transition: border-color .15s ease, background .15s ease, color .15s ease; }
.notes-tool:hover { border-color: #a5b3dc; background: #eef2ff; color: var(--brand-strong); }
.notes-tool-strong { font-weight: 900; }
.notes-tool-em { font-style: italic; }
.notes-editor { flex: 1 1 auto; min-height: 420px; resize: none; border-color: #d9e0eb; border-radius: 8px; background: #fbfcff; color: #29354c; font: 12px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.notes-editor:focus { background: #fff; border-color: #9eacd8; box-shadow: 0 0 0 3px rgba(80,101,229,.09); }
.notes-editor-footer { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; color: #8c96a8; font-size: 8px; }

/* Python notebook workspace ------------------------------------------------ */
.notebook-shell { display: grid; grid-template-columns: minmax(220px, .25fr) minmax(0, 1fr); gap: 16px; min-height: 620px; align-items: stretch; }
.notebook-sidebar, .notebook-editor-panel { min-width: 0; padding: 17px; }
.notebook-sidebar { display: flex; flex-direction: column; background: linear-gradient(180deg, #fff, #fbfcff); }
.notebook-sidebar label { margin-top: 12px; }
.notebook-list { display: flex; flex: 1; flex-direction: column; gap: 6px; margin-top: 14px; overflow: auto; }
.notebook-list-item { display: flex; width: 100%; flex-direction: column; gap: 3px; padding: 10px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #536079; cursor: pointer; text-align: left; }
.notebook-list-item:hover { background: #f2f5fb; color: var(--brand-strong); }
.notebook-list-item.active { border-color: #b7c5f5; background: #edf1ff; color: #2b3e91; }
.notebook-list-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.notebook-list-item small { color: #8b95a7; font-size: 9px; }
.notebook-editor-panel { display: flex; flex-direction: column; background: #f7f9fd; }
.notebook-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.notebook-cells { display: flex; flex-direction: column; gap: 12px; min-height: 500px; }
.notebook-cell { display: grid; grid-template-columns: 42px minmax(0, 1fr); border: 1px solid #dce3ee; border-radius: 10px; background: #fff; box-shadow: 0 3px 12px rgba(33, 48, 83, .05); overflow: hidden; }
.notebook-cell.is-error { border-color: #e6a3a3; }
.notebook-cell-gutter { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 13px 4px; border-right: 1px solid #edf0f5; background: #f6f8fc; color: #76829a; font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.notebook-cell-type { color: #6572b2; font-weight: 700; }
.notebook-cell-body { min-width: 0; padding: 8px 10px 11px; }
.notebook-cell-toolbar { display: flex; align-items: center; justify-content: space-between; min-height: 24px; }
.notebook-cell-actions { display: inline-flex; gap: 2px; }
.notebook-cell-actions button { border: 0; padding: 4px 6px; border-radius: 5px; background: transparent; color: #7b879b; cursor: pointer; font-size: 10px; }
.notebook-cell-actions button:hover { background: #edf1f8; color: #2f438f; }
.notebook-cell-editor { display: block; width: 100%; min-height: 74px; margin-top: 5px; padding: 10px; resize: vertical; border: 1px solid #e0e5ee; border-radius: 7px; background: #fbfcff; color: #202b41; font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; box-sizing: border-box; }
.notebook-cell-editor:focus { border-color: #9caae2; background: #fff; box-shadow: 0 0 0 3px rgba(80, 101, 229, .08); outline: 0; }
.notebook-cell-output { margin-top: 8px; overflow: auto; }
.notebook-output-text, .notebook-error { margin: 5px 0 0; padding: 8px; border-radius: 6px; background: #f4f6fa; color: #4a5770; font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; }
.notebook-error { background: #fff1f1; color: #a23b3b; }
.notebook-output-image { display: block; max-width: min(100%, 620px); max-height: 360px; margin-top: 7px; border: 1px solid #e1e5ed; border-radius: 6px; }
.notebook-table-wrap { margin-top: 7px; overflow: auto; border: 1px solid #e0e5ee; border-radius: 6px; }
.notebook-table-wrap table { width: 100%; border-collapse: collapse; font-size: 10px; }
.notebook-table-wrap th, .notebook-table-wrap td { padding: 6px 8px; border-bottom: 1px solid #edf0f5; text-align: left; white-space: nowrap; }
.notebook-table-wrap th { background: #f3f6fb; color: #5d6a82; font-weight: 700; }
.notebook-table-wrap small { display: block; padding: 5px 8px; color: #8b95a7; }
@media (max-width: 850px) { .notebook-shell { grid-template-columns: 1fr; } .notebook-sidebar { min-height: 210px; } .notebook-list { max-height: 150px; } }
.markdown-preview { flex: 1 1 auto; min-height: 420px; overflow: auto; padding-right: 3px; color: #3d4a61; font-size: 12px; line-height: 1.65; }
.markdown-preview h1, .markdown-preview h2, .markdown-preview h3, .markdown-preview h4, .markdown-preview h5, .markdown-preview h6 { color: #263553; line-height: 1.25; margin: 1.1em 0 .45em; }
.markdown-preview h1 { font-size: 22px; }
.markdown-preview h2 { font-size: 17px; }
.markdown-preview h3 { font-size: 14px; }
.markdown-preview p { margin: .7em 0; }
.markdown-preview ul, .markdown-preview ol { margin: .65em 0; padding-left: 22px; }
.markdown-preview li { margin: .25em 0; }
.markdown-preview a { color: var(--brand-strong); }
.markdown-preview blockquote { margin: .8em 0; padding: 5px 12px; border-left: 3px solid #9eabe0; background: #f3f5fc; color: #64708a; }
.markdown-preview hr { border: 0; border-top: 1px solid #dfe4ed; margin: 1.2em 0; }
.markdown-preview code { padding: 2px 4px; border-radius: 4px; background: #edf0f7; color: #4b5794; font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.markdown-preview pre { overflow: auto; margin: .85em 0; padding: 11px; border-radius: 7px; background: #182237; color: #dce4f4; }
.markdown-preview pre code { padding: 0; background: transparent; color: inherit; }
.markdown-visualization-embed { margin: 1.1em 0 1.35em; padding: 12px; border: 1px solid #dce3ee; border-radius: 9px; background: #fff; box-shadow: 0 3px 12px rgba(33, 48, 83, .06); }
.markdown-visualization-embed .structured-section { padding: 0; border: 0; box-shadow: none; }
.markdown-visualization-embed .analyst-viz-result { min-height: 230px; }
.markdown-table-wrap { width: 100%; overflow-x: auto; margin: 1em 0 1.25em; border: 1px solid #dce3ee; border-radius: 8px; background: #fff; }
.markdown-preview table { width: 100%; min-width: 520px; border-collapse: separate; border-spacing: 0; font-size: 10px; line-height: 1.45; }
.markdown-preview th, .markdown-preview td { padding: 8px 9px; border-right: 1px solid #e5e9f0; border-bottom: 1px solid #e5e9f0; vertical-align: top; text-align: left; }
.markdown-preview th:last-child, .markdown-preview td:last-child { border-right: 0; }
.markdown-preview tbody tr:last-child td { border-bottom: 0; }
.markdown-preview th { background: #f3f6fb; color: #384762; font-size: 9px; font-weight: 800; white-space: nowrap; }
.markdown-preview tbody tr:nth-child(even) td { background: #fbfcfe; }
.markdown-preview tbody tr:hover td { background: #f1f4ff; }
.markdown-task { display: inline-flex; align-items: center; gap: 6px; }
.markdown-task input { width: 12px; height: 12px; margin: 0; padding: 0; accent-color: var(--brand); }
.markdown-empty { color: #9aa4b5; font-style: italic; }

/* Notes get a spacious canvas when the workspace is in floating-window mode. */
.main[data-layout="windowed"] #tab-notes.tab[data-window-open="true"] { min-width: min(760px, calc(100vw - 40px)); }
.main[data-layout="windowed"] #tab-notes .notes-shell { min-height: 0; }
.main[data-layout="windowed"] #tab-notes .notes-list-panel,
.main[data-layout="windowed"] #tab-notes .notes-editor-panel,
.main[data-layout="windowed"] #tab-notes .notes-preview-panel { min-height: 0; }

/* AI workflow window */
.ai-workspace { display: grid; grid-template-columns: 240px minmax(520px,1fr) minmax(300px,380px); gap: 14px; align-items: start; }
.ai-workflow-list-panel, .ai-results-column { position: sticky; top: 143px; max-height: calc(100vh - 170px); overflow: auto; }
.ai-main-column { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ai-composer textarea { min-height: 112px; resize: vertical; }
.helper-inline { color: var(--muted); font-size: 10px; }
.workflow-list { display: flex; flex-direction: column; gap: 6px; }
.workflow-list-item { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 10px; text-align: left; cursor: pointer; }
.workflow-list-item:hover { border-color: #b7c2e9; background: #fafbff; }
.workflow-list-item.active { border-color: #7185e5; background: var(--brand-soft); }
.workflow-list-item strong, .workflow-list-item span, .workflow-list-item small { display: block; }
.workflow-list-item strong { font-size: 11px; }
.workflow-list-item span { color: #58657a; font-size: 9px; margin-top: 4px; }
.workflow-list-item small { color: #8992a3; font-size: 8px; margin-top: 5px; }
.workflow-conversation { display: flex; flex-direction: column; gap: 9px; max-height: 260px; overflow: auto; padding-right: 4px; }
.workflow-message { max-width: 88%; border-radius: 10px; padding: 10px 12px; }
.workflow-message.user { align-self: flex-end; background: #edf1ff; }
.workflow-message.assistant { align-self: flex-start; background: #f3f5f8; }
.workflow-message strong { font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.workflow-message p { font-size: 11px; margin: 5px 0; white-space: pre-wrap; }
.workflow-message span { color: #8992a3; font-size: 8px; }
.workflow-refine-row { display: flex; gap: 8px; margin-top: 12px; }
.workflow-refine-row input { margin: 0; }
.workflow-steps { display: flex; flex-direction: column; gap: 10px; }
.workflow-step { border: 1px solid var(--line); border-radius: 9px; background: #fff; padding: 13px; }
.workflow-step.selected { border-color: #7f91e8; box-shadow: 0 0 0 3px rgba(55,88,213,.08); }
.workflow-step-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.workflow-step-top > div { display: grid; grid-template-columns: 24px minmax(0,1fr); gap: 2px 7px; align-items: center; }
.step-number { grid-row: span 2; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--navy-2); color: white; font-size: 10px; font-weight: 800; }
.workflow-step-top strong { font-size: 11px; }
.workflow-step-top code { color: #68758a; font-size: 8px; }
.step-parameters { min-height: 98px; margin-top: 10px; background: #f8f9fc; font: 9px monospace; }
.step-parameters:disabled { background: #f1f3f7; color: #697386; }
.workflow-step-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; margin-top: 9px; }
.risk-label { margin-right: auto; font-size: 8px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.risk-low { color: #247255; } .risk-medium { color: #956812; } .risk-high { color: #a63c45; }
.step-summary { color: #435168; background: #f3f7ff; border-radius: 7px; padding: 8px; margin: 9px 0 0; font-size: 10px; }
.step-error { color: #a72f3c; background: #fff0f1; border-radius: 7px; padding: 8px; margin: 9px 0 0; font-size: 10px; }
.executive-summary { font-weight: 650; line-height: 1.55; }
.ai-results-column h3 { font-size: 10px; margin: 14px 0 7px; }
.ai-results-column ul { padding-left: 18px; font-size: 10px; }
.report-links { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.report-links a { text-decoration: none; }
.result-heading { margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--line); }
.step-result-heading strong, .step-result-heading span { display: block; }
.step-result-heading span { color: var(--muted); font-size: 9px; margin-top: 4px; }
.ai-results-column pre { max-height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.workflow-step .badge { white-space: nowrap; }

/* Bounded research agent ---------------------------------------------------- */
.research-agent-panel { margin-bottom: 14px; }
.research-agent-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); gap: 14px; }
.research-agent-grid label { display: block; }
.research-agent-grid textarea { min-height: 96px; resize: vertical; }
.research-agent-grid .helper-text { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.research-agent-actions { justify-content: flex-start; margin-top: 12px; }
.research-agent-status { min-height: 32px; margin-top: 12px; padding: 9px 10px; border-radius: 7px; background: #f6f8fc; font-size: 10px; }
.research-agent-status.success { color: var(--success); background: #edf9f3; }
.research-agent-status.error { color: var(--danger); background: #fff0f1; }
.research-agent-output-grid { display: grid; grid-template-columns: minmax(260px, .85fr) minmax(0, 1.15fr); gap: 14px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.compact-heading { margin: 0; padding: 0; border: 0; }
.compact-heading h3 { margin: 0; font-size: 11px; }
.compact-heading p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.research-agent-steps { display: flex; flex-direction: column; gap: 6px; max-height: 245px; overflow: auto; }
.research-agent-step { border-left: 3px solid #7d8ee5; border-radius: 0 7px 7px 0; padding: 7px 9px; background: #f7f9fd; font-size: 10px; }
.research-agent-step.failed { border-left-color: var(--danger); background: #fff4f5; }
.research-agent-step strong, .research-agent-step span, .research-agent-step small { display: block; }
.research-agent-step span { margin-top: 3px; color: #56647a; }
.research-agent-step small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.research-agent-report { min-height: 150px; max-height: 620px; overflow: auto; line-height: 1.55; }
.research-agent-report h1, .research-agent-report h2, .research-agent-report h3 { color: #263553; }
.research-agent-report table { width: 100%; border-collapse: collapse; font-size: 9px; }
.research-agent-report th, .research-agent-report td { padding: 5px 6px; border: 1px solid var(--line); text-align: left; }
.research-agent-report th { background: #f4f6fa; }
.research-agent-artifacts-section { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.research-agent-artifacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px; }
.research-agent-artifact { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; background: #f8faff; }
.research-agent-artifact-copy { min-width: 0; }
.research-agent-artifact strong, .research-agent-artifact small { display: block; }
.research-agent-artifact strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #263553; font-size: 10px; }
.research-agent-artifact small { margin-top: 3px; color: var(--muted); font-size: 8px; }
@media (max-width: 900px) {
  .research-agent-grid, .research-agent-output-grid { grid-template-columns: 1fr; }
}

/* Conversation-first research workspace */
.research-agent-workspace { display: grid; grid-template-columns: 218px minmax(0, 1fr) 292px; min-height: 720px; margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.research-conversations, .research-artifact-panel { min-width: 0; background: #f8faff; }
.research-conversations { border-right: 1px solid var(--line); padding: 12px; }
.research-artifact-panel { border-left: 1px solid var(--line); padding: 12px; }
.research-pane-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.research-pane-heading h3, .research-chat-header h3 { margin: 0; color: #263553; font-size: 12px; }
.research-pane-heading p, .research-chat-header p { margin: 3px 0 0; color: var(--muted); font-size: 9px; line-height: 1.4; }
.research-conversations .reference-filter { margin: 0 0 10px; }
.research-conversation-list { display: flex; flex-direction: column; gap: 6px; max-height: 650px; overflow: auto; }
.research-conversation-item { display: block; width: 100%; padding: 9px 9px 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #30405e; text-align: left; cursor: pointer; }
.research-conversation-item:hover { background: #eef2ff; }
.research-conversation-item.active { border-color: #9eaff4; background: #edf1ff; box-shadow: 0 1px 4px rgba(45,65,150,.08); }
.research-conversation-item strong, .research-conversation-item span, .research-conversation-item small, .research-conversation-item time { display: block; overflow: hidden; text-overflow: ellipsis; }
.research-conversation-item strong { white-space: nowrap; color: #293755; font-size: 10px; }
.research-conversation-item span { margin-top: 4px; color: #53627d; font-size: 8px; text-transform: capitalize; }
.research-conversation-item small { margin-top: 4px; color: var(--muted); font-size: 8px; line-height: 1.3; }
.research-conversation-item .research-conversation-preview { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; text-overflow: ellipsis; white-space: normal; }
.research-conversation-item time { margin-top: 3px; color: var(--muted); font-size: 8px; line-height: 1.2; white-space: nowrap; }
.research-chat-column { display: flex; min-width: 0; flex-direction: column; background: #fff; }
.research-chat-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 13px 15px; border-bottom: 1px solid var(--line); }
.research-chat-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px; flex-wrap: wrap; }
.research-chat-header-actions .research-agent-status { margin: 0; min-height: 0; padding: 6px 8px; white-space: nowrap; }
.research-live-progress { margin: 10px 16px 0; padding: 9px 10px; border: 1px solid #dce2ef; border-radius: 9px; background: #f8faff; }
.research-live-progress-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.research-live-progress-heading strong { color: #344568; font-size: 9px; }
.research-live-progress-heading span { color: var(--muted); font-size: 8px; }
.research-live-progress-list { display: flex; flex-direction: column; gap: 5px; max-height: 210px; overflow: auto; }
.research-live-progress-item { display: flex; align-items: flex-start; gap: 7px; padding: 5px 6px; border-radius: 6px; background: #fff; }
.research-live-progress-item.warning { background: #fffdf5; }
.research-live-progress-item.error { background: #fff4f5; }
.research-live-progress-icon { display: grid; width: 16px; height: 16px; flex: 0 0 16px; place-items: center; border-radius: 50%; background: #e8edff; color: #4d63c0; font-size: 8px; font-weight: 800; }
.research-live-progress-item.error .research-live-progress-icon { background: #ffe2e4; color: #b34a54; }
.research-live-progress-item > div { min-width: 0; }
.research-live-progress-item strong, .research-live-progress-item span, .research-live-progress-item small { display: block; overflow: hidden; text-overflow: ellipsis; }
.research-live-progress-item strong { color: #344568; font-size: 8px; }
.research-live-progress-item span { margin-top: 2px; color: #54627d; font-size: 8px; white-space: nowrap; }
.research-live-progress-item small { margin-top: 2px; color: var(--muted); font-size: 7px; }
.research-log-panel { display: flex; min-height: 0; flex: 1 1 auto; flex-direction: column; gap: 10px; }
.research-artifact-panel-content .research-live-progress { flex: 0 0 auto; margin: 0; padding: 0 0 10px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.research-artifact-panel-content .research-live-progress-list { max-height: 180px; }
.research-log-history { display: flex; min-height: 0; flex: 1 1 auto; flex-direction: column; gap: 6px; }
.research-log-history-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: #344568; font-size: 9px; }
.research-log-history-heading span { color: var(--muted); font-size: 8px; }
.research-log-history-list { display: flex; min-height: 0; flex: 1 1 auto; flex-direction: column; gap: 7px; overflow-x: hidden; overflow-y: auto; padding: 1px 2px 2px 0; }
.research-chat-timeline { display: flex; flex: 1; min-height: 260px; max-height: 690px; flex-direction: column; gap: 10px; overflow: auto; padding: 16px; background: #fbfcfe; }
.research-chat-message { max-width: 86%; padding: 10px 12px; border-radius: 10px; line-height: 1.5; }
.research-chat-message.user { align-self: flex-end; background: #edf1ff; color: #28365a; }
.research-chat-message.assistant { align-self: flex-start; background: #f1f4f8; color: #263553; }
.research-chat-message-label { margin-bottom: 4px; color: #61708b; font-size: 8px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.research-chat-message-body { font-size: 10px; overflow-wrap: anywhere; }
.research-chat-message-body p { margin: 0 0 7px; }
.research-chat-message-body p:last-child { margin-bottom: 0; }
.research-chat-message-body h1, .research-chat-message-body h2, .research-chat-message-body h3 { margin: 9px 0 4px; font-size: 12px; }
.research-chat-message-body ul, .research-chat-message-body ol { padding-left: 18px; }
.research-chat-message small, .research-chat-tool small { display: block; margin-top: 6px; color: var(--muted); font-size: 8px; }
.research-chat-tool { border-left: 3px solid #8194e9; border-radius: 0 8px 8px 0; padding: 9px 11px; background: #f5f7fc; }
.research-chat-tool.failed { border-left-color: var(--danger); background: #fff3f4; }
.research-chat-tool-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.research-chat-tool-heading strong { color: #35466b; font-size: 10px; }
.research-chat-tool p { margin: 5px 0 0; color: #52617a; font-size: 9px; }
.research-chat-tool details { margin-top: 7px; }
.research-chat-tool summary { color: #536cba; cursor: pointer; font-size: 8px; }
.research-chat-tool pre { max-height: 230px; overflow: auto; margin: 6px 0 0; padding: 8px; border-radius: 6px; background: #1c2434; color: #dce4f7; font: 8px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.research-chat-composer { padding: 13px 15px 15px; border-top: 1px solid var(--line); background: #fff; }
.research-chat-composer > label { display: block; }
.research-chat-composer textarea { min-height: 68px; resize: vertical; }
.research-composer-options { display: grid; grid-template-columns: 1.2fr 1.2fr repeat(3, .75fr); gap: 7px; margin-top: 8px; }
.research-composer-options label { min-width: 0; }
.research-composer-options input, .research-composer-options select { min-width: 0; }
.research-advanced-options { margin-top: 9px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fafbfe; }
.research-advanced-options summary { color: #536cba; cursor: pointer; font-size: 9px; font-weight: 750; }
.research-advanced-options label { display: block; margin-top: 8px; }
.research-advanced-options .helper-text { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; }
.research-artifact-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; margin-bottom: 10px; padding: 3px; border-radius: 7px; background: #edf1f8; }
.research-artifact-tab { border: 0; border-radius: 5px; background: transparent; color: #6d7890; padding: 6px 3px; cursor: pointer; font-size: 8px; font-weight: 750; }
.research-artifact-tab.active { background: #fff; color: #3d4da7; box-shadow: 0 1px 3px rgba(28,39,67,.1); }
.research-artifact-panel-content { display: flex; min-height: 130px; max-height: 620px; flex-direction: column; gap: 7px; overflow: auto; }
.research-file-card { padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.research-file-card > div:first-child { min-width: 0; }
.research-file-card strong, .research-file-card small { display: block; overflow: hidden; text-overflow: ellipsis; }
.research-file-card strong { color: #2e3e5d; font-size: 9px; white-space: nowrap; }
.research-file-card small { margin-top: 3px; color: var(--muted); font-size: 8px; line-height: 1.35; }
.research-file-card .button { margin-top: 8px; }
.research-report-preview { max-height: 230px; overflow: auto; margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--line); color: #40506b; font-size: 9px; line-height: 1.45; }
.research-report-preview h1, .research-report-preview h2, .research-report-preview h3 { margin: 8px 0 4px; font-size: 11px; }
.research-report-preview table { width: 100%; border-collapse: collapse; font-size: 8px; }
.research-report-preview th, .research-report-preview td { padding: 4px; border: 1px solid var(--line); text-align: left; }
.research-report-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.research-report-actions a { text-decoration: none; }
.research-visualization-card { overflow: hidden; }
.research-visualization-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.research-visualization-card-heading > div { min-width: 0; }
.research-visualization-preview { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.research-visualization-preview .structured-section { padding: 0; border: 0; box-shadow: none; }
.research-visualization-preview .analyst-viz-result { min-height: 180px; }
.research-file-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.research-source-link { display: block; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #3f55b2; text-decoration: none; }
.research-source-link strong, .research-source-link small { display: block; overflow: hidden; text-overflow: ellipsis; }
.research-source-link strong { font-size: 9px; white-space: nowrap; }
.research-source-link small { margin-top: 4px; color: var(--muted); font-size: 8px; line-height: 1.3; overflow-wrap: anywhere; }
@media (max-width: 1150px) {
  .research-agent-workspace { grid-template-columns: 190px minmax(0, 1fr); }
  .research-artifact-panel { grid-column: 1 / -1; border-top: 1px solid var(--line); border-left: 0; }
  .research-artifact-panel-content { max-height: 280px; }
}
@media (max-width: 760px) {
  .research-agent-workspace { display: block; }
  .research-conversations, .research-artifact-panel { border: 0; }
  .research-conversations { border-bottom: 1px solid var(--line); }
  .research-artifact-panel { border-top: 1px solid var(--line); }
  .research-conversation-list { max-height: 210px; }
  .research-chat-header { display: block; }
  .research-chat-header-actions { justify-content: flex-start; margin-top: 8px; }
  .research-composer-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Operations and history */
.team-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.admin-filter-tabs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: -4px 0 16px; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: #f7f9fc; }
.admin-filter { border: 0; border-radius: 6px; background: transparent; color: #6d7890; padding: 8px 10px; cursor: pointer; font-size: 10px; font-weight: 750; }
.admin-filter:hover { background: #edf1fb; color: #3e4da7; }
.admin-filter.active { background: #fff; color: var(--brand-strong); box-shadow: 0 1px 4px rgba(28,39,67,.1); }
.team-grid .admin-panel-hidden { display: none; }
.version-grid { display: grid; grid-template-columns: minmax(210px,.8fr) minmax(270px,1fr) minmax(270px,1fr); gap: 14px; align-items: start; }
.compact-list { display: flex; flex-direction: column; gap: 7px; max-height: 310px; overflow: auto; margin-top: 12px; }
.compact-item { border: 1px solid var(--line); border-radius: 7px; background: #fafbfc; padding: 9px 10px; font-size: 10px; }
.compact-item strong, .compact-item span, .compact-item small { display: block; }
.compact-item span, .compact-item small { color: var(--muted); margin-top: 3px; }
.compact-item .button-row { margin-top: 7px; }
.storage-alert { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; padding: 11px 13px; border: 1px solid #e6c58e; border-radius: 8px; background: #fff9ed; color: #725226; font-size: 10px; }
.storage-alert strong { color: #65430e; white-space: nowrap; }
.storage-alert span { flex: 1 1 auto; }
.storage-file-item strong { color: #34415c; }
.storage-file-item .storage-protected { display: inline; margin-left: 5px; color: #8a6570; font-size: 8px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.mini-output { min-height: 112px; max-height: 230px; overflow: auto; border-radius: 7px; background: #111827; color: #dbe3f1; padding: 10px; white-space: pre-wrap; word-break: break-word; }
.compact-timeline { max-height: 250px; overflow: auto; margin-top: 14px; }
.compact-timeline .timeline-item { grid-template-columns: 140px 200px 1fr; padding: 8px 4px; }
.activity-stream { display: flex; flex-direction: column; gap: 7px; max-height: 420px; overflow: auto; }
.activity-item { border-left: 3px solid #7c8fe7; border-radius: 0 7px 7px 0; background: #f7f8fc; padding: 8px 10px; font-size: 10px; }
.activity-item strong, .activity-item span, .activity-item code { display: block; }
.activity-item span { color: var(--muted); font-size: 8px; margin-top: 3px; }
.activity-item code { color: #536074; margin-top: 4px; white-space: pre-wrap; }
.login-dialog { width: min(420px, calc(100vw - 32px)); border: 0; border-radius: 12px; padding: 0; box-shadow: 0 24px 70px rgba(19,28,48,.28); }
.login-dialog::backdrop { background: rgba(17,24,39,.46); }
.login-dialog form { padding: 22px; }
.login-dialog label { display: block; margin: 12px 0; }
.login-dialog .button-row { justify-content: flex-end; margin-top: 18px; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 50; background: #172033; color: white; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.2); padding: 11px 14px; font-size: 11px; opacity: 0; pointer-events: none; transform: translateY(10px); transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #a82f3b; }
canvas { display: block; width: 100%; max-width: 100%; }
pre { font-size: 10px; }
details { margin-top: 8px; }
summary { cursor: pointer; font-weight: 700; }

/* Responsive layouts */
@media (max-width: 1280px) {
  .topbar { grid-template-columns: minmax(190px, 1fr) auto; }
  .project-context { display: none; }
  .top-actions { grid-column: 2; }
  .layout-label { display: none; }
  .layout-option { padding: 6px; }
  .ai-workspace { grid-template-columns: 210px minmax(480px, 1fr); }
  .ai-results-column { grid-column: 2; position: static; max-height: none; }
  .ai-workflow-list-panel { grid-row: span 2; }
}

@media (min-width: 701px) {
  html, body { height: 100%; overflow: hidden; }
  .shell { min-height: 0; }
}

@media (max-width: 1080px) {
  .shell { grid-template-columns: 215px minmax(0,1fr); }
  .main { padding: 22px 20px 40px; }
  .workspace-strip-inner { padding: 0 18px; gap: 14px; }
  .window-label { display: none; }
  .workspace-strip-meta { display: none; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .version-grid { grid-template-columns: 1fr 1fr; }
  .version-grid > div:last-child { grid-column: span 2; }
  .main[data-layout="grid"] { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .two-column, .model-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .ai-workspace { grid-template-columns: 1fr; }
  .ai-workflow-list-panel, .ai-results-column { position: static; max-height: none; grid-column: auto; grid-row: auto; }
  .team-grid, .version-grid { grid-template-columns: 1fr; }
  .team-grid .span-2, .version-grid > div:last-child { grid-column: auto; }
}
@media (max-width: 700px) {
  .topbar { height: 62px; padding: 0 13px; }
  .brand strong { font-size: 13px; }
  .brand > div:last-child span { display: none; }
  .top-actions .badge, .top-actions #refreshButton { display: none; }
  .workspace-strip { top: 62px; height: 48px; }
  .workspace-tab { padding: 0 11px; font-size: 10px; }
  .workspace-tab .tab-icon { display: none; }
  .shell { display: block; min-height: calc(100vh - 110px); }
  .sidebar { position: static; height: auto; max-height: none; border-bottom: 1px solid #293650; padding: 14px 13px; }
  .sidebar-section.grow { flex: none; }
  .dataset-section { display: none; }
  .nav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px 5px; }
  .nav-section { display: contents; }
  .nav-section-label { display: none; }
  .sidebar-footer { display: none; }
  .main { padding: 17px 13px 30px; }
  .workbook-ribbon-tabs { overflow: hidden; }
  .workbook-ribbon-hint { display: none; }
  .workbook-ribbon-body { overflow-x: auto; }
  .ribbon-group-wide { min-width: 220px; }
  .workbook-status { display: none; }
  .workbook-statusbar { min-height: 23px; }
  .workbook-zoom input { width: 72px; }
  .main:has(#tab-workbook.active) .workbook-grid { max-height: calc(100vh - 315px); min-height: 330px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .form-grid, .form-grid.compact { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .timeline-item { grid-template-columns: 1fr; gap: 3px; }
  .workspace-strip-meta { display: none; }
  .layout-option b { display: none; }
  .main[data-layout="windowed"] { min-height: 560px; padding: 14px; }
  .main[data-layout="windowed"] .tab[data-window-open="true"] { min-width: min(430px, calc(100vw - 40px)); width: min(650px, calc(100vw - 40px)); }
}

/* Phase 19 — product convergence and contextual Analyst ------------------- */
body .nav-experiences {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}
body .nav-experiences .nav-experience {
  min-height: 46px;
  padding: 7px 9px;
  border: 1px solid transparent;
}
body .nav-experience > span:last-child { min-width: 0; }
body .nav-experience strong,
body .nav-experience small { display: block; }
body .nav-experience strong { color: inherit; font-size: 12px; font-weight: 750; }
body .nav-experience small { margin-top: 2px; color: #7785a1; font-size: 9px; font-weight: 520; }
body .nav-experience.active small { color: #aab5d1; }
body .sidebar-workbench-tools,
body .sidebar-advanced { margin: 0; border-top: 1px solid #2a3650; padding-top: 7px; }
body .sidebar-workbench-tools summary,
body .sidebar-advanced summary {
  margin: 0 7px 5px;
  color: #8794ae;
  cursor: pointer;
  font-size: 9px;
  font-weight: 750;
}
body .nav-modes,
body .nav-secondary,
body .sidebar-advanced .nav-section { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; }
body .nav-modes .nav-item,
body .nav-secondary .nav-item,
body .sidebar-advanced .nav-item { min-height: 28px; }
body .nav-secondary .nav-section-label { grid-column: 1 / -1; margin-top: 2px; }

.contextual-analyst {
  position: fixed;
  top: var(--workbench-chrome-height);
  right: 0;
  bottom: 0;
  z-index: 28;
  width: 334px;
  display: none;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  border-left: 1px solid #cbd4e1;
  background: #fbfcfe;
  box-shadow: -12px 0 32px rgba(22, 34, 58, .13);
}
.analyst-rail-open .contextual-analyst { display: grid; }
@media (min-width: 1101px) {
  .analyst-rail-open .shell { padding-right: 334px; }
  .analyst-rail-open .shell:not(.inspector-closed) .contextual-analyst { display: none; }
}
.analyst-rail-heading {
  min-height: 49px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px 8px 13px;
  border-bottom: 1px solid #dce2ec;
  background: #f2f5fa;
}
.analyst-rail-heading > div:first-child span,
.analyst-rail-heading > div:first-child strong { display: block; }
.analyst-rail-heading > div:first-child span,
.analyst-section-label,
.analyst-section-heading > span { color: #77849a; font-size: 8px; font-weight: 850; letter-spacing: .11em; }
.analyst-rail-heading > div:first-child strong { margin-top: 3px; color: #27334a; font-size: 12px; }
.analyst-rail-heading > div:last-child { display: flex; align-items: center; gap: 4px; }
.analyst-rail-body { min-height: 0; overflow: auto; padding: 12px; }
.analyst-context { padding: 11px; border: 1px solid #dfe5ef; border-radius: 10px; background: #fff; box-shadow: 0 2px 8px rgba(30, 44, 73, .04); }
.analyst-context-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.analyst-context-chips span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; padding: 4px 7px; border-radius: 999px; background: #eef1ff; color: #4859be; font-size: 9px; white-space: nowrap; }
.analyst-context p { margin: 8px 0 0; color: #788398; font-size: 10px; line-height: 1.45; }
.analyst-activity { margin-top: 14px; }
.analyst-section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.analyst-section-heading button { border: 0; background: transparent; color: #8290a5; cursor: pointer; font-size: 9px; }
.analyst-activity-list { display: grid; gap: 6px; }
.analyst-empty { display: grid; gap: 3px; padding: 18px 12px; border: 1px dashed #d8dfeb; border-radius: 9px; color: #8893a4; text-align: center; }
.analyst-empty strong { color: #526078; font-size: 11px; }
.analyst-empty span { font-size: 9px; }
.analyst-activity-item { position: relative; display: grid; grid-template-columns: 18px minmax(0,1fr) auto; gap: 7px; align-items: start; padding: 8px; border: 1px solid #e1e6ee; border-radius: 8px; background: #fff; }
.analyst-activity-icon { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; background: #e9edf7; color: #6573c9; font-size: 9px; }
.analyst-activity-item.running .analyst-activity-icon { animation: analystPulse 1.1s ease-in-out infinite; }
.analyst-activity-item.completed .analyst-activity-icon { background: #e3f6ed; color: #20845c; }
.analyst-activity-item.failed .analyst-activity-icon,
.analyst-activity-item.needs_repair .analyst-activity-icon { background: #fff0e3; color: #ad6320; }
.analyst-activity-copy strong,
.analyst-activity-copy span { display: block; }
.analyst-activity-copy strong { color: #354158; font-size: 10px; line-height: 1.3; }
.analyst-activity-copy span { margin-top: 2px; color: #8792a4; font-size: 8px; line-height: 1.35; }
.analyst-activity-status { color: #8590a2; font-size: 8px; text-transform: capitalize; }
.analyst-recovery { margin-top: 10px; padding: 10px; border: 1px solid #f1c7ca; border-radius: 8px; background: #fff5f5; color: #9f3540; font-size: 10px; line-height: 1.45; }
.analyst-recovery button { margin-top: 7px; }
.analyst-suggestions { display: flex; gap: 5px; padding: 7px 10px; overflow-x: auto; border-top: 1px solid #e0e5ed; background: #f7f9fc; }
.analyst-suggestions button { flex: 0 0 auto; padding: 5px 7px; border: 1px solid #d6ddea; border-radius: 999px; background: #fff; color: #57647d; cursor: pointer; font-size: 8px; }
.analyst-suggestions button:hover { border-color: #96a4d5; color: #3d50be; }
.analyst-composer { padding: 9px 10px 10px; border-top: 1px solid #dce2ec; background: #fff; }
.analyst-composer textarea { width: 100%; min-height: 64px; resize: none; padding: 8px; border: 1px solid #cfd8e6; border-radius: 8px; outline: 0; color: #29364e; font-size: 11px; line-height: 1.4; }
.analyst-composer textarea:focus { border-color: #7d8edf; box-shadow: 0 0 0 3px rgba(82, 103, 220, .1); }
.analyst-composer > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.analyst-composer > div span { color: #8b95a5; font-size: 8px; }
.analyst-rail-toggle { position: fixed; right: 14px; bottom: 16px; z-index: 27; width: 39px; height: 39px; display: grid; place-items: center; border: 0; border-radius: 50%; background: #4c5fd1; color: #fff; cursor: pointer; box-shadow: 0 9px 24px rgba(42, 61, 160, .35); }
.analyst-rail-open .analyst-rail-toggle { display: none; }
@keyframes analystPulse { 0%,100% { opacity: .55; transform: scale(.88); } 50% { opacity: 1; transform: scale(1); } }

/* One contract for analytical outputs: answer first, detail on demand. */
.result-card { overflow: hidden; border: 1px solid #dbe2ed; border-radius: 11px; background: #fff; box-shadow: 0 3px 12px rgba(25, 39, 68, .05); }
.result-card-answer { padding: 14px 15px; border-bottom: 1px solid #e5e9f0; background: linear-gradient(135deg, #fbfcff, #f1f4ff); }
.result-card-kicker { color: #5366ca; font-size: 8px; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
.result-card-answer h2 { margin: 5px 0 0; color: #25314a; font-size: 15px; line-height: 1.32; }
.result-card-answer p { margin: 6px 0 0; color: #637087; font-size: 10px; line-height: 1.5; }
.result-card-body { display: grid; gap: 10px; padding: 12px; }
.result-card-warnings { padding: 9px 10px; border-left: 3px solid #d2922d; border-radius: 6px; background: #fff8e9; color: #825b1e; font-size: 10px; }
.result-card-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.result-card-actions span { padding: 5px 7px; border-radius: 6px; background: #eef2ff; color: #4d5fc2; font-size: 9px; }
.result-card-provenance summary { color: #68758b; cursor: pointer; font-size: 9px; font-weight: 700; }
.result-card-provenance pre { max-height: 220px; overflow: auto; white-space: pre-wrap; }
.workflow-step.needs-repair { border-color: #e8b680; background: #fffaf4; }
.workflow-step .step-operation { width: 100%; margin-top: 6px; padding: 6px 7px; border: 1px solid #d7deea; border-radius: 6px; background: #fff; color: #3d4a61; font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }

@media (max-width: 1100px) {
  .contextual-analyst { width: min(350px, 92vw); }
}
@media (max-width: 700px) {
  .contextual-analyst { top: var(--app-topbar-height); width: min(360px, 96vw); }
  .analyst-rail-open .shell { padding-right: 0; }
}

@media (max-width: 900px) {
  .goal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-secondary-grid { grid-template-columns: 1fr; }
  .home-status-card { flex-basis: 190px; }
}

@media (max-width: 620px) {
  .home-hero { flex-direction: column; padding: 20px; }
  .home-hero h1 { font-size: 28px; }
  .home-status-card { flex-basis: auto; }
  .goal-grid { grid-template-columns: 1fr; }
  .toolbar-context-fields { position: fixed; top: 108px; left: 8px; right: 8px; justify-content: space-between; }
  .toolbar-context-fields label { flex: 1; }
  .toolbar-context-fields select, .toolbar-context-fields input { min-width: 0; width: 100%; }
  .view-menu .layout-controls { right: -6px; }
}


/* Phase 8 model analysis and solver controls */
.studio-runbar { align-items: flex-end; }
.studio-run-fields { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px; min-width: 0; }
.studio-run-fields label { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.studio-run-fields input, .studio-run-fields select { width: 138px; min-width: 0; padding: 7px 8px; font-size: 9px; }
.studio-run-fields #studioSaveAs { width: 175px; }
.studio-scenario-actions { display: flex; gap: 5px; padding: 8px 12px 11px; border-top: 1px solid #edf0f5; }
.model-valid { margin: 5px 2px 9px; padding: 8px; border: 1px solid #cfe8d7; border-radius: 7px; background: #f0faf3; color: #287144; font-size: 9px; font-weight: 750; }
.model-issue, .model-block { margin: 5px 1px; padding: 8px; border: 1px solid #e2e7ef; border-radius: 7px; background: #fafbfd; }
.model-issue strong, .model-issue span, .model-issue small,
.model-block strong, .model-block span, .model-block small { display: block; }
.model-issue strong, .model-block strong { color: #3b475e; font-size: 8px; text-transform: uppercase; letter-spacing: .04em; }
.model-issue span, .model-block span { margin-top: 4px; color: #59667c; font-size: 9px; line-height: 1.35; }
.model-issue small, .model-block small { margin-top: 4px; color: #909bad; font-size: 7px; }
.model-issue.error { border-color: #eccdd2; background: #fff5f6; }
.model-issue.warning { border-color: #eadfbd; background: #fffaf0; }
.model-block.simultaneous { border-left: 3px solid #7b6ed6; }
.model-block.recursive { border-left: 3px solid #4b9b72; }
.model-analysis-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; margin-bottom: 12px; }
.model-analysis-grid > div { padding: 10px; border: 1px solid #e4e9f1; border-radius: 8px; background: #f9fbfd; }
.model-analysis-grid h3, .studio-output > h3 { margin: 0 0 6px; color: #667188; font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.model-analysis-grid p { margin: 0; color: #34415a; font-size: 10px; line-height: 1.45; }
.model-run-summary { display: grid; grid-template-columns: repeat(6, minmax(90px, 1fr)); gap: 7px; margin-bottom: 13px; }
.model-run-summary > div { padding: 9px; border: 1px solid #e1e7f0; border-radius: 8px; background: #f8fafd; }
.model-run-summary span, .model-run-summary strong { display: block; }
.model-run-summary span { color: #8a95a8; font-size: 7px; text-transform: uppercase; letter-spacing: .05em; }
.model-run-summary strong { margin-top: 4px; color: #2d3a55; font-size: 10px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1050px) {
  .model-run-summary { grid-template-columns: repeat(3, minmax(90px, 1fr)); }
}
@media (max-width: 720px) {
  .model-analysis-grid, .model-run-summary { grid-template-columns: 1fr; }
  .studio-run-fields { width: 100%; }
  .studio-run-fields label, .studio-run-fields input, .studio-run-fields select { width: 100%; }
}

/* Phase 9 PRG debugger */
.monaco-editor .program-breakpoint-glyph {
  background: #c9362b;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #8f2119;
  height: 12px !important;
  margin-left: 4px;
  margin-top: 3px;
  width: 12px !important;
}

/* Versioned analytical document studio */
.studio-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr) 260px; gap: 14px; align-items: start; }
.studio-explorer { min-height: 590px; }
.studio-explorer > label { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.studio-explorer select { width: 100%; }
.studio-file-list { display: flex; flex-direction: column; gap: 3px; margin-top: 12px; max-height: 480px; overflow: auto; }
.studio-file { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; border-radius: 7px; padding: 8px; background: transparent; text-align: left; cursor: pointer; color: #45526a; }
.studio-file:hover, .studio-file.active { background: #eef2fb; color: #2c3970; }
.studio-file-icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; background: #e4e9f5; color: #5968a3; font-size: 9px; font-weight: 800; }
.studio-file strong, .studio-file small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.studio-file strong { font-size: 10px; }
.studio-file small { margin-top: 2px; color: #96a0b2; font-size: 8px; }
.studio-library { border-top: 1px solid #e9edf5; margin-top: 14px; padding-top: 12px; }
.studio-library .panel-heading { margin-bottom: 6px; }
.studio-asset-list { display: flex; flex-direction: column; gap: 3px; max-height: 220px; overflow: auto; }
.studio-asset { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; border-radius: 7px; padding: 7px; background: transparent; text-align: left; cursor: pointer; color: #45526a; }
.studio-asset:hover { background: #eef2fb; color: #2c3970; }
.studio-asset strong, .studio-asset small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.studio-asset strong { font-size: 10px; }
.studio-asset small { margin-top: 2px; color: #96a0b2; font-size: 8px; }
.studio-editor-panel { min-width: 0; }
.studio-reference-panel { min-height: 590px; min-width: 0; }
.reference-filter { width: 100%; margin-bottom: 10px; }
.studio-command-reference { display: grid; gap: 7px; max-height: 500px; overflow: auto; padding-right: 3px; }
.studio-command-item { width: 100%; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-soft); color: var(--ink); text-align: left; cursor: pointer; display: grid; gap: 4px; }
.studio-command-item:hover { border-color: var(--brand); background: var(--brand-soft); }
.studio-command-item strong { font-size: 11px; }
.studio-command-item small { color: var(--muted); line-height: 1.35; }
.studio-command-item code { color: var(--brand-strong); font-size: 9px; white-space: pre-wrap; }
.studio-open-tabs { display: flex; gap: 2px; min-height: 32px; overflow-x: auto; border-bottom: 1px solid #e4e8f0; }
.studio-open-tab { border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 8px 12px; color: #8290a7; cursor: pointer; font-size: 9px; white-space: nowrap; }
.studio-open-tab.active { border-bottom-color: #4c5db4; color: #34427e; font-weight: 700; }
.studio-monaco { min-height: 480px; border: 1px solid #dfe4ed; border-radius: 8px; overflow: hidden; }
.studio-fallback-editor { min-height: 480px; width: 100%; box-sizing: border-box; }
.studio-output { margin-top: 12px; max-height: 280px; overflow: auto; border: 1px solid #e2e7ef; border-radius: 8px; background: #f8fafd; padding: 10px; }
.studio-output pre { margin: 0; white-space: pre-wrap; color: #4b5870; font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }
.hidden { display: none !important; }
@media (max-width: 1100px) { .studio-shell { grid-template-columns: 240px minmax(0, 1fr); } .studio-reference-panel { grid-column: 1 / -1; min-height: 0; } .studio-command-reference { max-height: 220px; grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 850px) { .studio-shell { grid-template-columns: 1fr; } .studio-explorer { min-height: 0; } .studio-file-list { max-height: 240px; } .studio-command-reference { grid-template-columns: 1fr; } }
@media (max-width: 1100px) { .notes-shell { grid-template-columns: 190px minmax(300px, .9fr) minmax(330px, 1.1fr); } }
@media (max-width: 850px) { .notes-shell { grid-template-columns: 1fr; } .notes-list-panel { min-height: 0; } .notes-list { max-height: 180px; } .notes-editor-panel, .notes-preview-panel { min-height: 520px; } }

/* Phase 13 analytical workbench ------------------------------------------------ */
:root {
  --workbench-explorer-width: 280px;
  --workbench-inspector-width: 300px;
  --workbench-console-height: 220px;
  --workbench-chrome-height: 170px;
}

.analytical-toolbar {
  position: sticky;
  top: 72px;
  z-index: 18;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 5px 24px;
  border-bottom: 1px solid #cfd7e5;
  background: #f8fafc;
  box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
}
.toolbar-context-group, .toolbar-command-group { display: flex; align-items: center; gap: 8px; min-width: 0; }
.toolbar-context-group { flex: 1 1 auto; }
.toolbar-command-group { flex: 0 0 auto; }
.analytical-toolbar label { display: flex; align-items: center; gap: 6px; min-width: 0; color: #788397; font-size: 9px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.toolbar-advanced-context { position: relative; flex: 0 0 auto; }
.toolbar-advanced-context summary { list-style: none; border: 1px solid #cfd7e4; border-radius: 5px; background: #fff; color: #788397; padding: 8px 9px; cursor: pointer; font-size: 9px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.toolbar-advanced-context summary::-webkit-details-marker { display: none; }
.toolbar-context-fields { position: absolute; top: 37px; left: 0; z-index: 24; display: flex; gap: 8px; padding: 9px; border: 1px solid #d2dbe8; border-radius: 7px; background: #fff; box-shadow: var(--shadow); }
.analytical-toolbar select, .analytical-toolbar input {
  min-width: 150px;
  height: 30px;
  padding: 5px 27px 5px 8px;
  border: 1px solid #cfd7e4;
  border-radius: 5px;
  background: #fff;
  color: #28344d;
  font-size: 10px;
  text-transform: none;
}
.analytical-toolbar .sample-field input { min-width: 92px; width: 92px; padding-right: 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.compact-action { min-height: 30px; padding: 6px 11px; border-radius: 5px; font-size: 10px; }
.command-palette-trigger {
  width: 235px;
  height: 31px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  border: 1px solid #cbd4e2;
  border-radius: 6px;
  background: #fff;
  color: #788397;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(25,37,59,.04);
}
.command-palette-trigger:hover { border-color: #9caad0; color: #34415c; }
.command-palette-trigger strong { flex: 1; text-align: left; font-size: 10px; font-weight: 600; }
.command-palette-trigger kbd, .command-search kbd { border: 1px solid #d8dee8; border-radius: 4px; background: #f5f7fa; color: #7f899b; padding: 2px 5px; font: 8px ui-monospace, monospace; }
.icon-action { width: 31px; height: 31px; border: 1px solid #cbd4e2; border-radius: 5px; background: #fff; color: #657088; cursor: pointer; }
.icon-action:hover, .icon-action.active { border-color: #9eacd2; background: #eef2ff; color: #4052bd; }

.workspace-strip { top: 116px; }
.workspace-strip-inner { padding-left: 18px; padding-right: 18px; gap: 12px; }
.workbench-object-tabs { display: contents; }
.workspace-tab-divider { align-self: center; width: 1px; height: 22px; flex: 0 0 1px; background: #dce2eb; margin: 0 5px; }
.object-tab { max-width: 220px; }
.object-tab .object-tab-label { overflow: hidden; text-overflow: ellipsis; }
.object-tab .object-tab-close { margin-left: 2px; color: #9ba5b5; font-size: 14px; line-height: 1; }
.object-tab .object-tab-close:hover { color: var(--danger); }

.shell {
  grid-template-columns: var(--workbench-explorer-width) minmax(0, 1fr) var(--workbench-inspector-width);
  grid-template-rows: minmax(0, 1fr) var(--workbench-console-height);
  grid-template-areas:
    "explorer main inspector"
    "explorer console inspector";
  height: calc(100vh - var(--workbench-chrome-height));
  min-height: 620px;
  overflow: hidden;
}
.sidebar {
  grid-area: explorer;
  position: relative;
  top: auto;
  height: auto;
  min-height: 0;
  padding: 12px 10px 10px;
  border-right: 1px solid #2b3650;
}
.main {
  grid-area: main;
  min-height: 0;
  padding: 20px 24px 34px;
  overflow: auto;
  background: #edf1f7;
}
.analytical-inspector {
  grid-area: inspector;
  position: relative;
  min-width: 0;
  overflow: hidden;
  border-left: 1px solid #cfd7e4;
  background: #f9fbfd;
}
.analytical-console {
  grid-area: console;
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-top: 1px solid #bfc9d9;
  background: #101827;
  color: #d8e0ef;
}
.shell.inspector-closed { grid-template-columns: var(--workbench-explorer-width) minmax(0, 1fr) 0; }
.shell.inspector-closed .analytical-inspector { display: none; }
.shell.explorer-closed { grid-template-columns: 0 minmax(0, 1fr) var(--workbench-inspector-width); }
.shell.explorer-closed .sidebar { display: none; }
.shell.explorer-closed.inspector-closed { grid-template-columns: 0 minmax(0, 1fr) 0; }
.shell.console-closed { grid-template-rows: minmax(0, 1fr) 0; }
.shell.console-closed .analytical-console { display: none; }

.workbench-explorer-section { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.explorer-filter-wrap { display: flex; align-items: center; gap: 6px; margin: 0 4px 7px; padding: 0 7px; border: 1px solid #303d58; border-radius: 6px; background: #151f34; color: #72809e; }
.explorer-filter-wrap input { height: 29px; border: 0; padding: 0; background: transparent; color: #e1e7f2; font-size: 10px; outline: none; }
.workbench-object-tree { flex: 1 1 auto; min-height: 120px; overflow: auto; padding-right: 2px; }
.explorer-loading { padding: 14px 9px; color: #7d8aa5; font-size: 10px; }
.object-group { margin-bottom: 3px; }
.object-group-heading { width: 100%; display: flex; align-items: center; gap: 6px; min-height: 26px; padding: 4px 6px; border: 0; border-radius: 5px; background: transparent; color: #95a2ba; cursor: pointer; text-align: left; }
.object-group-heading:hover { background: #18243a; color: #dfe6f3; }
.object-group-heading .chevron { width: 11px; color: #687793; font-size: 9px; transform: rotate(0); transition: transform .12s ease; }
.object-group.collapsed .object-group-heading .chevron { transform: rotate(-90deg); }
.object-group-heading strong { flex: 1; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.object-group-heading span:last-child { color: #61708d; font-size: 8px; }
.object-group-items { display: flex; flex-direction: column; }
.object-group.collapsed .object-group-items { display: none; }
.object-tree-item { width: 100%; min-height: 27px; display: grid; grid-template-columns: 18px minmax(0,1fr) auto; align-items: center; gap: 5px; padding: 4px 7px 4px 11px; border: 0; border-radius: 5px; background: transparent; color: #c0c9d9; cursor: pointer; text-align: left; }
.object-tree-item:hover { background: #1a2740; color: #fff; }
.object-tree-item.active { background: #26385d; color: #fff; box-shadow: inset 2px 0 0 #788aff; }
.object-tree-icon { width: 16px; text-align: center; color: #7f90b2; font-size: 11px; }
.object-tree-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.object-tree-meta { color: #60708e; font-size: 8px; }
.legacy-datasets { margin: 5px 3px 0; border-top: 1px solid #28354f; padding-top: 5px; }
.legacy-datasets summary { color: #71809c; font-size: 9px; cursor: pointer; }
.legacy-datasets .dataset-list { max-height: 140px; overflow: auto; margin-top: 5px; }
.legacy-datasets .dataset-item { padding: 6px 7px; }
.sidebar-section.grow { flex: 0 0 auto; max-height: 218px; border-top: 1px solid #2a3650; padding-top: 8px; }
.nav { gap: 5px; }
.nav-section { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 2px; }
.nav-section-label { grid-column: span 2; }
.nav-item { padding: 6px 7px; font-size: 9px; gap: 5px; }
.nav-icon { width: 13px; font-size: 12px; }
.sidebar-footer { padding-top: 8px; }
.sidebar-status { margin-top: 7px; }

.dock-heading { height: 43px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-bottom: 1px solid #dbe1eb; background: #f2f5f9; }
.dock-heading span, .dock-heading strong { display: block; }
.dock-heading span { color: #8a95a8; font-size: 8px; font-weight: 850; letter-spacing: .11em; }
.dock-heading strong { margin-top: 2px; max-width: 245px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #2f3a50; font-size: 10px; }
.dock-close, .dock-action { border: 0; background: transparent; color: #7f8a9c; cursor: pointer; }
.dock-close { width: 23px; height: 23px; border-radius: 4px; font-size: 16px; }
.dock-close:hover { background: #e3e8f0; color: #ad3340; }
.dock-action { font-size: 9px; }
.inspector-tabs { display: flex; height: 33px; border-bottom: 1px solid #dfe4ec; background: #fff; }
.inspector-tabs button { flex: 1; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #808b9d; cursor: pointer; font-size: 9px; }
.inspector-tabs button.active { border-bottom-color: #5368d9; color: #3d4fb3; font-weight: 750; }
.inspector-content { height: calc(100% - 76px); min-height: 0; display: block; overflow: auto; padding: 10px; }
.inspector-content.empty-state { display: grid; min-height: 160px; padding: 18px; text-align: center; }
.inspector-section { margin-bottom: 14px; }
.inspector-section h3 { margin: 0 0 6px; color: #7b8799; font-size: 8px; text-transform: uppercase; letter-spacing: .09em; }
.inspector-property { display: grid; grid-template-columns: 92px minmax(0,1fr); gap: 8px; padding: 5px 2px; border-bottom: 1px solid #edf0f4; font-size: 9px; }
.inspector-property span { color: #8b95a5; }
.inspector-property strong, .inspector-property code { min-width: 0; overflow-wrap: anywhere; color: #354158; font-size: 9px; font-weight: 620; }
.inspector-property code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.console-tabbar { height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #29354a; background: #151f30; }
.console-tabs { display: flex; align-self: stretch; }
.console-tabs button { min-width: 75px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #8491a8; cursor: pointer; font-size: 9px; }
.console-tabs button.active { border-bottom-color: #778bff; color: #e5e9f2; background: #111a29; }
.console-tabs button span { display: inline-grid; min-width: 15px; height: 15px; place-items: center; margin-left: 3px; border-radius: 8px; background: #2a3548; font-size: 7px; }
.console-actions { display: flex; align-items: center; gap: 8px; padding-right: 6px; }
.console-actions .muted { color: #75839a; font-size: 8px; }
.console-actions .dock-close:hover { background: #273349; }
.console-pane { display: none; height: calc(100% - 34px); min-height: 0; overflow: auto; }
.console-pane.active { display: block; }
.console-transcript { height: calc(100% - 57px); overflow: auto; padding: 8px 12px; font: 10px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.console-message { margin-bottom: 7px; white-space: pre-wrap; overflow-wrap: anywhere; }
.console-message.system { color: #7f8da3; }
.console-message.command { color: #c8d2e3; }
.console-message.command::before { content: "> "; color: #7c91ff; }
.console-message.error { color: #ff9aa5; }
.console-message.success { color: #8ed8b5; }
.console-input-row { height: 57px; display: grid; grid-template-columns: 22px minmax(0,1fr) 62px; gap: 6px; align-items: center; padding: 5px 8px; border-top: 1px solid #29354a; background: #0e1624; }
.console-prompt { color: #8093ff; font: 700 13px ui-monospace, monospace; text-align: center; }
.console-input-row textarea { height: 43px; resize: none; border: 0; outline: 0; background: transparent; color: #e2e7f0; font: 10px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace; }
#consoleOutput, #consoleProblems, #consoleJobs, #consoleVariables { padding: 9px 11px; background: #111a29; }
#consoleOutput .result-grid, #consoleVariables .result-grid { grid-template-columns: repeat(4, minmax(110px,1fr)); }

.dock-resizer { position: absolute; z-index: 5; }
.resizer-left { left: -3px; top: 0; bottom: 0; width: 6px; cursor: col-resize; }
.resizer-top { top: -3px; left: 0; right: 0; height: 6px; cursor: row-resize; }
.dock-resizer:hover, .dock-resizer.dragging { background: rgba(80,101,229,.45); }

.object-view-content { display: block; min-height: 250px; }
.object-view-content.empty-state { display: grid; }
.object-view-grid { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(300px,.65fr); gap: 14px; }
.object-summary-card, .structured-section { border: 1px solid var(--line); border-radius: 9px; background: #fff; padding: 14px; box-shadow: var(--shadow-soft); }
.object-summary-card h2, .structured-section h2 { margin: 0 0 10px; font-size: 13px; }
.structured-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(115px,1fr)); gap: 8px; margin-bottom: 12px; }
.structured-metric { padding: 9px; border: 1px solid #e0e6ef; border-radius: 7px; background: #f8fafc; }
.structured-metric span, .structured-metric strong { display: block; }
.structured-metric span { color: #8691a4; font-size: 8px; text-transform: uppercase; letter-spacing: .06em; }
.structured-metric strong { margin-top: 4px; color: #2e3b55; font-size: 11px; overflow-wrap: anywhere; }
.issue-list { display: flex; flex-direction: column; gap: 6px; }
.issue-row { display: grid; grid-template-columns: 60px minmax(0,1fr) auto; gap: 8px; align-items: start; padding: 8px; border: 1px solid #e1e6ee; border-radius: 7px; background: #fafbfd; font-size: 9px; }
.issue-row.error { border-color: #ebcbd0; background: #fff4f5; }
.issue-row.warning { border-color: #e8ddb7; background: #fff9ed; }
.issue-row .severity { font-weight: 800; text-transform: uppercase; }
.run-status-completed { color: var(--success); }
.run-status-failed { color: var(--danger); }

.command-palette-dialog { width: min(720px, calc(100vw - 30px)); max-height: min(620px, calc(100vh - 80px)); padding: 0; border: 0; border-radius: 10px; background: #fff; box-shadow: 0 28px 90px rgba(13,22,41,.36); }
.command-palette-dialog::backdrop { background: rgba(16,24,39,.38); backdrop-filter: blur(2px); }

/* Import data workspace ------------------------------------------------------ */
.main .import-window.active { display: flex; flex-direction: column; max-width: none; min-height: 0; margin: 0; padding: 0; border: 1px solid #cbd5e5; border-radius: 12px; background: #f7f9fc; color: var(--ink); box-shadow: var(--shadow); overflow: hidden; animation: none; }
.main[data-layout="tabbed"] .import-window.active { height: 100%; }
.import-dialog-shell { display: flex; flex: 1 1 auto; min-height: 0; flex-direction: column; overflow: hidden; }
.import-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 22px 24px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.import-dialog-header h2 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.import-dialog-header p:not(.eyebrow) { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.import-dialog-header .dock-close { flex: 0 0 auto; }
.import-mode-tabs { display: flex; gap: 4px; padding: 8px 24px 0; background: #fff; border-bottom: 1px solid var(--line); }
.import-mode-tabs button { border: 0; border-bottom: 3px solid transparent; background: transparent; color: #7c8799; padding: 9px 12px 10px; cursor: pointer; font-size: 10px; font-weight: 760; }
.import-mode-tabs button.active { border-bottom-color: var(--brand); color: var(--brand-strong); }
.import-online-panel { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 16px 24px 24px; }
.import-search-row { display: grid; grid-template-columns: 180px 180px minmax(0,1fr) auto; align-items: end; gap: 10px; }
.import-search-row label, .import-section-heading label { display: grid; gap: 5px; color: #657187; font-size: 9px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.import-search-row input, .import-search-row select, .import-section-heading select { height: 34px; min-width: 0; padding: 6px 8px; border: 1px solid #cfd7e4; border-radius: 6px; background: #fff; color: #28344d; font-size: 10px; text-transform: none; }
.import-search-row .button { height: 34px; }
.import-filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; min-height: 42px; padding: 10px 0 8px; }
.import-category-note { align-self: center; color: var(--brand-strong); font-size: 9px; font-weight: 700; }
.import-filter-bar label { display: grid; gap: 4px; color: #7b8799; font-size: 8px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.import-filter-bar input, .import-filter-bar select { height: 28px; min-width: 135px; padding: 5px 7px; border: 1px solid #d3dae6; border-radius: 5px; background: #fff; color: #3c4860; font-size: 9px; text-transform: none; }
.import-filter-bar .filter-check { display: flex; grid-template-columns: auto auto; align-items: center; gap: 5px; height: 28px; padding: 0 6px; border: 1px solid #d3dae6; border-radius: 5px; background: #fff; }
.import-filter-bar .filter-check input { min-width: auto; height: auto; }
.import-dialog-grid { display: grid; grid-template-columns: minmax(330px, .9fr) minmax(430px, 1.1fr); gap: 14px; min-height: 0; }
.import-catalog-column, .import-config-column { min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow-soft); }
.import-catalog-column { display: flex; min-height: 490px; flex-direction: column; overflow: hidden; }
.import-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 10px; padding: 12px 13px; border-bottom: 1px solid #e4e8ef; background: #fafbfd; }
.import-section-heading strong, .import-section-heading span { display: block; }
.import-section-heading strong { font-size: 11px; }
.import-section-heading span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.import-section-heading label { grid-template-columns: auto 55px; align-items: center; gap: 5px; color: #8a95a8; }
.import-section-heading select { width: 55px; height: 26px; padding: 3px; }
.import-catalog-results { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 8px; }
.import-catalog-results.empty-state { display: grid; place-items: center; min-height: 180px; padding: 26px; text-align: center; }
.catalog-category { display: grid; gap: 4px; margin: 0 0 15px; }
.catalog-category h3 { position: sticky; top: -8px; z-index: 1; display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 4px; padding: 7px 5px 6px; border-bottom: 2px solid #d8def7; background: #fff; color: var(--brand-strong); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.catalog-category h3 small { color: var(--muted); font-weight: 500; }
.import-catalog-result { width: 100%; display: grid; gap: 4px; margin-bottom: 6px; padding: 10px; border: 1px solid #e0e5ee; border-radius: 8px; background: #fff; color: #36435c; cursor: pointer; text-align: left; }
.import-catalog-result:hover, .import-catalog-result.selected { border-color: #8c9be9; background: #f5f7ff; box-shadow: 0 0 0 2px rgba(80,101,229,.08); }
.import-catalog-result strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.import-catalog-result span { color: #66738a; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; }
.import-catalog-result small { color: #8a95a8; font-size: 9px; line-height: 1.35; }
.import-catalog-result .catalog-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.import-catalog-result .catalog-badge { padding: 2px 5px; border-radius: 4px; background: #eef1ff; color: #5264c8; font-size: 8px; font-weight: 750; }
.import-config-column { padding: 13px; overflow: auto; }
.import-selection-summary { display: grid; gap: 3px; margin-bottom: 11px; padding: 10px; border: 1px solid #e2e7f0; border-radius: 8px; background: #f8faff; }
.import-selection-summary span { color: #7d89a0; font-size: 8px; font-weight: 850; letter-spacing: .1em; }
.import-selection-summary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #2f3d59; font-size: 12px; }
.import-selection-summary small { color: #7d89a0; font-size: 9px; }
.import-dimensions-panel { margin-bottom: 12px; padding: 10px; border: 1px solid #dfe5f0; border-radius: 8px; background: #fbfcff; }
.import-dimensions-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.import-dimensions-heading strong, .import-dimensions-heading small { display: block; }
.import-dimensions-heading strong { color: #34427e; font-size: 10px; }
.import-dimensions-heading small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.import-dimensions-heading .button { flex: 0 0 auto; }
.import-dimensions-status { margin: 8px 0; font-size: 8px; }
.import-dimensions-status.success { color: var(--success); }
.import-dimensions-status.error { color: var(--danger); }
.import-dimension-fields { display: grid; gap: 6px; max-height: 245px; overflow: auto; }
.import-dimension-row { display: grid; grid-template-columns: minmax(100px, .8fr) 78px minmax(120px, 1fr); gap: 6px; align-items: start; padding: 7px; border: 1px solid #e5e9f1; border-radius: 6px; background: #fff; }
.import-dimension-name { min-width: 0; padding-top: 5px; }
.import-dimension-name strong, .import-dimension-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-dimension-name strong { color: #44516b; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; }
.import-dimension-name small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.import-dimension-row select { width: 100%; min-width: 0; padding: 4px 5px; border: 1px solid #d4dbe7; border-radius: 5px; background: #fff; color: #3d4a63; font-size: 8px; }
.import-dimension-row select[multiple] { min-height: 54px; }
.dataset-view-panel { display: grid; gap: 9px; margin-bottom: 14px; }
.dataset-view-panel .panel-heading { margin-bottom: 0; }
.dataset-dimensions-status { min-height: 16px; font-size: 9px; }
.dataset-dimensions-status.success { color: var(--success); }
.dataset-dimensions-status.error { color: var(--danger); }
.dataset-view-actions { align-items: center; justify-content: flex-start; margin-top: 2px; }
.dataset-view-actions .muted { font-size: 9px; }
.import-full-table-note { display: grid; gap: 3px; margin: 0 0 12px; padding: 9px 10px; border: 1px solid #dfe5f0; border-radius: 8px; background: #fbfcff; }
.import-full-table-note strong { color: #34427e; font-size: 10px; }
.import-full-table-note small { color: var(--muted); font-size: 8px; line-height: 1.35; }
.import-config-grid label { min-width: 0; }
.import-config-grid textarea { min-height: 42px; resize: vertical; }
.import-action-row { justify-content: flex-end; margin-top: 12px; }
.import-status { min-height: 18px; margin-top: 9px; font-size: 9px; }
.import-status.success { color: var(--success); }
.import-status.error { color: var(--danger); }
.import-preview-output { max-height: 245px; margin-top: 8px; overflow: auto; padding: 9px; border: 1px solid #e2e7f0; border-radius: 7px; background: #fbfcfe; font-size: 9px; }
.import-preview-output .table-wrap { max-height: 180px; }
.import-file-panel { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 50px 24px 80px; background: #f7f9fc; }
.import-file-card { display: grid; place-items: center; gap: 8px; max-width: 560px; margin: 0 auto; padding: 45px 25px; border: 1px dashed #b9c4d7; border-radius: 12px; background: #fff; text-align: center; }
.import-file-card h3 { margin: 0; font-size: 16px; }
.import-file-card p { margin: 0 0 8px; color: var(--muted); font-size: 11px; }
.import-file-icon { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 14px; background: var(--brand-soft); color: var(--brand-strong); font-size: 25px; }
.import-file-card .muted { font-size: 9px; }

.main[data-layout="grid"] .import-window .import-dialog-shell,
.main[data-layout="windowed"] .import-window .import-dialog-shell { min-height: 0; }

@media (max-width: 850px) {
  .import-dialog-grid { grid-template-columns: 1fr; }
  .import-catalog-column { min-height: 300px; }
}
@media (max-width: 650px) {
  .import-dialog-header { padding: 17px; }
  .import-mode-tabs, .import-online-panel { padding-left: 17px; padding-right: 17px; }
  .import-search-row { grid-template-columns: 1fr; }
  .import-search-row .button { width: 100%; }
  .import-dimension-row { grid-template-columns: 1fr 88px; }
  .import-dimension-row select[multiple] { grid-column: 1 / -1; }
}
.command-palette-shell { overflow: hidden; border: 1px solid #cbd4e2; border-radius: 10px; }
.command-search { height: 50px; display: grid; grid-template-columns: 25px minmax(0,1fr) auto; align-items: center; gap: 7px; padding: 0 12px; border-bottom: 1px solid #e0e5ed; }
.command-search span { color: #6577dc; font-size: 19px; }
.command-search input { height: 46px; border: 0; outline: 0; padding: 0; font-size: 14px; }
.command-results { max-height: 460px; overflow: auto; padding: 6px; }
.command-result { width: 100%; display: grid; grid-template-columns: 31px minmax(0,1fr) auto; align-items: center; gap: 9px; padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; color: #354158; cursor: pointer; text-align: left; }
.command-result:hover, .command-result.selected { background: #eef2ff; }
.command-result-icon { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 6px; background: #e7ebf4; color: #5264c8; }
.command-result strong, .command-result small { display: block; }
.command-result strong { font-size: 10px; }
.command-result small { margin-top: 2px; color: #8b95a5; font-size: 8px; }
.command-result kbd { color: #909aab; font: 8px ui-monospace, monospace; }
.command-footer { display: flex; gap: 18px; padding: 7px 12px; border-top: 1px solid #e3e7ee; background: #f7f9fc; color: #8791a2; font-size: 8px; }

@media (max-width: 1280px) {
  :root { --workbench-inspector-width: 270px; --workbench-explorer-width: 250px; }
  .analytical-toolbar label span { display: none; }
  .command-palette-trigger { width: 190px; }
}
@media (max-width: 980px) {
  :root { --workbench-explorer-width: 220px; }
  .shell { grid-template-columns: var(--workbench-explorer-width) minmax(0,1fr); grid-template-areas: "explorer main" "explorer console"; }
  .analytical-inspector { position: fixed; top: var(--workbench-chrome-height); right: 0; bottom: 0; z-index: 30; width: 300px; box-shadow: -12px 0 30px rgba(20,31,54,.16); }
  .shell.inspector-closed .analytical-inspector { display: none; }
  .toolbar-context-group label:nth-child(4) { display: none; }
  .command-palette-trigger strong { display: none; }
  .command-palette-trigger { width: 70px; }
  .object-view-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  :root { --workbench-chrome-height: 154px; --workbench-console-height: 190px; }
  .analytical-toolbar { top: 62px; min-height: 44px; padding: 5px 8px; }
  .toolbar-context-group label:not(:nth-child(2)) { display: none; }
  .toolbar-context-group select { min-width: 150px; }
  .toolbar-command-group #workbenchStop, .toolbar-command-group .command-palette-trigger, .toolbar-command-group #toggleInspector { display: none; }
  .workspace-strip { top: 106px; }
  .shell { display: grid; grid-template-columns: 1fr; grid-template-rows: minmax(0,1fr) var(--workbench-console-height); grid-template-areas: "main" "console"; height: calc(100vh - var(--workbench-chrome-height)); min-height: 480px; }
  .sidebar { display: none; }
  .main { padding: 14px 10px 24px; }
  .analytical-inspector { top: var(--workbench-chrome-height); width: min(320px, 92vw); }
  .console-tabs button { min-width: 57px; font-size: 8px; }
  .console-tabs button:nth-child(n+4) { display: none; }
}
.main[data-layout="grid"], .main[data-layout="windowed"] { height: 100%; min-height: 0; }

/* Phase 15 economic data connectors ------------------------------------------- */
.connector-panel { min-height: 420px; }
.connector-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.connector-controls { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.connector-search-results { max-height: 260px; overflow: auto; display: grid; gap: 7px; padding-right: 4px; }
.connector-result { width: 100%; border: 1px solid var(--line); background: var(--surface-soft); color: inherit; border-radius: 8px; padding: 10px; text-align: left; cursor: pointer; display: grid; gap: 3px; }
.connector-result:hover { border-color: var(--accent); background: var(--surface); }
.connector-result strong { font-size: 12px; }
.connector-result span, .connector-result small { color: var(--muted); font-size: 11px; }
.error-text { color: var(--danger) !important; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 1050px) { .connector-grid { grid-template-columns: 1fr; } }

/* Phase 15 international catalog and vintage comparison */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 2rem;
}
.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}
.connector-errors {
  padding: .65rem .75rem;
  border-top: 1px solid var(--border);
  color: var(--danger, #b42318);
  background: color-mix(in srgb, var(--danger, #b42318) 6%, transparent);
}
#vintageComparison .structured-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 900px) {
  #vintageComparison .structured-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Phase 16 language platform */
.studio-language-status { margin-top: 7px; min-height: 15px; font: 9px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: #7b879d; }
.monaco-editor .squiggly-error { opacity: .95; }

/* Global Excel-style workspace ribbon --------------------------------------- */
:root {
  --global-ribbon-height: 106px;
  --workbench-chrome-height: 276px;
}
.global-ribbon {
  position: sticky;
  top: 72px;
  z-index: 19;
  height: var(--global-ribbon-height);
  overflow: hidden;
  border-bottom: 1px solid #cbd4e2;
  background: #eef1f6;
  box-shadow: 0 2px 9px rgba(29,42,71,.08);
}
.global-ribbon-tabs {
  display: flex;
  align-items: stretch;
  height: 32px;
  gap: 2px;
  padding: 0 18px;
  overflow-x: auto;
  border-bottom: 1px solid #d4dbe7;
  background: #e4e9f1;
}
.global-ribbon-tab {
  align-self: stretch;
  flex: 0 0 auto;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #68758b;
  padding: 0 14px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
}
.global-ribbon-tab:hover { background: #f1f4f9; color: #35456b; }
.global-ribbon-tab.active { border-bottom-color: var(--brand); background: #f8f9fc; color: var(--brand-strong); }
.global-ribbon-hint { align-self: center; margin-left: auto; padding-right: 3px; color: #8b95a7; font-size: 9px; white-space: nowrap; }
.global-ribbon-body {
  display: flex;
  height: calc(var(--global-ribbon-height) - 32px);
  overflow-x: auto;
  background: linear-gradient(#f8f9fb, #edf1f6);
}
.global-ribbon-panel { display: none; align-items: stretch; flex: 1 0 max-content; min-width: 100%; padding: 5px 10px 0; }
.global-ribbon-panel.active { display: flex; }
.global-ribbon-group { display: flex; flex: 0 0 auto; min-width: 0; flex-direction: column; justify-content: space-between; padding: 0 10px 5px; border-right: 1px solid #d7deea; }
.global-ribbon-group-wide { flex: 1 0 auto; }
.global-ribbon-tools { display: flex; align-items: center; gap: 3px; min-height: 47px; }
.global-ribbon-shortcuts { flex-wrap: wrap; align-content: center; gap: 4px 7px; }
.global-ribbon-command { display: inline-flex; align-items: center; justify-content: center; flex-direction: column; gap: 3px; width: 61px; height: 46px; border: 1px solid #cbd4e1; border-radius: 5px; background: #fff; color: #3e4b63; cursor: pointer; font-size: 8px; white-space: nowrap; }
.global-ribbon-command:hover, .global-ribbon-mini:hover { border-color: #97a7d0; background: #eef2ff; color: var(--brand-strong); }
.global-ribbon-icon { color: #33415d; font-size: 16px; line-height: 1; }
.global-ribbon-label { display: block; color: #8993a5; font-size: 8px; text-align: center; white-space: nowrap; }
.global-ribbon-mini { height: 24px; padding: 2px 8px; border: 1px solid #cbd4e1; border-radius: 4px; background: #fff; color: #56647b; cursor: pointer; font-size: 9px; white-space: nowrap; }

/* The sheet keeps its formula bar, while its former page-local ribbon is now global. */
#tab-workbook .workbook-ribbon-tabs, #tab-workbook .workbook-ribbon-body { display: none; }
#tab-workbook .workbook-toolbar { border-bottom: 0; background: transparent; }
.global-ribbon + .analytical-toolbar { top: calc(72px + var(--global-ribbon-height)); }
.global-ribbon ~ .workspace-strip { top: calc(72px + var(--global-ribbon-height) + 44px); }

/* Keep desktop chrome fixed so the workspace—not the document—owns scrolling. */
@media (min-width: 701px) {
  html, body { height: 100%; overflow: hidden; }
  .shell { min-height: 0; }
}

@media (max-width: 700px) {
  :root { --global-ribbon-height: 96px; --workbench-chrome-height: 250px; }
  .global-ribbon { top: 62px; }
  .global-ribbon-tabs { padding: 0 6px; }
  .global-ribbon-tab { padding: 0 10px; font-size: 9px; }
  .global-ribbon-hint { display: none; }
  .global-ribbon-panel { padding-left: 5px; padding-right: 5px; }
  .global-ribbon-group { padding-left: 6px; padding-right: 6px; }
  .global-ribbon-command { width: 55px; height: 44px; }
  .global-ribbon + .analytical-toolbar { top: calc(62px + var(--global-ribbon-height)); }
  .global-ribbon ~ .workspace-strip { top: calc(62px + var(--global-ribbon-height) + 44px); }
}

/* Compact Excel-style application chrome ---------------------------------- */
:root {
  --app-topbar-height: 36px;
  --global-ribbon-height: 82px;
  --workbench-context-height: 38px;
  --workspace-strip-height: 0px;
  --workbench-chrome-height: calc(var(--app-topbar-height) + var(--global-ribbon-height) + var(--workbench-context-height) + var(--workspace-strip-height));
}
.topbar {
  height: var(--app-topbar-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  background: #f7f9fc;
  color: #3c4860;
  border-bottom: 1px solid #d9e0eb;
  box-shadow: none;
}
.brand { flex: 0 0 auto; gap: 7px; }
.brand-mark { width: 24px; height: 24px; border-radius: 7px; box-shadow: none; }
.brand-mark span { font-size: 8px; }
.brand-mark i { width: 3px; height: 3px; right: 4px; bottom: 4px; }
.brand strong { color: #35425e; font-size: 10px; }
.brand > div:last-child span { display: none; }
.app-menu { display: flex; align-self: stretch; align-items: stretch; gap: 1px; }
.app-menu-menu { position: relative; margin: 0; }
.app-menu-menu > summary { display: flex; align-items: center; height: 100%; padding: 0 8px; border: 0; border-radius: 4px; color: #56647c; cursor: pointer; font-size: 9px; font-weight: 700; list-style: none; }
.app-menu-menu > summary::-webkit-details-marker { display: none; }
.app-menu-menu > summary:hover, .app-menu-menu[open] > summary { background: #e9edf6; color: var(--brand-strong); }
.app-menu-popover { position: absolute; top: calc(100% + 2px); left: 0; z-index: 40; display: grid; min-width: 178px; gap: 1px; padding: 4px; border: 1px solid #cfd8e6; border-radius: 6px; background: #fff; box-shadow: 0 10px 24px rgba(29,42,71,.15); }
.app-menu-command { display: flex; align-items: center; gap: 7px; width: 100%; height: 26px; padding: 3px 7px; border: 0; border-radius: 4px; background: transparent; color: #43516b; cursor: pointer; font-size: 9px; text-align: left; white-space: nowrap; }
.app-menu-command:hover { background: #eef2ff; color: var(--brand-strong); }
.menu-command-icon { display: inline-grid; width: 15px; place-items: center; color: #7483a0; font-size: 12px; line-height: 1; }
.app-menu-divider { height: 1px; margin: 3px 2px; background: #e2e7ef; }
.project-context { flex: 1 1 auto; justify-content: center; gap: 7px; min-width: 0; color: #7a8497; font-size: 9px; }
.project-context strong { color: #3f4b62; font-size: 9px; }
.project-context > span:last-child { color: #7a8497; }
.context-kicker { font-size: 7px; }
.context-divider { height: 11px; background: #d6dce7; }
.top-actions { flex: 0 0 auto; gap: 4px; }
.top-actions .badge { padding: 3px 7px; font-size: 8px; }
.top-actions .badge.neutral { background: #e9edf4; color: #69758a; }
.top-actions .top-button { height: 25px; padding: 4px 7px; border: 1px solid #cfd8e6; border-radius: 4px; background: #fff; color: #526079; font-size: 8px; }
.top-actions .top-button:hover { background: #eef2ff; border-color: #aebbdc; }
.app-menu-command#applicationsButton, .app-menu-command#refreshButton, .app-menu-command#importDataButton { padding: 3px 7px; font-size: 9px; font-weight: 500; }
.app-menu-command#importDataButton { color: #3b4bc2; }
.app-menu-section-label { padding: 4px 7px 2px; color: #8a95a8; font-size: 7px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.app-menu-layout-controls { display: grid; gap: 1px; }
.app-menu-layout-option { width: 100%; justify-content: flex-start; height: 26px; padding: 3px 7px; border-radius: 4px; font-size: 9px; text-align: left; }
.app-menu-layout-option b { font-size: 9px; font-weight: 700; }
.app-menu-objects-menu .app-menu-popover { min-width: 245px; }
.app-menu-objects-popover { padding: 5px; }
.app-menu-objects-popover .workspace-tabs { display: grid; max-height: 220px; min-width: 230px; gap: 1px; overflow: auto; }
.app-menu-objects-popover .workspace-tab { width: 100%; min-height: 26px; height: 26px; align-self: auto; justify-content: flex-start; gap: 6px; padding: 3px 7px; border-radius: 4px; font-size: 9px; text-align: left; }
.app-menu-objects-popover .workspace-tab.active::after { display: none; }
.app-menu-objects-popover .object-tab-close { margin-left: auto; color: #9ba5b5; font-size: 13px; line-height: 1; }
.app-menu-status { display: flex; align-items: center; gap: 5px; margin-left: 6px; color: #7a8497; font-size: 8px; white-space: nowrap; }
.app-menu-quick-actions { display: flex; align-items: center; gap: 3px; margin-left: 5px; padding-left: 6px; border-left: 1px solid #d9e0eb; }
.app-menu-quick-action { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 24px; min-width: 25px; padding: 3px 7px; border: 1px solid #cfd8e6; border-radius: 4px; background: #fff; color: #526079; cursor: pointer; font-size: 8px; font-weight: 750; line-height: 1; white-space: nowrap; }
.app-menu-quick-action:hover { border-color: #aebbdc; background: #eef2ff; color: var(--brand-strong); }
.app-menu-quick-action.active { border-color: #b9c5e3; background: #eef2ff; color: var(--brand-strong); }
.app-menu-quick-action.primary { border-color: #5368dc; background: #5368dc; color: #fff; box-shadow: 0 3px 8px rgba(67,84,196,.18); }
.app-menu-quick-action.primary:hover { border-color: #4355c7; background: #4355c7; color: #fff; }
.app-menu-quick-action.icon-only { width: 25px; padding: 3px; }
.app-menu-action-icon { font-size: 12px; line-height: 1; }

.global-ribbon {
  top: var(--app-topbar-height);
  height: var(--global-ribbon-height);
  box-shadow: 0 1px 4px rgba(29,42,71,.06);
}
.global-ribbon-tabs { height: 28px; gap: 1px; padding: 0 12px; }
.global-ribbon-tab { padding: 0 11px; font-size: 9px; }
.global-ribbon-hint { font-size: 8px; }
.global-ribbon-body { height: calc(var(--global-ribbon-height) - 28px); }
.global-ribbon-panel { padding: 3px 8px 0; }
.global-ribbon-group { padding: 0 7px 3px; }
.global-ribbon-tools { min-height: 37px; gap: 2px; }
.global-ribbon-command { width: 58px; height: 36px; gap: 2px; border-radius: 4px; font-size: 7px; line-height: 1.05; white-space: normal; text-align: center; }
.global-ribbon-icon { font-size: 13px; }
.global-ribbon-label { font-size: 7px; }
.global-ribbon-mini { height: 22px; padding: 2px 6px; font-size: 8px; }

.global-ribbon + .analytical-toolbar {
  top: calc(var(--app-topbar-height) + var(--global-ribbon-height));
  height: var(--workbench-context-height);
  min-height: var(--workbench-context-height);
  gap: 10px;
  padding: 3px 14px;
  box-shadow: none;
}
.toolbar-context-group, .toolbar-command-group { gap: 5px; }
.analytical-toolbar label { gap: 4px; font-size: 8px; }
.analytical-toolbar select, .analytical-toolbar input { min-width: 132px; height: 26px; padding: 4px 22px 4px 7px; border-radius: 4px; font-size: 9px; }
.analytical-toolbar .sample-field input { min-width: 78px; width: 78px; }
.toolbar-advanced-context summary { padding: 6px 8px; border-radius: 4px; font-size: 8px; }
.compact-action { min-height: 26px; padding: 4px 8px; border-radius: 4px; font-size: 9px; }
.command-palette-trigger { width: 210px; height: 27px; border-radius: 4px; }
.command-palette-trigger strong { font-size: 9px; }
.icon-action { width: 27px; height: 27px; border-radius: 4px; }

.global-ribbon ~ .workspace-strip {
  top: calc(var(--app-topbar-height) + var(--global-ribbon-height) + var(--workbench-context-height));
  height: var(--workspace-strip-height);
  background: #f8fafc;
  box-shadow: none;
}
.workspace-strip-inner { padding: 0 14px; gap: 10px; }
.window-label { gap: 6px; font-size: 8px; }
.window-label-icon { font-size: 14px; }
.workspace-tab { gap: 5px; padding: 0 10px; font-size: 9px; }
.workspace-tab.active::after { right: 8px; left: 8px; height: 2px; }
.tab-icon { font-size: 13px; }
.workspace-strip-meta { gap: 5px; font-size: 9px; }
.workspace-context-toggle { flex: 0 0 auto; height: 24px; padding: 4px 8px; border: 1px solid #dbe2ee; border-radius: 5px; background: #f4f6fa; color: #56627a; cursor: pointer; font-size: 9px; font-weight: 750; }
.workspace-context-toggle:hover, .workspace-context-toggle.active { border-color: #b9c5e3; background: #eef2ff; color: var(--brand-strong); }
.context-bar-closed { --workbench-context-height: 0px; --workbench-chrome-height: calc(var(--app-topbar-height) + var(--global-ribbon-height) + var(--workbench-context-height) + var(--workspace-strip-height)); }
.context-bar-closed .analytical-toolbar { display: none; }
.view-menu summary { padding: 5px 8px; border-radius: 5px; font-size: 9px; }

@media (max-width: 700px) {
  :root { --app-topbar-height: 40px; --global-ribbon-height: 82px; --workbench-context-height: 36px; --workspace-strip-height: 0px; --workbench-chrome-height: calc(var(--app-topbar-height) + var(--global-ribbon-height) + var(--workbench-context-height) + var(--workspace-strip-height)); }
  .topbar { grid-template-columns: 1fr auto; gap: 8px; padding: 0 12px; }
  .project-context { display: none; }
  .top-actions { gap: 3px; }
  .top-actions .top-button, .top-actions .button.primary { height: 26px; padding: 4px 6px; }
  .top-actions .top-button.icon-only { width: 26px; }
  .top-actions .top-button#applicationsButton .top-button-label { display: none; }
  .app-menu-quick-actions { gap: 2px; margin-left: 2px; padding-left: 3px; }
  .app-menu-quick-action { width: 24px; padding: 3px; }
  .app-menu-action-label { display: none; }
  .app-menu-menu > summary { padding: 0 5px; font-size: 8px; }
  .app-menu-objects-menu > summary { font-size: 0; }
  .app-menu-objects-menu > summary .menu-command-icon { font-size: 12px; }
  .app-menu-status { display: none; }
  .global-ribbon { top: var(--app-topbar-height); }
  .global-ribbon-tabs { padding: 0 5px; }
  .global-ribbon-tab { padding: 0 8px; font-size: 8px; }
  .global-ribbon-command { width: 52px; height: 34px; }
  .global-ribbon + .analytical-toolbar { top: calc(var(--app-topbar-height) + var(--global-ribbon-height)); }
  .global-ribbon ~ .workspace-strip { top: calc(var(--app-topbar-height) + var(--global-ribbon-height) + var(--workbench-context-height)); }
  .analytical-toolbar { padding-left: 8px; padding-right: 8px; }
  .toolbar-context-group { overflow-x: auto; }
  .toolbar-command-group { gap: 3px; }
  .command-palette-trigger { width: 27px; padding: 0 6px; }
  .command-palette-trigger strong, .command-palette-trigger kbd { display: none; }
  .workspace-strip-inner { padding: 0 8px; }
  .workspace-tab { padding: 0 8px; }
  .workspace-strip .view-menu { display: none; }
}

@media (max-width: 980px) {
  .shell.explorer-closed { grid-template-columns: 0 minmax(0, 1fr); grid-template-areas: "explorer main" "explorer console"; }
}

@media (max-width: 700px) {
  .shell.explorer-closed { grid-template-columns: 1fr; grid-template-areas: "main" "console"; }
  .shell:not(.explorer-closed) .sidebar {
    display: flex;
    position: fixed;
    top: var(--workbench-chrome-height);
    left: 0;
    bottom: 0;
    z-index: 30;
    width: min(300px, 88vw);
    height: auto;
    box-shadow: 12px 0 30px rgba(20,31,54,.16);
  }
  .shell.explorer-closed .sidebar { display: none; }
}

/* Responsive workbench polish ---------------------------------------------
   Keep the document surface fluid, and let the explorer become an optional
   utility pane instead of permanently consuming canvas space. */
.main {
  container: workspace / inline-size;
  min-width: 0;
}
.shell,
.sidebar,
.main,
.analytical-inspector,
.analytical-console { min-width: 0; }
.shell {
  grid-template-columns:
    minmax(220px, max(220px, min(var(--workbench-explorer-width), 26vw)))
    minmax(0, 1fr)
    minmax(0, min(var(--workbench-inspector-width), 30vw));
}
.sidebar-heading-actions { display: flex; align-items: center; gap: 5px; }
.sidebar-close { display: grid; }
.app-menu-quick-action.explorer-quick-action.active {
  border-color: #b9c5e3;
  background: #eef2ff;
  color: var(--brand-strong);
}
.app-menu-quick-action.explorer-quick-action { display: inline-flex; }
.main[data-layout="grid"] {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr));
  gap: clamp(10px, 1.5vw, 18px);
  padding: clamp(12px, 2vw, 26px) clamp(12px, 2vw, 26px) 40px;
}
.main[data-layout="grid"] .tab[data-window-open="true"] {
  min-width: 0;
  overflow: hidden;
}
.main[data-layout="windowed"] {
  height: 100%;
  min-height: 0;
  padding: clamp(10px, 1.6vw, 20px);
}
.main[data-layout="windowed"] .tab[data-window-open="true"] {
  width: min(650px, calc(100% - 24px));
  min-width: min(430px, calc(100% - 24px));
  max-width: calc(100% - 24px);
  min-height: min(300px, calc(100% - 24px));
  max-height: calc(100% - 24px);
}
.main[data-layout="grid"] .tab[data-window-open="true"],
.main[data-layout="windowed"] .tab[data-window-open="true"] {
  container: app-window / inline-size;
}

@media (max-width: 1100px) and (min-width: 701px) {
  .shell {
    grid-template-columns: minmax(220px, max(220px, min(var(--workbench-explorer-width), 26vw))) minmax(0, 1fr);
    grid-template-areas: "explorer main" "explorer console";
  }
  .shell.explorer-closed {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "main" "console";
  }
  .shell.explorer-closed.inspector-closed {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "main" "console";
  }
  .analytical-inspector {
    position: fixed;
    top: var(--workbench-chrome-height);
    right: 0;
    bottom: 0;
    z-index: 30;
    width: min(320px, 88vw);
    box-shadow: -12px 0 30px rgba(20, 31, 54, .16);
  }
  .shell.inspector-closed .analytical-inspector { display: none; }
}

@container workspace (max-width: 980px) {
  .home-hero { flex-direction: column; }
  .home-status-card { flex-basis: auto; }
  .goal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-secondary-grid,
  .two-column,
  .model-grid,
  .notes-shell,
  .ai-workspace,
  .connector-grid,
  .studio-shell,
  .team-grid,
  .version-grid { grid-template-columns: 1fr; }
  .span-2,
  .team-grid .span-2,
  .version-grid > div:last-child { grid-column: auto; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-workflow-list-panel,
  .ai-results-column { position: static; max-height: none; }
  .notes-list-panel,
  .notes-editor-panel,
  .notes-preview-panel { min-height: 0; }
}

@container workspace (max-width: 620px) {
  .goal-grid,
  .metric-grid,
  .form-grid,
  .form-grid.compact,
  .model-analysis-grid,
  .model-run-summary { grid-template-columns: 1fr; }
  .panel-heading { align-items: flex-start; flex-direction: column; gap: 9px; }
  .panel-heading > .button-row { width: 100%; }
  .panel-heading > .button-row > * { min-width: 0; }
  .home-hero { padding: 18px; }
  .home-hero h1 { font-size: 27px; }
  .tab { max-width: none; }
}

@media (max-width: 700px) {
  html, body { overflow: auto; }
  .shell {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) var(--workbench-console-height);
    grid-template-areas: "main" "console";
    height: calc(100vh - var(--workbench-chrome-height));
    min-height: 0;
  }
  .shell.explorer-closed,
  .shell.inspector-closed,
  .shell.explorer-closed.inspector-closed {
    grid-template-columns: 1fr;
    grid-template-areas: "main" "console";
  }
  .shell.console-closed { grid-template-rows: minmax(0, 1fr); }
  .sidebar { display: none; }
  .shell:not(.explorer-closed) .sidebar {
    display: flex;
    position: fixed;
    top: var(--workbench-chrome-height);
    bottom: 0;
    left: 0;
    z-index: 35;
    width: min(320px, calc(100vw - 28px));
    height: auto;
    max-height: none;
    border-right: 1px solid #2b3650;
    box-shadow: 12px 0 30px rgba(20, 31, 54, .2);
  }
  .sidebar-close { display: grid; }
  .main { padding: 14px 12px 28px; }
  .main[data-layout="grid"] { display: grid; grid-template-columns: 1fr; height: 100%; min-height: 0; overflow: auto; }
  .main[data-layout="windowed"] { display: grid; grid-template-columns: 1fr; height: 100%; min-height: 0; overflow: auto; }
  .main[data-layout="windowed"] .tab[data-window-open="true"] {
    position: relative;
    inset: auto !important;
    width: auto !important;
    height: auto !important;
    min-width: 0;
    min-height: 0;
    max-width: none;
    max-height: none;
    resize: none;
  }
  .main[data-layout="windowed"] .window-chrome { position: static; margin-left: -16px; margin-right: -16px; }
  .window-layout-hint { display: none; }
  .app-menu { min-width: 0; flex: 1 1 auto; overflow: hidden; }
  .app-menu-quick-actions { flex: 0 0 auto; margin-left: auto; }
  .app-menu-quick-actions > #newWorkbook,
  .app-menu-quick-actions > #saveWorkbook,
  .app-menu-quick-actions > #loadWorkbook,
  .app-menu-quick-actions > #workbookCsv { display: none; }
  .app-menu-quick-action.explorer-quick-action { display: inline-flex; }
}

/* Research agent drawers --------------------------------------------------
   The conversation is the primary surface; runs and files are optional
   context panes that can be opened when they are needed. */
.research-agent-panel-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}
.research-drawer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 29px;
  padding: 5px 9px;
  border: 1px solid #cdd7e8;
  border-radius: 7px;
  background: #fff;
  color: #5e6c84;
  cursor: pointer;
  font-size: 9px;
  font-weight: 760;
}
.research-drawer-toggle:hover,
.research-drawer-toggle.active {
  border-color: #aab9e7;
  background: #eef2ff;
  color: #3d4da7;
}
.research-pane-heading-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}
.research-drawer-close {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid #d4ddea;
  border-radius: 6px;
  background: #fff;
  color: #7d899d;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}
.research-drawer-close:hover {
  border-color: #c4cfeb;
  background: #eef2ff;
  color: #3d4da7;
}
#researchAgentWorkspace.research-agent-workspace {
  grid-template-columns: 0 minmax(0, 1fr) 0;
  min-height: 660px;
}
#researchAgentWorkspace.research-agent-workspace .research-conversations,
#researchAgentWorkspace.research-agent-workspace .research-artifact-panel {
  display: none;
}
#researchAgentWorkspace.research-agent-workspace .research-conversations {
  grid-column: 1;
}
#researchAgentWorkspace.research-agent-workspace .research-chat-column {
  grid-column: 2;
}
#researchAgentWorkspace.research-agent-workspace .research-artifact-panel {
  grid-column: 3;
}
#researchAgentWorkspace.research-agent-workspace.conversations-open {
  grid-template-columns: 218px minmax(0, 1fr) 0;
}
#researchAgentWorkspace.research-agent-workspace.artifacts-open {
  grid-template-columns: 0 minmax(0, 1fr) 292px;
}
#researchAgentWorkspace.research-agent-workspace.conversations-open.artifacts-open {
  grid-template-columns: 218px minmax(0, 1fr) 292px;
}
#researchAgentWorkspace.research-agent-workspace.conversations-open .research-conversations,
#researchAgentWorkspace.research-agent-workspace.artifacts-open .research-artifact-panel {
  display: block;
}

@media (max-width: 1150px) and (min-width: 761px) {
  #researchAgentWorkspace.research-agent-workspace.conversations-open {
    grid-template-columns: minmax(180px, 24vw) minmax(0, 1fr) 0;
  }
  #researchAgentWorkspace.research-agent-workspace.artifacts-open {
    grid-template-columns: 0 minmax(0, 1fr) minmax(250px, 30vw);
  }
  #researchAgentWorkspace.research-agent-workspace.conversations-open.artifacts-open {
    grid-template-columns: minmax(180px, 24vw) minmax(0, 1fr) minmax(250px, 30vw);
  }
}

@media (max-width: 900px) {
  .research-agent-panel-tools { justify-content: flex-start; margin-top: 9px; }
}

@media (max-width: 760px) {
  #researchAgentWorkspace.research-agent-workspace {
    display: block;
    min-height: 0;
    overflow: visible;
  }
  #researchAgentWorkspace.research-agent-workspace.conversations-open .research-conversations,
  #researchAgentWorkspace.research-agent-workspace.artifacts-open .research-artifact-panel {
    display: block;
  }
  #researchAgentWorkspace.research-agent-workspace .research-conversations,
  #researchAgentWorkspace.research-agent-workspace .research-artifact-panel {
    border: 0;
  }
  #researchAgentWorkspace.research-agent-workspace.conversations-open .research-conversations {
    border-bottom: 1px solid var(--line);
  }
  #researchAgentWorkspace.research-agent-workspace.artifacts-open .research-artifact-panel {
    border-top: 1px solid var(--line);
  }
  .research-agent-panel-tools { gap: 5px; }
  .research-agent-panel-tools .badge { margin-right: 2px; }
}

@container app-window (max-width: 900px) {
  #researchAgentWorkspace.research-agent-workspace {
    display: block;
    min-height: 0;
    overflow: visible;
  }
  #researchAgentWorkspace.research-agent-workspace .research-conversations,
  #researchAgentWorkspace.research-agent-workspace .research-chat-column,
  #researchAgentWorkspace.research-agent-workspace .research-artifact-panel {
    grid-column: auto;
  }
  #researchAgentWorkspace.research-agent-workspace.conversations-open .research-conversations,
  #researchAgentWorkspace.research-agent-workspace.artifacts-open .research-artifact-panel {
    display: block;
  }
  #researchAgentWorkspace.research-agent-workspace .research-conversations,
  #researchAgentWorkspace.research-agent-workspace .research-artifact-panel {
    border-left: 0;
    border-right: 0;
  }
  #researchAgentWorkspace.research-agent-workspace.conversations-open .research-conversations {
    border-bottom: 1px solid var(--line);
  }
  #researchAgentWorkspace.research-agent-workspace.artifacts-open .research-artifact-panel {
    border-top: 1px solid var(--line);
  }
  .research-chat-header {
    display: block;
  }
  .research-chat-header-actions {
    justify-content: flex-start;
    margin-top: 8px;
  }
  .research-composer-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* AI research workspace: conversation first, progressive disclosure second */
#tab-ai .research-window-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}
#tab-ai .research-window-heading h1 { margin: 0; color: #263553; font-size: 20px; letter-spacing: -.02em; }
#tab-ai .research-window-heading p:not(.eyebrow) { max-width: 700px; margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.research-window-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
#tab-ai .research-agent-panel { margin-bottom: 12px; }
#tab-ai .research-agent-panel > .panel-heading { padding-bottom: 10px; }
.research-agent-capability { color: var(--muted); font-size: 9px; white-space: nowrap; }

#researchAgentWorkspace.research-agent-workspace {
  grid-template-columns: 238px minmax(0, 1fr) 0;
  height: clamp(540px, 72vh, 790px);
  min-height: 0;
  margin-top: 0;
  border-radius: 8px;
}
#researchAgentWorkspace.research-agent-workspace .research-conversations,
#researchAgentWorkspace.research-agent-workspace .research-artifact-panel { display: block; min-height: 0; overflow: hidden; }
#researchAgentWorkspace.research-agent-workspace .research-conversations { grid-column: 1; }
#researchAgentWorkspace.research-agent-workspace .research-chat-column { grid-column: 2; min-height: 0; }
#researchAgentWorkspace.research-agent-workspace .research-artifact-panel { grid-column: 3; display: none; }
#researchAgentWorkspace.research-agent-workspace.artifacts-open { grid-template-columns: 0 minmax(0, 1fr) 340px; }
#researchAgentWorkspace.research-agent-workspace.conversations-open.artifacts-open { grid-template-columns: 238px minmax(0, 1fr) 340px; }
#researchAgentWorkspace.research-agent-workspace:not(.conversations-open) { grid-template-columns: 0 minmax(0, 1fr) 0; }
#researchAgentWorkspace.research-agent-workspace.conversations-open .research-conversations { display: block; }
#researchAgentWorkspace.research-agent-workspace.artifacts-open .research-artifact-panel { display: block; }
#researchAgentWorkspace.research-agent-workspace:not(.conversations-open) .research-conversations { display: none; }
#researchAgentWorkspace.research-agent-workspace:not(.artifacts-open) .research-artifact-panel { display: none; }

.research-chat-header { min-height: 62px; padding: 12px 16px; }
.research-chat-header-actions { max-width: 470px; }
.research-chat-header-actions .research-agent-status { font-weight: 750; }
.research-live-progress { margin: 10px clamp(18px, 5vw, 74px) 0; }
.research-chat-timeline { max-height: none; min-height: 0; padding: 22px clamp(18px, 5vw, 74px); gap: 16px; }
.research-chat-message { max-width: min(760px, 92%); padding: 12px 15px; border-radius: 12px; }
.research-chat-message.user { border-bottom-right-radius: 4px; }
.research-chat-message.assistant { border-bottom-left-radius: 4px; background: #f5f7fb; }
.research-chat-message-body { font-size: 11px; line-height: 1.58; }
.research-chat-message-body table { display: block; max-width: 100%; overflow: auto; border-collapse: collapse; font-size: 9px; }
.research-chat-message-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.research-copy-button { border: 0; padding: 2px 0; background: transparent; color: #536cba; cursor: pointer; font-size: 8px; font-weight: 750; }
.research-copy-button:hover { color: #354aab; text-decoration: underline; }

.research-chat-activity { width: min(760px, 92%); align-self: flex-start; border: 1px solid #dce2ef; border-radius: 10px; background: #fafbfe; }
.research-chat-activity.failed { border-color: #efbdc2; background: #fff8f8; }
.research-chat-activity > summary { display: flex; align-items: center; gap: 9px; padding: 10px 12px; color: #425170; cursor: pointer; list-style: none; }
.research-chat-activity > summary::-webkit-details-marker { display: none; }
.research-activity-icon { display: grid; width: 21px; height: 21px; place-items: center; border-radius: 50%; background: #e8edff; color: #4d63c0; font-size: 10px; font-weight: 800; }
.research-chat-activity.failed .research-activity-icon { background: #ffe2e4; color: #b34a54; }
.research-activity-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 2px; }
.research-activity-copy strong { font-size: 10px; }
.research-activity-copy small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.research-chat-activity-items { display: flex; flex-direction: column; gap: 6px; padding: 0 10px 10px; }
.research-tool-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 8px 9px; border: 1px solid #e0e5ef; border-radius: 7px; background: #fff; }
.research-tool-row.failed { border-color: #efbdc2; background: #fff7f7; }
.research-tool-row-copy { min-width: 0; flex: 1; }
.research-tool-row-copy strong, .research-tool-row-copy span, .research-tool-row-copy small { display: block; overflow: hidden; text-overflow: ellipsis; }
.research-tool-row-copy strong { color: #344568; font-size: 9px; }
.research-tool-row-copy span { margin-top: 2px; color: #54627d; font-size: 9px; }
.research-tool-row-copy small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.research-tool-row-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.research-tool-row-actions details { position: relative; }
.research-tool-row-actions details summary { color: #536cba; cursor: pointer; font-size: 8px; }
.research-tool-row-actions pre { position: absolute; z-index: 2; width: min(480px, 60vw); max-height: 260px; overflow: auto; margin: 5px 0 0 -340px; padding: 9px; border-radius: 7px; background: #1c2434; color: #dce4f7; font: 8px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.research-log-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 8px 9px; border: 1px solid #e0e5ef; border-radius: 7px; background: #fff; }
.research-log-row.warning { border-color: #ead6a5; background: #fffdf5; }
.research-log-row.error { border-color: #efbdc2; background: #fff7f7; }
.research-log-row-copy { min-width: 0; flex: 1; }
.research-log-row-copy strong, .research-log-row-copy span, .research-log-row-copy small { display: block; overflow: hidden; text-overflow: ellipsis; }
.research-log-row-copy strong { color: #344568; font-size: 9px; }
.research-log-row-copy span { margin-top: 2px; color: #54627d; font-size: 9px; }
.research-log-row-copy small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.research-log-row details { position: relative; flex-shrink: 0; }
.research-log-row details summary { color: #536cba; cursor: pointer; font-size: 8px; }
.research-log-row pre { position: absolute; z-index: 2; right: 0; width: min(480px, 60vw); max-height: 300px; overflow: auto; margin: 5px 0 0; padding: 9px; border-radius: 7px; background: #1c2434; color: #dce4f7; font: 8px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

.research-chat-composer { padding: 12px clamp(14px, 4vw, 58px) 14px; }
.research-composer-label { color: #425170; font-size: 10px; font-weight: 750; }
.research-chat-composer textarea { min-height: 74px; max-height: 180px; margin-top: 6px; border-radius: 10px; font-size: 11px; }
.research-composer-toolbar { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 8px; }
.research-mode-chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px; border: 1px solid #cbd5f1; border-radius: 999px; background: #f0f3ff; color: #3e51a5; font-size: 9px; font-weight: 800; }
.research-compact-field { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 8px; font-weight: 750; }
.research-compact-field select { width: auto; min-width: 88px; height: 28px; padding: 4px 22px 4px 7px; font-size: 9px; }
.research-agent-settings { position: relative; margin-left: auto; }
.research-agent-settings > summary { padding: 6px 8px; border: 1px solid #d4ddea; border-radius: 6px; background: #fff; color: #536cba; cursor: pointer; font-size: 9px; font-weight: 750; list-style: none; }
.research-agent-settings > summary::-webkit-details-marker { display: none; }
.research-settings-grid { position: absolute; z-index: 4; right: 0; bottom: calc(100% + 7px); display: grid; grid-template-columns: repeat(3, minmax(110px, 1fr)); gap: 8px; width: min(560px, 75vw); padding: 12px; border: 1px solid #cfd7e7; border-radius: 9px; background: #fff; box-shadow: 0 10px 28px rgba(31,45,77,.16); }
.research-settings-grid label { min-width: 0; color: #52617a; font-size: 8px; font-weight: 750; }
.research-settings-grid input { margin-top: 4px; font-size: 9px; }
.research-settings-grid .span-3 { grid-column: 1 / -1; }
.research-settings-grid .helper-text { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; font-weight: 400; }
.research-agent-actions { align-items: center; margin-top: 10px; }
.research-agent-actions .helper-inline { margin-left: 3px; }

.research-artifact-panel { padding: 12px; }
.research-artifact-tabs { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.research-artifact-tab { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.research-artifact-panel-content { min-height: 0; max-height: none; padding-right: 2px; }
.research-map { display: grid; gap: 8px; }
.research-map-section { padding: 9px; border: 1px solid var(--line); border-radius: 7px; background: #fbfcff; }
.research-map-section strong { display: block; color: #344568; font-size: 9px; }
.research-map-section p { margin: 5px 0 3px; font-size: 10px; line-height: 1.45; }
.research-map-section small { color: var(--muted); font-size: 8px; }
.research-map-section ul { margin: 6px 0 0 15px; padding: 0; color: #53627d; font-size: 9px; line-height: 1.45; }
.research-map-score { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 7px; }
.research-map-score span { display: flex; justify-content: space-between; padding: 5px 6px; border-radius: 5px; background: #f0f3fa; color: #53627d; font-size: 8px; }
.research-map-score b { color: #344568; }
.legacy-ai-workflows { margin-top: 14px; border: 1px solid var(--line); border-radius: 9px; background: #fafbfe; }
.legacy-ai-workflows > summary { padding: 11px 13px; color: #53627d; cursor: pointer; font-size: 10px; font-weight: 800; list-style: none; }
.legacy-ai-workflows > summary::-webkit-details-marker { display: none; }
.legacy-ai-workflows > summary::before { content: '▸'; display: inline-block; margin-right: 7px; transition: transform .15s ease; }
.legacy-ai-workflows[open] > summary::before { transform: rotate(90deg); }
.legacy-ai-workflow-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 13px 12px; color: var(--muted); font-size: 9px; }
.legacy-ai-workflows .ai-workspace { margin: 0 13px 13px; }

@media (max-width: 1150px) and (min-width: 761px) {
  #researchAgentWorkspace.research-agent-workspace.artifacts-open { grid-template-columns: 0 minmax(0, 1fr) minmax(280px, 31vw); }
  #researchAgentWorkspace.research-agent-workspace.conversations-open.artifacts-open { grid-template-columns: minmax(190px, 24vw) minmax(0, 1fr) minmax(280px, 31vw); }
  .research-settings-grid { width: min(500px, 70vw); }
}
@media (max-width: 760px) {
  #tab-ai .research-window-heading { display: block; }
  .research-window-actions { justify-content: flex-start; margin-top: 10px; }
  #researchAgentWorkspace.research-agent-workspace,
  #researchAgentWorkspace.research-agent-workspace.conversations-open,
  #researchAgentWorkspace.research-agent-workspace.artifacts-open,
  #researchAgentWorkspace.research-agent-workspace.conversations-open.artifacts-open { display: block; height: auto; min-height: 0; }
  #researchAgentWorkspace.research-agent-workspace .research-conversations,
  #researchAgentWorkspace.research-agent-workspace .research-artifact-panel { display: none; max-height: 260px; overflow: auto; }
  #researchAgentWorkspace.research-agent-workspace.conversations-open .research-conversations,
  #researchAgentWorkspace.research-agent-workspace.artifacts-open .research-artifact-panel { display: block; }
  #researchAgentWorkspace.research-agent-workspace .research-chat-column { min-height: 680px; }
  .research-chat-header-actions { justify-content: flex-start; margin-top: 8px; }
  .research-chat-timeline { min-height: 340px; padding: 16px 12px; }
  .research-live-progress { margin: 8px 12px 0; }
  .research-chat-message, .research-chat-activity { max-width: 96%; }
  .research-agent-settings { margin-left: 0; }
  .research-settings-grid { position: static; width: auto; margin-top: 7px; box-shadow: none; }
  .legacy-ai-workflow-toolbar { display: block; }
  .legacy-ai-workflow-toolbar .button-row { margin-top: 8px; }
}

/* Research window scrolling: keep the chat reachable and make nested panels usable. */
#tab-ai.tab[data-window-open="true"] {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: scroll;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
}
#tab-ai.tab[data-window-open="true"] > .research-window-heading,
#tab-ai.tab[data-window-open="true"] > .research-agent-panel,
#tab-ai.tab[data-window-open="true"] > .legacy-ai-workflows {
  flex: 0 0 auto;
}
#tab-ai .research-agent-panel { min-height: 0; }
#researchAgentWorkspace.research-agent-workspace {
  min-height: 0;
  overflow: visible;
}
#researchAgentWorkspace.research-agent-workspace .research-conversations {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
#researchAgentWorkspace.research-agent-workspace .research-chat-column {
  min-height: 0;
  overflow: hidden;
}
#researchAgentWorkspace.research-agent-workspace .research-artifact-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}
#researchAgentWorkspace.research-agent-workspace.artifacts-open .research-artifact-panel {
  display: flex;
}
#researchAgentWorkspace.research-agent-workspace .research-conversation-list,
#researchAgentWorkspace.research-agent-workspace .research-chat-timeline,
#researchAgentWorkspace.research-agent-workspace .research-artifact-panel-content {
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #aab7d7 transparent;
}
#researchAgentWorkspace.research-agent-workspace .research-conversation-list,
#researchAgentWorkspace.research-agent-workspace .research-chat-timeline,
#researchAgentWorkspace.research-agent-workspace .research-artifact-panel-content {
  overscroll-behavior: contain;
}
#researchAgentWorkspace.research-agent-workspace .research-artifact-panel-content {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
}
#tab-ai.tab[data-window-open="true"],
#researchAgentWorkspace.research-agent-workspace .research-conversation-list,
#researchAgentWorkspace.research-agent-workspace .research-chat-timeline,
#researchAgentWorkspace.research-agent-workspace .research-artifact-panel-content {
  scrollbar-width: thin;
  scrollbar-color: #aab7d7 transparent;
}
#tab-ai.tab[data-window-open="true"]::-webkit-scrollbar,
#researchAgentWorkspace.research-agent-workspace .research-conversation-list::-webkit-scrollbar,
#researchAgentWorkspace.research-agent-workspace .research-chat-timeline::-webkit-scrollbar,
#researchAgentWorkspace.research-agent-workspace .research-artifact-panel-content::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
#tab-ai.tab[data-window-open="true"]::-webkit-scrollbar-thumb,
#researchAgentWorkspace.research-agent-workspace .research-conversation-list::-webkit-scrollbar-thumb,
#researchAgentWorkspace.research-agent-workspace .research-chat-timeline::-webkit-scrollbar-thumb,
#researchAgentWorkspace.research-agent-workspace .research-artifact-panel-content::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 8px;
  background: #aab7d7;
  background-clip: padding-box;
}

@media (max-width: 760px) {
  #tab-ai.tab[data-window-open="true"] { display: block; overflow-y: auto; }
  #researchAgentWorkspace.research-agent-workspace .research-artifact-panel { display: block; overflow: auto; }
  #researchAgentWorkspace.research-agent-workspace .research-artifact-panel-content { max-height: 260px; }
}

/* Readable density pass ---------------------------------------------------
   The compact workbench had drifted toward 7–10px text and oversized gaps.
   Keep the canvas dense, but make labels, controls, and supporting copy
   readable at normal zoom. */
body {
  font-size: 14px;
  line-height: 1.4;
}
body .topbar {
  gap: 8px;
  padding: 0 10px;
}
body .app-menu-menu > summary,
body .app-menu-command,
body .app-menu-layout-option,
body .app-menu-objects-popover .workspace-tab { font-size: 10px; }
body .app-menu-section-label { font-size: 8px; }
body .app-menu-status { font-size: 9px; }
body .app-menu-quick-action { font-size: 9px; }
body .top-actions .top-button { font-size: 9px; }
body .top-actions .badge { font-size: 9px; }
body .global-ribbon-tab,
body .global-ribbon-command,
body .global-ribbon-label,
body .global-ribbon-mini { font-size: 9px; }
body .global-ribbon-command { height: 38px; }
body .analytical-toolbar label,
body .toolbar-advanced-context summary,
body .compact-action,
body .workspace-context-toggle { font-size: 10px; }
body .analytical-toolbar select,
body .analytical-toolbar input { font-size: 10px; }
body .workspace-tab,
body .workspace-strip-meta { font-size: 10px; }

body .main { padding: 16px 18px 28px; }
body .main[data-layout="grid"] {
  gap: 12px;
  padding: 16px 18px 28px;
}
body .main[data-layout="windowed"] { padding: 12px; }
body .page-heading {
  gap: 14px;
  padding-bottom: 14px;
  margin-bottom: 14px;
}
body .eyebrow { font-size: 11px; margin-bottom: 5px; }
body .page-heading h1 { font-size: 31px; }
body .page-heading p:not(.eyebrow) { font-size: 14px; margin-top: 6px; }
body .button-row { gap: 6px; }
body .button { padding: 7px 11px; font-size: 13px; }
body .button.small { padding: 6px 9px; font-size: 12px; }
body .badge { padding: 4px 8px; font-size: 11px; }
body .metric-grid { gap: 9px; margin-bottom: 10px; }
body .metric-card { padding: 11px 12px; }
body .metric-card span { font-size: 11px; }
body .metric-card strong { margin-top: 4px; font-size: 22px; }
body .two-column,
body .model-grid { gap: 10px; }
body .panel { padding: 14px; }
body .panel h2 { margin-bottom: 9px; font-size: 17px; }
body .panel-heading { gap: 10px; margin-bottom: 9px; }
body .panel-heading p { margin-top: 3px; font-size: 12px; }
body table { font-size: 12px; }
body th,
body td { padding: 6px 8px; }
body .form-grid { gap: 9px; margin-bottom: 10px; }
body .form-grid label,
body .login-dialog label { font-size: 12px; }
body .form-grid input,
body .form-grid textarea,
body .form-grid select,
body textarea,
body input,
body select { padding: 7px 8px; margin-top: 4px; font-size: 13px; }
body .helper { margin-top: 9px; padding: 8px; font-size: 12px; }
body .result-box { padding: 10px; font-size: 13px; }
body .result-grid { gap: 7px; }
body .result-stat { padding: 8px; }
body .result-stat span { font-size: 11px; }
body .result-stat strong { margin-top: 3px; font-size: 16px; }
body .chip-row { gap: 5px; margin-bottom: 6px; }
body .chip { padding: 4px 7px; font-size: 11px; }
body .plan-output { gap: 7px; }
body .plan-step { padding: 10px; }
body .timeline-item { gap: 10px; padding: 8px 4px; font-size: 12px; }
body .stat-grid { gap: 7px; }
body .stat-grid > div { padding: 8px; }
body .stat-grid span { font-size: 11px; }
body .stat-grid strong { margin-top: 3px; font-size: 13px; }

body .sidebar { gap: 12px; padding: 10px 8px 8px; }
body .sidebar-heading { margin-bottom: 8px; }
body .sidebar-heading strong { font-size: 12px; }
body .sidebar-kicker,
body .nav-section-label { font-size: 10px; }
body .dataset-item { padding: 8px; }
body .dataset-item strong { font-size: 12px; }
body .dataset-item span { margin-top: 3px; font-size: 11px; }
body .dataset-dropzone { padding: 7px 8px; font-size: 11px; }
body .nav { gap: 4px; }
body .nav-item { gap: 6px; padding: 7px 8px; font-size: 11px; }
body .nav-icon { font-size: 13px; }
body .sidebar-footer { padding-top: 7px; }
body .mini-label { font-size: 9px; }
body .sidebar-footer strong { font-size: 11px; }
body .sidebar-status { margin-top: 6px; font-size: 10px; }
body .object-group-heading strong { font-size: 10px; }
body .object-group-heading span:last-child,
body .object-tree-meta { font-size: 9px; }
body .object-tree-item { padding: 4px 6px 4px 9px; }
body .object-tree-label { font-size: 11px; }
body .explorer-loading { padding: 10px 8px; font-size: 11px; }

body .ai-workspace { gap: 10px; }
body .ai-main-column { gap: 10px; }
body .helper-inline { font-size: 12px; }
body .workflow-list { gap: 5px; }
body .workflow-list-item { padding: 8px; }
body .workflow-list-item strong { font-size: 12px; }
body .workflow-list-item span { margin-top: 3px; font-size: 10px; }
body .workflow-list-item small { margin-top: 4px; font-size: 10px; }
body .workflow-conversation { gap: 7px; }
body .workflow-message { padding: 8px 10px; }
body .workflow-message strong { font-size: 10px; }
body .workflow-message p { margin: 4px 0; font-size: 12px; }
body .workflow-message span { font-size: 10px; }
body .workflow-refine-row { gap: 6px; margin-top: 9px; }
body .workflow-steps { gap: 8px; }
body .workflow-step { padding: 10px; }
body .workflow-step-top strong { font-size: 12px; }
body .workflow-step-top code { font-size: 10px; }
body .step-summary,
body .step-error { padding: 7px; margin-top: 7px; font-size: 12px; }
body .ai-results-column h3 { font-size: 12px; margin: 10px 0 5px; }
body .ai-results-column ul { font-size: 12px; }
body .step-result-heading span { font-size: 10px; }

body .research-agent-workspace { margin-top: 10px; }
body .research-conversations,
body .research-artifact-panel { padding: 10px; }
body .research-pane-heading { gap: 6px; margin-bottom: 8px; }
body .research-pane-heading h3,
body .research-chat-header h3 { font-size: 16px; }
body .research-pane-heading p,
body .research-chat-header p { margin-top: 2px; font-size: 12px; }
body .research-conversation-list { gap: 5px; }
body .research-conversation-item { padding: 7px 8px; }
body .research-conversation-item strong { font-size: 12px; }
body .research-conversation-item span,
body .research-conversation-item small { margin-top: 3px; font-size: 10px; }
body .research-chat-header { gap: 9px; padding: 10px 12px; }
body .research-chat-header-actions { gap: 4px; }
body .research-chat-header-actions .research-agent-status { padding: 5px 7px; font-size: 11px; }
body .research-chat-timeline { gap: 8px; padding: 12px; }
body .research-chat-message { padding: 8px 10px; }
body .research-chat-message-label { margin-bottom: 3px; font-size: 10px; }
body .research-chat-message-body { font-size: 13px; }
body .research-chat-message small,
body .research-chat-tool small { margin-top: 4px; font-size: 10px; }
body .research-chat-tool { padding: 8px 9px; }
body .research-chat-tool-heading strong { font-size: 12px; }
body .research-chat-tool p { margin: 4px 0 0; font-size: 11px; }
body .research-chat-tool summary { font-size: 10px; }
body .research-chat-tool pre { font-size: 10px; }
body .research-chat-composer { padding: 10px 12px 12px; }
body .research-composer-options { gap: 5px; margin-top: 6px; }
body .research-composer-options label,
body .research-advanced-options label { font-size: 12px; }
body .research-advanced-options { margin-top: 7px; padding: 7px 8px; }
body .research-advanced-options summary { font-size: 11px; }
body .research-advanced-options .helper-text { margin-top: 2px; font-size: 10px; }
body .research-agent-actions { margin-top: 9px; }
body .research-drawer-toggle { padding: 5px 8px; font-size: 11px; }
body .research-drawer-close { font-size: 17px; }
body .research-artifact-tabs { margin-bottom: 8px; }
body .research-artifact-tab { padding: 5px 3px; font-size: 11px; }
body .research-file-card { padding: 8px; }
body .research-file-card strong { font-size: 11px; }
body .research-file-card small,
body .research-source-link small { margin-top: 2px; font-size: 10px; }
body .research-source-link { padding: 8px; }
body .research-report-actions { gap: 5px; margin-top: 8px; }

body .notes-shell { gap: 10px; }
body .notes-list-panel,
body .notes-editor-panel,
body .notes-preview-panel { padding: 13px; }
body .notes-list-heading h2 { font-size: 17px; }
body .notes-list { gap: 5px; margin-top: 9px; }
body .notes-list-item { gap: 7px; padding: 7px; }
body .notes-list-item-copy strong { font-size: 12px; }
body .notes-list-item-copy small { margin-top: 2px; font-size: 10px; }
body .notes-list-help { margin-top: 9px; padding-top: 8px; font-size: 11px; }
body .notes-toolbar { gap: 4px; margin: 8px 0 6px; padding: 4px; }
body .notes-tool { padding: 3px 8px; font-size: 11px; }
body .notes-editor-footer { gap: 8px; margin-top: 6px; font-size: 10px; }
body .markdown-preview { font-size: 13px; }
body .markdown-preview table { font-size: 11px; }
body .markdown-preview th { font-size: 10px; }

body .code-output,
body .editor,
body .console-transcript,
body .console-input-row textarea,
body .studio-output pre { font-size: 11px; }

@media (max-width: 700px) {
  body .app-menu-menu > summary { padding: 0 5px; font-size: 8px; }
  body .app-menu-objects-menu > summary { font-size: 0; }
  body .app-menu-objects-menu > summary .menu-command-icon { font-size: 12px; }
  body .app-menu-quick-action { font-size: 8px; }
  body .global-ribbon-tab { font-size: 8px; }
  body .research-artifact-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Larger type with tighter whitespace ------------------------------------ */
body { font-size: 15px; line-height: 1.35; }
body .main { padding: 12px 14px 22px; }
body .main[data-layout="grid"] { gap: 8px; padding: 12px 14px 22px; }
body .main[data-layout="windowed"] { padding: 9px; }
body .home-hero { gap: 14px; padding: 16px 18px; margin-bottom: 14px; }
body .home-hero h1 { font-size: 36px; }
body .home-hero p:not(.eyebrow) { margin-top: 6px; font-size: 15px; line-height: 1.4; }
body .home-section { margin-bottom: 14px; }
body .section-heading { gap: 10px; margin-bottom: 7px; }
body .section-heading h2 { font-size: 19px; }
body .goal-grid { gap: 8px; }
body .goal-card { min-height: 146px; padding: 12px; }
body .goal-icon { width: 30px; height: 30px; margin-bottom: 9px; }
body .goal-card strong { font-size: 14px; }
body .goal-card > span:not(.goal-icon) { margin-top: 5px; font-size: 12px; line-height: 1.35; }
body .goal-card b { padding-top: 9px; font-size: 11px; }
body .home-secondary-grid { gap: 9px; }
body .home-checklist { padding: 11px; }
body .checklist-item { gap: 8px; padding: 7px 2px; }
body .checklist-item strong { font-size: 12px; }
body .checklist-item small { margin-top: 2px; font-size: 11px; }
body .page-heading { gap: 10px; padding-bottom: 10px; margin-bottom: 10px; }
body .eyebrow { font-size: 12px; margin-bottom: 4px; }
body .page-heading h1 { font-size: 34px; }
body .page-heading p:not(.eyebrow) { font-size: 15px; line-height: 1.4; margin-top: 4px; }
body .button-row { gap: 5px; }
body .button { padding: 6px 10px; font-size: 14px; }
body .button.small { padding: 5px 8px; font-size: 13px; }
body .badge { padding: 3px 7px; font-size: 12px; }
body .metric-grid { gap: 7px; margin-bottom: 8px; }
body .metric-card { padding: 9px 10px; }
body .metric-card span { font-size: 12px; }
body .metric-card strong { margin-top: 3px; font-size: 23px; }
body .two-column,
body .model-grid { gap: 8px; }
body .panel { padding: 11px; }
body .panel h2 { margin-bottom: 7px; font-size: 18px; }
body .panel-heading { gap: 8px; margin-bottom: 7px; }
body .panel-heading p { margin-top: 2px; font-size: 13px; }
body table { font-size: 13px; }
body th,
body td { padding: 5px 7px; }
body .form-grid { gap: 7px; margin-bottom: 8px; }
body .form-grid label,
body .login-dialog label { font-size: 13px; }
body .form-grid input,
body .form-grid textarea,
body .form-grid select,
body textarea,
body input,
body select { padding: 6px 7px; margin-top: 3px; font-size: 14px; }
body .helper { margin-top: 7px; padding: 7px; font-size: 13px; line-height: 1.35; }
body .result-box { padding: 8px; font-size: 14px; }
body .result-grid { gap: 6px; }
body .result-stat { padding: 7px; }
body .result-stat span { font-size: 12px; }
body .result-stat strong { margin-top: 2px; font-size: 17px; }
body .chip-row { gap: 4px; margin-bottom: 5px; }
body .chip { padding: 3px 6px; font-size: 12px; }
body .plan-output { gap: 6px; }
body .plan-step { padding: 8px; }
body .timeline-item { gap: 8px; padding: 6px 3px; font-size: 13px; }
body .stat-grid { gap: 6px; }
body .stat-grid > div { padding: 7px; }
body .stat-grid span { font-size: 12px; }
body .stat-grid strong { margin-top: 2px; font-size: 14px; }
body .sidebar { gap: 8px; padding: 8px 6px 6px; }
body .sidebar-heading { margin-bottom: 6px; }
body .sidebar-heading strong { font-size: 13px; }
body .sidebar-kicker,
body .nav-section-label { font-size: 11px; }
body .dataset-item { padding: 6px 7px; }
body .dataset-item strong { font-size: 13px; }
body .dataset-item span { margin-top: 2px; font-size: 12px; }
body .dataset-dropzone { padding: 6px 7px; font-size: 12px; }
body .nav { gap: 3px; }
body .nav-item { gap: 5px; padding: 6px 7px; font-size: 12px; }
body .nav-icon { font-size: 14px; }
body .sidebar-footer { padding-top: 6px; }
body .mini-label { font-size: 10px; }
body .sidebar-footer strong { font-size: 12px; }
body .sidebar-status { margin-top: 5px; font-size: 11px; }
body .object-tree-item { padding: 3px 5px 3px 8px; }
body .object-tree-label { font-size: 12px; }
body .explorer-loading { padding: 8px 7px; font-size: 12px; }
body .ai-workspace,
body .ai-main-column { gap: 8px; }
body .workflow-list { gap: 4px; }
body .workflow-list-item { padding: 6px; }
body .workflow-list-item strong { font-size: 13px; }
body .workflow-list-item span,
body .workflow-list-item small { margin-top: 2px; font-size: 11px; }
body .workflow-conversation { gap: 6px; }
body .workflow-message { padding: 7px 8px; }
body .workflow-message strong { font-size: 11px; }
body .workflow-message p { margin: 3px 0; font-size: 13px; }
body .workflow-message span { font-size: 11px; }
body .workflow-refine-row { gap: 5px; margin-top: 7px; }
body .workflow-steps { gap: 6px; }
body .workflow-step { padding: 8px; }
body .workflow-step-top strong { font-size: 13px; }
body .workflow-step-top code { font-size: 11px; }
body .step-summary,
body .step-error { padding: 6px; margin-top: 6px; font-size: 13px; }
body .ai-results-column h3 { font-size: 13px; margin: 8px 0 4px; }
body .ai-results-column ul { font-size: 13px; }
body .step-result-heading span { font-size: 11px; }
body .notes-shell { gap: 8px; }
body .notes-list-panel,
body .notes-editor-panel,
body .notes-preview-panel { padding: 10px; }
body .notes-list { gap: 4px; margin-top: 7px; }
body .notes-list-item { gap: 6px; padding: 6px; }
body .notes-list-item-copy strong { font-size: 13px; }
body .notes-list-item-copy small { margin-top: 1px; font-size: 11px; }
body .notes-list-help { margin-top: 7px; padding-top: 6px; font-size: 12px; }
body .notes-toolbar { gap: 3px; margin: 6px 0 4px; padding: 3px; }
body .notes-tool { padding: 2px 6px; font-size: 12px; }
body .notes-editor-footer { gap: 6px; margin-top: 5px; font-size: 11px; }
body .markdown-preview { font-size: 14px; }
body .markdown-preview table { font-size: 12px; }
body .markdown-preview th { font-size: 11px; }
body .code-output,
body .editor,
body .console-transcript,
body .console-input-row textarea,
body .studio-output pre { font-size: 12px; }

body .dataset-item-row,
body .object-tree-item-row { display: flex; align-items: stretch; gap: 3px; min-width: 0; }
body .dataset-item-row .dataset-item,
body .object-tree-item-row .object-tree-item { flex: 1 1 auto; min-width: 0; width: auto; }
body .dataset-delete-action,
body .object-delete-action {
  flex: 0 0 auto;
  width: 25px;
  min-height: 25px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #9aa6bd;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
body .dataset-delete-action:hover,
body .object-delete-action:hover {
  border-color: #7b3e50;
  background: #3a2333;
  color: #ffb8c4;
}
body .object-delete-action { align-self: center; width: 23px; min-height: 23px; font-size: 15px; }

@media (max-width: 700px) {
  body .main,
  body .main[data-layout="grid"],
  body .main[data-layout="windowed"] { padding: 10px 8px 16px; }
  body .home-hero { gap: 10px; padding: 12px; }
  body .home-hero h1,
  body .page-heading h1 { font-size: 29px; }
  body .page-heading { padding-bottom: 8px; margin-bottom: 8px; }
  body .panel { padding: 9px; }
  body .panel h2 { font-size: 17px; }
  body .button { padding: 5px 8px; font-size: 13px; }
  body .button.small { padding: 4px 7px; font-size: 12px; }
  body .form-grid,
  body .form-grid.compact { gap: 6px; }
  body .form-grid label,
  body .login-dialog label { font-size: 12px; }
  body .form-grid input,
  body .form-grid textarea,
  body .form-grid select,
  body textarea,
  body input,
  body select { padding: 6px; font-size: 13px; }
  body .page-heading p:not(.eyebrow),
body .home-hero p:not(.eyebrow) { font-size: 14px; }
}

/* Final Phase 19 chrome overrides live last so legacy phase styles cannot
   re-expand the old module navigation. */
:root { --global-ribbon-height: 52px; }
.global-ribbon-tabs { display: none; }
.global-ribbon-body { height: var(--global-ribbon-height); }
body .sidebar-section.grow { max-height: 470px; }
body .badge.warning { background: #fff0d8; color: #925f19; }
body .nav { gap: 6px; }
body .nav-experiences { display: grid; grid-template-columns: 1fr; gap: 4px; }
body .nav-modes,
body .nav-secondary,
body .sidebar-advanced .nav-section { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; }
body .nav-secondary .nav-section-label { grid-column: 1 / -1; }

@media (max-width: 700px) {
  :root { --global-ribbon-height: 52px; }
}
