:root {
  --color-primary: #7C3AED;
  --color-primary-dark: #6423C7;
  --color-primary-light: #F3EEFF;
  --color-accent: #EC4899;
  --color-accent-light: #FDF2F8;
  --color-accent-2: #06B6D4;
  --color-accent-2-light: #ECFEFF;
  --gradient-brand: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  --gradient-brand-hover: linear-gradient(135deg, #6D28D9, #DB2777);

  --color-yes: #16a34a;
  --color-yes-bg: #dcfce7;
  --color-maybe: #d97706;
  --color-maybe-bg: #fef3c7;
  --color-no: #dc2626;
  --color-no-bg: #fee2e2;

  --color-text: #1E1B2E;
  --color-text-muted: #6b6478;
  --color-border: #E7E3F5;
  --color-bg: #FAF9FF;
  --color-card: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(31, 16, 64, 0.07), 0 1px 2px rgba(31, 16, 64, 0.05);
  --shadow-lg: 0 12px 32px rgba(76, 29, 149, 0.14);
}

* { box-sizing: border-box; }

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

.wrap { max-width: 1000px; margin: 0 auto; padding: 0 20px; }
.wrap.narrow { max-width: 600px; }

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.12rem;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: block;
  box-shadow: 0 3px 10px rgba(124, 58, 237, 0.3);
}
.admin-flag {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
}

main.wrap { padding-top: 28px; padding-bottom: 60px; }

.hero-panel {
  display: flex;
  align-items: center;
  gap: 32px;
  background: linear-gradient(120deg, var(--color-primary-light) 0%, var(--color-accent-light) 100%);
  border-radius: 24px;
  padding: 36px;
  margin-bottom: 24px;
}
.hero-copy { flex: 1 1 340px; }
.hero-copy h1 { font-size: 1.75rem; margin: 0 0 10px; letter-spacing: -0.01em; }
.hero-copy p { color: var(--color-text-muted); margin: 0; font-size: 1rem; }
.hero-illustration { flex: 0 0 280px; max-width: 42%; }
.hero-illustration img { width: 100%; height: auto; display: block; }
@media (max-width: 720px) {
  .hero-panel { flex-direction: column; padding: 26px; text-align: center; }
  .hero-illustration { max-width: 70%; }
}

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

.card h1 { margin-top: 0; font-size: 1.4rem; }
.card h2 { font-size: 1.05rem; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--gradient-brand);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  box-shadow: 0 3px 8px rgba(124, 58, 237, 0.3);
}

.vote-submit-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
}

.grid-card.step-locked .grid-scroll { opacity: 0.55; }
.grid-card.step-locked td.cell-vote.editable { cursor: not-allowed; }
.grid-card.step-locked td.cell-vote.editable:hover { background: transparent; }

.poll-head .poll-desc { color: var(--color-text-muted); white-space: pre-line; }
.poll-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
}
.badge-closed { background: var(--color-no-bg); color: var(--color-no); }
.badge-deadline { background: var(--color-maybe-bg); color: var(--color-maybe); }
.badge-final { background: var(--color-yes-bg); color: var(--color-yes); }
.badge-location {
  background: var(--color-accent-2-light);
  color: #0e7490;
  text-decoration: none;
}
.badge-location:hover { filter: brightness(0.96); }
.badge-location svg { width: 13px; height: 13px; flex: 0 0 auto; }

.form .field, .form .field-row { margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.field span { font-size: 0.85rem; font-weight: 600; color: var(--color-text); }
.field-narrow { max-width: 130px; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }

.input-icon-group { position: relative; }
.input-icon-group svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--color-primary); pointer-events: none;
}
.input-icon-group input { padding-left: 34px; }

input[type="text"], input[type="email"], input[type="date"], input[type="time"],
input[type="number"], input[type="datetime-local"], textarea {
  border: 1px solid var(--color-border);
  border-radius: 9px;
  padding: 9px 11px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--color-text);
  background: #fff;
  width: 100%;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  cursor: pointer;
}
.checkbox input { width: 16px; height: 16px; accent-color: var(--color-primary); }

.hint { color: var(--color-text-muted); font-size: 0.85rem; margin: 4px 0 14px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 9px;
  padding: 10px 18px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.05s ease, opacity 0.15s ease, filter 0.15s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--gradient-brand); color: #fff; box-shadow: 0 6px 16px rgba(124, 58, 237, 0.32); }
