input,
button,
select,
textarea {
  box-sizing: border-box;
  border: 2px solid #3E3E3E;
  display: block;
  background-color: #3E3E3E;
  border-radius: 6px;
  color: #fff;
  font-size: 20px;
  width: 100%;
  font-weight: normal;
  font-family: robotothin;
  padding: 1px;
  margin: 0;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  position: relative;
}

label {
  display: block;
  cursor: pointer;
  font-size: 20px;
  width: 100%;
  position: relative;
  color: #bbb;
  clear: both;
  min-height: 27px;
  box-sizing: border-box;
}


/* describe */

label p {
  position: absolute;
  right: -8px;
  top: 0;
  background-color: #000;
  color: #ccc;
  font-size: 7px;
  height: 100%;
  width: calc( 75% + 5px);
  margin: 0;
  box-sizing: border-box;
  padding: 0 4px;
  overflow: hidden;
  transition: color 0.2s ease-out;
  transform: translateX(100%);
}

label p span {
  font-style: normal;
}

label p.none {
  font-style: italic;
}

label p::before, label:hover p.overflow::after {
  display: block;
  position: absolute;
  content: "";
  height: 0.5px;
  width: 100%;
  left: 0;
  top: 0;
  background-image: linear-gradient(to right, #333, #333 80%, transparent);
}

label p.overflow::after {
  position: absolute;
  right: 0;
  bottom: 0;
  background-image: linear-gradient(to right, transparent, #000 40%, #000);
  box-sizing: border-box;
  height: 9px;
  padding: 0 4px 0 6px;
  display: block;
  font-family: awesome;
  content: "\f0d7";
  line-height: 9px;
  font-size: 11px;
  color: #eee;
}

:host-context(.node:hover) label p {
  color: #555;
}

:host-context(.node:hover) label:hover p {
  overflow: visible;
  color: #fff;
  z-index: 2;
}

:host-context(.node:hover) label p.overflow::after {
  color: #333;
}

:host-context(.node:hover) label:hover p.overflow {
  height: auto;
}

:host-context(.node:hover) label:hover p.overflow::after {
  top: auto;
  bottom: 0;
}

/*
if only...
:host>label:has(input:optional) {
  display: none;
}
*/

:host>label.optional {
  display: none;
}

:host-context(.node:hover)>label,
:host-context(.node.selected)>label {
  display: block;
}

/* always show all labels and inputs when in describe/help mode */
:host-context(.describe)>label {
  display: block;
}

label .label {
  display: none;
  box-sizing: border-box;
  position: absolute;
  top: 0;
  left: 0;
  background-image: linear-gradient(to left, rgba(221, 221, 221, 0), #ddd 4px, #ddd);
  color: #333;
  padding: 2px 5px;
  border-radius: 6px 0 0 6px;
  transform: translate(-100%, 0) translateX(1px);
  height: 100%;
  white-space: nowrap;
  box-shadow: -3px 0 8px -1px #000;
  align-items: center;
}

label .label.unknown {
  color: #888;
}

input:hover,
input:focus,
select:hover,
select:focus,
textarea:hover,
textarea:focus {
  border-radius: 0 6px 6px 0;
}

label:focus-within .label,
label:hover .label {
  display: flex;
}

/* checkboxes */
input[type="checkbox"] {
  opacity: 0;
  position: absolute;
  top: 0;
  left: 0;
}

input[type="checkbox"] ~ span {
  cursor: pointer;
  box-sizing: border-box;
  display: block;
  background-color: #3E3E3E;
  border: 2px solid #3E3E3E;
  width: 40px;
  height: 27px;
  position: relative;
  border-radius: 6px;
  float: right;
  opacity: 1;
  background-image: none;
  box-shadow: none;
  transform: initial;
}

input[type="checkbox"] ~ span::before {
  position: absolute;
  box-sizing: border-box;
  display: block;
  content: "";
  left: 0;
  top: 0;
  right: auto;
  width: 20px;
  height: 100%;
  background-color: #45679E;
  border: 2px solid #111;
  border-width: 0 0 1px 0;
  border-radius: 6px;
}

input[type="checkbox"]:checked ~ span::before {
  left: auto;
  right: 0;
}

input[type="checkbox"] ~ span:hover::before {
  background-color: #5b7cb3;
}

input[type="checkbox"]:focus ~ span::before {
  background-color: #5b7cb3;
}

/* buttons */
button,
input[type="button"],
input[type="submit"] {
  padding: 3px;
  border: 2px solid #000;
  border-width: 0 0 2px 0;
  background-color: #45679E;
  cursor: pointer;
  text-align: left;
}

button:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
button:focus,
input[type="button"]:focus,
input[type="submit"]:focus {
  outline: none;
  background-color: #5b7cb3;
}

button:active,
input[type="button"]:active,
input[type="submit"]:active {
  outline: none;
  border-width: 2px 0 0 0;
  border-color: rgb(30, 30, 30);
  background-color: #31599b;
}

button:disabled,
input[type="button"]:disabled,
input[type="submit"]:disabled {
  outline: none;
  border-width: 2px 0 0 0;
  border-color: rgb(30, 30, 30);
  background-color: rgb(60, 60, 60);
  color: rgb(130, 130, 130);
  cursor: default;
}


input[type=range] {
  height: 30px;
  border: none;
  background-color: transparent;
}

input[type=range]:focus {
  border: none;
}

input[type=range]:focus::-webkit-slider-thumb {
  border: 1px solid #45679E;
}

input[type=range]::-webkit-slider-runnable-track {
  background-color: #3E3E3E;
  height: 2px;
  border-radius: 2px;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  background-color: #fff;
  display: block;
  width: 6px;
  height: 20px;
  border: 1px solid #000;
  border-radius: 2px;
  box-sizing: border-box;
  margin-top: -9px;
}

.xible .node.fail>.content input,
.xible .node.fail>button,
.node.fail>.content select {
  border: 2px solid #f00;
  background-color: rgba(255, 0, 0, 0.3);
}

select {
   background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23CCCCCC%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
   background-repeat: no-repeat, repeat;
   background-position: right .4em top 50%, 0 0;
   background-size: .65em auto;
}

select::-ms-expand {
  display: none;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border: 2px solid #45679E;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

input:hover,
textarea:hover {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

input[type="number"] {
  font-size: 40px;
}

/* password visibility handling */
.password-wrapper {
  position: relative;
}

.password-wrapper input {
  padding-right: 26px;
}

.password-toggle {
  font-family: awesome;
  position: absolute;
  top: 50%;
  right: 7px;
  transform: translatey(-50%);
  font-size: 0.9rem;
}

.password-toggle::before {
  display: block;
  content: "\f06e";
}

.password-wrapper input[type="text"] ~ .password-toggle::before {
  content: "\f070";
}

label.vault .label::after {
  content: "\f132";
  font-family: awesome;
  font-size: 0.9rem;
  margin-left: 4px;
}

/* edit mode */
:host-context(.node.edit) label {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  font-size: 16px;
  color: #ddd;
  margin: 0 0 18px;
}

:host-context(.node.edit) label:last-child {
  margin-bottom: 0;
}

:host-context(.node.edit) label .label {
  display: block;
  position: static;
  transform: none;
  border-radius: 0;
  background-color: transparent;
  background-image: none;
  height: auto;
  box-shadow: none;
  color: inherit;
  order: -2;
  padding: 0;
}

:host-context(.node.edit) input,
:host-context(.node.edit) .password-wrapper,
:host-context(.node.edit) button,
:host-context(.node.edit) select,
:host-context(.node.edit) textarea {
  font-size: 16px;
  margin-top: 6px;
}

:host-context(.node.edit) .password-wrapper input {
  font-size: 16px;
  margin-top: 0;
}

:host-context(.node.edit) input[type="number"] {
  font-size: 40px;
}

:host-context(.node.edit) textarea {
  height: 100px;
}

:host-context(.node.edit) style ~ label:only-of-type {
  height: 100%;
}

:host-context(.node.edit) style ~ label:only-of-type textarea {
  height: 100%;
}

:host-context(.node.edit) input:hover,
:host-context(.node.edit) input:focus,
:host-context(.node.edit) select:hover,
:host-context(.node.edit) select:focus,
:host-context(.node.edit) textarea:hover,
:host-context(.node.edit) textarea:focus {
  border-radius: 6px;
}

:host-context(.node.edit) label p {
  position: static;
  order: -1;
  background-color: transparent;
  color: #bbb;
  width: auto;
  padding: 0;
  transform: none;
  font-size: 0.9em;
  height: auto;
}

:host-context(.node.edit) label p::before {
  display: none;
}

:host-context(.node.edit:hover) label p {
  color: #bbb;
}
