:root {
  color-scheme: dark;
  --bg: #08111d;
  --panel: #101d2e;
  --line: #24364a;
  --ink: #d5e4f5;
  --muted: #8ca5bd;
  --accent: #54c7ee;
  --amber: #e4b863;
  --data-font: 8px;
  --inspector: 168px;
  font-family: Inter,"Apple SD Gothic Neo","Malgun Gothic",system-ui,sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-rows: 30px minmax(0,1fr) 20px;
}

h1,h2,p {
  margin: 0;
}
h1 {
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
}
h1 span {
  font-size: 18px;
  color: var(--accent);
  margin-right: 5px;
}
h2 {
  font-size: 11px;
  font-weight: 720;
}

button,input,select {
  font: inherit;
  font-size: 11px;
  color: inherit;
  min-height: 22px;
  background: #0b1726;
  border: 1px solid var(--line);
  border-radius: 2px;
}

button {
  cursor: pointer;
  padding: 1px 8px;
}
select {
  max-width: 220px;
  padding: 1px 5px;
}
input {
  padding: 2px 6px;
  width: 190px;
  min-width: 80px;
}

button: hover,button[aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--accent);
  background: #153044;
}

button: disabled {
  color: #5b7087;
  cursor: default;
  border-color: var(--line);
  background: #0b1726;
}
a {
  color: var(--accent);
  text-underline-offset: 2px;
}
[hidden] {
  display: none!important;
}
:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
}
#connection {
  margin-left: auto;
  color: var(--muted);
}
#as-of {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.topbar select {
  font-size: 10px;
  width: 54px;
}

main {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 26px 142px minmax(80px,1fr) var(--inspector);
  gap: 4px;
  padding: 4px;
}

.filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 7px;
  padding: 3px 5px;
  border: 1px solid var(--line);
  font-size: 10px;
}
.filters label {
  white-space: nowrap;
  color: var(--muted);
}
.modes {
  display: flex;
  gap: 2px;
}
.scope {
  margin-left: auto;
  color: var(--accent);
  font-size: 11px;
}
#pending {
  color: var(--amber);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  border: 1px solid var(--line);
  align-items: center;
  font-size: 10px;
}
.metrics>span {
  padding: 0 12px;
  border-right: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
}
.metrics strong {
  margin-left: 9px;
  color: var(--accent);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.overview-band {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 4px;
  min-height: 0;
}
.instrument {
  border: 1px solid var(--line);
  padding: 5px 8px;
  min-width: 0;
  overflow: hidden;
}
.instrument h2 span {
  font-size: 9px;
  color: var(--muted);
  font-weight: 450;
  margin-left: 10px;
}
#year-chart,#month-chart {
  height: 108px;
}

.bubbles {
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0,1fr) 16px;
  padding: 16px 18px 0 35px;
  position: relative;
}
.bubble-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols),minmax(0,1fr));
  height: 100%;
  min-height: 0;
  position: relative;
}
.bubble-grid:before {
  content: "";
  position: absolute;
  inset: 0;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: repeating-linear-gradient(to top,transparent 0,transparent calc(25% - 1px),var(--line) calc(25% - 1px),var(--line) 25%);
  pointer-events: none;
}

.bubble-button {
  height: 100%;
  min-width: 0;
  padding: 0;
  position: relative;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0;
}
.bubble-button:hover,.bubble-button.selected {
  background: #142b3d;
  border-color: var(--accent);
}
.bubble-dot {
  position: absolute;
  left: 50%;
  bottom: var(--position);
  width: var(--diameter);
  height: var(--diameter);
  transform: translate(-50%,50%);
  border-radius: 50%;
  background: var(--accent);
  opacity: .68;
  pointer-events: none;
}
.bubble-button.empty .bubble-dot {
  background: var(--bg);
  border: 1px solid var(--muted);
}
.bubble-button.selected .bubble-dot {
  opacity: 1;
}
.bubble-value {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--position) + var(--diameter) / 2 + 1px);
  font-size: 9px;
  font-weight: 650;
  color: var(--ink);
  pointer-events: none;
  text-align: center;
}
.bubble-labels {
  display: grid;
  grid-template-columns: repeat(var(--cols),minmax(0,1fr));
  text-align: center;
  font-size: 9px;
  padding-top: 2px;
  color: var(--muted);
}
.bubble-scale {
  position: absolute;
  left: 0;
  top: 13px;
  bottom: 16px;
  width: 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 8px;
  color: var(--muted);
}
.empty-instrument {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 10px;
}

.master,.inspector {
  border: 1px solid var(--line);
  min-height: 0;
  display: grid;
  grid-template-rows: 26px minmax(0,1fr) 18px;
  overflow: hidden;
}
.section-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 1px 7px;
  border-bottom: 1px solid var(--line);
  background: #0b1928;
  font-size: 10px;
  min-width: 0;
}
.section-bar h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#result-count {
  margin-left: auto;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.section-bar button {
  min-height: 20px;
  font-size: 10px;
  padding-inline: 6px;
}

.table-scroll,.inspector-scroll {
  overflow: auto;
  position: relative;
  min-height: 0;
  scrollbar-color: #3d536a #0c1724;
  scrollbar-width: thin;
}
table {
  width: 100%;
  min-width: 950px;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: var(--data-font);
  font-variant-numeric: tabular-nums;
}
thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #102135;
}
th,td {
  padding: 0 4px;
  text-align: left;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid #1b2b3d;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  height: calc(var(--data-font) + 7px);
}
thead th {
  height: 26px;
  font-weight: 650;
}
th: last-child,td:last-child {
  padding: 0;
  overflow: visible;
}
.agency-col {
  width: 110px;
}
.title-col {
  width: 240px;
}
.apply-col {
  width: 100px;
}
.exam-col {
  width: 72px;
}
.status-col {
  width: 66px;
}
.stage-col {
  width: 160px;
}
.stage-date-col {
  width: 220px;
}

