* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #222; background: #f5f6f8; }
button, input, select { font: inherit; }
#login { max-width: 340px; margin: 15vh auto; padding: 32px; background: #fff; border-radius: 12px; box-shadow: 0 4px 24px #0001; text-align: center; }
#login h1 { margin-bottom: 12px; }
#login input { width: 100%; padding: 10px; margin: 16px 0; border: 1px solid #ccc; border-radius: 6px; }
#login button { width: 100%; padding: 10px; background: #2563eb; color: white; border: 0; border-radius: 6px; cursor: pointer; }
.err { color: #dc2626; margin-top: 12px; font-size: 14px; }

.layout { display: grid; grid-template-columns: 240px 1fr 1fr; height: 100vh; }
.sidebar { background: #1e293b; color: #cbd5e1; padding: 16px; overflow-y: auto; }
.sidebar h2 { color: #fff; font-size: 16px; margin-bottom: 12px; }
.sidebar .acct { padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .acct:hover, .sidebar .acct.active { background: #334155; color: #fff; }
.sidebar .badge { float: right; opacity: .6; font-size: 11px; }
.sidebar button { width: 100%; margin-top: 16px; padding: 8px; background: #2563eb; color: #fff; border: 0; border-radius: 6px; cursor: pointer; }
.sidebar .status { font-size: 11px; margin-top: 8px; line-height: 1.5; opacity: .8; }

.list-pane { border-right: 1px solid #ddd; background: #fff; overflow-y: auto; display: flex; flex-direction: column; }
.toolbar { padding: 12px; border-bottom: 1px solid #eee; display: flex; gap: 8px; }
.toolbar input { flex: 1; padding: 8px; border: 1px solid #ccc; border-radius: 6px; }
.toolbar button { padding: 8px 12px; cursor: pointer; border: 1px solid #ccc; background: #fff; border-radius: 6px; }
.msg-list { flex: 1; overflow-y: auto; }
.msg { padding: 12px 14px; border-bottom: 1px solid #f0f0f0; cursor: pointer; }
.msg:hover { background: #f8fafc; }
.msg.active { background: #eff6ff; border-left: 3px solid #2563eb; }
.msg .subj { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg .from { font-size: 12px; color: #666; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg .meta { font-size: 11px; color: #999; margin-top: 4px; display: flex; justify-content: space-between; }
.tag { display: inline-block; padding: 1px 6px; background: #e0e7ff; color: #3730a3; border-radius: 4px; font-size: 10px; }

.detail { background: #fff; overflow-y: auto; padding: 24px; }
.detail h1 { font-size: 20px; margin-bottom: 12px; line-height: 1.4; }
.detail .headers { font-size: 13px; color: #555; border-bottom: 1px solid #eee; padding-bottom: 12px; margin-bottom: 16px; line-height: 1.8; }
.detail .body { font-size: 14px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.detail .body-html { border: 0; width: 100%; height: 60vh; }
.empty { color: #999; text-align: center; margin-top: 40vh; }
.pager { padding: 10px; display: flex; gap: 8px; justify-content: center; align-items: center; font-size: 13px; }

.modal { position: fixed; inset: 0; background: #0008; display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-box { background: #fff; border-radius: 12px; padding: 24px; width: 420px; max-height: 90vh; overflow-y: auto; box-shadow: 0 8px 40px #0003; }
.modal-box h2 { margin-bottom: 16px; font-size: 18px; }
.modal-box label { display: block; font-size: 13px; color: #444; margin-bottom: 12px; }
.modal-box label input, .modal-box label select { display: block; width: 100%; padding: 8px; margin-top: 4px; border: 1px solid #ccc; border-radius: 6px; }
.modal-box label small { display: block; color: #888; font-size: 11px; margin-top: 4px; line-height: 1.4; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.modal-actions button { padding: 8px 20px; color: #fff; border: 0; border-radius: 6px; cursor: pointer; }
