:root {
  --bg: #f5f6f8;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: #ffffff;
  --ink: #0f172a;
  --muted: #667085;
  --line: rgba(148, 163, 184, 0.22);
  --line-strong: rgba(148, 163, 184, 0.34);
  --blue: #2563eb;
  --blue-soft: #e8f0ff;
  --green: #1f9d63;
  --green-soft: #e7f7ef;
  --amber: #d97706;
  --amber-soft: #fff3df;
  --red: #dc2626;
  --red-soft: #ffe8e8;
  --indigo: #4f46e5;
  --indigo-soft: #ebe9ff;
  --shadow: 0 12px 36px rgba(15, 23, 42, 0.06);
  --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.04);
  --radius: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.04), transparent 260px),
    var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Microsoft YaHei UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
input,
select {
  outline: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.92);
  backdrop-filter: blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #eef2ff;
  color: var(--blue);
  font-size: 22px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 18px;
}

.brand span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

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

.nav-item {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 0 14px;
  background: transparent;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

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

.nav-item:hover,
.nav-item.active {
  background: #ffffff;
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.sidebar-card {
  margin-top: auto;
  padding: 18px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 250, 255, 0.96));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.sidebar-card strong {
  display: block;
  margin: 8px 0 10px;
}

.sidebar-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

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

.mini-chip {
  padding: 12px;
  border-radius: 14px;
  background: #f7f9fc;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.mini-chip strong {
  display: block;
  margin: 0;
  font-size: 20px;
}

.mini-chip span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

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

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

/* 瘦工具栏：所有视图共用的常驻顶栏（仅一行操作区，不占内容空间） */
.topbar.topbar-slim {
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 14px;
}

/* 主页头部：原工作台大标题区移入主页视图 */
.home-hero {
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0;
  color: #6b7280;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.topbar h1 {
  margin: 6px 0 8px;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: 0;
}

.hero-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
  max-width: 760px;
}

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

.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.segmented button {
  border: 0;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  background: transparent;
  color: #475569;
}

.segmented button.active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.icon-button,
.primary-button,
.ghost-button,
.assistant-bar button {
  border-radius: 14px;
  min-height: 42px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.icon-button:hover,
.primary-button:hover,
.ghost-button:hover,
.assistant-bar button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.icon-button {
  width: 44px;
  display: grid;
  place-items: center;
}

.primary-button {
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-color: rgba(37, 99, 235, 0.16);
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  color: #ffffff;
}

.primary-button.small {
  min-height: 36px;
  border-radius: 12px;
}

.primary-button svg,
.icon-button svg {
  width: 18px;
  height: 18px;
}

.hero-band {
  margin-bottom: 18px;
}

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

.hero-stat {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.hero-stat strong {
  display: block;
  font-size: 22px;
}

.hero-stat span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.context-row {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(200px, 260px) minmax(220px, 300px) 1fr;
  gap: 12px;
}

.context-field {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.context-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.context-field select,
.toolbar input,
.toolbar select,
.assistant-bar input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.context-note {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.6;
  box-shadow: var(--shadow-soft);
}

.assistant-bar {
  display: grid;
  grid-template-columns: 24px minmax(180px, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.assistant-bar svg {
  color: var(--blue);
}

.prompt-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.prompt-chip {
  border: 0;
  border-radius: 999px;
  min-height: 32px;
  padding: 0 12px;
  background: #eef2ff;
  color: #3b4eb5;
  box-shadow: none;
}

.answer-strip {
  display: none;
  margin: 14px 0 18px;
  padding: 16px 18px;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  line-height: 1.8;
}

.answer-strip.active {
  display: block;
}

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

.answer-grid > div {
  padding: 12px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.answer-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.answer-grid strong {
  display: block;
  margin-top: 5px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.kpi-card,
.module,
.list-card,
.action-card,
.feed-card,
.warning-item,
.district-cell,
.event-card,
.analysis-card,
.profile-card,
.match-card,
.risk-card,
.data-card {
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.kpi-card {
  min-height: 128px;
  padding: 16px;
}

.kpi-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  margin-bottom: 12px;
}

.kpi-icon svg {
  width: 18px;
  height: 18px;
}

.tone-blue {
  color: var(--blue);
  background: var(--blue-soft);
}

.tone-green {
  color: var(--green);
  background: var(--green-soft);
}

.tone-amber {
  color: var(--amber);
  background: var(--amber-soft);
}

.tone-red {
  color: var(--red);
  background: var(--red-soft);
}

.tone-indigo {
  color: var(--indigo);
  background: var(--indigo-soft);
}

.kpi-card strong,
.data-card strong {
  display: block;
  font-size: 28px;
  line-height: 1.1;
}

.kpi-card span,
.data-card p,
.list-head p,
.feed-card p,
.warning-item p,
.analysis-card p,
.profile-card p,
.action-card p,
.event-card p,
.risk-card p,
.module p,
.context-note,
.muted {
  color: var(--muted);
}

.kpi-card span {
  display: block;
  margin-top: 8px;
  font-size: 13px;
}

.dashboard-grid,
.two-column,
.workbench {
  display: grid;
  gap: 12px;
}

.dashboard-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 12px;
}

.two-column {
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.9fr);
  margin-bottom: 12px;
}

.workbench {
  grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr);
}

.module {
  padding: 18px;
}

.module-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.module-head h2 {
  margin: 6px 0 0;
  font-size: 19px;
}

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

.stack.compact {
  gap: 8px;
}

.list-card,
.action-card,
.feed-card,
.analysis-card,
.profile-card,
.match-card,
.risk-card,
.data-card {
  padding: 14px;
}

.mini-panel {
  padding: 14px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

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

.list-head strong {
  font-size: 16px;
}

.list-head p {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.65;
}

.compact {
  align-items: center;
}

.badge,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
}

.badge {
  background: #eef2f7;
  color: #475569;
}

.badge.subtle {
  background: #f4f6fa;
}

.badge.high,
.badge.red {
  background: var(--red-soft);
  color: var(--red);
}

.badge.medium,
.badge.amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.low,
.badge.green {
  background: var(--green-soft);
  color: var(--green);
}

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

.tag {
  background: #f1f5f9;
  color: #475569;
}

.tag.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.tag.green {
  background: var(--green-soft);
  color: var(--green);
}

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

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

.toolbar {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 10px;
  margin-bottom: 12px;
}

.toolbar input,
.toolbar select {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.district-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.district-cell {
  padding: 14px;
  min-height: 132px;
}

.district-cell.hot {
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.08), var(--shadow-soft);
}

.district-cell.warm {
  box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.08), var(--shadow-soft);
}

.district-cell.cool {
  box-shadow: inset 0 0 0 1px rgba(31, 157, 99, 0.08), var(--shadow-soft);
}

.cell-score {
  margin: 16px 0 10px;
  font-size: 34px;
  line-height: 1;
  font-weight: 800;
}

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

.warning-list,
.event-list,
#residentProfiles {
  display: grid;
  gap: 10px;
}

.warning-item {
  display: grid;
  grid-template-columns: 8px 1fr;
  gap: 10px;
  padding: 14px;
}

.severity {
  width: 8px;
  border-radius: 999px;
  min-height: 100%;
}

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

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

.severity.low {
  background: var(--green);
}

.bar-chart {
  display: grid;
  gap: 14px;
}

.bar-row {
  display: grid;
  grid-template-columns: 96px 1fr 28px;
  align-items: center;
  gap: 10px;
  color: #475569;
  font-size: 13px;
}

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

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4f46e5, #2563eb, #1f9d63);
}

.event-card,
.profile-card {
  cursor: pointer;
}

.event-card.active,
.profile-card.active {
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.12), var(--shadow);
}

