:root {
  color-scheme: dark;
  --black: #060606;
  --black-2: #0d0e0f;
  --panel: #111313;
  --cream: #eee9dd;
  --muted: #8f918e;
  --muted-2: #666b67;
  --line: rgba(238, 233, 221, .15);
  --line-soft: rgba(238, 233, 221, .08);
  --blue: #71a8c4;
  --gold: #c7a86a;
  --green: #7ecda2;
  --red: #df817b;
  --ease: cubic-bezier(.23, 1, .32, 1);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--black);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--black);
  color: var(--cream);
  font-family: "DM Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.drawer-open {
  overflow: hidden;
}

button,
a,
select {
  font: inherit;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--cream);
  color: var(--black);
}

.ko-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 78px;
  display: flex;
  align-items: center;
  padding: 0 5.5vw;
  border-bottom: 1px solid rgba(238, 233, 221, .13);
  background: rgba(6, 6, 6, .95);
  backdrop-filter: blur(16px);
}

.ko-logo {
  width: 112px;
  height: 48px;
  display: flex;
  align-items: center;
}

.ko-logo img {
  display: block;
  width: 112px;
  height: auto;
  object-fit: contain;
}

.ko-nav {
  display: flex;
  align-items: stretch;
  align-self: stretch;
  gap: 34px;
  margin-left: 66px;
}

.ko-nav-link,
.text-button,
.drawer-close,
.stream-tab {
  border: 0;
  background: none;
  cursor: pointer;
}

.ko-nav-link {
  position: relative;
  padding: 0;
  color: #9ea29e;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .16em;
}

.ko-nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: transparent;
}

.ko-nav-link:hover,
.ko-nav-link.is-active {
  color: var(--cream);
}

.ko-nav-link.is-active::after {
  background: var(--gold);
}

.ko-header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 20px;
}

.identity {
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: .12em;
}

.identity--user {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #c6c8c3;
  letter-spacing: .04em;
}

.identity--user img {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  object-fit: cover;
}

.text-button {
  padding: 0;
  color: #8f918e;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: .13em;
}

.text-button:hover {
  color: var(--cream);
}

.ko-main {
  width: min(1180px, calc(100% - 11vw));
  margin: 0 auto;
  padding: 64px 0 86px;
}

.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  padding-bottom: 34px;
}

.overline {
  display: block;
  margin-bottom: 11px;
  color: #848984;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .22em;
}

.page-head h1 {
  margin: 0;
  color: var(--cream);
  font-size: clamp(2.65rem, 5vw, 4.35rem);
  font-weight: 560;
  line-height: .94;
  letter-spacing: -.055em;
}

.page-head p {
  margin: 14px 0 0;
  color: #929893;
  font-size: 13px;
  line-height: 1.7;
}

.primary-button,
.secondary-button,
.row-button {
  min-height: 38px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  color: var(--cream);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: .13em;
  transition: color .18s ease, background .18s ease, border-color .18s ease;
}

.primary-button,
.secondary-button {
  padding: 0 16px;
}

.primary-button {
  border-color: rgba(238, 233, 221, .55);
}

.primary-button:hover,
.secondary-button:hover,
.row-button:hover:not(:disabled) {
  border-color: var(--cream);
  background: var(--cream);
  color: var(--black);
}

.primary-button--danger {
  border-color: var(--red);
  background: var(--red);
  color: #120706;
}

.secondary-button {
  color: #aaaca7;
}

button:disabled {
  cursor: default;
  opacity: .27;
}

