:root{font-family:Segoe UI,Tahoma,Arial,sans-serif;color:#222;background:#ececec;font-size:13px}*{box-sizing:border-box}body{margin:0}button,select,input{font:inherit}button{cursor:pointer;border:1px solid transparent;background:transparent;color:inherit;border-radius:3px;padding:5px 8px}button:hover{background:#dbe9fb;border-color:#a8c7ef}button:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid #4389d3;outline-offset:1px}#app{height:100dvh;min-height:360px;display:flex;flex-direction:column}.titlebar{height:38px;background:#fff;border-bottom:1px solid #d3d3d3;display:flex;align-items:center;justify-content:space-between;padding:0 12px}.brand{display:flex;align-items:center;gap:7px}.mascot{background:#79bb40;color:#fff;font-size:19px;border-radius:4px;padding:0 5px}.subtitle{color:#777}.menubar{height:30px;background:#fafafa;display:flex;align-items:center;border-bottom:1px solid #ddd;padding-left:5px}.menubar button{padding:5px 10px}.toolbar{min-height:42px;display:flex;align-items:center;gap:4px;padding:4px 8px;background:#f7f7f7;border-bottom:1px solid #ccc;flex-wrap:wrap}.toolbar button{border-color:#ddd;background:#fff}.toolbar .separator{height:22px;border-left:1px solid #ccc;margin:0 5px}.language-label{margin-left:auto;color:#555}select{background:#fff;border:1px solid #bbb;padding:5px;max-width:150px}.tabs{display:flex;background:#e3e3e3;min-height:34px;overflow-x:auto;align-items:end;gap:2px;padding:3px 4px 0}.tab{white-space:nowrap;display:flex;align-items:center;gap:8px;background:#d3d3d3;border:1px solid #bbb;border-bottom:0;padding:7px 9px;border-radius:5px 5px 0 0;max-width:230px}.tab.active{background:#fff;border-top:3px solid #77b63e;padding-top:5px}.tab-name{overflow:hidden;text-overflow:ellipsis}.tab-close{padding:0 4px;color:#666}.workspace{flex:1;min-height:0;background:#fff}.editor-shell{height:100%;display:flex;overflow:hidden}.gutter{flex:0 0 54px;overflow:hidden;text-align:right;padding:12px 10px 60px 4px;white-space:pre;font:14px/21px Consolas,'Courier New',monospace;background:#f5f5f5;color:#858585;border-right:1px solid #ddd;user-select:none}.code-area{position:relative;flex:1;min-width:0;overflow:hidden}#editor,#highlight{position:absolute;inset:0;margin:0;padding:12px 16px 60px;white-space:pre;tab-size:4;font:14px/21px Consolas,'Courier New',monospace;letter-spacing:0;border:0;outline:0;overflow:auto;width:100%;height:100%}#editor{resize:none;background:transparent;color:transparent;caret-color:#222;-webkit-text-fill-color:transparent;z-index:2}#editor::selection{background:#9ac4f988;-webkit-text-fill-color:transparent}#highlight{z-index:1;pointer-events:none;color:#252525}#highlight .keyword{color:#064ba2;font-weight:600}#highlight .string{color:#ad4b15}#highlight .comment{color:#648c4c}#highlight .number{color:#ad2a86}#highlight .tag{color:#174ca3}#highlight .attr{color:#c04532}.statusbar{min-height:27px;background:#f1f1f1;border-top:1px solid #ccc;display:flex;gap:0;align-items:center;overflow:hidden}.statusbar span{padding:4px 11px;border-right:1px solid #d2d2d2;white-space:nowrap}.statusbar span:first-child{flex:1;overflow:hidden;text-overflow:ellipsis}.search-panel{padding:8px;display:flex;align-items:center;gap:8px;flex-wrap:wrap;background:#eef3f9;border-bottom:1px solid #b9c9dd}.search-panel[hidden],.search-panel [hidden]{display:none}.search-panel input:not([type=checkbox]){width:170px;padding:6px;border:1px solid #aaa}.search-panel button{background:#fff;border:1px solid #bbb}.search-panel small{color:#526075}.check{white-space:nowrap}dialog{border:1px solid #aaa;border-radius:8px;max-width:430px;box-shadow:0 15px 60px #0004;padding:25px}dialog::backdrop{background:#0006}body.dark{color:#ddd;background:#20242b}body.dark .titlebar,body.dark .menubar,body.dark .toolbar,body.dark .statusbar,body.dark .tabs,body.dark .search-panel{background:#292e35;border-color:#414852}body.dark .tab{background:#333943;border-color:#555}body.dark .tab.active{background:#1d2229}body.dark .workspace{background:#1d2229}body.dark .gutter{background:#242a32;border-color:#414852;color:#8993a0}body.dark #highlight{color:#e0e4e8}body.dark #editor{caret-color:#fff}body.dark #highlight .keyword{color:#78b4ff}body.dark #highlight .string{color:#e7a46d}body.dark #highlight .comment{color:#8cae78}body.dark #highlight .number{color:#df9ae5}body.dark #highlight .tag{color:#81c0f6}body.dark #highlight .attr{color:#f3a68c}body.dark .toolbar button,body.dark .search-panel button,body.dark select,body.dark dialog{background:#333943;color:#eee;border-color:#505b68}body.dark button:hover{background:#445268}body.dark .subtitle,body.dark .language-label{color:#b6bdc8}@media(max-width:650px){.subtitle,.toolbar button span,.language-label{display:none}.toolbar{gap:2px}.toolbar button{padding:6px}.statusbar span{padding:4px 6px}.statusbar span:nth-child(3),.statusbar span:nth-child(5){display:none}.gutter{flex-basis:42px;padding-right:7px}#editor,#highlight{padding-left:9px}.search-panel input:not([type=checkbox]){width:120px}}

[hidden]{display:none!important} .auth-screen{min-height:100vh;display:grid;place-items:center;background:#e8ecf2;padding:20px}.auth-card{width:min(430px,100%);padding:28px;background:white;border:1px solid #cbd3df;border-radius:10px;box-shadow:0 12px 40px #0002}.auth-card h1{margin:0 0 8px}.auth-card p{color:#526075}.auth-card form,.auth-card label{display:grid;gap:7px}.auth-card form{gap:15px}.auth-card input{width:100%;padding:11px;border:1px solid #aab5c2;border-radius:5px}.auth-card button{padding:10px;cursor:pointer}.auth-tabs{display:flex;gap:8px;margin:18px 0}.auth-tabs button{flex:1}.auth-tabs .selected,#authSubmit{background:#2173b9;color:white;border:0;border-radius:5px}.header-actions{display:flex;align-items:center;gap:8px}.sidebar{width:230px;min-width:180px;border-right:1px solid #bbc3cf;background:#f3f5f8;overflow:auto;padding:10px}.side-title{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}.sidebar button{cursor:pointer}.sidebar .file{display:block;width:100%;text-align:left;border:0;background:transparent;padding:8px 5px;overflow-wrap:anywhere}.sidebar .file:hover,.sidebar .file.active{background:#d9e8f6}.sidebar .person{border-top:1px solid #c5cbd3;padding:8px 0;overflow-wrap:anywhere}.sidebar #admin{margin-top:20px}.workspace .editor-shell{flex:1;min-width:0}#toast{position:fixed;right:18px;bottom:38px;background:#202c3c;color:white;padding:12px 16px;border-radius:6px;z-index:50;display:none;max-width:340px}body.dark .sidebar{background:#292e35;color:#eee;border-color:#414852}body.dark .sidebar .file{color:#eee}body.dark .sidebar .file:hover,body.dark .sidebar .file.active{background:#445268}@media(max-width:700px){.sidebar{width:160px;min-width:140px}.header-actions #accountName{display:none}}

/* Painel lateral do chat, mantendo a interface clássica do editor */
.chat-panel{width:330px;min-width:260px;max-width:45vw;display:flex;flex-direction:column;background:#f6f7f9;border-left:1px solid #bfc6ce;min-height:0}.chat-heading{padding:10px;display:flex;justify-content:space-between;align-items:center;background:#e6ebf0;border-bottom:1px solid #c7cdd5}.chat-rooms{padding:9px;display:flex;flex-wrap:wrap;gap:5px;align-items:center}.chat-rooms select{flex:1;min-width:125px}.chat-rooms .selected{background:#d3e7fa;border-color:#8cb7e0}.chat-online{padding:4px 10px;color:#506477;font-size:12px;border-bottom:1px solid #ddd}.chat-messages{flex:1;min-height:0;overflow-y:auto;padding:10px;display:flex;flex-direction:column;gap:10px}.chat-msg{padding:8px 10px;border:1px solid #d3d8df;border-radius:8px;background:white;overflow-wrap:anywhere}.chat-msg.mine{background:#e8f3e5;border-color:#bdd8b8}.chat-meta{font-size:11px;color:#637083;margin-bottom:5px}.chat-body{white-space:pre-wrap;line-height:1.4}.chat-delete{font-size:11px;color:#9b3333;padding:3px;margin-top:4px}.chat-compose{display:flex;gap:5px;padding:9px;border-top:1px solid #d2d8df}.chat-compose textarea{resize:vertical;min-height:48px;flex:1;min-width:0;padding:7px;border:1px solid #aab3bf;border-radius:4px;font:inherit}.chat-compose button{background:#dbead6;border:1px solid #aac59f}.chat-hint{padding:0 9px 8px;color:#677282}body.dark .chat-panel{background:#292e35;border-color:#414852}body.dark .chat-heading{background:#343b45;border-color:#414852}body.dark .chat-msg{background:#343b45;border-color:#515c69}body.dark .chat-msg.mine{background:#304b3b}body.dark .chat-meta,body.dark .chat-online,body.dark .chat-hint{color:#b4bdc9}body.dark .chat-compose textarea{background:#1d2229;color:#eee;border-color:#505b68}@media(max-width:800px){.chat-panel{width:280px;min-width:220px;max-width:70vw}}@media(max-width:520px){.chat-panel{position:absolute;right:0;top:0;bottom:0;z-index:10;width:min(350px,95vw);max-width:none;box-shadow:-4px 0 20px #0003}.workspace{position:relative}}

/* Respeita o atributo hidden mesmo em painéis com display flex/grid. */
[hidden]{display:none!important}
.workspace{display:flex;min-width:0;overflow:hidden}
.workspace .editor-shell{min-width:0;flex:1}

/* V3: pré-visualização isolada sem interferir nas abas ou no chat */
.preview-panel{width:min(48%,680px);min-width:260px;display:flex;flex-direction:column;min-height:0;border-left:1px solid #bac2ca;background:#f6f7f9}.preview-heading{display:flex;align-items:center;gap:6px;padding:7px;border-bottom:1px solid #cbd1d9}.preview-heading b{flex:1}.preview-heading select{max-width:125px}.preview-content{flex:1;min-height:0;display:flex;justify-content:center;align-items:stretch;padding:8px;overflow:hidden}.preview-content iframe{width:100%;height:100%;background:white;border:1px solid #ccc}.preview-panel.mobile .preview-content iframe{max-width:390px}.preview-note{padding:6px 9px;font-size:11px;color:#626e79;border-top:1px solid #ddd}body.dark .preview-panel{background:#292e35;border-color:#414852}body.dark .preview-heading,body.dark .preview-note{border-color:#414852;color:#bec8d4}@media(max-width:800px){.preview-panel{width:48%;min-width:200px}}@media(max-width:600px){.preview-panel{position:absolute;inset:0;z-index:9;width:100%;min-width:0}.workspace{position:relative}}

/* Garantir que os painéis ocultos não ocupem espaço. */
[hidden]{display:none!important}

/* Correção pontual de contraste dos botões do chat no tema escuro. */
body.dark #chatGeneral,
body.dark .chat-compose button {
  color: #f8fafc;
  -webkit-text-fill-color: #f8fafc;
  background: #354354;
  border: 1px solid #728197;
}
body.dark #chatGeneral.selected {
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
  background: #245b91;
  border-color: #79b8f3;
}
body.dark .chat-compose button {
  background: #24663e;
  border-color: #61ad7b;
}
body.dark #chatGeneral:hover,
body.dark #chatGeneral:focus-visible {
  background: #376b9e;
  color: #ffffff;
}
body.dark .chat-compose button:hover,
body.dark .chat-compose button:focus-visible {
  background: #32834f;
  color: #ffffff;
}


/* V3.4: cores dos botões Geral e Enviar em ambos os temas. */
#chatGeneral {
  background: #2563eb;
  border: 1px solid #1d4ed8;
  color: #fff;
  -webkit-text-fill-color: #fff;
  font-weight: 600;
}
#chatGeneral.selected, #chatGeneral:hover, #chatGeneral:focus-visible {
  background: #1d4ed8;
  border-color: #1e40af;
  color: #fff;
  -webkit-text-fill-color: #fff;
}
.chat-compose button {
  background: #16a34a;
  border: 1px solid #15803d;
  color: #fff;
  -webkit-text-fill-color: #fff;
  font-weight: 600;
}
.chat-compose button:hover, .chat-compose button:focus-visible {
  background: #15803d;
  color: #fff;
  -webkit-text-fill-color: #fff;
}
body.dark #chatGeneral, body.dark #chatGeneral.selected {
  background: #3b82f6;
  border-color: #60a5fa;
  color: #fff;
  -webkit-text-fill-color: #fff;
}
body.dark #chatGeneral:hover, body.dark #chatGeneral:focus-visible {
  background: #2563eb;
  color: #fff;
  -webkit-text-fill-color: #fff;
}
body.dark .chat-compose button {
  background: #15803d;
  border-color: #22c55e;
  color: #fff;
  -webkit-text-fill-color: #fff;
}
body.dark .chat-compose button:hover, body.dark .chat-compose button:focus-visible {
  background: #166534;
  color: #fff;
  -webkit-text-fill-color: #fff;
}

