:root {
  --canvas: #eef1f3;
  --surface: #ffffff;
  --surface-soft: #f6f8f9;
  --surface-strong: #e6ebed;
  --ink: #172126;
  --ink-soft: #526168;
  --ink-muted: #7b898f;
  --line: #dce3e5;
  --teal: #087f73;
  --teal-deep: #075f58;
  --teal-soft: #d9f0ec;
  --blue: #2759cc;
  --blue-soft: #e4ecff;
  --amber: #d6901f;
  --amber-soft: #fff1d5;
  --coral: #d65745;
  --coral-soft: #ffebe7;
  --violet: #7459a8;
  --shadow: 0 12px 28px rgba(30, 48, 54, 0.08);
  --sidebar-width: 232px;
  --rail-width: 276px;
  --radius: 6px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family:
    "IBM Plex Sans", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(39, 89, 204, 0.2);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--rail-width);
  height: 100vh;
}

.app-shell.sidebar-collapsed {
  --sidebar-width: 68px;
}

.app-shell.sidebar-collapsed .brand-copy,
.app-shell.sidebar-collapsed .project-switcher > span:nth-child(2),
.app-shell.sidebar-collapsed .project-switcher > svg,
.app-shell.sidebar-collapsed .nav-item > span,
.app-shell.sidebar-collapsed .nav-label,
.app-shell.sidebar-collapsed .service-indicator {
  display: none;
}

.app-shell.sidebar-collapsed .brand,
.app-shell.sidebar-collapsed .project-switcher,
.app-shell.sidebar-collapsed .nav-item,
.app-shell.sidebar-collapsed .sidebar-footer {
  justify-content: center;
}

.app-shell.sidebar-collapsed .project-switcher {
  display: flex;
  padding: 8px;
}

.app-shell.sidebar-collapsed .nav-item.active::before {
  left: -14px;
}

.sidebar {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 18px 14px 14px;
  background: #182227;
  color: #d7dfe2;
  border-right: 1px solid #2b373c;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 44px;
  padding: 0 8px;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(3, 5px);
  align-items: end;
  gap: 3px;
  width: 25px;
  height: 25px;
  padding: 5px;
  color: #dffbf6;
  background: var(--teal);
  border-radius: 5px;
}

.brand-mark span {
  width: 5px;
  background: currentColor;
  border-radius: 1px 1px 0 0;
}

.brand-mark span:nth-child(1) { height: 7px; }
.brand-mark span:nth-child(2) { height: 13px; }
.brand-mark span:nth-child(3) { height: 10px; }

.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-copy strong {
  color: #fff;
  font-size: 17px;
  line-height: 1.1;
}

.brand-copy small {
  margin-top: 4px;
  color: #829198;
  font-size: 10px;
}

.project-switcher {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 9px;
  margin: 18px 0 12px;
  padding: 10px;
  background: #222e33;
  border: 1px solid #344147;
  border-radius: var(--radius);
  cursor: pointer;
}

.project-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: #b8f1e8;
  background: #0b5f58;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 800;
}

