:root {
  --bg: #09111d;
  --bg-2: #0e1730;
  --panel: rgba(16, 23, 38, 0.86);
  --panel-strong: rgba(12, 18, 30, 0.92);
  --panel-soft: rgba(255, 255, 255, 0.04);
  --line: rgba(132, 244, 223, 0.14);
  --line-soft: rgba(146, 165, 255, 0.18);
  --text: #f4f8ff;
  --muted: #9eacc6;
  --teal: #84f4df;
  --teal-strong: #50d8c8;
  --violet: #8c91ff;
  --violet-strong: #676eff;
  --amber: #ffd27d;
  --danger: #ff7f9d;
  --danger-soft: rgba(255, 127, 157, 0.18);
  --success: #6ff0b0;
  --success-soft: rgba(111, 240, 176, 0.18);
  --shadow: 0 30px 100px rgba(1, 5, 14, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", Inter, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(80, 216, 200, 0.18), transparent 18%),
    radial-gradient(circle at 18% 0%, rgba(103, 110, 255, 0.22), transparent 24%),
    radial-gradient(circle at bottom left, rgba(255, 210, 125, 0.08), transparent 18%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 52%, #09111d 100%);
}

.shell {
  width: calc(100vw - 32px);
  margin: 16px auto;
}

.topbar,
.workspace,
.modal-card {
  border: 1px solid var(--line-soft);
  border-radius: 28px;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.topbar {
  display: grid;
  grid-template-columns: 1.15fr 0.95fr;
  gap: 24px;
  padding: 28px;
  margin-bottom: 18px;
  background:
    linear-gradient(135deg, rgba(103, 110, 255, 0.12), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 70%),
    var(--panel);
  position: relative;
  overflow: hidden;
}

.topbar::after {
  content: "";
  position: absolute;
  right: -5%;
  top: -25%;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(80, 216, 200, 0.18), transparent 62%);
  filter: blur(18px);
  pointer-events: none;
}

.brand-block,
.topbar-right {
  position: relative;
  z-index: 1;
}

.eyebrow,
.panel-label {
  margin: 0 0 10px;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(2.2rem, 3vw, 3.2rem);
  line-height: 1.03;
  max-width: 780px;
  text-shadow: 0 10px 36px rgba(0, 0, 0, 0.22);
}

.subcopy,
.panel-copy {
  color: var(--muted);
}

.subcopy {
  margin: 12px 0 0;
  max-width: 860px;
  font-size: 1rem;
}

.panel-copy {
  margin: 2px 0 0;
  font-size: 14px;
}

code {
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(132, 244, 223, 0.12);
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(132, 244, 223, 0.14);
  color: #d8fff7;
  font-size: 13px;
  font-weight: 700;
}

.hero-chip i {
  color: var(--teal);
}

.topbar-right {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-end;
}

.actions,
.inline-actions,
.editor-actions,
.row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  align-content: flex-start;
  padding: 10px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.server-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.server-switch span {
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  font-weight: 800;
}

.server-switch-field {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 244px;
  min-height: 40px;
  padding: 0 36px 0 12px;
  border-radius: 12px;
  background: rgba(8, 12, 20, 0.58);
  border: 1px solid rgba(132, 244, 223, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.auth-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.auth-chip i {
  color: var(--teal);
}

.server-switch-field i {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--amber);
  font-size: 12px;
  pointer-events: none;
}

.server-switch select {
  width: 100%;
  border: 0;
  outline: none;
  color: var(--text);
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  font-weight: 700;
  line-height: 1.2;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.22);
  cursor: pointer;
}

.server-switch select option {
  color: var(--text);
  background: #0f1727;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 14px;
  padding: 11px 16px;
  color: #f9fbff;
  background: linear-gradient(135deg, var(--teal-strong) 0%, var(--violet) 100%);
  cursor: pointer;
  font-weight: 700;
  transition: transform 140ms ease, opacity 140ms ease, filter 140ms ease, border-color 140ms ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

button.ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

button.warning {
  color: #2f1c00;
  background: linear-gradient(135deg, #ffb24d 0%, #ffd67e 100%);
}

button.danger {
  color: #fff7f8;
  background: linear-gradient(135deg, #f06f87 0%, #ff8aa0 100%);
}

button:disabled {
  opacity: 0.36;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.nav-btn {
  width: 44px;
  justify-content: center;
  padding: 11px 0;
}

.layout {
  display: grid;
  grid-template-columns: minmax(380px, 0.92fr) minmax(560px, 1.45fr);
  gap: 18px;
  min-height: calc(100vh - 150px);
}

.workspace {
  padding: 22px;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.workspace::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.browser-panel {
  background:
    linear-gradient(180deg, rgba(140, 145, 255, 0.08), transparent 15%),
    var(--panel);
}

.editor-panel {
  background:
    linear-gradient(180deg, rgba(132, 244, 223, 0.08), transparent 15%),
    var(--panel);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  z-index: 1;
}

.panel-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(132, 244, 223, 0.12);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.crumb:hover,
.crumb.active {
  color: var(--text);
  background: var(--accent-soft);
  border-color: rgba(132, 244, 223, 0.28);
}

.file-list {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 270px);
  overflow: auto;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: var(--panel-strong);
  position: relative;
  z-index: 1;
}

.file-entry {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 15px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: transparent;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.file-entry:hover,
.file-entry.active {
  background: linear-gradient(90deg, rgba(132, 244, 223, 0.12), rgba(140, 145, 255, 0.08));
}

.file-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(132, 244, 223, 0.16), rgba(140, 145, 255, 0.12));
  color: #e0ebff;
  font-size: 14px;
  font-weight: 800;
}

.file-meta {
  min-width: 0;
}

.file-name {
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.entry-link {
  color: #d5deff;
  font-size: 13px;
  font-weight: 700;
}

.file-entry-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.entry-delete {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  color: #ffeef1;
  background: rgba(255, 127, 157, 0.14);
  border: 1px solid rgba(255, 127, 157, 0.2);
  justify-content: center;
}

.toolbar-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}

.toolbar-line {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: var(--panel-strong);
}

.toolbar-line label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
}

input[type="text"],
input[type="password"],
input[type="file"],
textarea {
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: rgba(6, 10, 19, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

input[type="text"],
input[type="password"],
input[type="file"] {
  padding: 11px 12px;
  border-radius: 12px;
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
  color: var(--muted);
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
  outline: none;
  border-color: rgba(132, 244, 223, 0.28);
  box-shadow: 0 0 0 3px rgba(132, 244, 223, 0.08);
}

textarea {
  min-height: calc(100vh - 405px);
  resize: vertical;
  padding: 16px;
  border-radius: 22px;
  line-height: 1.55;
  position: relative;
  z-index: 1;
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 265px;
  padding: 11px 16px;
  border-radius: 999px;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.status-pill.running {
  color: #dcffeb;
  background: linear-gradient(135deg, rgba(111, 240, 176, 0.22), rgba(132, 244, 223, 0.14));
  border-color: rgba(111, 240, 176, 0.3);
}

.status-pill.stopped {
  color: #ffecef;
  background: linear-gradient(135deg, rgba(255, 127, 157, 0.2), rgba(255, 214, 126, 0.08));
  border-color: rgba(255, 127, 157, 0.28);
}

.status-pill.idle {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.status-pill i {
  font-size: 10px;
}

.status-pill.running i {
  animation: pulse-dot 1s ease-in-out infinite;
}

@keyframes pulse-dot {
  0% { opacity: 0.35; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.12); }
  100% { opacity: 0.35; transform: scale(0.9); }
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1500;
  max-width: 380px;
  padding: 14px 18px;
  border-radius: 18px;
  color: var(--text);
  background: #111821;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 20, 0.72);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  width: min(1200px, calc(100vw - 64px));
  margin: 6vh auto 0;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(132, 244, 223, 0.08), transparent 14%),
    rgba(14, 20, 34, 0.96);
  overflow: hidden;
}

.modal-card-wide {
  width: min(1320px, calc(100vw - 48px));
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.console-output {
  margin: 0;
  height: calc(78vh - 120px);
  overflow: auto;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(132, 244, 223, 0.14);
  background: linear-gradient(180deg, rgba(8, 12, 20, 0.98), rgba(10, 15, 25, 0.98));
  color: #d6f7e4;
  font: 13px/1.55 "Cascadia Code", Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.fastdl-meta {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.fastdl-path {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-weight: 700;
}

.fastdl-upload-line {
  margin-bottom: 0;
}

.fastdl-upload-status {
  margin: 10px 2px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.fastdl-list {
  max-height: calc(78vh - 220px);
  min-height: 420px;
}

.file-list::-webkit-scrollbar,
textarea::-webkit-scrollbar,
.console-output::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.file-list::-webkit-scrollbar-track,
textarea::-webkit-scrollbar-track,
.console-output::-webkit-scrollbar-track {
  background: #111923;
  border-radius: 999px;
}

.file-list::-webkit-scrollbar-thumb,
textarea::-webkit-scrollbar-thumb,
.console-output::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #35516f 0%, #4f7da8 100%);
  border: 2px solid #111923;
  border-radius: 999px;
}

button:disabled {
  opacity: 0.36;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.is-hidden {
  display: none !important;
}

.hidden {
  display: none;
}

.auth-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-shell {
  width: min(560px, 100%);
}

.auth-card {
  padding: 32px;
  border-radius: 30px;
  border: 1px solid var(--line-soft);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  background:
    linear-gradient(135deg, rgba(103, 110, 255, 0.12), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 70%),
    var(--panel);
}

.auth-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.auth-form label {
  display: grid;
  gap: 8px;
}

.auth-form label span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.auth-form button {
  justify-content: center;
  margin-top: 8px;
}

.auth-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

@media (max-width: 1280px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .topbar-right {
    align-items: stretch;
  }
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .toolbar-grid {
    grid-template-columns: 1fr;
  }

  .actions {
    justify-content: stretch;
  }

  .modal-card {
    width: calc(100vw - 24px);
    margin-top: 4vh;
    padding: 16px;
  }

  .console-output {
    height: calc(84vh - 120px);
  }
}
