/* Orbit account settings and connection management. */
.settings-work { width: 100%; max-width: none; margin: 0; padding: 28px clamp(22px, 2.5vw, 40px) 64px; }
.settings-pagehead { min-height: 76px; align-items: center; margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.settings-pagehead h1 { font-size: clamp(29px, 2.2vw, 36px); font-weight: 620; }
.settings-pagehead .lead { max-width: 680px; font-size: 14px; }
.settings-layout { min-width: 0; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(28px, 3vw, 44px); align-items: start; }
.settings-directory { position: sticky; top: 76px; z-index: 8; min-width: 0; display: grid; gap: 18px; }
.settings-nav { display: grid; gap: 5px; }
.settings-nav a { position: relative; min-height: 46px; display: flex; align-items: center; justify-content: flex-start; padding: 0 16px; border-radius: 0 8px 8px 0; color: var(--muted); font-size: 13px; font-weight: 520; }
.settings-nav a::before { content: ''; position: absolute; inset: 8px auto 8px 0; width: 3px; border-radius: 0 3px 3px 0; background: transparent; }
.settings-nav a:hover { background: color-mix(in oklch, var(--surface) 62%, transparent); color: var(--fg); }
.settings-nav a[aria-current='true'] { background: var(--fg-soft); color: var(--fg); font-weight: 610; }
.settings-nav a[aria-current='true']::before { background: var(--accent); }
.settings-stack { min-width: 0; display: grid; gap: 24px; }
.settings-panel { display: block; scroll-margin-top: 104px; overflow: clip; }
.settings-panel > .panel-head { min-height: 72px; align-items: center; padding: 18px 22px; border-right: 0; border-bottom: 1px solid var(--border); background: var(--surface); }
.settings-panel > .panel-head h2 { font-size: 18px; }
.settings-panel > .panel-head p { max-width: 72ch; margin: 5px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.settings-panel > .panel-head .pill { margin-top: 0; }
.settings-panel-body { min-width: 0; background: var(--surface); }
.settings-form { padding: 24px; border-bottom: 1px solid var(--border); }
#profile .settings-form { border-bottom: 0; }
.settings-work .field,
.connection-dialog .field {
  position: static;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  touch-action: auto;
}
.settings-work .field > span,
.connection-dialog .field > span {
  display: block;
  color: var(--fg);
  font-size: 11.5px;
  font-weight: 540;
  line-height: 1.25;
}
.settings-work :is(.input, .textarea, .select),
.connection-dialog :is(.input, .textarea, .select) {
  box-sizing: border-box;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid color-mix(in oklch, var(--border) 84%, var(--fg) 16%);
  border-radius: 7px;
  background: color-mix(in oklch, var(--surface-2) 78%, var(--surface));
  color: var(--fg);
  font-size: 13px;
  line-height: 1.35;
  box-shadow: inset 0 1px 0 color-mix(in oklch, var(--fg) 4%, transparent);
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.settings-work :is(.input, .textarea, .select):hover:not(:disabled),
.connection-dialog :is(.input, .textarea, .select):hover:not(:disabled) {
  border-color: color-mix(in oklch, var(--muted) 58%, var(--border));
  background: var(--surface-2);
}
.settings-work :is(.input, .textarea, .select):focus,
.connection-dialog :is(.input, .textarea, .select):focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.settings-work :is(.input, .textarea)::placeholder,
.connection-dialog :is(.input, .textarea)::placeholder { color: color-mix(in oklch, var(--muted) 76%, transparent); }
.settings-work :is(.input, .textarea, .select):disabled {
  border-color: var(--border);
  background: color-mix(in oklch, var(--surface-2) 56%, var(--bg));
  color: var(--muted);
  -webkit-text-fill-color: var(--muted);
  opacity: 1;
  cursor: not-allowed;
}
.settings-work .textarea,
.connection-dialog .textarea {
  min-height: 96px;
  padding-block: 12px;
  resize: vertical;
}
.profile-avatar-row { display: grid; grid-template-columns: 66px minmax(0, 1fr); gap: 14px; align-items: center; margin-bottom: 18px; }
.profile-avatar { position: relative; width: 64px; height: 64px; overflow: hidden; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 50%; background: var(--surface-2); color: var(--fg); font: 620 16px/1 var(--font-mono); appearance: none; }
.profile-avatar:hover { border-color: var(--accent); }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-row strong { display: block; font-size: 12px; font-weight: 600; }
.profile-avatar-row p { margin: 3px 0 8px; color: var(--muted); font-size: 10.5px; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; row-gap: 17px; }
.form-grid .field small { margin-top: -1px; color: var(--muted); font-size: 9.5px; line-height: 1.45; }
.form-span { grid-column: 1 / -1; }
.textarea-compact { min-height: 96px; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 14px; }
.form-feedback { margin: 10px 0 0; color: var(--yes); font-size: 11px; }
.form-feedback.is-error { color: var(--no); }
.password-rules { margin: 10px 0 0; color: var(--muted); font-size: 10.5px; }
.notification-groups { display: grid; }
.notification-group + .notification-group { border-top: 1px solid var(--border); }
.notification-group h3 { margin: 0; padding: 18px 20px 11px; font-size: 14px; font-weight: 600; }
.notification-head, .notification-row { display: grid; grid-template-columns: minmax(0, 1fr) 76px 76px 76px; gap: 4px; align-items: center; padding-inline: 20px; }
.notification-head { min-height: 32px; color: var(--muted); font: 500 10px/1 var(--font-mono); text-align: center; text-transform: uppercase; letter-spacing: .035em; }
.notification-head span:first-child { text-align: left; }
.notification-row { min-height: 68px; border-top: 1px solid var(--border); }
.notification-row > span:first-child { display: grid; gap: 5px; }
.notification-row b { font-size: 13px; font-weight: 570; line-height: 1.25; }
.notification-row small { color: var(--muted); font-size: 11px; line-height: 1.35; }
.notification-row .switch { justify-self: center; }
.notification-footer { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 18px; align-items: end; padding: 16px 18px; border-top: 1px solid var(--border); background: var(--surface-2); }
.notification-footer p { margin: 0 0 10px; color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.preference-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.preference-card { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 12px; align-items: center; padding: 14px 16px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.preference-card:nth-child(2n) { border-right: 0; }
.preference-card:nth-last-child(-n+2) { border-bottom: 0; }
.preference-card > span { display: grid; gap: 3px; }
.preference-card b { font-size: 11px; font-weight: 570; }
.preference-card small { color: var(--muted); font-size: 9px; }
.preference-card .select { min-width: 0; font-size: 11px; }

.connection-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 28px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.connection-summary > div { min-width: 0; display: grid; gap: 7px; padding: 22px 24px; border-right: 1px solid var(--border); }
.connection-summary > div:last-child { border-right: 0; }
.connection-summary span { color: var(--muted); font: 500 9px/1 var(--font-mono); text-transform: uppercase; }
.connection-summary strong { font-family: var(--font-mono); font-size: 28px; font-weight: 600; }
.connection-summary small { color: var(--muted); font-size: 11px; }
.connection-summary .health-good { color: var(--yes); font-family: var(--font-body); font-size: 22px; }
.connection-tabs { display: inline-flex; gap: 2px; margin-bottom: 26px; padding: 4px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.connection-tabs button { min-height: 40px; display: inline-flex; align-items: center; gap: 8px; padding: 7px 16px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-size: 13px; font-weight: 540; appearance: none; }
.connection-tabs button span { min-width: 18px; padding: 2px 5px; border-radius: 9px; background: var(--border); color: var(--muted); font: 550 8px/1 var(--font-mono); }
.connection-tabs button[aria-selected='true'] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px var(--fg-soft); }
.connection-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.connection-view[hidden] { display: none !important; }
.section-heading { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; font-size: 18px; font-weight: 620; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.connection-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
.connection-card { min-width: 0; display: flex; flex-direction: column; min-height: 308px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.connection-provider { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 20px; border-bottom: 1px solid var(--border); }
.provider-mark { width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); font: 620 16px/1 var(--font-mono); }
.connection-provider h3 { margin: 0; font-size: 16px; font-weight: 610; }
.connection-provider p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.connection-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); flex: 1; margin: 0; }
.connection-meta > div { min-width: 0; padding: 18px 20px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.connection-meta > div:nth-child(2n) { border-right: 0; }
.connection-meta > div:nth-last-child(-n+2) { border-bottom: 0; }
.connection-meta dt { margin-bottom: 7px; color: var(--muted); font: 500 9px/1 var(--font-mono); text-transform: uppercase; }
.connection-meta dd { margin: 0; overflow: hidden; font-size: 12px; font-weight: 540; text-overflow: ellipsis; white-space: nowrap; }
.connection-card footer { min-height: 62px; display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 11px 14px; border-top: 1px solid var(--border); background: var(--surface-2); }
.connection-card footer .connection-scope { margin-right: auto; }
.connection-scope { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.danger-text { color: var(--no); }
.wallet-address { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.wallet-address > span { color: var(--muted); font-size: 9px; }
.wallet-address strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; }
.connection-add-card { grid-column: 1 / -1; min-height: 132px; display: grid; grid-template-columns: 46px minmax(0, 1fr); column-gap: 16px; align-content: center; padding: 24px; border: 1px dashed color-mix(in oklch, var(--muted) 42%, var(--border)); border-radius: var(--radius-lg); background: transparent; color: var(--muted); text-align: left; appearance: none; }
.connection-add-card:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.connection-add-card > span { grid-row: 1 / 3; align-self: center; width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; }
.connection-add-card strong { align-self: end; color: var(--fg); font-size: 14px; font-weight: 580; }
.connection-add-card small { align-self: start; margin-top: 5px; color: var(--muted); font-size: 11px; }
.provider-directory { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.provider-directory-card { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.provider-directory-card > header { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 20px; border-bottom: 1px solid var(--border); }
.provider-directory-card .provider-mark img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.provider-directory-card h3 { margin: 0; font-size: 16px; font-weight: 610; }
.provider-directory-card header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.provider-directory-card dl { margin: 0; }
.provider-directory-card dl div { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 14px; padding: 13px 20px; border-bottom: 1px solid var(--border); }
.provider-directory-card dt { color: var(--muted); font: 500 9px/1.4 var(--font-mono); text-transform: uppercase; }
.provider-directory-card dd { margin: 0; font-size: 11px; font-weight: 540; line-height: 1.4; }
.provider-directory-card > footer { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 14px 11px 20px; background: var(--surface-2); }
.provider-directory-card > footer span { color: var(--muted); font-size: 10px; line-height: 1.4; }
.connection-dialog-layer { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.connection-dialog-layer[hidden] { display: none !important; }
.connection-dialog-backdrop { position: absolute; inset: 0; border: 0; background: color-mix(in oklch, var(--bg) 76%, transparent); backdrop-filter: blur(7px); }
.connection-dialog { position: relative; z-index: 1; width: min(560px, 100%); max-height: min(760px, calc(100vh - 40px)); overflow: auto; border: 1px solid color-mix(in oklch, var(--border) 82%, var(--fg) 18%); border-radius: 10px; background: var(--surface); box-shadow: 0 28px 90px color-mix(in oklch, var(--bg) 78%, transparent); }
.connection-dialog > header { position: sticky; top: 0; z-index: 2; min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); background: color-mix(in oklch, var(--surface) 96%, transparent); backdrop-filter: blur(12px); }
.connection-dialog h2 { margin: 4px 0 0; font-size: 18px; font-weight: 620; }
.connection-dialog-close { width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--muted); font: 400 20px/1 var(--font-body); appearance: none; }
.connection-dialog-close:hover { border-color: var(--fg); color: var(--fg); }
.connection-dialog form { display: grid; gap: 14px; padding: 18px; }
.connection-dialog-context { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); }
.connection-dialog-context .provider-mark { width: 44px; height: 44px; }
.connection-dialog-context strong { display: block; font-size: 13px; font-weight: 600; }
.connection-dialog-context p { margin: 4px 0 0; color: var(--muted); font-size: 10.5px; line-height: 1.45; }
.connection-venue-fields, .connection-api-fields { display: grid; gap: 14px; }
.connection-venue-fields[hidden], .connection-api-fields[hidden] { display: none !important; }
.connection-api-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-top: 2px; }
.connection-api-fields .field:last-child { grid-column: 1 / -1; }
.connection-dialog footer { position: sticky; bottom: -18px; display: flex; justify-content: flex-end; gap: 8px; margin: 2px -18px -18px; padding: 14px 18px; border-top: 1px solid var(--border); background: color-mix(in oklch, var(--surface) 96%, transparent); backdrop-filter: blur(12px); }
.connection-safety { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); }
.connection-safety p { margin: 0; font-size: 9.5px; line-height: 1.45; }
.connection-safety strong { color: var(--fg); font-weight: 580; }
body.has-connection-dialog { overflow: hidden; }

.polymarket-card { overflow: hidden; }
.polymarket-empty { flex: 1; display: grid; align-content: center; justify-items: start; gap: 10px; min-height: 174px; padding: 24px 20px; }
.polymarket-empty h4 { margin: 0; font-size: 15px; font-weight: 600; }
.polymarket-empty p { max-width: 58ch; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.polymarket-empty .btn { margin-top: 4px; }
.polymarket-receipt { border-left: 2px solid var(--border); padding-left: 14px; }
.venue-wallet-address { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.venue-wallet-address > div { min-width: 0; display: grid; gap: 6px; }
.venue-wallet-address span { color: var(--muted); font: 500 9px/1 var(--font-mono); text-transform: uppercase; }
.venue-wallet-address strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.key-dialog-body { padding: 18px; }
.key-step { display: grid; gap: 18px; }
.key-step[hidden] { display: none !important; }
.key-step-heading { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; align-items: start; }
.key-step-heading > span { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 50%; color: var(--muted); font: 600 11px/1 var(--font-mono); }
.key-step-heading h3 { margin: 1px 0 5px; font-size: 15px; font-weight: 610; }
.key-step-heading p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.key-warning { padding: 14px; border: 1px solid color-mix(in oklch, var(--no) 38%, var(--border)); border-radius: 7px; background: color-mix(in oklch, var(--no) 7%, var(--surface)); }
.key-warning strong { font-size: 12px; font-weight: 620; }
.key-warning p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.key-step footer { position: static; display: flex; justify-content: flex-end; gap: 8px; margin: 0 -18px -18px; padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface-2); }
.btn-danger { border-color: color-mix(in oklch, var(--no) 76%, var(--border)); background: var(--no); color: white; }
.btn-danger:hover { filter: brightness(.94); }
.private-key-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); }
.private-key-box > span { grid-column: 1 / -1; color: var(--muted); font: 500 9px/1 var(--font-mono); text-transform: uppercase; }
.private-key-box code { min-width: 0; overflow-wrap: anywhere; font: 500 11px/1.55 var(--font-mono); }
.key-confirm { min-height: 44px; display: flex; align-items: center; gap: 10px; color: var(--fg); font-size: 11px; cursor: pointer; }
.key-confirm input { width: 18px; height: 18px; accent-color: var(--accent); }

@media (max-width: 1240px) {
  .connection-list { grid-template-columns: 1fr; }
  .connection-add-card { min-height: 132px; }
}
@media (max-width: 900px) {
  .settings-layout { display: block; }
  .settings-directory { position: sticky; top: 44px; display: flex; align-items: center; gap: 8px; margin: 0 -8px 18px; padding: 8px; overflow-x: auto; border-bottom: 1px solid var(--border); background: color-mix(in oklch, var(--bg) 92%, transparent); backdrop-filter: blur(14px); }
  .settings-nav { display: flex; gap: 2px; }
  .settings-nav a { flex: none; justify-content: center; padding-inline: 18px; }
  .settings-nav a::before { inset: auto 12px 0; width: auto; height: 2px; border-radius: 2px 2px 0 0; }
  .settings-panel > .panel-head { padding: 18px 20px; }
  .settings-panel > .panel-head p { max-width: 60ch; }
}
@media (max-width: 680px) {
  .settings-work { padding: 20px 14px 84px; }
  .settings-pagehead { min-height: 0; margin-bottom: 20px; padding-bottom: 18px; }
  .settings-pagehead { align-items: stretch; }
  .settings-pagehead .btn { min-height: 44px; }
  .form-grid, .preference-grid, .connection-summary { grid-template-columns: 1fr; }
  .connection-tabs { width: 100%; overflow-x: auto; }
  .connection-tabs button { flex: 1 0 auto; min-height: 44px; justify-content: center; }
  .form-span { grid-column: auto; }
  .preference-card, .preference-card:nth-child(2n), .preference-card:nth-last-child(-n+2) { grid-template-columns: 1fr; border-right: 0; border-bottom: 1px solid var(--border); }
  .preference-card:last-child { border-bottom: 0; }
  .notification-head, .notification-row { grid-template-columns: minmax(0, 1fr) repeat(3, 40px); }
  .notification-row { grid-template-columns: minmax(0, 1fr) repeat(3, 40px); padding-block: 9px; }
  .notification-row .switch { transform: none; }
  .notification-footer { grid-template-columns: 1fr; }
  .connection-summary > div { border-right: 0; border-bottom: 1px solid var(--border); }
  .connection-summary > div:last-child { border-bottom: 0; }
  .connection-provider { grid-template-columns: 38px minmax(0, 1fr); }
  .connection-provider .pill { grid-column: 2; justify-self: start; }
  .connection-meta { grid-template-columns: 1fr; }
  .connection-meta > div, .connection-meta > div:nth-child(2n), .connection-meta > div:nth-last-child(-n+2) { border-right: 0; border-bottom: 1px solid var(--border); }
  .connection-meta > div:last-child { border-bottom: 0; }
  .connection-card footer { align-items: stretch; flex-direction: column; }
  .connection-card footer .connection-scope { margin: 0 0 4px; }
  .connection-card footer .btn { width: 100%; min-height: 44px; }
  .wallet-address { grid-template-columns: 1fr; }
  .connection-dialog footer { flex-direction: column-reverse; }
  .connection-dialog footer .btn { width: 100%; min-height: 44px; }
  .key-step footer { flex-direction: column-reverse; }
  .key-step footer .btn { width: 100%; min-height: 44px; }
  .venue-wallet-address, .private-key-box { grid-template-columns: 1fr; }
  .venue-wallet-address .btn, .private-key-box .btn { width: 100%; min-height: 44px; }
  .connection-api-fields { grid-template-columns: 1fr; }
  .connection-api-fields .field:last-child { grid-column: auto; }
  .provider-directory { grid-template-columns: 1fr; }
  .provider-directory-card > header { grid-template-columns: 40px minmax(0, 1fr); }
  .provider-directory-card > header .pill { grid-column: 2; justify-self: start; }
  .provider-directory-card dl div { grid-template-columns: 1fr; gap: 5px; }
  .provider-directory-card > footer { align-items: stretch; flex-direction: column; padding: 14px; }
  .provider-directory-card > footer .btn { width: 100%; min-height: 44px; }
}
