:root {
  --bg: #141517;
  --surface: #1c1e22;
  --surface-2: #24262c;
  --border: #2c2e35;
  --border-hover: #3e414b;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --green: #10b981;
  --red: #ef4444;
  --amber: #f59e0b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 56px;
  background: #18191c;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
  white-space: nowrap;
}
.brand-badge {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}
.brand-sub {
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.storage-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--muted);
}
.storage-bar {
  width: 54px;
  height: 6px;
  background: #2b2d35;
  border-radius: 99px;
  overflow: hidden;
}
.storage-bar > span {
  display: block;
  height: 100%;
  background: var(--blue);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-hover); }
.btn-secondary { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: #2f323a; border-color: var(--border-hover); }
.btn-danger { background: rgba(239, 68, 68, 0.14); border-color: rgba(239, 68, 68, 0.3); color: #fca5a5; }
.btn-danger:hover:not(:disabled) { background: rgba(239, 68, 68, 0.25); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-cta {
  background: #dc2626;
  color: #fff;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
}
.btn-cta:hover { background: #b91c1c; }

/* Layout */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 18px 64px;
}
.center-wrap {
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px;
}
.login-card {
  width: 100%;
  max-width: 400px;
}
.public-card {
  width: 100%;
  max-width: 640px;
}

/* Forms */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 5px;
}
.input, .textarea, .select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 11px;
  font-size: 14px;
  color: var(--text);
  outline: none;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--blue); }
.textarea { resize: vertical; min-height: 70px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--blue); }

/* Tabs */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}
.tab {
  padding: 7px 14px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.tab.active { background: var(--surface-2); color: #fff; }
.tab:hover:not(.active) { color: var(--text); }

/* Dropzone */
.dropzone {
  border: 2px dashed #3a3d47;
  border-radius: 10px;
  padding: 28px 18px;
  text-align: center;
  background: rgba(255, 255, 255, 0.015);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 14px;
}
.dropzone.dragover {
  border-color: var(--blue);
  background: rgba(37, 99, 235, 0.08);
}
.dropzone-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.dropzone-sub { font-size: 12px; color: var(--muted); }

/* Queued / File Rows */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
}
.file-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Progress */
.progress-wrap {
  margin: 12px 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.progress-bar {
  height: 7px;
  background: #2b2d35;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 6px;
}
.progress-bar > span {
  display: block;
  height: 100%;
  background: var(--blue);
  transition: width 0.12s linear;
}

/* Transfer Cards */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 26px 0 14px;
  flex-wrap: wrap;
}
.transfer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
}
.t-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.t-card:hover { border-color: var(--border-hover); }
.t-title { font-size: 15px; font-weight: 600; word-break: break-word; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
}
.badge-blue { background: rgba(37, 99, 235, 0.2); color: #93c5fd; }
.badge-green { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; }
.badge-amber { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }
.badge-red { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  color: #93c5fd;
}
.link-box span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  user-select: all;
}
.t-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal {
  width: 100%;
  max-width: 620px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 60;
  background: #2b2d33;
  border: 1px solid #3d404a;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error-text { color: #fca5a5; font-size: 13px; margin-top: 6px; }

@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .storage-pill, .brand-sub { display: none; }
  .topbar { padding: 0 12px; }
  .container { padding: 16px 12px 48px; }
}