.health-strip {
  display: grid;
  grid-template-columns: 1.35fr .8fr .85fr;
  margin-bottom: 46px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.health-item {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 22px;
  border-right: 1px solid var(--line-soft);
}

.health-item:last-child {
  border-right: 0;
}

.health-item--status {
  justify-content: flex-start;
}

.health-label {
  display: block;
  margin-bottom: 5px;
  color: #6f746f;
  font-size: 8px;
  font-weight: 650;
  letter-spacing: .16em;
}

.health-item strong {
  color: var(--cream);
  font-size: 15px;
  font-weight: 620;
}

.health-item:first-child strong {
  color: var(--green);
}

.health-strip--degraded .health-item:first-child strong {
  color: var(--red);
}

.health-note {
  color: #666b67;
  font-size: 9px;
}

.notice {
  margin: -24px 0 30px;
  padding: 12px 14px;
  border-left: 2px solid var(--gold);
  background: rgba(199, 168, 106, .055);
  color: #c9c3b5;
  font-size: 11px;
}

.notice--success {
  border-color: var(--green);
  background: rgba(126, 205, 162, .055);
  color: var(--green);
}

.notice--error {
  border-color: var(--red);
  background: rgba(223, 129, 123, .055);
  color: var(--red);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.section-head h2,
.drawer-head h2 {
  margin: 0;
  color: var(--cream);
  font-size: 1.72rem;
  font-weight: 560;
  letter-spacing: -.035em;
}

.section-head p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.service-list {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.service-row {
  min-height: 82px;
  display: grid;
  grid-template-columns: 12px minmax(230px, 1fr) 90px 88px auto;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line-soft);
  transition: background .18s ease;
}

.service-row:last-child {
  border-bottom: 0;
}

.service-row:hover {
  background: rgba(255, 255, 255, .018);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #666;
}

.status-dot--online {
  background: var(--green);
}

.status-dot--offline {
  background: var(--red);
}

.service-name {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.service-name strong {
  color: var(--cream);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .02em;
}

.service-name span,
.service-pid {
  overflow: hidden;
  color: #727772;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-state {
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .12em;
}

.service-state--online {
  color: var(--green);
}

.service-state--offline {
  color: var(--red);
}

.service-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.row-button {
  min-height: 31px;
  padding: 0 10px;
  color: #a8aaa4;
  font-size: 8px;
}

.row-button--primary {
  border-color: rgba(199, 168, 106, .55);
  color: #d9c391;
}

.row-button--danger {
  border-color: rgba(223, 129, 123, .34);
  color: #c98782;
}

.read-only {
  color: #767b77;
  font-size: 8px;
  font-weight: 650;
  letter-spacing: .12em;
}

.activity-table-head,
.activity-row {
  display: grid;
  grid-template-columns: 150px minmax(190px, 1.2fr) minmax(110px, .7fr) minmax(130px, .8fr) 90px;
  gap: 18px;
  align-items: center;
}

.activity-table-head {
  min-height: 38px;
  padding: 0 16px;
  border-top: 1px solid var(--line);
  color: #676c68;
  font-size: 8px;
  font-weight: 650;
  letter-spacing: .14em;
}

.activity-list {
  border-bottom: 1px solid var(--line);
}

.activity-row {
  min-height: 68px;
  padding: 10px 16px;
  border-top: 1px solid var(--line-soft);
}

.activity-row time,
.activity-row > span,
.activity-action {
  color: #a4a8a3;
  font-size: 10px;
}

.activity-row time {
  color: #767b77;
  font-family: "Cascadia Code", Consolas, monospace;
}

.activity-actor {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.activity-actor strong {
  overflow: hidden;
  color: var(--cream);
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-actor span {
  color: #686e69;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 8px;
}

.activity-action {
  color: #d0c9b8;
  font-weight: 600;
}

.activity-result {
  justify-self: start;
  font-size: 8px !important;
  font-weight: 700;
  letter-spacing: .12em;
}

.activity-result--success {
  color: var(--green) !important;
}

.activity-result--failed {
  color: var(--red) !important;
}

.empty-state {
  min-height: 90px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line);
  color: #777c78;
  font-size: 11px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, .62);
  backdrop-filter: blur(2px);
}

.log-drawer {
  position: fixed;
  z-index: 41;
  top: 0;
  right: 0;
  width: min(760px, 92vw);
  height: 100vh;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  border-left: 1px solid var(--line);
  background: #090a0a;
  box-shadow: -30px 0 80px rgba(0, 0, 0, .36);
  transition: transform .28s var(--ease);
}

.log-drawer.is-open {
  transform: translateX(0);
}

.drawer-head {
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 28px;
  border-bottom: 1px solid var(--line);
}

.drawer-head .overline {
  margin-bottom: 7px;
}

.drawer-service-name {
  display: block;
  margin-top: 6px;
  color: #6d726e;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 9px;
}

.drawer-close {
  width: 38px;
  height: 38px;
  color: #868b86;
  font-size: 25px;
  line-height: 1;
}

.drawer-close:hover {
  color: var(--cream);
}

.drawer-toolbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line-soft);
}

.stream-tabs {
  display: flex;
  align-items: stretch;
  align-self: stretch;
  gap: 20px;
}

.stream-tab {
  position: relative;
  padding: 0;
  color: #737873;
  font-size: 8px;
  font-weight: 650;
  letter-spacing: .13em;
}

.stream-tab:hover,
.stream-tab.is-active {
  color: var(--cream);
}

.stream-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--gold);
}

