/* Quick Substitutions. Follows the app's ink-on-transparent surfaces, so the
   page reads the same in the light and dark themes: every colour here comes
   from the theme's own ink and background. */
#panel-quick-sub {
  --qs-ink: var(--transparent-content-ink, var(--text));
  --qs-paper: var(--bg);
  --qs-soft: color-mix(in srgb, var(--qs-ink) 9%, transparent);
  --qs-line: color-mix(in srgb, var(--qs-ink) 38%, transparent);
  color: var(--qs-ink);
}
#panel-quick-sub .qs-wrap { max-width: 760px; margin: 0 auto; padding: 4px 0 48px; }
#panel-quick-sub .qs-head h2 { margin: 0 0 4px; font-size: 24px; line-height: 1.2; letter-spacing: -.02em; }
#panel-quick-sub .qs-head-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 4px; }
#panel-quick-sub .qs-head-row h2 { margin: 0; }
#panel-quick-sub .qs-cart { flex: 0 0 auto; white-space: nowrap; }
#panel-quick-sub .qs-buy { font-weight: 800; }
#panel-quick-sub .qs-lead { margin: 0 0 12px; font-size: 15px; line-height: 1.5; }
#panel-quick-sub .qs-umf {
  margin: 0 0 16px; padding: 10px 12px; border-left: 4px solid var(--qs-ink);
  background: var(--qs-soft); border-radius: 0 10px 10px 0; font-size: 14px; line-height: 1.5;
}
#panel-quick-sub .qs-umf-inline { margin: 12px 0; font-size: 13px; }

#panel-quick-sub .qs-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 16px; }
#panel-quick-sub .qs-mode,
#panel-quick-sub .qs-option,
#panel-quick-sub .qs-chip,
#panel-quick-sub .qs-ing,
#panel-quick-sub .qs-suggest-item {
  font: inherit; color: var(--qs-ink); background: transparent; border: 1.5px solid var(--qs-line);
  border-radius: 12px; cursor: pointer; text-align: left;
}
#panel-quick-sub .qs-mode { min-height: 48px; padding: 10px 12px; font-size: 15px; font-weight: 800; text-align: center; }
#panel-quick-sub .qs-mode.is-picked,
#panel-quick-sub .qs-option.is-picked,
#panel-quick-sub .qs-ing.is-picked { border-color: var(--qs-ink); box-shadow: 0 0 0 2px var(--qs-ink); background: var(--qs-soft); }
#panel-quick-sub .qs-mode:hover,
#panel-quick-sub .qs-option:hover,
#panel-quick-sub .qs-chip:hover,
#panel-quick-sub .qs-ing:not(:disabled):hover,
#panel-quick-sub .qs-suggest-item:hover { border-color: var(--qs-ink); background: var(--qs-soft); }
#panel-quick-sub button:focus-visible,
#panel-quick-sub summary:focus-visible { outline: 3px solid var(--qs-ink); outline-offset: 2px; }

#panel-quick-sub .qs-card { margin-bottom: 16px; }
#panel-quick-sub .qs-title { margin: 0 0 10px; font-size: 18px; line-height: 1.3; letter-spacing: -.02em; overflow-wrap: anywhere; }
#panel-quick-sub .qs-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
#panel-quick-sub .qs-text,
#panel-quick-sub .qs-hint,
#panel-quick-sub .qs-empty,
#panel-quick-sub .qs-tip,
#panel-quick-sub .qs-warn,
#panel-quick-sub .qs-error,
#panel-quick-sub .qs-chosen,
#panel-quick-sub .qs-notice { margin: 0 0 10px; font-size: 14px; line-height: 1.5; }
#panel-quick-sub .qs-hint { font-size: 13px; opacity: .82; }
#panel-quick-sub .qs-hint-out { margin: -4px 2px 16px; }
#panel-quick-sub .qs-tip { padding: 8px 10px; background: var(--qs-soft); border-radius: 10px; }
#panel-quick-sub .qs-warn,
#panel-quick-sub .qs-error { padding: 8px 10px; border: 1.5px dashed var(--qs-ink); border-radius: 10px; }
#panel-quick-sub .qs-error { border-style: solid; font-weight: 700; }
#panel-quick-sub .qs-notice,
#panel-quick-sub .qs-done { font-weight: 700; }
#panel-quick-sub .qs-notice { padding: 10px 12px; border: 1.5px solid var(--qs-ink); border-radius: 10px; }
#panel-quick-sub .qs-done { display: inline-flex; align-items: center; min-height: 38px; font-size: 13px; }
#panel-quick-sub p.qs-done { display: block; min-height: 0; margin: 14px 0 10px; font-size: 14px; }
#panel-quick-sub .qs-link {
  font: inherit; font-size: 13px; font-weight: 700; color: var(--qs-ink); background: none; border: 0; padding: 4px 2px;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}