.project-switcher > span:nth-child(2) {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.project-switcher small {
  color: #829198;
  font-size: 10px;
}

.project-switcher strong {
  margin-top: 3px;
  overflow: hidden;
  color: #edf4f5;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-switcher svg {
  width: 15px;
  color: #77868d;
}

.nav-list {
  flex: 1;
  min-height: 0;
}

.nav-label {
  margin: 21px 10px 7px;
  color: #697980;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 40px;
  margin: 3px 0;
  padding: 0 10px;
  color: #aebbc0;
  background: transparent;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  text-align: left;
}

.nav-item svg {
  width: 17px;
  height: 17px;
}

.nav-item:hover {
  color: #fff;
  background: #222f34;
}

.nav-item.active {
  color: #eafffb;
  background: #0b625a;
}

.nav-item.active::before {
  position: absolute;
  left: -14px;
  width: 3px;
  height: 22px;
  background: #4bd3c4;
  content: "";
}

.nav-count {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-left: auto;
  color: #8fa0a7;
  background: #2b383d;
  border-radius: 10px;
  font-size: 10px;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 2px 0;
  border-top: 1px solid #2c393e;
}

.service-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.service-indicator > span:nth-child(2) {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.service-indicator strong {
  color: #dce5e7;
  font-size: 11px;
}

.service-indicator small {
  margin-top: 3px;
  color: #718188;
  font-size: 9px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #6e7d83;
  border-radius: 50%;
}

.status-dot.online {
  background: #38bf88;
  box-shadow: 0 0 0 4px rgba(56, 191, 136, 0.12);
}

.status-dot.offline {
  background: var(--coral);
}

.sidebar .icon-btn {
  color: #86969c;
}

.workspace {
  display: flex;
  min-width: 0;
  flex-direction: column;
  background: var(--canvas);
}

.topbar {
  z-index: 10;
  display: flex;
  flex: 0 0 58px;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
}

.breadcrumb,
.topbar-actions,
.heading-actions,
.button-row {
  display: flex;
  align-items: center;
}

.breadcrumb {
  gap: 8px;
  color: var(--ink-muted);
  font-size: 12px;
}

.breadcrumb strong {
  color: var(--ink);
}

.breadcrumb svg {
  width: 13px;
  height: 13px;
}

.topbar-actions {
  gap: 8px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--ink);
  background: var(--surface-soft);
  border-color: var(--line);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.btn {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn-primary {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.btn-primary:hover {
  background: var(--teal-deep);
  border-color: var(--teal-deep);
}

.btn-secondary {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.btn-secondary:hover {
  background: var(--surface-soft);
}

.btn-quiet {
  color: var(--teal-deep);
  background: transparent;
}

.full-width {
  width: 100%;
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-left: 3px;
  color: #fff;
  background: #39474d;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
}

.mobile-menu {
  display: none;
}

.main-canvas {
  min-width: 0;
  flex: 1;
  overflow: auto;
}

.view {
  display: none;
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 28px 38px;
}

.view.active {
  display: block;
  animation: view-in 220ms ease;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-heading {
  display: flex;
  min-height: 54px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--teal-deep);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.page-heading h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.08;
  font-weight: 760;
}

.heading-actions {
  gap: 9px;
}

.sync-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-muted);
  font-size: 11px;
}

.sync-state svg {
  width: 14px;
  height: 14px;
  color: var(--teal);
}

.analysis-composer {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  background: var(--surface);
  border: 1px solid #cfd8db;
  border-left: 3px solid var(--teal);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(28, 51, 57, 0.04);
}

.compact-composer {
  margin-bottom: 16px;
}

.composer-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--teal);
  background: var(--teal-soft);
  border-radius: 4px;
}

.composer-icon svg {
  width: 16px;
}

.analysis-composer textarea {
  width: 100%;
  min-height: 32px;
  max-height: 86px;
  padding: 6px 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  resize: none;
}

.analysis-composer textarea::placeholder,
.drawer-composer textarea::placeholder {
  color: #8b989d;
}

.send-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #fff;
  background: var(--teal);
  border: 0;
  border-radius: 5px;
  cursor: pointer;
}

.send-btn:hover {
  background: var(--teal-deep);
}

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

.send-btn svg {
  width: 16px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.kpi-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 15px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.kpi-label {
  color: var(--ink-muted);
  font-size: 11px;
}

.kpi-card strong {
  margin: 9px 0 7px;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 24px;
  line-height: 1;
}

.kpi-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
}

.kpi-meta svg {
  width: 12px;
  height: 12px;
}

.positive { color: var(--teal-deep); }
.negative { color: var(--coral); }
.neutral { color: var(--ink-muted); }

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.panel,
.workflow-section,
.deliverables-section,
.builder-sidebar,
.report-preview,
.document-workspace,
.research-feature,
.cluster-list,
.asset-table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel {
  min-width: 0;
  padding: 16px;
}

.panel-head,
.section-heading,
.rail-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel h2,
.section-heading h2,
.rail-section h2,
.builder-sidebar h2,
.cluster-list h2 {
  margin: 0;
  font-size: 14px;
}

.panel p,
.section-heading p {
  margin: 4px 0 0;
  color: var(--ink-muted);
  font-size: 10px;
}

.segmented-control {
  display: inline-flex;
  padding: 2px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 5px;
}

.segmented-control button {
  min-height: 26px;
  padding: 0 9px;
  color: var(--ink-muted);
  background: transparent;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
  font-size: 10px;
}

.segmented-control button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 3px rgba(30, 49, 55, 0.12);
}

.chart {
  height: 232px;
  margin-top: 4px;
}

.priority-list {
  margin: 8px -3px -5px;
}

