/* Settings credential fields rhythm. */

/*
   A label belongs to the control beneath it, so each pair stays tight and
   the readable gap goes between one field and the next. Remember toggles
   are part of their password field: drop the nested card and line the box
   up with the input above and the status text below. */
#settings-dialog .set-panels section > label:not(.sync-check) {
  margin-bottom: -0.45rem;
}
#settings-dialog .set-panels :is(.sync-field-group, .sync-feature-settings) {
  row-gap: 0.3rem;
}
#settings-dialog .set-panels :is(.sync-field-group, .sync-feature-settings) > label:not(.sync-check) {
  margin: 0.85rem 0 0;
}
#settings-dialog .set-panels :is(.sync-field-group, .sync-feature-settings) > label:not(.sync-check):first-child {
  margin-top: 0;
}
#settings-dialog .set-panels :is(.sync-field-group, .sync-feature-settings) > input,
#settings-dialog .set-panels :is(.sync-field-group, .sync-feature-settings) > select {
  margin: 0;
}
#settings-dialog .set-panels :is(.sync-field-group, .sync-feature-settings) > label.sync-check {
  min-height: 0;
  margin: 0.35rem 0 0;
  padding: 0.15rem 0 0.15rem 0.1rem;
  border: 0;
  border-radius: 0;
  background: none;
  gap: 0.5rem;
}
/* Help markers keep one uniform 0.5rem gap, matching the Cloud provider row,
   whether the text is a field label, a checkbox row or a panel title. */
#settings-dialog .set-panels label .info-pill,
#settings-dialog .set-panels .set-heading .info-pill {
  margin-left: 0 !important;
}
#settings-dialog .set-panels label.sync-check,
#settings-dialog .set-panels .set-heading {
  gap: 0.5rem;
}

/* "Encrypted backup" is a span rather than a label, so it needs the same
   explicit 0.5rem gap instead of the pill's inline margin. */
#settings-dialog .set-panels #s-enc-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
#settings-dialog .set-panels #s-enc-label .info-pill {
  margin-left: 0 !important;
}

/* Price history belongs to the same cloud setup, so it follows the credential
   card model: one bordered card, a plain remember row and flush fields
   instead of a second nested card with its own chrome. */
#settings-dialog .set-panels .sync-feature-group {
  gap: 0.3rem;
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.018);
}
#settings-dialog .set-panels .sync-feature-group > .sync-subheading {
  margin: 0 0 0.15rem;
}
#settings-dialog .set-panels .sync-feature-group > label.sync-check {
  min-height: 0;
  margin: 0.35rem 0 0;
  padding: 0.15rem 0 0.15rem 0.1rem;
  border: 0;
  border-radius: 0;
  background: none;
  gap: 0.5rem;
}
#settings-dialog .set-panels .sync-feature-settings {
  gap: 0.3rem;
  margin: 0.15rem 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}
/* Credential cards nested inside a provider block (WebDAV password, MEGA
   secret key) sat flush against the field above them because those blocks
   have no gap of their own. Give the card the same readable gap that
   separates any other field from the one before it. */
#settings-dialog .set-panels :is(#sy-g-webdav, #sy-g-megas3, #pd-g-webdav, #pd-g-megas3) > .sync-field-group {
  margin: 0.9rem 0 0;
}
#settings-dialog .set-panels #pd-status {
  margin: 0.35rem 0 0;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius);
  font-size: 0.76rem;
}

/* Idle portfolio history has no download status, so the load panel had
   nothing to show but still reserved its heading height and margins. Collapse
   it only while the live status is empty; loading and error copy still show. */
.history-load-panel:has(> .history-load-heading > .history-load-status:empty) {
  display: none;
}

/* Encrypted backup restore uses the same Browse file design as Backups:
   a dashed rounded drop box with a pill button, not a plain text input. */
#sy-enc-upload-label {
  display: block;
  margin: 0.7rem 0 0;
  color: #b7b7bc;
  font-size: 0.76rem;
  font-weight: 550;
  letter-spacing: 0;
}
#sy-enc-upload {
  width: 100%;
  min-height: 3rem;
  padding: 0.45rem;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  pointer-events: none;
  cursor: default;
}
#sy-enc-upload::file-selector-button,
#sy-enc-upload::-webkit-file-upload-button {
  min-height: 2.15rem;
  margin-right: 0.7rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
}

/* Keep the collapsed Details row vertically balanced: its top and bottom
   insets match. The larger safe inset belongs only to the expanded form, so
   it never shifts the summary's resting position. */
#trade-form details.adv {
  padding-bottom: 0.4rem;
}
#trade-form details.adv[open] {
  padding-bottom: 0.9rem;
}
