:root {
  --primary: #1e3c72;
  --primary-light: #2a5298;
  --bg: #f4f6fb;
  --card: #ffffff;
  --border: #e1e5ee;
  --text: #1c2333;
  --muted: #6b7280;
  --ok: #0e6245;
  --ok-bg: #e6f7e6;
  --error: #9b1c1c;
  --error-bg: #fde8e8;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

header {
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  color: white;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand { font-size: 20px; font-weight: 700; }
.brand span { font-weight: 400; opacity: .85; }

#userbar { font-size: 14px; display: flex; align-items: center; gap: 12px; }
#userbar button {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.4);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}

h2 { margin-top: 0; font-size: 18px; color: var(--primary); }
h3 { font-size: 15px; margin: 0 0 8px; }

label { display: block; font-size: 13px; font-weight: 600; margin-top: 12px; margin-bottom: 4px; }

input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

input[type="checkbox"], input[type="radio"] {
  width: auto;
  flex: none;
}

textarea { resize: vertical; min-height: 60px; }

button.primary, button[type="submit"] {
  margin-top: 16px;
  padding: 10px 18px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
button.primary:hover, button[type="submit"]:hover { background: var(--primary-light); }

button.secondary {
  padding: 7px 14px;
  background: white;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

button.small { padding: 5px 10px; font-size: 12px; }

.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tabs button {
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.tabs button.active { background: var(--primary); color: white; border-color: var(--primary); }

.msg { padding: 10px 12px; border-radius: var(--radius); margin-top: 12px; font-size: 13px; white-space: pre-wrap; }
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg.error { background: var(--error-bg); color: var(--error); }

.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

.list-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 12px;
}
.list-item .meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.badge {
  display: inline-block;
  background: var(--primary);
  color: white;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
}
.badge.outline { background: white; color: var(--primary); border: 1px solid var(--primary); }
.badge.gray { background: #eceff5; color: var(--muted); }

.score { font-weight: 700; color: var(--primary); font-size: 15px; }

.chat-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 10px;
  padding: 12px;
  background: #fafbfd;
}
.chat-messages { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.bubble { max-width: 75%; padding: 8px 12px; border-radius: 12px; font-size: 13px; }
.bubble.mine { align-self: flex-end; background: var(--primary); color: white; }
.bubble.theirs { align-self: flex-start; background: #eceff5; color: var(--text); }
.bubble .time { display: block; font-size: 10px; opacity: .7; margin-top: 3px; }
.chat-send { display: flex; gap: 8px; margin-top: 10px; }
.chat-send textarea { min-height: 38px; }

.muted { color: var(--muted); font-size: 13px; }
.link-btn { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 13px; text-decoration: underline; padding: 0; }

.notif-wrap { position: relative; }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--error); color: white;
  border-radius: 10px; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; line-height: 16px; text-align: center; padding: 0 3px;
}
.notif-panel {
  position: absolute; top: 38px; right: 0;
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  width: 300px; max-height: 360px; overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  z-index: 20; padding: 6px;
}
.notif-item { padding: 8px 10px; border-radius: 6px; font-size: 12px; cursor: pointer; }
.notif-item + .notif-item { margin-top: 2px; }
.notif-item.unread { background: #eef2fb; font-weight: 600; }
.notif-item .time { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; font-weight: 400; }
.notif-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 12px; }

.stars { color: #d9a441; letter-spacing: 1px; }

.site-footer { text-align: center; padding: 20px; }
.site-footer a { color: var(--muted); font-size: 13px; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