.axis {
  display: grid;
  grid-template-columns: repeat(var(--ticks),minmax(0,1fr));
  font-size: 9px;
  min-height: 24px;
  align-items: center;
  color: var(--muted);
  text-align: center;
}
.axis>span {
  border-left: 1px solid var(--line);
  overflow: hidden;
}
#notices tr {
  cursor: pointer;
}
#notices tr:hover {
  background: #142b3d;
}
#notices tr.selected {
  background: #17394a;
  color: #e7f8ff;
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}
.pending-text {
  color: var(--amber);
}

.plot {
  position: relative;
  height: calc(var(--data-font) + 7px);
  background: linear-gradient(to right,var(--line) 1px,transparent 1px) 0 0/calc(100% / var(--ticks)) 100%;
}
.range,.point {
  position: absolute;
  display: block;
  top: 50%;
  pointer-events: auto;
}
.range {
  height: 3px;
  border-radius: 1px;
  transform: translateY(-50%);
  background: var(--accent);
  min-width: 1px;
}
.range.announcement {
  background: #547187;
  height: 2px;
  opacity: .7;
}
.range.application {
  background: #55d5f3;
  height: 4px;
}
.range.event {
  background: #93ccd5;
  height: 3px;
}
.point {
  width: 4px;
  height: 4px;
  background: var(--amber);
  transform: translate(-50%,-50%) rotate(45deg);
}

.chart-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 7px;
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}
.chart-footer>span:last-child {
  margin-left: auto;
}
.key {
  display: inline-block;
  width: 14px;
  height: 3px;
  margin-right: 5px;
  background: var(--accent);
  vertical-align: middle;
}
.key.announcement {
  background: #547187;
}
.key.application {
  background: #55d5f3;
}
.key.event {
  background: var(--amber);
}

.inspector .section-bar label {
  margin-left: 8px;
  white-space: nowrap;
  color: var(--muted);
}
#track {
  font-size: 10px;
  min-height: 20px;
  max-width: 350px;
}
#source {
  white-space: nowrap;
}
#expand-inspector {
  margin-left: auto;
  white-space: nowrap;
}
#evidence {
  font-size: 9px;
  color: var(--muted);
  padding: 1px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#stages .child td:first-child {
  padding-left: 18px;
  color: #9ab8d1;
}
footer {
  display: flex;
  justify-content: space-between;
  padding: 1px 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
  overflow: hidden;
}
#footer-status {
  overflow: hidden;
  text-overflow: ellipsis;
}
.inspector.expanded {
  min-height: 0;
}
body.expanded {
  --inspector: 320px;
}

@media(max-width:900px) {
  .topbar {
    gap: 5px;
  }
  .topbar h1 {
    font-size: 12px;
  }
  #as-of {
    display: none;
  }
  .overview-band {
    grid-template-columns: 1fr 1fr;
  }
  .instrument h2 span {
    display: none;
  }
  .metrics>span {
    padding: 0 5px;
    font-size: 9px;
  }
  .metrics strong {
    font-size: 12px;
    margin-left: 3px;
  }
  #search {
    width: 130px;
  }
  .scope {
    font-size: 10px;
  }
  .bubble-value {
    font-size: 8px;
  }
  .bubbles {
    padding-left: 24px;
    padding-right: 5px;
  }
  .bubble-scale {
    width: 21px;
  }
}

@media(max-width:540px) {
  main {
    grid-template-rows: auto 25px 120px minmax(70px,1fr) var(--inspector);
    gap: 3px;
  }
  :root {
    --inspector: 152px;
  }
  #year-chart,#month-chart {
    height: 88px;
  }
  .topbar h1 {
    font-size: 11px;
  }
  .topbar label {
    font-size: 9px;
  }
  #connection {
    font-size: 9px;
  }
  .filters {
    gap: 3px 4px;
  }
  .filters label {
    font-size: 9px;
  }
  input,select,button {
    font-size: 10px;
  }
  #agency-filter {
    max-width: 130px;
  }
  .metrics>span {
    font-size: 8px;
  }
  .metrics strong {
    font-size: 10px;
  }
  .overview-band {
    grid-template-columns: 1.25fr 1fr;
  }
  .instrument {
    padding: 4px;
  }
  .instrument h2 {
    font-size: 9px;
  }
  .bubble-value {
    display: none;
  }
  .bubble-labels {
    font-size: 8px;
  }
  .bubble-scale {
    font-size: 7px;
  }
  .bubble-dot {
    max-width: 12px;
    max-height: 12px;
  }
  #selected-title {
    max-width: 95px;
  }
  .inspector .section-bar {
    gap: 4px;
  }
  #track {
    max-width: 135px;
  }
  .inspector .section-bar label {
    display: none;
  }
  #source {
    font-size: 9px;
  }
  .section-bar {
    gap: 5px;
  }
  #result-count {
    font-size: 8px;
  }
}

.notice-button {
  display: block;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font-size: inherit;
  line-height: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notice-button:hover {
  background: transparent;
}

.calendar-line {
  position: absolute;
  width: 1px;
  top: 0;
  bottom: 0;
  background: var(--line);
  pointer-events: none;
}
