:root {
  color-scheme: dark;
  --bg: #070a0f;
  --panel: rgba(15, 20, 29, 0.82);
  --panel-strong: rgba(19, 26, 37, 0.96);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #f6f8fb;
  --muted: #98a4b5;
  --accent: #83f7c7;
  --accent-2: #80a7ff;
  --danger: #ff7c85;
  --warning: #ffd479;
  --radius: 20px;
  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;
  background:
    radial-gradient(circle at 12% 8%, rgba(54, 109, 255, 0.2), transparent 32%),
    radial-gradient(circle at 86% 20%, rgba(82, 255, 184, 0.12), transparent 28%),
    var(--bg);
  color: var(--text);
}

button, input { font: inherit; }
button { color: inherit; }

.background-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

.shell {
  position: relative;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 64px 0 80px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  align-items: flex-start;
  margin-bottom: 26px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

h1 {
  margin: 12px 0 8px;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1;
  letter-spacing: -0.05em;
}

.hero p {
  margin: 0;
  max-width: 720px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  color: var(--muted);
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(255,255,255,.05);
}

.status-badge.online { color: var(--accent); }
.status-badge.busy { color: var(--warning); }
.status-badge.offline { color: var(--danger); }

.notice {
  margin-bottom: 18px;
  padding: 13px 16px;
  border: 1px solid rgba(255, 212, 121, 0.22);
  border-radius: 14px;
  background: rgba(255, 212, 121, 0.07);
  color: #e9dec7;
  font-size: 14px;
}

.panel {
  margin-top: 18px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0,0,0,.22);
  backdrop-filter: blur(20px);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.panel-heading > div:first-child {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-index {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.connection-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.field { display: grid; gap: 8px; }
.field span { color: var(--muted); font-size: 13px; }

input {
  width: 100%;
  min-height: 45px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  background: rgba(0,0,0,.22);
  color: var(--text);
  transition: border-color .2s ease, box-shadow .2s ease;
}

input:focus {
  border-color: rgba(131, 247, 199, 0.55);
  box-shadow: 0 0 0 4px rgba(131, 247, 199, 0.08);
}

.button {
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  transition: transform .16s ease, opacity .16s ease, border-color .16s ease, background .16s ease;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: .38; cursor: not-allowed; }
.button.primary { background: var(--accent); color: #07110d; }
.button.secondary { background: var(--accent-2); color: #071020; }
.button.ghost { border-color: var(--border); background: rgba(255,255,255,.04); }
.button.danger { border-color: rgba(255, 124, 133, .28); background: rgba(255, 124, 133, .08); color: #ffb1b7; }
.button.small { min-height: 32px; padding: 0 10px; border-radius: 9px; font-size: 12px; }

.config-summary {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0,0,0,.16);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.config-summary strong { color: var(--text); }
.config-summary .ok { color: var(--accent); }

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

.path-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0,0,0,.18);
  color: var(--muted);
  font-size: 13px;
}

.path-bar code {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.drop-zone {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  margin-bottom: 18px;
  border: 1px dashed rgba(128, 167, 255, .45);
  border-radius: 15px;
  background: rgba(128, 167, 255, .055);
  transition: border-color .2s ease, background .2s ease;
}

.drop-zone.dragging {
  border-color: var(--accent);
  background: rgba(131, 247, 199, .08);
}
.drop-zone.disabled { opacity: .5; }
.drop-zone .button { margin-left: auto; }
.drop-zone strong { display: block; margin-bottom: 4px; }
.drop-zone span { color: var(--muted); font-size: 13px; }
.drop-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: rgba(128, 167, 255, .14);
  color: var(--accent-2);
  font-size: 24px;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
}

table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--border); text-align: left; font-size: 13px; }
th { color: var(--muted); font-weight: 650; background: rgba(255,255,255,.025); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255,255,255,.025); }
.actions-column { width: 190px; }
.file-actions { display: flex; gap: 7px; }
.file-name-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-weight: 650;
  text-align: left;
}
.file-name-button:hover { color: var(--accent); }
.file-icon { width: 22px; text-align: center; }
.type-pill { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: rgba(255,255,255,.055); color: var(--muted); font-size: 11px; }
.empty-row td { padding: 34px; text-align: center; color: var(--muted); }

.log-output {
  min-height: 110px;
  max-height: 280px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #05070b;
  font: 12px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.log-line { color: #aab6c7; }
.log-line.success { color: var(--accent); }
.log-line.error { color: #ff9ca4; }
.log-time { color: #667387; margin-right: 8px; }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100% - 44px));
  padding: 13px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--panel-strong);
  box-shadow: 0 16px 50px rgba(0,0,0,.35);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(255,124,133,.35); }

@media (max-width: 760px) {
  .shell { width: min(100% - 20px, 1180px); padding-top: 32px; }
  .hero, .panel-heading, .explorer-heading { align-items: stretch; flex-direction: column; }
  .connection-grid { grid-template-columns: 1fr; }
  .connection-grid .button { width: 100%; }
  .panel { padding: 18px; }
  .drop-zone { align-items: flex-start; flex-wrap: wrap; }
  .drop-zone .button { width: 100%; margin-left: 0; }
}

.credentials-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}
.credentials-grid .full { grid-column: 1 / -1; }
.cache-badge {
  margin-left: auto;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  color: var(--muted);
}
.upload-progress { margin: -4px 0 18px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: rgba(0,0,0,.16); }
.upload-progress.hidden { display: none; }
.progress-meta { display:flex; justify-content:space-between; gap:16px; margin-bottom:10px; color:var(--muted); font-size:12px; }
.progress-meta strong { color: var(--accent); }
.progress-track { height:8px; overflow:hidden; border-radius:999px; background:rgba(255,255,255,.07); }
.progress-bar { height:100%; width:0; background:linear-gradient(90deg,var(--accent-2),var(--accent)); transition:width .18s ease; }
@media (max-width: 760px) {
  .credentials-grid { grid-template-columns: 1fr; }
  .credentials-grid .full { grid-column: auto; }
  .credentials-grid .button { width:100%; }
}

.server-config-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: stretch;
}
.server-config-card {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0,0,0,.16);
}
.server-config-card strong { color: var(--text); }
.server-config-card small { color: var(--muted); line-height: 1.5; }
.server-config-label { color: var(--muted); font-size: 12px; }
.server-config-grid > .button { align-self: center; min-height: 48px; }
@media (max-width: 760px) {
  .server-config-grid { grid-template-columns: 1fr; }
  .server-config-grid > .button { width: 100%; }
}
