/* Settings page (#/settings/...). Everything is scoped under .setp. Built from the shared pieces in style.css
   (.btn, .input, .seg, .switch, .subtabs, kbd): this file only lays them out. */
.setp { height: 100%; overflow-y: auto; background: var(--bg); }
.setp-in { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; max-width: 1120px; margin: 0 auto; padding: 24px 24px 64px; align-items: start; }
.setp-side { position: sticky; top: 24px; display: grid; gap: 8px; min-width: 0; }
.setp-side-h { margin: 0; padding: 0 10px; color: var(--muted); font: 500 11px/1.2 var(--sans); letter-spacing: .04em; text-transform: uppercase; }
/* the section list is a sidebar here and the shared .subtabs row (with .hfade) on a phone, so these rules stop at 761 px */
@media (min-width: 761px) {
  .setp-nav { display: grid; gap: 2px; overflow: visible; background: none; }
  .setp-nav a { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 6px; color: var(--muted); font: 500 13.5px/1 var(--sans); }
  .setp-nav a svg { flex: none; color: var(--dim); transition: color .12s; }
  .setp-nav a:hover { color: var(--fg); background: var(--hover); }
  .setp-nav a:hover svg { color: var(--fg-2); }
  .setp-nav a.on { color: var(--fg); background: var(--fill); }
  .setp-nav a.on svg { color: var(--accent); }
  .setp-nav a.on::after { display: none; }
}
.setp-body { display: grid; gap: 16px; min-width: 0; }
.setp-body h1 { margin: 0; font: 600 22px/1.2 var(--sans); letter-spacing: -.01em; }
.setp-lede { margin: -8px 0 4px; color: var(--muted); font-size: 13px; line-height: 1.55; max-width: 76ch; }

/* a card: one bordered panel with a 46 px title bar */
.setp-card { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--panel); min-width: 0; }
.setp-card > h2 { display: flex; align-items: center; gap: 8px; height: 46px; margin: -16px -16px 2px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--fg); font: 500 14px/1 var(--sans); }
.setp-card.danger { border-color: color-mix(in srgb, var(--down) 28%, var(--line)); }
.setp-card.danger > h2 { color: var(--down); border-bottom-color: color-mix(in srgb, var(--down) 20%, var(--line)); }
.setp-note { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.55; max-width: 84ch; }
.setp .setp-note.warn { padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--warn) 28%, transparent); border-radius: 6px; background: color-mix(in srgb, var(--warn) 7%, transparent); color: var(--fg-2); }
.setp-mini { margin: 0; color: var(--dim); font-size: 12px; line-height: 1.45; }
.setp-msg { margin: 0; min-height: 1em; color: var(--muted); font-size: 12px; }
.setp-msg:empty { display: none; }
.setp-err { margin: 0; color: var(--down); font-size: 12px; }
.setp-fmsg { color: var(--down); font-size: 11.5px; }
.setp-fmsg:empty { display: none; }
.setp-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.setp-acts:empty { display: none; }
.setp-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: var(--pill); background: var(--fill); color: var(--fg-2); font: 500 11px/1 var(--sans); white-space: nowrap; vertical-align: 1px; }
.setp-tag.up { color: var(--up); background: color-mix(in srgb, var(--up) 13%, transparent); }
.setp-tag.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 13%, transparent); }
.setp .warn { color: var(--warn); }

