:root {
  --bg: #f5f6fa; --card: #fff; --text: #1d2433; --muted: #66708a; --line: #e3e6ef;
  --brand: #5b3df5; --ok: #1a8f5a; --soon: #c27a00; --urgent: #d33a3a;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11131a; --card: #1a1d27; --text: #e8eaf2; --muted: #98a0b8; --line: #2a2f3d; --brand: #8b74ff; }
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--brand); }
.topbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; text-decoration: none; font-size: 1.1rem; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.topbar nav a { text-decoration: none; }
.container { max-width: 820px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.narrow { max-width: 440px; margin: 24px auto; }
h1 { margin-top: 0; font-size: 1.5rem; }
label { display: block; margin: 12px 0; font-weight: 600; font-size: .95rem; }
input:not([type=checkbox]), select, textarea { display: block; width: 100%; margin-top: 4px; padding: 10px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
button, .btn { display: inline-block; padding: 10px 18px; font: inherit; font-weight: 600; color: #fff; background: var(--brand); border: 0; border-radius: 8px; cursor: pointer; text-decoration: none; }
button.link { background: none; color: var(--brand); padding: 0; }
form.inline { display: inline; }
.note { color: var(--muted); font-size: .9rem; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; border: 1px solid var(--line); }
.flash.ok { background: rgba(26,143,90,.12); border-color: var(--ok); }
.flash.error { background: rgba(211,58,58,.12); border-color: var(--urgent); }
.checklist { list-style: none; padding: 0; margin: 0 0 16px; }
.checklist label { font-weight: 400; display: flex; gap: 8px; align-items: center; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.chip { padding: 6px 12px; border-radius: 999px; background: var(--card); color: var(--text); border: 1px solid var(--line); font-weight: 500; }
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip-check { margin: 0 0 0 auto; font-weight: 500; }
.timeline { list-style: none; padding: 0; margin: 0; }
.item { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.item.done { opacity: .55; }
.item.done .title { text-decoration: line-through; }
.done-box { margin-top: 4px; width: 18px; height: 18px; }
.body { flex: 1; min-width: 0; }
.title { font-weight: 600; word-break: break-word; }
.meta, .desc { color: var(--muted); font-size: .88rem; }
.tag { display: inline-block; padding: 1px 8px; margin-right: 6px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); font-weight: 600; }
.countdown { font-weight: 700; white-space: nowrap; font-size: .9rem; }
.countdown.ok { color: var(--ok); } .countdown.soon { color: var(--soon); }
.countdown.urgent, .countdown.overdue { color: var(--urgent); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.card.row { padding: 14px 16px; }
.card.unread { border-left: 4px solid var(--brand); }
.card.read { opacity: .7; }
.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; border: 1px solid var(--line); background: var(--bg); }
.badge.approved, .badge.public { color: var(--ok); }
.badge.pending, .badge.restricted { color: var(--soon); }
.badge.rejected, .badge.private { color: var(--urgent); }
button.danger { background: var(--urgent); }
button[disabled] { opacity: .5; cursor: not-allowed; }
.review-form, .inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.review-form input, .inline-form input, .inline-form select, .row select { width: auto; flex: 1; min-width: 120px; display: inline-block; margin-top: 0; }
.grades { width: 100%; border-collapse: collapse; }
.grades th, .grades td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); }
.grades input { width: 100px; margin: 0; }
.grades .total td { font-weight: 700; }
.chat { height: 340px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: var(--bg); }
.msg { margin-bottom: 8px; }
.msg .who { font-weight: 700; margin-right: 6px; }
.msg .time { color: var(--muted); font-size: .78rem; }
.msg.mine .who { color: var(--brand); }
.msg .text { white-space: pre-wrap; word-break: break-word; }
.msg .del { font-size: .78rem; margin-left: 8px; }
.chat-form { display: flex; gap: 8px; margin-top: 10px; }
.chat-form input { margin: 0; }
input.copy { font-size: .85rem; margin-bottom: 10px; }
@media (max-width: 520px) { .item { flex-wrap: wrap; } .countdown { width: 100%; } }