#panel-quick-sub .qs-label { display: block; margin: 0 0 6px; font-size: 13px; font-weight: 700; }
#panel-quick-sub .qs-label-chips { margin-top: 14px; }
#panel-quick-sub .qs-input { display: block; width: 100%; box-sizing: border-box; min-height: 46px; padding: 10px 12px; border-radius: 10px; font-size: 16px; }
#panel-quick-sub .qs-textarea { min-height: 150px; line-height: 1.5; resize: vertical; }
#panel-quick-sub select.qs-input { appearance: auto; }
#panel-quick-sub .qs-chips { display: flex; flex-wrap: wrap; gap: 8px; }
#panel-quick-sub .qs-chip { min-height: 38px; padding: 7px 12px; border-radius: 99px; font-size: 13px; font-weight: 700; }

#panel-quick-sub .qs-suggest-list,
#panel-quick-sub .qs-cands,
#panel-quick-sub .qs-ings,
#panel-quick-sub .qs-changes { list-style: none; margin: 0; padding: 0; }
#panel-quick-sub .qs-suggest-list { margin-top: 8px; display: grid; gap: 6px; }
#panel-quick-sub .qs-suggest-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; width: 100%; min-height: 44px; padding: 9px 12px; font-size: 15px; font-weight: 700; }
#panel-quick-sub .qs-suggest-alias { font-size: 12px; font-weight: 500; opacity: .8; }
#panel-quick-sub #qs-suggest .qs-empty { margin: 8px 0 0; }

#panel-quick-sub .qs-cand { padding: 14px 0; border-top: 1px solid var(--qs-line); }
#panel-quick-sub .qs-cand:first-child { border-top: 0; padding-top: 4px; }
#panel-quick-sub .qs-cand-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 6px; }
#panel-quick-sub .qs-cand-name { font-size: 16px; font-weight: 800; overflow-wrap: anywhere; }
#panel-quick-sub .qs-cand-note,
#panel-quick-sub .qs-cand-swap { margin: 0 0 6px; font-size: 14px; line-height: 1.5; }
#panel-quick-sub .qs-cand-swap-label { font-weight: 800; }
#panel-quick-sub .qs-cand-swap-label::after { content: ':'; }

/* Closeness is told apart by fill and outline, not by colour. */
#panel-quick-sub .qs-badge {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 99px; border: 1.5px solid var(--qs-ink);
  font-size: 11.5px; font-weight: 800; line-height: 1.5; white-space: nowrap;
}
#panel-quick-sub .qs-badge-very { background: var(--qs-ink) !important; color: var(--qs-paper) !important; }
#panel-quick-sub .qs-badge-adjust { border-style: dashed; }
#panel-quick-sub .qs-badge-stock { border-radius: 6px; }
#panel-quick-sub .qs-badge-stock::before { content: '\2713'; margin-right: 4px; }

#panel-quick-sub .qs-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
#panel-quick-sub .qs-next { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--qs-line); }
#panel-quick-sub .qs-next p { margin: 0 0 8px; font-size: 14px; font-weight: 700; }

#panel-quick-sub .qs-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
#panel-quick-sub .qs-option { display: flex; flex-direction: column; gap: 3px; min-height: 64px; padding: 10px 12px; }
#panel-quick-sub .qs-option-label { font-size: 14px; font-weight: 800; line-height: 1.3; }
#panel-quick-sub .qs-option-hint { font-size: 12px; opacity: .8; }

