:root {
  --ink: #251b16;
  --muted: #7f6b5d;
  --line: #e5d7c9;
  --panel: #fffdf9;
  --panel-soft: #f8efe5;
  --nav: #2b1f18;
  --nav-muted: #d3bda9;
  --green: #4d8f62;
  --teal: #3c7d76;
  --amber: #b76821;
  --red: #bd4d42;
  --blue: #a95728;
  --violet: #8f5d45;
  --shadow: 0 18px 50px rgba(72, 43, 24, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f3eadf;
  color: var(--ink);
  font-family:
    Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  background: var(--nav);
  color: #fff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #d98935, #5f8f61);
  font-weight: 800;
  font-size: 24px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.sidebar .eyebrow {
  color: var(--nav-muted);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.2;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.nav-item,
.icon-btn,
.primary-btn,
.ghost-btn,
.segment {
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-item {
  width: 100%;
  gap: 10px;
  color: var(--nav-muted);
  background: transparent;
  border-radius: 8px;
  padding: 12px;
  justify-content: flex-start;
}

.nav-item.active,
.nav-item:hover {
  color: #fffaf2;
  background: rgba(255, 238, 218, 0.12);
}

.nav-item svg,
.primary-btn svg,
.ghost-btn svg,
.icon-btn svg,
.url-field svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.quiet-panel {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 238, 218, 0.14);
  border-radius: 8px;
  background: rgba(255, 238, 218, 0.07);
}

.panel-title {
  margin-bottom: 10px;
  color: var(--nav-muted);
  font-size: 12px;
}

.site-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.site-chip span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fff6e8;
  color: var(--nav);
  font-weight: 800;
}

.site-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  padding: 24px;
  min-width: 0;
}

.topbar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.scan-form {
  flex: 1;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.url-field {
  flex: 1;
  min-width: 180px;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
}

.url-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
}

.primary-btn,
.ghost-btn,
.icon-btn {
  height: 46px;
  border-radius: 8px;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.primary-btn {
  gap: 8px;
  padding: 0 18px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(169, 87, 40, 0.25);
}

.ghost-btn {
  gap: 8px;
  padding: 0 14px;
  background: #f1e3d4;
  color: var(--ink);
  font-weight: 700;
}

.icon-btn {
  width: 46px;
  background: #fffdf9;
  color: var(--ink);
  border: 1px solid var(--line);
}

.primary-btn:hover,
.ghost-btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
}

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

.switch-row {
  height: 46px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 8px;
  background: #fffdf9;
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 700;
}

.switch-row input {
  accent-color: var(--blue);
}

.summary-band,
.main-pane,
.insight-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.summary-band {
  display: grid;
  grid-template-columns: minmax(260px, 360px) 1fr;
  gap: 24px;
  padding: 22px;
  margin-bottom: 20px;
}

.score-block {
  display: flex;
  align-items: center;
  gap: 16px;
}

.score-block canvas {
  width: 132px;
  height: 132px;
}

.score-copy strong {
  display: block;
  font-size: 52px;
  line-height: 0.95;
}

.score-copy span {
  color: var(--muted);
  font-weight: 700;
}

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

.kpi {
  min-width: 0;
  padding: 14px;
  border-radius: 8px;
  background: var(--panel-soft);
}

.kpi span,
.kpi small {
  display: block;
  color: var(--muted);
}

.kpi strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 26px;
}

.kpi small {
  font-size: 12px;
  line-height: 1.35;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}

.main-pane {
  min-width: 0;
  padding: 20px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head.compact {
  margin-bottom: 12px;
}

.segmented {
  display: flex;
  padding: 4px;
  border-radius: 8px;
  background: #f1e3d4;
}

.segment {
  min-width: 68px;
  height: 34px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.segment.active {
  color: var(--ink);
  background: #fffdf9;
  box-shadow: 0 5px 14px rgba(72, 43, 24, 0.1);
}

.metric-list,
.task-list,
.signal-table,
.compare-board,
.priority-list {
  display: grid;
  gap: 10px;
}

.metric-row,
.task-row,
.signal-row,
.compare-row {
  display: grid;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
}

.metric-row {
  grid-template-columns: minmax(150px, 1.1fr) minmax(160px, 2fr) 62px;
}

.metric-name,
.task-title,
.signal-name {
  font-weight: 800;
}

.metric-desc,
.task-meta,
.signal-desc,
.compare-row span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

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

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--amber), var(--green));
}

