* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #e5eef7;
  background: #0b1220;
}

button,
input,
select,
a {
  font: inherit;
}

a {
  color: #8fbaff;
}

button {
  border: 1px solid #2a3a52;
  background: #3b82f6;
  color: #f8fbff;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
}

button.secondary {
  background: #162236;
}

button.inline {
  padding: 6px 10px;
  font-size: 13px;
}

input,
select {
  width: 100%;
  border: 1px solid #233247;
  background: #101a2a;
  color: #f8fbff;
  border-radius: 8px;
  padding: 10px 12px;
}

label {
  display: grid;
  gap: 6px;
}

label span,
.muted {
  color: #8ea3bd;
  font-size: 13px;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  padding: 24px 28px 18px;
  border-bottom: 1px solid #1b293d;
  background: #0f1727;
}

.topbar h1,
.section-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.layout {
  display: grid;
  gap: 18px;
  padding: 18px 28px 28px;
}

.panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: #101a2a;
  border: 1px solid #1d2a3f;
  border-radius: 8px;
}

.panel-split {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-width: 28px;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: #162236;
  color: #c5d3e4;
  font-size: 12px;
}

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

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

.form-grid .wide {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  align-items: end;
}

.detail-stack {
  display: grid;
  gap: 18px;
}

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

.detail-grid > div {
  min-width: 0;
}

.detail-grid > div > div {
  margin-top: 6px;
  color: #f8fbff;
  overflow-wrap: anywhere;
}

.subhead {
  padding-top: 12px;
  border-top: 1px solid #1b293d;
}

.table-wrap {
  overflow: auto;
  border: 1px solid #1b293d;
  border-radius: 8px;
}

.table-wrap.narrow {
  min-height: 220px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid #182538;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

thead th {
  color: #8ea3bd;
  font-weight: 500;
  background: #0d1523;
  position: sticky;
  top: 0;
}

tbody tr:hover {
  background: #0e1524;
}

.status {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  text-transform: capitalize;
}

.status.draft,
.status.stopped,
.status.disabled {
  background: #253247;
  color: #9eb0c8;
}

.status.starting,
.status.stopping {
  background: #4a3410;
  color: #ffd28a;
}

.status.running {
  background: #123624;
  color: #8fe3b0;
}

.status.failed {
  background: #42181d;
  color: #ffb0b9;
}

.status.session-ended {
  background: #253247;
  color: #9eb0c8;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.empty-state {
  padding: 24px;
  border: 1px dashed #29405f;
  border-radius: 8px;
  color: #8ea3bd;
  text-align: center;
}

.empty-state.compact {
  padding: 16px;
}

.alert {
  margin: 16px 28px 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: #41202a;
  color: #ffd2db;
  border: 1px solid #6b2c3b;
}

.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(3, 8, 15, 0.78);
}

.login-card {
  width: min(420px, calc(100vw - 32px));
  display: grid;
  gap: 14px;
  padding: 24px;
  background: #101a2a;
  border: 1px solid #223247;
  border-radius: 8px;
}

.login-card h2 {
  margin: 0 0 6px;
}

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

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

@media (max-width: 900px) {
  .panel-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar,
  .layout {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .panel-split,
  .form-grid,
  .form-grid.compact,
  .detail-grid {
    grid-template-columns: 1fr;
  }
}
