:root {
  --bg: #faf6f3; --surface: #fff; --text: #2a2226; --muted: #7d6f74; --line: #eadfdb;
  --accent: #b8475a; --accent-soft: #f7e4e7; --yes: #2f8f5b; --yes-soft: #e3f4ea; --no: #b04a3a; --no-soft: #f8e4e0;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1517; --surface: #241d20; --text: #f1e9ec; --muted: #a8989e; --line: #3a3034;
    --accent: #e0788a; --accent-soft: #3d252b; --yes: #6cc796; --yes-soft: #1f3529; --no: #e58a7a; --no-soft: #3d2521;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--no); margin: 0; }

.btn { font: inherit; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 10px; padding: .55rem 1rem; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: .3rem .7rem; font-size: .9rem; }
.btn.danger { color: var(--no); }
.link-btn { font: inherit; background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 0; }

input, textarea, select { font: inherit; color: inherit; width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
input:focus, textarea:focus, select:focus, .btn:focus-visible, .card:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: grid; gap: .3rem; font-size: .9rem; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); padding: 1.6rem; display: grid; gap: 1rem; }
.login-card p { margin: 0; }

/* layout */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 1rem 16px .5rem; max-width: 760px; margin: 0 auto; }
.topbar h1 { font-size: 1.35rem; color: var(--accent); }
.topbar-right { display: flex; gap: .6rem; align-items: center; }
.tabs { display: flex; gap: .3rem; padding: .3rem 16px; max-width: 760px; margin: 0 auto; overflow-x: auto; }
.tabs button { font: inherit; border: 0; background: transparent; color: var(--muted); padding: .45rem .8rem; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.badge:not(:empty) { display: inline-block; min-width: 1.3em; padding: 0 .35em; border-radius: 999px; background: var(--accent); color: #fff; font-size: .75rem; text-align: center; }
.filters { display: grid; grid-template-columns: 1fr auto; gap: .5rem; padding: .5rem 16px; max-width: 760px; margin: 0 auto; }
.filters select { width: auto; }
.list { display: grid; gap: .75rem; padding: .5rem 16px 6rem; max-width: 760px; margin: 0 auto; }
.empty { text-align: center; padding: 2rem 16px; }

/* idea card */
.idea { padding: 1rem; display: grid; gap: .55rem; cursor: pointer; }
.idea.match { border-color: var(--yes); }
.idea-head { display: flex; gap: .6rem; align-items: center; }
.idea-head h3 { font-size: 1.05rem; }
.cat { font-size: 1.3rem; }
.cat.big { font-size: 2rem; }
.desc { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: .35rem .9rem; font-size: .85rem; color: var(--muted); }
.idea-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.votes { display: flex; gap: .35rem; flex-wrap: wrap; }
.chip { font-size: .8rem; padding: .15rem .55rem; border-radius: 999px; border: 1px solid var(--line); }
.chip.yes { background: var(--yes-soft); border-color: transparent; color: var(--yes); }
.chip.no { background: var(--no-soft); border-color: transparent; color: var(--no); }
.chip.wait { color: var(--muted); }
.vote-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.btn.vote.on-yes { background: var(--yes-soft); border-color: var(--yes); color: var(--yes); font-weight: 600; }
.btn.vote.on-no { background: var(--no-soft); border-color: var(--no); color: var(--no); font-weight: 600; }

.fab { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 2rem; line-height: 1; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,.2); }

/* dialogs */
dialog.sheet { border: 0; padding: 0; width: min(560px, 100vw); max-height: 92dvh; border-radius: 18px; background: var(--surface); color: var(--text); }
dialog.sheet::backdrop { background: rgba(20, 10, 14, .45); }
@media (max-width: 600px) {
  dialog.sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 18px 18px 0 0; }
}
.sheet-inner { padding: 1.2rem 16px 1.4rem; display: grid; gap: .8rem; }
.sheet-inner h2 { font-size: 1.25rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .3rem; }
.actions.spread { justify-content: space-between; border-top: 1px solid var(--line); padding-top: .8rem; }
.detail-head { display: grid; grid-template-columns: auto 1fr auto; gap: .7rem; align-items: start; }
.detail-head p { margin: .2rem 0 0; }
.section { font-size: .95rem; color: var(--muted); margin-top: .3rem; }
.comments { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.comments li { display: grid; gap: .2rem; justify-items: start; }
.comments li.mine { justify-items: end; }
.bubble { background: var(--bg); border: 1px solid var(--line); padding: .45rem .75rem; border-radius: 12px; max-width: 85%; white-space: pre-wrap; overflow-wrap: anywhere; }
.comments li.mine .bubble { background: var(--accent-soft); border-color: transparent; }
.comment-form { display: grid; grid-template-columns: 1fr auto; gap: .5rem; }
a { color: var(--accent); }
