/* ============ Seto Poll ============ */
:root {
  --bg: #0f172a;
  --bg2: #111c33;
  --card: #16233f;
  --card2: #1e2d4d;
  --line: #2a3a5c;
  --text: #e8eefc;
  --muted: #9fb0d0;
  --accent: #4f8cff;
  --accent-d: #3b74e0;
  --green: #34c759;
  --green-d: #28a745;
  --red: #ff5a5f;
  --amber: #ffb020;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--red); min-height: 1.2em; margin: 8px 0 0; font-size: 14px; }
.screen { min-height: 100dvh; }
.center { display: flex; align-items: center; justify-content: center; padding: 24px 16px; }

/* ---- Auth ---- */
.card {
  width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; box-shadow: 0 10px 40px rgba(0,0,0,.35);
}
.card h1 { margin: 0 0 4px; font-size: 26px; }
.tabs { display: flex; gap: 8px; margin: 18px 0 14px; }
.tab { flex: 1; background: var(--card2); color: var(--muted); border: 1px solid var(--line); padding: 10px; border-radius: 10px; font-weight: 600; cursor: pointer; }
.tab.active { color: #fff; background: var(--accent); border-color: var(--accent); }
input, textarea, select, button { font: inherit; }
form input, form textarea, .sel, textarea.inp, input.inp {
  width: 100%; margin-top: 10px; padding: 12px 14px; background: var(--bg2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; outline: none;
}
form input:focus, textarea:focus, .sel:focus, .inp:focus { border-color: var(--accent); }
form button[type=submit], .btn-primary {
  width: 100%; margin-top: 14px; padding: 13px; background: var(--accent); color: #fff; border: 0;
  border-radius: 10px; font-weight: 700; cursor: pointer;
}
form button[type=submit]:active, .btn-primary:active { background: var(--accent-d); }

/* ---- Header ---- */
.app-header {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 12px 16px; background: rgba(15,23,42,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.app-title { font-weight: 800; font-size: 18px; cursor: pointer; }
.header-right { display: flex; align-items: center; gap: 8px; }
.chip { background: var(--card2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  background: var(--card2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.icon-btn:active { background: var(--line); }

.page { max-width: 760px; margin: 0 auto; padding: 16px; padding-bottom: 60px; }

/* ---- Butoane generice ---- */
button { cursor: pointer; }
.btn { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card2); color: var(--text); font-weight: 600; }
.btn:active { background: var(--line); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.green { background: var(--green); border-color: var(--green); color: #05230f; }
.btn.danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn.ghost, .ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 10px 14px; border-radius: 10px; font-weight: 600; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; }

/* ---- Home ---- */
.home-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.home-top h2 { margin: 0; font-size: 20px; }
.poll-card {
  display: block; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; color: var(--text); cursor: pointer;
}
.poll-card:active { border-color: var(--accent); }
.poll-card h3 { margin: 0 0 6px; font-size: 16px; }
.pc-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--muted); }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; border: 1px solid var(--line); }
.badge.type { background: #23345a; color: #bcd0ff; border-color: #2f4570; }
.badge.open { background: rgba(52,199,89,.15); color: #7ee29a; border-color: rgba(52,199,89,.4); }
.badge.closed { background: rgba(255,90,95,.12); color: #ff9599; border-color: rgba(255,90,95,.35); }
.badge.anon { background: #2a2350; color: #cbb8ff; border-color: #3b3170; }
.badge.voted { background: rgba(79,140,255,.15); color: #a9c6ff; border-color: rgba(79,140,255,.4); }
.badge.novote { background: rgba(255,176,32,.12); color: #ffcf7a; border-color: rgba(255,176,32,.35); }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

/* ---- Detaliu ---- */
.back { background: none; border: 0; color: var(--muted); font-weight: 600; padding: 4px 0; margin-bottom: 6px; }
.detail-head h2 { margin: 6px 0 6px; font-size: 22px; line-height: 1.25; }
.detail-desc { color: var(--muted); margin: 0 0 10px; white-space: pre-wrap; }
.section { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 14px 0; }
.section h4 { margin: 0 0 12px; font-size: 15px; }
.deadline { font-size: 13px; }
.deadline.soon { color: var(--amber); }
.deadline.over { color: var(--red); }

/* voting */
.opt {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 12px; margin-bottom: 10px; background: var(--bg2); cursor: pointer; user-select: none;
}
.opt.selected { border-color: var(--accent); background: #1a2b4d; }
.opt .mark { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.opt.checkbox .mark { border-radius: 6px; }
.opt.selected .mark { border-color: var(--accent); background: var(--accent); color: #fff; }
.opt .otxt { flex: 1; }
.opt .added { font-size: 11px; color: var(--muted); }
.opt-del { background: none; border: 0; color: var(--red); font-size: 18px; padding: 0 4px; }

/* ranked */
.rank-num { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: 0 0 auto; }
.rank-btns { display: flex; flex-direction: column; gap: 2px; }
.rank-btns button { width: 26px; height: 22px; padding: 0; line-height: 1; }

/* date states */
.date-states { display: flex; gap: 6px; }
.date-states button { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--card2); color: var(--muted); font-weight: 600; font-size: 13px; }
.date-states button.on-yes { background: var(--green); border-color: var(--green); color: #05230f; }
.date-states button.on-maybe { background: var(--amber); border-color: var(--amber); color: #3a2600; }

/* rating stars */
.stars { display: flex; gap: 6px; font-size: 34px; }
.star { cursor: pointer; color: #45537a; line-height: 1; }
.star.on { color: #ffd24a; }

/* results */
.res-row { margin-bottom: 12px; }
.res-line { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 5px; }
.res-line .win { color: #ffd24a; }
.bar { height: 12px; background: var(--bg2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar > i.maybe { background: var(--amber); }
.res-sub { font-size: 12px; color: var(--muted); margin-left: 6px; }
.answers li { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; list-style: none; }
.answers { padding: 0; margin: 0; }
.answers .who { font-size: 12px; color: var(--muted); display: block; margin-top: 4px; }

/* participants */
.people { display: flex; flex-direction: column; gap: 6px; }
.person { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); }
.person.novote { border-color: rgba(255,176,32,.4); }
.person .status { font-size: 13px; font-weight: 700; }
.person .status.yes { color: var(--green); }
.person .status.no { color: var(--amber); }
.nudge-box { margin-top: 10px; }

/* comments */
.cmt { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.cmt .who { font-size: 12px; color: var(--muted); margin-bottom: 3px; display: flex; justify-content: space-between; }
.cmt .del { background: none; border: 0; color: var(--red); font-size: 12px; }

/* create form */
.field { margin-bottom: 14px; }
.field > label, .lbl { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.type-btn { padding: 12px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--card2); color: var(--text); font-size: 12.5px; font-weight: 600; text-align: center; }
.type-btn .ico { font-size: 20px; display: block; margin-bottom: 4px; }
.type-btn.active { border-color: var(--accent); background: #1a2b4d; }
.opt-edit { display: flex; gap: 8px; margin-bottom: 8px; }
.opt-edit input { margin: 0; }
.opt-edit .x { flex: 0 0 auto; }
.toggle { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line); }
.toggle:last-child { border-bottom: 0; }
.toggle .t-label { font-size: 14px; }
.toggle .t-label small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.switch { position: relative; width: 46px; height: 27px; flex: 0 0 auto; }
.switch input { display: none; }
.switch .sl { position: absolute; inset: 0; background: var(--card2); border: 1px solid var(--line); border-radius: 999px; transition: .15s; }
.switch .sl::after { content: ""; position: absolute; width: 21px; height: 21px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: .15s; }
.switch input:checked + .sl { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .sl::after { left: 21px; }
.inline-2 { display: flex; gap: 10px; }
.inline-2 > div { flex: 1; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.modal-card.modal-wide { max-width: 520px; }
.modal-card h2 { margin: 0 0 10px; font-size: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.modal-scroll { max-height: 64vh; max-height: 64dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.qr-box { display: flex; justify-content: center; padding: 12px; background: #fff; border-radius: 12px; margin: 10px 0; }
.qr-box img, .qr-box canvas { display: block; }
.invite-url { word-break: break-all; font-size: 13px; color: var(--muted); background: var(--bg2); padding: 8px 10px; border-radius: 8px; }

/* users modal */
.usr { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); gap: 8px; }
.usr:last-child { border-bottom: 0; }
.usr .u-name { font-weight: 600; }
.usr .u-mail { font-size: 12px; color: var(--muted); }
.usr-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.badge-block { color: var(--red); font-size: 11px; font-weight: 700; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #05230f; color: #d6ffe2; border: 1px solid var(--green); padding: 10px 16px; border-radius: 10px; z-index: 80; font-weight: 600; box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.toast.err { background: #2a0d0e; color: #ffd6d7; border-color: var(--red); }

.fab { position: fixed; right: 18px; bottom: 18px; z-index: 30; }

/* ---- Drawer (burger) ---- */
.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer.hidden { display: none; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.drawer-panel {
  position: absolute; top: 0; left: 0; bottom: 0; width: 82%; max-width: 320px;
  background: var(--card); border-right: 1px solid var(--line); padding: 18px 16px;
  overflow-y: auto; box-shadow: 6px 0 30px rgba(0,0,0,.4);
  transform: translateX(0); animation: drawer-in .16s ease;
}
@keyframes drawer-in { from { transform: translateX(-100%); } to { transform: translateX(0); } }
.drawer-head { font-weight: 800; font-size: 18px; margin-bottom: 14px; }
.drawer-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 16px 0 6px; font-weight: 700; }
.drawer-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; text-decoration: none;
  padding: 12px 12px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line);
  color: var(--text); font-weight: 600; font-size: 15px; margin-bottom: 8px; cursor: pointer;
}
.drawer-item:active { background: var(--line); }
.drawer-item.current { border-color: var(--accent); background: #1a2b4d; }
.drawer-item.danger { color: var(--red); border-color: rgba(255,90,95,.35); }
.drawer-user { font-size: 13px; color: var(--muted); padding: 4px 2px 8px; }

/* ---- Breakdown (cine ce a votat) ---- */
.bd-opt { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: var(--bg2); }
.bd-opt h5 { margin: 0 0 8px; font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
.bd-opt h5 .n { font-size: 12px; color: var(--muted); font-weight: 600; }
.bd-people { display: flex; flex-wrap: wrap; gap: 6px; }
.bd-chip { background: var(--card2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; font-size: 13px; }
.bd-chip .tag { color: var(--muted); font-size: 11px; margin-left: 4px; }
.bd-empty { color: var(--muted); font-size: 13px; }
.btn-block { display: block; width: 100%; margin-top: 10px; }
@media (min-width: 620px) { .type-grid { grid-template-columns: repeat(6, 1fr); } }
