*, *::before, *::after {
  box-sizing: border-box;
}

* {
    -webkit-tap-highlight-color: transparent;
}

[x-cloak] {
  display: none !important;
}

.noselect {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

:root {
  --bg: #13171f;
  --surface: #0d1117;
  --surface-2: #161b22;
  --code: #292b2d; /*#1d1f21; #373b3f*/

  --text: #e6edf3;
  --text-muted: #b7bec9;

  --border: #30363d;

  --primary: #58a6ff;
  --primary-text: #0b0d11;

  --success: #239123;
  --danger: #c42d2d;

  --hover-bg: rgba(255, 255, 255, 0.08);

  /* Toggle */
  --toggle-bg: #777;
  --toggle-bg-active: #4caf50;
  --toggle-knob: #ffffff;
}

html[data-theme="light"] {
  --bg: #f6f7f9;

  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --code: #e1e4e7; /*#ebeced;*/

  --text: #111827;
  --text-muted: #4f535b;

  --border: #d1d5db;

  --primary: #0050d7;
  --primary-text: #ffffff;

  --success: #1f8f3a;
  --danger: #d12b2b;

  --hover-bg: rgba(0, 0, 0, 0.06);

  /* Toggle */
  --toggle-bg: #b6bcc4;
  --toggle-bg-active: #4caf50;
  --toggle-knob: #ffffff;
}

#dark-theme-icon,
#light-theme-icon {
    display: none;
}

[data-theme="dark"] #dark-theme-icon {
    display: block;
}

[data-theme="light"] #light-theme-icon {
    display: block;
}

textarea {
    color-scheme: dark;
}

[data-theme="light"] textarea {
    color-scheme: light;
}

input[type="date"] {
    color-scheme: dark;
}

[data-theme="light"] input[type="date"] {
    color-scheme: light;
}

body {
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  line-height: 1.6;

  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
}

.content-disabled {
  pointer-events: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  opacity: 30%;
}

main {}

.container {
  margin-left: auto;
  margin-right: auto;
  /*max-width: 40em;*/
  max-width: 960px;
  padding: 20px 24px;
}

