/* Name and icon setup over the originating chat. */
.app-create-modal {
    --ds-card-bg: rgba(26, 26, 30, 0.94);
    --ds-fg: #fff;
    --ds-border: rgba(255, 255, 255, 0.12);
    --ds-sub: rgba(255, 255, 255, 0.1);
    --ds-input-bg: rgba(255, 255, 255, 0.06);
    --ds-hover: rgba(255, 255, 255, 0.08);
    --ds-btn-bg: #fff;
    --ds-btn-fg: #111;
    --ds-ghost: rgba(255, 255, 255, 0.09);
    --ds-radio: rgba(255, 255, 255, 0.28);
    --ds-green: #34c759;
    --ds-red: #ff453a;
    --ds-scrim: rgba(0, 0, 0, 0.22);
}
[data-theme="light"] .app-create-modal {
    --ds-card-bg: rgba(255, 255, 255, 0.97);
    --ds-fg: #111;
    --ds-border: rgba(0, 0, 0, 0.1);
    --ds-sub: rgba(0, 0, 0, 0.08);
    --ds-input-bg: rgba(0, 0, 0, 0.03);
    --ds-hover: rgba(0, 0, 0, 0.05);
    --ds-btn-bg: #111;
    --ds-btn-fg: #fff;
    --ds-ghost: rgba(0, 0, 0, 0.06);
    --ds-radio: rgba(0, 0, 0, 0.22);
    --ds-green: #34c759;
    --ds-red: #d70015;
    --ds-scrim: rgba(0, 0, 0, 0.18);
}

.app-create-modal * { box-sizing: border-box; }
.ds-root { position: fixed; inset: 0; z-index: 10050; pointer-events: none; font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif; }
.ds-scrim { position: absolute; inset: 0; background: var(--ds-scrim); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); opacity: 1; transition: opacity .28s ease, -webkit-backdrop-filter .28s ease, backdrop-filter .28s ease; pointer-events: auto; }
.ds-root.min .ds-scrim { -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); opacity: 0; pointer-events: none; }

.ds-card {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: min(420px, calc(100% - 32px)); max-height: calc(100% - 90px);
    overflow-y: auto; box-sizing: border-box;
    background: var(--ds-card-bg); -webkit-backdrop-filter: blur(28px); backdrop-filter: blur(28px);
    border: 1px solid var(--ds-border); border-radius: 22px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5); padding: 22px; color: var(--ds-fg);
    pointer-events: auto; transition: transform .34s cubic-bezier(.34,1.1,.4,1), opacity .26s ease;
}

.ds-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.ds-title { font-size: 16px; font-weight: 650; }
.ds-min { width: 30px; height: 30px; flex: none; border-radius: 50%; border: none; background: var(--ds-ghost); color: inherit; font-size: 20px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }

.ds-input { width: 100%; box-sizing: border-box; padding: 12px 14px; border-radius: 13px; border: 1.5px solid var(--ds-border); background: var(--ds-input-bg); color: inherit; font-size: 15px; outline: none; }
.ds-input:focus { border-color: var(--ds-radio); }

.ds-name-list { display: flex; flex-direction: column; gap: 8px; }
.ds-opt { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 13px; border: 1.5px solid var(--ds-border); background: var(--ds-input-bg); color: inherit; font-size: 15px; cursor: pointer; transition: border-color .15s, background .15s; }
.ds-opt:hover { background: var(--ds-hover); }
.ds-opt::before { content: ''; flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--ds-radio); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: transparent; transition: border-color .15s, background .15s, color .15s; }
.ds-opt.sel { border-color: rgba(52,199,89,.55); background: rgba(52,199,89,.10); font-weight: 600; }
.ds-opt.sel::before { content: '\2713'; border-color: var(--ds-green); background: var(--ds-green); color: #fff; }
.ds-opt-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-custom { margin-top: 12px; }

.ds-avatar-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ds-avatar { width: 104px; height: 104px; flex: none; border-radius: 26px; overflow: hidden; background: var(--ds-sub); display: flex; align-items: center; justify-content: center; }
.ds-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ds-spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--ds-sub); border-top-color: var(--ds-fg); animation: ds-spin .8s linear infinite; opacity: .7; }
@keyframes ds-spin { to { transform: rotate(360deg); } }
.ds-edit { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--ds-border); background: transparent; color: inherit; font-size: 12.5px; cursor: pointer; }
.ds-edit:hover { background: var(--ds-hover); }
.ds-edit.active { background: var(--ds-hover); }
.ds-edit-row { display: none; gap: 8px; width: 100%; margin-top: 6px; align-items: center; }
.ds-edit-row.open { display: flex; }
.ds-edit-row .ds-input { flex: 1; }

.ds-actions { display: flex; gap: 10px; margin-top: 18px; }
.ds-btn { flex: 1; padding: 12px; border-radius: 13px; border: none; font-size: 14px; font-weight: 600; cursor: pointer; }
.ds-btn-primary { background: var(--ds-btn-bg); color: var(--ds-btn-fg); }
.ds-btn-ghost { background: var(--ds-ghost); color: inherit; }
.ds-btn:disabled { opacity: .5; cursor: default; }

.app-create-modal .ds-error { color: var(--ds-red); font-size: 13px; line-height: 1.4; margin-top: 12px; }
.app-create-modal .ds-edit-row { display: flex; flex-wrap: wrap; }
.app-create-modal .ds-edit-row .ds-input { flex-basis: 100%; min-width: 0; }
.app-create-modal .ds-card { max-height: calc(100dvh - 48px); }
.app-create-modal .ds-input { font-size: 16px; }
.app-create-modal[hidden] { display: none; }
