:root{
  --bg:#ffffff;
  --surface:#f5f5f7;
  --ink:#181818;
  --dim:#6a6a6a;
  --dimmer:#525252;
  --line:#e5e5e7;
  --line-input:#86868b;
  --red:#cf2030;
  --red-hot:#cf2030;
  --red-soft:#fdf2f3;
  --cyan:#181818;
  --ok:#0f7b6c;
  --amber:#8a4b00;
}
*{box-sizing:border-box;margin:0;padding:0}
body{
  background:var(--bg);color:var(--ink);
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"PingFang TC","Noto Sans TC","Microsoft JhengHei",sans-serif;
  font-feature-settings:"tnum" 1;font-variant-numeric:tabular-nums;
  -webkit-text-size-adjust:100%;
  padding:0 24px calc(48px + env(safe-area-inset-bottom));
  max-width:600px;margin:0 auto;
  font-weight:500;
}
.ph-top{
  display:flex;align-items:flex-end;justify-content:space-between;gap:12px;
  padding:calc(24px + env(safe-area-inset-top)) 0 0;margin-bottom:0;
}
.ph-title{min-width:0}
.ph-top .t{font-size:24px;font-weight:700;letter-spacing:-.02em;line-height:1.25}
.ph-top .date{display:block;font-size:14px;color:var(--dim);font-weight:500;margin-top:4px}
.ph-top .c{font-size:14px;color:var(--dim);font-weight:500;white-space:nowrap}
.ph-top .c i{color:var(--ink);font-style:normal;font-weight:600}
.ph-top .c u{color:var(--amber);text-decoration:none;font-weight:600}

.ph-h{font-size:18px;color:var(--ink);font-weight:700;letter-spacing:-.01em;margin:40px 0 16px;line-height:1.35}
.fld{width:100%;font:inherit;font-size:16px;font-weight:500;color:var(--ink);background:var(--bg);
  border:1px solid var(--line-input);border-radius:12px;padding:12px 16px;min-height:48px;transition:border-color .15s ease}
.fld:focus{background:var(--bg)}
.fld:focus:not(:focus-visible),.tpled textarea:focus:not(:focus-visible){border-color:var(--ink);outline:none}
:focus-visible{
  outline:2px solid var(--red);outline-offset:2px;
}
.fld::placeholder{color:var(--dim)}
.fld.bad{border-color:var(--red)}
select.fld{appearance:none;cursor:pointer;padding-right:40px}
.fl{display:block;font-size:14px;font-weight:600;color:var(--ink);letter-spacing:0;margin-top:4px}
.selwrap{position:relative}
.selwrap::after{
  content:"";position:absolute;right:16px;top:50%;width:8px;height:8px;pointer-events:none;
  border-right:1.5px solid var(--dim);border-bottom:1.5px solid var(--dim);
  transform:translateY(-65%) rotate(45deg);
}
.tpl-pick-wrap{margin:8px 0 12px}
.hintline a{color:var(--red);font-weight:600;text-underline-offset:4px}

.ref-card{background:var(--surface);border-radius:20px;padding:24px;margin-top:20px}
.ref-main .ref-card:first-child{margin-top:16px}
.ref-card + .ref-card{margin-top:20px}
.ref-card .ph-h{margin:0 0 20px}
.ref-id{padding:20px 24px}

