body {
  background-color: #dee3e7;
  color: black;
  text-align: center;
  font-family: sans-serif;
  padding: 0;
  margin: 0;
}

fieldset {
  padding: 0;
}

fieldset#root-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  grid-template-rows: auto auto auto auto;
  grid-gap: 1em;
  text-align: center;
  border: 0;
}

table {
  background-color: white;
  border-collapse: collapse;
  width: 100%;
  box-shadow: 0 0 10px 0 #444;
}

th,
td {
  border: 1px solid #efefef;
  text-align: left;
  padding: 0.6em;
}

th:first-child {
  width: 5%;
}

tr:hover td {
  background-color: beige;
}

legend {
  padding-top: 1em;
}

span[role="icon"] {
  display: block;
  font-size: 3em;
  vertical-align: middle;
}

form span[role="icon"],
tr.log-row span[role="icon"] {
  display: inline-block;
  padding-right: 0.2em;
}

.error {
  background-color: salmon;
  padding: 1em;
}

.title.temporary-status-message {
  color: gray;
}

div.entity {
  background-color: white;
  box-shadow: 0 0 10px 0 #444;
  display: grid;
  grid-column: auto / span 2;
  grid-row: auto / span 2;
  grid-template-rows: auto min-content;
  grid-template-columns: minmax(min-content, auto);
}

h2 {
  font-size: 1em;
  display: inline-block;
}

div.entity h2 {
  grid-column: 1 / span all;
}

/* Buttons */

button,
input[type="submit"] {
  padding: 1em;
  color: black;
  text-align: center;
  border: 1px solid #999;
  background-color: white;
  box-shadow: 0 0 6px 0 #aaa;
  user-select: none;
}

button:hover,
input[type="submit"]:hover {
  box-shadow: 0 0 10px 0 #666;
  cursor: pointer;
}

button:focus,
input[type="submit"]:focus {
  outline: 1px solid black;
}

button:disabled,
input[type="submit"]:disabled {
  color: gray;
  background-color: #333;
  cursor: not-allowed;
}

fieldset#section-switcher {
  border: 0;
  text-align: right;
  margin-bottom: 1em;
}

fieldset#section-switcher button {
  padding: 1em;
  color: black;
  display: table-cell;
  text-align: center;
  border: 1px solid #999;
  background-color: white;
  box-shadow: 0 0 6px 0 #aaa;
  user-select: none;
  cursor: pointer;
}

fieldset#root-group action-button button {
  width: 100%;
  height: 100%;
}

fieldset#section-switcher button:first-child {
  border-radius: 1em 0 0 1em;
}

fieldset#section-switcher button:last-child {
  border-radius: 0 1em 1em 0;
}

button.active-section {
  font-weight: bold;
}

/* Button animations */

.action-failed {
  animation: kf-action-failed 1s;
}

@keyframes kf-action-failed {
  0% { background-color: black; }
  20% { background-color: red; }
  0% { background-color: inherit; }
}

.action-success {
  animation: kf-action-success 1s;
}

@keyframes kf-action-success {
  0% { background-color: black; }
  20% { background-color: limegreen; }
  0% { background-color: inherit; }
}

.action-nonzero-exit {
  animation: kf-action-nonzero-exit 1s;
}

@keyframes kf-action-nonzero-exit {
  0% { background-color: black; }
  20% { background-color: orange; }
  0% { background-color: inherit; }
}

.action-timeout {
  animation: kf-action-timeout 1s;
}

@keyframes kf-action-timeout {
  0% { background-color: black; }
  20% { background-color: cyan; }
  0% { background-color: inherit; }
}

footer,
footer a {
  color: black;
}

img.logo {
  width: 1em;
  height: 1em;
  vertical-align: middle;
}

@media (max-width: 320px) {
  fieldset {
    grid-template-columns: auto;
    grid-gap: 0;
    padding: 0;
  }
}

main {
  padding: 1em;
}

summary {
  cursor: pointer;
}

details {
  display: inline-block;
}

details[open] {
  margin-top: 1em;
  display: block;
}

form.action-arguments {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1em;
  box-shadow: 0 0 6px 0 #aaa;
  background-color: #dee3e7;
}

form div.wrapper {
  border-radius: 1em;
  box-shadow: 0 0 10px 0 #444;
  background-color: white;
  border: 1px solid #999;
  text-align: left;
  padding: 1em;
}

label {
  width: 20%;
  text-align: right;
  display: inline-block;
  padding-right: 1em;
}

input {
  padding: 0.6em;
}

input:invalid {
  outline: 2px solid red;
}

form .wrapper span.icon {
  display: inline-block;
  vertical-align: middle;
}

form input[type="submit"]:first-child {
  margin-right: 1em;
}

button[name="cancel"]:hover {
  background-color: salmon;
}

input[name="start"]:hover {
  background-color: #aceaac;
}

form div.buttons {
  text-align: right;
}

pre {
  border: 1px solid gray;
  padding: 1em;
  min-height: 1em;
}

td.exit-code {
  text-align: center;
}

input.invalid {
  background-color: salmon;
}

#available-version {
  background-color: #aceaac;
  padding: 0.2em;
  border-radius: 1em;
}

@media (prefers-color-scheme: dark) {
  body {
    background-color: #333;
    color: white;
  }

  form.action-arguments {
    background-color: #333;
  }

  form div.wrapper {
    background-color: #222;
  }

  button,
  input[type="submit"] {
    border: 1px solid #666;
    background-color: #222;
    box-shadow: 0 0 6px 0 #444;
    color: white;
  }

  button:disabled {
    background-color: black;
  }

  table,
  td,
  th {
    border: 1px solid gray;
  }

  td,
  tr {
    background-color: #222;
    color: white;
  }

  tr:hover td {
    background-color: #666;
  }

  footer,
  footer a {
    color: gray;
  }
}