/* key/value tiles: the value on top, its label under it */
.setp-grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.setp-kv { display: grid; gap: 6px; align-content: center; justify-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); text-align: center; min-width: 0; }
.setp-kv > span { order: 2; color: var(--muted); font: 400 12px/1.3 var(--sans); }
.setp-kv b { font: 500 16px/1.2 var(--mono); }
.setp-line { margin: 0; color: var(--muted); font-size: 12.5px; }
.setp-wallet { display: grid; gap: 10px; }
.setp-wid { display: flex; align-items: center; gap: 8px; }
.setp-wid b { font-size: 16px; font-weight: 600; }
.setp-addr { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; flex-wrap: wrap; }
.setp-wallet .setp-kv { width: max-content; min-width: 180px; justify-items: start; text-align: left; }
.setp-list { margin: 0; padding: 0; list-style: none; display: grid; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.setp-list li { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 8px 12px; font-size: 12.5px; min-width: 0; }
.setp-list li + li { border-top: 1px solid var(--line); }
.setp-list li b { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setp-list.plain li { flex-wrap: wrap; gap: 4px 12px; }
.setp-list.plain li b { min-width: 110px; }

/* fields: a grey label over an .input */
.setp-field { display: grid; gap: 6px; min-width: 0; }
.setp-field > span { color: var(--muted); font-size: 12px; font-weight: 500; }
.setp-field > span em { font-style: normal; color: var(--dim); font-weight: 400; margin-left: 4px; }
.setp-field > .seg { justify-self: start; }
.setp input[type="file"] { font: 12px var(--sans); color: var(--muted); max-width: 100%; }
.setp input[type="file"]::file-selector-button { height: 30px; margin-right: 10px; padding: 0 14px; border: 0; border-radius: var(--pill); background: var(--fill); color: var(--fg); font: 600 12px var(--sans); cursor: pointer; }
.setp input[type="file"]::file-selector-button:hover { background: var(--fill-2); }
.setp-check { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; line-height: 18px; cursor: pointer; }
.setp-check input { flex: none; margin: 0; }
.setp-check input:not(.switch) { width: 16px; height: 16px; margin-top: 1px; }
.setp-check .setp-mini { display: block; margin-top: 2px; }
/* a switch row: the text on the left, the switch on the right, rows split by thin lines */
.setp-toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; font-size: 13px; line-height: 18px; cursor: pointer; }
.setp-toggle + .setp-toggle { border-top: 1px solid var(--line-soft); }
.setp-toggle .setp-mini { display: block; margin-top: 3px; }
.setp-card > h2 + .setp-toggle { margin-top: -6px; }
.setp-card > .setp-toggle:last-child { margin-bottom: -6px; }
.setp .seg button small { opacity: .75; font-size: 10.5px; }
.setp-inline { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.setp-inline .grow, .setp-alert-form .grow { flex: 1 1 260px; }

/* presets */
.setp-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.setp-preset { align-content: start; gap: 14px; }
.setp-preset.on { border-color: var(--sel-line); box-shadow: 0 0 0 1px var(--sel-line); }
.setp-phead { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 46px; margin: -16px -16px 0; padding: 0 12px 0 10px; border-bottom: 1px solid var(--line); }
.setp-pname input { width: 110px; height: 30px; min-width: 0; padding: 0 6px; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--fg); font: 600 15px/1 var(--sans); outline: 0; }
.setp-pname input:hover { border-color: var(--line); }
.setp-pname input:focus { border-color: var(--accent); background: var(--panel-2); }
.setp-preset .setp-field .input { width: 100%; }
/* option rows fill the card in equal columns (.seg-fill, style.css), up to a comfortable width on wide single cards */
.setp-preset .seg-fill { max-width: 560px; }

/* display: theme cards with a mini preview drawn from that theme's colours (--sb bg, --sp panel, --sl line, --sf text,
   --sm muted text, --sa accent, set inline by settings.js) */
.setp-themes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.setp-theme { position: relative; display: grid; gap: 10px; padding: 8px 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--panel); cursor: pointer; transition: border-color .12s; }
.setp-theme:hover { border-color: var(--line-2); }
.setp-theme.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.setp-theme input, .setp-acc input { position: absolute; opacity: 0; pointer-events: none; }
.setp-theme:has(input:focus-visible), .setp-acc:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.setp-theme .sw { position: relative; display: block; height: 64px; border: 1px solid var(--sl); border-radius: 6px; background: var(--sb); overflow: hidden; }
.setp-theme .sw i { position: absolute; display: block; }
.setp-theme .sw i:nth-child(1) { inset: 10px 10px -1px; border: 1px solid var(--sl); border-radius: 4px 4px 0 0; background: var(--sp); }
.setp-theme .sw i:nth-child(2) { top: 22px; left: 20px; width: 34%; height: 5px; border-radius: 3px; background: var(--sf); box-shadow: 0 11px 0 var(--sm); }
.setp-theme .sw i:nth-child(3) { top: 20px; right: 20px; width: 28px; height: 12px; border-radius: 6px; background: var(--sa); }
.setp-theme b { padding: 0 2px; font-weight: 500; font-size: 13px; }
.setp-accents { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.setp-acc { position: relative; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); cursor: pointer; transition: border-color .12s; }
.setp-acc:hover { border-color: var(--line-2); }
.setp-acc i { width: 20px; height: 20px; border-radius: 50%; }
.setp-acc.on { border-color: var(--fg); box-shadow: 0 0 0 1px var(--fg); }
.setp-acc.def { display: inline-flex; gap: 7px; width: auto; padding: 0 12px 0 4px; border-radius: var(--pill); color: var(--fg-2); font-size: 12.5px; font-weight: 500; }
.setp-custom { display: inline-flex; align-items: center; gap: 8px; height: 30px; margin-left: 4px; padding: 0 4px 0 12px; border: 1px solid var(--line); border-radius: var(--pill); color: var(--fg-2); font-size: 12.5px; font-weight: 500; cursor: pointer; }
.setp-custom input[type="color"] { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; overflow: hidden; }
.setp-custom input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.setp-custom input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.setp-custom input[type="color"]::-moz-color-swatch { border: 0; border-radius: 50%; }
.setp-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); font-size: 12.5px; }
.setp-pv-l { color: var(--dim); font: 500 11px/1 var(--sans); letter-spacing: .04em; text-transform: uppercase; }
.setp-preview .seg { flex-wrap: nowrap; }