.namelist{margin-top:12px;display:flex;flex-direction:column;gap:8px}
.namelist button,#btnAllNames{
  font:inherit;font-size:16px;font-weight:500;text-align:left;color:var(--ink);
  background:var(--surface);border:0;border-radius:12px;padding:12px 16px;cursor:pointer;transition:background-color .15s ease;
  display:block;width:100%;min-height:48px;
}
#btnAllNames{margin-top:12px;text-align:center;color:var(--ink);font-weight:600}
.ref-card .namelist button,.ref-card #btnAllNames{background:var(--bg)}
.namelist button:hover,#btnAllNames:hover{background:#ebebee}
.namelist button:active{background:#e2e2e6}
.namelist .none{color:var(--dim);font-size:14px;padding:16px 4px;line-height:1.7}

.whoami{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:0}
.whoami .n{font-size:20px;font-weight:700;color:var(--ink)}
.whoami button{font:inherit;font-size:14px;font-weight:600;color:var(--ink);background:var(--bg);
  border:0;border-radius:12px;padding:0 16px;cursor:pointer;min-height:44px;min-width:64px;transition:background-color .15s ease}
.whoami button:hover{background:#ebebee}
[data-member-link][hidden]{display:none!important}
.taskback{
  flex:1 1 auto;display:flex;align-items:center;justify-content:center;min-height:44px;padding:0 16px;
  color:var(--ink);background:var(--surface);border:0;border-radius:12px;
  font-size:14px;font-weight:600;text-decoration:none;text-align:center;
}
#refStart,#sourceBox{scroll-margin-top:24px}

#hereRow{margin-top:16px;padding-top:16px;border-top:1px solid var(--line)}
#hereRow .btn-stage{
  display:block;max-width:480px;margin-top:0;border:0;background:var(--ink);color:#ffffff;
}
#hereRow .btn-stage:hover:not(:disabled){filter:brightness(.94)}
#hereRow .btn-stage:disabled{background:#ededef;border-color:transparent;color:var(--dim)}
.here-state{
  margin-top:0;font-size:14px;font-weight:600;line-height:1.5;
  display:inline-flex;align-items:center;gap:8px;color:var(--dim);
}
.here-state:empty{display:none}
#btnHere:not([hidden]) + .here-state:not(:empty){margin-top:8px}
.here-state.is-done{color:var(--ok)}
.here-state.is-done::before{content:"";width:8px;height:8px;border-radius:50%;background:var(--ok);flex:0 0 auto}
.here-state.is-err{color:var(--red)}

.altbox{display:none}
.altbox summary{
  color:var(--ink);background:var(--surface);border:0;border-radius:12px;
  min-height:48px;padding:12px 16px;cursor:pointer;font-size:16px;font-weight:500;line-height:1.4;
}
.ref-card .altbox summary{background:var(--bg)}
.altbox .hintline{margin-bottom:8px}
.chips{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.chips button{
  flex:1 1 44%;font:inherit;font-size:14px;font-weight:500;color:var(--ink);
  background:var(--surface);border:0;border-radius:24px;padding:8px 16px;cursor:pointer;transition:background-color .15s ease;
  min-height:44px;display:inline-flex;align-items:center;justify-content:center;line-height:1.35;
}
.ref-card .chips button{background:var(--bg)}
.chips button.on,.ref-card .chips button.on{color:#ffffff;background:var(--ink);font-weight:600}
.chips button:disabled,.ref-card .chips button:disabled{cursor:default;background:#ededef;color:var(--dim)}

.stack{display:flex;flex-direction:column;gap:12px}
#refForm.stack{gap:8px}
#refForm.stack .fl{margin-top:8px}
#refForm.stack .fl:first-child,#refForm .errline{margin-top:0}
#refForm.stack .altbox,#refForm.stack .btn-red{margin-top:8px}
.stack .btn-stage{margin-top:0}
#inviteActs .stack{margin-top:12px}

.btn-red{
  width:100%;font:inherit;font-size:16px;font-weight:600;letter-spacing:0;color:#ffffff;
  background:var(--red);border:0;border-radius:12px;padding:16px;min-height:48px;cursor:pointer;transition:filter .15s ease;
}
.btn-red:hover:not(:disabled){filter:brightness(.94)}
.btn-red:disabled{cursor:default;background:#ededef;color:var(--dim)}
.btn-red.ok{background:var(--ok)}

.btn-stage{
  width:100%;font:inherit;font-size:16px;font-weight:600;letter-spacing:0;color:var(--ink);
  background:var(--bg);border:1.5px solid var(--ink);border-radius:12px;padding:16px;min-height:48px;
  margin-top:16px;cursor:pointer;transition:background-color .15s ease;
}
.btn-stage:disabled{cursor:default;background:#ededef;border-color:var(--line);color:var(--dim)}
.btn-stage.ok{background:var(--ok);border-color:var(--ok);color:#ffffff}

.btn-ghost{
  width:100%;font:inherit;font-size:16px;font-weight:600;color:var(--ink);letter-spacing:0;
  background:var(--surface);border:0;border-radius:12px;padding:16px;min-height:48px;cursor:pointer;transition:background-color .15s ease;
}
.ref-card .btn-ghost{background:var(--bg);margin-top:12px}
.btn-ghost:hover:not(:disabled){background:#ebebee}
.btn-ghost.ok{color:var(--ok)}
.btn-ghost:disabled,.ref-card .btn-ghost:disabled{cursor:default;background:#ededef;color:var(--dim)}

.seg{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:12px}
.seg button{
  flex:1 1 auto;font:inherit;font-size:14px;font-weight:500;color:var(--ink);
  background:var(--surface);border:0;border-radius:24px;padding:8px 16px;cursor:pointer;transition:background-color .15s ease;
  min-height:44px;display:inline-flex;align-items:center;justify-content:center;gap:8px;
}
.seg button.on{color:#ffffff;background:var(--ink);font-weight:600}
.seg button .own{font-size:12px;font-weight:500;font-style:normal;color:var(--dim)}
.seg button.on .own{color:#ffffff}

.tplbar{display:flex;gap:8px;margin-bottom:12px}
.tplbar button{
  flex:1 1 auto;font:inherit;font-size:14px;font-weight:600;color:var(--ink);
  background:var(--surface);border:0;border-radius:12px;padding:8px 16px;cursor:pointer;min-height:44px;
}
.tplbar button:hover:not(:disabled){background:#ebebee}
.tpled{display:none;flex-direction:column;gap:12px;margin-bottom:12px}
.tpled.open{display:flex}
.tpled textarea{
  width:100%;font:inherit;font-size:16px;font-weight:500;line-height:1.7;color:var(--ink);background:var(--bg);
  border:1px solid var(--line-input);border-radius:12px;padding:12px 16px;min-height:152px;resize:vertical;
}
.tpled .row{display:flex;gap:8px}
.tpled .row button{flex:1 1 auto;min-height:48px;border-radius:12px;font:inherit;font-size:14px;font-weight:600;cursor:pointer}
.tpled .row .save{color:#ffffff;background:var(--red);border:0}
.tpled .row .cancel{color:var(--ink);background:var(--surface);border:0}
.tpled .row .del{color:var(--red);background:var(--red-soft);border:0}

.mycount{display:flex;align-items:baseline;flex-wrap:wrap;gap:8px;
  border-top:1px solid var(--line);margin-top:32px;padding-top:16px}
.mycount .k{font-size:14px;color:var(--dim);font-weight:500}
.mycount .v{font-size:18px;font-weight:700;color:var(--ink);font-variant-numeric:tabular-nums}
.mycount .v .u{font-size:14px;color:var(--dim);margin-left:4px;font-weight:500}

.mylist{display:flex;flex-direction:column;gap:12px;margin-top:12px}
@keyframes rowIn{from{opacity:0}to{opacity:1}}
.mylist .it{
  background:var(--surface);border:0;overflow-wrap:anywhere;
  border-radius:16px;padding:16px 20px;font-size:16px;animation:rowIn .25s ease-out;
}
.mylist .it-head{display:flex;align-items:baseline;justify-content:space-between;flex-wrap:wrap;gap:4px 12px}
.mylist .it-title{min-width:0;overflow-wrap:anywhere}
.mylist .it .a{font-weight:600;color:var(--ink)}
.mylist .it .b{color:var(--dim);font-weight:500}
.mylist .it .c{display:block;color:var(--dim);font-size:14px;margin-top:4px;font-weight:500}
.mylist .it .s{flex:0 0 auto;font-size:14px;font-weight:600;color:var(--dim);white-space:nowrap}
.mylist .it .s.sent{color:var(--ok)}
.mylist .it .s.failed{color:var(--amber);white-space:normal;max-width:100%}
.mylist .it .retry{
  display:block;margin-top:12px;font:inherit;font-size:14px;font-weight:600;color:var(--ink);
  background:var(--bg);border:0;border-radius:12px;padding:8px 16px;min-height:44px;width:100%;cursor:pointer;line-height:1.4;
}
.mylist .it .retry:hover:not(:disabled){background:#ebebee}
.mylist .it .revoke{color:var(--red)}
.mylist .it .retry:disabled,.mylist .it .revoke:disabled{cursor:default;background:#ededef;color:var(--dim)}

.tpl{
  background:var(--surface);border:0;border-radius:16px;padding:20px;
  font-size:14px;font-weight:500;line-height:1.75;color:var(--dim);white-space:pre-wrap;
}
.tpl b{color:var(--ink);font-weight:600}
.hintline{color:var(--dim);font-size:14px;font-weight:500;margin-top:12px;line-height:1.65}
#pickHint{margin-top:0;margin-bottom:12px}
.errline{display:none;color:var(--red);font-size:14px;font-weight:600;margin-top:8px;line-height:1.6}
#altLabel{color:var(--ink)}
.privacy{color:var(--dim);font-size:14px;font-weight:500;margin-top:12px;line-height:1.65}
.boot{color:var(--dim);font-size:16px;font-weight:500;padding:40px 0;line-height:1.8}
.lswarn{
  display:none;margin-top:12px;padding:16px 20px;border-radius:16px;line-height:1.65;
  color:var(--ink);background:var(--red-soft);font-size:14px;font-weight:500;white-space:pre-line;
}
#copysink{position:fixed;left:-9999px;top:0;opacity:0}
.confirm{
  display:none;margin-top:12px;padding:16px 20px;border-radius:16px;line-height:1.65;
  color:var(--ink);background:var(--red-soft);font-size:14px;font-weight:500;
}
.ref-card .confirm{
  margin-top:16px;padding:16px 0 0;border:0;border-top:1px solid var(--line);
  border-radius:0;background:transparent;color:var(--red);font-weight:600;
}
.confirm.open{display:block}
.confirm .row{display:flex;gap:8px;margin-top:12px}
.confirm .row button{
  flex:1 1 auto;font:inherit;font-size:14px;font-weight:600;min-height:48px;border-radius:12px;cursor:pointer;
  color:var(--ink);background:var(--bg);border:0;
}
.confirm .row button:hover{background:#ebebee}
.backnote{display:none;margin-bottom:12px;color:var(--dim);font-size:14px;font-weight:500;line-height:1.65}
.backnote.open{display:block}
.backnote button{
  display:block;margin-top:12px;font:inherit;font-size:14px;font-weight:600;color:var(--ink);
  background:var(--surface);border:0;border-radius:12px;padding:0 16px;min-height:48px;cursor:pointer;
}
.ref-card .backnote button{background:var(--bg)}
#phForm.open{display:block}
.sourcebox{
  margin-top:16px;padding:16px 20px;border:0;border-radius:16px;
  background:var(--surface);line-height:1.6;
}
.ref-card .sourcebox{
  margin-top:16px;padding:16px 0 0;border:0;border-top:1px solid var(--line);
  border-radius:0;background:transparent;
}
.sourcebox p{margin:0;font-size:14px;font-weight:500;overflow-wrap:anywhere;color:var(--ink)}
.sourcebox .row{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.sourcebox button{
  min-height:44px;padding:8px 16px;border-radius:12px;border:0;
  background:var(--bg);color:var(--ink);font:inherit;font-size:14px;font-weight:600;cursor:pointer;
}
.sourcebox button:hover{background:#ebebee}

@media (min-width:960px){
  body{max-width:1200px;padding-left:40px;padding-right:40px}
  .ph-top{padding-top:40px}
  .ph-top .t{font-size:28px}
  #phPick{max-width:600px}
  #phForm.open{max-width:none}
  .ref-layout{display:grid;grid-template-columns:minmax(0,1.05fr) minmax(0,1fr);gap:32px;align-items:start;margin-top:20px}
  .ref-main .ref-card:first-child{margin-top:0}
  .ref-side .mycount{margin-top:0;padding-top:0;border-top:0}
}
