:root {
  --bg: #f4f7f8;
  --panel: #ffffff;
  --ink: #172326;
  --muted: #617074;
  --line: #d9e1e4;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --amber: #b7791f;
  --red: #b42318;
  --green: #157347;
  --console: #101819;
  --console-text: #d6f5e9;
  --shadow: 0 12px 36px rgba(21, 35, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 14px;
}

button:hover {
  background: var(--teal-dark);
}

button.secondary {
  background: #e9f1f2;
  color: var(--ink);
}

button.secondary:hover {
  background: #dfe9eb;
}

button.danger {
  background: #fee4e2;
  color: var(--red);
}

button.danger:hover {
  background: #fecdca;
}

.shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #111c1f;
  color: #eef7f7;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 18px;
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
}

.brand-mark {
  align-items: center;
  background: #d8f3ee;
  border-radius: 8px;
  color: #0d4d49;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.brand small {
  color: #9fb6ba;
  display: block;
  font-size: 12px;
  margin-top: 2px;
}

nav {
  display: grid;
  gap: 6px;
}

nav a {
  border-radius: 8px;
  color: #c9d9dc;
  font-size: 14px;
  font-weight: 650;
  padding: 10px 12px;
  text-decoration: none;
}

nav a.active,
nav a:hover {
  background: #203135;
  color: #fff;
}

.port-pill {
  border: 1px solid #2d464b;
  border-radius: 8px;
  color: #c9d9dc;
  font-size: 13px;
  margin-top: auto;
  padding: 10px 12px;
}

main {
  display: grid;
  gap: 18px;
  padding: 28px;
}

.topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.1;
}

h2 {
  font-size: 16px;
}

p {
  color: var(--muted);
  margin: 7px 0 0;
}

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

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.span-2 {
  grid-column: span 2;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-head span {
  color: var(--muted);
  font-size: 13px;
}

.server-list {
  display: grid;
  gap: 10px;
}

.server-row {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: 1.2fr 1fr 1fr auto;
  padding: 12px;
}

.server-row strong {
  display: block;
}

.server-row small {
  color: var(--muted);
}

.empty {
  color: var(--muted);
  padding: 16px 0;
}

.status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 9px;
}

.status.success {
  background: #dcfae6;
  color: var(--green);
}

.status.failed,
.status.copy_failed,
.status.checksum_failed {
  background: #fee4e2;
  color: var(--red);
}

.status.running {
  background: #fff1c2;
  color: var(--amber);
}

.status.idle {
  background: #edf2f4;
  color: #475467;
}

.stat {
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 13px 0;
}

.stat span {
  color: var(--muted);
}

.transfer-progress {
  border-top: 1px solid var(--line);
  margin-bottom: 14px;
  padding-top: 14px;
}

.progress-meta,
.progress-details {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.progress-meta {
  font-size: 13px;
  margin-bottom: 8px;
}

.progress-meta span {
  color: var(--teal);
  font-weight: 800;
}

.progress-track {
  background: #e5edef;
  border-radius: 5px;
  height: 10px;
  overflow: hidden;
  width: 100%;
}

.progress-track span {
  background: var(--teal);
  display: block;
  height: 100%;
  transition: width 240ms ease;
  width: 0;
}

.progress-track.indeterminate span {
  animation: progress-indeterminate 1.4s ease-in-out infinite;
  width: 35%;
}

.progress-details {
  color: var(--muted);
  font-size: 12px;
  justify-content: flex-start;
  margin-top: 7px;
  min-height: 18px;
}

@keyframes progress-indeterminate {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(310%);
  }
}

.console {
  background: var(--console);
  border-radius: 8px;
  color: var(--console-text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.65;
  margin: 0;
  max-height: 420px;
  min-height: 320px;
  overflow: auto;
  padding: 16px;
  white-space: pre-wrap;
}

form {
  display: grid;
  gap: 12px;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 700;
  gap: 6px;
}

input,
select {
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 40px;
  padding: 9px 10px;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
  outline: none;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.server-form {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.wide-field {
  grid-column: span 2;
}

.form-actions {
  align-items: end;
  display: flex;
  gap: 10px;
}

.table-wrap {
  overflow: auto;
}

table {
  border-collapse: collapse;
  font-size: 13px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

td code {
  color: var(--muted);
  font-size: 12px;
}

.toast {
  background: #111c1f;
  border-radius: 8px;
  bottom: 20px;
  color: white;
  opacity: 0;
  padding: 12px 14px;
  pointer-events: none;
  position: fixed;
  right: 20px;
  transform: translateY(8px);
  transition: 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

  .sidebar {
    flex-direction: row;
    flex-wrap: wrap;
  }

  nav {
    display: flex;
    flex-wrap: wrap;
  }

  .port-pill {
    margin-left: auto;
    margin-top: 0;
  }

  .grid,
  .server-form {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .wide-field {
    grid-column: span 1;
  }

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

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }
}