.item-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.analysis-card strong,
.risk-card strong,
.profile-card strong,
.match-card strong,
.feed-card strong,
.action-card strong {
  font-size: 16px;
}

.workflow {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.workflow-step {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.workflow-step span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--blue);
  font-weight: 700;
}

.workflow-step p {
  margin: 4px 0 0;
}

.ghost-button {
  padding: 0 12px;
  box-shadow: none;
  background: #f8fafc;
}

.link-button {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.toolbar.single {
  grid-template-columns: 1fr;
}

.status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.status-actions .ghost-button {
  min-height: 34px;
  border-radius: 999px;
}

.note-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.note-box textarea {
  width: 100%;
  resize: vertical;
  border: 0;
  background: transparent;
  color: var(--ink);
  line-height: 1.7;
}

.note-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.mini-row {
  padding: 10px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.mini-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.mini-row p {
  margin: 0;
  line-height: 1.7;
}

.match-bar {
  height: 8px;
  margin: 10px 0;
  background: #edf2f7;
  border-radius: 999px;
  overflow: hidden;
}

.match-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1f9d63, #2563eb);
}

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

.risk-card {
  min-height: 176px;
}

.risk-score {
  margin: 12px 0 10px;
  font-size: 34px;
  line-height: 1;
  font-weight: 800;
}

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

.data-card {
  min-height: 138px;
}

.data-num {
  margin: 12px 0 10px;
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
}

.graph-panel {
  padding: 18px;
}

.graph-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 12px;
}

.graph-tools {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.graph-level {
  flex: 0 0 auto;
}

.graph-context {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 38px;
  padding: 8px 0 12px;
  color: var(--muted);
  font-size: 12px;
}

.graph-filterbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0 14px;
  border-bottom: 1px solid var(--line);
}

.graph-filterbar select {
  min-width: 120px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.graph-legend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  white-space: nowrap;
}

.legend-dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  border-radius: 50%;
  margin-left: 8px;
}

.legend-dot.community { background: #4f46e5; }
.legend-dot.person { background: #16a34a; }
.legend-dot.event { background: #dc2626; }
.legend-dot.policy { background: #2563eb; }

canvas {
  width: 100%;
  height: 680px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background:
    linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    #ffffff;
  background-size: 28px 28px;
  box-shadow: var(--shadow-soft);
  cursor: grab;
  touch-action: none;
}

canvas.is-panning {
  cursor: grabbing;
}

.node-detail {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  align-self: start;
}

.node-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.graph-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
  gap: 12px;
  margin-top: 12px;
}

.graph-path-panel,
.graph-table-panel {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-strong);
}

.path-empty,
.path-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.path-empty {
  min-height: 74px;
  flex-wrap: wrap;
}

.path-empty span {
  width: 100%;
  color: var(--muted);
  font-size: 12px;
}

.path-head span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.path-head button {
  margin-left: auto;
}

.path-chain {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  margin-top: 14px;
  padding-bottom: 4px;
}

.path-node {
  flex: 0 0 auto;
  max-width: 150px;
  padding: 7px 9px;
  overflow: hidden;
  border-radius: 7px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.path-chain i {
  color: var(--muted);
  font-style: normal;
}

.graph-table-wrap {
  max-height: 260px;
  overflow: auto;
}

.graph-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.graph-table-wrap th,
.graph-table-wrap td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.graph-table-wrap th {
  position: sticky;
  top: 0;
  background: #fff;
  color: var(--muted);
  font-weight: 600;
}

.graph-table-wrap tbody tr {
  cursor: pointer;
}

.graph-table-wrap tbody tr:hover,
.graph-table-wrap tbody tr.active {
  background: var(--blue-soft);
}

.forecast-board {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-strong);
}

.forecast-list,
.scenario-steps {
  display: grid;
  gap: 10px;
}

.forecast-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.forecast-row:last-child {
  border-bottom: 0;
}

.forecast-row p,
.scenario-step p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.forecast-row small {
  color: var(--muted);
}

.forecast-up {
  color: var(--red);
}

.forecast-steady {
  color: var(--green);
}

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

.scenario-step {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(248, 250, 252, 0.72);
}

.scenario-step > b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
}

#evaluationBoard small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.5;
}

.evidence-proof-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.outcome-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto auto;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.outcome-row b {
  color: var(--muted);
  font-weight: 500;
}

.outcome-row i {
  color: var(--muted);
  font-style: normal;
}

.outcome-row strong {
  color: var(--green);
}

.outcome-row em {
  color: var(--green);
  font-style: normal;
  font-weight: 700;
}

