.platform-field {
  position: relative;
}
.platform-field input {
  padding-right: 40px;
}
.platform-preview {
  position: absolute;
  right: 10px;
  top: 7px;
  height: 36px;
  display: flex;
  align-items: center;
  max-width: 130px;
  font-size: 11px;
  color: var(--muted);
  pointer-events: none;
}
.platform-name {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.platform-logo {
  display: block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  object-fit: contain;
}
.platform-logo {
  border-radius: 3px;
}
.dark .platform-logo[src$='/revolut.svg'],
.dark .platform-logo[src$='/okx.svg'] {
  filter: invert(1);
}
th:nth-child(5) {
  width: 15%;
}
th:nth-child(6) {
  width: 15%;
}
@media (max-width: 700px) {
  table {
    min-width: 850px;
  }
}
.platform-options {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  z-index: 10;
  padding: 4px;
  max-height: 210px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-popover);
}
.platform-option {
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  min-height: 36px;
  font-size: 14px;
}
.platform-option:hover,
.platform-option[aria-selected='true'] {
  background: var(--soft);
}
.platform-option .platform-name {
  font-size: 14px;
  max-width: none;
  gap: 10px;
}
.currency-field {
  position: relative;
}
.currency-field input {
  padding-right: 30px;
}
.currency-preview {
  position: absolute;
  right: 9px;
  top: 7px;
  height: 36px;
  display: flex;
  align-items: center;
  pointer-events: none;
}
.currency-logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;
}
.currency-euro {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}
.currency-options {
  left: auto;
  min-width: 240px;
}
.currency-options .platform-option {
  gap: 9px;
  font-size: 14px;
}
.currency-full-name {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}
.ledger {
  position: relative;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.import-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 24px 20px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.import-strip strong {
  font-weight: 500;
  color: var(--text);
}
.ai-import:disabled {
  opacity: 0.5;
  color: var(--muted);
  background: transparent;
  border-style: solid;
  cursor: not-allowed;
}
.coming-soon {
  font-size: 10px;
  color: var(--muted);
  margin-left: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
}
.drop-overlay {
  position: absolute;
  inset: 8px;
  z-index: 5;
  background: var(--surface);
  border: 1px dashed var(--ring);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  pointer-events: none;
}
.drop-overlay > svg {
  width: 32px;
  height: 32px;
  color: var(--muted);
}
.drop-overlay strong {
  font-size: 16px;
  font-weight: 500;
}
.drop-overlay > span {
  font-size: 13px;
  color: var(--muted);
}
.format-label {
  font-size: 14px;
  font-weight: 500;
  margin: 18px 0 9px;
}
.csv-example {
  max-height: 150px;
}
.csv-help {
  font-size: 12px;
  line-height: 1.8;
  color: var(--muted);
  margin-top: 12px;
}
@media (max-width: 700px) {
  .import-strip {
    padding: 0 24px 20px;
    font-size: 12px;
  }
  .ai-import {
    font-size: 11px;
    gap: 5px;
    white-space: normal;
    height: auto;
    min-height: 37px;
    padding: 8px;
  }
  .coming-soon {
    font-size: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 1px 5px;
  }
  .drop-overlay > span {
    max-width: 90%;
    text-align: center;
    line-height: 1.6;
    font-size: 13px;
  }
}
.extra-fields {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.extra-fields summary {
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
  border-radius: var(--radius-sm);
}
.extra-fields label {
  margin-top: 15px;
}
.detail-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.duplicate-badge {
  display: block;
  width: max-content;
  padding: 3px 5px;
  margin-top: 5px;
  border: 1px solid color-mix(in srgb, var(--orange) 35%, transparent);
  border-radius: var(--radius-sm);
  color: var(--orange);
  background: var(--orange-soft);
  font-size: 10px;
}
.duplicate-summary {
  display: block;
  color: var(--orange);
  margin-top: 5px;
  max-width: 230px;
  line-height: 1.6;
}
.details-content {
  padding: 24px;
}
#transaction-details {
  margin: 0;
}
#transaction-details > div {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  font-size: 13px;
}
#transaction-details dt {
  color: var(--muted);
}
#transaction-details dd {
  margin: 0;
  overflow-wrap: anywhere;
  line-height: 1.6;
  white-space: pre-wrap;
}
.duplicate-notice {
  font-size: 12px;
  line-height: 1.7;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--orange-soft);
  color: var(--orange);
  margin-bottom: 12px;
  border: 1px solid color-mix(in srgb, var(--orange) 30%, transparent);
}
@media (max-width: 450px) {
  #transaction-details > div {
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 5px;
    font-size: 13px;
  }
  .detail-form-row {
    grid-template-columns: 1fr;
  }
}
.asset-type-label {
  margin-top: 12px;
}
.asset-type-label select {
  font-size: 14px;
  height: 36px;
}
.asset-type-label select:disabled {
  color: var(--muted);
  background: var(--soft);
  opacity: 1;
}

