* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #1c1e21;
  background: #f5f6f8;
}
nav {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border-bottom: 1px solid #e2e4e8;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}
nav .brand { font-weight: 700; margin-right: 16px; padding: 14px 0; }
nav a {
  color: #444;
  text-decoration: none;
  padding: 14px 12px;
  border-bottom: 2px solid transparent;
}
nav a.active { color: #0b57d0; border-bottom-color: #0b57d0; }
nav a:hover { color: #0b57d0; }
nav .right { margin-left: auto; }

main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 22px; margin: 0; }
h3 { margin: 14px 0 6px; }
.muted { color: #6b7280; font-size: 14px; }
.error { color: #c62828; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.tabs { display: flex; gap: 6px; }
.tab {
  padding: 8px 18px;
  border-radius: 8px 8px 0 0;
  background: #e6e8ec;
  color: #444;
  text-decoration: none;
}
.tab.active { background: #0b57d0; color: #fff; }

.period { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.period label { font-size: 14px; color: #444; }
.platforms { display: flex; align-items: center; gap: 10px; }
.platforms label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
input[type="date"], input[type="text"], input[type="password"],
input:not([type]) {
  padding: 7px 10px;
  border: 1px solid #cfd3da;
  border-radius: 6px;
  font-size: 14px;
}
button, .button {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: #0b57d0;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .button:hover { filter: brightness(1.08); }
button:disabled { background: #9aa4b2; cursor: default; }
.secondary { background: #5f6b7a; }
.danger { background: #c62828; }

table.posts {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #e2e4e8;
  border-radius: 8px;
  overflow: hidden;
  font-size: 14px;
}
table.posts th, table.posts td {
  padding: 8px 10px;
  border-bottom: 1px solid #eef0f3;
  text-align: left;
}
table.posts th { background: #f0f2f5; font-weight: 600; }
tr.week-row td {
  background: #dbe7f7;
  font-weight: 600;
  color: #1a3d6e;
}
tr.row-ok td { background: #f0faf1; }
tr.row-no td { background: #fdf2f2; color: #8a8f98; }
table.compact { margin-bottom: 12px; }

.mark-cell { white-space: nowrap; }
button.mark {
  width: 34px;
  height: 30px;
  padding: 0;
  font-size: 15px;
  background: #e6e8ec;
  color: #666;
}
button.mark.ok.on { background: #2e7d32; color: #fff; }
button.mark.no.on { background: #c62828; color: #fff; }

.account-block {
  background: #fff;
  border: 1px solid #e2e4e8;
  border-left: 6px solid #ccc;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
.account-block.green { border-left-color: #2e7d32; }
.account-block.yellow { border-left-color: #f9a825; }
.account-block header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
/* which accounts a collection run should cover */
.acc-picker {
  border: 1px solid #dfe3ea;
  border-radius: 8px;
  margin: 12px 0;
  background: #fff;
}
.acc-picker > summary {
  padding: 9px 12px;
  cursor: pointer;
  font-size: 14px;
  color: #444;
  user-select: none;
}
.acc-tools {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid #eef1f5;
  flex-wrap: wrap;
}
.acc-tools input[type="search"] {
  flex: 1 1 220px;
  padding: 7px 10px;
  border: 1px solid #cfd3da;
  border-radius: 6px;
  font-size: 14px;
}
.acc-list {
  max-height: 260px;
  overflow-y: auto;
  border-top: 1px solid #eef1f5;
}
.acc-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid #f4f6f9;
}
.acc-row:hover { background: #f7f9fc; }
.acc-row[hidden] { display: none; }
.acc-nm { flex: 0 0 auto; font-weight: 600; }
.acc-hd { color: #6b7280; font-size: 13px; margin-left: auto; white-space: nowrap; }

.meaning-cell input.post-meaning {
  width: 52px;
  padding: 4px 6px;
  border: 1px solid #cfd3da;
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
}

/* rating admin table */
.rating-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 12px 0 16px;
}
.rating-tools .upload {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13px;
  color: #444;
}
.rating-tools .upload input[type="file"] { font-size: 13px; max-width: 240px; }
button.primary { background: #2563eb; }
.rating-table th .sub, .rating-table td .sub {
  color: #9aa4b2;
  font-size: 12px;
  font-weight: 400;
}
.rating-table td { vertical-align: middle; }
.rating-table input.academic {
  width: 68px;
  padding: 5px 7px;
  border: 1px solid #cfd3da;
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
}
.rating-table tr.incomplete { background: #fffaf0; }
.rating-table tr.incomplete input.academic:placeholder-shown { border-color: #e3b341; }
.rating-table .total b { font-size: 15px; }
.rating-note { margin-top: 10px; }

/* accounts that produced no posts in the last run, with the reason why */
.zero-box {
  border: 1px solid #e3d3a8;
  background: #fffbf0;
  border-radius: 8px;
  margin: 12px 0 18px;
  overflow: hidden;
}
.zero-head {
  padding: 8px 12px;
  background: #f6ecd2;
  font-size: 14px;
  font-weight: 600;
  color: #7a5c00;
}
.zero-table { width: 100%; border-collapse: collapse; }
.zero-table td {
  padding: 7px 12px;
  border-top: 1px solid #f0e6cc;
  font-size: 14px;
  vertical-align: middle;
}
.zero-name { font-weight: 600; }
.zero-user { color: #6b7280; white-space: nowrap; }
.zero-detail { font-size: 13px; }
.reason {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.reason-not_found   { background: #ffd6d6; color: #8c1c1c; }
.reason-private     { background: #e0dcff; color: #372a86; }
.reason-no_posts    { background: #e5e7eb; color: #4b5563; }
.reason-no_keyword  { background: #e5e7eb; color: #4b5563; }
.reason-unavailable { background: #ffe4c4; color: #8a4b00; }
.reason-error       { background: #ffd6d6; color: #8c1c1c; }

.badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.badge.green { background: #c6efce; color: #1b5e20; }
.badge.yellow { background: #ffeb9c; color: #7a5c00; }
.legend {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  vertical-align: -2px;
}
.legend.green { background: #2e7d32; }
.legend.yellow { background: #f9a825; }

.panel {
  background: #fff;
  border: 1px solid #e2e4e8;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
.panel h3:first-child { margin-top: 0; }
.form-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.form-row input { flex: 1 1 180px; }

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-box {
  background: #fff;
  border: 1px solid #e2e4e8;
  border-radius: 10px;
  padding: 32px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-box h1 { text-align: center; font-size: 20px; }

/* ── collection log panel ─────────────────────────────────────────────────── */
.log-box {
  background: #0f1720;
  border: 1px solid #24303d;
  border-radius: 8px;
  margin: 12px 0 18px;
  overflow: hidden;
}
.log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #1a2432;
  color: #d6dee8;
  font-size: 13px;
  font-weight: 600;
}
.log-head button { padding: 4px 12px; font-size: 12px; }
.log-lines {
  max-height: 340px;
  overflow-y: auto;
  padding: 10px 12px;
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.55;
  color: #c3ccd6;
  white-space: pre-wrap;
  word-break: break-word;
}
.log-line { display: block; }
.log-line .log-ts { color: #5f6f80; margin-right: 8px; }
.log-line.lvl-ok    { color: #6ee7a0; }
.log-line.lvl-warn  { color: #f0c674; }
.log-line.lvl-error { color: #ff8b8b; }
