.account-button{background:#27232e;color:#fff;border:1px solid #6e567d;border-radius:22px;padding:10px 18px;font:inherit;font-size:14px;cursor:pointer}.account-content{padding:28px;max-width:640px}.account-head{display:flex;align-items:center;justify-content:space-between}.account-content p,.account-content details{font-size:14px;line-height:1.7;color:#c7becd}.account-content h3{margin-top:26px}.balance{display:block;font-size:34px;margin:18px 0;color:#e6c1ff}#account-dialog{background:#18151e;color:#fff;border:1px solid #51455f;border-radius:20px;max-width:calc(100vw - 24px);max-height:90vh}#account-dialog::backdrop{background:#0009}#account-identity{overflow-wrap:anywhere}#grant-form{display:grid;gap:10px}#grant-form input,#grant-form select,#model-select{font:inherit;font-size:14px;color:#fff;background:#27222f;border:1px solid #5f4e6c;border-radius:8px;padding:10px;max-width:100%}#ledger-list{font-size:14px}.ledger-row{display:flex;justify-content:space-between;gap:15px;border-bottom:1px solid #39303e;padding:12px 0}.ledger-row small{display:block;color:#aea2b6}.model-label{font-size:14px;margin-right:10px}.composer #price-hint{margin:8px 0}.account-content button:disabled,.composer button:disabled{opacity:.5;cursor:wait}.message.assistant .bubble{background:#28232f}.message small{font-size:13px}.account-content [hidden]{display:none}@media(max-width:600px){.account-content{padding:18px}.account-button{max-width:200px}.topbar{gap:8px}}
#balance-dialog{background:#18151e;color:#fff;border:1px solid #655170;border-radius:16px;width:480px;max-width:calc(100vw - 24px);max-height:90vh;overflow:auto}#balance-dialog::backdrop{background:#000a}#balance-form{display:grid;gap:10px}#balance-form input{width:100%;min-width:0;box-sizing:border-box;font:inherit;font-size:16px;background:#27222f;color:#fff;border:1px solid #796086;padding:12px;border-radius:8px}#balance-member,#balance-result{overflow-wrap:anywhere}#balance-dialog label{font-size:14px}#balance-current{color:#e6c1ff}.admin-member-row{flex-wrap:wrap}@media(max-width:600px){.admin-member-details{flex-basis:100%}}
/* Compact mobile controls; keep the conversation visible above the keyboard. */
html,body{max-width:100%;overflow-x:clip}
.topbar .brand{flex-shrink:0}.account-button{min-width:0;overflow-wrap:anywhere}
#account-dialog{max-height:90dvh;overflow-y:auto;overscroll-behavior:contain}
#grant-form input,#grant-form select,#model-select{font-size:16px}
@media(max-width:680px){
 .topbar{height:auto;min-height:75px;padding:12px 16px;gap:12px}
 .account-button{font-size:13px;padding:9px 12px;max-width:180px}
 main{padding-left:16px;padding-right:16px}
 #story-dialog{position:fixed;inset:0;margin:0;width:100%;max-width:100%;height:100dvh;max-height:100dvh;border:0;border-radius:0}
 .story-layout{height:100%;min-height:0}
 .story-aside{height:78px;padding:6px 14px;gap:10px}
 .story-art{flex-basis:44px;width:44px;height:66px}
 .aside-content h2{margin:5px 0 0;font-size:18px}
 .chat-head{padding:8px 14px}.chat-head .icon-button{min-width:40px;height:40px}
 .messages{min-height:0;padding:16px;overscroll-behavior:contain}
 .composer{padding:10px 14px max(10px,env(safe-area-inset-bottom));flex-shrink:0}
 .suggestion-label{display:none}
 .suggestions{flex-wrap:nowrap;overflow-x:auto;margin-bottom:8px;padding-bottom:3px}
 .suggestions button{flex-shrink:0;max-width:240px;font-size:13px;white-space:nowrap}
 .model-label{display:none}
 #model-select{height:42px;margin:0;padding:6px 10px}
 .composer #price-hint{font-size:12px;line-height:1.4;margin:6px 0}
 #message-input{min-height:70px;padding:10px 90px 10px 12px}
 #message-form .primary{min-height:42px;right:8px;bottom:8px;font-size:14px}
 .composer-note{margin-top:6px;font-size:12px}
 .bubble{font-size:16px;line-height:1.75}
 .toast{z-index:100;bottom:max(16px,env(safe-area-inset-bottom))}
}
@media(max-width:380px){.brand{gap:7px;font-size:16px}.brand-mark{width:30px;height:30px}.account-button{max-width:165px;font-size:12px}}
@media(max-height:550px) and (max-width:680px){.story-aside,.suggestions,.composer #price-hint,.composer>.composer-note{display:none}}

#auth-dialog{background:#18151e;color:#fff;border:1px solid #51455f;border-radius:20px;width:440px;max-width:calc(100vw - 24px);max-height:90dvh;overflow-y:auto}#auth-dialog::backdrop{background:#000a}#auth-form,#signup-fields{display:grid;gap:10px}#auth-dialog [hidden]{display:none}#auth-form input{width:100%;box-sizing:border-box;font:inherit;font-size:16px;color:#fff;background:#27222f;border:1px solid #5f4e6c;border-radius:8px;padding:12px}#auth-form .primary{padding:13px;min-height:46px}#auth-switch{margin-top:18px;width:100%}#auth-error{color:#ffb5bd;margin:0}#auth-dialog a{color:#dcc1f6}#signup-note{font-size:12px}#auth-form label{font-size:14px}.account-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:20px}
.admin-member-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 0;border-bottom:1px solid #44384d}.admin-member-details{display:grid;gap:4px;min-width:0;overflow-wrap:anywhere;font-size:14px;line-height:1.6}.admin-member-details strong{color:#f0e1ff}.admin-member-details span{color:#cbbdd5}.delete-member-button{flex-shrink:0;border:1px solid #b67685;border-radius:8px;background:#38202a;color:#ffbdcb;padding:10px 12px;font-size:14px}.member-self{font-size:14px;color:#bda5d0;white-space:nowrap}#delete-member-dialog{background:#18151e;color:#fff;border:1px solid #655170;border-radius:16px;max-width:calc(100vw - 24px);width:480px}#delete-member-dialog::backdrop{background:#000a}#delete-member-confirm{width:100%;background:#27222f;color:#fff;border:1px solid #796086;padding:12px;border-radius:8px;margin-top:10px;font:inherit}#delete-member-error{color:#ffbdcb}#delete-member-dialog label{font-size:14px;overflow-wrap:anywhere}

.chat-photo{display:block;max-width:300px;width:100%;margin-top:10px;border-radius:14px;overflow:hidden;border:1px solid var(--border)}
.chat-photo img{display:block;width:100%;height:auto;aspect-ratio:2/3;object-fit:cover}
.admin-photo-library{margin:18px 0;padding:14px;border:1px solid var(--border);border-radius:12px}
.admin-photo-library summary{cursor:pointer;font-weight:700;min-height:32px;font-size:16px}
#admin-photo-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-top:16px}
.admin-photo-card{margin:0;min-width:0}.admin-photo-card .chat-photo{max-width:none;margin-top:0}
.admin-photo-card figcaption{font-size:16px;font-weight:700;margin-top:8px}.admin-photo-card p{font-size:14px;color:var(--muted);line-height:1.6}
@media(max-width:380px){#admin-photo-grid{grid-template-columns:1fr}}

.admin-photo-group{grid-column:1/-1}.admin-photo-group h4{font-size:18px;margin:12px 0}.admin-photo-items{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}@media(max-width:380px){.admin-photo-items{grid-template-columns:1fr}}

.admin-photo-picker,.admin-photo-content{grid-column:1/-1;min-width:0}.admin-photo-picker label{display:block;font-size:14px;margin-bottom:8px}.admin-photo-picker select{width:100%;min-height:44px;margin:0;font-size:16px}

.admin-member-management{margin:18px 0;padding:14px;border:1px solid var(--border);border-radius:12px}.admin-member-management>summary{font-size:16px;font-weight:600;line-height:1.6;cursor:pointer;min-height:32px}.admin-member-management #admin-members-status{font-size:14px;color:var(--muted)}.admin-member-management #admin-members-status:empty{display:none}
/* Member information and actions occupy separate rows, including narrow screens. */
#admin-members .admin-member-row{display:grid;grid-template-columns:minmax(0,1fr);gap:8px;padding:12px 0}
#admin-members .admin-member-details{width:100%;min-width:0}
#admin-members .member-actions{position:static;display:flex;justify-content:flex-start;align-items:center;flex-wrap:wrap;gap:6px;width:100%;min-width:0}
#admin-members .member-actions button{position:static;flex:0 1 auto;width:auto;min-width:0;min-height:32px;margin:0;padding:5px 9px;font-size:12px;line-height:1.5;white-space:normal}
#admin-members .member-self{padding:5px 0}
#admin-members .member-level{width:110px;max-width:100%;min-height:32px;margin:0 0 3px;font-size:12px}
@media(max-width:420px){#admin-members .member-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}#admin-members .member-actions button{width:100%;min-height:36px}}
/* Compact member overview with readable account details. */
#admin-members-title{font-size:15px;margin:18px 0 6px}
.admin-member-row{gap:10px;padding:9px 0}
.admin-member-details{font-size:12px;line-height:1.45;gap:3px;flex:1}
.member-identity,.member-meta{display:flex;align-items:baseline;flex-wrap:wrap;gap:4px 10px}
.member-identity strong{font-size:13px}.member-identity span{font-size:12px}
.member-meta .member-balance{color:#e6c1ff;white-space:nowrap}
.delete-member-button{font-size:12px;padding:7px 9px;min-height:36px}
.member-self{font-size:12px}

/* Voice and send share the input's existing action area. */
#story-dialog #message-input{padding-right:156px}
#message-form .message-input-actions{position:absolute;right:8px;bottom:10px;display:flex;align-items:center;gap:6px}
#message-form .message-input-actions .primary{position:static;min-height:44px;padding:8px 12px;margin:0;font-size:14px}
#voice-input-button{width:44px;height:44px;flex-shrink:0;border:1px solid #66517e;border-radius:9px;background:#27222f;color:#e7d8ff;padding:0;font-size:21px;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
#voice-input-button[aria-pressed="true"]{background:#722f4f;border-color:#ffadc4;color:#fff}
#voice-input-button:disabled{opacity:.55;cursor:not-allowed}

.admin-voice-preview{margin:18px 0}.admin-voice-preview summary{cursor:pointer;font-weight:600}.voice-sample-list{display:grid;gap:12px}.voice-sample-list section{padding:12px;border:1px solid #ffffff26;border-radius:12px;min-width:0}.voice-sample-list h4{margin:0 0 6px}.voice-sample-list p{font-size:14px;line-height:1.6}.voice-sample-list audio{width:100%;margin-top:10px}

.search-sources{display:flex;flex-wrap:wrap;gap:8px;font-size:13px;margin:8px 0}.search-sources a{color:inherit;text-decoration:underline;overflow-wrap:anywhere}.search-sources span{opacity:.7}

.relationship-status{padding:7px 16px;font-size:12px;line-height:1.6;color:#c9bbd7;background:#211b29;border-bottom:1px solid #3b3047;flex-shrink:0;overflow-wrap:anywhere;}
@media(max-width:600px){.relationship-status{padding:6px 10px;font-size:11px;}}

#test-access-banner:not([hidden]){display:flex;align-items:center;justify-content:center;gap:12px;flex-wrap:wrap;padding:10px 16px;background:#403058;color:#fff;font-size:14px}#stop-test-access,.test-member-button{border:1px solid #b9a2db;border-radius:8px;padding:8px 10px;background:#302440;color:#fff;font:inherit;cursor:pointer}.member-actions{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}.test-member-button{font-size:12px;min-height:36px}.test-access-note{font-size:13px;color:#cbbdd5}
.group-entry[aria-disabled="true"]{opacity:.65}.group-entry{text-decoration:none;white-space:nowrap}.member-level{font:inherit;font-size:14px;max-width:110px;padding:4px;border:1px solid #d5d9d4;border-radius:6px;background:white;color:#24322e}.topbar{flex-wrap:wrap;gap:10px}
#relationship-editor{width:min(540px,94vw)}#relationship-editor label{display:block;margin:10px 0 4px;font-size:14px}#relationship-editor select,#relationship-editor input[type=number]{width:100%;padding:8px;font:inherit;border:1px solid #c7d2c8;border-radius:7px}#relationship-editor fieldset{border:0;padding:0;margin:12px 0}#relationship-editor .relation-check{display:flex;gap:8px;align-items:center}#relationship-editor .relation-check input{width:auto}#relation-refresh{margin-top:12px}

.member-sort-controls{display:flex;gap:12px;flex-wrap:wrap;margin:12px 0}.member-sort-controls label{display:grid;gap:5px;font-size:14px;flex:1;min-width:140px}.member-sort-controls select{width:100%;padding:9px}.member-dates{display:flex;flex-wrap:wrap;gap:6px 16px;font-size:14px;color:var(--muted);margin-top:8px}.member-date-note{font-size:13px;color:var(--muted);line-height:1.6}

/* Light surfaces for membership forms. */
#auth-dialog,.member-profile-panel{
 color-scheme:light;--panel:#fff;--text:#20212a;--muted:#606473;--border:#d5d8e1;
 background:#fff;color:#20212a;border:1px solid #d5d8e1;
}
#auth-dialog .account-content,.member-profile-panel .account-content{background:#fff;color:#20212a}
#auth-dialog p,.member-profile-panel p{color:#606473}
#auth-dialog label,.member-profile-panel label{color:#20212a}
#auth-dialog input,.member-profile-panel input,.member-profile-panel select{
 background:#fff;color:#20212a;border:1px solid #b9bfcc;font-size:16px;
}
#auth-dialog input::placeholder,.member-profile-panel input::placeholder{color:#747987}
#auth-dialog .account-button,#auth-dialog .icon-button,.member-profile-panel .account-button,.member-profile-panel .icon-button{background:#f3f4f8;color:#303442;border-color:#d5d8e1}
#auth-dialog .primary,.member-profile-panel .primary{background:#6940bc;border-color:#6940bc;color:#fff}
#auth-dialog .primary:hover,.member-profile-panel .primary:hover{background:#58329f}
#auth-dialog #auth-error,.member-profile-panel [role=alert]{color:#b42318}
