/* The profile drawer: a glass sheet from the right. A fixed top bar, the identity, then grouped lists in the iOS
   settings manner: one row per thing, brand mark on the left, the state or the action on the right, forms folded
   under their row until asked for. */
.drawer-host { position: fixed; inset: 0; z-index: 80; }
.drawer-bg { position: absolute; inset: 0; background: rgba(11, 12, 16, 0.28); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity 0.4s var(--ease); }
.drawer { position: absolute; top: 10px; right: 10px; bottom: 10px; width: min(440px, calc(100vw - 20px)); border-radius: 24px; background: var(--paper); border: 1px solid var(--line-2); box-shadow: 0 40px 100px -30px rgba(11, 12, 16, 0.5); overflow: hidden; transform: translateX(calc(100% + 24px)); transition: transform 0.5s var(--ease); display: flex; flex-direction: column; }
.drawer-host.on .drawer-bg { opacity: 1; }
.drawer-host.on .drawer { transform: none; }
html.drawer-open { overflow: hidden; }
.dtop { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 12px 0 20px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 86%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); flex: none; }
.dtop b { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.drawer-x { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--ink); display: grid; place-items: center; cursor: pointer; transition: transform 0.2s var(--ease), background 0.2s; }
.drawer-x:hover { transform: rotate(90deg); }
.drawer-x svg { width: 16px; height: 16px; }
.drawer-in { overflow-y: auto; padding: 0 16px 24px; flex: 1; overscroll-behavior: contain; }
.drawer-in > * { opacity: 0; transform: translateY(8px); }
.drawer-host.on .drawer-in > * { opacity: 1; transform: none; transition: opacity 0.55s var(--ease), transform 0.55s var(--ease); }
.drawer-host.on .drawer-in > :nth-child(2) { transition-delay: 0.05s; }
.drawer-host.on .drawer-in > :nth-child(3) { transition-delay: 0.1s; }
.drawer-host.on .drawer-in > :nth-child(4) { transition-delay: 0.15s; }
.drawer-host.on .drawer-in > :nth-child(n + 5) { transition-delay: 0.2s; }

