.ptf-tool {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 4px;
}

.ptf-panel {
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 12px 14px;
  min-width: 0;
}

.ptf-panel-head h2 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
}

.ptf-sync-panel {
  padding-top: 10px;
  padding-bottom: 10px;
}

.ptf-sync-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
}

.ptf-sync-select-wrap {
  min-width: 220px;
  flex: 1 1 220px;
}

.ptf-sync-msg {
  width: 100%;
  margin: 0;
  font-size: 12px;
}

.ptf-sync-msg.is-success { color: #3fb950; }
.ptf-sync-msg.is-error { color: #f85149; }

.ptf-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ptf-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: start;
}

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

.ptf-field > span {
  display: block;
  height: 14px;
  line-height: 14px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-subtle);
}

.ptf-field input,
.ptf-field select,
.ptf-field .peps-input,
.ptf-field .peps-select {
  width: 100%;
  min-width: 0;
  height: 34px;
  box-sizing: border-box;
  margin: 0;
  padding: 0 10px;
  border-radius: var(--radius, 6px);
  border: 1px solid var(--border-default);
  background: var(--bg-subtle);
  color: var(--fg-default);
  font: inherit;
  font-size: 13px;
  line-height: 32px;
  appearance: none;
  -webkit-appearance: none;
}

.ptf-field select,
.ptf-field .peps-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M3 4.5L6 8l3-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.ptf-toolbar-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding-top: 2px;
  border-top: 1px solid var(--border-muted);
}

.ptf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.ptf-meta {
  margin-left: auto;
  font-size: 12px;
  color: var(--fg-muted);
  white-space: nowrap;
}

.ptf-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-default);
  background: var(--bg-canvas);
}

.ptf-summary.is-empty {
  display: block;
  color: var(--fg-muted);
  font-size: 13px;
  line-height: 1.5;
}

.ptf-stat span {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.ptf-stat strong {
  display: block;
  font-size: 17px;
  font-weight: 600;
  color: var(--fg-default);
  font-variant-numeric: tabular-nums;
}

.ptf-stat em {
  display: block;
  margin-top: 4px;
  font-style: normal;
  font-size: 12px;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

.ptf-stat.is-up strong { color: #3fb950; }
.ptf-stat.is-down strong { color: #f85149; }

.ptf-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.8fr);
  gap: 12px;
  align-items: start;
}

.ptf-holdings {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ptf-row {
  display: grid;
  grid-template-columns: 36px repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-muted);
  background: var(--bg-subtle);
  font-size: 13px;
}

.ptf-row .ptf-stat strong {
  font-size: 15px;
}

.ptf-row-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
}

.ptf-row-sym strong {
  letter-spacing: 0.04em;
}

.ptf-coin-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
}

.ptf-coin-icon-wrap.is-sm {
  width: 18px;
  height: 18px;
  flex-basis: 18px;
}

.ptf-coin-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: var(--bg-subtle);
}

.ptf-coin-icon-wrap.is-sm .ptf-coin-icon {
  width: 18px;
  height: 18px;
}

.ptf-ex-icon {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  object-fit: cover;
  flex: 0 0 14px;
  background: var(--bg-subtle);
}

.ptf-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ptf-row-source {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #79b8ff;
  opacity: 0.9;
  white-space: nowrap;
}

.ptf-row-source span {
  display: inline;
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
}

.ptf-empty {
  color: var(--fg-muted);
  font-size: 13px;
  line-height: 1.5;
  padding: 4px 0;
}

.ptf-alloc {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ptf-alloc-bar-wrap {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-subtle);
  border: 1px solid var(--border-muted);
}

.ptf-alloc-seg {
  height: 100%;
  min-width: 0;
}

.ptf-alloc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ptf-alloc-item {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.ptf-alloc-item .ptf-coin-icon-wrap {
  width: 18px;
  height: 18px;
  flex-basis: 18px;
}

.ptf-alloc-item strong {
  font-variant-numeric: tabular-nums;
  color: var(--fg-muted);
}

/* Guide */
.ptf-tool > .tf-guide-box { margin-top: 2px; }

.ptf-tool .tf-guide-box {
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  border-left: 3px solid var(--accent-emphasis);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--fg-muted);
}

.ptf-tool .tf-guide-box summary {
  cursor: pointer;
  color: var(--fg-default);
  font-weight: 600;
  font-size: 13px;
  list-style: none;
}

.ptf-tool .tf-guide-box summary::-webkit-details-marker { display: none; }
.ptf-tool .tf-guide-content { margin-top: 12px; }
.ptf-tool .tf-guide-intro {
  margin: 0 0 14px;
  line-height: 1.55;
  max-width: 90ch;
  opacity: 0.92;
}
.ptf-tool .tf-guide-heading {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--fg-default);
}
.ptf-tool .tf-guide-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.55;
}
.ptf-tool .tf-guide-list li + li { margin-top: 6px; }
.ptf-tool .tf-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  max-width: 920px;
}
.ptf-tool .tf-guide-block {
  min-width: 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--bg-subtle);
  border: 1px solid var(--border-muted);
}
.ptf-tool .tf-guide-list-consider li::marker { color: var(--accent-emphasis); }
.ptf-tool .tf-guide-content--summary .tf-guide-more {
  margin-top: 14px;
  max-width: 920px;
}

@media (max-width: 900px) {
  .ptf-layout { grid-template-columns: 1fr; }
  .ptf-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ptf-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ptf-row {
    grid-template-columns: 36px repeat(2, minmax(0, 1fr));
  }
  .ptf-row-icon {
    grid-row: 1 / span 2;
  }
}

@media (max-width: 640px) {
  .ptf-fields { grid-template-columns: 1fr 1fr; }
  .ptf-meta { margin-left: 0; width: 100%; white-space: normal; }
  .ptf-toolbar-footer { flex-direction: column; align-items: stretch; }
  .ptf-summary {
    grid-template-columns: 1fr;
  }
  .ptf-row {
    grid-template-columns: 36px 1fr;
  }
  .ptf-row-icon {
    grid-row: 1 / span 4;
  }
  .ptf-tool .tf-guide-grid { grid-template-columns: 1fr; }
}
