:root {
  color-scheme: light dark;
  --bg: #f4f6fb;
  --panel: #fff;
  --ink: #172235;
  --muted: #536079;
  --rule: #d8deea;
  --blue: #1558ce;
  --blue-tint: #eaf1ff;
  --green: #11623c;
  --green-tint: #e4f5e9;
  --red: #97384a;
  --red-tint: #fcecf0;
  --quiet: #eef1f6;
  font: 16px/1.45 "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
[hidden] { display: none !important; }
button, textarea, select { font: inherit; }
button, select, a { -webkit-tap-highlight-color: transparent; }
button, select { cursor: pointer; }
:focus-visible { outline: 3px solid #6599ff; outline-offset: 3px; }
button:disabled, textarea:disabled { opacity: .6; cursor: default; }
.page { width: min(100%, 780px); margin: auto; padding: max(36px, env(safe-area-inset-top)) 24px max(40px, env(safe-area-inset-bottom)); }
.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.page-head h1 { margin: 0; font-size: clamp(30px, 6vw, 42px); line-height: 1.12; letter-spacing: -.045em; }
.page-head p { color: var(--muted); margin: 5px 0 0; }
.brand-mark { flex: 0 0 52px; height: 52px; position: relative; border-radius: 17px; background: #1558ce; }
.brand-mark i { position: absolute; display: block; border-radius: 50%; border: 2.5px solid #fff; width: 15px; height: 15px; }
.brand-mark i:first-child { left: 18px; top: 9px; }
.brand-mark i:nth-child(2) { left: 10px; top: 23px; }
.brand-mark i:nth-child(3) { left: 26px; top: 23px; }
h2 { margin: 0; font-size: 20px; letter-spacing: -.025em; line-height: 1.25; }
.demo-bar { display: flex; align-items: center; gap: 10px; margin: -7px 0 17px; font-size: 14px; color: var(--muted); }
.demo-bar select { border: 1px solid var(--rule); border-radius: 8px; padding: 5px 8px; color: var(--ink); background: var(--panel); }
.summary-panel, .add-panel, .list-panel { background: var(--panel); border: 1px solid var(--rule); border-radius: 20px; }
.summary-panel { padding: 18px 23px; margin-bottom: 16px; }
.summary-counts { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.summary-counts > div + div { border-left: 1px solid var(--rule); padding-left: clamp(8px, 3vw, 24px); }
.summary-counts dt { color: var(--muted); font-size: 14px; }
.summary-counts dd { font-size: clamp(24px, 5vw, 32px); font-weight: 650; line-height: 1.2; margin: 4px 0 0; font-variant-numeric: tabular-nums; }
#count-member { color: var(--green); }
#count-absent { color: var(--red); }
.retry-group { color: var(--blue); background: transparent; margin-left: 4px; padding: 5px 7px; text-decoration: underline; font-size: 13px; }
.add-panel { padding: 23px; margin-bottom: 16px; }
.form-hint { display: block; margin-top: 8px; color: var(--muted); font-size: 14px; }
.report-panel { margin-bottom: 16px; padding: 20px; border: 1px solid var(--rule); border-radius: 20px; background: var(--panel); }
.share-choice { display: flex; align-items: flex-start; gap: 9px; margin: 15px 0 8px; font-size: 14px; }
.share-choice input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; }
#download-link { color: var(--blue); }
.form-line { display: flex; align-items: flex-end; gap: 9px; margin-top: 12px; }
textarea { border: 1px solid var(--rule); border-radius: 11px; color: var(--ink); background: var(--bg); min-width: 0; min-height: 72px; flex: 1; padding: 11px 13px; resize: vertical; }
textarea::placeholder { color: var(--muted); }
button { border: 0; border-radius: 11px; }
.primary { min-height: 44px; padding: 0 18px; white-space: nowrap; color: #fff; background: #1558ce; font-weight: 600; }
.primary span { margin-right: 2px; }
.primary:not(:disabled):hover { background: #114bb3; }
.form-message { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.form-message:empty, .list-message:empty { display: none; }
.error { color: var(--red); }
.list-head { padding: 18px 23px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#total { color: var(--muted); font-weight: 500; font-size: 16px; margin-left: 3px; }
.secondary, .open-group { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; font-size: 14px; font-weight: 600; }
.secondary { gap: 5px; color: var(--blue); background: transparent; padding: 5px 7px; }
.secondary span { font-size: 21px; }
.secondary:hover { background: var(--blue-tint); }
#groups { list-style: none; margin: 0; padding: 0 23px; }
.group { display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--rule); padding: 15px 0; }
.avatar { flex: 0 0 46px; height: 46px; border-radius: 14px; overflow: hidden; display: grid; place-items: center; background: var(--blue-tint); color: var(--blue); font-weight: 700; font-size: 18px; }
.avatar img { display: block; height: 100%; width: 100%; object-fit: cover; }
.group-copy { flex: 1; min-width: 0; }
.group-name { margin: 0 0 4px; font-size: 17px; line-height: 1.25; font-weight: 650; overflow-wrap: anywhere; }
.state { font-size: 13px; display: inline-flex; align-items: center; gap: 5px; font-weight: 500; color: var(--muted); }
.state-mark { display: inline-grid; place-items: center; height: 18px; width: 18px; line-height: 1; font-weight: 700; background: var(--quiet); border-radius: 50%; }
.state.member { color: var(--green); }
.member .state-mark { background: var(--green-tint); }
.state.absent { color: var(--red); }
.absent .state-mark { background: var(--red-tint); }
.open-group { text-align: center; background: var(--blue-tint); color: var(--blue); border-radius: 10px; padding: 6px 12px; text-decoration: none; }
.open-group:hover { text-decoration: underline; }
.group-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.remove-group { color: var(--red); background: transparent; padding: 8px; font-size: 14px; min-height: 40px; }
.remove-group:hover { background: var(--red-tint); }
#remove-dialog { width: min(410px, calc(100% - 32px)); border: 1px solid var(--rule); padding: 22px; border-radius: 18px; background: var(--panel); color: var(--ink); }
#remove-dialog::backdrop { background: rgba(8, 18, 36, .46); }
#remove-name { overflow-wrap: anywhere; font-weight: 650; margin: 14px 0 6px; }
#remove-note { color: var(--muted); margin: 0; font-size: 14px; }
.remove-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
#remove-confirm { padding: 10px 14px; background: #af3045; color: white; font-size: 14px; font-weight: 600; }
.remove-notice { position: fixed; z-index: 2; bottom: max(18px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); background: var(--ink); color: var(--panel); padding: 12px 18px; border-radius: 14px; overflow-wrap: anywhere; box-shadow: 0 4px 16px #0002; pointer-events: none; }
.legal-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 20px 4px 0; font-size: 13px; }
.legal-links a { color: var(--muted); text-underline-offset: 3px; }
.list-message { color: var(--muted); margin: 0; padding: 10px 23px 21px; }
.list-message.error { color: var(--red); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 550px) {
  .page { padding: max(22px, env(safe-area-inset-top)) 12px max(30px, env(safe-area-inset-bottom)); }
  .page-head { gap: 12px; margin: 0 4px 22px; }
  .page-head p { font-size: 14px; }
  .add-panel { padding: 17px; }
  .summary-panel { padding: 15px 12px; }
  .summary-counts dt { font-size: 13px; }
  .list-head { padding: 13px 17px; }
  #groups { padding: 0 17px; }
  .group { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 8px 11px; }
  .avatar { width: 40px; height: 40px; border-radius: 12px; }
  .group-actions { grid-column: 2; }
  .form-line { flex-wrap: wrap; }
  .form-line textarea { flex-basis: 100%; }
  .list-message { padding: 5px 17px 17px; }
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #141922; --panel: #1e2531; --ink: #f4f6fa; --muted: #b3bfd1; --rule: #394356; --blue: #a5c4ff; --blue-tint: #273a59; --green: #9bdfb5; --green-tint: #294539; --red: #ffb4c1; --red-tint: #59313e; --quiet: #384355; }
}
