/* Shared dropdowns and overlays. Native interaction and focus behaviour stay intact. */
@supports (appearance:base-select){
  :root .filter-panel :is(#chapter,#type,#area),:root #calendarEditorForm select:not([multiple]){appearance:base-select;}
  :root body select:not([multiple]):not([size]),:root body select:not([multiple])[size="1"]{appearance:base-select;}
  select::picker(select){appearance:base-select;padding:6px;border:1px solid color-mix(in srgb,var(--text-primary) 8%,transparent);border-radius:16px;background:var(--surface-raised);color:var(--text-primary);box-shadow:var(--shadow-raised);font:400 14px/1.6 var(--font-ui);max-height:min(360px,60dvh);overflow:auto;overscroll-behavior:contain;}
  select::picker-icon{display:none;}
  select:not([multiple]):is(:not([size]),[size="1"]) option{display:flex;align-items:center;gap:12px;min-height:40px;padding:9px 12px;border-radius:10px;background:transparent;color:var(--text-primary);font:inherit;white-space:normal;overflow-wrap:anywhere;}
  select:not([multiple]):is(:not([size]),[size="1"]) option:hover,select:not([multiple]):is(:not([size]),[size="1"]) option:focus{background:var(--surface-2);outline:none;}
  select:not([multiple]):is(:not([size]),[size="1"]) option:checked{background:var(--accent-soft);color:var(--accent-blue);font-weight:500;}
  select:not([multiple]):is(:not([size]),[size="1"]) option::checkmark{order:1;margin-inline-start:auto;color:var(--accent-blue);font-size:14px;}
  select:not([multiple]):is(:not([size]),[size="1"]) option:disabled{color:var(--text-muted);opacity:.55;}
  select:not([multiple]):is(:not([size]),[size="1"]) optgroup{padding:6px 0;font-weight:500;}
}
/* Dialogs share surface, edge, shadow, backdrop and action spacing. */
:root:has(dialog:modal,.modal-backdrop:not([hidden])){overflow:hidden;}
:root body :is(dialog,.modal-backdrop>.modal){color:var(--text-primary);background:var(--surface-raised);border:1px solid color-mix(in srgb,var(--text-primary) 8%,transparent);border-radius:24px;box-shadow:var(--shadow-raised);max-width:calc(100vw - 32px);max-height:calc(100dvh - 48px);}
:root body :is(dialog,.modal-backdrop>.modal){overscroll-behavior:contain;scroll-padding-block:16px;}
body.guest-mode.login-open .login-screen,body.password-change-required .password-change-screen{height:100dvh;min-height:0;overflow-y:auto;overscroll-behavior:contain;align-content:start;align-content:safe center;}
:root body dialog::backdrop{background:#0c0c314d;backdrop-filter:blur(4px);}
:root body .modal-backdrop{background:#0c0c314d;backdrop-filter:blur(4px);padding:24px;}
body.authenticated :is(.modal-actions,.brand-asset-dialog-actions){display:flex;justify-content:flex-end;align-items:center;flex-wrap:wrap;gap:8px;margin-top:24px;}
body.authenticated :is(dialog,.modal) h2{font-size:22px;font-weight:500;line-height:1.5;}
body.authenticated :is(.modal,.brand-asset-dialog) :is(p,label,small){line-height:1.8;}
body.authenticated :is(.brand-asset-dialog,.image-history-dialog){padding:24px;}
body.authenticated .brand-asset-dialog form{gap:16px;}
body.authenticated .brand-asset-dialog :is(input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),select,textarea){border:1px solid transparent;border-radius:16px;background-color:var(--surface-2);color:var(--text-primary);font:400 14px/1.6 var(--font-ui);min-height:44px;padding:10px 14px;}
body.authenticated .brand-asset-dialog select:not([multiple]){padding-right:44px;}
body.authenticated .brand-asset-dialog :is(input,textarea,select):focus{outline:none;border-color:var(--border-strong);box-shadow:none;}
/* Floating assistant: the same calm surfaces as the rest of the workspace. */
body.authenticated #ask.assistant-drawer{inset:auto 24px 24px auto;width:min(460px,calc(100vw - 48px));height:min(720px,calc(100dvh - 48px));min-height:0;border:1px solid color-mix(in srgb,var(--text-primary) 8%,transparent);border-radius:24px;background:var(--surface-raised);box-shadow:var(--shadow-raised);backdrop-filter:none;}
body.authenticated #ask.assistant-drawer .ask-panel{background:var(--surface-raised);padding:0;border:0;border-radius:inherit;}
body.authenticated #ask.assistant-drawer .assistant-drawer-heading{display:grid;grid-template-columns:minmax(0,1fr) repeat(3,36px);gap:8px;min-height:0;padding:18px 20px 14px;background:var(--surface-raised);backdrop-filter:none;border-bottom:1px solid color-mix(in srgb,var(--text-primary) 6%,transparent);}
body.authenticated #ask .assistant-drawer-identity{grid-column:1;grid-row:1;gap:10px;}
body.authenticated #ask .assistant-drawer-identity h2{font-size:16px;font-weight:500;line-height:1.5;}
body.authenticated #ask .assistant-drawer-identity small{font-size:11px;line-height:1.5;}
body.authenticated #ask .assistant-drawer-heading .heading-actions{display:contents;}
body.authenticated #ask .assistant-drawer-heading .icon-button{width:36px;height:36px;min-height:36px;min-width:36px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--text-secondary);display:grid;grid-template:1fr / 1fr;place-items:center;}
body.authenticated #ask .assistant-drawer-heading .icon-button:hover{background:var(--surface-2);}
body.authenticated #ask .assistant-drawer-heading .icon-button svg{width:18px;height:18px;}
body.authenticated #askContextToggle{grid-column:2;grid-row:1;}
body.authenticated #clearChatBtn{grid-column:3;grid-row:1;}
body.authenticated #closeAskDrawer{grid-column:4;grid-row:1;}
body.authenticated #ask #aiStatusBadge{grid-column:1/-1;grid-row:2;justify-self:start;max-width:100%;font-size:11px;font-weight:400;padding:4px 8px;}
body.authenticated #ask.assistant-drawer .chat-window{padding:20px;gap:20px;background:var(--surface-raised);background-image:none;border:0;border-radius:0;}
body.authenticated #ask.assistant-drawer .message{max-width:100%;font-size:14px;line-height:1.85;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;}
body.authenticated #ask.assistant-drawer .message.user{justify-self:end;max-width:90%;padding:12px 16px;background:var(--accent-soft);border-radius:18px;color:var(--text-primary);}
body.authenticated #ask .assistant-identity{margin-bottom:12px;gap:8px;}
body.authenticated #ask .assistant-identity strong{font-size:13px;font-weight:500;}
body.authenticated #ask .assistant-identity small{font-size:11px;color:var(--text-muted);}
body.authenticated #ask .xiaoyi-avatar{width:30px;height:30px;min-width:30px;border:0;background:url('../eo-brand-mark.svg') center/contain no-repeat;font-size:0;box-shadow:none;}
body.authenticated #ask.assistant-drawer .ask-form.unified-chat-composer{grid-template-columns:36px minmax(0,1fr) 36px;column-gap:8px;margin:8px 16px 16px;padding:8px;min-height:52px;border:0;border-radius:28px;background:var(--surface-2);box-shadow:none;backdrop-filter:none;}
body.authenticated #ask.assistant-drawer .ask-form.unified-chat-composer textarea{font-size:14px;line-height:24px;min-height:24px;max-height:144px;color:var(--text-primary);}
body.authenticated #ask .chat-attach-button{width:36px;height:36px;min-width:36px;min-height:36px;padding:0;border:0;background:transparent;display:grid;grid-template:1fr / 1fr;place-items:center;}
body.authenticated #ask .chat-attach-button svg{width:20px;height:20px;}
body.authenticated #ask.assistant-drawer .ask-form.unified-chat-composer>.primary-button{width:36px;height:36px;min-width:36px;min-height:36px;}
body.authenticated #ask.assistant-drawer .ask-form.unified-chat-composer>.primary-button svg{width:20px;height:20px;}
body.authenticated #ask.assistant-drawer .source-panel{background:var(--surface-raised);border-color:var(--border-subtle);box-shadow:var(--shadow-raised);}
body.authenticated #ask .source-note{background:var(--surface-2);border:0;border-radius:16px;color:var(--text-secondary);}
body.authenticated .brand-asset-management-menu>div{border:1px solid var(--border-subtle);border-radius:16px;padding:6px;background:var(--surface-raised);box-shadow:var(--shadow-raised);}
body.authenticated .brand-asset-management-menu>div>button{min-height:40px;padding:8px 12px;border:0;border-radius:10px;text-align:left;}
@media(max-width:780px){:root body :is(dialog,.modal-backdrop>.modal){max-height:calc(100dvh - 32px);}:root body .modal-backdrop{padding:16px;}body.authenticated :is(.brand-asset-dialog,.image-history-dialog){padding:20px;}body.authenticated #ask.assistant-drawer{inset:auto 12px 12px;width:calc(100vw - 24px);height:min(680px,calc(100dvh - 24px));border-radius:24px;}body.authenticated #ask.assistant-drawer .assistant-drawer-heading{padding:16px;gap:6px;grid-template-columns:minmax(0,1fr) repeat(3,36px);}body.authenticated #ask.assistant-drawer .chat-window{padding:16px;}body.authenticated #ask.assistant-drawer .ask-form.unified-chat-composer{margin:8px 12px 12px;}body.authenticated #ask .assistant-drawer-identity small{display:none;}body.authenticated .brand-asset-dialog :is(input,select,textarea){font-size:16px;}}

select option[hidden]{display:none;}
body.authenticated .organization-picker-menu{min-width:0;padding:6px;border:1px solid color-mix(in srgb,var(--text-primary) 8%,transparent);border-radius:16px;background:var(--surface-raised);box-shadow:var(--shadow-raised);}
body.authenticated .organization-picker-head{padding:10px 8px;border-color:var(--border-subtle);}
body.authenticated .organization-picker-option{min-height:40px;gap:10px;padding:9px 12px;border-radius:10px;font-size:13px;line-height:1.6;}
body.authenticated .organization-picker-option:has(input:checked){background:var(--accent-soft);color:var(--accent-blue);}
body.authenticated .organization-picker-option:hover{background:var(--surface-2);}
body.authenticated .organization-picker-trigger{border:0;border-radius:16px;background:var(--surface-2);padding:12px 16px;}
body.authenticated .organization-picker-clear{border:0;border-radius:999px;background:var(--surface-2);}
body.authenticated #ask .chat-add-image{width:36px;height:36px;min-width:36px;min-height:36px;padding:0;border:0;background:transparent;font:300 26px/1 var(--font-ui);color:var(--text-secondary);display:grid;place-items:center;}
:root .month-picker-panel{box-sizing:border-box;max-height:min(420px,calc(100dvh - 80px));overflow-y:auto;overscroll-behavior:contain;border:1px solid var(--border-subtle);border-radius:16px;background:var(--surface-raised);box-shadow:var(--shadow-raised);}
/* The same personal centre is used from public pages and the workspace. */
body #guestProfileBtn{display:grid;grid-template:1fr / 1fr;place-items:center;width:44px;height:44px;min-width:44px;min-height:44px;padding:0;gap:0;border:0;border-radius:50%;background:var(--accent-blue);color:var(--on-accent);box-shadow:none;}
body #guestProfileBtn #guestUserAvatar{display:grid;place-items:center;width:44px;height:44px;border:0;border-radius:50%;background:transparent;color:var(--on-accent);font-size:13px;font-weight:500;letter-spacing:.02em;box-shadow:none;}
body #guestProfileBtn :is(.guest-user-copy,.guest-profile-chevron){display:none;}
body #guestWorkbenchBtn{display:grid;grid-template:1fr / 1fr;place-items:center;width:44px;height:44px;min-width:44px;min-height:44px;padding:0;border:0;border-radius:50%;background:var(--surface-1);color:var(--text-primary);box-shadow:none;}
body #guestWorkbenchBtn>span{display:none;}
body #guestWorkbenchBtn>.lucide{width:20px;height:20px;}
body .guest-session-cluster{gap:0;padding:0;background:transparent;border:0;}
body #guestSignedInActions{gap:8px;align-items:center;}
body #selfAccountDialog{width:min(680px,calc(100vw - 32px));padding:0;max-height:calc(100dvh - 32px);overflow:auto;color:var(--text-primary);background:var(--surface-raised);border:1px solid var(--border-subtle);border-radius:24px;}
body #selfAccountDialog .account-dialog-header{padding:24px;gap:16px;border-color:var(--border-subtle);}
body #selfProfileTitle{font-size:22px;font-weight:500;}
body #selfAccountDialog .account-dialog-header>button{width:36px;height:36px;min-width:36px;display:grid;grid-template:1fr / 1fr;place-items:center;padding:0;border:0;border-radius:50%;background:var(--surface-2);}
body #selfAccountDialog .account-dialog-header>button svg{width:18px;height:18px;}
body #selfProfileForm{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;padding:24px 24px 0;}
body #selfProfileForm>label{display:grid;gap:8px;min-width:0;color:var(--text-secondary);font-size:13px;}
body #selfProfileForm input{box-sizing:border-box;width:100%;min-width:0;min-height:44px;padding:10px 14px;border:1px solid transparent;border-radius:16px;color:var(--text-primary);background:var(--surface-2);font:400 14px/1.6 var(--font-ui);box-shadow:none;}
body #selfProfileForm input[readonly]{color:var(--text-muted);background:transparent;padding-left:0;}
body #selfProfileForm input:focus{outline:none;border-color:var(--border-strong);}
body #selfProfileForm [hidden]{display:none;}
body #selfProfileForm .self-membership-info{grid-column:1/-1;font-size:12px;color:var(--text-muted);}
body #selfProfileForm .self-membership-info p{font-size:13px;line-height:1.8;margin:8px 0 0;}
body #selfProfileForm .account-dialog-footer{grid-column:1/-1;background:var(--surface-raised);border-color:var(--border-subtle);}
body #selfProfileForm :is(.primary-button,.text-button){border-radius:999px;min-height:44px;padding:0 20px;font-size:13px;border:0;}
body #selfProfileForm .primary-button{background:var(--accent-blue);color:var(--on-accent);}
body #selfProfileStatus{font-size:13px;line-height:1.6;}
body #selfProfileStatus.is-success{color:var(--status-success);}
body #selfProfileStatus.is-error{color:var(--status-danger);}
@media(max-width:780px){body.guest-mode #accountPopover{position:fixed;top:84px;left:16px;right:16px;width:auto;max-width:none;max-height:calc(100dvh - 100px);}body #selfProfileForm{grid-template-columns:1fr;gap:16px;padding:20px 20px 0;}body #selfProfileForm input{font-size:16px;}body #selfAccountDialog .account-dialog-header{padding:20px;}}

body #selfProfileForm .self-membership-info{overflow-wrap:anywhere;}

/* Stacked previews and upload forms scroll as one modal on small viewports. */
@media(max-width:780px),(max-height:560px){
  body.authenticated .document-detail-modal{height:auto;grid-template-rows:auto auto auto;overflow-y:auto;}
  body.authenticated .document-detail-layout{grid-template-columns:minmax(0,1fr);}
  body.authenticated :is(.document-original-preview,.document-parsed-content){min-height:140px;max-height:min(480px,55dvh);}
  body.authenticated .brand-asset-upload-modal{height:auto;overflow-y:auto;}
  body.authenticated .brand-asset-upload-modal .brand-asset-workflow-form{height:auto;grid-template-rows:auto auto auto;}
  body.authenticated .brand-asset-upload-body{overflow:visible;}
}
