:root {
  --bg: #f6f8fc;
  --card: #ffffff;
  --text: #202124;
  --muted: #5f6368;
  --line: #e6e8ee;
  --primary: #1a73e8;
  --primary-soft: #e8f0fe;
  --danger: #d93025;
  --sidebar: #f6f8fc;
  --hover: #f2f3f5;
  --active: #d3e3fd;
  --shadow: 0 1px 2px rgba(60, 64, 67, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: "Google Sans", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif; }
button, input, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; }
.page { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 28px 0 48px; }

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.topbar h1 { margin: 0 0 6px; font-size: 22px; font-weight: 650; }
.topbar p { margin: 0; color: var(--muted); font-size: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.pad { padding: 22px; }

.panel { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 16px; }
label { display: block; margin: 0 0 8px; color: #4b5563; font-size: 13px; }
input, textarea {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  outline: none;
}
textarea { min-height: 220px; resize: vertical; line-height: 1.6; }
input:focus, textarea:focus { border-color: #b9c8f0; box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.08); }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.hint { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.hint code { font-size: 12px; background: #f3f4f6; padding: 1px 4px; border-radius: 4px; }

.btn {
  border: 0;
  border-radius: 10px;
  padding: 9px 14px;
  background: var(--primary);
  color: #fff;
}
.btn.secondary { background: #fff; color: #374151; border: 1px solid #e5e7eb; }
.btn.danger { background: #fff; color: var(--danger); border: 1px solid #f0d0d0; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.login .card { width: min(420px, calc(100% - 32px)); }

.batch-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.batch-item:last-child { border-bottom: 0; }
.forward-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.muted { color: var(--muted); font-size: 12px; }
.error { color: var(--danger); font-size: 13px; }
.success { color: #1e8e3e; font-size: 13px; }

.reader {
  height: 100vh;
  display: grid;
  grid-template-columns: 260px 360px 1fr;
  background: #fff;
  overflow: hidden;
}
.reader-accounts {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.reader-brand {
  padding: 18px 16px 12px;
  font-size: 18px;
  font-weight: 700;
}
.reader-accounts-list {
  overflow: auto;
  padding: 0 8px 16px;
}
.account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  margin-bottom: 4px;
}
.account-row:hover { background: var(--hover); }
.account-row.is-active { background: var(--active); }
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #1a73e8;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  flex: none;
}
.account-meta { min-width: 0; }
.account-meta b, .msg-from, .msg-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-meta b { font-size: 13px; }
.account-meta em {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-list {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 12px 8px;
  border-bottom: 1px solid var(--line);
}
.folder-tabs { display: flex; gap: 6px; }
.folder-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 16px;
  font-size: 13px;
}
.folder-tab.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.icon-btn {
  border: 0;
  background: transparent;
  color: #3c4043;
  padding: 8px 10px;
  border-radius: 16px;
}
.icon-btn:hover { background: var(--hover); }
.list-body { flex: 1; overflow: auto; }
.list-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.msg-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #f0f1f3;
  background: #fff;
  text-align: left;
  padding: 12px 16px 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
}
.msg-row:hover { background: #f8f9fa; }
.msg-row.is-active { background: var(--primary-soft); }
.msg-from { font-size: 13px; font-weight: 600; }
.msg-time { color: var(--muted); font-size: 12px; }
.msg-row strong { grid-column: 1 / -1; font-size: 13px; font-weight: 500; }
.msg-row em {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-detail {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
}
.detail-empty {
  flex: 1;
  display: grid;
  place-items: center;
  color: #80868b;
  font-size: 14px;
}
.detail-head { padding: 20px 32px 16px; border-bottom: 1px solid var(--line); }
.detail-head h1 {
  margin: 0 0 16px;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.35;
}
.detail-from { display: flex; align-items: center; gap: 12px; }
.detail-from b { display: block; font-size: 14px; }
.detail-from span { color: var(--muted); font-size: 12px; }
.confirm-link {
  display: inline-block;
  margin-top: 14px;
  padding: 8px 16px;
  border-radius: 4px;
  background: #1a73e8;
  color: #fff;
  font-size: 13px;
}
.detail-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
  padding: 0 16px;
}

@media (max-width: 980px) {
  .reader { grid-template-columns: 72px 1fr; }
  .reader-detail { display: none; }
  .account-meta { display: none; }
  .reader-accounts { width: 72px; }
}
@media (max-width: 860px) {
  .page { width: min(100% - 24px, 100%); }
  .panel { grid-template-columns: 1fr; }
}
