:root {
  color-scheme: light;
  --ink: #252629;
  --quiet: #61656a;
  --white: #fff;
  --blue: #2459c4;
  --blue-pressed: #194cae;
  --blue-bg: #eaf1ff;
  --panel: #edf4ff;
  --ticket: #e3edff;
  --line: #e1e4e8;
  --field: #d5d5d5;
  --red: #ad3838;
  --green: #20744d;
  --rust: #984c24;
  --gutter: 22px;
  --width: 520px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: #f1f3f5;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html.pwa-standalone { touch-action: pan-x pan-y; }
body { margin: 0; overscroll-behavior-y: contain; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .64; }
button:focus-visible, input:focus-visible, :is(.service, .card-switch, .card-choice):has(:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
h1, h2, p { margin: 0; }
h1 { font-size: 31px; line-height: 1.18; letter-spacing: -.035em; }
h2 { font-size: 17px; line-height: 1.3; letter-spacing: -.01em; }
small { font-size: 12px; color: var(--quiet); }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
strong, h1, h2 { font-weight: 700; }
.icon { display: inline-block; width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.well { display: inline-grid; flex: none; place-items: center; width: 32px; height: 32px; color: var(--tone); }
.well .icon { width: 21px; height: 21px; }
.blue { --tone: #2459c4; }
.teal { --tone: #187481; }
.rust { --tone: #99502f; }
.indigo { --tone: #495fa3; }
.green { --tone: var(--green); }
.red { --tone: var(--red); }
.operation-use { --tone: #b94f4b; }
.operation-charge { --tone: #38805b; }
.neutral { --tone: #61656a; }
.brand-tone { --tone: #62544b; }
.service-cut { --tone: #4a6d90; }
.service-wash { --tone: #086f72; }
.service-perm { --tone: #88510b; }
.service-dye { --tone: #6941a5; }
.type-caption { color: var(--tone, var(--quiet)); }

#app {
  position: relative;
  isolation: isolate;
  width: min(100%, var(--width));
  min-height: 100vh;
  min-height: 100dvh;
  margin-inline: auto;
  background: var(--white);
}
#page { padding: calc(18px + env(safe-area-inset-top, 0px)) var(--gutter) calc(28px + var(--safe-bottom)); }
#app:has(#bottom:not(:empty)) #page { padding-bottom: calc(86px + var(--safe-bottom)); }
#bottom:not(:empty) {
  z-index: 2;
  position: fixed;
  inset: auto 0 0;
  width: min(100%, var(--width));
  margin-inline: auto;
  padding-bottom: var(--safe-bottom);
  border-top: 1px solid var(--line);
  background: var(--white);
}
.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-bottom: 14px; }
.brand-name { display: inline-flex; gap: 10px; align-items: center; font-weight: 700; font-size: 13px; white-space: nowrap; }
.brand-name .well { width: 24px; height: 24px; }
.brand-name .well .icon { width: 20px; height: 20px; }
.brand-side { margin-left: auto; }
.brand .btn.back { margin-left: -13px; justify-content: flex-start; padding-left: 12px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.page-heading > div { min-width: 0; overflow-wrap: anywhere; }
.page-heading p { margin-top: 4px; font-size: 13px; color: var(--quiet); }
.page-heading .new-member { margin-top: 3px; }
[data-view="member"] .page-heading { margin-bottom: 24px; }
[data-view="addMember"] .page-heading { margin-bottom: 28px; }

.btn {
  display: inline-flex;
  min-height: 49px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 13px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}
.btn .icon { width: 17px; height: 17px; }
.btn.primary { color: var(--white); background: var(--blue); }
.btn.primary:active { background: var(--blue-pressed); }
.btn.secondary { color: var(--blue); border-color: var(--line); background: var(--white); }
.btn.secondary:active { background: #f5f8ff; }
.btn.destructive { color: var(--white); background: var(--red); }
.btn.plain { color: var(--blue); background: transparent; }
.btn.new-member { min-height: 44px; padding-inline: 13px; flex-shrink: 0; white-space: nowrap; }
.btn.icon-button { min-height: 44px; width: 44px; padding: 0; }
.btn.member-more { position: relative; justify-content: flex-end; padding-inline-end: 7px; border: 0; }
.btn.member-more::before {
  content: "";
  position: absolute;
  inset-block: 7px;
  inset-inline-end: 0;
  width: 30px;
  border: 1px solid var(--line);
  border-radius: 9px;
  pointer-events: none;
}
.btn.member-more:active::before { background: var(--blue-bg); }
.btn.member-more .icon { position: relative; width: 16px; height: 16px; stroke-width: 2.5; }
.btn.full { width: 100%; }
.btn.grow { flex: 1; }
.actions { display: flex; gap: 12px; padding: 11px var(--gutter) 10px; }
.actions .secondary { min-width: 31%; }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px 10px 8px; }
.tabs button { border: 0; background: transparent; display: grid; place-items: center; gap: 3px; color: var(--quiet); min-height: 57px; padding: 2px 0; font-size: 11px; }
.tabs button > span { display: grid; place-items: center; height: 28px; }
.tabs button[aria-current] { color: var(--blue); font-weight: 700; }
.tabs button .icon { height: 18px; }
.tabs button[aria-current] .icon { stroke-width: 2; }
.text-button { padding: 4px 0; min-height: 34px; border: 0; background: transparent; color: var(--blue); font-weight: 700; font-size: 13px; white-space: nowrap; }

.search { display: flex; align-items: center; border: 1px solid var(--field); border-radius: 12px; padding-left: 14px; gap: 9px; color: var(--quiet); }
.search > label { display: flex; cursor: text; }
.search input { flex: 1; width: 0; border: 0; min-height: 49px; padding: 0 13px 0 0; border-radius: 12px; background: var(--white); color: var(--ink); font-size: 16px; appearance: none; }
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus-visible { outline: none; }
.search:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
.search .search-clear { color: var(--quiet); margin-inline-end: 2px; flex: none; }
.search input:placeholder-shown + .search-clear { display: none; }
input::placeholder { color: var(--quiet); opacity: 1; }
.summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px 0; margin-top: 16px; border: 1px solid #e1eafe; border-radius: 17px; background: var(--panel); }
.metric { position: relative; min-width: 0; display: grid; align-content: start; gap: 2px; padding: 0 15px; }
.metric > span:first-child { padding-right: 19px; color: var(--quiet); font-size: 12px; }
.metric > strong { font-size: 23px; line-height: 1.2; letter-spacing: -.025em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric > .well { position: absolute; width: 25px; height: 25px; top: 0; right: 13px; }
.metric > .well .icon { width: 15px; height: 15px; }
.summary .metric + .metric { border-left: 1px solid #d6e1f6; }

section { margin-top: 19px; }
.section-heading { min-height: 27px; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.segmented { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 11px; margin-top: 14px; background: var(--white); }
.segmented button { flex: 1; min-height: 36px; border: 0; border-radius: 8px; color: var(--quiet); background: transparent; font-size: 13px; }
.segmented button[aria-pressed="true"] { color: var(--blue); background: var(--blue-bg); font-weight: 700; }
.segmented.underlined { align-self: stretch; gap: 16px; border: 0; padding: 0; margin-top: 0; }
.segmented.underlined button { position: relative; flex: auto; padding: 0; border-radius: 0; min-height: 34px; color: var(--ink); font-weight: 700; font-size: 15px; }
.segmented.underlined button[aria-pressed="true"] { background: none; color: var(--blue); }
.segmented.underlined button[aria-pressed="true"]::after { position: absolute; content: ""; inset: auto 0 1px; height: 2px; border-radius: 2px; background: var(--blue); }
[data-view="members"] #list-results { margin-top: 14px; }

.group { border: 1px solid var(--line); border-radius: 17px; overflow: hidden; background: var(--white); }
.row {
  position: relative;
  min-width: 0;
  width: 100%;
  min-height: 55px;
  display: flex;
  align-items: center;
  column-gap: 9px;
  padding: 9px 12px;
  border: 0;
  background: var(--white);
  text-align: left;
}
.row + .row::before { content: ""; position: absolute; top: 0; inset-inline: 12px; height: 1px; background: var(--line); }
button.row:active { background: #f7f9fc; }
button.row:focus-visible { outline-offset: -3px; border-radius: 12px; }
.row-copy { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.row-copy strong, .identity strong { display: block; line-height: 1.24; }
.row-copy small, .row-end small, .identity small { display: block; margin-top: 3px; line-height: 1.25; }
.row-copy .type-caption { font-size: .88em; margin-left: 2px; font-weight: 700; }
.row-end { display: block; flex: 0 0 auto; max-width: 43%; text-align: right; font-size: 13px; color: var(--quiet); overflow-wrap: anywhere; }
.delta.deduction { color: var(--red); }
.delta.addition { color: var(--green); }
.row-chevron { display: inline-flex; align-items: center; color: var(--quiet); margin-left: -5px; }
.row-chevron .icon { width: 13px; height: 13px; }
.avatar { display: grid; place-items: center; flex: none; width: 37px; height: 37px; border-radius: 50%; color: var(--ink); background: #eff2f5; font-weight: 700; font-size: 15px; }
.low-count, .low-text { color: var(--rust); font-weight: 700; }
.low-count::before { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: #bd6a3d; content: ""; vertical-align: 2px; margin-right: 5px; }
.empty { display: grid; justify-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 17px; padding: 20px 12px; text-align: center; color: var(--quiet); font-size: 13px; }
.empty .btn { min-height: 40px; }

.ticket { position: relative; color: #354356; background: var(--ticket); border-radius: 20px; }
.ticket-total { padding: 17px 18px 14px; font-weight: 600; font-size: 13px; }
.ticket-total .well { position: absolute; right: 17px; top: 16px; }
.ticket-total strong { margin-right: 5px; font-size: 54px; line-height: 1.1; color: var(--ink); letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.ticket-breakdown { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 16px; padding: 13px 18px 16px; border-top: 1px dashed #b7cef1; }
.ticket-breakdown::before, .ticket-breakdown::after { position: absolute; top: -7px; width: 13px; height: 13px; border-radius: 50%; background: var(--white); content: ""; }
.ticket-breakdown::before { left: -7px; }
.ticket-breakdown::after { right: -7px; }
.ticket-breakdown span, .ticket-breakdown strong { display: block; }
.ticket-breakdown span { font-size: 13px; font-weight: 700; }
.ticket-breakdown strong { color: var(--ink); font-size: 19px; }

.stack { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; min-width: 0; font-size: 14px; font-weight: 700; }
.field input { width: 100%; min-height: 49px; border: 1px solid var(--field); border-radius: 12px; padding: 10px 13px; background: var(--white); font-size: 16px; font-weight: 400; }
.field input[type="number"] { appearance: textfield; }
.field input[type="number"]::-webkit-inner-spin-button, .field input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }
.field input::placeholder { font-size: 15px; }
.field-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.identity { display: flex; align-items: center; gap: 11px; margin: 4px 0 19px; }
#card-fields legend { padding: 0; margin-bottom: 7px; font-weight: 700; font-size: 14px; }
.services { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.service { position: relative; cursor: pointer; }
.service input, .card-switch input, .card-choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.service > span { display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 61px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); font-size: 13px; font-weight: 700; }
.service .icon { width: 22px; height: 22px; color: var(--tone); }
.service input:checked + span { border-color: var(--tone); box-shadow: inset 0 0 0 1px var(--tone); color: var(--tone); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 19px; }
.chips button { min-width: 0; flex: 1 0 auto; min-height: 37px; border: 1px solid var(--line); border-radius: 9px; padding: 3px 5px; background: var(--white); font-size: 12px; white-space: nowrap; }
.chips button[aria-pressed="true"] { border-color: var(--blue); color: var(--blue); font-weight: 700; background: var(--blue-bg); }
.card-switch { position: relative; display: flex; align-items: center; gap: 10px; padding: 11px 0 0; border-top: 1px solid var(--line); min-height: 54px; cursor: pointer; }
.card-switch > strong { flex: 1; font-size: 14px; }
.card-switch input + span { position: relative; width: 46px; height: 26px; flex: none; border-radius: 20px; background: #d9dfe5; }
.card-switch input + span::after { position: absolute; top: 3px; left: 3px; content: ""; width: 20px; height: 20px; border-radius: 50%; background: var(--white); }
.card-switch input:checked + span { background: var(--blue); }
.card-switch input:checked + span::after { left: 23px; }

.period { display: flex; min-height: 57px; justify-content: space-between; align-items: center; }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.stat-grid .metric { border: 1px solid var(--line); border-radius: 14px; min-height: 83px; padding: 12px 12px 11px; }
.stat-grid .metric .well { right: 10px; top: 10px; }
.stat-grid .metric > span:first-child { padding-right: 28px; }
[data-view="stats"] .row { min-height: 44px; }
[data-view="stats"] .row-end { color: var(--ink); font-weight: 700; }

.sync-state { display: inline-flex; align-items: center; justify-content: end; gap: 6px; border: 0; border-radius: 6px; color: var(--quiet); background: transparent; font-size: 12px; font-weight: 700; white-space: nowrap; }
.sync-state.ok { color: var(--green); }
.sync-state.syncing { color: var(--blue); }
.sync-state.fail { color: var(--red); min-height: 38px; padding-inline: 3px; }
.sync-state i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.cloud-card { padding: 13px 13px 11px; border: 1px solid #e1eafe; border-radius: 17px; background: var(--panel); }
.cloud-top, .cloud-bottom { display: flex; align-items: center; gap: 10px; }
.cloud-top .cloud-state { margin-left: auto; }
.cloud-bottom { justify-content: space-between; margin-top: 12px; padding-top: 10px; border-top: 1px solid #d9e4f7; font-size: 13px; }
.cloud-bottom span { color: var(--quiet); font-size: 12px; }
.cloud-bottom div > * { display: block; }
.cloud-bottom .btn { min-height: 45px; }
.cloud-bottom .cloud-button { border-color: #bfd1f4; }
.local-counts { display: flex; min-height: 70px; align-items: center; padding: 12px 0; }
.local-counts > div { flex: 1 1 0; min-width: 0; padding: 0 11px; overflow-wrap: anywhere; }
.local-counts > div + div { border-left: 1px solid var(--line); }
.local-counts span, .local-counts strong { display: block; }
.local-counts span { font-size: 12px; color: var(--quiet); }
.local-counts strong { font-size: 19px; letter-spacing: -.03em; }
.danger-text .row-copy strong { color: var(--red); }
.credential > div { position: relative; padding: 13px; }
.credential > div + div { border-top: 1px solid var(--line); }
.credential span, .key-box span, .result-card > span { display: block; font-size: 13px; color: var(--quiet); }
.credential strong { display: block; overflow-wrap: anywhere; padding-right: 43px; }
.credential .icon-button { position: absolute; right: 4px; top: 9px; }
.credential-key, .key-box strong { font-size: 22px; color: var(--blue); letter-spacing: .09em; }
.standalone-action { margin-top: 18px; }
.key-box { padding: 15px; margin-bottom: 19px; background: var(--panel); border-radius: 14px; }
.result-icon { margin: 23px 0 12px; }
.result-icon .well { width: 44px; height: 44px; }
.result-icon .icon { width: 28px; height: 28px; }
.result-card { position: relative; border-radius: 16px; padding: 15px; background: var(--ticket); }
.result-card > .well { position: absolute; top: 14px; right: 14px; }
.result-card > strong { display: block; margin-top: 4px; padding-right: 37px; font-size: 20px; }
.result-card > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; border-top: 1px solid #d6e1f6; margin-top: 10px; padding-top: 10px; font-size: 13px; }

dialog { color: var(--ink); }
#sheet {
  position: fixed;
  inset: auto 0 0;
  margin: 0 auto;
  max-width: none;
  width: min(100%, var(--width));
  max-height: 94vh;
  max-height: 94dvh;
  border: 0;
  border-radius: 22px 22px 0 0;
  padding: 0;
  background: var(--white);
  overscroll-behavior: contain;
}
#sheet::backdrop { background: rgb(29 38 51 / 45%); }
body:has(#sheet[open]) { overflow: hidden; }
.sheet-form { padding: 0 var(--gutter) calc(10px + var(--safe-bottom)); }
.sheet-grip { width: 36px; height: 4px; margin: 10px auto 7px; border-radius: 4px; background: var(--line); }
.sheet-heading { display: flex; align-items: center; justify-content: space-between; gap: 9px; min-height: 46px; }
.sheet-heading h2 { font-size: 24px; }
.sheet-heading h2:focus { outline: none; }
.sheet-heading .icon-button { color: var(--quiet); background: transparent; border: 0; }
.sheet-subtitle, .sheet-hint { color: var(--quiet); font-size: 13px; margin: 0 0 13px; white-space: pre-line; overflow-wrap: anywhere; }
.sheet-actions { display: flex; gap: 10px; border-top: 1px solid var(--line); padding-top: 11px; margin-top: 13px; }
.sheet-actions .secondary { min-width: 30%; color: var(--ink); }
.card-choices { display: grid; gap: 7px; margin-bottom: 13px; }
.card-choice { display: block; position: relative; cursor: pointer; }
.choice-ui { display: flex; min-height: 54px; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 11px; padding: 7px 10px; }
.choice-ui .row-copy { font-size: 14px; }
.choice-radio { flex: none; width: 19px; height: 19px; border: 1px solid var(--quiet); border-radius: 50%; }
.choice-ui b { text-align: right; font-size: 12px; }
.card-choice input:checked + .choice-ui { color: var(--blue); border-color: var(--blue); background: var(--blue-bg); }
.card-choice input:checked + .choice-ui .choice-radio { position: relative; border-color: var(--blue); background: var(--blue); }
.card-choice input:checked + .choice-ui .choice-radio::after { position: absolute; content: ''; width: 8px; height: 4px; left: 4.5px; top: 5.5px; transform: rotate(-45deg); border-bottom: 1.5px solid #fff; border-left: 1.5px solid #fff; }
.selected-only, .card-choice input:checked + .choice-ui .unselected-only { display: none; }
.card-choice input:checked + .choice-ui .selected-only { display: inline; }
.note-chips { margin-bottom: 0; }
.note-chips .btn { color: var(--blue); }
.error-line { color: var(--red); font-size: 13px; margin-top: 9px; }
#pull-hint { position: fixed; z-index: 3; left: 50%; top: calc(10px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); border: 1px solid var(--line); border-radius: 18px; padding: 6px 14px; background: var(--white); color: var(--blue); font-size: 13px; }
#toast { z-index: 3; position: fixed; bottom: calc(79px + var(--safe-bottom)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 7px; max-width: calc(100vw - 30px); width: max-content; padding: 8px 13px; border: 1px solid #d6eadb; border-radius: 13px; box-shadow: 0 5px 20px rgb(25 35 48 / 12%); color: var(--green); background: #f7fcf8; font-size: 14px; font-weight: 700; }
#toast.error { color: var(--red); border-color: #f2d5d5; background: #fff7f7; }
#toast .well { width: 25px; height: 25px; }
#toast .icon { width: 15px; height: 15px; }
.app-update {
  position: sticky; top: 0; z-index: 4;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) var(--gutter) 8px;
  background: var(--blue-bg); color: var(--blue); border-bottom: 1px solid var(--line);
}
.app-update .btn { min-height: 34px; border-radius: 9px; padding: 4px 10px; }
@media (max-width: 350px) {
  :root { --gutter: 16px; }
  h1 { font-size: 28px; }
  .service > span { min-height: 56px; }
  .brand-name { gap: 6px; }
  .summary .metric > .well { right: 7px; }
  .chips { gap: 4px; }
}