/* V3.6 — cores explícitas para o chat, em ambos os temas. */
body:not(.dark) #chatGeneral {background:#2563eb!important;border:1px solid #1d4ed8!important;color:#fff!important;-webkit-text-fill-color:#fff!important;font-weight:600}
body:not(.dark) #chatGeneral:hover,body:not(.dark) #chatGeneral.selected,body:not(.dark) #chatGeneral:focus-visible {background:#1d4ed8!important;color:#fff!important;-webkit-text-fill-color:#fff!important}
body:not(.dark) #chatForm button[type="submit"] {background:#16a34a!important;border:1px solid #15803d!important;color:#fff!important;-webkit-text-fill-color:#fff!important;font-weight:600}
body:not(.dark) #chatForm button[type="submit"]:hover,body:not(.dark) #chatForm button[type="submit"]:focus-visible {background:#15803d!important;color:#fff!important;-webkit-text-fill-color:#fff!important}
body.dark #chatGeneral {background:#3b82f6!important;border:1px solid #60a5fa!important;color:#fff!important;-webkit-text-fill-color:#fff!important;font-weight:600}
body.dark #chatGeneral:hover,body.dark #chatGeneral.selected,body.dark #chatGeneral:focus-visible {background:#2563eb!important;color:#fff!important;-webkit-text-fill-color:#fff!important}
body.dark #chatForm button[type="submit"] {background:#15803d!important;border:1px solid #22c55e!important;color:#fff!important;-webkit-text-fill-color:#fff!important;font-weight:600}
body.dark #chatForm button[type="submit"]:hover,body.dark #chatForm button[type="submit"]:focus-visible {background:#166534!important;color:#fff!important;-webkit-text-fill-color:#fff!important}

