:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-alt: #eef3f3;
  --ink: #1d2527;
  --muted: #607075;
  --line: #d8e1e2;
  --line-strong: #b9c8cb;
  --teal: #087f7a;
  --teal-2: #0aa6a0;
  --amber: #c47b16;
  --gold: #f0b84e;
  --blue: #2f79b7;
  --green: #2d8a55;
  --red: #b64b4b;
  --graphite: #263033;
  --shadow: 0 18px 48px rgba(29, 37, 39, 0.12);
  --radius: 8px;
  color-scheme: light;
  font-family:
    Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", Arial,
    sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
}

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

button {
  border: 0;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 16px;
  background: #182326;
  color: #f3f8f8;
}

.brand {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 50px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(10, 166, 160, 0.95), rgba(47, 121, 183, 0.9)),
    #0aa6a0;
  color: #ffffff;
  font-weight: 800;
}

.brand-title {
  font-size: 16px;
  font-weight: 760;
  line-height: 1.25;
}

.brand-subtitle {
  margin-top: 4px;
  color: #a9bec2;
  font-size: 12px;
}

.nav-group {
  display: grid;
  gap: 6px;
}

.nav-button {
  width: 100%;
  min-height: 40px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: transparent;
  color: #dbe7e9;
  text-align: left;
  cursor: pointer;
}

.nav-button:hover,
.nav-button.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-button .label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-button .badge {
  min-width: 24px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(10, 166, 160, 0.25);
  color: #bdf1ee;
  font-size: 11px;
  font-weight: 760;
}

.icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
  font-size: 14px;
  font-weight: 760;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--teal-2);
  box-shadow: 0 0 0 4px rgba(10, 166, 160, 0.14);
}

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #dbe7e9;
}

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

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 247, 248, 0.9);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.page-title {
  min-width: 0;
}

.eyebrow {
  color: var(--teal);
  font-size: 12px;
  font-weight: 760;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin-top: 4px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.15;
  font-weight: 820;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
  font-weight: 780;
}

h3 {
  font-size: 15px;
  line-height: 1.3;
  font-weight: 760;
}

p {
  color: var(--muted);
  line-height: 1.65;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 13px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-weight: 720;
  white-space: nowrap;
}

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

.button.primary {
  border-color: var(--teal);
  background: var(--teal);
  color: #ffffff;
}

.button.primary:hover {
  border-color: #096965;
  background: #096965;
  color: #ffffff;
}

.button.ghost {
  background: transparent;
}

.button.small {
  min-height: 32px;
  padding: 7px 10px;
  font-size: 13px;
}

.button.square {
  width: 38px;
  padding: 0;
}

.content {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 24px 28px 36px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(330px, 0.85fr);
  gap: 18px;
}

