
  :root{
    --bg: #0f1113;
    --panel: #15171a;
    --fg: #eef1f4;
    --muted: #8a9199;
    --line: #23272c;
    --accent: #7fd1c1;
    --unread-dot: #7fd1c1;
  }
  * { box-sizing: border-box; }
  html, body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--fg);
    font-family: 'DM Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 13px;
    scrollbar-width: none;
    overflow-y:hidden;
  }

  a:link {
  text-decoration: none;
}

 

  .red {
    color: red;
  }
  
  /* ---------- top bar ---------- */
  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0px 20px;
    border-bottom: 1px solid var(--line);
  }
  .brand {
    display: flex;
    align-items: baseline;
    gap: 8px;
    letter-spacing: .02em;
    text-decoration: none;
  }
  .brand .mark { color: var(--accent); font-weight: 700; }
  .brand .sep { color: var(--line); }
  .brand .app { color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: .08em; }

  .account {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
  }
  .account .addr { color: var(--fg); }
  .account .avatar {
    width: 22px; height: 22px;
    border: 1px solid var(--line);
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
    color: var(--accent);
  }

  /* ---------- layout ---------- */
.app-shell {
  display: grid;
  grid-template-columns: 200px 1fr 0px; /* default: wide, panel collapsed */
  height: calc(100% - 46px);
}

.app-shell:has(#mainbody:not(:empty)) {
  grid-template-columns: 200px 300px 1fr; /* panel has content → normal layout */
}
  /* ---------- left nav ---------- */
  .nav {
    border-right: 1px solid var(--line);
    padding: 16px 0;
    display: flex;
    flex-direction: column;
  }
  .compose-btn {
    margin: 0 14px 18px;
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    font-family: inherit;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 9px 0;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
  }
  .compose-btn:hover { background: var(--accent); color: #0f1113; }

  .nav-list { list-style: none; margin: 0; padding: 0; }
  .nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    color: var(--muted);
    cursor: pointer;
    border-left: 2px solid transparent;
  }
  .nav-item:hover { color: var(--fg); }
  .nav-item.active {
    color: var(--fg);
    border-left-color: var(--accent);
    background: rgba(127, 209, 193, 0.05);
  }
  .nav-count {
    font-size: 11px;
    color: var(--muted);
  }
  .nav-item.active .nav-count { color: var(--accent); }

  .nav-footer {
    margin-top: auto;
    padding: 14px;
    border-top: 1px solid var(--line);
  }
  .nav-footer a {
    color: var(--muted);
    text-decoration: none;
    font-size: 11px;
    letter-spacing: .04em;
  }
  .nav-footer a:hover { color: var(--fg); }

  /* ---------- message list ---------- */
  .list {
    border-right: 1px solid var(--line);
    overflow-y: auto;
  }
  .list-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .list-header h1 {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    margin: 0;
  }
  .search {
    width: 90%;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--line);
    color: var(--fg);
    font-family: inherit;
    font-size: 12px;
    padding: 8px 10px;
    margin: 10px 14px;
  }

.reader-content--html {
    all: revert;
    width:100%;
    border:none; 
    display:block;
}

  .search::placeholder { color: var(--muted); }

  .msg-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
  }
  .msg-row:hover { background: rgba(255,255,255,0.025); }
  .msg-row.selected { background: rgba(127, 209, 193, 0.06); border-left: 2px solid var(--accent); padding-left: 14px; }

  .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    margin-top: 6px;
    background: var(--unread-dot);
    flex-shrink: 0;
  }
  .msg-row.read .dot { background: transparent; }

  .msg-body { min-width: 0; flex: 1; }
  .msg-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
  }
  .msg-from {
    color: var(--fg);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .msg-row.read .msg-from { color: var(--muted); font-weight: 400; }
  .msg-time { color: var(--muted); font-size: 11px; flex-shrink: 0; }
  .msg-subject {
    margin-top: 3px;
    color: var(--fg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .msg-row.read .msg-subject { color: var(--muted); }
  .msg-snippet {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ---------- reading pane ---------- */
  .reader {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }
  .reader-header {
    padding: 20px 28px 16px;
    border-bottom: 1px solid var(--line);
  }
  .reader-subject {
    font-size: 16px;
    color: var(--fg);
    margin: 0 0 14px;
    font-weight: 500;
  }
  .reader-meta {
    display: flex;
    align-items: flex-start;
    gap: 12px;
  }
  .reader-avatar {
    width: 32px; height: 32px;
    border: 1px solid var(--line);
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    color: var(--accent);
    font-size: 12px;
    flex-shrink: 0;
  }
  .reader-meta-text { flex: 1; min-width: 0; }
  .reader-from { color: var(--fg); }
  .reader-from .addr { color: var(--muted); font-size: 12px; }
  .reader-to { color: var(--muted); font-size: 11px; margin-top: 2px; }
  .reader-time { color: var(--muted); font-size: 11px; white-space: nowrap; }

  .reader-actions {
    display: flex;
    gap: 8px;
    padding: 14px 28px;
    border-bottom: 1px solid var(--line);
  }
  .action-btn {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--muted);
    font-family: inherit;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 7px 14px;
    cursor: pointer;
  }
  .action-btn:hover { color: var(--fg); border-color: var(--muted); }

  .reader-content {
    padding: 24px 28px;
    line-height: 1.7;
    color: var(--fg);
    white-space: pre-wrap;
  }
  .reader-content p { margin: 0 0 1em; }

  /* ---------- scrollbars ---------- */
  ::-webkit-scrollbar { width: 8px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--line); }

  @media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .nav, .list { display: none; }
  }


  /* ---------- composer ---------- */
.composer-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.composer-fields {
  padding: 4px 28px 0;
  border-bottom: 1px solid var(--line);
}

.composer-field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.composer-field:last-child { border-bottom: none; }

.composer-label {
  width: 60px;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.composer-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--fg);
  font-family: inherit;
  font-size: 13px;
  padding: 4px 0;
}
.composer-input:focus { outline: none; }
.composer-input::placeholder { color: var(--muted); }

.composer-body-field {
  flex: 1;
  padding: 20px 28px;
  min-height: 0;
}

.composer-textarea {
  width: 100%;
  height: 100%;
  min-height: 240px;
  resize: vertical;
  background: transparent;
  border: none;
  color: var(--fg);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.7;
  padding: 0;
}
.composer-textarea:focus { outline: none; }
.composer-textarea::placeholder { color: var(--muted); }

.composer-actions {
  margin-top: auto;
}

.action-btn-primary {
  color: var(--accent);
  border-color: var(--accent);
}
.action-btn-primary:hover {
  background: var(--accent);
  color: #0f1113;
}