:root{font:14px/1.5 Inter,ui-sans-serif,system-ui,-apple-system,Arial;color:#e7eaf3;background:#0b0e17}*{box-sizing:border-box}body{margin:0}button,input,select,textarea{font:inherit}button{cursor:pointer}button:disabled{opacity:.5;cursor:wait}input,select,textarea{width:100%;background:#171d2d;border:1px solid #354056;border-radius:12px;color:#f5f6fb;padding:12px;outline:none}input:focus,textarea:focus{border-color:#df278f}button{border:0;border-radius:10px;padding:11px 15px;background:#252e42;color:#f8f8fb}button:hover{filter:brightness(1.18)}.primary,.compose,.login button{background:linear-gradient(100deg,#7428ff,#e90091,#ffbd19);color:#fff;font-weight:700}.login{min-height:100vh;display:grid;place-items:center;background:radial-gradient(ellipse at top,#51155a,#0b0e17 55%)}.login-card{width:min(90vw,400px);padding:35px;border:1px solid #333348;border-radius:22px;background:#101521;box-shadow:0 25px 70px #0006;text-align:center}.login-logo{width:120px;height:62px;object-fit:cover;object-position:left}.login-card h1{margin:0}.login-card p{color:#abb3c7}.login form{display:grid;gap:12px}.error{color:#ff859a}header{display:flex;align-items:center;gap:16px;padding:13px 22px;border-bottom:1px solid #222b3c;height:78px;background:#10141e}.brand{display:flex;align-items:center;gap:8px;width:230px;flex:none;font-size:20px}.brand span{font-weight:400}.brand img{width:44px;height:44px;object-fit:cover;object-position:left}.search{max-width:780px;display:flex;align-items:center;gap:10px;background:#1a2334;border-radius:17px;padding:0 14px;flex:1}.search span{font-size:30px}.search input{border:none;background:transparent}.icon-btn{background:none}.layout{display:flex;height:calc(100vh - 78px)}aside{width:245px;flex:none;padding:24px 14px;display:flex;flex-direction:column;gap:12px;border-right:1px solid #263044}.compose{align-self:start;min-width:170px;padding:14px}nav button{width:100%;text-align:left}nav .active{background:#31203f;border-left:3px solid #f028a2}.section-label{color:#aab4c9;margin-top:22px;padding-left:10px}.mail-account{display:block;width:100%;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mail-account.active{background:#4e285f}.add-account{text-align:left;background:none;color:#ff91d0}aside small{color:#647089;margin-top:auto;padding:8px}main{min-width:0;flex:1;display:flex;flex-direction:column}.list-header{display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid #2c3445}.mainpanes{display:flex;flex:1;min-height:0}#thread-list{width:50%;max-width:650px;min-width:300px;border-right:1px solid #2c3445;overflow:auto}.thread{display:flex;gap:12px;padding:15px;border-bottom:1px solid #262e3c;cursor:pointer}.thread:hover,.thread.selected{background:#25243f}.avatar{height:42px;width:42px;border-radius:50%;background:linear-gradient(135deg,#4a52b0,#e02e86);display:grid;place-items:center;flex:none;font-weight:700}.thread-info{flex:1;min-width:0}.thread-head{display:flex;justify-content:space-between;gap:8px}.thread time{font-size:11px;color:#abb4ca;white-space:nowrap}.thread p,.thread strong{display:block;margin:2px 0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.thread p{font-size:12px;color:#9ba8bf}.thread.unread{background:#1b1e34}.thread.unread .thread-head{font-weight:700}.reading{flex:1;min-width:0;overflow:auto;padding:25px}.placeholder{color:#8f9ab0;text-align:center;margin:20vh auto}.reading h2{overflow-wrap:anywhere}.message{padding:22px 0;border-top:1px solid #334050}.message-meta{color:#aab4c9;font-size:12px;overflow-wrap:anywhere}.message-body{white-space:pre-wrap;overflow-wrap:anywhere;margin-top:20px;line-height:1.7}.reading .reply{margin-top:20px}dialog{border:1px solid #37415a;background:#111827;border-radius:20px;color:white;max-width:min(94vw,560px);width:100%;max-height:90vh;overflow:auto}dialog::backdrop{background:#000b}.dialog-form{display:grid;gap:12px;padding:8px 12px}.dialog-form h2{margin:0}.dialog-form label{display:grid;gap:5px;color:#cbd2de}.actions{display:flex;justify-content:flex-end;gap:10px}.actions button{min-width:100px}#toast{position:fixed;right:20px;bottom:20px;padding:14px;background:#2c3141;color:white;border-radius:9px;display:none}@media(max-width:800px){header{gap:8px;padding:10px}.brand{width:auto;font-size:0}.brand img{width:35px;height:35px}.search{min-width:80px}.layout{height:calc(100vh - 78px)}aside{width:76px;padding:12px 5px}.compose{min-width:0;font-size:0}.compose:first-letter{font-size:18px}nav,.section-label,aside small{display:none}.mail-account{font-size:10px;white-space:normal;word-break:break-word}.add-account{font-size:10px}.mainpanes{flex-direction:column}#thread-list{width:100%;max-width:none;min-width:0;flex:1}.reading{display:none}.mainpanes.open #thread-list{display:none}.mainpanes.open .reading{display:block}.reading{padding:14px}}
[hidden]{display:none!important}

/* Automatic text direction for email messages */
.message-body {
  direction: ltr;
  text-align: start;
  unicode-bidi: plaintext;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.7;
}


/* Sandboxed HTML email display */
.mail-html-frame {
  display: block;
  width: 100%;
  min-height: 450px;
  border: 0;
  background: #0b0e17;
  color-scheme: dark;
  border-radius: 8px;
  margin-top: 18px;
}

/* CODO_LIGHTBOX_V1 */
.mail-image-toolbar {display:flex;flex-wrap:wrap;gap:8px;margin:14px 0 4px}
.mail-image-zoom {padding:7px 12px;font-size:12px;border:1px solid #46536d;background:#222b3d;color:#f5f6fb;border-radius:8px}
.image-lightbox {position:fixed;inset:0;width:100vw;height:100vh;max-width:100vw;max-height:100vh;margin:0;padding:36px;border:0;border-radius:0;background:rgba(8,10,17,.96);overflow:auto}
.image-lightbox[open] {display:flex;align-items:center;justify-content:center}
.image-lightbox::backdrop {background:rgba(0,0,0,.88)}
.image-lightbox img {display:block;max-width:100%;max-height:calc(100vh - 72px);width:auto;height:auto;object-fit:contain}
#lightbox-close {position:fixed;top:15px;right:20px;z-index:1;font-size:30px;line-height:1;padding:5px 12px;background:#30384a;color:#fff}


/* CODO mail iframe polish 18-29: height is driven by sandbox bridge. */
.mail-html-frame{display:block;width:100%;height:160px;min-height:80px;max-width:100%;border:1px solid #30394c;border-radius:12px;background:#151a27;overflow:hidden;margin:14px 0 8px}

/* Compose editor 18-32 */
.codo-editor-toolbar{display:flex;flex-wrap:wrap;gap:6px;padding:7px;background:#1c2436;border:1px solid #354056;border-radius:10px}
.codo-editor-toolbar button{padding:5px 10px;min-width:32px}
.codo-compose-editor{min-height:210px;max-height:44vh;overflow:auto;border:1px solid #354056;border-radius:12px;padding:13px;background:#171d2d;color:#f5f6fb;outline:none;white-space:pre-wrap;overflow-wrap:anywhere}
.codo-compose-editor:focus{border-color:#df278f}
.codo-compose-editor a{color:#aebeff}
#compose-dialog{max-width:min(94vw,740px)}

/* CODO Mail 18-33: status indicators */
.codo-unread-dot{color:#f46ac0;font-size:11px;vertical-align:middle}
.codo-replied{display:inline-block;font-weight:500;font-size:11px;color:#b7cdf9;background:#25354d;padding:1px 6px;border-radius:8px;vertical-align:middle}
.thread.unread .thread-info strong{font-weight:800;color:#fff}

/* CODO Mail 18-34 folder navigation and conversation accordion */
#mail-folder-nav{display:flex;flex-direction:column;gap:4px}
#mail-folder-nav button{text-align:left;cursor:pointer}
#mail-folder-nav button.active{border-left:4px solid #ee409e}
.codo-mail-accordion{border-bottom:1px solid #394257;padding:6px 0}
.codo-mail-accordion>summary{display:flex;align-items:center;gap:12px;cursor:pointer;list-style:none;padding:14px 8px;border-radius:9px}
.codo-mail-accordion>summary::-webkit-details-marker{display:none}
.codo-mail-accordion>summary:hover{background:#242c3e}
.codo-mail-accordion>summary .codo-expand-icon{font-size:14px;color:#a6b3ce;flex:none}
.codo-mail-accordion[open]>summary .codo-expand-icon{transform:rotate(90deg)}
.codo-mail-accordion>summary .codo-mail-summary-sender{font-weight:700;white-space:nowrap}
.codo-mail-accordion>summary .codo-mail-summary-snippet{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#9aaac5;min-width:0;flex:1}
.codo-mail-accordion>summary time{font-size:12px;color:#a5b2ca;flex:none}
.codo-mail-accordion[open]>summary .codo-mail-summary-snippet{display:none}
.codo-mail-accordion>.codo-mail-accordion-body{padding:0 8px 12px}

/* CODO Mail 18.35: user theme preferences */
.codo-theme-select{display:flex;align-items:center;gap:6px;font-size:12px;color:#abb4ca;white-space:nowrap}
.codo-theme-select select{width:auto;padding:7px;font-size:12px}
.codo-signature-editor{min-height:120px;max-height:32vh}
.codo-muted{color:#a9b4ca;font-size:12px;margin:0}
html[data-codo-theme="light"]{color:#18253a;background:#f3f6fb}
html[data-codo-theme="light"] header{background:#fff;border-color:#d4dce8;color:#18253a}
html[data-codo-theme="light"] .search{background:#edf2fa}
html[data-codo-theme="light"] .search input{color:#18253a}
html[data-codo-theme="light"] aside,html[data-codo-theme="light"] main{background:#f8fafd;color:#18253a;border-color:#d7dfec}
html[data-codo-theme="light"] .thread{border-color:#dae2ed}
html[data-codo-theme="light"] .thread:hover,html[data-codo-theme="light"] .thread.selected,html[data-codo-theme="light"] .thread.unread{background:#e6edf9}
html[data-codo-theme="light"] .thread p,html[data-codo-theme="light"] .thread time,html[data-codo-theme="light"] .thread-head,html[data-codo-theme="light"] .message-meta{color:#536680}
html[data-codo-theme="light"] .thread.unread .thread-info strong{color:#14233a}
html[data-codo-theme="light"] .reading,html[data-codo-theme="light"] .list-header{background:#f8fafd;color:#18253a;border-color:#d5deeb}
html[data-codo-theme="light"] .codo-mail-accordion{border-color:#d6e0ec}
html[data-codo-theme="light"] .codo-mail-accordion>summary:hover{background:#e7edf6}
html[data-codo-theme="light"] .codo-mail-summary-snippet,html[data-codo-theme="light"] .codo-mail-accordion>summary time{color:#65758b}
html[data-codo-theme="light"] nav .active,html[data-codo-theme="light"] .mail-account.active{background:#eee4f4;color:#26314b}
html[data-codo-theme="light"] dialog{background:#fff;color:#17263d;border-color:#d6deeb}
html[data-codo-theme="light"] input,html[data-codo-theme="light"] select,html[data-codo-theme="light"] textarea,html[data-codo-theme="light"] .codo-compose-editor{background:#f8fafd;color:#19263d;border-color:#d0dced}
html[data-codo-theme="light"] .codo-editor-toolbar{background:#eff3fa;border-color:#d0dced}
html[data-codo-theme="light"] .dialog-form label,html[data-codo-theme="light"] .codo-theme-select{color:#33465e}
html[data-codo-theme="light"] .placeholder,html[data-codo-theme="light"] .section-label{color:#607089}
html[data-codo-theme="light"] .icon-btn{color:#344763}

/* 18.36: light theme actions; Compose retains its gradient. */
html[data-codo-theme="light"] button:not(.compose):not(.icon-btn),html[data-codo-theme="light"] .reply,html[data-codo-theme="light"] #mail-folder-nav button{background:#7629bb;color:#fff;border-color:#7629bb}
html[data-codo-theme="light"] button:not(.compose):not(.icon-btn):hover{background:#612199}
html[data-codo-theme="light"] #mail-folder-nav button.active{background:#ede2f6;color:#482568;border-left:4px solid #7629bb}
html[data-codo-theme="light"] .codo-mail-accordion>summary{background:transparent;color:#17263d}
html[data-codo-theme="light"] .codo-mail-accordion>summary:hover{background:#ebeff7}
.codo-attachments-list{display:flex;flex-wrap:wrap;gap:8px;padding:12px 0}
.codo-attachments-list a{padding:8px 10px;border-radius:8px;background:#6e329c;color:#fff;text-decoration:none;font-size:13px}
#compose-attachments{padding:8px;width:100%}

/* CODO 18.37: contextual message reply and attachment diagnostics */
.codo-reply-specific{margin:9px 0 12px;background:#7730ab;color:#fff;border:0;border-radius:8px;padding:8px 13px;cursor:pointer}
.codo-reply-specific:hover{background:#913ad0}
.codo-attachment-status{font-size:13px;opacity:.85;padding:9px 0}

/* CODO Mail 18.39: compact actions and exact transparent symbol */
.brand img{width:42px;height:46px;object-fit:contain;object-position:center;flex:none}
.login-logo{width:96px;height:104px;object-fit:contain;object-position:center;display:block;margin:0 auto 8px}
.codo-mail-accordion-body .codo-reply-specific{display:inline-flex;align-items:center;justify-content:center;min-height:36px;min-width:90px;margin:9px 0 12px;padding:7px 14px;border-radius:9px;font-size:13px;font-weight:600;line-height:1.2;background:#7629bb;color:#fff}
.codo-mail-accordion-body .codo-reply-specific:hover{background:#8b36ce}
html[data-codo-theme="light"] .codo-mail-accordion-body .codo-reply-specific{background:#7629bb;color:#fff}
@media(max-width:800px){.brand img{width:34px;height:38px}}

/* CODO Mail user administration */
.codo-admin-dialog{width:min(850px,94vw);max-height:90vh;overflow:auto;color:var(--text,#e5e7eb)}
.codo-admin-panel{padding:22px}.codo-admin-heading{display:flex;justify-content:space-between;align-items:center;gap:12px}
.codo-admin-heading button{font-size:26px;background:transparent;border:0;color:inherit;cursor:pointer}
.codo-admin-help{opacity:.75}.codo-admin-users-list{margin-top:16px;display:grid;gap:10px}
.codo-admin-user-row{display:flex;align-items:center;justify-content:space-between;gap:14px;border:1px solid #7775;border-radius:10px;padding:12px;flex-wrap:wrap}
.codo-admin-user-row small{display:block;opacity:.72;margin-top:4px}.codo-admin-user-actions{display:flex;flex-wrap:wrap;gap:6px}
.codo-admin-user-actions button{cursor:pointer;border:1px solid #7778;border-radius:7px;padding:7px 10px;background:transparent;color:inherit}
.codo-admin-user-actions .codo-admin-danger{border-color:#d75a5a;color:#e26d6d}
.codo-admin-active{display:flex;align-items:center;gap:9px}.codo-admin-active input{width:auto}