@media (max-width: 760px) {
  .graph-context {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .graph-legend {
    width: 100%;
    margin-left: 0;
  }

  .graph-bottom {
    grid-template-columns: 1fr;
  }
  .evidence-proof-grid {
    grid-template-columns: 1fr;
  }

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

  .outcome-row b,
  .outcome-row i {
    display: none;
  }
}

.node-head {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.node-head strong {
  font-size: 18px;
}

.node-head p {
  margin: 0;
  color: var(--muted);
}

.detail-row {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  font-size: 13px;
}

.detail-row span:first-child {
  color: var(--muted);
}

.detail-row:last-child {
  border-bottom: 0;
}

.status-link {
  color: var(--blue);
  text-decoration: none;
}

.status-link:hover {
  text-decoration: underline;
}

@media (max-width: 1200px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .dashboard-grid,
  .risk-board,
  .data-grid,
  .hero-summary,
  .district-map,
  .graph-wrap {
    grid-template-columns: 1fr 1fr;
  }

  .workbench,
  .two-column {
    grid-template-columns: 1fr;
  }

  .graph-wrap {
    grid-template-columns: 1fr;
  }

  .node-detail {
    order: -1;
  }
}

@media (max-width: 760px) {
  .main {
    padding: 16px;
  }

  .topbar {
    flex-direction: column;
  }

  .topbar h1 {
    font-size: 28px;
  }

  .hero-summary,
  .kpi-grid,
  .dashboard-grid,
  .risk-board,
  .data-grid,
  .district-map,
  .mini-grid,
  .hero-summary {
    grid-template-columns: 1fr;
  }

  .context-row,
  .assistant-bar,
  .toolbar,
  .bar-row {
    grid-template-columns: 1fr;
  }

  .assistant-bar {
    justify-items: stretch;
  }

  .assistant-bar svg {
    display: none;
  }

  .assistant-bar button {
    width: 100%;
  }

  .prompt-chips {
    order: 3;
  }
}

.auth-page {
  min-height: 100vh;
  background: #f4f6f8;
  color: #1e293b;
}

.auth-site {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.auth-content-width {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}

.auth-header {
  background: #ffffff;
  border-top: 4px solid #173f73;
  border-bottom: 1px solid #d7dee7;
}

.auth-header-inner {
  width: min(1180px, calc(100% - 48px));
  min-height: 92px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: #173f73;
  text-decoration: none;
}

.auth-emblem {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 2px solid #c9272c;
  border-radius: 50%;
  color: #c9272c;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 26px;
  font-weight: 700;
}

.auth-brand-copy strong,
.auth-brand-copy small {
  display: block;
}

.auth-brand-copy strong {
  font-family: "STSong", "SimSun", serif;
  font-size: 25px;
  letter-spacing: 2px;
}

.auth-brand-copy small {
  margin-top: 6px;
  color: #718096;
  font-size: 12px;
  letter-spacing: 1px;
}

.auth-header-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #778496;
  font-size: 13px;
}

.auth-header-divider {
  width: 1px;
  height: 14px;
  background: #cbd5e1;
}

.auth-navline {
  background: #f9fafb;
  border-bottom: 1px solid #e1e6ec;
}

.auth-navline .auth-content-width {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.auth-nav-current {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 44px;
  color: #173f73;
  font-weight: 700;
}

.auth-nav-current::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: #c9272c;
  content: "";
}

.auth-nav-note {
  color: #8a96a6;
  font-size: 12px;
}

.auth-main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  align-items: center;
  gap: clamp(48px, 8vw, 126px);
  padding-top: 66px;
  padding-bottom: 74px;
}

.auth-intro {
  align-self: center;
  padding-left: clamp(0px, 3vw, 42px);
}

.auth-kicker {
  margin: 0 0 14px;
  color: #c9272c;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
}

.auth-intro h1 {
  margin: 0;
  color: #173f73;
  font-family: "STSong", "SimSun", serif;
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 1px;
}

.auth-title-rule {
  width: 58px;
  height: 3px;
  margin: 20px 0 22px;
  background: #c9272c;
}

.auth-intro-copy {
  max-width: 570px;
  margin: 0;
  color: #667386;
  font-size: 16px;
  line-height: 2;
}

.auth-service-list {
  max-width: 570px;
  display: grid;
  gap: 0;
  margin-top: 38px;
  border-top: 1px solid #d8e0e8;
}

.auth-service-list > div {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 22px;
  padding: 15px 0;
  border-bottom: 1px solid #d8e0e8;
}

.auth-service-list strong {
  color: #334e73;
  font-size: 14px;
}

.auth-service-list span {
  color: #7b8795;
  font-size: 13px;
}

.auth-panel {
  position: relative;
  padding: 34px 38px 30px;
  border: 1px solid #ced8e3;
  border-top: 4px solid #173f73;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(30, 52, 78, 0.08);
}

.auth-panel::before,
.auth-panel::after {
  position: absolute;
  width: 9px;
  height: 9px;
  border-color: #c9272c;
  content: "";
}

.auth-panel::before {
  top: 13px;
  left: 13px;
  border-top: 1px solid;
  border-left: 1px solid;
}

.auth-panel::after {
  right: 13px;
  bottom: 13px;
  border-right: 1px solid;
  border-bottom: 1px solid;
}

.auth-panel-heading {
  padding-bottom: 22px;
  border-bottom: 1px solid #e1e6ec;
}

.auth-panel-heading .auth-kicker {
  margin-bottom: 9px;
}

.auth-panel h2 {
  margin: 0;
  color: #1d3557;
  font-family: "STSong", "SimSun", serif;
  font-size: 27px;
}

.auth-panel-heading p:last-child {
  margin: 9px 0 0;
  color: #8a96a6;
  font-size: 13px;
}

.auth-form {
  display: grid;
  gap: 16px;
  padding-top: 23px;
}

.auth-form label,
.resident-form label {
  display: grid;
  gap: 8px;
  color: #45566d;
  font-size: 13px;
}

.auth-form input,
.auth-form select,
.resident-form input,
.resident-form textarea {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid #cbd5e1;
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.auth-form input::placeholder {
  color: #b0bac6;
}

.auth-form input:focus,
.auth-form select:focus {
  border-color: #4675a8;
  box-shadow: 0 0 0 3px rgba(70, 117, 168, 0.12);
}

.auth-submit {
  width: 100%;
  min-height: 45px;
  justify-content: center;
  border: 0;
  border-radius: 2px;
  background: #1c4c84;
  box-shadow: none;
  font-size: 16px;
  letter-spacing: 3px;
}

.auth-submit:hover {
  background: #153c69;
  box-shadow: none;
}

.auth-demo {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #e1e6ec;
}

.auth-demo-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: #54657b;
  font-size: 13px;
}

.auth-demo-heading small {
  color: #9aa5b3;
  font-size: 11px;
}

.auth-actions,
.resident-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-top: 11px;
}

