:root {
  color-scheme: light;
  --page: #f5f7fb;
  --panel: #fff;
  --ink: #172137;
  --muted: #53617a;
  --line: #dce3ef;
  --blue: #2351d9;
  --blue-hover: #1a42bc;
  --soft-blue: #eaf0ff;
  --radius: 20px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  line-height: 1.55;
}

h1, h2, p, ul { margin: 0; }
h1, h2 { line-height: 1.14; letter-spacing: -.035em; overflow-wrap: anywhere; }
h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: 1.35rem; }
a { color: inherit; }
button, input, textarea { font: inherit; }
button, summary { cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid #4c78ec;
  outline-offset: 3px;
}

.shell {
  width: min(1112px, calc(100% - 3rem));
  margin-inline: auto;
}

.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand, .topbar-nav, .button {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
}

.brand {
  font-weight: 780;
  font-size: 1.13rem;
  letter-spacing: -.035em;
  text-decoration: none;
}

.brand-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 3px;
  padding-left: 9px;
  background: var(--blue);
  border-radius: 11px;
}

.brand-mark i {
  display: block;
  height: 2px;
  width: 17px;
  border-radius: 4px;
  background: white;
}

.brand-mark i:last-child {
  width: 10px;
  background: #acffd3;
}

.topbar-nav { gap: 1rem; }

.nav-link, .text-button {
  color: var(--muted);
  border: 0;
  background: none;
  padding: .45rem 0;
  font-size: .9rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.nav-link:hover, .text-button:hover { color: var(--blue); }

.page { padding-block: 2rem 4rem; }

.poll-header {
  margin-bottom: 1.15rem;
}

.poll-header h1 {
  max-width: 32ch;
  font-size: clamp(1.9rem, 4.5vw, 3.15rem);
  letter-spacing: -.045em;
}

.poll-description {
  max-width: 65ch;
  margin-top: .5rem;
  color: var(--muted);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.poll-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: .5rem 1rem;
  margin-top: .75rem;
}

.poll-meta .share { max-width: 100%; }
.poll-meta .share-button { min-height: 44px; }
.poll-header.poll-idle > .share { margin-top: .75rem; }

.poll-chip {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .28rem .7rem;
  border-radius: 99px;
  font-size: .875rem;
  font-weight: 700;
  white-space: nowrap;
}

.poll-chip > span {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}

.deadline {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: 2.1rem;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 630;
}

.clock-icon {
  position: relative;
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  border: 1.5px solid;
  border-radius: 50%;
  color: var(--blue);
}

.clock-icon::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 6px;
  width: 5px;
  height: 5px;
  border-left: 1.5px solid;
  border-bottom: 1.5px solid;
}

