/* Chieko Mail — Gmail 风格，只读精简 */
:root {
  --blue: #1a73e8;
  --blue-dark: #1765cc;
  --bg: #f6f8fc;
  --hover: #f1f3f4;
  --border: #e0e0e0;
  --text: #202124;
  --muted: #5f6368;
  --sidebar-w: 220px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text); background: var(--bg);
}
.hidden { display: none !important; }

/* ── 登录页 ── */
.login-wrap {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #e8f0fe 0%, #f6f8fc 60%);
}
.login-card {
  width: 360px; background: #fff; border-radius: 12px; padding: 40px 36px;
  box-shadow: 0 4px 24px rgba(60,64,67,.15); text-align: center;
}
.login-logo { margin-bottom: 8px; }
.login-card h1 { font-size: 22px; font-weight: 500; color: var(--text); }
.login-sub { color: var(--muted); font-size: 13px; margin: 6px 0 24px; }
.login-card input {
  width: 100%; padding: 12px; margin-bottom: 12px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 14px; outline: none; transition: border-color .15s;
}
.login-card input:focus { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.login-card button {
  width: 100%; padding: 12px; margin-top: 8px; background: var(--blue); color: #fff;
  border: none; border-radius: 6px; font-size: 15px; cursor: pointer; transition: background .15s;
}
.login-card button:hover { background: var(--blue-dark); }
.login-card button:disabled { background: #a8c7fa; cursor: wait; }
.login-error { color: #d93025; font-size: 13px; min-height: 18px; margin: 4px 0; }

/* ── 主布局 ── */
.main { display: flex; height: 100vh; overflow: hidden; }

/* 左栏 */
#sidebar {
  width: var(--sidebar-w); background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
}
.sidebar-user { padding: 16px 16px 8px; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--blue);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 15px; flex-shrink: 0;
}
.sidebar-email {
  font-size: 12px; color: var(--muted); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.folder-list { flex: 1; padding: 8px; overflow-y: auto; }
.folder-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px;
  border-radius: 8px; cursor: pointer; color: var(--text); font-size: 13.5px;
}
.folder-item:hover { background: var(--hover); }
.folder-item.active { background: #d3e3fd; color: #041e49; font-weight: 500; }
.folder-item .badge {
  margin-left: auto; background: var(--blue); color: #fff; font-size: 11px;
  border-radius: 10px; padding: 1px 7px; font-weight: 600;
}
.sidebar-foot {
  padding: 10px; border-top: 1px solid var(--border);
  display: flex; gap: 8px;
}
.icon-btn {
  flex: 1; padding: 8px; background: none; border: none; border-radius: 6px;
  font-size: 16px; cursor: pointer; color: var(--muted);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }

/* 中栏 */
#list-pane { flex: 0 0 400px; display: flex; flex-direction: column; background: #fff; border-right: 1px solid var(--border); }
.toolbar { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.search-box {
  display: flex; align-items: center; background: var(--hover);
  border-radius: 8px; padding: 0 12px; height: 40px;
}
.search-icon { color: var(--muted); margin-right: 8px; font-size: 16px; }
.search-box input {
  flex: 1; border: none; background: none; outline: none; font-size: 14px;
}
.msg-list { flex: 1; overflow-y: auto; }
.msg-row {
  padding: 12px 16px; border-bottom: 1px solid #f1f3f4; cursor: pointer;
  position: relative; transition: background .1s;
}
.msg-row:hover { background: var(--hover); }
.msg-row.active { background: #e8f0fe; }
.msg-row.unseen .msg-from, .msg-row.unseen .msg-subject { font-weight: 600; }
.msg-row.unseen .dot { display: inline-block; }
.dot {
  display: none; width: 8px; height: 8px; border-radius: 50%;
  background: var(--blue); margin-right: 8px; vertical-align: 1px;
}
.msg-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.msg-from { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-date { color: var(--muted); font-size: 11.5px; flex-shrink: 0; }
.msg-subject { margin-top: 2px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-snippet {
  margin-top: 2px; font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pager {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 10px; border-top: 1px solid var(--border); background: #fff;
}
.pager button {
  padding: 6px 14px; border: 1px solid var(--border); background: #fff;
  border-radius: 6px; cursor: pointer; font-size: 13px;
}
.pager button:hover:not(:disabled) { background: var(--hover); }
.pager button:disabled { opacity: .4; cursor: default; }
#page-info { color: var(--muted); font-size: 12.5px; }
.msg-empty { padding: 40px; text-align: center; color: var(--muted); }

/* 右栏 */
#detail-pane { flex: 1; background: #fff; overflow-y: auto; }
.detail-empty {
  height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 15px;
}
.detail { padding: 28px 32px; max-width: 860px; }
.detail h2 { font-size: 19px; font-weight: 500; margin-bottom: 10px; }
.detail-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; padding-bottom: 14px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.attach-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
  background: var(--hover); border-radius: 16px; font-size: 12.5px;
  color: var(--text); text-decoration: none; border: 1px solid var(--border);
}
.attach-chip:hover { background: #e2e6ea; }
#d-body {
  width: 100%; min-height: 420px; border: none; border-radius: 6px;
  background: #fff;
}

/* ── 响应式（窄屏：左栏收起，列表/详情切换）── */
@media (max-width: 860px) {
  #sidebar { display: none; }
  #list-pane { flex: 1; border-right: none; }
  #detail-pane { display: none; }
  body.detail-open #list-pane { display: none; }
  body.detail-open #detail-pane { display: block; }
  .detail-meta { flex-direction: column; gap: 4px; }
}
