.money-summary .portfolio-total {
  grid-column: 1 / -1;
}

.money-summary .portfolio-total strong {
  font-size: clamp(24px, 7vw, 34px);
}

.money-summary .portfolio-total small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.35;
}

.purchase-lock {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f5f7f6;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.exit-status.is-checking i {
  background: #e6a144;
  box-shadow: 0 0 0 4px rgba(230, 161, 68, .12);
}

.exit-status.is-error i {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(196, 81, 81, .12);
}

.operation-costs {
  margin-top: 12px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.4;
}

.operation-verification {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 8px;
}

.operation-verification span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operation-management {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.operation-management summary {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.management-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.management-actions button,
.management-actions select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f7faf8;
  color: var(--ink);
  font-size: 10px;
  font-weight: 800;
}

.management-actions label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 8px;
}

.management-actions select { padding: 0 9px; }
.management-actions .danger-button {
  grid-column: 1 / -1;
  color: var(--red);
  background: #fff7f7;
  border-color: #efd0d0;
}
.management-actions #resolve-manually { grid-column: 1 / -1; }
.management-actions small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.4;
}

.history-card {
  margin-top: 12px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
}

.history-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  list-style: none;
  cursor: pointer;
}

.history-card summary::-webkit-details-marker { display: none; }
.history-card summary span { font-size: 11px; font-weight: 800; }
.history-card summary strong { color: var(--muted); font-size: 9px; }
.history-list { display: grid; margin-top: 12px; border-top: 1px solid var(--line); }
.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.history-item:last-child { border-bottom: 0; }
.history-item strong { font-size: 11px; }
.history-item b { color: var(--green); font-size: 11px; text-align: right; }
.history-item small { color: var(--muted); font-size: 8px; }
.history-empty { padding: 14px 0 2px; color: var(--muted); font-size: 9px; text-align: center; }
.history-open {
  width: 100%;
  min-height: 42px;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}

#history-dialog[open] { align-items: stretch; }
.history-sheet {
  width: min(100%, 620px);
  height: 100%;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px calc(24px + env(safe-area-inset-bottom));
  overflow-y: auto;
  background: var(--paper);
}
.history-sheet-head { position: sticky; top: -18px; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 18px 0 14px; background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(12px); }
.history-sheet-head small { color: var(--green); font-size: 8px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.history-sheet-head h2 { margin: 4px 0 0; font-size: 23px; }
.history-sheet-head button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: var(--card); color: var(--ink); font-size: 24px; cursor: pointer; }
.history-complete-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 5px 0 12px; }
.history-complete-metrics article { padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.history-complete-metrics small { display: block; margin-bottom: 6px; color: var(--muted); font-size: 8px; }
.history-complete-metrics strong { font-size: 15px; }
.history-filter-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 9px; }
.history-filter-row label { color: var(--muted); font-size: 9px; font-weight: 800; }
.history-filter-row select { min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); color: var(--ink); font-size: 9px; font-weight: 800; }
.history-complete-list { display: grid; gap: 8px; }
.history-detail { border: 1px solid var(--line); border-radius: 15px; background: var(--card); overflow: hidden; }
.history-detail > summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; list-style: none; cursor: pointer; }
.history-detail > summary::-webkit-details-marker { display: none; }
.history-detail > summary span { display: grid; gap: 4px; }
.history-detail > summary strong { font-size: 12px; }
.history-detail > summary small { color: var(--muted); font-size: 8px; }
.history-detail > summary b { font-size: 13px; }
.history-detail[open] > summary { border-bottom: 1px solid var(--line); }
.history-detail-body { display: grid; gap: 13px; padding: 14px; }
.history-data-section h3 { margin: 0 0 7px; color: var(--green); font-size: 8px; letter-spacing: .1em; text-transform: uppercase; }
.history-data-section dl { display: grid; grid-template-columns: 1fr 1fr; margin: 0; border-top: 1px solid var(--line); }
.history-data-section dl > div { min-width: 0; padding: 9px 0; border-bottom: 1px solid var(--line); }
.history-data-section dl > div:nth-child(odd) { padding-right: 9px; border-right: 1px solid var(--line); }
.history-data-section dl > div:nth-child(even) { padding-left: 9px; }
.history-data-section dt { color: var(--muted); font-size: 8px; }
.history-data-section dd { margin: 4px 0 0; overflow-wrap: anywhere; font-size: 10px; font-weight: 800; }
.history-data-technical dd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8px; }
.history-tax-note { margin: 14px 3px 0; color: var(--muted); font-size: 8px; line-height: 1.5; text-align: center; }

.preview-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 14px 0 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  text-align: left;
  overflow: hidden;
}
.preview-breakdown > div { padding: 9px 10px; border-bottom: 1px solid var(--line); }
.preview-breakdown > div:nth-child(odd) { border-right: 1px solid var(--line); }
.preview-breakdown > div:nth-last-child(-n + 2) { border-bottom: 0; }
.preview-breakdown .preview-net { grid-column: 1 / -1; border-right: 0; }
.preview-breakdown dt { color: var(--muted); font-size: 8px; }
.preview-breakdown dd { margin: 4px 0 0; font-size: 10px; font-weight: 800; }
.confirm-sheet .preview-fee-note { margin: 0 0 13px; font-size: 8px; line-height: 1.4; }

.chart-period {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 9px;
  background: #edf3f0;
}
.chart-period button {
  min-width: 34px;
  min-height: 27px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
}
.chart-period button.is-selected { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(16, 41, 39, .08); }
.chart-target-zone { fill: rgba(201, 246, 93, .15); }
.chart-current-line { stroke: #7b8d88; stroke-width: 1; stroke-dasharray: 2 4; }
.chart-current-dot { fill: #fff; stroke: var(--ink); stroke-width: 2; }

@media (max-width: 370px) {
  .history-card { padding: 14px; }
}
