* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--color-background); color: var(--color-text); font: var(--text-body)/1.6 var(--font-ui); letter-spacing: 0; }
button, input, select { font: inherit; letter-spacing: 0; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
:focus-visible { outline: 3px solid var(--color-primary-dark); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -60px; left: 16px; z-index: 30; padding: 8px 16px; background: #fff; color: var(--color-primary-dark); }
.skip-link:focus { top: 8px; }
.site-header { background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.site-header-inner { max-width: 1440px; min-height: 64px; margin: auto; padding: 8px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.identity-mark { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--color-primary-dark); }
.identity-name { font-size: 14px; font-weight: 700; white-space: nowrap; }
.mode-badge { max-width: 58%; border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 4px 8px; color: var(--color-muted); font-size: 14px; line-height: 1.3; text-align: right; }
.mode-badge.demo { background: var(--color-warning-light); border-color: #fcd34d; color: var(--color-warning); }
.mode-badge.live { background: var(--color-primary-light); border-color: #86efac; color: var(--color-primary-dark); }
.workspace { max-width: 1440px; min-height: calc(100vh - 64px); margin: auto; display: grid; grid-template-columns: 196px minmax(0, 1fr); }
.section-nav { padding: 24px 12px; border-right: 1px solid var(--color-border); display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.nav-tab { min-height: 44px; width: 100%; border: 0; border-radius: var(--radius-sm); padding: 8px 12px; background: transparent; color: var(--color-muted); text-align: left; font-size: 14px; font-weight: 600; }
.nav-tab:hover { background: var(--color-gray-100); color: var(--color-text); }
.nav-tab.is-active { background: var(--color-primary-light); color: var(--color-primary-dark); }
.main-content { min-width: 0; padding: 32px clamp(16px, 3vw, 40px) 64px; }
.view { max-width: var(--content-width); margin: 0 auto; }
.page-heading, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.page-heading { margin-bottom: 24px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: var(--text-heading); line-height: 1.3; font-weight: 700; }
h2 { margin-bottom: 0; font-size: var(--text-body); line-height: 1.4; font-weight: 700; }
h3 { margin-bottom: 8px; font-size: var(--text-body); line-height: 1.4; font-weight: 700; }
.page-subtitle { margin: 0; color: var(--color-muted); font-size: 14px; line-height: 1.7; }
.nowrap-phrase { display: inline-block; white-space: nowrap; }
.icon-button { width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: #fff; }
.icon-button:hover, .clear-button:hover { background: var(--color-gray-100); }
.icon-button img, .clear-button img, .action-button img, .filter-submit img, .source-link img { width: 18px; height: 18px; display: block; }
.error-message { margin: 0 0 16px; padding: 12px 16px; border-left: 3px solid var(--color-danger); background: var(--color-danger-light); color: var(--color-danger); font-size: 14px; }
.overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); background: #fff; }
.metric { min-width: 0; padding: 16px 24px; display: flex; flex-direction: column; gap: 2px; }
.metric + .metric { border-left: 1px solid var(--color-border); }
.metric-label { color: var(--color-muted); font-size: 14px; line-height: 1.3; }
.metric strong { font-size: var(--text-heading); line-height: 1.3; font-weight: 700; font-variant-numeric: tabular-nums; }
.traffic-section { padding: 24px 0 32px; border-bottom: 1px solid var(--color-border); }
.compact-heading { margin-bottom: 12px; }
.subtle { color: var(--color-muted); font-size: var(--text-caption); line-height: 1.4; }
.traffic-chart { min-width: 0; color: var(--color-muted); }
.chart-scroll { overflow-x: auto; }
.chart-values { display: grid; grid-template-columns: repeat(var(--chart-count), minmax(0, 1fr)); min-width: max(100%, var(--chart-min-width)); }
.chart-column { min-width: 0; }
.chart-plot { height: 104px; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--color-border); }
.chart-plot svg { width: 32px; height: 103px; display: block; }
.traffic-chart .chart-bar { fill: var(--color-primary-dark); }
.chart-value { min-width: 0; padding: 8px 4px; border-bottom: 1px solid var(--color-border); font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; }
.chart-value span, .chart-value strong { display: block; white-space: nowrap; }
.chart-value strong { color: var(--color-text); font-size: 14px; }
.records-section { padding-top: 24px; }
.records-section > .section-heading { margin-bottom: 16px; }
.action-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 16px; border: 1px solid var(--color-primary-dark); border-radius: var(--radius-sm); background: #fff; color: var(--color-primary-dark); text-decoration: none; font-size: 14px; font-weight: 700; white-space: nowrap; }
.action-button:hover { background: var(--color-primary-light); }
.filters { display: grid; grid-template-columns: minmax(150px, 230px) minmax(210px, 300px) minmax(180px, 1fr) auto; align-items: end; gap: 12px; margin-bottom: 12px; }
.field { min-width: 0; display: flex; flex-direction: column; gap: 4px; color: var(--color-muted); font-size: 14px; font-weight: 600; }
.field select, .field input { width: 100%; height: 44px; border: 1px solid #9ca3af; border-radius: var(--radius-sm); padding: 0 12px; background: #fff; color: var(--color-text); font-size: 14px; font-weight: 400; }
.field input::placeholder { color: var(--color-muted); }
.filter-submit { height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; border: 1px solid var(--color-primary-dark); border-radius: var(--radius-sm); background: var(--color-primary-dark); color: #fff; font-size: 14px; font-weight: 700; }
.filter-submit img { filter: brightness(0) invert(1); }
.filter-submit:hover { background: #166534; }
.active-filter { min-height: 44px; width: fit-content; max-width: 100%; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; padding: 0 0 0 12px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: #fff; color: var(--color-muted); font-size: 14px; overflow-wrap: anywhere; }
.active-filter strong { color: var(--color-text); font-weight: 600; }
.journey-entry { margin: 0 0 16px; }
.clear-button { width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center; border: 0; border-left: 1px solid var(--color-border); background: transparent; }
.list-status { padding: 24px 16px; border-top: 1px solid var(--color-border); color: var(--color-muted); font-size: 14px; line-height: 1.7; }
.list-status.is-error { color: var(--color-danger); background: var(--color-danger-light); }
.table-wrap { min-width: 0; }
.events-table { width: 100%; border-collapse: collapse; background: #fff; table-layout: fixed; }
.events-table th { height: 40px; padding: 8px 12px; border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); background: var(--color-gray-50); color: var(--color-muted); text-align: left; font-size: 12px; font-weight: 700; }
.events-table th:nth-child(1) { width: 18%; }
.events-table th:nth-child(2) { width: 18%; }
.events-table th:nth-child(3) { width: 25%; }
.events-table th:nth-child(4) { width: 10%; }
.events-table th:nth-child(5) { width: 14%; }
.events-table th:nth-child(6) { width: 15%; }
.events-table td { padding: 8px 12px; border-bottom: 1px solid var(--color-border); color: var(--color-muted); font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; vertical-align: middle; }
.events-table tbody tr:hover { background: var(--color-gray-50); }
.events-table .time-cell { color: var(--color-text); font-variant-numeric: tabular-nums; }
.event-open { min-height: 44px; border: 0; padding: 4px 0; background: transparent; color: var(--color-primary-dark); text-align: left; font-size: 14px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.event-open:hover, .group-open:hover { color: #166534; }
.group-open { min-height: 44px; width: 100%; border: 0; padding: 4px 0; background: transparent; color: var(--color-primary-dark); text-align: left; font-size: 14px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; text-decoration: underline; text-underline-offset: 3px; }
.code-text { color: var(--color-text); font: 14px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.status-code { font-weight: 700; color: var(--color-text); }
.status-code.error { color: var(--color-danger); }
.status-code.warning { color: var(--color-warning); }
.signal-count { color: var(--color-warning); font-weight: 700; }
.pagination { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--color-border); color: var(--color-muted); font-size: 14px; }
.pagination-buttons { display: flex; gap: 8px; }
.meta-line { margin: -8px 0 24px; color: var(--color-muted); font-size: 14px; }
.meta-line span { display: block; }
.scenarios-list { display: grid; gap: 32px; }
.scenario { padding-top: 24px; border-top: 1px solid var(--color-border); }
.scenario-heading { display: flex; justify-content: space-between; gap: 16px; }
.scenario-tags { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 8px; }
.scenario-title { font-size: 20px; line-height: 1.4; margin: 0 0 4px; }
.scenario-target { margin: 0; color: var(--color-muted); font-size: 14px; }
.tag { width: fit-content; flex: none; padding: 4px 8px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); color: var(--color-muted); font-size: 14px; line-height: 1.4; }
.tag.demo { border-color: #fcd34d; background: var(--color-warning-light); color: var(--color-warning); }
.scenario-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 42%); gap: 32px; margin-top: 24px; }
.info-label, .overline { display: block; margin-bottom: 4px; color: var(--color-muted); font-size: 12px; font-weight: 700; line-height: 1.4; }
.scenario-body p { font-size: 14px; line-height: 1.8; margin-bottom: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.path-list, .source-list, .plain-list { margin: 8px 0 0; padding-left: 20px; }
.path-list li, .source-list li, .plain-list li { margin-bottom: 8px; font-size: 14px; overflow-wrap: anywhere; }
.source-list li { padding-bottom: 12px; border-bottom: 1px solid var(--color-border); list-style: none; }
.source-list { padding-left: 0; }
.source-link { min-height: 44px; display: inline-flex; align-items: center; gap: 4px; color: var(--color-primary-dark); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.source-meta { display: block; color: var(--color-muted); font-size: 12px; }
.source-evidence { display: block; margin-top: 4px; white-space: pre-wrap; line-height: 1.7; }
.policy-lead { display: flex; align-items: flex-start; gap: 16px; padding: 16px 20px; border-left: 3px solid var(--color-warning); background: var(--color-warning-light); font-size: 14px; line-height: 1.7; }
.policy-lead strong { flex: none; color: var(--color-warning); }
.policy-list { margin: 24px 0 0; border-top: 1px solid var(--color-border); }
.policy-list > div { display: grid; grid-template-columns: minmax(180px, 30%) 1fr; gap: 24px; padding: 16px 0; border-bottom: 1px solid var(--color-border); }
.policy-list dt { color: var(--color-muted); font-size: 14px; font-weight: 700; }
.policy-list dd { margin: 0; font-size: 14px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.event-dialog { width: min(640px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0 0 0 auto; border: 0; padding: 0; background: #fff; box-shadow: 0 0 32px rgb(17 24 39 / 18%); }
.event-dialog::backdrop { background: rgb(17 24 39 / 42%); }
.dialog-header { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; border-bottom: 1px solid var(--color-border); position: sticky; top: 0; background: #fff; z-index: 1; }
.dialog-header h2 { font-size: 20px; }
.detail-content { padding: 24px; }
.detail-meta { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px 24px; margin: 0 0 24px; }
.detail-meta > div { min-width: 0; }
.detail-meta dt { color: var(--color-muted); font-size: 12px; }
.detail-meta dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.detail-section { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--color-border); }
.detail-section h3 { margin-bottom: 12px; }
.detail-note { margin: 0 0 12px; color: var(--color-muted); font-size: 14px; line-height: 1.8; }
.detail-data { margin: 0; padding: 12px 16px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-gray-50); color: var(--color-text); font: 14px/1.7 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.related-links { display: flex; flex-wrap: wrap; gap: 8px; }
.related-button { min-height: 44px; border: 1px solid var(--color-primary-dark); border-radius: var(--radius-sm); padding: 8px 12px; background: #fff; color: var(--color-primary-dark); font-size: 14px; font-weight: 700; text-align: left; overflow-wrap: anywhere; }
.related-button:hover { background: var(--color-primary-light); }
.journey-list, .inference-list { margin: 0; padding: 0; list-style: none; }
.journey-list li, .inference-list li { padding: 16px 0; border-top: 1px solid var(--color-border); }
.journey-list li:first-child, .inference-list li:first-child { border-top: 0; }
.journey-item-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 8px; }
.journey-item-heading strong { font-size: 14px; }
.journey-item-heading time { color: var(--color-muted); font-size: 14px; }
.journey-item p, .inference-list p { margin: 0 0 8px; font-size: 14px; line-height: 1.8; overflow-wrap: anywhere; }
.journey-item .related-button { margin-top: 4px; }
@media (max-width: 1023px) {
  .workspace { grid-template-columns: 1fr; }
  .section-nav { padding: 0 16px; border-right: 0; border-bottom: 1px solid var(--color-border); flex-direction: row; overflow-x: auto; background: #fff; }
  .nav-tab { width: auto; flex: none; border-radius: 0; border-bottom: 3px solid transparent; padding: 12px 16px; }
  .nav-tab.is-active { border-bottom-color: var(--color-primary-dark); background: transparent; }
}
@media (max-width: 767px) {
  .site-header-inner { min-height: 56px; padding: 8px 16px; }
  .identity-name { font-size: 14px; }
  .mode-badge { font-size: 14px; max-width: 54%; }
  .main-content { padding: 24px 16px 48px; }
  .page-heading { margin-bottom: 20px; }
  .overview { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .metric { padding: 12px 16px; }
  .metric:nth-child(3) { border-left: 0; border-top: 1px solid var(--color-border); }
  .metric:nth-child(4) { border-top: 1px solid var(--color-border); }
  .metric strong { font-size: 20px; }
  .traffic-section { padding: 12px 0 16px; }
  .subtle, .info-label, .overline, .source-meta, .detail-meta dt { font-size: 14px; }
  .records-section { padding-top: 16px; }
  .records-section > .section-heading { align-items: flex-start; }
  .action-button { width: 44px; padding: 8px; }
  .action-button span { display: none; }
  .action-button img { flex: none; }
  .filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .search-field { grid-column: 1; }
  .filter-submit { grid-column: 2; justify-content: center; }
  .events-table, .events-table tbody, .events-table tr, .events-table td { display: block; width: 100%; }
  .events-table thead { display: none; }
  .events-table tr { padding: 12px 0; border-top: 1px solid var(--color-border); }
  .events-table td { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; border: 0; text-align: right; }
  .events-table td::before { content: attr(data-label); flex: none; color: var(--color-muted); text-align: left; }
  .events-table td > * { max-width: 68%; }
  .events-table .time-cell { align-items: center; }
  .event-open, .group-open { text-align: right; }
  .scenario-body { grid-template-columns: 1fr; gap: 16px; }
  .scenario-heading { flex-wrap: wrap; }
  .policy-lead { flex-direction: column; gap: 4px; }
  .policy-list > div { grid-template-columns: 1fr; gap: 2px; }
  .dialog-header, .detail-content { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 390px) {
  .identity-name { font-size: 14px; }
  .mode-badge { max-width: 50%; }
  .records-section > .section-heading { gap: 8px; }
  .action-button { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