.auth-actions .ghost-button {
  min-height: 32px;
  padding: 0 5px;
  border-radius: 2px;
  border-color: #d5dee8;
  background: #f8fafc;
  color: #53657c;
  box-shadow: none;
  font-size: 12px;
}

.auth-actions .ghost-button:hover {
  transform: none;
  border-color: #9bb0c8;
  background: #eef4fb;
  box-shadow: none;
}

.auth-register {
  margin: 22px 0 0;
  text-align: center;
  font-size: 13px;
}

.auth-link {
  color: #1c4c84;
  text-decoration: none;
}

.auth-link:hover {
  color: #c9272c;
  text-decoration: underline;
}

.auth-notice {
  margin-top: 20px;
  padding: 10px 12px;
  border: 1px solid #e6eaf0;
  background: #fafbfd;
  color: #8a96a6;
  font-size: 11px;
  line-height: 1.7;
}

.auth-notice span {
  margin-right: 5px;
  color: #c9272c;
}

.auth-footer {
  border-top: 1px solid #d7dee7;
  background: #ffffff;
}

.auth-footer .auth-content-width {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  color: #98a2af;
  font-size: 11px;
}

/* Government portal visual system for operational and resident pages. */
:root {
  --gov-navy: #173f73;
  --gov-blue: #1d548d;
  --gov-red: #c4262d;
  --gov-bg: #f3f5f7;
  --gov-line: #d8e0e8;
  --gov-text: #25364a;
  --gov-muted: #718094;
}

body:not(.auth-page) {
  background: var(--gov-bg);
  color: var(--gov-text);
}

body:not(.auth-page) .brand-mark {
  border: 2px solid var(--gov-red);
  border-radius: 50%;
  background: #ffffff;
  color: var(--gov-red);
  font-family: "STKaiti", "KaiTi", serif;
  box-shadow: none;
}

body:not(.auth-page) .brand strong {
  color: var(--gov-navy);
  font-family: "STSong", "SimSun", serif;
  letter-spacing: 1px;
}

body:not(.auth-page) .brand span {
  color: var(--gov-muted);
}

.gov-utility {
  min-height: 38px;
  margin: -28px -28px 24px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--gov-line);
  background: #ffffff;
  color: #8995a3;
  font-size: 12px;
}

.gov-utility span:first-child {
  color: #536981;
}

.sidebar {
  padding-top: 0;
  border-right: 1px solid #cfd9e4;
  background: #ffffff;
  backdrop-filter: none;
}

.sidebar .brand {
  min-height: 82px;
  margin: 0 -16px;
  padding: 0 20px;
  border-top: 4px solid var(--gov-navy);
  border-bottom: 1px solid var(--gov-line);
}

.sidebar-caption {
  padding: 10px 12px 6px;
  border-left: 3px solid var(--gov-red);
  color: var(--gov-navy);
  font-size: 13px;
  font-weight: 700;
}

.nav {
  gap: 6px;
}

.nav-item {
  min-height: 43px;
  border-radius: 2px;
  color: #52647a;
}

.nav-item:hover,
.nav-item.active {
  background: #edf4fb;
  border-color: #d5e2ef;
  box-shadow: none;
  color: var(--gov-navy);
  transform: none;
}

.nav-item.active {
  border-left: 3px solid var(--gov-red);
  padding-left: 11px;
  font-weight: 700;
}

.sidebar-card {
  border-radius: 2px;
  background: #f7f9fb;
  box-shadow: none;
}

.main {
  padding-top: 28px;
}

.topbar {
  min-height: 68px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--gov-line);
}

.topbar h1 {
  color: var(--gov-navy);
  font-family: "STSong", "SimSun", serif;
  font-size: 30px;
}

.eyebrow {
  color: var(--gov-red);
}

.segmented,
.icon-button,
.primary-button,
.ghost-button,
.assistant-bar button,
.hero-stat,
.context-field,
.context-note,
.assistant-bar,
.module,
.kpi-card,
.list-card,
.action-card,
.feed-card,
.warning-item,
.district-cell,
.event-card,
.analysis-card,
.profile-card,
.match-card,
.risk-card,
.data-card,
.node-detail,
.toolbar input,
.toolbar select {
  border-radius: 2px;
}

.segmented {
  background: #f7f9fb;
  box-shadow: none;
}

.segmented button {
  border-radius: 2px;
}

.segmented button.active {
  background: var(--gov-navy);
  color: #ffffff;
  box-shadow: none;
}

.icon-button,
.primary-button,
.ghost-button,
.assistant-bar button {
  box-shadow: none;
}

.primary-button {
  border-color: var(--gov-blue);
  background: var(--gov-blue);
}

.primary-button:hover {
  background: var(--gov-navy);
  box-shadow: none;
}

.ghost-button {
  background: #f7f9fb;
}

.hero-stat,
.context-field,
.context-note,
.assistant-bar,
.module,
.kpi-card,
.list-card,
.action-card,
.feed-card,
.warning-item,
.district-cell,
.event-card,
.analysis-card,
.profile-card,
.match-card,
.risk-card,
.data-card,
.node-detail {
  background: #ffffff;
  box-shadow: 0 3px 12px rgba(30, 54, 82, 0.045);
}

.hero-stat strong,
.kpi-card strong,
.data-card strong,
.risk-score,
.data-num {
  color: var(--gov-navy);
}

.context-field span,
.list-head p,
.item-meta,
.module p,
.muted {
  color: var(--gov-muted);
}

.prompt-chip {
  border-radius: 2px;
  background: #edf4fb;
  color: var(--gov-navy);
}

.bar-fill {
  background: var(--gov-blue);
}

.badge,
.tag {
  border-radius: 2px;
}

.badge {
  background: #eef2f6;
  color: #53647a;
}

.badge.high,
.badge.red,
.tag.red {
  background: #f9e8e9;
  color: var(--gov-red);
}

.badge.medium,
.badge.amber,
.tag.amber {
  background: #fbf1df;
  color: #9a651d;
}

.badge.low,
.badge.green,
.tag.green {
  background: #e8f3ed;
  color: #2f7653;
}

.tag.blue {
  background: #eaf1f8;
  color: var(--gov-navy);
}