/* identity */
.dhead { margin: 0 -16px; padding: 22px 20px 20px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; background: radial-gradient(70% 120% at 15% 0%, rgba(214, 206, 255, 0.5), transparent 70%), radial-gradient(60% 100% at 95% 0%, rgba(206, 230, 255, 0.55), transparent 70%); }
html[data-theme="dark"] .dhead { background: radial-gradient(70% 120% at 15% 0%, rgba(98, 84, 210, 0.28), transparent 70%), radial-gradient(60% 100% at 95% 0%, rgba(60, 120, 220, 0.2), transparent 70%); }
.dav { position: relative; width: 60px; height: 60px; flex: none; }
.dav .av, .dav img { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; position: absolute; inset: 0; box-shadow: 0 0 0 3px var(--paper); }
.dav .av.ini { font-size: 18px; }
.dav-edit { position: absolute; right: -3px; bottom: -3px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--paper); border: 2px solid var(--paper); cursor: pointer; transition: transform 0.2s var(--ease); }
.dav-edit:hover { transform: scale(1.1); }
.dav-edit svg { width: 11px; height: 11px; }
.dhead h3 { font-size: 20px; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.dhead .dsub { margin-top: 3px; font: 12px var(--mono); color: var(--muted); overflow-wrap: anywhere; line-height: 1.5; }

/* sections and lists */
.dsec { margin-top: 18px; }
.dlabel { display: block; margin: 0 4px 7px; font: 500 10.5px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.dlist { border-radius: 16px; background: var(--card); border: 1px solid var(--line); overflow: hidden; }
.drow2 { width: 100%; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; min-height: 56px; background: none; border: 0; color: var(--ink); font: inherit; text-align: left; }
.dlist > .drow2 + .drow2, .dlist > .dfold + .drow2, .dlist > .drow2 + .dfold { border-top: 1px solid var(--line); }
.ri { width: 32px; height: 32px; display: grid; place-items: center; }
.ri > svg { width: 30px; height: 30px; }
.b-x { width: 30px; height: 30px; border-radius: 50%; background: #000; color: #fff; display: grid; place-items: center; }
.b-x svg { width: 13px; height: 13px; }
.b-g { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); color: var(--ink); display: grid; place-items: center; }
.b-g svg { width: 15px; height: 15px; }
.rt { min-width: 0; display: block; }
.rt b { display: block; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.rt > span { display: block; margin-top: 1px; font: 12px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr { display: flex; align-items: center; gap: 4px; }
.rr .pill { height: 22px; padding: 0 9px; font-size: 10.5px; }
.ib { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; border: 0; background: none; color: var(--ink-2); cursor: pointer; transition: background 0.15s, color 0.15s; }
.ib:hover { background: var(--surface-2); color: var(--ink); }
.ib svg { width: 16px; height: 16px; }
.ib.done { color: var(--accent); }
.rlink { display: inline-flex; align-items: center; gap: 2px; height: 30px; padding: 0 6px 0 10px; border-radius: 999px; border: 0; background: var(--accent-soft); color: var(--accent); font: 500 12.5px var(--body); cursor: pointer; white-space: nowrap; transition: background 0.15s; }
.rlink:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.rlink svg { width: 14px; height: 14px; transition: transform 0.2s var(--ease); }
.rlink.open svg { transform: rotate(90deg); }
.rlink.quiet { background: none; color: var(--muted); }
.rlink.quiet:hover { background: var(--surface-2); color: var(--ink); }
.dfold { padding: 0 12px 12px 56px; }
.dfold form { display: grid; gap: 8px; }
.dfold .inl { display: flex; gap: 8px; }
.dfold input, .dname input { width: 100%; min-width: 0; height: 40px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--paper); color: var(--ink); font: 14px var(--body); }
.dfold input:focus, .dname input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.dfold .btn { height: 40px; justify-self: start; }
.dname { position: relative; }
.dname input { height: 46px; padding-right: 84px; background: var(--card); border-radius: 14px; font-size: 15px; }
.dname .btn { position: absolute; right: 6px; top: 6px; height: 34px; opacity: 0; transform: scale(0.9); pointer-events: none; transition: opacity 0.2s, transform 0.2s var(--ease); }
.dname.dirty .btn { opacity: 1; transform: none; pointer-events: auto; }
.dnote { margin: 7px 4px 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.dopt { cursor: pointer; transition: background 0.15s; }
.dopt:hover { background: var(--surface-2); }
.dopt .rr svg { width: 16px; height: 16px; color: var(--faint); }
.dopt.danger .rt b { color: var(--fault); }
.dopt.danger .b-g { background: color-mix(in srgb, var(--fault) 12%, transparent); color: var(--fault); }
.tpick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 5px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.tpick button { display: grid; justify-items: center; gap: 4px; padding: 10px 0 8px; border: 0; border-radius: 11px; background: none; color: var(--muted); font: 500 12px var(--body); cursor: pointer; transition: background 0.2s, color 0.2s; }
.tpick button svg { width: 18px; height: 18px; }
.tpick button:hover { color: var(--ink); }
.tpick button.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(11, 12, 16, 0.08), 0 0 0 1px var(--line-2); }
.me-btn { display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 14px 0 4px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); font: 500 14px var(--body); cursor: pointer; transition: transform 0.15s var(--ease); }
.me-btn:hover { transform: translateY(-1px); }
.me-btn .av-wrap, .me-btn .av { width: 32px; height: 32px; }
.me-btn .nm { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) { .me-btn { padding: 0 4px; } .me-btn .nm { display: none; } .dfold { padding-left: 12px; } }
@media (prefers-reduced-motion: reduce) { .drawer, .drawer-bg, .drawer-in > * { transition: none !important; } }
