:root {
  color-scheme: light;
  --ink: #172126;
  --muted: #657078;
  --soft: #89939a;
  --canvas: #f3f5f3;
  --paper: #ffffff;
  --line: #d9dedb;
  --line-strong: #c3cbc6;
  --green: #168363;
  --green-soft: #dcefe8;
  --blue: #2878a8;
  --blue-soft: #dcebf3;
  --amber: #b87013;
  --amber-soft: #f6ead7;
  --red: #b84d4d;
  --red-soft: #f6e1e1;
  --violet: #6c61a8;
  --violet-soft: #e8e5f3;
  --teal: #218c8a;
  --shadow: 0 1px 2px rgb(18 30 24 / 7%);
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-size: 14px;
  line-height: 1.45;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 8px clamp(16px, 3vw, 44px);
  color: #fff;
  background: #172126;
  border-bottom: 3px solid var(--green);
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  color: #172126;
  background: #f5f7f4;
  border-right: 6px solid #35ad7d;
  border-radius: 4px;
  font-size: 18px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.brand small {
  margin-top: 1px;
  color: #bfc8c3;
  font-size: 11px;
  font-weight: 500;
}

.topbar-actions,
.freshness {
  display: flex;
  align-items: center;
}

.topbar-actions {
  gap: 10px;
}

.freshness {
  gap: 7px;
  color: #e5ebe7;
  font-size: 12px;
}

.freshness time {
  color: #aeb9b3;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  background: var(--amber);
  border: 2px solid rgb(255 255 255 / 20%);
  border-radius: 50%;
}

.status-dot.live {
  background: #4ad69e;
}

.status-dot.stale,
.status-dot.error {
  background: #ef7777;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  color: #fff;
  background: transparent;
  border: 1px solid #46524c;
  border-radius: 5px;
  cursor: pointer;
  font-size: 21px;
  line-height: 1;
}

.icon-button:hover,
.icon-button:focus-visible {
  background: #28342e;
  border-color: #6a766f;
  outline: none;
}

.icon-button.loading span {
  animation: rotate 0.75s linear infinite;
}

@keyframes rotate {
  to {
    transform: rotate(360deg);
  }
}

main {
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: 24px clamp(14px, 3vw, 44px) 54px;
}

.mission-band {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: clamp(28px, 6vw, 88px);
  align-items: end;
  padding: 8px 0 25px;
  border-bottom: 1px solid var(--line-strong);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1,
h2 {
  margin: 0;
  font-weight: 720;
}

h1 {
  max-width: 920px;
  font-size: clamp(21px, 2.1vw, 31px);
  line-height: 1.28;
}

h2 {
  font-size: 16px;
  line-height: 1.3;
}

.mission-progress p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.metric-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.metric-line strong {
  color: var(--ink);
  font-size: 20px;
}

.progress-track {
  position: relative;
  width: 100%;
  height: 7px;
  overflow: hidden;
  background: #e1e5e2;
  border-radius: 2px;
}

.progress-track > span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--green);
  transition: width 280ms ease;
}

.progress-large {
  height: 10px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  padding: 18px 0 25px;
}