.score-pill {
  justify-self: end;
  padding: 6px 9px;
  border-radius: 999px;
  background: #edf6e9;
  color: #34673f;
  font-weight: 800;
}

.score-pill.warn {
  background: #fff3df;
  color: #8d570f;
}

.score-pill.bad {
  background: #ffe8e8;
  color: #9b3030;
}

.signal-map {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff9f1;
  margin-bottom: 12px;
}

.signal-map canvas {
  width: 100%;
  height: 320px;
  display: block;
}

.signal-row {
  grid-template-columns: 1fr 74px;
}

.task-row {
  grid-template-columns: 24px 1fr auto;
}

.task-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.tag {
  padding: 5px 8px;
  border-radius: 999px;
  color: #fff;
  background: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.tag.high {
  background: var(--red);
}

.tag.medium {
  background: var(--amber);
}

.tag.low {
  background: var(--teal);
}

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

.compare-row.header {
  background: var(--nav);
  color: #fffaf2;
  font-weight: 800;
}

.compare-row.header span {
  color: #ead4bd;
}

.insight-pane {
  display: grid;
  gap: 20px;
}

.insight-card {
  padding: 18px;
}

.priority-list {
  padding-left: 20px;
}

.priority-list li {
  padding: 10px 0;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

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

.priority-list strong {
  display: block;
  color: var(--ink);
}

.asset-card {
  overflow: hidden;
}

.asset-visual {
  position: relative;
  height: 150px;
  margin: -18px -18px 16px;
  background:
    linear-gradient(120deg, rgba(217, 137, 53, 0.22), transparent 45%),
    linear-gradient(45deg, rgba(77, 143, 98, 0.24), transparent 56%),
    #2a1d17;
}

.node,
.pulse {
  position: absolute;
  border-radius: 50%;
}

.node {
  width: 46px;
  height: 46px;
  background: #fff3df;
  box-shadow: 0 0 0 8px rgba(255, 238, 218, 0.12);
}

.n1 {
  left: 40px;
  top: 34px;
}

.n2 {
  right: 52px;
  top: 46px;
}

.n3 {
  left: 140px;
  bottom: 24px;
}

.pulse {
  inset: 34px 76px 26px 72px;
  border: 2px solid rgba(255, 225, 188, 0.5);
  animation: pulse 2.8s ease-in-out infinite;
}

.asset-text {
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 0;
}

@keyframes pulse {
  50% {
    transform: scale(1.04);
    opacity: 0.7;
  }
}

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

  .brand-block div:not(.brand-mark),
  .nav-item span,
  .quiet-panel {
    display: none;
  }

  .brand-block {
    justify-content: center;
  }

  .nav-item {
    justify-content: center;
  }

  .summary-band,
  .content-grid {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 12px;
    flex-direction: row;
    align-items: center;
  }

  .side-nav {
    display: flex;
    overflow-x: auto;
  }

  .workspace {
    padding: 14px;
  }

  .topbar,
  .scan-form {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    justify-content: space-between;
  }

  .summary-band {
    padding: 16px;
  }

  .score-block {
    align-items: flex-start;
  }

  .score-copy strong {
    font-size: 42px;
  }

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

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-row,
  .task-row,
  .signal-row,
  .compare-row {
    grid-template-columns: 1fr;
  }

  .task-row {
    position: relative;
    padding-left: 44px;
  }

  .task-row input {
    position: absolute;
    left: 14px;
    top: 18px;
  }

  .score-pill {
    justify-self: start;
  }
}
