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

/* —— Toolbar / inputs —— */
.apc-panel {
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 12px 14px;
  min-width: 0;
}

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

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

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

.apc-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);
}

.apc-field input,
.apc-field select,
.apc-field .peps-input,
.apc-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;
  vertical-align: middle;
  appearance: none;
  -webkit-appearance: none;
}

.apc-field select,
.apc-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;
}

.apc-field input[type="date"] {
  line-height: normal;
  display: flex;
  align-items: center;
}

.apc-field input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0.7;
  cursor: pointer;
}

.apc-field-symbol,
.apc-field-quote {
  max-width: none;
}

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

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

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

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

.apc-summary.has-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.apc-summary-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

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

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

.apc-summary.is-overview {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.apc-overview-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
}

.apc-overview-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.apc-overview-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  text-align: left;
  border-radius: 8px;
  border: 1px solid var(--border-muted);
  background: var(--bg-subtle);
  color: inherit;
  font: inherit;
}

.apc-overview-top {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 22px;
}

.apc-overview-symbol {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  min-width: 0;
  white-space: nowrap;
}

.apc-overview-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.apc-overview-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px 12px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  width: 100%;
  min-width: 0;
}

.apc-overview-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  align-self: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(88, 166, 255, 0.35);
  border-radius: 8px;
  background: rgba(88, 166, 255, 0.12);
  color: #79b8ff;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.apc-overview-add:hover {
  background: rgba(88, 166, 255, 0.22);
  border-color: rgba(88, 166, 255, 0.55);
  color: #a5d0ff;
}

.apc-overview-add.is-remove {
  border-color: rgba(248, 81, 73, 0.4);
  background: rgba(248, 81, 73, 0.12);
  color: #f85149;
}

.apc-overview-add.is-remove:hover {
  background: rgba(248, 81, 73, 0.22);
  border-color: rgba(248, 81, 73, 0.6);
  color: #ff7b72;
}

.apc-overview-add-ico {
  display: block;
  flex-shrink: 0;
}

.apc-overview-stats .apc-stat strong {
  font-size: 15px;
}

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

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

.apc-stat.is-up strong {
  color: #3fb950;
}

.apc-stat.is-down strong {
  color: #f85149;
}

/* —— History —— */
.apc-history {
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 12px 14px;
}

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

.apc-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.apc-trade .apc-stat strong {
  font-size: 15px;
}

.apc-trade-type .apc-side {
  display: inline-block;
  vertical-align: middle;
}

.apc-trade-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.apc-trade-actions strong {
  font-weight: 400;
}

.apc-side {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
}

.apc-side.is-buy {
  color: #3fb950;
  background: rgba(63, 185, 80, 0.12);
}

.apc-side.is-sell {
  color: #f85149;
  background: rgba(248, 81, 73, 0.12);
}

.apc-side.is-in {
  color: #58a6ff;
  background: rgba(88, 166, 255, 0.12);
}

.apc-side.is-out {
  color: #d2a8ff;
  background: rgba(210, 168, 255, 0.12);
}

.apc-trade button {
  font-size: 12px;
}

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

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

.apc-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);
}

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

.apc-tool .tf-guide-box summary::-webkit-details-marker {
  display: none;
}

.apc-tool .tf-guide-content {
  margin-top: 12px;
}

.apc-tool .tf-guide-intro {
  margin: 0 0 14px;
  line-height: 1.55;
  max-width: 90ch;
  opacity: 0.92;
}

.apc-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);
}

.apc-tool .tf-guide-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.55;
}

.apc-tool .tf-guide-list li + li {
  margin-top: 6px;
}

.apc-tool .tf-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  max-width: 920px;
}

.apc-tool .tf-guide-block {
  min-width: 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--bg-subtle);
  border: 1px solid var(--border-muted);
}

.apc-tool .tf-guide-list-consider li::marker {
  color: var(--accent-emphasis);
}

.apc-tool .tf-guide-content--summary .tf-guide-more {
  margin-top: 14px;
  max-width: 920px;
}

@media (max-width: 900px) {
  .apc-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .apc-summary,
  .apc-summary-stats,
  .apc-overview-stats,
  .apc-trade {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .apc-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .apc-meta {
    margin-left: 0;
    width: 100%;
    white-space: normal;
  }

  .apc-toolbar-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .apc-actions {
    width: 100%;
  }

  .apc-actions .peps-btn {
    flex: 1 1 auto;
  }

  .apc-summary,
  .apc-summary-stats,
  .apc-overview-stats,
  .apc-trade {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .apc-trade-actions {
    align-items: flex-start;
  }

  .apc-tool .tf-guide-grid {
    grid-template-columns: 1fr;
  }
}
