@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url('./fonts/ibm-plex-sans-latin-wght-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url('./fonts/ibm-plex-sans-cyrillic-wght-normal.woff2') format('woff2');
  unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* Surface and accent roles follow Abyss Tasks' Base16 Default Dark theme. */
:root,
[data-bs-theme='dark'] {
  color-scheme: dark;

  --ground: #181818;
  --surface: #202020;
  --surface-control: #282828;
  --selected: #383838;
  --line: rgb(216 216 216 / 14%);
  --line-strong: rgb(216 216 216 / 24%);
  --strong: #f8f8f8;
  --ink: #d8d8d8;
  --muted: #b8b8b8;
  --faint: #969696;
  --link: #7cafc2;
  --good: #a1b56c;
  --error: #da7069;
  --bs-body-bg: var(--ground);
  --bs-body-color: var(--ink);
  --bs-body-font-family: 'IBM Plex Sans', system-ui, sans-serif;
  --bs-body-font-size: 0.9375rem;
  --bs-body-line-height: 1.5;
  --bs-border-color: var(--line);
  --bs-border-radius: 4px;
  --bs-link-color: var(--link);
  --bs-link-hover-color: #b0d3de;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
}

button,
input {
  font: inherit;
}

a {
  color: var(--link);
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--bs-link-hover-color);
}

summary {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}

.skip {
  position: fixed;
  top: -5rem;
  left: 1rem;
  background: var(--surface-control);
  padding: 0.5rem 1rem;
  z-index: 5;
}

.skip:focus {
  top: 1rem;
}

main:focus {
  outline: 0;
}

h1,
h2,
h3,
p,
dl,
dd {
  margin: 0;
}

h1,
h2,
h3 {
  color: var(--strong);
}

h1 {
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 550;
  letter-spacing: -0.043em;
  line-height: 1.16;
}

h2 {
  font-size: 1.1rem;
  letter-spacing: -0.018em;
  font-weight: 550;
}

h3 {
  font-size: 0.955rem;
  letter-spacing: -0.012em;
  font-weight: 550;
}

.icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 36px;
  border-radius: 4px;
  padding: 0.42rem 0.85rem;
  font-weight: 500;
  line-height: 1.4;
  font-size: 0.875rem;
  transition: none;
  white-space: normal;
}

.btn-primary {
  --bs-btn-color: #15252c;
  --bs-btn-bg: var(--link);
  --bs-btn-border-color: var(--link);
  --bs-btn-hover-color: #10181b;
  --bs-btn-hover-bg: #9ac3d1;
  --bs-btn-hover-border-color: #9ac3d1;
  --bs-btn-active-bg: #94bdcc;
  --bs-btn-active-color: #10181b;
  --bs-btn-active-border-color: #94bdcc;
  --bs-btn-disabled-color: #272d30;
  --bs-btn-disabled-bg: #829ba3;
  --bs-btn-disabled-border-color: #829ba3;
}

.btn-outline-secondary {
  --bs-btn-color: var(--ink);
  --bs-btn-bg: var(--surface-control);
  --bs-btn-border-color: var(--line-strong);
  --bs-btn-hover-color: var(--strong);
  --bs-btn-hover-bg: var(--selected);
  --bs-btn-hover-border-color: #626262;
  --bs-btn-active-color: var(--strong);
  --bs-btn-active-bg: var(--selected);
  --bs-btn-active-border-color: var(--line-strong);
}

.btn-outline-danger {
  --bs-btn-color: var(--error);
  --bs-btn-bg: transparent;
  --bs-btn-border-color: #664440;
  --bs-btn-hover-color: #ffc2b9;
  --bs-btn-hover-bg: #3a2826;
  --bs-btn-hover-border-color: #8e544e;
  --bs-btn-active-color: #ffc2b9;
  --bs-btn-active-bg: #422b29;
  --bs-btn-active-border-color: #8e544e;
}

.form-control {
  background: var(--ground);
  border-color: var(--line-strong);
  color: var(--ink);
  border-radius: 4px;
  min-height: 41px;
}