.priority-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 13px 4px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #edf0f1;
  cursor: pointer;
  text-align: left;
}

.priority-item:last-child {
  border-bottom: 0;
}

.priority-item:hover strong {
  color: var(--teal-deep);
}

.priority-rank {
  display: grid;
  place-items: center;
  width: 31px;
  height: 23px;
  border-radius: 4px;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 9px;
  font-weight: 800;
}

.priority-rank.critical {
  color: #a63d30;
  background: var(--coral-soft);
}

.priority-rank.high {
  color: #8c5c13;
  background: var(--amber-soft);
}

.priority-rank.medium {
  color: #2f5baa;
  background: var(--blue-soft);
}

.priority-item > span:nth-child(2) {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.priority-item strong {
  font-size: 11px;
}

.priority-item small {
  margin-top: 5px;
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.priority-item svg {
  width: 14px;
  color: #9aa5a9;
}

.workflow-section,
.deliverables-section {
  margin-bottom: 14px;
  padding: 17px 18px 18px;
}

.progress-label {
  color: var(--teal-deep);
  font-size: 10px;
  font-weight: 700;
}

.workflow-track {
  display: grid;
  grid-template-columns: minmax(98px, 1fr) 34px minmax(98px, 1fr) 34px minmax(98px, 1fr) 34px minmax(98px, 1fr) 34px minmax(98px, 1fr);
  align-items: start;
  margin-top: 20px;
}

.workflow-step {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-direction: column;
  padding: 0 2px;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: center;
}

.workflow-step > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #859398;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 50%;
}

.workflow-step > span svg {
  width: 15px;
}

.workflow-step strong {
  margin-top: 8px;
  font-size: 10px;
}

.workflow-step small {
  margin-top: 4px;
  color: var(--ink-muted);
  font-size: 8px;
  white-space: nowrap;
}

.workflow-step.completed > span {
  color: var(--teal-deep);
  background: var(--teal-soft);
  border-color: #afd8d1;
}

.workflow-step.active > span {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
  box-shadow: 0 0 0 5px rgba(8, 127, 115, 0.1);
}

.workflow-line {
  height: 1px;
  margin-top: 17px;
  background: var(--line);
}

.workflow-line.completed {
  background: #83c9bd;
}

.deliverable-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.deliverable-card {
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.deliverable-visual {
  position: relative;
  height: 116px;
  overflow: hidden;
  background: #e9edef;
}

.deliverable-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform 250ms ease;
}

.deliverable-card:hover img {
  transform: scale(1.025);
}

.file-type {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 6px;
  color: #fff;
  background: rgba(23, 33, 38, 0.82);
  border-radius: 3px;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 8px;
  font-weight: 800;
}

.dashboard-art {
  background: #f7fbfa;
}

.dashboard-art .deliverable-visual {
  display: grid;
  place-items: center;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.08) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,0.08) 1px, transparent 1px),
    #123f3c;
  background-size: 16px 16px;
}

.mini-dashboard {
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  grid-template-rows: 32px 42px;
  gap: 7px;
  width: 78%;
  padding: 9px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
}

.mini-dashboard span {
  background: rgba(217, 240, 236, 0.84);
  border-radius: 2px;
}

.mini-dashboard span:nth-child(2) {
  background: rgba(244, 183, 64, 0.76);
}

.mini-dashboard span:nth-child(3) {
  grid-column: 1 / -1;
  background: linear-gradient(170deg, transparent 45%, #51c4b6 46% 50%, transparent 51%);
  border: 1px solid rgba(255,255,255,0.15);
}

.mini-dashboard span:nth-child(4) {
  display: none;
}

.deliverable-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
}

.deliverable-body > div {
  min-width: 0;
}

.deliverable-body small {
  color: var(--ink-muted);
  font-size: 9px;
}