.btn-primary:hover { background: var(--gradient-brand-hover); }
.btn-secondary { background: var(--color-primary-light); color: var(--color-primary-dark); }
.btn-secondary:hover { background: #e6defd; }
.btn-ghost { background: transparent; color: var(--color-primary-dark); border: 1px dashed var(--color-primary); }
.btn-danger { background: #fff; color: var(--color-no); border: 1px solid var(--color-no); }
.btn-danger:hover { background: var(--color-no-bg); }
.btn-block { width: 100%; margin-top: 10px; }
.btn-small { padding: 6px 12px; font-size: 0.8rem; }
.btn-icon {
  background: var(--color-no-bg); color: var(--color-no);
  width: 32px; height: 32px; border-radius: 8px; font-size: 1rem; padding: 0; flex: 0 0 auto;
}
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.option-row {
  display: flex; gap: 10px; align-items: flex-end;
  padding: 12px; margin-bottom: 10px;
  background: #fbfaff; border: 1px solid var(--color-border); border-radius: 10px;
}
.option-row .field { margin-bottom: 0; }

.alert {
  padding: 12px 16px; border-radius: 10px; font-size: 0.9rem; margin-bottom: 16px;
}
.alert-error { background: var(--color-no-bg); color: var(--color-no); }
.alert-info { background: var(--color-primary-light); color: var(--color-primary-dark); }
.alert-warning { background: var(--color-maybe-bg); color: var(--color-maybe); }

.success-badge {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--gradient-brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700; margin-bottom: 12px;
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.35);
}

.link-box { margin-top: 16px; }
.link-box label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 6px; color: var(--color-text-muted); }
.link-box-admin { padding: 12px; background: #fff7ed; border: 1px solid #fde68a; border-radius: 10px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; font-size: 0.85rem; background: #f9fafb; }
.btn-link { display: inline-block; margin-top: 8px; font-size: 0.85rem; color: var(--color-primary-dark); text-decoration: none; font-weight: 700; }
.btn-link:hover { text-decoration: underline; }

.grid-card { padding: 20px; }
.grid-scroll { overflow-x: auto; }

table.poll-grid {
  border-collapse: collapse;
  width: 100%;
  min-width: 480px;
}
table.poll-grid th, table.poll-grid td {
  border: 1px solid var(--color-border);
  padding: 8px 10px;
  text-align: center;
  white-space: nowrap;
  font-size: 0.88rem;
}
table.poll-grid thead th {
  background: #fbfaff;
  font-weight: 700;
}
table.poll-grid th.col-name, table.poll-grid td.cell-name {
  text-align: left;
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 1;
  min-width: 140px;
}
table.poll-grid thead th.col-name { background: #fbfaff; z-index: 2; }

th.option-head { cursor: pointer; min-width: 90px; }
th.option-head:hover { background: var(--color-primary-light); }
th.option-head.is-final { background: var(--color-yes-bg); }
th.option-head .opt-date { font-size: 0.82rem; }
th.option-head .opt-time { font-size: 0.75rem; font-weight: 500; color: var(--color-text-muted); }
th.option-head .opt-cap { font-size: 0.72rem; font-weight: 500; color: var(--color-text-muted); display: block; margin-top: 2px; }
th.option-head .opt-remove { color: var(--color-no); font-weight: 700; margin-left: 4px; cursor: pointer; }
th.total-head { min-width: 70px; }

tr.row-me td.cell-name { font-weight: 700; }

td.cell-name .participant-name { display: inline-flex; align-items: center; gap: 6px; }
.avatar {
  width: 23px; height: 23px; border-radius: 50%;
  background: var(--gradient-brand);
  color: #fff; font-size: 0.68rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.remove-participant { color: var(--color-no); cursor: pointer; font-weight: 700; margin-left: 6px; }

td.cell-vote { cursor: default; }
td.cell-vote.editable { cursor: pointer; }
td.cell-vote.editable:hover { background: var(--color-primary-light); }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.dot-yes { background: var(--color-yes); }
.dot-maybe { background: var(--color-maybe); }
.dot-no { background: var(--color-no); }

.vote-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  font-size: 0.85rem; font-weight: 800; color: #fff; line-height: 1;
}
.vote-chip-yes { background: var(--color-yes); box-shadow: 0 2px 6px rgba(22, 163, 74, .35); }
.vote-chip-maybe { background: var(--color-maybe); box-shadow: 0 2px 6px rgba(217, 119, 6, .35); }
.vote-chip-no { background: var(--color-no); box-shadow: 0 2px 6px rgba(220, 38, 38, .35); }
.vote-chip-empty { background: transparent; border: 2px dashed var(--color-border); color: var(--color-text-muted); font-weight: 600; box-sizing: border-box; }

.count-cell { font-size: 0.78rem; color: var(--color-text-muted); }
.count-cell b { color: var(--color-yes); font-size: 0.9rem; }

.legend, .legend-row { display: flex; gap: 16px; align-items: center; margin-top: 12px; font-size: 0.85rem; color: var(--color-text-muted); flex-wrap: wrap; }
.legend-row { justify-content: space-between; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

.vote-status { margin-left: 10px; font-size: 0.85rem; color: var(--color-text-muted); }

.empty-state {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 28px 16px; color: var(--color-text-muted);
}
.empty-state img { width: 92px; height: 92px; margin-bottom: 10px; }
.empty-state strong { color: var(--color-text); font-size: 0.95rem; }
.empty-state span { font-size: 0.85rem; margin-top: 2px; }

.admin-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 720px) { .admin-grid-2 { grid-template-columns: 1fr; } }

.divider { border: none; border-top: 1px solid var(--color-border); margin: 18px 0; }

.footer { text-align: center; color: var(--color-text-muted); font-size: 0.82rem; padding: 20px 0; }
.footer .brand-mark { width: 20px; height: 20px; vertical-align: -5px; margin-right: 4px; }