.workflow-step,
.mini-panel,
.note-box {
  border-radius: 2px;
  background: #f7f9fb;
}

.workflow-step span {
  border-radius: 2px;
  background: #eaf1f8;
  color: var(--gov-navy);
}

.global-search,
.resident-search {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--gov-line);
  border-radius: 2px;
  background: #ffffff;
}

.global-search {
  width: 220px;
}

.global-search svg,
.resident-search svg {
  width: 16px;
  color: #8190a1;
}

.global-search input,
.resident-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--gov-text);
  background: transparent;
  font-size: 12px;
}

.tool-button {
  position: relative;
}

.tool-button b {
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 9px;
  background: var(--gov-red);
  color: #ffffff;
  font-size: 9px;
  line-height: 14px;
  text-align: center;
}

.role-focus {
  margin-bottom: 16px;
}

.role-focus .module-head {
  margin-bottom: 12px;
}

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

.role-focus-item {
  min-height: 94px;
  padding: 12px;
  border: 1px solid var(--gov-line);
  border-left: 3px solid var(--gov-blue);
  background: #f9fbfd;
}

.role-focus-item strong {
  display: block;
  margin-bottom: 8px;
  color: var(--gov-navy);
  font-size: 13px;
}

.role-focus-item .badge {
  margin-bottom: 6px;
}

.role-focus-item p {
  margin: 0;
  color: var(--gov-muted);
  font-size: 12px;
  line-height: 1.6;
}

.tool-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--gov-navy);
}

.tool-results {
  display: grid;
  gap: 4px;
}

.empty-state {
  padding: 22px 14px;
  border: 1px dashed #cbd6e0;
  background: #fafbfd;
  text-align: center;
}

.empty-state strong {
  color: var(--gov-navy);
}

.empty-state p {
  margin: 6px 0 0;
  color: var(--gov-muted);
  font-size: 12px;
}

.resident-quickbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.resident-search {
  flex: 1;
}

.resident-quickbar .ghost-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.resident-quickbar .ghost-button svg {
  width: 15px;
}

.resident-history-panel {
  display: none;
}

.resident-history-panel.active {
  display: block;
}

@media (max-width: 1200px) {
  .role-focus-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .global-search {
    width: 100%;
    order: 10;
  }

  .top-actions {
    width: 100%;
  }

  .role-focus-grid {
    grid-template-columns: 1fr;
  }

  .resident-quickbar {
    flex-wrap: wrap;
  }

  .resident-search {
    flex-basis: 100%;
  }
}

@media (max-width: 960px) {
  .auth-main,
  .resident-hero {
    grid-template-columns: 1fr;
  }

  .auth-intro {
    padding-left: 0;
  }

  .auth-panel {
    width: min(520px, 100%);
    margin: 0 auto;
  }
}

@media (max-width: 760px) {
  .auth-content-width,
  .auth-header-inner {
    width: min(100% - 28px, 1180px);
  }

  .auth-header-inner {
    min-height: 78px;
  }

  .auth-emblem {
    width: 44px;
    height: 44px;
    font-size: 22px;
  }

  .auth-brand-copy strong {
    font-size: 20px;
  }

  .auth-brand-copy small,
  .auth-header-meta,
  .auth-nav-note {
    display: none;
  }

  .auth-main {
    gap: 34px;
    padding-top: 38px;
    padding-bottom: 44px;
  }

  .auth-intro h1 {
    font-size: 30px;
  }

  .auth-intro-copy {
    font-size: 14px;
  }

  .auth-service-list {
    margin-top: 24px;
  }

  .auth-service-list > div {
    grid-template-columns: 92px 1fr;
    gap: 12px;
    padding: 12px 0;
  }

  .auth-panel {
    padding: 28px 22px 24px;
  }

  .auth-footer .auth-content-width {
    min-height: 48px;
    flex-wrap: wrap;
    gap: 5px 16px;
    padding-top: 9px;
    padding-bottom: 9px;
  }

  .resident-top,
  .resident-main {
    padding-left: 16px;
    padding-right: 16px;
  }

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

/* Final portal overrides keep every non-auth page on the same visual language. */
body:not(.auth-page) .module-head {
  padding-bottom: 11px;
  border-bottom: 1px solid #e0e6ec;
}

body:not(.auth-page) .module-head h2 {
  color: var(--gov-navy);
  font-family: "STSong", "SimSun", serif;
  font-size: 18px;
}

body:not(.auth-page) .module-head .eyebrow {
  padding-left: 8px;
  border-left: 3px solid var(--gov-red);
}

body:not(.auth-page) .toolbar input,
body:not(.auth-page) .toolbar select,
body:not(.auth-page) .context-field select,
body:not(.auth-page) .assistant-bar input {
  border-radius: 2px;
}

body:not(.auth-page) .toolbar input,
body:not(.auth-page) .toolbar select {
  border-color: #cbd7e2;
}

body:not(.auth-page) .toolbar input:focus,
body:not(.auth-page) .toolbar select:focus,
body:not(.auth-page) .context-field select:focus,
body:not(.auth-page) .assistant-bar input:focus {
  border-color: #6d91b5;
  box-shadow: 0 0 0 3px rgba(29, 84, 141, 0.1);
}

body:not(.auth-page) .kpi-card,
body:not(.auth-page) .data-card,
body:not(.auth-page) .risk-card {
  border-top: 3px solid #dbe6f0;
}

body:not(.auth-page) .kpi-card:first-child,
body:not(.auth-page) .data-card:first-child {
  border-top-color: var(--gov-navy);
}

body:not(.auth-page) .warning-item {
  border-left: 3px solid #dfe6ed;
}

body:not(.auth-page) .warning-item:has(.severity.high) {
  border-left-color: var(--gov-red);
}

body:not(.auth-page) .warning-item:has(.severity.medium) {
  border-left-color: #bb812d;
}

body:not(.auth-page) .warning-item:has(.severity.low) {
  border-left-color: #4c8a68;
}

body:not(.auth-page) canvas {
  border-radius: 2px;
  background:
    linear-gradient(rgba(111, 137, 163, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(111, 137, 163, 0.08) 1px, transparent 1px),
    #ffffff;
  background-size: 28px 28px;
}

body:not(.auth-page) .node-detail {
  border-top: 3px solid var(--gov-navy);
}

body:not(.auth-page) .event-card.active,
body:not(.auth-page) .profile-card.active {
  border-color: #7092b4;
  box-shadow: inset 3px 0 0 var(--gov-red), 0 3px 12px rgba(30, 54, 82, 0.07);
}

.resident-content-width {
  width: min(1180px, calc(100% - 48px));
  margin-right: auto;
  margin-left: auto;
}

.resident-shell {
  background: var(--gov-bg);
}

.resident-top {
  padding: 0;
  border-top: 4px solid var(--gov-navy);
  border-bottom: 1px solid var(--gov-line);
  background: #ffffff;
}

.resident-topbar {
  width: min(1180px, calc(100% - 48px));
  min-height: 88px;
  max-width: none;
  margin: 0 auto;
}

.resident-top .brand {
  min-height: 58px;
}

.resident-top .brand-mark {
  width: 48px;
  height: 48px;
}

.resident-top .brand strong {
  color: var(--gov-navy);
  font-family: "STSong", "SimSun", serif;
  font-size: 23px;
}

.resident-header-meta {
  margin-left: auto;
  color: #7c8998;
  font-size: 13px;
}

.resident-navline {
  border-bottom: 1px solid var(--gov-line);
  background: #f9fafb;
}

.resident-navline .resident-content-width {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 18px;
  color: #8b97a4;
  font-size: 12px;
}

.resident-nav-current {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 44px;
  color: var(--gov-navy);
  font-weight: 700;
}

.resident-nav-current::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--gov-red);
  content: "";
}