.deliverable-body h3 {
  margin: 4px 0 0;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.intelligence-rail {
  z-index: 10;
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 18px 16px;
  overflow: auto;
  background: #f9fafb;
  border-left: 1px solid var(--line);
}

.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.rail-head > div,
.engine-row > span:last-child,
.rail-action span,
.source-item > span:nth-child(2) {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.rail-head small,
.engine-row small,
.rail-action small,
.source-item small {
  color: var(--ink-muted);
  font-size: 9px;
}

.rail-head strong {
  margin-top: 3px;
  font-size: 13px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 700;
}

.status-badge span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-badge.checking {
  color: #776442;
  background: #f3eadb;
}

.status-badge.checking span { background: var(--amber); }
.status-badge.online { color: #136d51; background: #dff3ea; }
.status-badge.online span { background: #2fad7b; }
.status-badge.offline { color: #9b4034; background: var(--coral-soft); }
.status-badge.offline span { background: var(--coral); }

.engine-card {
  padding: 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

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

.engine-logo {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  color: #fff;
  background: var(--teal);
  border-radius: 5px;
}

.engine-logo svg {
  width: 17px;
}

.engine-row strong {
  font-size: 11px;
}

.engine-row small {
  margin-top: 4px;
}

.engine-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 13px;
  border-top: 1px solid #edf0f1;
}

.engine-metrics span {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding-top: 10px;
  color: var(--ink-muted);
  font-size: 9px;
}

.engine-metrics span + span {
  padding-left: 12px;
  border-left: 1px solid #edf0f1;
}

.engine-metrics strong {
  color: var(--ink);
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 15px;
}

.rail-section {
  margin-top: 20px;
}

.rail-section-head h2 {
  font-size: 11px;
}

.rail-section-head > span {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 18px;
  color: var(--ink-muted);
  background: var(--surface-strong);
  border-radius: 9px;
  font-size: 9px;
}

.task-list {
  margin-top: 7px;
}

.task-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid #e9edef;
  cursor: pointer;
}

.task-item > span:first-child {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--teal-deep);
  background: var(--teal-soft);
  border-radius: 4px;
}

.task-item svg {
  width: 12px;
}

.task-item > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.task-item strong {
  overflow: hidden;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-item small {
  margin-top: 4px;
  color: var(--ink-muted);
  font-size: 8px;
}

.task-skeleton {
  width: 100%;
  height: 39px;
  margin: 8px 0;
  background: linear-gradient(90deg, #eef1f2 25%, #f8f9fa 45%, #eef1f2 65%);
  background-size: 220% 100%;
  border-radius: 4px;
  animation: skeleton 1.4s infinite linear;
}

.task-skeleton.short {
  width: 76%;
}

@keyframes skeleton {
  to { background-position: -220% 0; }
}

.source-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 9px;
  padding: 10px 0;
  border-bottom: 1px solid #e9edef;
}

.source-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 28px;
  color: #2e6195;
  background: #e2edf6;
  border-radius: 4px;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 8px;
  font-weight: 800;
}

.source-item strong {
  overflow: hidden;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-item small {
  margin-top: 4px;
}

.source-item > svg {
  width: 13px;
  color: var(--teal);
}

.rail-action {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: auto;
  padding: 12px;
  color: var(--ink);
  background: #fff;
  border: 1px dashed #b7c6ca;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
}

.rail-action:hover {
  border-color: var(--teal);
}

.rail-action > svg {
  width: 16px;
  color: var(--teal);
}

.rail-action strong {
  font-size: 10px;
}

.rail-action small {
  margin-top: 3px;
}

/* Dashboard */
.embedded-frame {
  height: calc(100vh - 155px);
  min-height: 640px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.frame-toolbar {
  display: flex;
  height: 42px;
  align-items: center;
  justify-content: space-between;
  padding: 0 9px 0 14px;
  background: #f6f8f9;
  border-bottom: 1px solid var(--line);
}

.frame-url {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-muted);
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 9px;
}

.frame-url span {
  width: 7px;
  height: 7px;
  background: #35b67f;
  border-radius: 50%;
}

.embedded-frame iframe {
  width: 100%;
  height: calc(100% - 42px);
  border: 0;
}

/* Weekly report */
.builder-layout {
  display: grid;
  grid-template-columns: 246px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.builder-sidebar {
  position: sticky;
  top: 20px;
  padding: 18px;
}

.builder-sidebar h2 {
  margin-bottom: 18px;
}

.builder-sidebar > label,
.builder-sidebar fieldset {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}

.builder-sidebar label > span,
.builder-sidebar legend {
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
}

.builder-sidebar select,
.research-query select {
  width: 100%;
  height: 36px;
  padding: 0 9px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.builder-sidebar .check-row {
  display: flex;
  min-height: 28px;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 10px;
}

.check-row input {
  accent-color: var(--teal);
}

.report-preview {
  padding: 22px;
  background: #dfe4e6;
}

.report-sheet {
  width: min(100%, 780px);
  min-height: 820px;
  margin: 0 auto;
  padding: 44px 50px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(31, 47, 52, 0.14);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  color: var(--ink-muted);
  border-bottom: 2px solid var(--ink);
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 9px;
}

.sheet-head strong {
  color: var(--teal-deep);
}

.report-sheet > h2 {
  margin: 34px 0 0;
  font-size: 28px;
}

.sheet-subtitle {
  margin: 8px 0 26px;
  color: var(--ink-muted);
  font-size: 11px;
}

.sheet-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.sheet-kpis > div {
  display: flex;
  flex-direction: column;
  padding: 17px 14px;
}

.sheet-kpis > div + div {
  border-left: 1px solid var(--line);
}

.sheet-kpis small {
  color: var(--ink-muted);
  font-size: 9px;
}

.sheet-kpis strong {
  margin: 7px 0 5px;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 21px;
}

.sheet-kpis span {
  font-size: 9px;
}

.weekly-chart {
  height: 270px;
  margin: 24px 0 18px;
}

.sheet-conclusion {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  padding: 15px 0;
  border-top: 1px solid var(--line);
}

.sheet-conclusion > span {
  color: var(--teal);
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 10px;
  font-weight: 800;
}

.sheet-conclusion p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.7;
}

.sheet-conclusion strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
}

/* Documents and research */
.document-workspace {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: calc(100vh - 160px);
  overflow: hidden;
}

.document-meta {
  padding: 18px;
  border-right: 1px solid var(--line);
}

.document-meta > img {
  display: block;
  width: 100%;
  aspect-ratio: 1.414 / 1;
  object-fit: cover;
  object-position: top;
  border: 1px solid var(--line);
}

.asset-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 14px;
  color: var(--teal-deep);
  font-size: 9px;
  font-weight: 700;
}

.asset-status svg {
  width: 13px;
}

.document-meta h2 {
  margin: 10px 0 18px;
  font-size: 14px;
  line-height: 1.45;
}

.document-meta dl {
  margin: 0 0 20px;
}

.document-meta dl > div {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid #edf0f1;
  font-size: 10px;
}

.document-meta dt {
  color: var(--ink-muted);
}

.document-meta dd {
  margin: 0;
  font-weight: 700;
}

.pdf-frame {
  min-width: 0;
  background: #dfe4e6;
}

.pdf-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.research-query {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 126px;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
  padding: 10px 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.research-query > svg {
  width: 17px;
  color: var(--teal);
}

.research-query input {
  width: 100%;
  min-width: 0;
  height: 34px;
  border: 0;
  outline: 0;
  font-size: 12px;
}

.research-query select {
  height: 32px;
  font-size: 10px;
}

.research-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(240px, 0.8fr);
  gap: 14px;
}

.research-feature {
  display: grid;
  grid-template-columns: minmax(190px, 0.8fr) minmax(260px, 1.2fr);
  min-height: 410px;
  overflow: hidden;
}

.research-feature > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  background: #eef1f2;
  border-right: 1px solid var(--line);
}

.research-feature-body {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  padding: 28px;
}

.research-feature-body h2 {
  margin: 13px 0 12px;
  font-size: 22px;
  line-height: 1.35;
}

.research-feature-body > p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.75;
}

.research-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 100%;
  margin: 26px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.research-facts span {
  display: flex;
  flex-direction: column;
  padding: 14px 8px;
  color: var(--ink-muted);
  font-size: 9px;
}

.research-facts span + span {
  border-left: 1px solid var(--line);
}

.research-facts strong {
  margin-bottom: 5px;
  color: var(--ink);
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 17px;
}

.button-row {
  gap: 8px;
  margin-top: auto;
}

.cluster-list {
  padding: 20px;
}

.cluster-list h2 {
  margin-bottom: 13px;
}

.cluster-list > div {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid #edf0f1;
}

.cluster-list > div:last-child {
  border-bottom: 0;
}

.cluster-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.cluster-dot.c1 { background: var(--teal); }
.cluster-dot.c2 { background: var(--amber); }
.cluster-dot.c3 { background: var(--coral); }
.cluster-dot.c4 { background: var(--blue); }
.cluster-dot.c5 { background: #8c969a; }

.cluster-list p {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.cluster-list strong {
  font-size: 10px;
}

.cluster-list small {
  margin-top: 4px;
  color: var(--ink-muted);
  font-size: 9px;
}

/* Asset table */
.asset-table-wrap {
  overflow: hidden;
}

.asset-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.asset-table th,
.asset-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #edf0f1;
  text-align: left;
}

.asset-table th {
  color: var(--ink-muted);
  background: #f8fafb;
  font-size: 9px;
  font-weight: 700;
}

.asset-table th:first-child { width: 46%; }
.asset-table th:nth-child(2) { width: 12%; }
.asset-table th:nth-child(3) { width: 12%; }
.asset-table th:nth-child(4) { width: 16%; }
.asset-table th:last-child { width: 14%; }

.asset-table td {
  color: var(--ink-soft);
  font-size: 10px;
}

.asset-table tbody tr:hover {
  background: #fbfcfc;
}

.asset-table td:first-child {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
}

.asset-table td:first-child > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.asset-table td:first-child strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-table td:first-child small {
  margin-top: 5px;
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 5px;
}

.asset-icon svg { width: 17px; }
.dashboard-icon { color: var(--teal-deep); background: var(--teal-soft); }
.doc-icon { color: #315ca8; background: var(--blue-soft); }
.pdf-icon { color: #ad493c; background: var(--coral-soft); }

.status-pill {
  display: inline-flex;
  padding: 4px 7px;
  border-radius: 10px;
  font-size: 8px;
  font-weight: 700;
}

.status-pill.live { color: #176b50; background: #ddf2e9; }
.status-pill.done { color: #315da5; background: #e7edfb; }

.asset-table td:last-child {
  display: flex;
  gap: 2px;
}

/* Analysis drawer */
.drawer-backdrop {
  position: fixed;
  z-index: 90;
  inset: 0;
  visibility: hidden;
  background: rgba(16, 27, 31, 0.35);
  opacity: 0;
  transition: 180ms ease;
}

.drawer-backdrop.open {
  visibility: visible;
  opacity: 1;
}

.analysis-drawer {
  position: fixed;
  z-index: 100;
  top: 0;
  right: 0;
  display: flex;
  width: min(520px, 100vw);
  height: 100vh;
  flex-direction: column;
  background: #fff;
  box-shadow: -18px 0 38px rgba(23, 37, 42, 0.18);
  transform: translateX(102%);
  transition: transform 220ms ease;
}

.analysis-drawer.open {
  transform: translateX(0);
}

.analysis-drawer > header {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.analysis-drawer > header > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

.analysis-drawer > header > div:first-child > span:last-child {
  display: flex;
  flex-direction: column;
}

.analysis-drawer header small {
  color: var(--ink-muted);
  font-size: 9px;
}

.analysis-drawer header strong {
  margin-top: 3px;
  font-size: 12px;
}

.drawer-content {
  min-height: 0;
  flex: 1;
  padding: 20px;
  overflow: auto;
  background: #f6f8f9;
}

.analysis-state {
  display: flex;
  max-width: 320px;
  margin: 15vh auto 0;
  align-items: center;
  flex-direction: column;
  text-align: center;
}

.analysis-state[hidden],
.analysis-output[hidden] {
  display: none;
}

.analysis-state > span {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: var(--teal);
  background: var(--teal-soft);
  border-radius: 8px;
}

.analysis-state > span svg {
  width: 22px;
}

.analysis-state h2 {
  margin: 15px 0 6px;
  font-size: 16px;
}

.analysis-state p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 10px;
}

.analysis-state.loading > span {
  animation: pulse 1.2s ease infinite;
}

@keyframes pulse {
  50% { transform: scale(0.92); opacity: 0.65; }
}

.analysis-output {
  padding: 18px;
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.analysis-output h2 {
  margin: 0 0 14px;
  color: var(--ink);
  font-size: 15px;
}

.analysis-output .task-meta {
  margin-top: 16px;
  padding-top: 12px;
  color: var(--ink-muted);
  border-top: 1px solid var(--line);
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 9px;
}

.drawer-suggestions {
  display: flex;
  gap: 6px;
  padding: 10px 14px 0;
  overflow-x: auto;
  background: #fff;
}

.drawer-suggestions button {
  min-height: 27px;
  padding: 0 9px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  font-size: 9px;
  white-space: nowrap;
}

.drawer-composer {
  margin: 10px 14px 14px;
  padding: 10px;
  background: #fff;
  border: 1px solid #bfcacd;
  border-radius: var(--radius);
}

.drawer-composer:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 127, 115, 0.1);
}

.drawer-composer textarea {
  width: 100%;
  min-height: 64px;
  max-height: 160px;
  padding: 0;
  border: 0;
  outline: 0;
  resize: vertical;
}

.drawer-composer > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 7px;
}

.drawer-composer > div > span {
  color: var(--ink-muted);
  font-size: 8px;
}

/* Report modal */
.modal-backdrop {
  position: fixed;
  z-index: 120;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(13, 22, 26, 0.72);
}

.modal-backdrop[hidden] {
  display: none;
}

.report-modal-panel {
  display: flex;
  width: min(1120px, 100%);
  height: min(88vh, 860px);
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 26px 70px rgba(0,0,0,0.26);
}

.report-modal-panel > header {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  padding: 0 13px 0 18px;
  border-bottom: 1px solid var(--line);
}

.report-modal-panel > header > div:first-child {
  display: flex;
  flex-direction: column;
}

.report-modal-panel header small {
  color: var(--ink-muted);
  font-size: 9px;
}

.report-modal-panel header strong {
  margin-top: 3px;
  font-size: 12px;
}

.report-modal-panel > header > div:last-child {
  display: flex;
  gap: 3px;
}

.report-modal-panel iframe {
  width: 100%;
  min-height: 0;
  flex: 1;
  background: #dfe4e6;
  border: 0;
}

.toast {
  position: fixed;
  z-index: 160;
  left: 50%;
  bottom: 24px;
  max-width: min(440px, calc(100vw - 32px));
  padding: 10px 13px;
  color: #fff;
  background: #223036;
  border-radius: 5px;
  box-shadow: var(--shadow);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1180px) {
  :root {
    --rail-width: 244px;
    --sidebar-width: 214px;
  }

  .view {
    padding-right: 20px;
    padding-left: 20px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .deliverable-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .deliverable-card:last-child {
    display: none;
  }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    min-height: 100vh;
    height: auto;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 232px;
    transform: translateX(-102%);
    transition: transform 200ms ease;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 20px 0 50px rgba(16, 28, 33, 0.25);
  }

  .mobile-menu {
    display: inline-grid;
  }

  .workspace {
    min-height: 100vh;
  }

  .intelligence-rail {
    display: none;
  }

  .main-canvas {
    overflow: visible;
  }

  .overview-grid,
  .research-grid {
    grid-template-columns: 1fr;
  }

  .workflow-track {
    overflow-x: auto;
    grid-template-columns: 110px 26px 110px 26px 110px 26px 110px 26px 110px;
  }

  .document-workspace {
    min-height: 720px;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 0 12px;
  }

  .breadcrumb > span,
  .breadcrumb > svg {
    display: none;
  }

  .topbar-actions > .icon-btn,
  .user-avatar {
    display: none;
  }

  .view {
    padding: 18px 12px 30px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .page-heading h1 {
    font-size: 23px;
  }

  .heading-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .sync-state {
    width: 100%;
  }

  .kpi-grid,
  .deliverable-grid {
    grid-template-columns: 1fr;
  }

  .deliverable-card:last-child {
    display: block;
  }

  .segmented-control {
    display: none;
  }

  .builder-layout {
    grid-template-columns: 1fr;
  }

  .builder-sidebar {
    position: static;
  }

  .report-preview {
    padding: 8px;
    overflow-x: auto;
  }

  .report-sheet {
    min-width: 620px;
  }

  .document-workspace {
    grid-template-columns: 1fr;
  }

  .document-meta {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .document-meta > img {
    width: 180px;
  }

  .pdf-frame {
    min-height: 620px;
  }

  .research-query {
    grid-template-columns: 20px minmax(0, 1fr);
  }

  .research-query select {
    grid-column: 1 / -1;
  }

  .research-feature {
    grid-template-columns: 1fr;
  }

  .research-feature > img {
    height: 250px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .research-facts {
    grid-template-columns: 1fr;
  }

  .research-facts span + span {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .asset-table-wrap {
    overflow-x: auto;
  }

  .asset-table {
    min-width: 760px;
  }

  .modal-backdrop {
    padding: 0;
  }

  .report-modal-panel {
    width: 100%;
    height: 100vh;
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