.button {
  justify-content: center;
  padding: .64rem .95rem;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: .92rem;
  line-height: 1.3;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.button-primary { background: var(--blue); color: #fff; }
.button-primary:hover { background: var(--blue-hover); }
.button-secondary { background: var(--panel); color: var(--ink); border-color: var(--line); }
.button-secondary:hover, .share-button:hover { background: var(--soft-blue); color: #2347af; }
.share-button { background: #fff; color: #233d83; border-color: #ced9f4; }

.copy-icon {
  display: inline-block;
  position: relative;
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border: 1.5px solid;
  border-radius: 3px;
  margin-right: 3px;
}

.copy-icon::after {
  content: "";
  position: absolute;
  top: -5px;
  left: 3px;
  width: 11px;
  height: 11px;
  border: 1.5px solid;
  border-bottom-color: transparent;
  border-left-color: transparent;
  border-radius: 3px;
}

.share-address { margin-top: .5rem; }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 2px 5px #1b294405;
}

.attendance-icon, .option-icon {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 9px;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
}

.tone-going { background: #e2f6eb; color: #175d3b; }
.tone-not_going { background: #fae9ed; color: #9a3245; }
.tone-thinking { background: #fff2d9; color: #795018; }

.ballot-grid, .admin-grid {
  display: grid;
  gap: 1rem;
  align-items: start;
}

.ballot-grid {
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.35fr);
}

.account-only, .form-panel, .login-panel, .manage-poll { padding: 1.35rem; }

.ballot-panel, .attendance-panel {
  min-width: 0;
  --ballot-padding: clamp(.9rem, 2.5vw, 1.3rem);
}

.ballot-panel { padding: var(--ballot-padding); }

.page-heading, .manage-poll {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.page-heading { margin-bottom: 1.3rem; }
.page-heading h1 { font-size: clamp(1.9rem, 4vw, 2.55rem); }

.panel-copy { margin-block: .65rem 1rem; }
.muted, small { color: var(--muted); }
small { font-size: .85rem; }

.identity-actions { display: grid; gap: .6rem; }
.identity-actions .button { width: 100%; }
.ballot-login {
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: .45rem;
}

.ballot-login .button { padding-inline: .5rem; }
.vote-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: .4rem .7rem;
}
.current-response {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem;
  color: var(--muted);
  font-size: .9rem;
}

.vote-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .45rem;
  margin-top: .8rem;
}

.vote-option {
  display: grid;
  align-items: center;
  justify-items: center;
  align-content: center;
  gap: .25rem;
  min-width: 0;
  min-height: 62px;
  padding: .42rem .3rem;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  overflow-wrap: anywhere;
}

.vote-option:hover { background: #f8faff; border-color: #91a9f3; }
.vote-option.is-selected {
  color: #2347af;
  background: var(--soft-blue);
  border-color: #6c89e0;
  box-shadow: inset 0 0 0 1px #6c89e0;
}
.option-icon { width: 24px; height: 24px; border-radius: 7px; font-size: .95rem; }

.attendance-heading { padding: var(--ballot-padding); }
.attendance-group { border-top: 1px solid var(--line); }
.attendance-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: .65rem;
  min-height: 52px;
  padding: .55rem var(--ballot-padding);
}

.attendance-summary:hover, .attendance-group[open] > .attendance-summary {
  background: #f7f9fd;
}

.attendance-summary:focus-visible { outline-offset: -3px; }
.attendance-group:last-child:not([open]) > .attendance-summary {
  border-radius: 0 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px);
}

.attendance-label { font-weight: 680; overflow-wrap: anywhere; }
.attendance-count { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 670; }
.attendance-members { list-style: none; padding-inline: var(--ballot-padding); }
.attendance-member {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: .7rem;
  padding: .55rem 0;
}

.attendance-member + .attendance-member { border-top: 1px solid var(--line); }
.attendance-name { min-width: 0; font-weight: 620; overflow-wrap: anywhere; }
.attendance-member .participant-time { padding-top: .15rem; font-size: .8rem; }
.attendance-empty { padding: .65rem var(--ballot-padding); color: var(--muted); }

.status-chip, .you {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: .36rem;
  padding: .26rem .55rem;
  border-radius: 99px;
  font-size: .875rem;
  font-weight: 680;
  white-space: nowrap;
}

.status-icon { font-weight: 800; line-height: 1; }
.you { margin-left: .3rem; padding: .1rem .4rem; color: #2447a3; background: var(--soft-blue); font-size: .8rem; }
.participant-time { color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }

summary::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  margin-right: 3px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-2px) rotate(45deg);
}

details[open] > summary::after { transform: translateY(2px) rotate(225deg); }

.account { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.ballot-panel .account { margin-top: .75rem; padding-top: .35rem; }
.account-only { margin-top: 1rem; max-width: 430px; }
.account-only .account { margin: 0; padding: 0; border: 0; }
.account summary { display: flex; align-items: center; gap: .6rem; min-height: 44px; font-weight: 710; }
.account-name { margin-right: auto; min-width: 0; overflow-wrap: anywhere; }
.account-action { color: var(--muted); font-size: .875rem; }
.account .form-stack, .form-panel .form-stack { margin-top: 1rem; }
.account .text-button { margin-top: .25rem; }
.identity-settings { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.identity-settings p { margin-bottom: .8rem; }
.identity-list { margin: .4rem 0; padding-inline-start: 1.25rem; }
.account-only h2 { margin: 0 0 .75rem; }

.admin-grid { grid-template-columns: minmax(0, 300px) minmax(0, 1fr); }
.admin-main { display: grid; gap: 1rem; min-width: 0; }
.form-stack, .field { display: grid; gap: .45rem; }
.form-stack { gap: .85rem; }
.field label, .form-stack > label { font-size: .9rem; font-weight: 670; }

input, textarea {
  background-color: #fff;
  border: 1px solid #cdd7e7;
  border-radius: 10px;
  color: var(--ink);
  padding: .55rem .7rem;
  min-width: 0;
  min-height: 43px;
  width: 100%;
}

textarea { resize: vertical; }
.poll-open { background: #e0f6e9; color: #175d3b; }
.poll-closed { background: #eff2f7; color: #4c5b73; }
.manage-poll { align-items: flex-start; }
.manage-poll h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin: .55rem 0 .45rem; }
.manage-description { margin-block: .35rem .5rem; white-space: pre-wrap; overflow-wrap: anywhere; }

.login-panel { width: min(100%, 464px); margin: 2rem auto 0; padding: clamp(1.35rem, 4vw, 2rem); }
.login-panel h1 { font-size: clamp(1.65rem, 4vw, 2.25rem); margin-bottom: 1.1rem; }
.login-panel .form-stack { margin-top: .85rem; }

.notice {
  border: 1px solid;
  border-radius: 12px;
  padding: .7rem .9rem;
  font-size: .95rem;
  font-weight: 620;
  margin-bottom: 1rem;
}
.notice-success { border-color: #b9e5ca; background: #e8f8ee; color: #195e3c; }
.notice-error { border-color: #ecc6d0; background: #feedf2; color: #93283e; }

.sr-only {
  position: absolute;
  height: 1px;
  width: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 970px) {
  .admin-grid { grid-template-columns: minmax(0, 260px) minmax(0, 1fr); }
}

@media (max-width: 720px) {
  .shell { width: calc(100% - 2rem); }
  .topbar-inner { min-height: 62px; }
  .page { padding-top: 1.35rem; }
  .ballot-grid, .admin-grid { grid-template-columns: minmax(0, 1fr); }
  .ballot-grid { gap: .75rem; }
}

@media (max-width: 460px) {
  .shell { width: calc(100% - 1.5rem); }
  .topbar-inner, .topbar-nav { gap: .7rem; }
  .brand { font-size: 1rem; gap: .45rem; }
  .topbar-nav { flex-wrap: wrap; justify-content: end; row-gap: 0; }
  .nav-link, .topbar-nav .text-button { font-size: .875rem; }
  .poll-header { margin-bottom: .9rem; }
  .poll-meta .share-button { padding-inline: .65rem; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .manage-poll { flex-wrap: wrap; }
  .status-chip { font-size: .875rem; gap: .24rem; padding-inline: .4rem; }
}
