:root {
  color-scheme: dark;
  --bg: #101418;
  --surface: #181f26;
  --surface-2: #202934;
  --line: #33404e;
  --text: #ecf3f7;
  --muted: #96a7b6;
  --blue: #4da3ff;
  --green: #36c275;
  --red: #ff5d5d;
  --yellow: #f4b942;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(77, 163, 255, 0.12), transparent 36%),
    linear-gradient(315deg, rgba(54, 194, 117, 0.10), transparent 34%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

code,
kbd,
pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(16, 20, 24, 0.82);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-actions form {
  margin: 0;
}

a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.7rem, 3vw, 2.7rem);
  letter-spacing: 0;
}

h2 {
  font-size: 1.05rem;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.dashboard-grid,
.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.split-grid {
  margin-top: 18px;
  align-items: start;
}

.split-grid > .panel:last-child {
  grid-column: 1 / -1;
}

.panel {
  background: rgba(24, 31, 38, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

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

.panel-head p {
  color: var(--muted);
  margin-top: 4px;
}

.status-list {
  display: grid;
  gap: 12px;
}

.status-list > div {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.status-list > div:last-child {
  border-bottom: 0;
}

.status-list span,
.hint-card dt {
  color: var(--muted);
}

.status-list code {
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.84rem;
}

.badge-ok {
  color: #062814;
  background: var(--green);
}

.badge-danger {
  color: #330909;
  background: var(--red);
}

.badge-muted {
  color: var(--text);
  background: var(--surface-2);
}

.hint-card dl {
  display: grid;
  gap: 14px;
  margin: 0;
}

.hint-card div {
  display: grid;
  gap: 4px;
}

.hint-card dd {
  margin: 0;
  line-height: 1.55;
}

.scan-copy {
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 18px;
}

.feature-list,
.flow-steps,
.tool-grid {
  display: grid;
  gap: 10px;
}

.feature-list a,
.flow-steps div,
.tool-tile {
  display: grid;
  gap: 5px;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text);
  background: rgba(11, 15, 19, 0.42);
  text-decoration: none;
}

.feature-list a:hover {
  border-color: rgba(77, 163, 255, 0.55);
}

.tool-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tool-tile:hover {
  border-color: rgba(77, 163, 255, 0.55);
}

.feature-list span,
.flow-steps span,
.tool-tile span {
  color: var(--muted);
  line-height: 1.45;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
  align-items: end;
}

.form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

.form-grid input[type="file"],
.form-grid input[type="number"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--text);
  background: #111820;
}

.flow-steps {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.flow-steps strong {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  color: #061322;
  background: var(--blue);
}

kbd {
  border: 1px solid var(--line);
  border-bottom-width: 3px;
  border-radius: 5px;
  padding: 1px 7px;
  background: var(--surface-2);
}

.message-area {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.transfer-panel {
  margin-top: 18px;
}

.transfer-list,
.transfer-history {
  display: grid;
  gap: 10px;
}

.transfer-history-head {
  margin: 18px 0 10px;
}

.transfer-card,
.empty-transfer {
  border-radius: 8px;
  padding: 14px;
  background: rgba(11, 15, 19, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.transfer-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.transfer-card-top strong,
.transfer-card-top span {
  display: block;
}

.transfer-card-top div span {
  color: var(--muted);
  margin-top: 4px;
}

.progress-wrap {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  margin: 14px 0 8px;
  background: #0b0f13;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: width 0.25s ease;
}

.transfer-failed .progress-bar {
  background: var(--red);
}

.transfer-success .progress-bar {
  background: var(--green);
}

.transfer-meta,
.empty-transfer {
  color: var(--muted);
  line-height: 1.45;
}

.alert {
  border-radius: 8px;
  padding: 13px 15px;
  line-height: 1.45;
}

.alert-success {
  color: #d9ffe8;
  background: rgba(54, 194, 117, 0.16);
  border: 1px solid rgba(54, 194, 117, 0.42);
}

.alert-danger {
  color: #ffe5e5;
  background: rgba(255, 93, 93, 0.15);
  border: 1px solid rgba(255, 93, 93, 0.45);
}

.alert-warning {
  color: #fff0cf;
  background: rgba(244, 185, 66, 0.15);
  border: 1px solid rgba(244, 185, 66, 0.44);
  margin-bottom: 16px;
}

.hidden {
  display: none !important;
}

.files-panel {
  margin-top: 18px;
}

.active-file-box {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 16px;
  padding: 13px 15px;
  border-radius: 8px;
  color: #d9ffe8;
  background: rgba(54, 194, 117, 0.13);
  border: 1px solid rgba(54, 194, 117, 0.35);
}

.active-file-box span {
  color: var(--muted);
}

.upload-zone {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 98px;
  padding: 18px;
  border: 1px dashed rgba(77, 163, 255, 0.62);
  border-radius: 8px;
  background: rgba(77, 163, 255, 0.08);
  margin-bottom: 18px;
}

.upload-zone.drag-over {
  border-color: var(--green);
  background: rgba(54, 194, 117, 0.12);
}

.upload-zone span {
  display: block;
  color: var(--muted);
  margin-top: 6px;
}

.inline-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 150px;
}

.inline-field span {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.inline-field input {
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.inline-field select {
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  background: rgba(18, 28, 45, 0.96);
}

.hint-box {
  margin: -4px 0 18px;
  padding: 12px 14px;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  line-height: 1.55;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.filter-search {
  flex: 1 1 260px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.file-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.active-pill {
  display: inline-flex;
  color: #062814;
  background: var(--green);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
}

.scan-badge {
  min-height: 24px;
  margin-left: 7px;
  font-size: 0.74rem;
}

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

.url-cell code {
  display: block;
  max-width: 520px;
  overflow-wrap: anywhere;
}

.empty-row {
  color: var(--muted);
  text-align: center;
}

.button,
.icon-button {
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.14s ease, filter 0.14s ease, background 0.14s ease;
}

.button:hover,
.icon-button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.button:disabled,
.icon-button:disabled {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

.button {
  min-height: 40px;
  padding: 9px 14px;
}

.button-primary {
  color: #061322;
  background: var(--blue);
}

.button-secondary {
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.button-ghost {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
}

.button-ok {
  color: #062814;
  background: var(--green);
}

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

.button-small {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.86rem;
}

.icon-button {
  width: 38px;
  height: 38px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 1.15rem;
}

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

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.log-output {
  min-height: 330px;
  max-height: 520px;
  overflow: auto;
  white-space: pre-wrap;
  margin: 16px 0 0;
  padding: 16px;
  background: #0b0f13;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #d5e3ec;
  line-height: 1.45;
}

.free-panel {
  margin-top: 18px;
}

.free-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: #0b0f13;
}

.free-ip,
.free-placeholder {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 7px;
  padding: 5px 9px;
}

.free-ip {
  color: #d9ffe8;
  background: rgba(54, 194, 117, 0.13);
  border: 1px solid rgba(54, 194, 117, 0.26);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
}

.free-placeholder {
  color: var(--muted);
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(420px, 100%);
}

.login-panel {
  background: rgba(24, 31, 38, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 30px;
  box-shadow: var(--shadow);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 22px;
  border-radius: 8px;
  color: #061322;
  background: linear-gradient(135deg, var(--blue), var(--green));
  font-weight: 900;
}

.login-panel h1 {
  font-size: 2rem;
}

.login-panel p {
  color: var(--muted);
  margin: 8px 0 22px;
  line-height: 1.5;
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label {
  color: var(--muted);
  font-size: 0.92rem;
}

.login-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 12px;
  color: var(--text);
  background: #111820;
  outline: none;
}

.login-form input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(77, 163, 255, 0.18);
}

.login-form button {
  margin-top: 8px;
}

@media (max-width: 880px) {
  .dashboard-grid,
  .split-grid,
  .flow-steps,
  .tool-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .upload-zone {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .status-list > div {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