/* Editte: identidade visual. Alterações restritas à marca e elementos de identidade. */
.editte-header-icon{width:30px;height:30px;display:block;flex-shrink:0;border-radius:7px}
.brand b{font-size:15px;letter-spacing:.15px;color:#1260a7}
body.dark .brand b{color:#79c9ff}
.editte-auth-brand{display:flex;justify-content:center;align-items:center;margin:0 0 16px}
.editte-auth-brand img{width:min(230px,100%);height:auto;display:block}
.auth-card{border-top:4px solid #17a864}
.auth-tabs .selected,#authSubmit{background:#1665bb;color:#fff}
.auth-tabs .selected:hover,#authSubmit:hover{background:#0f4d92;color:#fff}
body.dark .auth-screen{background:#161f2a}
body.dark .auth-card{background:#283341;color:#f1f5f9;border-color:#475569}
body.dark .auth-card p{color:#c6d0dc}
body.dark .auth-card input{background:#192534;color:#f1f5f9;border-color:#64748b}

/* Marca Editte no lugar do lápis original */
.brand .mascot{display:inline-flex;align-items:center;justify-content:center;background:transparent!important;padding:0!important;border-radius:6px;line-height:1;flex-shrink:0}
.brand .mascot img{display:block;width:27px;height:27px;object-fit:contain}

/* Editte: remove completamente o fundo do antigo mascote */
.titlebar .brand .mascot, body.dark .titlebar .brand .mascot {background:none!important;background-color:transparent!important;background-image:none!important;box-shadow:none!important;border:0!important;outline:0!important;padding:0!important;width:30px;height:30px;display:inline-flex;align-items:center;justify-content:center;}
.titlebar .brand .mascot img {display:block;width:27px;height:27px;max-width:none;object-fit:contain;background:transparent!important;border:0!important;box-shadow:none!important;}

/* Editte chat: incremental improvements without modifying editor layout */
.chat-unread:not([hidden]){display:inline-block;min-width:18px;padding:1px 5px;margin-left:4px;border-radius:12px;background:#e33b48;color:#fff;font-size:11px;font-weight:700;text-align:center}
#chatSound{border:0;background:transparent;color:inherit;cursor:pointer;font-size:17px;margin-left:auto;margin-right:7px}
.chat-msg{position:relative;padding-left:35px}
.chat-avatar{position:absolute;left:0;top:3px;width:27px;height:27px;border-radius:50%;display:grid;place-items:center;background:#2268b7;color:#fff;font-size:13px;font-weight:700;line-height:1}
.chat-msg.mine .chat-avatar{background:#24915e}

/* Editte: fotos opcionais de perfil */
#profileButton{display:flex;align-items:center;gap:7px;border:0;background:transparent;color:inherit;cursor:pointer;font:inherit;padding:3px 5px;max-width:200px}
#profileButton:hover{opacity:.85}
.profile-avatar,.profile-preview{display:grid;place-items:center;overflow:hidden;border-radius:50%;background:#2268b7;color:#fff;font-weight:700;flex-shrink:0}
.profile-avatar{width:29px;height:29px;font-size:13px}
.profile-preview{width:96px;height:96px;margin:10px auto;font-size:38px}
.profile-avatar img,.profile-preview img,.chat-avatar img{width:100%;height:100%;object-fit:cover;display:block}
.profile-dialog{border:1px solid #8d9bad;border-radius:10px;padding:22px;max-width:min(380px,90vw);background:#fff;color:#202b39}
.profile-dialog::backdrop{background:#0008}
.profile-dialog button{padding:8px;margin:4px;cursor:pointer}
body.dark .profile-dialog{background:#252b35;color:#fff}
@media(max-width:700px){#profileButton #accountName{display:none}}

/* Editte: botões padronizados na janela de foto de perfil */
.profile-dialog #avatarChoose,.profile-dialog #avatarRemove,.profile-dialog #profileClose{border:1px solid transparent;border-radius:6px;padding:9px 13px;font-weight:600;color:#fff;cursor:pointer;transition:background-color .15s ease}
.profile-dialog #avatarChoose{background:#1665bb;border-color:#1665bb}
.profile-dialog #avatarChoose:hover{background:#0f4d92}
.profile-dialog #avatarRemove{background:#20965c;border-color:#20965c}
.profile-dialog #avatarRemove:hover{background:#167646}
.profile-dialog #profileClose{background:#1665bb;border-color:#1665bb}
.profile-dialog #profileClose:hover{background:#0f4d92}
body.dark .profile-dialog #avatarChoose,body.dark .profile-dialog #profileClose{background:#1665bb;color:#fff}
body.dark .profile-dialog #avatarRemove{background:#20965c;color:#fff}
.profile-dialog p{font-size:12px;text-align:center;opacity:.8}

/* Editte: manter fotos de perfil circulares no chat geral e privado. */
.chat-avatar {
  border-radius: 50%;
  overflow: hidden;
}
.chat-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* Editte: perfis e selos, mantendo o tema existente. */
.editte-profile-dialog{width:min(460px,calc(100vw - 28px));max-height:85vh;overflow:auto;border-radius:12px;padding:22px;color:var(--text,#222);background:var(--panel,#fff)}
.editte-profile-dialog::backdrop{background:#0009}
.editte-profile-dialog h3{margin:0 0 12px}
.editte-profile-dialog label{display:block;margin:8px 0;font-size:13px}
.editte-profile-dialog input:not([type=checkbox]),.editte-profile-dialog textarea{display:block;width:100%;box-sizing:border-box;margin-top:4px;padding:8px;border-radius:6px;border:1px solid #999;background:transparent;color:inherit}
.profile-fields{display:grid;grid-template-columns:1fr 1fr;gap:0 12px}
.profile-checks{display:grid;grid-template-columns:1fr 1fr;gap:2px 10px}
.profile-checks label{display:flex;align-items:center;gap:6px}
.profile-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:16px}
.profile-actions button,.profile-dialog #profileEdit{border:0;border-radius:6px;background:#1665bb;color:#fff;padding:9px 13px;font-weight:600;cursor:pointer}
.profile-actions .ep-primary{background:#20965c}
.profile-hint{font-size:12px;opacity:.75}
.public-profile-top{display:flex;align-items:center;gap:14px;margin-bottom:12px}
.public-profile-top h3{margin:0 0 4px}
.public-profile-avatar{display:grid;place-items:center;width:70px;height:70px;min-width:70px;border-radius:50%;overflow:hidden;background:#1665bb;color:white;font-size:30px}
.public-profile-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%}
.public-profile-badges{display:flex;gap:6px;flex-wrap:wrap;margin:12px 0}
.editte-badge{border:1px solid #77a7d7;background:rgba(40,110,190,.1);border-radius:99px;padding:4px 9px;font-size:12px}
.profile-clickable{cursor:pointer}
.chat-avatar.profile-clickable:hover{outline:2px solid #20965c}
.admin-badge-actions{display:flex;gap:4px;flex-wrap:wrap;margin:6px 0 10px}
.admin-badge-actions button{font-size:11px;padding:4px 6px}
.admin-badge-actions button.badge-on{background:#20965c;color:#fff}
@media(max-width:440px){.profile-fields,.profile-checks{grid-template-columns:1fr}}

/* Indicador verde ao lado de Geral no chat */
#chatGeneral .editte-geral-dot{display:inline-block;width:8px;height:8px;min-width:8px;border-radius:50%;background:#4ade80;vertical-align:middle;margin-left:5px;box-shadow:0 0 0 2px rgba(74,222,128,.15)}

/* Painel administrativo acessível pelo perfil, sem ocupar Meus arquivos */
#adminDialog{width:min(650px,calc(100vw - 28px))}
#adminDialog #usersButton{background:#1665bb;color:#fff;border:0;border-radius:6px;padding:9px 13px;font-weight:600;cursor:pointer}
#adminDialog .person{border-top:1px solid #c5cbd3;padding:10px 0;overflow-wrap:anywhere}
#adminDialog #users{margin-top:12px;max-height:50vh;overflow:auto}
#adminDialog .person button{cursor:pointer}
.profile-dialog #profileAdmin{border:0;border-radius:6px;background:#20965c;color:#fff;padding:9px 13px;font-weight:600;cursor:pointer}

/* Apenas posicionamento dos botoes de Minha foto de perfil. */
.profile-dialog .editte-profile-button-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;align-items:stretch}
.profile-dialog .editte-profile-button-grid>button{box-sizing:border-box;margin:0;width:100%;min-width:0;white-space:normal}
.profile-dialog .editte-profile-button-grid>#avatarChoose{grid-column:1;grid-row:1}
.profile-dialog .editte-profile-button-grid>#avatarRemove{grid-column:1;grid-row:2}
.profile-dialog .editte-profile-button-grid>#profileClose{grid-column:2;grid-row:1}
.profile-dialog .editte-profile-button-grid>#profileEdit{grid-column:2;grid-row:2}
.profile-dialog .editte-profile-button-grid>#profileAdmin[hidden]{display:none!important}
.profile-dialog:has(#profileAdmin:not([hidden])) .editte-profile-button-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
.profile-dialog:has(#profileAdmin:not([hidden])) #profileEdit{grid-column:2;grid-row:1}
.profile-dialog:has(#profileAdmin:not([hidden])) #profileAdmin{grid-column:2;grid-row:2}
.profile-dialog:has(#profileAdmin:not([hidden])) #profileClose{grid-column:3;grid-row:1 / span 2;align-self:center}

/* Ajuste exclusivo do administrador: largura suficiente para textos em uma linha.
   A grade de usuarios comuns permanece exatamente igual. */
.profile-dialog:has(#profileAdmin:not([hidden])){width:min(490px,calc(100vw - 24px));max-width:calc(100vw - 24px);box-sizing:border-box}
.profile-dialog:has(#profileAdmin:not([hidden])) .editte-profile-button-grid{grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(70px,.72fr)}
.profile-dialog:has(#profileAdmin:not([hidden])) .editte-profile-button-grid>button{white-space:nowrap;padding-left:7px;padding-right:7px}
@media(max-width:400px){.profile-dialog:has(#profileAdmin:not([hidden])){padding:12px}.profile-dialog:has(#profileAdmin:not([hidden])) .editte-profile-button-grid{gap:5px}.profile-dialog:has(#profileAdmin:not([hidden])) .editte-profile-button-grid>button{font-size:12px;padding-left:3px;padding-right:3px}}

/* Segurança da conta: sem alterar a grade dos botões do perfil. */
.editte-security{margin-top:18px;padding-top:12px;border-top:1px solid var(--border,#aaa)}
.editte-security h4{margin:0 0 10px}
#passwordFields{margin-top:12px;display:grid;gap:10px}
#passwordFields[hidden]{display:none!important}
#passwordFields label{display:grid;gap:5px}
.editte-password-link{margin-top:8px;background:transparent!important;border:0!important;text-decoration:underline;box-shadow:none!important;cursor:pointer}

/* Botoes do perfil: duas colunas, fechamento na ultima linha. */
.profile-dialog .editte-profile-button-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;align-items:stretch}
.profile-dialog .editte-profile-button-grid>button{grid-column:auto;grid-row:auto;align-self:stretch;box-sizing:border-box;width:100%;min-width:0;margin:0;white-space:normal}
.profile-dialog .editte-profile-button-grid>#avatarChoose{grid-column:1;grid-row:1}
.profile-dialog .editte-profile-button-grid>#avatarRemove{grid-column:1;grid-row:2}
.profile-dialog .editte-profile-button-grid>#profileEdit{grid-column:2;grid-row:1}
.profile-dialog .editte-profile-button-grid>#profileAdmin[hidden]{display:none!important}
.profile-dialog .editte-profile-button-grid>#profileAdmin:not([hidden]){grid-column:2;grid-row:2}
.profile-dialog .editte-profile-button-grid>#togglePassword{grid-column:2;grid-row:2}
.profile-dialog .editte-profile-button-grid>#profileClose{grid-column:1 / -1;grid-row:3}
.profile-dialog:has(#profileAdmin:not([hidden])){width:min(490px,calc(100vw - 24px));max-width:calc(100vw - 24px);box-sizing:border-box}
.profile-dialog:has(#profileAdmin:not([hidden])) .editte-profile-button-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.profile-dialog:has(#profileAdmin:not([hidden])) .editte-profile-button-grid>button{white-space:normal;padding-left:9px;padding-right:9px;font-size:inherit}
.profile-dialog:has(#profileAdmin:not([hidden])) .editte-profile-button-grid>#togglePassword{grid-column:1;grid-row:3}
.profile-dialog:has(#profileAdmin:not([hidden])) .editte-profile-button-grid>#profileClose{grid-column:2;grid-row:3}
.profile-dialog #togglePassword{border:0;border-radius:6px;background:#1665bb;color:#fff;padding:9px 13px;font-weight:600;cursor:pointer}
.profile-dialog #togglePassword:hover{background:#0f4d92}
#passwordDialog #passwordClose{border:0;border-radius:6px;background:#1665bb;color:#fff;padding:9px 13px;font-weight:600;cursor:pointer}

/* Ajuste visual pontual: botoes do administrador compactos. */
.profile-dialog:has(#profileAdmin:not([hidden])){width:min(420px,calc(100vw - 24px))}
.profile-dialog:has(#profileAdmin:not([hidden])) .editte-profile-button-grid>button{padding:7px 8px;font-size:13px;line-height:1.25;white-space:nowrap}
@media(max-width:380px){.profile-dialog:has(#profileAdmin:not([hidden])) .editte-profile-button-grid>button{font-size:12px;padding:7px 4px}}
/* Salvar senha: mesmo padrao visual de Salvar perfil. */
#passwordDialog #savePassword{border:0;border-radius:6px;background:#20965c;color:#fff;padding:9px 13px;font:inherit;font-weight:600;cursor:pointer;justify-self:start;width:auto;min-width:0}
#passwordDialog #savePassword:hover{background:#167646}

/* Perfil administrador: largura natural do texto, mantendo fonte, altura, cores e ordem.
   O perfil dos usuarios comuns nao e alterado. */
.profile-dialog:has(#profileAdmin:not([hidden])){width:min(360px,calc(100vw - 24px))}
.profile-dialog:has(#profileAdmin:not([hidden])) .editte-profile-button-grid{grid-template-columns:repeat(2,max-content);justify-content:center;gap:8px}
.profile-dialog:has(#profileAdmin:not([hidden])) .editte-profile-button-grid>button{width:auto;min-width:0;padding:9px 13px;font-size:inherit;line-height:normal;white-space:nowrap}
@media(max-width:380px){
 .profile-dialog:has(#profileAdmin:not([hidden])) .editte-profile-button-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .profile-dialog:has(#profileAdmin:not([hidden])) .editte-profile-button-grid>button{width:100%;font-size:12px;padding:8px 5px;white-space:normal}
}

/* Ajuste final: somente o quadro branco do administrador acompanha a largura
   natural dos botoes ja aprovados; usuario comum permanece intacto. */
.profile-dialog:has(#profileAdmin:not([hidden])){
  width:max-content;
  max-width:calc(100vw - 24px);
  box-sizing:border-box;
}

/* Editte: contraste dos botoes de Meus arquivos exclusivamente no tema escuro.
   Sobrescreve apenas cores definidas inline pelo JavaScript. */
body.dark #sidebar #files button,
body.dark #sidebar #projectCloud button {
  background-color:#354354 !important;
  color:#eef5ff !important;
  -webkit-text-fill-color:#eef5ff !important;
  border-color:#64748b !important;
}
body.dark #sidebar #files button:hover,
body.dark #sidebar #projectCloud button:hover,
body.dark #sidebar #files button:focus-visible,
body.dark #sidebar #projectCloud button:focus-visible {
  background-color:#445a73 !important;
  color:#ffffff !important;
  -webkit-text-fill-color:#ffffff !important;
}
body.dark #sidebar #files button:disabled,
body.dark #sidebar #projectCloud button:disabled {opacity:.6}

/* Editte: seletor Texto normal e opcoes legiveis no tema escuro.
   Apenas cores; dimensoes e comportamento permanecem iguais. */
body.dark .toolbar > .editte-language-box > #language {
  background-color: #333943 !important;
  color: #f1f5f9 !important;
  -webkit-text-fill-color: #f1f5f9 !important;
  border-color: #64748b !important;
  color-scheme: dark;
}
body.dark .toolbar > .editte-language-box > #language option,
body.dark .toolbar > .editte-language-box > #language optgroup {
  background-color: #292e35;
  color: #f1f5f9;
  -webkit-text-fill-color: #f1f5f9;
}
body.dark .toolbar > .editte-language-box > #language:focus-visible {
  outline-color: #79b8f3;
}
