/* OxMail Webmail — green on navy, clean 3-pane layout. */
:root {
  --navy: #0B1320; --panel: #131F31; --line: #22304a; --line2: #1a2740;
  --green: #22C55E; --green-dk: #16a34a; --ink: #EAF0F7; --muted: #94A3B8;
  --bad: #ef5350; --hi: rgba(34, 197, 94, .12); --sel: rgba(30, 144, 255, .14); --blue: #1E90FF;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body { font: 14px/1.5 -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--navy); color: var(--ink); }
button { font: inherit; cursor: pointer; }
input, textarea { font: inherit; color: var(--ink); background: var(--navy); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; }
input:focus, textarea:focus { outline: none; border-color: var(--green); }
.btn { background: var(--green); color: #062012; border: none; border-radius: 8px; padding: 8px 14px; font-weight: 700; }
.btn:hover { background: var(--green-dk); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); font-weight: 500; }
.btn.ghost:hover { border-color: var(--muted); background: var(--line2); }
.btn.danger { background: transparent; border: 1px solid var(--line); color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.mut { color: var(--muted); }

/* login */
.login { max-width: 360px; margin: 14vh auto; background: var(--panel); border: 1px solid var(--line); padding: 30px; border-radius: 16px; }
.login .brand { display: flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 800; letter-spacing: .4px; }
.login .brand img { width: 34px; height: 34px; }
.login .brand b { color: var(--green); }
.login label { display: block; font-weight: 600; font-size: 12px; margin: 14px 0 4px; color: #c9d5e3; }
.login input { width: 100%; }
.login .err { color: var(--bad); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* shell */
.shell { display: grid; grid-template-columns: 210px 360px 1fr; grid-template-rows: 52px 1fr; height: 100vh; }
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 0 14px; background: #0d1626; border-bottom: 1px solid var(--line); }
.top .brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 16px; margin-right: 6px; }
.top .brand img { width: 26px; height: 26px; }
.top .brand b { color: var(--green); }
.top .search { flex: 1; max-width: 480px; position: relative; }
.top .search input { width: 100%; padding-left: 32px; background: var(--panel); }
.top .search::before { content: "⌕"; position: absolute; left: 10px; top: 7px; color: var(--muted); font-size: 16px; }
.top .who { margin-left: auto; font-size: 12.5px; color: var(--muted); }

/* folders */
.nav { background: var(--panel); border-right: 1px solid var(--line); padding: 12px 8px; overflow-y: auto; }
.nav .compose { width: calc(100% - 8px); margin: 2px 4px 14px; padding: 10px; font-size: 14px; }
.folder { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: #c9d5e3; font-weight: 500; }
.folder:hover { background: var(--line2); }
.folder.on { background: var(--hi); color: var(--green); font-weight: 700; }
.folder .n { margin-left: auto; font-size: 11.5px; background: var(--green); color: #062012; border-radius: 12px; padding: 0 7px; font-weight: 800; line-height: 17px; }
.folder .ico { width: 17px; text-align: center; }

/* message list */
.list { border-right: 1px solid var(--line); overflow-y: auto; background: #0e1828; }
.list .head { position: sticky; top: 0; background: #0e1828; padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; z-index: 2; }
.list .head h2 { font-size: 14.5px; flex: 1; }
.row { padding: 10px 12px; border-bottom: 1px solid var(--line2); cursor: pointer; }
.row:hover { background: var(--line2); }
.row.sel { background: var(--sel); }
.row .l1 { display: flex; gap: 8px; align-items: baseline; }
.row .from { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .when { font-size: 11.5px; color: var(--muted); flex-shrink: 0; }
.row .subj { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.row .prev { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.unread .from, .row.unread .subj { color: #fff; font-weight: 800; }
.row.unread { border-left: 3px solid var(--green); padding-left: 9px; }
.row .clip { color: var(--muted); font-size: 12px; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }

/* reading pane */
.read { overflow-y: auto; display: flex; flex-direction: column; }
.read .bar { display: flex; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.read .meta { padding: 14px 18px 6px; }
.read .meta h1 { font-size: 18px; margin-bottom: 8px; }
.read .meta .kv { font-size: 12.5px; color: var(--muted); }
.read .meta .kv b { color: var(--ink); font-weight: 600; }
.read .atts { padding: 8px 18px; display: flex; gap: 8px; flex-wrap: wrap; }
.att { display: inline-flex; gap: 6px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; color: var(--ink); text-decoration: none; }
.att:hover { border-color: var(--green); }
.read .bodywrap { flex: 1; margin: 10px 18px 18px; background: #fff; border-radius: 10px; overflow: hidden; min-height: 200px; }
.read .bodywrap.plain { background: var(--panel); border: 1px solid var(--line); }
.read iframe { width: 100%; height: 100%; border: 0; min-height: 380px; }
.read pre.plainbody { padding: 16px; white-space: pre-wrap; word-break: break-word; font: 13.5px/1.6 inherit; color: var(--ink); }
.imgnote { margin: 0 18px; padding: 8px 12px; background: var(--line2); border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; align-items: center; }

/* compose */
dialog { border: none; border-radius: 16px; padding: 0; width: min(720px, 96vw); background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
dialog::backdrop { background: rgba(5, 10, 18, .75); }
.cmp { display: flex; flex-direction: column; max-height: 86vh; }
.cmp .cbar { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 700; }
.cmp .cbar .x { margin-left: auto; background: none; border: none; color: var(--muted); font-size: 18px; }
.cmp .fields { padding: 10px 16px 0; }
.cmp .frow { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line2); padding: 6px 0; }
.cmp .frow label { width: 52px; font-size: 12px; color: var(--muted); font-weight: 600; }
.cmp .frow input { flex: 1; border: none; background: transparent; padding: 4px 2px; border-radius: 0; }
.cmp textarea { margin: 10px 16px; min-height: 220px; resize: vertical; }
.cmp .catt { padding: 0 16px 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.cmp .send { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.cmp .err { color: var(--bad); font-size: 12.5px; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--green); border-radius: 10px; padding: 10px 18px; font-weight: 600; z-index: 60; pointer-events: none; }
.spin { color: var(--muted); text-align: center; padding: 30px; }

/* responsive: collapse to 2 panes, then 1 */
@media (max-width: 1000px) { .shell { grid-template-columns: 180px 300px 1fr; } }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 52px auto 1fr; }
  .nav { display: flex; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line); padding: 6px; }
  .nav .compose { width: auto; margin: 0 8px 0 0; white-space: nowrap; }
  .folder { white-space: nowrap; }
  .list { display: none; }
  .list.mobile-on { display: block; }
  .read { display: none; }
  .read.mobile-on { display: flex; }
}