.btn:focus-visible,
.form-control:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
  box-shadow: none;
}

.auth-screen {
  min-height: 100vh;
  min-height: 100svh;
  padding: 32px 22px;
  display: grid;
  place-items: center;
}

.auth-form {
  width: min(100%, 304px);
  text-align: center;
  min-width: 0;
}

.brand-mark {
  display: block;
  width: 132px;
  height: auto;
  border-radius: 50%;
  margin: 0 auto 20px;
}

.auth-form h1 {
  font-size: 2rem;
  font-weight: 560;
  letter-spacing: -0.055em;
}

dialog p {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 16px;
  overflow-wrap: anywhere;
}

.auth-form > p {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
  margin: 14px auto 0;
}

.auth-actions {
  display: grid;
  gap: 10px;
  margin-top: 30px;
}

.auth-actions .btn {
  min-height: 43px;
  letter-spacing: -0.01em;
}

.auth-form .btn-primary {
  --bs-btn-color: #152122;
  --bs-btn-bg: #a5d6d7;
  --bs-btn-border-color: #a5d6d7;
  --bs-btn-hover-bg: #b6e2e2;
  --bs-btn-hover-border-color: #b6e2e2;
}

.key-form {
  display: grid;
  gap: 9px;
  text-align: left;
}

.auth-form .key-form {
  margin-top: 24px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 500;
  margin: 0;
}

.form-control:focus {
  background: var(--ground);
  color: var(--ink);
  border-color: var(--link);
  box-shadow: none;
}

.key-form .btn {
  margin-top: 6px;
  min-height: 41px;
}

.back-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  margin-top: 6px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.account-key {
  overflow-wrap: anywhere;
  margin-top: 18px;
}

.auth-form details {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 16px;
}

code {
  color: #dc9656;
  font-size: 0.85em;
}

details code {
  display: block;
  margin: 0.5rem 0 0;
}

.app-screen {
  width: min(842px, calc(100% - 64px));
  margin: auto;
  padding-bottom: 72px;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 64px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 40px;
}

.tabs > img {
  border-radius: 50%;
  height: auto;
  margin-right: 15px;
}

.tabs > a,
.nav-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 4px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.875rem;
  white-space: nowrap;
  text-decoration: none;
}

.tabs > a[aria-current='page'] {
  background: var(--surface-control);
  color: var(--strong);
}

.provider-icon .icon {
  width: 23px;
  height: 23px;
}

.tabs > a[aria-current='page'] .icon {
  color: var(--link);
}

.nav-action {
  margin-left: auto;
  color: var(--faint);
}

.tabs > a:hover,
.nav-action:hover {
  background: var(--surface);
}

.nav-action:hover {
  color: var(--strong);
}

.workspace {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  overflow: hidden;
}

.heading,
.panel-head,
.row-item,
.channel-row,
.toolbar,
.actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.heading,
.panel-head,
.row-item {
  justify-content: space-between;
}

.panel-head,
.row-item,
.channel-row {
  padding: 16px 21px;
}

.panel-head {
  min-height: 54px;
  border-bottom: 1px solid var(--line);
}

.panel-head h1 {
  font-size: 1.45rem;
}

.row-item + .row-item,
.channel-row + .row-item,
.summary-list > .row-item + .row-item {
  border-top: 1px solid var(--line);
}

.channel-row {
  min-height: 84px;
  gap: 13px;
}

.channel-row .btn {
  margin-left: auto;
}

.provider-icon {
  background: #253137;
  border: 1px solid #384b52;
  border-radius: 7px;
  color: var(--link);
  height: 40px;
  width: 40px;
  display: grid;
  place-items: center;
  flex: none;
}

.channel-identity h3 {
  margin-bottom: 3px;
  overflow-wrap: anywhere;
}

.row-item > div,
.identity,
.metrics > * {
  min-width: 0;
}

.identity {
  overflow-wrap: anywhere;
}