.resident-main {
  max-width: none;
  padding: 34px 0 44px;
  gap: 16px;
}

.resident-hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
}

.resident-list {
  display: grid;
  gap: 12px;
}

.resident-card,
.resident-panel {
  border: 1px solid var(--gov-line);
  border-radius: 2px;
  background: #ffffff;
  box-shadow: 0 3px 12px rgba(30, 54, 82, 0.045);
  padding: 20px;
}

.resident-card h1 {
  margin: 0 0 8px;
  color: var(--gov-navy);
  font-family: "STSong", "SimSun", serif;
  font-size: 30px;
}

.resident-card p {
  margin: 0;
  color: var(--gov-muted);
  line-height: 1.7;
}

.resident-card .eyebrow,
.resident-panel .eyebrow {
  padding-left: 8px;
  border-left: 3px solid var(--gov-red);
}

.resident-form textarea {
  min-height: 120px;
  padding: 12px 14px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: #ffffff;
}

.resident-grid .resident-card {
  min-height: 142px;
}

.resident-grid .resident-card strong {
  color: var(--gov-navy);
}

.resident-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.resident-task-item {
  cursor: pointer;
}

.resident-task-item:hover {
  border-color: #7898b8;
  background: #f8fbfe;
}

.resident-request-form textarea,
.resident-form textarea {
  min-height: 88px;
  padding: 10px 12px;
  resize: vertical;
}

.resident-form input,
.resident-form select,
.resident-form textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd7e2;
  border-radius: 2px;
  background: #ffffff;
  color: var(--gov-text);
}

.request-detail h3 {
  margin: 22px 0 10px;
  padding-left: 8px;
  border-left: 3px solid var(--gov-red);
  color: var(--gov-navy);
  font-size: 15px;
}

.site-footer {
  border-top: 1px solid var(--gov-line);
  background: #ffffff;
}

.site-footer-inner {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 18px 0;
  color: #718094;
  font-size: 12px;
  line-height: 1.8;
}

.site-footer-inner strong {
  display: block;
  color: var(--gov-navy);
  font-family: "STSong", "SimSun", serif;
  font-size: 15px;
}

.site-footer-items {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}

.site-footer a {
  color: var(--gov-blue);
  text-decoration: none;
}

.site-footer small {
  color: #9aa5b2;
}

.article-page {
  background: var(--gov-bg);
}

.article-shell {
  width: min(1180px, calc(100% - 48px));
  min-height: calc(100vh - 112px);
  margin: 0 auto;
  background: #ffffff;
}

.article-header {
  min-height: 82px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 4px solid var(--gov-navy);
  border-bottom: 1px solid var(--gov-line);
}

.article-brand {
  color: var(--gov-navy);
  font-family: "STSong", "SimSun", serif;
  font-size: 22px;
  text-decoration: none;
}

.article-brand small {
  margin-left: 12px;
  color: var(--gov-muted);
  font-family: inherit;
  font-size: 12px;
}

.article-header nav {
  display: flex;
  gap: 18px;
}

.article-header nav a {
  color: var(--gov-blue);
  font-size: 13px;
  text-decoration: none;
}

.article-content {
  max-width: 860px;
  margin: 0 auto;
  padding: 48px 32px 72px;
}

.article-kicker {
  margin: 0 0 12px;
  color: var(--gov-red);
  font-size: 13px;
}

.article-content h1 {
  margin: 0;
  color: var(--gov-navy);
  font-family: "STSong", "SimSun", serif;
  font-size: 32px;
  line-height: 1.45;
}

.article-meta {
  margin: 18px 0 30px;
  padding: 12px 0;
  border-top: 1px solid var(--gov-line);
  border-bottom: 1px solid var(--gov-line);
  color: var(--gov-muted);
  font-size: 12px;
}

.article-body {
  color: #3d4c5d;
  font-size: 15px;
  line-height: 2;
}

.article-body h2 {
  margin-top: 28px;
  color: var(--gov-navy);
  font-size: 18px;
}

.article-body ul {
  padding-left: 24px;
}

.article-tools {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 18px;
}

.article-tools button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--gov-line);
  border-radius: 2px;
  background: #f8fafc;
  color: var(--gov-blue);
  cursor: pointer;
}

.site-settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}

.site-settings-grid label {
  display: grid;
  gap: 5px;
  color: var(--gov-muted);
  font-size: 12px;
}

.site-settings-grid input {
  min-height: 36px;
  padding: 0 8px;
  border: 1px solid var(--gov-line);
  border-radius: 2px;
}