.hero-panel {
  overflow: hidden;
  min-height: 360px;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(320px, 1.08fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
}

.hero-copy h2 {
  font-size: clamp(25px, 4vw, 42px);
  line-height: 1.05;
}

.hero-copy p {
  max-width: 58ch;
}

.hero-image {
  min-height: 360px;
  background: var(--surface-alt);
  position: relative;
}

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

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metric-card {
  min-height: 86px;
  display: grid;
  gap: 7px;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fbfdfd;
}

.metric-value {
  font-size: 24px;
  font-weight: 820;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
}

.metric-trend {
  width: fit-content;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(45, 138, 85, 0.12);
  color: var(--green);
  font-size: 11px;
  font-weight: 760;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel-header {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  display: grid;
  gap: 4px;
}

.panel-title span {
  color: var(--muted);
  font-size: 12px;
}

.panel-body {
  padding: 18px;
}

.stack {
  display: grid;
  gap: 14px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
}

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

.three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.opportunity-list {
  display: grid;
  gap: 10px;
}

.opportunity-item {
  width: 100%;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
  text-align: left;
  cursor: pointer;
}

.opportunity-item:hover,
.opportunity-item.is-selected {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(10, 166, 160, 0.11);
}

.item-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.item-name {
  font-weight: 780;
  line-height: 1.25;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--graphite);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pill.teal {
  background: rgba(10, 166, 160, 0.13);
  color: var(--teal);
}

.pill.amber {
  background: rgba(240, 184, 78, 0.18);
  color: #8a5a0d;
}

.pill.red {
  background: rgba(182, 75, 75, 0.13);
  color: var(--red);
}

.pill.green {
  background: rgba(45, 138, 85, 0.13);
  color: var(--green);
}

.score-ring {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    conic-gradient(var(--teal) calc(var(--score) * 1%), #e5ecec 0),
    #e5ecec;
}

.score-ring span {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  font-size: 13px;
  font-weight: 820;
}

.timeline {
  display: grid;
  gap: 14px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
}

.timeline-marker {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(10, 166, 160, 0.16);
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
}

.timeline-copy {
  display: grid;
  gap: 4px;
}

.timeline-copy strong {
  font-size: 14px;
}

.timeline-copy span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 12px;
  font-weight: 760;
  color: var(--graphite);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

.field textarea {
  min-height: 104px;
  resize: vertical;
  line-height: 1.55;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(10, 166, 160, 0.11);
}

.segmented {
  display: inline-flex;
  min-height: 38px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3f3;
}

.segmented button {
  min-width: 84px;
  padding: 7px 11px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 720;
}

.segmented button.is-active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(29, 37, 39, 0.08);
}

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

.output-block {
  min-height: 150px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}

.output-block.wide {
  grid-column: 1 / -1;
}

.output-block h3 {
  margin-bottom: 10px;
}

.clean-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.clean-list li {
  position: relative;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.clean-list li::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal-2);
  position: absolute;
  left: 0;
  top: 0.72em;
}

.document-preview {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.document-preview section {
  display: grid;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.document-preview section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.document-preview h3 {
  color: var(--teal);
}

.qa-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.qa-table th,
.qa-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.55;
}

.qa-table th {
  background: #eef3f3;
  color: var(--graphite);
  font-size: 12px;
}

.qa-table tr:last-child td {
  border-bottom: 0;
}

.confidence {
  min-width: 92px;
  display: grid;
  gap: 6px;
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: #e1e8e8;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.range-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  align-items: center;
  gap: 12px;
}

input[type="range"] {
  accent-color: var(--teal);
}

.roi-number {
  font-size: clamp(30px, 5vw, 56px);
  font-weight: 840;
  line-height: 1;
}

.roi-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.price-table {
  display: grid;
  gap: 10px;
}

.price-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(0, 1.3fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.knowledge-results {
  display: grid;
  gap: 10px;
}

.knowledge-item {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}

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

.connector {
  min-height: 116px;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #c9d4d6;
  flex: 0 0 auto;
}

.switch::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  position: absolute;
  top: 3px;
  left: 3px;
  box-shadow: 0 3px 10px rgba(29, 37, 39, 0.18);
}

.switch.on {
  background: var(--teal);
}

.switch.on::after {
  left: 23px;
}

.audit-feed {
  display: grid;
  gap: 10px;
}

.audit-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.audit-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(47, 121, 183, 0.12);
  color: var(--blue);
  font-weight: 800;
  font-size: 12px;
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 30px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  text-align: center;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  min-width: 220px;
  max-width: calc(100vw - 44px);
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--graphite);
  color: #ffffff;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.mobile-menu {
  display: none;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .sidebar {
    padding: 16px 10px;
  }

  .brand {
    grid-template-columns: 1fr;
    place-items: center;
  }

  .brand-copy,
  .nav-button .label,
  .nav-button .badge,
  .sidebar-footer {
    display: none;
  }

  .nav-button {
    grid-template-columns: 1fr;
    place-items: center;
  }
}

@media (max-width: 980px) {
  .dashboard-grid,
  .workspace-grid,
  .two-col,
  .hero-panel {
    grid-template-columns: 1fr;
  }

  .hero-image {
    min-height: 280px;
  }

  .metric-row,
  .three-col,
  .roi-kpis,
  .connector-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 12;
    height: auto;
    display: block;
    padding: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .brand,
  .sidebar-footer {
    display: none;
  }

  .nav-group {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
  }

  .nav-button {
    min-height: 44px;
    padding: 6px;
  }

  .topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
    padding: 18px;
  }

  .top-actions {
    justify-content: start;
  }

  .content {
    padding: 18px 16px 92px;
  }

  .metric-row,
  .form-grid,
  .output-grid,
  .roi-kpis,
  .connector-grid {
    grid-template-columns: 1fr;
  }

  .price-row {
    grid-template-columns: 1fr;
  }

  .search-row {
    grid-template-columns: 1fr;
  }

  .qa-table {
    display: block;
    overflow-x: auto;
    white-space: normal;
  }
}
