:root {
  --bg: #f7f7f8;
  --card: #ffffff;
  --text: #1c1c1e;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-fg: #ffffff;
  --err: #dc2626;
  --ok: #16a34a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --card: #1c1c1e;
    --text: #f2f2f2;
    --muted: #9ca3af;
    --border: #2e2e30;
    --accent: #3b82f6;
    --accent-fg: #0b0b0c;
  }
}

* { box-sizing: border-box; }

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

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

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

.auth-card { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 12px; }
.auth-card h1 { font-size: 1.25rem; margin: 0 0 8px; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); }

input, select, button {
  font: inherit;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

button {
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  cursor: pointer;
}
button:hover { opacity: 0.9; }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  font-size: 0.85rem;
}

.error { color: var(--err); font-size: 0.9rem; }
.notice { color: var(--muted); font-size: 0.9rem; }
.ok { color: var(--ok); }
.err { color: var(--err); }
.muted { color: var(--muted); }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.brand { font-weight: 600; }
.badge {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  margin-left: 6px;
}

.topbar-right { display: flex; gap: 16px; align-items: center; font-size: 0.9rem; }
.topbar-right a { color: var(--text); text-decoration: none; }
.topbar-right a:hover { text-decoration: underline; }

.container { max-width: 900px; margin: 24px auto; padding: 0 16px; }
.container.narrow { max-width: 600px; }

h2 { font-size: 1rem; margin: 0 0 14px; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline { display: inline; }
.actions { display: flex; gap: 10px; align-items: center; }

.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.list a { color: var(--accent); text-decoration: none; }
.list a:hover { text-decoration: underline; }

.thread {
  height: 55vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.msg { max-width: 75%; padding: 8px 12px; border-radius: 10px; background: var(--bg); }
.msg .meta { font-size: 0.7rem; color: var(--muted); margin-bottom: 2px; }
.msg .body { white-space: pre-wrap; word-break: break-word; }
.msg.mine { align-self: flex-end; background: var(--accent); color: var(--accent-fg); }
.msg.mine .meta { color: rgba(255,255,255,0.75); }

.send-form { display: flex; gap: 8px; }
.send-form input { flex: 1; }