.kpi {
  min-height: 100px;
  padding: 13px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.kpi-label,
.kpi-note {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.kpi strong {
  display: block;
  margin: 7px 0 5px;
  font-size: clamp(22px, 2vw, 29px);
  line-height: 1;
}

.kpi-note {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-band,
.chart-band,
.resource-band {
  padding: 24px 0;
  border-top: 1px solid var(--line-strong);
}

.section-heading,
.chart-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.section-meta,
.chart-heading > span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

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

.agent-card {
  position: relative;
  min-height: 206px;
  padding: 15px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 3px solid var(--agent-color, var(--green));
  border-radius: 6px;
  box-shadow: var(--shadow);
}

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

.agent-name {
  font-size: 16px;
  font-weight: 750;
}

.agent-role {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.agent-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.agent-state::before {
  width: 7px;
  height: 7px;
  content: "";
  background: var(--soft);
  border-radius: 50%;
}

.agent-state.working::before {
  background: var(--green);
}

.agent-state.waiting::before {
  background: var(--amber);
}

.agent-state.blocked::before,
.agent-state.offline::before {
  background: var(--red);
}

.agent-current {
  min-height: 52px;
  margin: 20px 0 13px;
}

.agent-current span,
.agent-next span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.agent-current strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.agent-progress-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 15px;
}

.agent-progress-row .progress-track {
  flex: 1;
  height: 6px;
}

.agent-progress-row small {
  width: 34px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.agent-next {
  padding-top: 11px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.activity-heading {
  align-items: center;
}

.activity-heading-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(58px, 1fr));
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
}

.segment-button {
  min-height: 34px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
}

.segment-button:last-child {
  border-right: 0;
}

.segment-button:hover,
.segment-button:focus-visible {
  color: var(--ink);
  background: #f1f4f2;
  outline: none;
}

.segment-button.active {
  color: #fff;
  background: var(--ink);
}

.activity-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
  background: var(--paper);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.activity-stat {
  min-width: 0;
  padding: 13px 16px;
  border-right: 1px solid var(--line);
}

.activity-stat:last-child {
  border-right: 0;
}

.activity-stat span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.activity-stat strong {
  display: block;
  margin-top: 3px;
  font-size: 22px;
}

.activity-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 26px;
}

.activity-panel {
  min-width: 0;
}

.activity-subheading {
  display: flex;
  min-height: 42px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.activity-subheading strong,
.activity-subheading span {
  display: block;
}

.activity-subheading strong {
  font-size: 13px;
}

.activity-subheading span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.activity-subheading > span {
  flex: 0 0 auto;
  margin-top: 1px;
  text-align: right;
}

.activity-chart-scroll {
  min-height: 286px;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.activity-histogram {
  display: grid;
  width: 100%;
  min-width: max(640px, calc(var(--activity-hours, 24) * 18px));
  height: 284px;
  grid-template-columns: repeat(var(--activity-hours, 24), minmax(18px, 1fr));
  gap: 2px;
  padding: 15px 14px 10px;
}

.activity-hour {
  display: grid;
  min-width: 0;
  grid-template-rows: 18px 210px 28px;
  align-items: end;
  text-align: center;
}

.activity-hour-count {
  min-height: 16px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
}

.activity-bar-slot {
  position: relative;
  display: flex;
  height: 210px;
  align-items: flex-end;
  justify-content: center;
  border-bottom: 1px solid var(--line-strong);
}

.activity-bar-slot::before,
.activity-bar-slot::after {
  position: absolute;
  right: 0;
  left: 0;
  height: 1px;
  content: "";
  background: #edf0ee;
}

.activity-bar-slot::before {
  top: 33.333%;
}

.activity-bar-slot::after {
  top: 66.666%;
}

.activity-bar-stack {
  position: relative;
  z-index: 1;
  display: flex;
  width: min(14px, 72%);
  height: 100%;
  flex-direction: column-reverse;
  justify-content: flex-start;
}

.activity-bar-stack.empty::after {
  display: block;
  width: 100%;
  height: 2px;
  margin-top: auto;
  content: "";
  background: #dfe4e1;
}

.activity-bar-segment {
  display: block;
  min-height: 3px;
  flex: 0 0 auto;
  background: var(--blue);
}

.activity-bar-segment.work,
.activity-dot.work {
  background: var(--blue);
}

.activity-bar-segment.evidence,
.activity-dot.evidence {
  background: var(--violet);
}

.activity-bar-segment.success,
.activity-dot.success {
  background: var(--green);
}

.activity-bar-segment.issue,
.activity-dot.issue {
  background: var(--red);
}

.activity-bar-segment.planning,
.activity-dot.planning {
  background: var(--amber);
}

.activity-hour-label {
  display: block;
  height: 28px;
  padding-top: 7px;
  overflow: visible;
  color: var(--muted);
  font-size: 8px;
  white-space: nowrap;
}

.activity-legend {
  display: flex;
  min-height: 30px;
  flex-wrap: wrap;
  gap: 7px 13px;
  align-items: center;
  padding-top: 8px;
  color: var(--muted);
  font-size: 10px;
}

.activity-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.activity-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 1px;
}

.activity-feed {
  height: 286px;
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.activity-group h3 {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 8px 12px;
  color: #455149;
  background: #f3f6f4;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  font-weight: 800;
}

.activity-group:first-child h3 {
  border-top: 0;
}

.activity-group h3 span {
  color: var(--muted);
  font-weight: 650;
}

.activity-event {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 10px;
  min-height: 56px;
  align-items: start;
  padding: 9px 12px;
  border-bottom: 1px solid #edf0ee;
}

.activity-group:last-child .activity-event:last-child {
  border-bottom: 0;
}

.activity-event-time {
  padding-top: 2px;
  color: var(--muted);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 10px;
}

.activity-event-main {
  min-width: 0;
}

.activity-event-head {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 5px 7px;
  align-items: center;
}

.activity-actor {
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
}

.activity-event-label {
  display: inline-block;
  padding: 2px 5px;
  color: #34546a;
  background: var(--blue-soft);
  border-radius: 3px;
  font-size: 9px;
  font-weight: 750;
}

.activity-event-label.evidence {
  color: #514782;
  background: var(--violet-soft);
}

.activity-event-label.success {
  color: #11664d;
  background: var(--green-soft);
}

.activity-event-label.issue {
  color: #943c3c;
  background: var(--red-soft);
}

.activity-event-label.planning {
  color: #86500d;
  background: var(--amber-soft);
}

.activity-event-detail {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gpu-list {
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.gpu-row {
  display: grid;
  grid-template-columns: 110px minmax(160px, 1.25fr) minmax(160px, 1fr)
    92px 112px minmax(150px, 1fr);
  gap: 16px;
  align-items: center;
  min-height: 78px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--line);
}

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

.gpu-identity {
  min-width: 0;
}

.gpu-index {
  display: block;
  font-size: 16px;
  font-weight: 800;
}

.gpu-name {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-metric {
  min-width: 0;
}

.bar-metric-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
}

.bar-metric-head strong {
  color: var(--ink);
  font-size: 11px;
}

.bar-metric.utilization .progress-track > span {
  background: var(--blue);
}

.bar-metric.memory .progress-track > span {
  background: var(--violet);
}

.thermal,
.power {
  color: var(--muted);
  font-size: 11px;
}

.thermal strong,
.power strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 15px;
}

.thermal.warm strong {
  color: var(--amber);
}

.thermal.hot strong {
  color: var(--red);
}

.project-list {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 5px;
}

.project-label,
.state-label {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  padding: 3px 6px;
  background: #eef1ef;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: #344039;
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-label.idle {
  color: var(--muted);
  background: transparent;
  border-style: dashed;
}

.project-label.reserved {
  color: #655619;
  background: #fff7dd;
  border-color: #e4c970;
}

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

.chart-panel {
  min-width: 0;
}

.chart-wrap {
  width: 100%;
  min-height: 250px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.line-chart {
  display: block;
  width: 100%;
  height: 250px;
}

.chart-grid-line {
  stroke: #e2e6e3;
  stroke-width: 1;
}

.chart-axis-label {
  fill: #7e8982;
  font-size: 10px;
}

.chart-line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-area {
  fill: none;
}

.legend {
  display: flex;
  min-height: 22px;
  flex-wrap: wrap;
  gap: 8px 13px;
  padding-top: 9px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
}

.legend-swatch {
  width: 13px;
  height: 3px;
  background: var(--swatch);
}

.resource-band {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 0.8fr)) minmax(260px, 1.4fr);
  gap: 10px;
}

.resource-block {
  display: flex;
  min-height: 160px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.ring-chart {
  width: 116px;
  height: 116px;
  flex: 0 0 116px;
  transform: rotate(-90deg);
}

.ring-chart circle {
  fill: none;
  stroke-width: 11;
}

.ring-base {
  stroke: #e3e7e4;
}

.ring-value {
  stroke: var(--blue);
  stroke-dasharray: 301.593;
  stroke-dashoffset: 301.593;
  stroke-linecap: butt;
  transition: stroke-dashoffset 280ms ease;
}

.ring-disk .ring-value {
  stroke: var(--amber);
}

.ring-chart text {
  fill: var(--ink);
  font-size: 17px;
  font-weight: 800;
  transform: rotate(90deg);
  transform-origin: 60px 60px;
}

.resource-details {
  display: block;
  padding: 10px 18px;
}

.resource-row {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

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

.resource-row span {
  color: var(--muted);
}

.table-scroll {
  overflow-x: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  background: #f7f8f7;
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

td {
  font-size: 12px;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.task-title {
  display: block;
  max-width: 320px;
  font-weight: 700;
}

.task-id {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 10px;
}

.table-progress {
  display: flex;
  width: 145px;
  align-items: center;
  gap: 8px;
}

.table-progress small {
  width: 34px;
  color: var(--muted);
  text-align: right;
}

.state-label.running,
.state-label.claimed {
  color: #1d658f;
  background: var(--blue-soft);
  border-color: #b8d4e3;
}

.state-label.submitted,
.state-label.verified,
.state-label.archived {
  color: #11664d;
  background: var(--green-soft);
  border-color: #b6dbcc;
}

.state-label.pending {
  color: #86500d;
  background: var(--amber-soft);
  border-color: #e8cfaa;
}

.state-label.blocked,
.state-label.rejected,
.state-label.revoking,
.state-label.invalidated {
  color: #943c3c;
  background: var(--red-soft);
  border-color: #e8bcbc;
}

.alerts-band {
  padding-bottom: 0;
}

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

.alert-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: 4px;
}

.alert-row.critical {
  border-left-color: var(--red);
}

.alert-row.info {
  border-left-color: var(--blue);
}

.alert-level {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.alert-row time {
  color: var(--muted);
  font-size: 10px;
}

.empty-state {
  padding: 22px;
  color: var(--muted);
  background: var(--paper);
  border: 1px dashed var(--line-strong);
  border-radius: 5px;
  text-align: center;
}

footer {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 14px;
  color: var(--muted);
  background: #e8ece9;
  border-top: 1px solid var(--line-strong);
  font-size: 10px;
}

dialog {
  width: min(420px, calc(100% - 28px));
  padding: 22px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  box-shadow: 0 18px 70px rgb(17 30 24 / 22%);
}

dialog::backdrop {
  background: rgb(23 33 38 / 58%);
}

dialog label {
  display: block;
  margin: 19px 0 6px;
  color: var(--muted);
  font-size: 11px;
}

dialog input {
  width: 100%;
  height: 42px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

dialog input:focus {
  border-color: var(--blue);
  outline: 2px solid var(--blue-soft);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.command-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  color: #fff;
  background: #172126;
  border: 1px solid #172126;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
}

.command-button:hover,
.command-button:focus-visible {
  background: #2a3730;
  outline: none;
}

.form-error {
  min-height: 18px;
  margin: 7px 0 0;
  color: var(--red);
  font-size: 11px;
}

.toast {
  position: fixed;
  z-index: 30;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100% - 36px));
  padding: 10px 12px;
  color: #fff;
  background: #172126;
  border-left: 4px solid var(--green);
  border-radius: 4px;
  box-shadow: 0 8px 28px rgb(17 30 24 / 20%);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.error-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.error-page main {
  width: min(620px, calc(100% - 30px));
  padding: 38px;
  background: var(--paper);
  border-top: 4px solid var(--red);
}

.error-page h1 {
  margin-bottom: 24px;
}

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

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

  .activity-layout {
    grid-template-columns: 1fr;
  }

  .activity-feed {
    height: 340px;
  }

  .gpu-row {
    grid-template-columns: 90px minmax(150px, 1fr) minmax(150px, 1fr)
      80px 90px;
  }

  .project-list {
    grid-column: 2 / -1;
  }
}

@media (max-width: 820px) {
  .mission-band {
    grid-template-columns: 1fr;
    gap: 21px;
  }

  .chart-band,
  .resource-band {
    grid-template-columns: 1fr;
  }

  .resource-details {
    min-height: auto;
  }

  .gpu-row {
    width: auto;
    grid-template-columns: 72px minmax(0, 1fr) minmax(0, 1fr);
    gap: 11px 12px;
    align-items: center;
  }

  .gpu-identity {
    grid-column: 1;
    grid-row: 1;
  }

  .bar-metric.utilization {
    grid-column: 2 / -1;
    grid-row: 1;
  }

  .bar-metric.memory {
    grid-column: 2 / -1;
    grid-row: 2;
  }

  .thermal {
    grid-column: 1;
    grid-row: 2;
  }

  .power {
    grid-column: 1;
    grid-row: 3;
  }

  .project-list {
    grid-column: 2 / -1;
    grid-row: 3;
  }
}

@media (max-width: 600px) {
  .topbar {
    align-items: flex-start;
  }

  .freshness {
    display: grid;
    grid-template-columns: 8px 1fr;
  }

  .freshness time {
    grid-column: 2;
  }

  main {
    padding-top: 18px;
  }

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

  .kpi {
    min-height: 92px;
    padding: 12px;
  }

  .kpi strong {
    font-size: 22px;
  }

  .agent-card {
    min-height: 212px;
  }

  .section-heading,
  .chart-heading {
    align-items: flex-start;
  }

  .activity-heading,
  .activity-heading-actions {
    align-items: stretch;
  }

  .activity-heading {
    flex-direction: column;
  }

  .activity-heading-actions {
    flex-direction: column;
    gap: 7px;
  }

  .activity-heading-actions .section-meta {
    max-width: none;
    text-align: left;
  }

  .segmented-control {
    width: 100%;
  }

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

  .activity-stat:nth-child(2) {
    border-right: 0;
  }

  .activity-stat:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .activity-chart-scroll,
  .activity-feed {
    height: 318px;
  }

  .activity-feed {
    height: 360px;
  }

  .section-meta,
  .chart-heading > span {
    max-width: 42%;
  }

  footer {
    flex-direction: column;
    gap: 3px;
  }
}

@media (max-width: 410px) {
  .brand strong {
    font-size: 13px;
  }

  .kpi-grid,
  .agent-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    gap: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