.drawer-tools {
  display: flex;
  align-items: center;
  gap: 18px;
}

.tail-control {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #737873;
  font-size: 8px;
  font-weight: 650;
  letter-spacing: .11em;
}

.tail-control select {
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #0d0e0e;
  color: #b4b6b1;
  font-size: 9px;
  outline: none;
}

#logs-output {
  flex: 1;
  margin: 0;
  overflow: auto;
  padding: 24px 28px 40px;
  background: #070808;
  color: #a0a8a2;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 10px;
  line-height: 1.62;
  white-space: pre-wrap;
  word-break: break-word;
}

.login-panel {
  width: min(520px, 100%);
  margin: 74px auto 0;
  padding: 44px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.login-panel h1 {
  margin: 0;
  font-size: 2.7rem;
  font-weight: 560;
  letter-spacing: -.045em;
}

.login-panel p {
  margin: 16px 0 28px;
  color: var(--muted);
  font-size: 13px;
}

.login-panel .primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.login-status {
  margin: 0 0 20px;
  padding: 11px 12px;
  border-left: 2px solid var(--gold);
  background: rgba(199, 168, 106, .05);
  color: #b8aa89;
  font-size: 11px;
}

.confirm-dialog {
  width: min(430px, calc(100% - 28px));
  padding: 0;
  border: 1px solid rgba(238, 233, 221, .25);
  border-radius: 0;
  background: #0b0c0c;
  color: var(--cream);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .55);
}

.confirm-dialog::backdrop {
  background: rgba(0, 0, 0, .76);
}

.confirm-dialog form {
  padding: 30px;
}

.confirm-dialog h2 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 560;
  letter-spacing: -.035em;
}

.confirm-dialog p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.confirm-dialog .audit-note {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  color: #797f79;
  font-size: 10px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 26px;
}

@media (max-width: 900px) {
  .ko-nav {
    margin-left: 36px;
    gap: 24px;
  }

  .service-row {
    grid-template-columns: 12px minmax(180px, 1fr) 76px auto;
  }

  .service-pid {
    display: none;
  }

  .activity-table-head,
  .activity-row {
    grid-template-columns: 130px minmax(160px, 1.2fr) 100px 110px 78px;
    gap: 12px;
  }

  .health-strip {
    grid-template-columns: 1fr 1fr;
  }

  .health-item:first-child {
    grid-column: 1 / -1;
    border-bottom: 1px solid var(--line-soft);
    border-right: 0;
  }
}

@media (max-width: 700px) {
  .ko-header {
    height: auto;
    min-height: 68px;
    padding: 0 16px;
    flex-wrap: wrap;
  }

  .ko-logo,
  .ko-logo img {
    width: 96px;
  }

  .ko-nav {
    order: 3;
    width: 100%;
    height: 44px;
    margin: 0;
    gap: 26px;
  }

  .ko-header-right {
    margin-left: auto;
  }

  .identity--user span {
    display: none;
  }

  .ko-main {
    width: calc(100% - 32px);
    padding: 46px 0 64px;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 22px;
  }

  .page-head h1 {
    font-size: 3rem;
  }

  .health-strip {
    grid-template-columns: 1fr;
    margin-bottom: 38px;
  }

  .health-item,
  .health-item:first-child {
    min-height: 76px;
    grid-column: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .health-item:last-child {
    border-bottom: 0;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .service-row {
    min-height: 0;
    grid-template-columns: 10px 1fr auto;
    gap: 12px;
    padding: 18px 4px;
  }

  .service-state {
    justify-self: end;
  }

  .service-actions {
    grid-column: 2 / 4;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .activity-table-head {
    display: none;
  }

  .activity-row {
    min-height: 92px;
    grid-template-columns: 1fr auto;
    gap: 7px 16px;
    padding: 16px 4px;
  }

  .activity-row time {
    order: 4;
    grid-column: 1 / -1;
    font-size: 8px;
  }

  .activity-actor,
  .activity-action,
  .activity-row > span:not(.activity-result) {
    grid-column: 1;
  }

  .activity-result {
    grid-column: 2;
    grid-row: 1;
  }

  .log-drawer {
    width: 100vw;
  }

  .drawer-head {
    min-height: 96px;
    padding: 20px 18px;
  }

  .drawer-toolbar {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 18px;
  }

  .stream-tabs {
    min-height: 36px;
    align-self: stretch;
  }

  .drawer-tools {
    width: 100%;
    justify-content: space-between;
  }

  #logs-output {
    padding: 20px 18px 34px;
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