.table-scroll table {
  min-width: 1120px;
}
.table-scroll th:nth-child(n) {
  width: auto;
}
.table-scroll th:nth-child(2) {
  width: 14%;
}
.table-scroll th:nth-child(3) {
  width: 13%;
}
.table-scroll th:nth-child(4),
.table-scroll th:nth-child(5) {
  width: 15%;
}
.table-scroll th:nth-child(6) {
  width: 9%;
}
.table-scroll th:nth-child(7) {
  width: 12%;
}
.table-scroll th:nth-child(8) {
  width: 11%;
}
.fee-cell,
.price-cell {
  font-variant-numeric: tabular-nums;
}
.missing-value {
  color: var(--muted);
}
#transaction-details .platform-detail {
  font-size: inherit;
  max-width: none;
  white-space: normal;
  overflow: visible;
  vertical-align: middle;
}

/* Shared interaction states and native controls follow the same neutral component theme. */
form input:focus-visible,
form select:focus-visible {
  border-color: var(--ring);
  outline: 3px solid color-mix(in srgb, var(--ring) 50%, transparent);
  outline-offset: 0;
}

form input::placeholder {
  color: var(--muted);
}

form select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2371717a' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.dark form input:not(:read-only),
.dark form select {
  background-color: color-mix(in srgb, var(--soft) 30%, transparent);
}

form select:disabled {
  cursor: not-allowed;
}

form option {
  background: var(--surface);
  color: var(--text);
}

.search:focus-within input {
  outline: none;
  box-shadow: none;
}

.extra-fields summary::-webkit-details-marker {
  display: none;
}

.extra-fields summary::after {
  content: '';
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s;
  margin-right: 4px;
}

.extra-fields[open] > summary::after {
  transform: rotate(225deg);
}

summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--ring) 50%, transparent);
  outline-offset: 2px;
}

#transaction-details > div:last-child {
  border-bottom: 0;
}

.danger:hover {
  background: #b91c1c;
}

.sort-button:hover {
  background: var(--soft);
  color: var(--text);
}

@media (max-width: 700px) {
  .search {
    width: 100%;
  }
  .stat-card {
    padding: 18px 16px;
  }
  .stat-label {
    font-size: 12px;
  }
  .stat-description {
    font-size: 11px;
    flex-wrap: wrap;
  }
  .stat-number {
    font-size: 30px;
  }
  .stat-percent {
    display: none;
  }
  .file-actions {
    align-self: flex-start;
    gap: 8px;
  }
  .file-actions .button {
    height: 32px;
    font-size: 12px;
  }
  .table-tools {
    padding: 0 16px 20px;
  }
  .table-footer {
    padding: 14px 16px;
    gap: 12px;
    flex-wrap: wrap;
  }
  .import-strip {
    padding: 0 16px 20px;
  }
  .ai-import {
    font-size: 12px;
  }
  .dialog-actions {
    flex-direction: column-reverse;
  }
  .dialog-actions > .button {
    width: 100%;
  }

  .toast {
    right: 16px;
    bottom: 16px;
  }
  .privacy-note {
    font-size: 12px;
  }
  footer {
    font-size: 11px;
  }
}

@media (max-width: 450px) {
  #transaction-details > div {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  .form-row {
    grid-template-columns: minmax(0, 1fr) 112px;
  }
  .detail-form-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.danger:focus-visible {
  outline-color: color-mix(in srgb, var(--destructive) 40%, transparent);
}
.platform-options.opens-up {
  top: auto;
  bottom: calc(100% + 5px);
}
