:root {
  color-scheme: dark;
  --ink: #eef7fb;
  --muted: #8ea2ad;
  --line: rgba(154, 184, 197, 0.18);
  --surface: rgba(16, 26, 34, 0.92);
  --surface-strong: #101923;
  --soft: rgba(255, 255, 255, 0.055);
  --field: #0b131a;
  --green: #35d39f;
  --green-soft: rgba(53, 211, 159, 0.16);
  --cyan: #6bd9ff;
  --cyan-soft: rgba(107, 217, 255, 0.14);
  --red: #ff6b7d;
  --red-soft: rgba(255, 107, 125, 0.14);
  --gold: #ffc857;
  --gold-soft: rgba(255, 200, 87, 0.15);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(12, 20, 28, 0.96), rgba(4, 8, 12, 1)),
    #070c11;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
  padding: 0 14px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(107, 217, 255, 0.44);
  background: rgba(107, 217, 255, 0.1);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-soft);
}

h1,
h2,
p {
  margin-top: 0;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 13, 19, 0.86);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 950;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  aspect-ratio: 1;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  color: #031014;
  font-size: 13px;
  box-shadow: 0 0 22px rgba(53, 211, 159, 0.24);
}

.nav {
  display: flex;
  gap: 6px;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 8px;
  font-weight: 800;
}

.nav a.active {
  color: var(--ink);
  background: var(--soft);
}

.logout-form {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.login-layout {
  min-height: calc(100vh - 150px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 48px;
  align-items: center;
}

.login-copy h1 {
  max-width: 760px;
  font-size: clamp(40px, 6vw, 82px);
  line-height: 0.98;
  letter-spacing: 0;
  margin: 0;
}

.auth-panel,
.admin-panel,
.upload-panel,
.table-wrap,
.secret-dialog,
.log-dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-panel,
.admin-panel,
.upload-form,
.secret-form {
  display: grid;
  gap: 16px;
}

.auth-panel,
.admin-panel {
  padding: 26px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-bottom: 22px;
}

.page-head h1 {
  font-size: 38px;
  margin-bottom: 0;
  letter-spacing: 0;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 950;
  font-size: 12px;
}

.primary-button {
  border-color: rgba(53, 211, 159, 0.5);
  background: linear-gradient(135deg, #36d89f, #62d8ff);
  color: #031014;
}

.ghost-button {
  background: transparent;
}

.danger {
  border-color: rgba(255, 107, 125, 0.32);
  color: #ffd7dc;
  background: var(--red-soft);
}

.upload-panel {
  margin-bottom: 24px;
  padding: 20px;
}

.dropzone {
  min-height: 178px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 2px dashed rgba(107, 217, 255, 0.35);
  border-radius: 8px;
  background: rgba(107, 217, 255, 0.06);
  text-align: center;
  cursor: pointer;
}

.dropzone.active {
  border-color: var(--green);
  background: var(--green-soft);
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.drop-title {
  color: var(--ink);
  font-size: 20px;
  font-weight: 950;
}

.drop-subtitle,
.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.table-wrap {
  overflow: hidden;
}

.bot-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.bot-table th,
.bot-table td {
  padding: 15px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.bot-table th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.bot-table tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

.bot-table td:first-child {
  display: grid;
  gap: 3px;
}

.actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.actions-cell button {
  min-height: 34px;
  padding: 0 10px;
}

.status,
.user-chip {
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.status-ready,
.status-online,
.status-running {
  background: var(--green-soft);
  color: var(--green);
}

.status-installing,
.status-created,
.status-restarting {
  background: var(--gold-soft);
  color: var(--gold);
}

.status-failed,
.status-exited,
.status-dead,
.status-paused,
.status-docker-unavailable {
  background: var(--red-soft);
  color: var(--red);
}

.admin-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.alert,
.notice {
  border-radius: 8px;
  padding: 12px 14px;
  font-weight: 800;
}

.alert {
  color: #ffd7dc;
  background: var(--red-soft);
}

.notice {
  color: var(--green);
  background: var(--green-soft);
}

.empty {
  height: 180px;
  color: var(--muted);
  text-align: center;
}

.log-dialog,
.secret-dialog {
  width: min(920px, calc(100% - 32px));
  padding: 0;
  color: var(--ink);
}

.secret-dialog {
  width: min(760px, calc(100% - 32px));
}

.log-dialog::backdrop,
.secret-dialog::backdrop {
  background: rgba(0, 0, 0, 0.66);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  margin: 0;
}

.secret-form {
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.5fr) auto;
  align-items: end;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.secret-form p {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.secret-list {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.secret-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 120px auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.secret-row span {
  font-weight: 900;
}

.secret-row code {
  color: var(--cyan);
}

pre {
  max-height: 68vh;
  overflow: auto;
  margin: 0;
  padding: 18px;
  color: #d8f2ec;
  background: #05090d;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 960px) {
  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding: 14px 16px;
  }

  .logout-form {
    width: 100%;
    margin-left: 0;
  }

  .shell {
    width: min(100% - 20px, 1240px);
    padding-top: 22px;
  }

  .login-layout,
  .admin-grid,
  .secret-form {
    grid-template-columns: 1fr;
  }

  .page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .table-wrap {
    overflow-x: auto;
  }

  .bot-table {
    min-width: 1020px;
  }

  .secret-row {
    grid-template-columns: 1fr;
  }
}