@media (max-width: 760px) {
  .gov-utility {
    display: none;
  }

  .main {
    padding-top: 16px;
  }

  .resident-content-width,
  .resident-topbar {
    width: min(100% - 28px, 1180px);
  }

  .resident-top {
    padding-right: 0;
    padding-left: 0;
  }

  .resident-topbar {
    min-height: 76px;
  }

  .resident-header-meta {
    display: none;
  }

  .resident-main {
    padding-top: 24px;
  }

  .resident-hero {
    grid-template-columns: 1fr;
  }

  .site-footer-inner {
    width: min(100% - 28px, 1180px);
  }

  .article-shell {
    width: min(100% - 28px, 1180px);
  }

  .article-header {
    padding: 0 16px;
  }

  .article-brand small {
    display: none;
  }

  .article-content {
    padding: 32px 18px 48px;
  }

  .article-content h1 {
    font-size: 25px;
  }

  .site-settings-grid {
    grid-template-columns: 1fr;
  }
}

/* Final interaction pass: compact workbench hierarchy, real icon semantics, and mobile navigation. */
.top-more {
  position: relative;
}

.top-more summary {
  list-style: none;
}

.top-more summary::-webkit-details-marker {
  display: none;
}

.top-more-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  width: 188px;
  padding: 6px;
  border: 1px solid var(--gov-line);
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(30, 54, 82, 0.14);
}

.tool-menu-item {
  position: relative;
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--gov-text);
  text-align: left;
  font-size: 12px;
}

.tool-menu-item:hover {
  background: #edf4fb;
  color: var(--gov-navy);
}

.tool-menu-item svg {
  width: 16px;
  height: 16px;
  color: var(--gov-blue);
}

.tool-menu-item b {
  margin-left: auto;
  min-width: 16px;
  padding: 1px 4px;
  background: var(--gov-red);
  color: #ffffff;
  font-size: 10px;
  text-align: center;
}

.dashboard-details {
  align-self: start;
}

.module-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.module-summary::-webkit-details-marker {
  display: none;
}

.module-summary::after {
  content: "+";
  color: var(--gov-blue);
  font-size: 20px;
  line-height: 1;
}

.dashboard-details[open] .module-summary::after {
  content: "−";
}

.module-summary h2 {
  margin: 6px 0 0;
  color: var(--gov-navy);
  font-family: "STSong", "SimSun", serif;
  font-size: 18px;
}

.module-summary .eyebrow {
  padding-left: 8px;
  border-left: 3px solid var(--gov-red);
}

.summary-hint {
  margin-left: auto;
  padding: 4px 7px;
  background: #f3f6f9;
  color: var(--gov-muted);
  font-size: 11px;
}

.details-content {
  padding-top: 14px;
}

.module-inline-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.module-inline-toolbar select {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #cbd7e2;
  border-radius: 2px;
  background: #ffffff;
  color: var(--gov-text);
}

.mobile-nav-toggle,
.sidebar-scrim {
  display: none;
}

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

.resident-quick-action {
  min-height: 82px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--gov-line);
  border-left: 3px solid var(--gov-blue);
  border-radius: 2px;
  background: #ffffff;
  color: var(--gov-text);
  text-align: left;
}

.resident-quick-action:hover {
  border-color: #7898b8;
  background: #f8fbfe;
}

.resident-action-icon {
  flex: 0 0 auto;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  color: var(--gov-blue);
}

.resident-action-icon svg {
  width: 20px;
  height: 20px;
}

.resident-action-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.resident-action-copy strong {
  color: var(--gov-navy);
  font-size: 13px;
}

.resident-action-copy small {
  color: var(--gov-muted);
  font-size: 11px;
  line-height: 1.5;
}

.resident-action-arrow {
  margin-left: auto;
  color: var(--gov-blue);
  font-size: 20px;
}

.intelligence-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.intelligence-form {
  display: grid;
  gap: 12px;
}

.intelligence-form label {
  display: grid;
  gap: 6px;
  color: var(--gov-muted);
  font-size: 12px;
}

.intelligence-form input,
.intelligence-form select,
.intelligence-form textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid #cbd7e2;
  border-radius: 2px;
  background: #ffffff;
  color: var(--gov-text);
}

.intelligence-form textarea {
  resize: vertical;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.file-picker {
  padding: 12px;
  border: 1px dashed #9db2c8;
  background: #f8fbfe;
}

.intelligence-result {
  margin-top: 12px;
}

.champion-cockpit {
  margin-bottom: 12px;
  padding: 20px;
  border-top: 3px solid var(--gov-red);
  background: linear-gradient(135deg, #ffffff 0%, #f3f8fc 100%);
}

.cockpit-headline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.cockpit-headline h2 {
  margin: 6px 0 4px;
  color: var(--gov-navy);
  font-family: "STSong", "SimSun", serif;
  font-size: 22px;
}

.cockpit-headline p {
  margin: 0;
}

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

.cockpit-metric {
  min-height: 74px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px 14px;
  border-left: 3px solid var(--gov-blue);
  background: #ffffff;
}

.cockpit-metric.red { border-color: var(--gov-red); }
.cockpit-metric.amber { border-color: #b97816; }
.cockpit-metric.green { border-color: #287a55; }
.cockpit-metric strong { font-size: 24px; color: var(--gov-navy); }
.cockpit-metric span { color: var(--gov-muted); font-size: 12px; }

.cockpit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.85fr);
  gap: 12px;
}

.cockpit-priority,
.cockpit-queue {
  padding: 16px;
  border: 1px solid var(--gov-line);
  background: #ffffff;
}

.cockpit-priority h3,
.cockpit-queue h3 {
  margin: 4px 0;
  color: var(--gov-navy);
  font-size: 17px;
}

.cockpit-priority > p {
  line-height: 1.7;
}

.evidence-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.evidence-strip > div {
  min-width: 0;
  padding: 10px;
  background: #f6f9fc;
  border: 1px solid #e1e9f0;
}

.evidence-strip span,
.evidence-strip strong {
  display: block;
}

.evidence-strip span {
  color: var(--gov-muted);
  font-size: 11px;
}

.evidence-strip strong {
  margin-top: 5px;
  overflow: hidden;
  color: var(--gov-navy);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cockpit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.queue-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #e8eef3;
}

.queue-row:last-child { border-bottom: 0; }
.queue-row strong { color: var(--gov-navy); font-size: 13px; }
.queue-row p { margin: 4px 0 0; font-size: 11px; }

.cockpit-review {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--gov-line);
  color: var(--gov-muted);
  font-size: 12px;
}

.cockpit-review svg { color: var(--gov-blue); }
.cockpit-review b { margin-left: auto; color: var(--gov-navy); }

.policy-gap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
  color: var(--gov-muted);
  font-size: 11px;
}

