:root {
  color: #1f2328;
  background: #f5f7f7;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  letter-spacing: 0;
  --ink: #1f2328;
  --muted: #687078;
  --line: #dce1e2;
  --surface: #ffffff;
  --green: #087f5b;
  --green-soft: #e8f5ef;
  --amber: #a75d00;
  --amber-soft: #fff2dd;
  --red: #c23434;
  --red-soft: #fdeaea;
  --blue: #1769aa;
}

* {
  box-sizing: border-box;
}

.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;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--surface);
}

.auth-gate {
  position: fixed;
  z-index: 100;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--surface);
}

.auth-gate[hidden] {
  display: none;
}

.auth-card {
  width: 100%;
  max-width: 340px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 12px 36px rgba(31, 35, 40, 0.08);
}

.auth-card h1 {
  margin-bottom: 26px;
  font-size: 28px;
}

.auth-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.auth-password {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  background: var(--surface);
  font: inherit;
}

.auth-password:focus {
  outline: 2px solid var(--green);
  outline-offset: 1px;
}

.auth-submit {
  display: block;
  width: 100%;
  min-height: 42px;
  margin-top: 16px;
  border: 1px solid var(--green);
  border-radius: 4px;
  color: #fff;
  background: var(--green);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.auth-submit:disabled {
  opacity: 0.65;
  cursor: wait;
}

.auth-error {
  margin: 14px 0 0;
  color: var(--red);
  font-size: 13px;
}

.auth-error[hidden] {
  display: none;
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  min-height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
  cursor: pointer;
}

.brand:focus {
  outline: 2px solid var(--green);
  outline-offset: 4px;
}

.brand[aria-pressed="true"] .brand-mark {
  border-color: var(--green);
}

@media (hover: none) {
  .brand:focus {
    outline: 0;
  }
}

.brand-mark,
.empty-orbit {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.brand-mark {
  margin-right: 10px;
}

.brand-mark span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.topbar-time {
  position: absolute;
  left: 50%;
  max-width: 40%;
  overflow: hidden;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  text-overflow: ellipsis;
  transform: translateX(-50%);
  white-space: nowrap;
}

.connection,
.view-meta,
footer {
  display: flex;
  align-items: center;
}

.connection {
  color: var(--muted);
  font-size: 13px;
}

.connection-dot {
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: #aab0b4;
}

.connection[data-state="live"] .connection-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.connection[data-state="retrying"] .connection-dot {
  background: var(--amber);
  box-shadow: 0 0 0 4px var(--amber-soft);
}

main {
  width: calc(100% - 64px);
  max-width: 1180px;
  margin: 0 auto;
}

.overview {
  padding: 52px 0 42px;
  border-bottom: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.section-heading > * + * {
  margin-left: 24px;
}

.section-heading.compact {
  align-items: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.2;
}

.view-meta {
  color: var(--muted);
  font-size: 13px;
}

.view-meta > * + * {
  margin-left: 14px;
}

.freshness {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #f8f9f9;
  font-size: 12px;
  font-weight: 650;
}

.freshness[data-state="fresh"] {
  border-color: #b9dfce;
  color: var(--green);
  background: var(--green-soft);
}

.freshness[data-state="stale"],
.freshness[data-state="offline"] {
  border-color: #f0cf9b;
  color: var(--amber);
  background: var(--amber-soft);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 34px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metric {
  min-width: 0;
  padding: 24px 26px 22px 0;
}

.metric + .metric {
  padding-left: 26px;
  border-left: 1px solid var(--line);
}

.metric-label,
.metric small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: flex;
  align-items: center;
  min-height: 29px;
  margin: 10px 0 8px;
  font-size: 29px;
  line-height: 1;
  white-space: nowrap;
}

.metric-accent strong {
  color: var(--blue);
}

.sessions {
  padding: 38px 0 64px;
}

.session-list {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.session-row {
  display: block;
  align-items: center;
  width: 100%;
  min-height: 76px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: inherit;
  background: var(--surface);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.session-row-content {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.7fr) minmax(0, 0.8fr) minmax(0, 0.7fr);
  align-items: center;
  width: 100%;
  min-width: 0;
}

.session-row:hover {
  border-color: #bdc5c7;
  background: #fbfcfc;
}

.session-row:focus {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.session-row[data-action="pending"] {
  border-color: var(--blue);
}

.session-row[data-action="sent"] {
  border-color: var(--green);
  background: var(--green-soft);
}

.session-row[data-action="failed"] {
  border-color: var(--red);
  background: var(--red-soft);
}

.session-row:disabled {
  opacity: 1;
  cursor: wait;
}

.session-main,
.session-meta,
.session-project,
.session-model {
  display: block;
  min-width: 0;
}

.session-name,
.session-project,
.session-model {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-name {
  display: block;
  margin: 0 0 7px;
  font-size: 14px;
  font-weight: 680;
}

.session-id,
.session-project,
.session-model,
.session-time {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.session-id,
.session-time {
  display: block;
}

.session-project,
.session-model {
  padding-right: 16px;
}

.status {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 650;
}

.status::before {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  margin-right: 7px;
  border-radius: 50%;
  background: #9ea5aa;
  content: "";
}

.status[data-state="running"] {
  color: var(--green);
}

.status[data-state="running"]::before {
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.status[data-state="failed"] {
  color: var(--red);
}

.status[data-state="failed"]::before {
  background: var(--red);
}

.status[data-state="interrupted"],
.status[data-state="cancelled"] {
  color: var(--amber);
}

.status[data-state="interrupted"]::before,
.status[data-state="cancelled"]::before {
  background: var(--amber);
}

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.empty-state p {
  margin-bottom: 0;
  font-size: 13px;
}

.empty-orbit {
  width: 36px;
  height: 36px;
  border-color: #b9c0c2;
}

footer {
  justify-content: space-between;
  width: calc(100% - 64px);
  max-width: 1180px;
  min-height: 54px;
  margin: 0 auto;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

@media (min-width: 900px) and (max-height: 540px) and (orientation: landscape) {
  body {
    height: 100vh;
    overflow: hidden;
  }

  .topbar {
    min-height: 40px;
    padding: 0 18px;
  }

  .topbar-time {
    font-size: 10px;
  }

  .brand {
    font-size: 14px;
  }

  .brand-mark {
    width: 20px;
    height: 20px;
    margin-right: 8px;
  }

  .brand-mark span {
    width: 6px;
    height: 6px;
  }

  .connection {
    font-size: 11px;
  }

  main {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    column-gap: 18px;
    width: calc(100% - 28px);
    max-width: none;
    height: calc(100vh - 40px);
    overflow: hidden;
  }

  .overview {
    min-width: 0;
    padding: 12px 18px 10px 0;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

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

  .overview > .section-heading {
    /* Keep text clear of the display cutout without moving the rules. */
    padding-left: 48px;
  }

  .section-heading > * + * {
    margin-left: 12px;
  }

  .eyebrow {
    margin-bottom: 3px;
    font-size: 9px;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 18px;
  }

  .view-meta {
    align-items: flex-end;
    flex-direction: column;
    font-size: 10px;
  }

  .view-meta > * + * {
    margin-top: 4px;
    margin-left: 0;
  }

  .freshness {
    min-height: 20px;
    padding: 0 7px;
    font-size: 10px;
  }

  .metrics {
    grid-template-columns: minmax(0, 1fr);
    margin-top: 10px;
    padding-left: 48px;
  }

  .metric {
    padding: 10px 12px 9px 0;
  }

  .metric + .metric {
    position: relative;
    padding-left: 0;
    border-left: 0;
  }

  .metric + .metric::before {
    position: absolute;
    top: 0;
    right: 0;
    left: -48px;
    border-top: 1px solid var(--line);
    content: "";
  }

  .metric-label,
  .metric small {
    font-size: 10px;
  }

  .metric strong {
    min-height: 23px;
    margin: 5px 0 4px;
    font-size: 23px;
  }

  .sessions {
    min-width: 0;
    height: 100%;
    padding: 11px 0 8px;
    overflow: hidden;
  }

  .session-list {
    height: calc(100vh - 101px);
    margin-top: 8px;
    padding-right: 4px;
    gap: 6px;
    overflow-y: auto;
  }

  .session-row {
    min-height: 48px;
    padding: 6px 10px;
  }

  .session-row-content {
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 0.65fr) minmax(0, 0.75fr) minmax(0, 0.7fr);
  }

  .session-name {
    margin-bottom: 3px;
    font-size: 14px;
  }

  .session-id,
  .session-project,
  .session-model,
  .session-time {
    font-size: 10px;
  }

  .session-project,
  .session-model {
    padding-right: 10px;
  }

  .status {
    font-size: 11px;
  }

  .status::before {
    width: 6px;
    height: 6px;
    margin-right: 5px;
  }

  .empty-state {
    min-height: 100%;
  }

  footer {
    display: none;
  }
}

@media (max-width: 820px) {
  .topbar {
    padding: 0 20px;
  }

  main,
  footer {
    width: calc(100% - 40px);
    max-width: 680px;
  }

  .overview {
    padding-top: 36px;
  }

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

  .metric:nth-child(3) {
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .metric:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .session-row {
    display: block;
    gap: 12px 16px;
  }

  .session-row-content {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px 16px;
  }

  .session-project,
  .session-model {
    padding-right: 0;
  }
}

@media (max-width: 520px) {
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-heading > * + * {
    margin-top: 16px;
    margin-left: 0;
  }

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

  h1 {
    font-size: 29px;
  }

  .view-meta {
    width: 100%;
    justify-content: space-between;
  }

  .metric {
    padding: 20px 16px 18px 0;
  }

  .metric + .metric {
    padding-left: 16px;
  }

  .metric:nth-child(3) {
    padding-left: 0;
  }

  .session-row {
    display: block;
  }

  .session-row-content {
    grid-template-columns: minmax(0, 1fr);
  }

  .session-time {
    justify-self: start;
  }
}