/* tables (hotkeys, alerts): wide ones scroll inside their own box */
.setp-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
/* a table that is the card's main content runs edge to edge instead of drawing a box inside the box */
.setp-scroll.flush { margin: -16px -16px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: var(--radius-md) var(--radius-md) 0 0; }
.setp-scroll.flush .setp-table th:first-child, .setp-scroll.flush .setp-table td:first-child { padding-left: 16px; }
.setp-scroll.flush .setp-table th:last-child, .setp-scroll.flush .setp-table td:last-child { padding-right: 16px; }
.setp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.setp-table th { height: 40px; padding: 0 12px; text-align: left; border-bottom: 1px solid var(--line); color: var(--muted); font: 400 12px/1 var(--sans); white-space: nowrap; }
.setp-table td { height: 44px; padding: 6px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; white-space: nowrap; }
.setp-table tbody tr:hover td { background: var(--hover); }
.setp-table tr:last-child td { border-bottom: 0; }
.setp-table td.r { text-align: right; }
.setp-table td:first-child { white-space: normal; min-width: 110px; }
.setp-table td.r .btn + .btn { margin-left: 4px; }
.setp-table td a { color: var(--accent); }
.setp-table .keys { display: inline-flex; align-items: center; gap: 4px; }
.setp-table kbd { min-width: 22px; height: 22px; color: var(--fg); font-size: 11.5px; }

