:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1b1f27;
  --muted: #5a6270;
  --border: #d9dde3;
  --accent: #2952cc;
  --accent-dark: #1e3d99;
  --good: #1a7a3c;
  --good-bg: #e5f6ea;
  --tight: #9a6a00;
  --tight-bg: #fff3d6;
  --over: #b3261e;
  --over-bg: #fbe4e2;
  --radius: 10px;
  font-size: 16px;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}
.brand { font-weight: 700; font-size: 1.1rem; text-decoration: none; color: var(--text); }
.topnav { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-left: auto; }
.topnav a { text-decoration: none; color: var(--text); font-weight: 500; }
.topnav a:hover { color: var(--accent); }
.who { color: var(--muted); font-size: 0.9rem; }

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

.auth-card {
  max-width: 380px;
  margin: 3rem auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}

h1 { font-size: 1.5rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.15rem; margin-top: 2rem; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

label { display: block; font-weight: 600; margin: 0.9rem 0 0.3rem; font-size: 0.92rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], select, textarea {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
}
textarea { resize: vertical; }
.hint { color: var(--muted); font-size: 0.85rem; margin-top: 0.3rem; }

button, .button {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.65rem 1.1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  margin-top: 1.2rem;
}
button:hover, .button:hover { background: var(--accent-dark); }

.link-button {
  background: none;
  color: var(--accent);
  border: none;
  padding: 0;
  margin: 0;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: underline;
  cursor: pointer;
}
.link-button.danger { color: var(--over); }
.inline-form { display: inline; margin: 0; }
.idea-actions { display: flex; align-items: center; gap: 1rem; margin-top: 1.2rem; }

.alert {
  background: var(--over-bg);
  color: var(--over);
  border: 1px solid var(--over);
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  font-size: 0.92rem;
}
.alert-info { background: var(--tight-bg); color: var(--tight); border-color: var(--tight); }
.alert-success { background: var(--good-bg); color: var(--good); border-color: var(--good); }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin: 1.2rem 0;
}
.filter-bar input[type="search"] { flex: 1; min-width: 160px; }
.filter-bar select { width: auto; }
.clear-link { font-size: 0.88rem; }

.idea-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.8rem; }
.idea-card {
  display: flex;
  gap: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
}
.idea-detail-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  margin-top: 1rem;
}

.vote-col { display: flex; align-items: flex-start; }
.vote-form { margin: 0; }
.vote-button {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  font-weight: 700;
  min-width: 3.4rem;
  text-align: center;
  margin: 0;
}
.vote-button.voted { background: var(--accent); color: #fff; border-color: var(--accent); }
.vote-count { display: block; font-size: 1.05rem; }

.idea-body { flex: 1; min-width: 0; }
.idea-title { font-weight: 700; font-size: 1.05rem; text-decoration: none; color: var(--text); }
.idea-title:hover { color: var(--accent); }
.idea-desc { margin: 0.5rem 0; color: var(--text); white-space: pre-wrap; }

.badge-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.4rem 0; }
.badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #eef1f6;
  color: var(--muted);
}
.fit-good { background: var(--good-bg); color: var(--good); }
.fit-tight { background: var(--tight-bg); color: var(--tight); }
.fit-over { background: var(--over-bg); color: var(--over); }

.status-idea { background: #eef1f6; color: var(--muted); }
.status-planned { background: #e3ebfd; color: var(--accent-dark); }
.status-in_progress { background: var(--tight-bg); color: var(--tight); }
.status-launched { background: var(--good-bg); color: var(--good); }
.status-archived { background: #eee; color: #888; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.status-row { display: flex; align-items: center; gap: 0.6rem; margin-top: 1.2rem; }
.status-row label { margin: 0; }
.status-row select { width: auto; }
.save-hint { font-size: 0.85rem; color: var(--good); }

.card-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  margin-top: 1rem;
}

.comment-list { list-style: none; padding: 0; margin: 1rem 0; }
.comment { border-bottom: 1px solid var(--border); padding: 0.8rem 0; }
.comment-meta { margin: 0 0 0.2rem; font-size: 0.85rem; color: var(--muted); }
.comment-body { margin: 0; white-space: pre-wrap; }

.user-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.user-table th, .user-table td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.row-actions { display: flex; gap: 0.8rem; }

.empty-state { color: var(--muted); margin-top: 2rem; }

code { background: #f0f2f6; padding: 0.15rem 0.4rem; border-radius: 4px; }

@media (max-width: 520px) {
  .idea-card { flex-direction: row; }
  .topnav { gap: 0.7rem; }
}