.policy-gap b {
  padding: 3px 6px;
  background: #e8f5ed;
  color: #23714e;
  font-weight: 700;
}

.policy-gap b.missing {
  background: #fff3df;
  color: #976016;
}

.effectiveness-module {
  margin-bottom: 12px;
}

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

.effectiveness-metric {
  padding: 14px;
  border: 1px solid var(--gov-line);
  border-top: 3px solid var(--gov-blue);
  background: #fff;
}

.effectiveness-metric strong,
.effectiveness-metric span,
.effectiveness-metric small {
  display: block;
}

.effectiveness-metric strong {
  color: var(--gov-navy);
  font-size: 23px;
}

.effectiveness-metric span {
  margin-top: 5px;
  color: var(--gov-text);
  font-size: 12px;
  font-weight: 700;
}

.effectiveness-metric small {
  margin-top: 4px;
  color: var(--gov-muted);
  font-size: 11px;
}

.effectiveness-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.effectiveness-grid > div {
  padding: 14px;
  border: 1px solid var(--gov-line);
  background: #f8fbfe;
}

.performance-row {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) 45px minmax(90px, 1.5fr);
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #e5edf3;
  color: var(--gov-text);
  font-size: 12px;
}

.performance-row b {
  color: var(--gov-blue);
  text-align: right;
}

.performance-row i {
  height: 6px;
  overflow: hidden;
  background: #dbe6ef;
}

.performance-row em {
  display: block;
  height: 100%;
  background: var(--gov-blue);
}

.effectiveness-note {
  margin: 12px 0 0;
  color: var(--gov-muted);
  font-size: 12px;
}

.dossier-evidence {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #c9dce9;
  border-left: 3px solid var(--gov-blue);
  background: #f7fbfe;
}

.dossier-evidence .evidence-strip {
  margin-bottom: 10px;
}

.trend-list {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--gov-line);
}

.trend-list > strong {
  display: block;
  margin-bottom: 7px;
  color: var(--gov-navy);
  font-size: 12px;
}

.trend-row {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) 35px 25px auto;
  align-items: center;
  gap: 7px;
  padding: 7px 0;
  border-bottom: 1px solid #e8eef3;
  font-size: 12px;
}

.trend-row b {
  color: var(--gov-navy);
  text-align: right;
}

.trend-row i {
  font-style: normal;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
}

.trend-row i.up { color: var(--gov-red); }
.trend-row i.steady { color: var(--gov-muted); }
.trend-row small { color: var(--gov-muted); }

.evidence-details {
  margin-top: 12px;
  border: 1px solid var(--gov-line);
  background: #f8fbfe;
}

.evidence-details summary {
  padding: 10px 12px;
  cursor: pointer;
  color: var(--gov-navy);
  font-size: 12px;
  font-weight: 700;
}

.evidence-details .stack {
  padding: 0 12px 12px;
}

.evidence-files {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #dce8f0;
}

.evidence-files > strong {
  display: block;
  margin-bottom: 7px;
  color: var(--gov-navy);
  font-size: 12px;
}

.event-followup {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #c9d8e4;
}

.event-followup label {
  display: grid;
  gap: 5px;
  color: var(--gov-muted);
  font-size: 11px;
}

.event-followup input {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid #cbd7e2;
  border-radius: 2px;
  background: #fff;
  color: var(--gov-text);
}

@media (max-width: 900px) {
  .cockpit-grid { grid-template-columns: 1fr; }
  .cockpit-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .effectiveness-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .effectiveness-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .cockpit-headline { display: block; }
  .cockpit-headline > .badge { display: inline-flex; margin-top: 10px; }
  .evidence-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cockpit-review { align-items: flex-start; flex-wrap: wrap; }
  .cockpit-review b { width: 100%; margin-left: 24px; }
  .effectiveness-metrics { grid-template-columns: 1fr 1fr; }
  .trend-row { grid-template-columns: minmax(70px, 1fr) 30px 22px; }
  .trend-row small { grid-column: 1 / -1; }
}

.opportunity-card button {
  margin-top: 8px;
}

@media (max-width: 900px) {
  .graph-wrap {
    grid-template-columns: 1fr;
  }

  .node-detail {
    order: -1;
  }

  .graph-bottom {
    grid-template-columns: 1fr;
  }

  .shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    z-index: 30;
    inset: 0 auto 0 0;
    width: min(290px, 82vw);
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 12px 0 28px rgba(30, 54, 82, 0.14);
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 25;
    inset: 0;
    border: 0;
    background: rgba(15, 35, 58, 0.26);
  }

  body.nav-open .sidebar-scrim {
    display: block;
  }

  .main {
    padding: 16px;
  }

  .gov-utility {
    margin: -16px -16px 18px;
    padding: 0 16px;
  }

  .mobile-nav-toggle {
    display: grid;
  }

  .topbar {
    align-items: stretch;
  }

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

  .global-search {
    order: 3;
    width: 100%;
  }

  .top-more-menu {
    position: fixed;
    top: auto;
    right: 16px;
    bottom: 76px;
  }

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

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

@media (max-width: 600px) {
  .main {
    padding: 12px;
  }

  .gov-utility {
    display: none;
  }

  .topbar h1 {
    font-size: 27px;
  }

  .top-actions {
    gap: 7px;
  }

  .top-actions > .badge,
  .top-actions > .segmented,
  .top-actions > .primary-button,
  .top-actions > .ghost-button {
    min-height: 38px;
  }

  .top-actions > .segmented {
    order: 2;
  }

  .top-actions > .primary-button {
    order: 3;
  }

  .top-actions > .top-more {
    order: 4;
  }

  .top-actions > .ghost-button {
    order: 5;
  }

  .top-actions > .mobile-nav-toggle {
    order: 6;
  }

  .hero-summary,
  .kpi-grid,
  .dashboard-grid,
  .risk-board,
  .data-grid,
  .district-map {
    grid-template-columns: 1fr;
  }

  .two-column,
  .workbench {
    grid-template-columns: 1fr;
  }

  .assistant-bar {
    grid-template-columns: 1fr;
  }

  .assistant-bar > svg {
    display: none;
  }

  .assistant-bar button {
    width: 100%;
  }

  .prompt-chips {
    order: 3;
  }

  .resident-quick-actions {
    grid-template-columns: 1fr;
  }

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

  .resident-main {
    padding-top: 22px;
  }
}