/* alerts */
.setp-range { display: grid; grid-template-columns: auto minmax(120px, 280px) 48px; justify-content: start; align-items: center; gap: 14px; font-size: 13px; }
.setp-sounds { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px; }
.setp-sound { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 6px 8px 6px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.setp-sound .setp-check { align-items: center; }
/* one row: token | watch | condition | value | add, every label on the same line and every control 36 px */
.setp-alert-form { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto 140px auto; align-items: end; gap: 8px; }
.setp-alert-form .setp-field .input { width: 100%; }
.setp-alert-form .seg { flex-wrap: nowrap; }
.setp-alert-form .seg button { height: calc(var(--h-lg) - 6px); }

/* network */
.setp-rpcs { display: grid; gap: 6px; }
.setp-rpc { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; min-height: 52px; padding: 8px 10px 8px 12px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; transition: border-color .12s, background-color .12s; }
.setp-rpc:hover { border-color: var(--line-2); background: var(--hover); }
.setp-rpc.on { border-color: var(--sel-line); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.setp-rpc input { margin: 0; }
.setp-rpc .t { display: grid; gap: 4px; min-width: 0; }
.setp-rpc .t b { font-weight: 500; font-size: 13px; }
.setp-rpc .t span { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setp-rpc .res { font-size: 12px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* data */
.setp-preview-box { display: grid; gap: 10px; padding: 12px 14px; border: 1px solid var(--sel-line); border-radius: var(--radius-md); background: color-mix(in srgb, var(--accent) 5%, var(--panel)); font-size: 12.5px; line-height: 1.5; min-width: 0; }
.setp-preview-box p { margin: 0; overflow-wrap: anywhere; }
.setp-preview-box .setp-mini.warn { color: var(--warn); }
.setp-diff { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); border-radius: 6px; background: color-mix(in srgb, var(--warn) 5%, transparent); min-width: 0; }
.setp-diff h3 { margin: 0; color: var(--warn); font: 500 11px/1 var(--sans); text-transform: uppercase; letter-spacing: .04em; }
.setp-diff .setp-scroll { background: var(--panel); }
.setp-table td.setp-new { color: var(--fg); font-weight: 600; }
.setp-wipe { display: grid; gap: 12px; max-width: 460px; }

@media (max-width: 1080px) { .setp-presets { grid-template-columns: 1fr; } .setp-preset { grid-template-columns: minmax(0, 1fr); } }
/* the alert form's single row needs about 760 px of card: below that, the address takes its own line */
@media (max-width: 1100px) {
  .setp-alert-form { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
  .setp-alert-form > .grow { grid-column: 1 / -1; }
  .setp-alert-form .seg { width: auto; }
  .setp-alert-form .seg button { flex: 1; min-width: 0; padding: 0 4px; white-space: nowrap; }
  .setp-alert-form .setp-field > .seg { justify-self: stretch; }
}
@media (max-width: 760px) {
  .setp-in { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 0 12px 40px; }
  .setp-side { position: sticky; top: 0; z-index: 2; margin: 0 -12px; padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--bg); }
  .setp-side-h { display: none; }
  .setp-nav { --hf: var(--bg); }
  .setp-nav a svg { display: none; }
  .setp-body h1 { font-size: 20px; }
  .setp-card { padding: 12px; }
  .setp-card > h2 { height: 42px; margin: -12px -12px 2px; padding: 0 12px; }
  .setp-phead { margin: -12px -12px 0; height: 44px; }
  .setp-scroll.flush { margin: -12px -12px 0; }
  .setp-scroll.flush .setp-table th:first-child, .setp-scroll.flush .setp-table td:first-child { padding-left: 12px; }
  .setp-scroll.flush .setp-table th:last-child, .setp-scroll.flush .setp-table td:last-child { padding-right: 12px; }
  .setp-themes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .setp-range { grid-template-columns: minmax(0, 1fr) 48px; }
  .setp-range span { grid-column: 1 / -1; }
  .setp-rpc { grid-template-columns: auto minmax(0, 1fr) auto; }
  .setp-rpc .res { grid-column: 2 / 3; grid-row: 2; }
  .setp-wallet .setp-kv { width: auto; }
  .setp-sounds { grid-template-columns: 1fr; }
  .setp-table th, .setp-table td { padding-left: 8px; padding-right: 8px; }
  .setp-table .setp-tag { display: none; }
}
