/* DashView — Profile settings (v2) */
.pf-card .stg-card-body { display: flex; flex-direction: column; gap: 0; }
.pf-req { color: var(--danger, #e5484d); font-weight: 700; }
.pf-count { float: right; font-family: var(--f-mono, monospace); font-size: 10.5px; color: var(--ink-30); font-weight: 500; }
.pf-count.near { color: var(--signal); }
.pf-textarea { resize: vertical; min-height: 78px; line-height: 1.5; font-family: inherit; }
select.stg-input { cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, var(--ink-50) 50%), linear-gradient(135deg, var(--ink-50) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
input[readonly].stg-input { opacity: .72; cursor: not-allowed; }
.pf-err { color: var(--danger, #e5484d) !important; }
.stg-input.pf-invalid { border-color: var(--danger, #e5484d); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger, #e5484d) 14%, transparent); }

/* Hero */
.pf-hero {
  display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(200px, 260px); gap: 22px; align-items: center;
  padding: 20px; border: 1px solid var(--line); border-radius: 18px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--signal) 9%, var(--paper-soft)), var(--paper-soft) 70%);
}
.pf-avatar-wrap { position: relative; width: 96px; height: 96px; }
.pf-avatar {
  width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  font-size: 32px; font-weight: 600; letter-spacing: .02em; color: #fff; background: var(--signal); text-shadow: 0 1px 2px rgba(0,0,0,.22);
  background-size: cover; background-position: center;
  box-shadow: inset 0 2px 2px rgba(255,255,255,.4), inset 0 -4px 8px rgba(0,0,0,.12), 0 0 0 3px var(--paper), 0 0 0 4px var(--line-strong), 0 14px 26px -12px rgba(0,0,0,.45);
}
.pf-avatar.has-photo span { display: none; }
.pf-avatar-sm { width: 40px; height: 40px; font-size: 14px; box-shadow: none; flex-shrink: 0; }
.pf-presence { position: absolute; right: 4px; bottom: 4px; width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--paper); background: var(--ios-green, #30d158); }
.pf-presence[data-s="busy"] { background: #ef4444; } .pf-presence[data-s="away"] { background: #f59e0b; } .pf-presence[data-s="dnd"] { background: #7c3aed; }
.pf-hero-main { min-width: 0; }
.pf-hero-name { font-size: 1.35rem; font-weight: 700; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-hero-user { font-family: var(--f-mono, monospace); font-size: .82rem; color: var(--signal); margin-top: 2px; }
.pf-hero-sub { font-size: .84rem; color: var(--ink-50); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-hero-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.pf-meter { padding: 12px 14px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); }
.pf-meter-top { display: flex; justify-content: space-between; font-size: .74rem; color: var(--ink-50); margin-bottom: 8px; }
.pf-meter-top b { color: var(--ink); font-size: .9rem; }
.pf-meter-bar { height: 7px; border-radius: 99px; background: var(--paper-alt, var(--line)); overflow: hidden; }
.pf-meter-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--signal), var(--signal-bright, var(--signal))); transition: width .45s cubic-bezier(.3,1.2,.5,1); }
.pf-meter-hint { font-size: .72rem; color: var(--ink-30); margin-top: 8px; line-height: 1.4; }

/* Username field */
.pf-handle { position: relative; display: flex; align-items: center; }
.pf-handle .stg-input { padding-left: 30px; padding-right: 34px; font-family: var(--f-mono, monospace); }
.pf-at { position: absolute; left: 13px; color: var(--ink-30); font-family: var(--f-mono, monospace); pointer-events: none; }
.pf-handle-state { position: absolute; right: 12px; width: 16px; height: 16px; border-radius: 50%; display: none; }
.pf-handle-state.ok { display: block; background: var(--ios-green, #30d158) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 8.5 2.6 2.6L12 5.5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/100% no-repeat; }
.pf-handle-state.bad { display: block; background: var(--danger, #e5484d) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m5 5 6 6m0-6-6 6' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center/100% no-repeat; }

/* Status + swatches — iOS system colours */
.pf-card { --ios-red:#FF3B30; --ios-orange:#FF9500; --ios-green2:#34C759; --ios-purple:#AF52DE; }
html[data-theme="dark"] .pf-card { --ios-red:#FF453A; --ios-orange:#FF9F0A; --ios-green2:#30D158; --ios-purple:#BF5AF2; }
.pf-status { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px; width: fit-content; max-width: 100%; border-radius: 14px; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.pf-status button { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 11px; border: 0; background: transparent; color: var(--ink-50); font-size: .8rem; font-weight: 500; cursor: pointer; transition: background .2s, color .2s, box-shadow .2s, transform .15s; }
.pf-status button i { width: 10px; height: 10px; border-radius: 50%; background: var(--ios-green2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ios-green2) 22%, transparent); }
.pf-status button[data-s="busy"] i { background: var(--ios-red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ios-red) 22%, transparent); }
.pf-status button[data-s="away"] i { background: var(--ios-orange); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ios-orange) 22%, transparent); }
.pf-status button[data-s="dnd"] i { background: var(--ios-purple); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ios-purple) 22%, transparent); }
.pf-status button:hover { color: var(--ink); }
.pf-status button:active { transform: scale(.96); }
.pf-status button[aria-checked="true"] { color: var(--ink); font-weight: 600; background: var(--paper); box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 3px 8px -2px rgba(0,0,0,.14); }
.pf-presence { background: var(--ios-green2) !important; }
.pf-presence[data-s="busy"] { background: var(--ios-red) !important; } .pf-presence[data-s="away"] { background: var(--ios-orange) !important; } .pf-presence[data-s="dnd"] { background: var(--ios-purple) !important; }
.pf-colorname { float: right; font-size: 11px; font-weight: 600; color: var(--ink-50); letter-spacing: .01em; }

.pf-swatches { display: grid; grid-template-columns: repeat(auto-fill, 34px); gap: 12px 14px; padding: 6px 2px 2px; }
.pf-swatches button {
  position: relative; width: 34px; height: 34px; border-radius: 50%; border: 0; padding: 0; cursor: pointer; display: grid; place-items: center;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 70%, #fff) 0%, var(--c) 60%, color-mix(in srgb, var(--c) 86%, #000) 100%);
  box-shadow: inset 0 1px 1px rgba(255,255,255,.55), inset 0 -2px 3px rgba(0,0,0,.14), 0 3px 8px -3px color-mix(in srgb, var(--c) 70%, transparent);
  transition: transform .22s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
  -webkit-tap-highlight-color: transparent;
}
.pf-swatches button::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 0 var(--c); transition: box-shadow .2s; }
.pf-swatches button svg { width: 16px; height: 16px; opacity: 0; transform: scale(.4); transition: opacity .15s, transform .25s cubic-bezier(.34,1.56,.64,1); filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.pf-swatches button:hover { transform: scale(1.1); }
.pf-swatches button:active { transform: scale(.92); }
.pf-swatches button:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }
/* iOS-style selection: white gap + coloured ring + check */
.pf-swatches button[aria-checked="true"] { transform: scale(1); }
.pf-swatches button[aria-checked="true"]::after { inset: -5px; box-shadow: 0 0 0 2.5px var(--c); }
.pf-swatches button[aria-checked="true"] svg { opacity: 1; transform: scale(1); }
.pf-swatches button[aria-checked="true"] { box-shadow: 0 0 0 2.5px var(--paper), inset 0 1px 1px rgba(255,255,255,.55), inset 0 -2px 3px rgba(0,0,0,.14), 0 3px 8px -3px color-mix(in srgb, var(--c) 70%, transparent); }
.pf-swatches button[aria-checked="true"]::after { inset: -2.5px; box-shadow: 0 0 0 2.5px var(--c); border-radius: 50%; }

/* Preview */
.pf-preview { display: flex; align-items: center; gap: 12px; width: fit-content; max-width: 100%; padding: 12px 18px 12px 12px; border-radius: 14px; background: #0f1411; border: 1px solid rgba(255,255,255,.08); }
.pf-prev-text p { margin: 0; font-size: .82rem; font-weight: 600; color: #f2f5f2; }
.pf-prev-text span { font-size: .72rem; color: rgba(242,245,242,.55); }
.pf-preview .pf-avatar { color: #fff; }

/* Save bar */
.pf-savebar { display: flex; align-items: center; gap: 12px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.pf-dirty { display: inline-flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 600; color: var(--signal); }
.pf-dirty i { width: 8px; height: 8px; border-radius: 50%; background: var(--signal); animation: pfPulse 1.6s ease-in-out infinite; }
@keyframes pfPulse { 50% { opacity: .35; } }
.stg-status-pill.pf-saved { color: var(--ios-green, #30d158); }

@media (max-width: 760px) {
  .pf-hero { grid-template-columns: auto minmax(0, 1fr); }
  .pf-meter { grid-column: 1 / -1; }
}
@media (max-width: 440px) {
  .pf-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .pf-hero-actions { justify-content: center; }
  .pf-hero-main { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .pf-dirty i, .pf-meter-bar i { animation: none; transition: none; } }

/* ── Appearance › Accent colour — iOS style swatches ─────────────────────── */
.ap-accents { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 14px 8px !important; }
.ap-acc {
  flex-direction: column; justify-content: flex-start; gap: 8px; padding: 6px 2px 4px !important; border: 0 !important; background: transparent !important;
  box-shadow: none !important; border-radius: 14px; font-size: 11.5px; color: var(--ink-50); cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), color .2s;
}
.ap-acc:hover { transform: translateY(-2px) !important; color: var(--ink); }
.ap-acc:active { transform: scale(.94) !important; }
.ap-acc b { font-weight: 500; letter-spacing: .01em; }
.ap-acc.active { color: var(--ink); }
.ap-acc.active b { font-weight: 700; }
.ap-acc-dot {
  position: relative; width: 44px !important; height: 44px !important; border-radius: 50%;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 70%, #fff) 0%, var(--c) 60%, color-mix(in srgb, var(--c) 86%, #000) 100%) !important;
  box-shadow: inset 0 1.5px 1px rgba(255,255,255,.55), inset 0 -3px 4px rgba(0,0,0,.14), 0 6px 12px -6px color-mix(in srgb, var(--c) 75%, transparent) !important;
  transition: box-shadow .2s;
}
.ap-acc-dot::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; box-shadow: 0 0 0 0 var(--c); transition: box-shadow .2s, inset .2s; }
.ap-acc.active .ap-acc-dot { box-shadow: 0 0 0 3px var(--paper), inset 0 1.5px 1px rgba(255,255,255,.55), inset 0 -3px 4px rgba(0,0,0,.14), 0 6px 12px -6px color-mix(in srgb, var(--c) 75%, transparent) !important; }
.ap-acc.active .ap-acc-dot::after { inset: -3px; box-shadow: 0 0 0 2.5px var(--c); }
.ap-acc-dot svg { width: 18px !important; height: 18px !important; opacity: 0; transform: scale(.4); transition: opacity .15s, transform .25s cubic-bezier(.34,1.56,.64,1) !important; filter: drop-shadow(0 1px 1px rgba(0,0,0,.28)); }
.ap-acc.active .ap-acc-dot svg { opacity: 1 !important; transform: scale(1); }
/* Yellow / Mint read better with dark tick */
.ap-acc[data-accent-opt="yellow"] .ap-acc-dot svg, .ap-acc[data-accent-opt="mint"] .ap-acc-dot svg { color: rgba(0,0,0,.65); filter: none; }
.ap-acc:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
@media (max-width: 520px) { .ap-accents { grid-template-columns: repeat(4, 1fr); } }
