:root {
  color: #1c2733;
  background: #f2f5f8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: radial-gradient(circle at top left, rgba(34, 144, 255, .12), transparent 34rem), #f2f5f8;
}
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.shell { width: min(1080px, calc(100% - 32px)); margin: 0 auto; padding: 36px 0 64px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.brand-mark { display: grid; width: 44px; height: 44px; place-items: center; color: #fff; background: #1684e8; border-radius: 12px; font-size: 22px; font-weight: 800; box-shadow: 0 8px 24px rgba(22,132,232,.25); }
h1, h2, p { margin: 0; }
.brand h1 { font-size: 19px; }
.brand p, .help { margin-top: 3px; color: #708090; font-size: 13px; }
.card { background: rgba(255,255,255,.97); border: 1px solid #dfe6ed; border-radius: 18px; box-shadow: 0 18px 55px rgba(45,66,86,.08); }
.compact { width: min(440px, 100%); margin: 8vh auto 0; padding: 32px; }
.compact h2 { margin-top: 5px; }
.eyebrow { color: #1684e8; font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
h2 { font-size: clamp(21px, 3vw, 28px); letter-spacing: -.02em; }
.form-stack { display: grid; gap: 18px; margin-top: 26px; }
label { display: grid; gap: 8px; color: #465564; font-size: 13px; font-weight: 650; }
input { width: 100%; padding: 11px 13px; color: #1c2733; background: #fff; border: 1px solid #cfd9e2; border-radius: 10px; outline: none; }
input:focus { border-color: #1684e8; box-shadow: 0 0 0 3px rgba(22,132,232,.13); }
button { padding: 10px 16px; border: 0; border-radius: 10px; font-weight: 720; }
button:disabled { cursor: not-allowed; opacity: .5; }
.primary { color: #fff; background: #1684e8; }
.primary:hover:not(:disabled) { background: #0874d3; }
.ghost { color: #405162; background: #eaf0f5; }
.danger { color: #b42318; background: #feeceb; }
.help { margin-top: 18px; line-height: 1.6; text-align: center; }
.pending-icon { margin-bottom: 12px; font-size: 38px; text-align: center; }
#pending-view > p { margin-top: 12px; color: #607080; line-height: 1.6; }
.device-summary { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 22px 0; padding: 16px; background: #f4f7f9; border-radius: 12px; }
.device-summary dt { color: #718191; }
.device-summary dd { margin: 0; font-weight: 700; }
.button-row, .account-actions, .section-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.workspace { display: grid; gap: 20px; }
.topbar, .peers-card, .send-card, .transfers-card { padding: 22px; }
.account-actions { justify-content: flex-end; color: #607080; font-size: 14px; }
.status { display: inline-flex; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.status.online, .status.p2p { color: #067647; background: #e8f7ef; }
.status.offline { color: #607080; background: #edf1f4; }
.status.relay { color: #9a6700; background: #fff4ce; }
.status.connecting { color: #125f9f; background: #e5f2ff; }
.topology-help { margin-top: 6px; color: #718191; font-size: 13px; }
.device-topology {
  position: relative;
  width: min(100%, 760px);
  height: 410px;
  margin: 18px auto 0;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(22,132,232,.15) 0, rgba(22,132,232,.06) 24%, transparent 52%),
    radial-gradient(circle, rgba(129,151,170,.22) 1px, transparent 1.5px);
  background-size: auto, 24px 24px;
  border: 1px solid #e1e8ee;
  border-radius: 16px;
}
#device-links { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#device-links line { stroke: #b7c8d6; stroke-width: 2; stroke-dasharray: 7 8; transition: stroke .2s ease, stroke-width .2s ease; }
#device-links line.selected { stroke: #1684e8; stroke-width: 4; stroke-dasharray: none; }
#device-links marker path { fill: context-stroke; }
.topology-nodes { position: absolute; inset: 0; }
.topology-node {
  position: absolute;
  display: grid;
  width: 150px;
  justify-items: center;
  gap: 5px;
  padding: 10px 8px;
  color: #263746;
  background: transparent;
  border: 0;
  border-radius: 14px;
  text-align: center;
  transform: translate(-50%, -50%);
  z-index: 2;
}
button.topology-node:hover, button.topology-node.selected { background: rgba(255,255,255,.92); box-shadow: 0 8px 26px rgba(42,72,98,.14); }
.topology-node strong { display: block; max-width: 138px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.topology-node small { color: #6f8190; font-size: 11px; font-weight: 550; }
.device-node-icon {
  position: relative;
  display: block;
  width: 54px;
  height: 54px;
  background: #e9f4fd;
  border: 1px solid #b9daf6;
  border-radius: 50%;
  box-shadow: 0 6px 18px rgba(22,132,232,.12);
}
.device-node-icon::before {
  position: absolute;
  top: 14px;
  left: 12px;
  width: 28px;
  height: 19px;
  content: "";
  border: 2px solid #1684e8;
  border-radius: 3px;
}
.device-node-icon::after {
  position: absolute;
  top: 36px;
  left: 19px;
  width: 16px;
  height: 2px;
  content: "";
  background: #1684e8;
  box-shadow: 0 -4px 0 -0.5px #1684e8;
}
.device-node-icon.mobile::before { top: 11px; left: 18px; width: 18px; height: 30px; border-radius: 4px; }
.device-node-icon.mobile::after { top: 36px; left: 25px; width: 4px; height: 2px; box-shadow: none; border-radius: 99px; }
.current-device-node { width: 170px; }
.current-device-node::before, .current-device-node::after {
  position: absolute;
  inset: 2px 60px auto;
  width: 50px;
  height: 50px;
  content: "";
  border: 1px solid rgba(22,132,232,.32);
  border-radius: 50%;
  animation: topology-pulse 2.8s ease-out infinite;
  z-index: -1;
}
.current-device-node::after { animation-delay: 1.4s; }
.current-device-node .device-node-icon { color: #fff; background: #1684e8; border-color: #1684e8; box-shadow: 0 9px 28px rgba(22,132,232,.3); }
.current-device-node .device-node-icon::before { border-color: #fff; }
.current-device-node .device-node-icon::after { background: #fff; box-shadow: 0 -4px 0 -0.5px #fff; }
.current-device-node .device-node-icon.mobile::after { box-shadow: none; }
.current-device-node small { color: #1684e8; font-weight: 700; }
.remote-device-node.selected .device-node-icon { background: #dcf6e9; border-color: #74cea0; }
.remote-device-node.selected .device-node-icon::before { border-color: #07864b; }
.remote-device-node.selected .device-node-icon::after { background: #07864b; box-shadow: 0 -4px 0 -0.5px #07864b; }
.remote-device-node.selected .device-node-icon.mobile::after { box-shadow: none; }
.topology-empty { position: absolute; right: 0; bottom: 22px; left: 0; color: #718191; font-size: 13px; text-align: center; }
@keyframes topology-pulse {
  from { opacity: .8; transform: scale(1); }
  to { opacity: 0; transform: scale(2.25); }
}
.drop-zone { display: grid; place-items: center; gap: 7px; min-height: 145px; margin-top: 18px; padding: 24px; text-align: center; border: 2px dashed #bfd0df; border-radius: 14px; background: #f8fafc; }
.drop-zone.dragging { border-color: #1684e8; background: #edf7ff; }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-zone span { color: #718191; font-size: 12px; font-weight: 500; }
.selected-files { display: grid; gap: 6px; margin: 12px 0; }
.selected-file { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; background: #f4f7f9; border-radius: 9px; font-size: 13px; }
.wide { width: 100%; }
.transfer-list { display: grid; gap: 12px; margin-top: 18px; }
.transfer-item { padding: 15px; border: 1px solid #e2e8ee; border-radius: 12px; }
.transfer-head, .transfer-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.transfer-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transfer-meta { margin-top: 5px; color: #718191; font-size: 12px; }
.progress { height: 7px; margin: 12px 0 8px; overflow: hidden; background: #e8edf2; border-radius: 99px; }
.progress span { display: block; width: 0; height: 100%; background: #1684e8; transition: width .2s ease; }
.transfer-foot { color: #607080; font-size: 12px; }
.incoming-actions { display: flex; gap: 8px; margin-top: 12px; }
.empty { padding: 22px; color: #718191; text-align: center; }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: min(420px, calc(100% - 40px)); padding: 13px 16px; color: #fff; background: #213244; border-radius: 11px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.toast.error { background: #b42318; }
@media (max-width: 650px) {
  .shell { width: min(100% - 20px, 1080px); padding-top: 18px; }
  .compact { padding: 24px; }
  .topbar, .section-header, .account-actions { align-items: flex-start; flex-direction: column; }
  .account-actions { width: 100%; }
  .account-actions button { width: 100%; }
  .device-topology { height: 370px; }
  .topology-node { width: 112px; padding: 7px 4px; }
  .topology-node strong { max-width: 106px; font-size: 12px; }
  .device-node-icon { width: 48px; height: 48px; }
  .device-node-icon::before { top: 12px; left: 10px; }
  .device-node-icon::after { top: 34px; left: 17px; }
  .device-node-icon.mobile::before { top: 9px; left: 15px; }
  .device-node-icon.mobile::after { top: 34px; left: 22px; }
  .current-device-node { width: 130px; }
  .current-device-node::before, .current-device-node::after { inset: 0 41px auto; width: 48px; height: 48px; }
}
@media (prefers-color-scheme: dark) {
  :root { color: #eef4fa; background: #11161c; }
  body { background: radial-gradient(circle at top left, rgba(22,132,232,.16), transparent 34rem), #11161c; }
  .card { background: #171d24; border-color: #2a3540; }
  .brand p, .help, #pending-view > p, .account-actions, .transfer-meta, .transfer-foot { color: #9baaba; }
  input { color: #eef4fa; background: #11171d; border-color: #3a4652; }
  label { color: #bec9d3; }
  .ghost, .status.offline { color: #cfdae4; background: #2a3540; }
  .device-topology { border-color: #34414d; background: radial-gradient(circle at center, rgba(22,132,232,.17) 0, rgba(22,132,232,.06) 26%, transparent 54%), radial-gradient(circle, rgba(126,149,169,.2) 1px, transparent 1.5px); background-size: auto, 24px 24px; }
  .topology-node, button.topology-node:hover, button.topology-node.selected { color: #eaf1f7; }
  button.topology-node:hover, button.topology-node.selected { background: rgba(30,39,48,.94); }
  .topology-help, .topology-node small, .topology-empty { color: #9baaba; }
  #device-links line { stroke: #485968; }
  #device-links line.selected { stroke: #43a6ff; }
  .drop-zone { color: #eaf1f7; background: #1b232b; border-color: #34414d; }
  .selected-file, .device-summary { background: #202a33; }
  .transfer-item { border-color: #34414d; }
  .progress { background: #34414d; }
}