.metadata,
.muted,
.empty {
  font-size: 0.865rem;
  color: var(--muted);
}

.metadata {
  margin-top: 3px;
}

.workspace > .muted,
.empty {
  padding: 16px 21px;
}

.summary-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.summary-list.mt-3 {
  margin-top: 0 !important;
}

.workspace > .muted + .summary-list {
  border-top: 1px solid var(--line);
}

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

dialog .actions {
  margin-top: 16px;
  justify-content: flex-end;
}

.workspace > .actions {
  padding: 0 21px 16px;
}

.workspace > .actions:empty {
  display: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.795rem;
  font-weight: 500;
}

.pill::before {
  content: '';
  height: 6px;
  width: 6px;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
}

.pill[data-tone='good'] {
  color: var(--good);
}

.pill[data-tone='error'] {
  color: var(--error);
}

.pill[data-tone='good']::before,
.pill[data-tone='error']::before {
  background: currentcolor;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metrics > div {
  padding: 16px 21px;
}

.metrics > div + div {
  border-left: 1px solid var(--line);
}

.metrics dt {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 400;
}

.metrics dd {
  font-variant-numeric: tabular-nums;
  font-size: 1.35rem;
  font-weight: 520;
  margin: 3px 0 0;
  overflow-wrap: anywhere;
}

.notice {
  padding: 11px 13px;
  border: 1px solid #46513a;
  background: #252921;
  border-radius: 4px;
  color: #c1cd9b;
  overflow-wrap: anywhere;
  text-align: left;
  font-size: 0.9rem;
}

.notice[data-kind='error'] {
  border-color: #69443f;
  color: #efa09a;
  background: #2c2423;
}

dialog .notice {
  margin-bottom: 0;
}

.notice:not(:empty) {
  margin: 16px 0;
}

.notice:empty {
  display: none;
}

dialog {
  width: min(412px, calc(100% - 32px));
  max-height: calc(100svh - 32px);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 24px;
  background: var(--surface);
  color: var(--ink);
}

dialog::backdrop {
  background: rgb(0 0 0 / 62%);
}

dialog h2 {
  margin-bottom: 16px;
  font-size: 1.2rem;
}

dialog code {
  overflow-wrap: anywhere;
}

.full-key {
  display: block;
  user-select: all;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
  background: var(--ground);
  color: var(--muted);
}

@media (width <= 640px) {
  .brand-mark {
    width: 116px;
    margin-bottom: 16px;
  }

  .app-screen {
    width: calc(100% - 32px);
    padding-bottom: 32px;
  }

  .tabs {
    height: auto;
    min-height: 59px;
    flex-wrap: wrap;
    padding-block: 8px;
    margin-bottom: 26px;
  }

  .tabs > img {
    margin-right: 3px;
  }

  .tabs > a,
  .nav-action {
    padding: 5px 8px;
    min-height: 36px;
    font-size: 0.84rem;
  }

  .nav-action .icon,
  .tabs > a .icon {
    display: none;
  }

  .channel-row,
  .row-item,
  .panel-head {
    padding: 14px;
    flex-wrap: wrap;
  }

  .channel-row .btn {
    margin-left: 0;
  }

  .channel-identity {
    flex: 1;
  }

  .metrics > div {
    padding: 12px;
  }

  .metrics dd {
    font-size: 1.05rem;
  }

  .workspace > .muted,
  .empty {
    padding: 14px;
  }
}

@media (width <= 360px) {
  .tabs {
    gap: 0;
  }

  .tabs > img {
    width: 20px;
  }

  .tabs > a,
  .nav-action {
    padding: 4px 6px;
  }
}

@media (width <= 460px) {
  .tabs:has(a[href='#account']) > a {
    padding-inline: 3px;
  }

  .tabs:has(a[href='#account']) .nav-action {
    font-size: 0;
    gap: 0;
    padding-inline: 5px;
  }

  .tabs:has(a[href='#account']) .nav-action .icon {
    display: block;
  }
}