#panel-quick-sub .qs-ings { display: grid; gap: 8px; }
#panel-quick-sub .qs-ing { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 9px 12px; }
#panel-quick-sub .qs-ing:disabled { opacity: .55; cursor: not-allowed; }
#panel-quick-sub .qs-ing-name { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
#panel-quick-sub .qs-ing-name small,
#panel-quick-sub .qs-table small { display: block; font-size: 11.5px; font-weight: 500; opacity: .8; }
#panel-quick-sub .qs-ing-amount { font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
#panel-quick-sub .qs-ing-flag {
  padding: 2px 8px; border-radius: 99px; background: var(--qs-ink) !important; color: var(--qs-paper) !important;
  font-size: 11.5px; font-weight: 800; white-space: nowrap;
}

#panel-quick-sub .qs-amount { margin: 0 0 12px; font-size: 17px; line-height: 1.45; }
#panel-quick-sub .qs-shift { display: grid; gap: 2px; margin: 0 0 12px; padding: 10px 12px; border: 1.5px solid var(--qs-ink); border-radius: 12px; }
#panel-quick-sub .qs-shift-label { font-size: 16px; font-weight: 800; }
#panel-quick-sub .qs-shift-text { font-size: 14px; line-height: 1.5; }
#panel-quick-sub .qs-shift-noticeable { border-width: 2.5px; }
#panel-quick-sub .qs-shift-big { border-width: 4px; }
#panel-quick-sub .qs-shift-unknown { border-style: dashed; }
#panel-quick-sub .qs-rebalance { margin: 0 0 14px; }
#panel-quick-sub .qs-changes { margin: 0 0 10px; display: grid; gap: 4px; font-size: 14px; }
#panel-quick-sub .qs-changes li::before { content: '\2022'; margin-right: 8px; }

#panel-quick-sub .qs-table { width: 100%; border-collapse: collapse; margin: 0 0 12px; font-size: 14px; }
#panel-quick-sub .qs-table th,
#panel-quick-sub .qs-table td { padding: 9px 6px; border-bottom: 1px solid var(--qs-line); text-align: right; font-variant-numeric: tabular-nums; vertical-align: top; }
#panel-quick-sub .qs-table th:first-child { text-align: left; overflow-wrap: anywhere; }
#panel-quick-sub .qs-table tbody th { font-weight: 500; }
#panel-quick-sub .qs-table .is-changed th,
#panel-quick-sub .qs-table .is-changed td { font-weight: 800; background: var(--qs-soft) !important; }
#panel-quick-sub .qs-table .qs-total th,
#panel-quick-sub .qs-table .qs-total td { border-bottom: 0; font-weight: 700; }
#panel-quick-sub .qs-details { margin: 0 0 12px; border: 1.5px solid var(--qs-line); border-radius: 12px; padding: 0 12px; }
#panel-quick-sub .qs-details summary { padding: 12px 0; font-size: 14px; font-weight: 800; cursor: pointer; }
#panel-quick-sub .qs-details[open] summary { border-bottom: 1px solid var(--qs-line); margin-bottom: 10px; }
#panel-quick-sub .qs-details small { display: inline; }

@media (max-width: 600px) {
  #panel-quick-sub .qs-head h2 { font-size: 21px; }
  #panel-quick-sub .qs-options { grid-template-columns: 1fr; }
  #panel-quick-sub .qs-option { min-height: 52px; }
  #panel-quick-sub .qs-actions .btn { flex: 1 1 100%; justify-content: center; min-height: 44px; }
  #panel-quick-sub .qs-table { font-size: 13px; }
  #panel-quick-sub .qs-table th,
  #panel-quick-sub .qs-table td { padding: 8px 4px; }
}

/* Folded cards and small spacing fixes */
#panel-quick-sub .qs-card-chosen .qs-chosen { margin-bottom: 0; }
#panel-quick-sub .qs-units { margin: 8px 0 12px; }
#panel-quick-sub #qs-saved,
#panel-quick-sub #qs-paste,
#panel-quick-sub #qs-link { margin-bottom: 12px; }
#panel-quick-sub .qs-exact { scroll-margin-top: 140px; }
@media (max-width: 600px) { #panel-quick-sub .qs-exact { scroll-margin-top: 180px; } }
