:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #5e6a75;
  --line: #d9e0e7;
  --panel: #ffffff;
  --bg: #f4f7f9;
  --accent: #0c6b58;
  --accent-soft: #e4f3ef;
  --warn: #9a5a00;
  --warn-soft: #fff3dc;
  --danger: #9b1c1c;
  --danger-soft: #fde8e8;
  --ok: #176b2c;
  --ok-soft: #e5f4e8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", Arial, sans-serif;
}

button,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  min-height: 38px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

button:disabled {
  color: #9aa4ae;
  background: #eef2f5;
  cursor: not-allowed;
}

select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}

.demo-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.demo-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 8px;
  font-size: 30px;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

h3 {
  font-size: 14px;
  margin-bottom: 6px;
}

.subtitle,
.muted {
  color: var(--muted);
}

.status-strip,
.toolbar,
.panel-title-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.badge.neutral {
  background: #e9eef3;
  color: #4d5964;
}

.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  margin-bottom: 16px;
}

.select-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

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

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

.step-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  min-height: 62px;
}

.step-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.step-item.done {
  border-color: #b8d8c3;
  background: #f2faf4;
}

.step-id {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.timeline-list.empty {
  color: var(--muted);
  min-height: 180px;
  align-content: center;
}

.event-row {
  border-left: 4px solid var(--accent);
  padding: 10px 12px;
  background: #f9fbfc;
  border-radius: 6px;
}

.event-meta {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.kpi-list {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
}

.kpi-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.kpi-list dt {
  color: var(--muted);
}

.kpi-list dd {
  margin: 0;
  font-weight: 800;
}

.resident-box {
  padding: 12px;
  border-radius: 6px;
  background: #f8fafb;
}


.resident-box h3 {
  margin-bottom: 10px;
}

.resident-list-placeholder {
  margin: 0;
  color: var(--muted);
}

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

.resident-item {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: #fff;
  padding: 10px;
}

.resident-item-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.resident-item strong {
  font-size: 18px;
}

.resident-item-main span {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #fee4e2;
  color: #b42318;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 8px;
}

.resident-item p {
  margin: 6px 0 0;
  color: #344054;
  font-size: 14px;
  line-height: 1.4;
}

.resident-item small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.briefing-layout {
  margin-top: 16px;
}

.briefing-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.briefing-panel {
  min-height: 220px;
}

.briefing-sections {
  display: grid;
  gap: 12px;
}

.briefing-section {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.check-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.check-item {
  padding: 10px;
  border-radius: 6px;
  background: var(--ok-soft);
  color: var(--ok);
  font-weight: 700;
}

.log-panel {
  margin-top: 16px;
}

#logBox {
  min-height: 100px;
  max-height: 260px;
  overflow: auto;
  margin: 0;
  white-space: pre-wrap;
  color: #26323d;
}

@media (max-width: 1080px) {
  .demo-header,
  .grid {
    grid-template-columns: 1fr;
  }

  .demo-header {
    display: grid;
  }
}

@media (max-width: 640px) {
  .demo-shell {
    padding: 14px;
  }

  h1 {
    font-size: 24px;
  }

  .toolbar button,
  .toolbar select,
  .select-label {
    width: 100%;
  }
}

.badge.mode-icsn {
  background: #e8f3ff;
  color: #0b5394;
  border-color: #9fc5e8;
}

.badge.mode-linked {
  background: #eaf7ef;
  color: #146c2e;
  border-color: #9fd4ad;
}

.badge.mode-partial {
  background: #fff6df;
  color: #8a5a00;
  border-color: #e5c46d;
}

.mode-meta {
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
  background: #f8fbfd;
}

.mode-meta-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.mode-meta-header p {
  margin: 0;
  color: #44546a;
  font-size: 13px;
}

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

.domain-grid h3 {
  font-size: 13px;
  margin: 0 0 8px;
}

.domain-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.domain-list span,
.empty-token {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid #d8dee9;
  background: #fff;
}

.domain-list.available span {
  border-color: #b7d7bd;
  background: #eef8f0;
}

.domain-list.forbidden span {
  border-color: #e6b4b4;
  background: #fff1f1;
}

.source-map {
  margin-top: 12px;
}

.source-map summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
}

.source-map-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.source-map-list article {
  border: 1px solid #e3e8ef;
  border-radius: 6px;
  padding: 8px;
  background: #fff;
}

.source-map-list strong,
.source-map-list span {
  display: block;
  font-size: 12px;
}

.source-map-list span {
  color: #667085;
  margin-top: 2px;
}

.source-map-list p {
  margin: 4px 0 0;
  font-size: 12px;
  color: #344054;
}


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

.trust-item {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.trust-item span,
.trust-item strong,
.trust-item small {
  display: block;
}

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

.trust-item strong {
  margin-top: 6px;
  color: var(--ink);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.trust-item small {
  margin-top: 5px;
  color: #52606d;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.briefing-meta {
  margin-bottom: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f4f7f9;
  color: #52606d;
  font-size: 13px;
  font-weight: 700;
}

.briefing-meta.actual {
  border-color: #9fd4ad;
  background: #eaf7ef;
  color: #146c2e;
}

.briefing-meta.fallback {
  border-color: #e5c46d;
  background: #fff6df;
  color: #8a5a00;
}

.briefing-summary {
  margin: 0 0 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  color: #344054;
  line-height: 1.6;
}

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

@media (max-width: 640px) {
  .trust-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 760px) {
  .domain-grid {
    grid-template-columns: 1fr;
  }
}
