body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px 24px;
  line-height: 1.45;
  color: #1a1a1a;
  background: #fafafa;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 24px;
  border-bottom: 1px solid #bbb;
  padding: 12px 0;
}

h1 {
  margin: 0;
  font-size: 22px;
}

h1 a {
  color: inherit;
  text-decoration: none;
}

h2 {
  font-size: 20px;
  margin: 20px 0 8px;
}

h3 {
  font-size: 16px;
  margin: 24px 0 8px;
}

button,
.button {
  display: inline-block;
  border-radius: 16px !important;
}

nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
  flex: 1;
}

#logout {
  margin-left: auto;
}

[hidden] {
  display: none !important;
}

nav a.current {
  font-weight: bold;
  color: #1a1a1a;
  text-decoration: none;
}

a {
  color: #0645ad;
}

footer {
  margin-top: 32px;
  padding-top: 8px;
  border-top: 1px solid #bbb;
  color: #666;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 20px 0 12px;
}

.toolbar h2,
.toolbar h3 {
  margin: 0;
}

.id {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.id code {
  word-break: break-all;
}

.back {
  margin: 16px 0 0;
}

.scroll {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  background: #fff;
}

table.list {
  width: 100%;
  min-width: 720px;
}

th,
td {
  border: 1px solid #ccc;
  padding: 5px 8px;
  text-align: left;
  vertical-align: top;
}

thead th {
  background: #eee;
}

tr.link {
  cursor: pointer;
}

tr.link:hover td {
  background: #f0f4ff;
}

table.fields {
  width: 100%;
  max-width: 760px;
}

table.fields th {
  width: 160px;
  background: #f4f4f4;
  font-weight: normal;
  color: #444;
}

table.fields input:not([type=checkbox]),
table.fields select,
table.fields textarea {
  width: 100%;
  box-sizing: border-box;
}

.version {
  align-items: center;
  display: flex;
  gap: 8px;
}

code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
}

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

input,
select,
textarea {
  padding: 3px 6px;
  border: 1px solid #999;
  border-radius: 2px;
  background: #fff;
}

input:disabled,
select:disabled,
textarea:disabled {
  background: #eee;
  color: #666;
}

button,
a.button {
  padding: 3px 12px;
  border: 1px solid #888;
  border-radius: 2px;
  background: #f2f2f2;
  color: #1a1a1a;
  cursor: pointer;
  text-decoration: none;
}

button:hover,
a.button:hover {
  background: #e4e4e4;
}

button.primary {
  border-color: #0645ad;
  background: #0645ad;
  color: #fff;
}

button.primary:hover {
  background: #053a8c;
}

button.danger {
  border-color: #b00;
  color: #b00;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

fieldset {
  max-width: 760px;
  box-sizing: border-box;
  border: 1px solid #ccc;
  margin: 24px 0 0;
  background: #fff;
}

fieldset.danger {
  border-color: #e0a0a0;
}

legend {
  padding: 0 4px;
  font-weight: bold;
}

fieldset p {
  margin: 4px 0 8px;
}

.hint,
.muted {
  color: #666;
  font-size: 13px;
}

.tag {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid #999;
  border-radius: 2px;
  font-size: 12px;
  background: #f4f4f4;
}

.tag.live {
  border-color: #3a3;
  background: #efe;
}

.tag.scheduled,
.tag.upcoming {
  border-color: #c90;
  background: #fff8e0;
}

.tag.hidden,
.tag.ended {
  color: #666;
}

.tag.running {
  border-color: #c33;
  background: #fee;
}

#message {
  padding: 6px 10px;
  border: 1px solid #6a6;
  background: #efe;
}

#message.error {
  border-color: #c66;
  background: #fee;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

@media (max-width: 640px) {
  body {
    padding: 0 12px 16px;
  }

  header {
    gap: 8px 16px;
  }

  nav {
    order: 3;
    flex-basis: 100%;
  }

  input,
  select,
  textarea,
  button,
  a.button {
    font-size: 16px;
  }

  button,
  a.button {
    padding: 2px 8px;
  }

  .buttons>button {
    flex: 1 1 auto;
  }

  .scroll {
    overflow: visible;
  }

  table.list {
    min-width: 0;
    background: none;
  }

  table.list thead {
    display: none;
  }

  table.list,
  table.list tbody,
  table.list tr,
  table.list td {
    display: block;
    box-sizing: border-box;
    width: 100%;
  }

  table.list tr {
    margin-bottom: 10px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    background: #fff;
  }

  tr.link:hover td {
    background: none;
  }

  tr.link:active {
    background: #f0f4ff;
  }

  table.list td {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 3px 0;
    border: 0;
  }

  table.list td::before {
    content: attr(data-label);
    flex: 0 0 96px;
    color: #666;
    font-size: 13px;
  }

  table.list tr.empty td::before {
    content: none;
  }

  table.fields {
    border: 1px solid #ccc;
  }

  table.fields,
  table.fields tbody,
  table.fields tr,
  table.fields th,
  table.fields td {
    display: block;
    box-sizing: border-box;
    width: 100%;
  }

  table.fields tr {
    padding: 10px 12px;
    border-bottom: 1px solid #e4e4e4;
  }

  table.fields tr:last-child {
    border-bottom: 0;
  }

  table.fields th,
  table.fields td {
    padding: 0;
    border: 0;
  }

  table.fields th {
    width: auto;
    margin-bottom: 4px;
    background: none;
    font-size: 13px;
  }

  fieldset {
    padding: 8px 12px 12px;
  }

  fieldset>button {
    width: 100%;
  }
}