.link {
  color: var(--primary);
  cursor: pointer;
  outline: none;
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

.link.external::after {
    /*content: "↗";*/
    content: "\2197";
    font-size: 0.8em;
    margin-left: 2px;
    display: inline-block;
    transform: translateY(-1px);
}

.disabled-link {
  color: var(--text-muted);
  pointer-events: none;
}

/* forms */

input {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  outline: none;
/*  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;*/
}

input:focus {
  border-color: var(--primary);
  box-shadow:
    0 0 0 3px
    color-mix(in srgb, var(--primary) 15%, transparent);
}

.btn {
  font: inherit;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  background-color: var(--primary);
  color: var(--primary-text);

  padding: 6px 10px;

  border-radius: 10px;
  border: 1px solid transparent;

  /*font-weight: 500;*/
  cursor: pointer;
  outline: 0;
  text-decoration: none;

  width: auto;
}

.btn:hover {
  /*filter: brightness(90%);*/
  opacity: 0.9;
}

.btn:disabled {
  background: var(--text-muted);
  color: var(--surface);
  filter: none !important;
  cursor: not-allowed;
}

.btn.btn-full {
  width: 100%;
}

.btn.btn-green {
  background-color: var(--success);
  color: white;
}

.btn.btn-red {
  background-color: var(--danger);
  color: white;
}

.btn.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn.btn-ghost:hover {
  border-color: color-mix(
    in srgb,
    var(--border) 70%,
    var(--text)
  );
}

.btn-link {
    background: none;
    border: 0;
    padding: 0;
    color: var(--red);
    cursor: pointer;
    font: inherit;
}

.btn-link:hover {
    text-decoration: underline;
}

hr {
    height: 1px;
    margin: 1rem 0;
    color: inherit;
    background-color: var(--text-muted);
    border: 0;
    opacity: .3;
}

blockquote {
    margin: 1.5rem 0;
    padding: 0 0.75rem;
    border-left: 4px solid #26427b;
    /* color: #a8b3c7; */
    /* background: #1a1f2b; */
    border-radius: 0 8px 8px 0;
}

table {
    width: 100%;
    border-collapse: collapse;

    margin: 1.5rem 0;

    overflow: hidden;
    /*border-radius: 10px;*/
}

th,
td {
    border: 1px solid var(--border);
    padding: 0.75rem 1rem;
    text-align: left;
}

th {
    background: var(--surface-2);
    font-weight: 600;
}

/*Modals*/
.modal-backdrop {
    position: fixed;
    inset: 0;

    z-index: 2000;

    display: flex;
    justify-content: center;
    align-items: flex-start;

    padding: 18vh 24px 24px;

    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

@media (max-width: 600px) {
    .modal-backdrop {
        padding-top: 7vh;
        padding-left: 5px;
        padding-right: 5px;
    }
}

.modal {
    width: 100%;
    max-width: 500px;

    background: var(--surface-2);

    border: 1px solid var(--border);
    border-radius: 12px;

    max-height: 90vh;
    overflow-y: auto;

    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.3);
}

@media (max-width: 600px) {
    .modal {
        max-height: 85vh;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 16px 20px;

    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.modal-close {
    width: 36px;
    height: 36px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: transparent;
    border: none;
    border-radius: 8px;

    color: var(--text);

    cursor: pointer;
}

.modal-close:hover {
    background: var(--hover-bg);
}

.modal-body {
    padding: 20px;
}

.modal-body p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    gap: 10px;

    padding: 16px 20px;

    border-top: 1px solid var(--border);
}

/* generic */

.invisible {
  display: none !important;
}

ul {
  padding-left: 2em;
}

/* Code blocks */

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;

    font-size: 0.9em;

    background: var(--code);
    /*border: 1px solid var(--border);*/
    padding: 0.15em 0.35em;
    border-radius: 6px;
}

pre code {
    font-size: 0.8em;
}

/*pre {
    overflow-x: auto;

    margin: 1.5rem 0;

    border-radius: 10px;
}

pre code {
    padding: 0;
}*/

/*select*/

select {
  width: 100%;
  padding: 10px 40px 10px 12px;

  background-color: var(--surface);
  color: var(--text);

  border: 1px solid var(--border);
  border-radius: 8px;

  font: inherit;
  cursor: pointer;
  outline: none;

  /* Remove default browser styling */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  /* Custom chevron */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23b7bec9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}

select:hover {
  border-color: color-mix(
    in srgb,
    var(--border) 70%,
    var(--text)
  );
}

select:focus {
  border-color: var(--primary);
  box-shadow:
    0 0 0 3px
    color-mix(in srgb, var(--primary) 15%, transparent);
}

select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

select option {
  background: var(--surface);
  color: var(--text);
}

.select-wrapper {
  position: relative;
}

.select-wrapper select {
  background-color: var(--surface-2);
}

/*toggle checkbox*/
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    cursor: pointer;
}

.toggle-input {
    display: none;
}

.toggle-slider {
    position: relative;

    width: 44px;
    height: 24px;

    background: var(--toggle-bg);
    border-radius: 999px;

    transition: 0.2s;
}

.toggle-slider::before {
    content: "";

    position: absolute;
    top: 3px;
    left: 3px;

    width: 18px;
    height: 18px;

    background: var(--toggle-knob);
    border-radius: 50%;

    transition: 0.2s;
}

.toggle-input:checked + .toggle-slider {
    background: var(--toggle-bg-active);
}

.toggle-input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/*Loading wheel*/
#loading-wheel {
   position: absolute;
   left: 50%;
   top: 50%;
   height:60px;
   width:60px;
   margin:0px auto;
   -webkit-animation: rotation .6s infinite linear;
   -moz-animation: rotation .6s infinite linear;
   -o-animation: rotation .6s infinite linear;
   animation: rotation .6s infinite linear;
   border-left:6px solid rgba(0,174,239,.15);
   border-right:6px solid rgba(0,174,239,.15);
   border-bottom:6px solid rgba(0,174,239,.15);
   border-top:6px solid rgba(0,174,239,.8);
   border-radius:100%;
}

@-webkit-keyframes rotation {
   from {-webkit-transform: rotate(0deg);}
   to {-webkit-transform: rotate(359deg);}
}
@-moz-keyframes rotation {
   from {-moz-transform: rotate(0deg);}
   to {-moz-transform: rotate(359deg);}
}
@-o-keyframes rotation {
   from {-o-transform: rotate(0deg);}
   to {-o-transform: rotate(359deg);}
}
@keyframes rotation {
   from {transform: rotate(0deg);}
   to {transform: rotate(359deg);}
}