:root {
  color-scheme: dark;
  --bg: #000;
  --panel: #0b0b0b;
  --panel-2: #191919;
  --line: #252525;
  --text: #f7f8fb;
  --muted: #8d929a;
  --muted-2: #5d626b;
  --blue: #0098ff;
  --green: #42d77d;
  --red: #ff5a63;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.pc-only {
  display: none;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: #000;
}

.login-shell[hidden] {
  display: none;
}

.login-panel {
  width: min(100%, 360px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0a0a0a;
  padding: 18px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.46);
}

.login-panel h1 {
  margin: 0;
  font-size: 28px;
}

.login-panel p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.access-block {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: #000;
  text-align: center;
}

.access-block section {
  width: min(100%, 320px);
}

.access-block h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

.access-block p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.app-shell {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 10px 118px;
  background: #000;
}

.screen {
  padding: 24px 0 0;
  animation: screen-in 180ms ease both;
}

.screen[hidden] {
  display: none;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.utility-head,
.bot-head,
.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.head-actions,
.bot-head-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
  line-height: 1.08;
  font-weight: 850;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

.round-button {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #1f1f1f;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
}

.round-button.small {
  width: 28px;
  height: 28px;
  font-size: 15px;
}

.form-panel,
.logs-panel {
  margin-top: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0a0a0a;
}

.field {
  display: block;
  margin-top: 12px;
}

.field span,
.selector-block > span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.field input {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: var(--radius);
  outline: 0;
  background: var(--panel-2);
  color: #fff;
  padding: 0 12px;
}

.selector-block {
  margin-top: 12px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-row button {
  min-height: 32px;
  border: 1px solid #2b2b2b;
  border-radius: 999px;
  background: #070707;
  color: var(--muted);
  cursor: pointer;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 750;
}

.chip-row button.active {
  border-color: var(--blue);
  background: rgba(0, 152, 255, 0.16);
  color: #fff;
}

.primary-button,
.secondary-button {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 850;
}

.primary-button {
  width: 100%;
  margin-top: 12px;
  background: var(--blue);
  color: #fff;
}

.secondary-button {
  background: #242424;
  color: #fff;
  padding: 0 12px;
}

.secondary-button.danger-soft {
  background: #2a1719;
  color: #ffd6dc;
}

.secondary-button:disabled,
.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.error-text,
.result-text {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
}

.result-text.ok {
  color: var(--green);
}

.account-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.account-card {
  display: grid;
  gap: 10px;
  border-radius: var(--radius);
  background: var(--panel);
  padding: 12px;
}

.account-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.account-card strong,
.account-card span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.account-title {
  font-size: 16px;
  font-weight: 900;
}

.account-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.account-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.account-tools button {
  min-height: 36px;
  border: 0;
  border-radius: 7px;
  background: #1d1d1d;
  color: #fff;
  cursor: pointer;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
}

.account-tools button.danger {
  background: #3a171b;
  color: #ffd6dc;
}

.credential-line {
  display: inline-flex;
  max-width: 100%;
  min-width: 0;
  vertical-align: bottom;
}

.secret-value {
  filter: blur(4px);
  user-select: none;
  transition: filter 160ms ease;
}

.account-card:hover .secret-value,
.account-card:focus-within .secret-value {
  filter: blur(0);
  user-select: text;
}

.bot-head {
  align-items: flex-start;
}

.bot-head h1 {
  max-width: 290px;
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-grid;
  grid-auto-flow: column;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  border-radius: 999px;
  background: #111;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.status-pill i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red);
}

.status-pill.running i {
  background: var(--green);
}

.bot-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.bot-actions .primary-button {
  margin-top: 0;
}

.log-list {
  display: grid;
  gap: 6px;
  max-height: calc(100vh - 360px);
  max-height: calc(100svh - 360px);
  min-height: 220px;
  margin-top: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.log-item {
  display: grid;
  gap: 4px;
  border-radius: 7px;
  background: #111;
  padding: 8px 10px;
}

.log-item time {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.log-item pre {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  color: #fff;
  font: 12px/1.35 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.empty-state {
  padding: 34px 10px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.confirm-overlay {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.7);
}

.confirm-overlay[hidden] {
  display: none;
}

.confirm-panel {
  width: min(100%, 360px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0a0a0a;
  padding: 16px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.58);
}

.confirm-panel p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}

.confirm-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.bottom-nav-wrap {
  position: fixed;
  right: 0;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: 0;
}

.bottom-nav {
  --nav-padding-x: 8px;
  position: fixed;
  right: 0;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: 0;
  display: grid;
  grid-template-columns: repeat(var(--nav-count), minmax(0, 1fr));
  width: min(calc(100% - 28px), 400px);
  height: 64px;
  margin: 0 auto;
  padding: 0 var(--nav-padding-x);
  border: 1px solid #15151c;
  border-radius: 10px;
  background: #080711;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.45);
  isolation: isolate;
  overflow: hidden;
  scrollbar-width: none;
}

.bottom-nav::-webkit-scrollbar {
  display: none;
}

.bottom-item {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  appearance: none;
}

.bottom-item:focus {
  outline: 0;
}

.bottom-item:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: -6px;
}

.nav-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  overflow: visible;
  transition:
    background 180ms ease,
    box-shadow 180ms ease,
    color 180ms ease,
    transform 320ms cubic-bezier(0.2, 0.9, 0.2, 1.2);
  font-size: 18px;
  font-weight: 900;
}

.nav-icon.has-image {
  background: #15151c;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.nav-icon-image {
  display: block;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  object-fit: contain;
}

.bottom-item small {
  position: absolute;
  bottom: 7px;
  max-width: calc(100% - 4px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
  font-weight: 800;
  opacity: 0;
  transform: translateY(8px);
  transition: color 200ms ease, opacity 180ms ease, transform 220ms ease;
}

.bottom-item.active {
  color: #fff;
}

.bottom-item.active .nav-icon {
  background: #f8f8fa;
  box-shadow: 0 7px 16px rgba(0, 0, 0, 0.32);
  color: #080711;
  overflow: hidden;
  transform: translateY(-8px);
}

.bottom-item.active .nav-icon-image {
  width: 28px;
  height: 28px;
}

.bottom-item.active small {
  color: #fff;
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 360px) {
  .bot-actions {
    grid-template-columns: 1fr;
  }

  .account-tools {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 760px) {
  .pc-mode .pc-only {
    display: grid;
  }

  .pc-mode .app-shell {
    width: min(100%, 1180px);
    padding: 32px 32px 124px;
  }

  .pc-mode .screen {
    padding-top: 0;
  }

  .pc-mode [data-screen="accounts"]:not([hidden]) {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
  }

  .pc-mode [data-screen="accounts"] .utility-head {
    grid-column: 1 / -1;
  }

  .pc-mode .account-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 18px;
  }

  .pc-mode .bot-screen:not([hidden]) {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
  }

  .pc-mode .bot-head,
  .pc-mode .bot-actions,
  .pc-mode .result-text {
    grid-column: 1;
  }

  .pc-mode .logs-panel {
    grid-column: 2;
    grid-row: 1 / span 4;
    margin-top: 0;
  }

  .pc-mode .log-list {
    max-height: calc(100vh - 148px);
    min-height: 560px;
  }

  .pc-mode .bottom-nav {
    width: min(calc(100% - 64px), 920px);
    height: 76px;
  }

  .pc-mode .nav-icon {
    width: 44px;
    height: 44px;
    font-size: 22px;
  }

  .pc-mode .nav-icon-image {
    width: 34px;
    height: 34px;
  }

  .pc-mode .bottom-item small {
    bottom: 11px;
    max-width: 68px;
    font-size: 11px;
  }

  .pc-mode .bottom-item.active .nav-icon {
    transform: translateY(-10px);
  }

  .pc-mode .bottom-item.active .nav-icon-image {
    width: 38px;
    height: 38px;
  }
}
