/* OnDuhGo Twin — the Mail window (docs/mail.md). Baloo 2 only; Ink window, Espresso panels, Cream text, Tan rules,
   Paper behind a message, Coral only for the unread dot and the Send button's focus. Loaded by lib/pwa.php after jukebox.css. */

/* the dock button shows only for people with a mailbox (mail.js adds body.ml-on) */
#dpDock [data-dp="mail"]{display:none}
body.ml-on #dpDock [data-dp="mail"]{display:flex}

#mlWin{position:fixed;z-index:17;top:18px;bottom:94px;left:50%;transform:translateX(-50%);width:min(1320px,calc(100vw - 48px));box-sizing:border-box;
  display:flex;flex-direction:column;background:#2B2118;color:#F7E7C6;border:1px solid rgba(200,155,108,.45);border-radius:20px;
  box-shadow:0 18px 50px rgba(0,0,0,.5);font:500 16px/1.6 "Baloo 2","Work Sans",sans-serif;padding:14px 18px 0;overflow:hidden}
#mlWin[hidden]{display:none}
#mlWin *{box-sizing:border-box}
#mlWin .mlhead{display:flex;align-items:center;justify-content:space-between;gap:12px;flex:none;padding-bottom:10px;border-bottom:1px solid rgba(200,155,108,.25)}
#mlWin h2{margin:0;font-size:24px;font-weight:800;line-height:1.15}
#mlWin .mlsub{font-size:14px;color:rgba(247,231,198,.68)}
#mlWin .mltools{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}
#mlClose,#mlWin .mlx{width:40px;height:40px;padding:0;border-radius:12px;border:1px solid rgba(200,155,108,.45);background:transparent;color:#F7E7C6;font:600 20px "Baloo 2","Work Sans",sans-serif;cursor:pointer}
#mlClose:hover,#mlWin .mlx:hover{border-color:#F7E7C6}
.mlbtn{min-height:40px;padding:0 16px;border-radius:999px;border:1.5px solid rgba(200,155,108,.5);background:#2B2118;color:#F7E7C6;font:700 15px "Baloo 2","Work Sans",sans-serif;cursor:pointer;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
.mlbtn:hover{border-color:#F7E7C6}
.mlbtn:disabled{opacity:.55;cursor:default}
.mlbtn.mlmain{background:#F7E7C6;color:#2B2118;border-color:#F7E7C6}
.mlbtn.mlquiet{border-color:rgba(200,155,108,.28);color:rgba(247,231,198,.8)}
#mlWin button:focus-visible,#mlWin a:focus-visible,#mlWin input:focus-visible,#mlWin select:focus-visible,#mlWin textarea:focus-visible,#mlWin label.mlbtn:focus-within{outline:2px solid #E38361;outline-offset:2px}

/* three panes */
#mlWin .mlbody{flex:1 1 auto;min-height:0;display:grid;grid-template-columns:220px minmax(280px,360px) 1fr;gap:0}
#mlWin .mlrail{overflow-y:auto;padding:12px 12px 16px 0;border-right:1px solid rgba(200,155,108,.2)}
#mlWin .mlbox{position:relative;display:flex;flex-direction:column;align-items:flex-start;width:100%;text-align:left;padding:8px 40px 8px 12px;margin:0 0 4px;border-radius:12px;border:1px solid transparent;background:transparent;color:#F7E7C6;font:inherit;cursor:pointer;line-height:1.3}
#mlWin .mlbox:hover{border-color:rgba(200,155,108,.45)}
#mlWin .mlbox.on{background:#4A2A18;border-color:rgba(200,155,108,.5)}
#mlWin .mlbox b{font-weight:700}
#mlWin .mlbox small{font-size:13px;color:rgba(247,231,198,.6);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}
#mlWin .mlbox em{font-style:normal;font-size:12px;font-weight:600;color:#C89B6C}
#mlWin .mlcount{position:absolute;right:10px;top:9px;min-width:22px;padding:0 6px;border-radius:999px;background:#F7E7C6;color:#2B2118;font-size:13px;font-weight:800;text-align:center;line-height:22px}
#mlWin .mlfold{display:flex;gap:6px;margin:14px 0 0;padding-top:12px;border-top:1px solid rgba(200,155,108,.2)}
#mlWin .mlfold button{flex:1;min-height:36px;border-radius:999px;border:1px solid rgba(200,155,108,.4);background:transparent;color:#F7E7C6;font:700 14px "Baloo 2","Work Sans",sans-serif;cursor:pointer}
#mlWin .mlfold button[aria-selected="true"]{background:#C89B6C;border-color:#C89B6C;color:#2B2118}
#mlWin .mlnote{font-size:14px;color:rgba(247,231,198,.7);margin:6px 4px}

#mlWin .mllist{display:flex;flex-direction:column;min-height:0;border-right:1px solid rgba(200,155,108,.2)}
#mlWin .mlsearch{flex:none;padding:12px 12px 8px}
#mlWin .mlsearch input{width:100%;min-height:40px;padding:0 14px;border-radius:999px;border:1px solid rgba(200,155,108,.45);background:#4A2A18;color:#F7E7C6;font:500 15px "Baloo 2","Work Sans",sans-serif}
#mlWin .mlsearch input::placeholder{color:rgba(247,231,198,.55)}
#mlRows{list-style:none;margin:0;padding:0 8px 8px;overflow-y:auto;flex:1 1 auto;scrollbar-width:thin;scrollbar-color:rgba(200,155,108,.5) transparent}
#mlWin .mlrow{display:grid;width:100%;text-align:left;gap:0;padding:9px 12px;margin:0 0 2px;border-radius:12px;border:1px solid transparent;background:transparent;color:rgba(247,231,198,.82);font:inherit;cursor:pointer;line-height:1.35}
#mlWin .mlrow:hover{border-color:rgba(200,155,108,.4)}
#mlWin .mlrow.on{background:#4A2A18;border-color:rgba(200,155,108,.55)}
#mlWin .mlr1{display:flex;gap:8px;align-items:baseline}
#mlWin .mlfrom{flex:1 1 auto;min-width:0;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#mlWin .mlr1 time{flex:none;font-size:13px;color:rgba(247,231,198,.6)}
#mlWin .mlsubj{display:flex;align-items:center;gap:6px;font-size:15px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
#mlWin .mlsnip{font-size:13px;color:rgba(247,231,198,.55);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#mlWin .mlrow.unread{color:#F7E7C6}
#mlWin .mlrow.unread .mlfrom,#mlWin .mlrow.unread .mlsubj{font-weight:800}
#mlWin .mldot{flex:none;width:8px;height:8px;border-radius:50%;background:#E38361}
#mlWin .mlclip{flex:none;color:#C89B6C;display:inline-flex}
#mlWin .mltag{justify-self:start;margin-top:3px;padding:0 8px;border-radius:999px;border:1px solid rgba(200,155,108,.4);font-size:12px;font-weight:600;color:#C89B6C}
#mlWin .mlmore{margin:4px 12px 12px;align-self:center}
#mlWin .mlempty{list-style:none;padding:16px 12px;margin:0;color:rgba(247,231,198,.62);font-size:15px}

#mlWin .mlread{overflow-y:auto;padding:12px 4px 16px 18px;display:flex;flex-direction:column;min-height:0}
#mlWin .mlpick{margin:auto;text-align:center}
#mlWin .mlrbar{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 10px}
#mlWin .mlback{display:none}
#mlWin .mlrsubj{margin:0 0 8px;font-size:22px;font-weight:800;line-height:1.25;word-break:break-word}
#mlWin .mlmeta{margin:0 0 10px;font-size:14px;display:grid;gap:2px}
#mlWin .mlmeta div{display:flex;gap:8px}
#mlWin .mlmeta dt{flex:none;width:64px;color:rgba(247,231,198,.55)}
#mlWin .mlmeta dd{margin:0;min-width:0;word-break:break-word}
#mlWin .mladdr{color:rgba(247,231,198,.6)}
#mlWin .mlatts{list-style:none;display:flex;flex-wrap:wrap;gap:8px;margin:0 0 10px;padding:0}
#mlWin .mlatts a{display:inline-flex;align-items:center;gap:6px;max-width:320px;min-height:40px;padding:4px 12px;border-radius:12px;border:1px solid rgba(200,155,108,.45);color:#F7E7C6;text-decoration:none;font-size:14px}
#mlWin .mlatts a:hover{border-color:#F7E7C6}
#mlWin .mlatts span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600}
#mlWin .mlatts small{flex:none;color:rgba(247,231,198,.6)}
#mlWin .mlpics,#mlWin .mlwarn{display:flex;align-items:center;flex-wrap:wrap;gap:10px;margin:0 0 10px;padding:8px 12px;border-left:3px solid #C89B6C;background:rgba(74,42,24,.6);border-radius:0 10px 10px 0;font-size:14px}
#mlWin .mlframe{flex:1 1 auto;min-height:420px;width:100%;border:0;border-radius:12px;background:#FFFBF2}
#mlWin .mltext{flex:1 1 auto;white-space:pre-wrap;word-break:break-word;background:#FFFBF2;color:#2B2118;border-radius:12px;padding:14px 16px;font-size:16px;line-height:1.65}
#mlWin .mltext a{color:#4A2A18;font-weight:600}
#mlWin .mlq{color:#4A2A18;opacity:.7}

/* writing sheet and mailbox settings: over the panes, inside the window */
#mlWin .mlsheet{position:absolute;inset:66px 0 0 0;z-index:2;background:rgba(43,33,24,.92);display:flex;justify-content:center;align-items:stretch;padding:0 12px 12px}
#mlWin .mlsheet[hidden]{display:none}
#mlWin .mlform{width:min(820px,100%);display:flex;flex-direction:column;gap:8px;background:#4A2A18;border:1px solid rgba(200,155,108,.45);border-radius:16px;padding:12px 16px 14px;overflow-y:auto}
#mlWin .mlform header{display:flex;align-items:center;justify-content:space-between}
#mlWin .mlform h3{margin:0;font-size:20px;font-weight:800}
#mlWin .mlform label{display:flex;align-items:center;gap:10px}
#mlWin .mlform label > span{flex:none;width:64px;font-size:14px;color:rgba(247,231,198,.65)}
#mlWin .mlform input[type=text],#mlWin .mlform input[type=email],#mlWin .mlform input[type=password],#mlWin .mlform input:not([type]),#mlWin .mlform select,#mlWin .mlform textarea{
  flex:1 1 auto;min-width:0;min-height:40px;padding:6px 12px;border-radius:10px;border:1px solid rgba(200,155,108,.4);background:#2B2118;color:#F7E7C6;font:500 16px/1.5 "Baloo 2","Work Sans",sans-serif}
#mlWin .mlform textarea{flex:1 1 auto;min-height:220px;resize:vertical;line-height:1.6}
#mlWin .mlform footer{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-top:4px}
#mlWin .mlform label.mlbtn{width:auto}
#mlWin .mcstat,#mlWin .msstat{font-size:14px;color:rgba(247,231,198,.8)}
#mlWin .mcfiles{display:flex;flex-wrap:wrap;gap:6px}
#mlWin .mcfile{display:inline-flex;align-items:center;gap:6px;padding:2px 4px 2px 10px;border-radius:999px;border:1px solid rgba(200,155,108,.45);font-size:14px;background:transparent;color:#F7E7C6;font-family:inherit}
#mlWin .mcfile small{color:rgba(247,231,198,.6)}
#mlWin .mcfile button{width:28px;height:28px;border-radius:50%;border:0;background:transparent;color:#F7E7C6;font-size:16px;cursor:pointer}
#mlWin .mcfwd{padding:4px 12px;cursor:pointer;font-weight:600}
#mlWin .mcfwd[aria-pressed="false"]{opacity:.65}
#mlWin .msform{width:min(980px,100%)}
#mlWin .msbox{border:1px solid rgba(200,155,108,.35);border-radius:14px;padding:8px 14px 12px;margin:0}
#mlWin .msbox legend{padding:0 6px;font-weight:800;color:#C89B6C}
#mlWin .msgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:8px 14px}
#mlWin .msgrid label > span{width:96px}
#mlWin .mshint{margin:4px 0;font-size:14px;color:rgba(247,231,198,.72)}
#mlWin .mspeople{display:flex;flex-direction:column;gap:2px;margin-top:8px}
#mlWin .mspeople > span{font-size:14px;color:rgba(247,231,198,.65)}
#mlWin .mscheck{cursor:pointer}
#mlWin .mscheck input{width:20px;height:20px;accent-color:#C89B6C}
#mlWin .mscheck small{color:rgba(247,231,198,.55)}
#mlWin .msmore{flex-direction:column;align-items:stretch !important;gap:2px !important;margin-top:4px}
#mlWin .msmore small{color:rgba(247,231,198,.6)}
#mlWin .msact{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-top:8px}
#mlWin .msres{font-size:14px}
#mlWin .msres.bad{color:#F7E7C6;border-left:3px solid #E38361;padding-left:8px}

/* narrower windows: one pane at a time */
@media (max-width:1060px){
  #mlWin .mlbody{grid-template-columns:200px 1fr}
  #mlWin .mlread{display:none;grid-column:1 / -1}
  #mlWin .mlbody[data-view="read"] .mlrail,#mlWin .mlbody[data-view="read"] .mllist{display:none}
  #mlWin .mlbody[data-view="read"] .mlread{display:flex;padding-left:0}
  #mlWin .mlback{display:inline-flex}
  #mlWin .mllist{border-right:0}
}
html.m-ui #mlWin{top:0;left:0;right:0;bottom:calc(var(--m-tabs,56px) + env(safe-area-inset-bottom,0px));width:auto;transform:none;border-radius:0;border-width:0 0 1px;padding:10px 12px 0;z-index:40}
html.m-ui.m-land #mlWin{bottom:0;right:var(--m-rail,64px)}
@media (max-width:720px){
  #mlWin{top:0;left:0;right:0;width:auto;transform:none;border-radius:0;padding:10px 12px 0}
  #mlWin .mlhead{flex-wrap:wrap}
  #mlWin .mlbody{grid-template-columns:1fr;grid-template-rows:auto 1fr}
  #mlWin .mlrail{display:flex;gap:6px;overflow-x:auto;overflow-y:hidden;padding:8px 0;border-right:0;border-bottom:1px solid rgba(200,155,108,.2)}
  #mlWin #mlBoxes{display:flex;gap:6px}
  #mlWin .mlbox{width:auto;flex:none;margin:0;padding:6px 36px 6px 12px}
  #mlWin .mlbox small{display:none}
  #mlWin .mlcount{top:7px}
  #mlWin .mlfold{margin:0;padding:0 0 0 6px;border-top:0;border-left:1px solid rgba(200,155,108,.2)}
  #mlWin .mlfold button{flex:none;padding:0 14px}
  #mlWin .mlsearch{padding:8px 0}
  #mlRows{padding:0 0 8px}
  #mlWin .mlsheet{inset:56px 0 0 0;padding:0}
  #mlWin .mlform{border-radius:14px 14px 0 0}
  #mlWin .mlform label > span{width:56px}
  #mlWin .mlframe{min-height:60vh}
}
@media (prefers-reduced-motion:reduce){#mlWin{transition:none}}
