:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei UI", system-ui, sans-serif;
  color: #18233b;
  background: #e7ebf3;
  font-size: 16px;
  line-height: 1.55;
  --ink: #18233b;
  --muted: #505b70;
  --accent: #1e4cc4;
  --accent-dark: #1e439d;
  --tint: #e8efff;
  --line: #e2e6ef;
  --surface: #f2f3f7;
  --danger: #a12638;
  --white: #fff;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-block: 65px 102px; }
body { margin: 0; min-width: 0; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.7rem, 5vw, 2.25rem); line-height: 1.25; }
h2 { font-size: 1.125rem; line-height: 1.4; overflow-wrap: anywhere; }

.app {
  width: min(100%, 1000px);
  margin: auto;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(28px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.bar, .actions, .section-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bar, .section-header { justify-content: space-between; }
.bar { min-height: 48px; margin-bottom: 12px; }
.bar strong { padding: 5px 0; letter-spacing: .04em; }
.bar .actions { gap: 4px; }
.hero {
  color: var(--white);
  padding: 25px clamp(18px, 4vw, 32px);
  background: linear-gradient(140deg, #18284c, #214da8);
  border-radius: 20px;
  margin-bottom: 16px;
}
.hero p { margin-top: 5px; color: #dfebff; font-size: .93rem; }

.card, dialog {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: clamp(15px, 3.8vw, 23px);
  box-shadow: 0 2px 8px #26205308;
}
.card h2 { margin-bottom: 12px; }
.login { max-width: 430px; }
.login button { margin-top: 12px; width: 100%; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.account { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 14px; }
.account h2 { margin-bottom: 2px; }
.account-rights { color: var(--accent-dark); font-size: .875rem; font-weight: 650; }
.muted { color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }

label { display: block; margin-top: 12px; margin-bottom: 5px; font-weight: 620; }
button, input, select, textarea { font: inherit; border-radius: 12px; min-height: 44px; }
button {
  cursor: pointer;
  padding: 8px 12px;
  border: 1px solid transparent;
  color: var(--ink);
  background: #edf0f6;
  font-weight: 650;
  overflow-wrap: anywhere;
}
button:disabled { cursor: default; opacity: .56; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
button.primary { color: var(--white); background: var(--accent); }
button.secondary { background: var(--tint); color: var(--accent-dark); }
button.quiet { background: transparent; color: var(--accent-dark); }
button.danger { color: var(--danger); }
@media (hover: hover) {
  button.primary:not(:disabled):hover { background: var(--accent-dark); }
  button:not(.primary):not(:disabled):hover { background: #e2eafd; }
}
input, select, textarea {
  padding: 8px 10px;
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background: #f5f6fa;
  border: 1px solid #d1d9e9;
}
input[type="file"] { font-size: .9rem; margin-top: 7px; }
textarea { resize: vertical; }
.field-action { display: flex; align-items: stretch; gap: 8px; }
.field-action button { flex-shrink: 0; }
.field-action input { flex: 1; }
.switcher { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.switcher button { background: var(--white); border-color: var(--line); }
.switcher button[aria-pressed="true"] {
  background: var(--tint);
  color: var(--accent-dark);
  border-color: #b6c8f2;
}
.switcher:empty { display: none; }
.notice {
  color: var(--ink);
  background: var(--tint);
  border-radius: 10px;
  margin: 0 0 14px;
  padding: 9px 12px;
  font-size: .95rem;
  overflow-wrap: anywhere;
}
.notice.bad { background: #fff0f3; color: var(--danger); }
.notice.good { background: #ebf7f0; color: #245742; }
.report-layout, .column { display: grid; align-content: start; gap: 12px; }
.report-layout { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) {
  .report-layout { grid-template-columns: minmax(0, 1fr) minmax(0, .85fr); gap: 16px; }
}
.selected, .recovery, .result { overflow-wrap: anywhere; }
.selected { margin-top: 12px; background: #f5f3ff; border-radius: 10px; padding: 10px; }
.selected p + p { margin-top: 3px; }
.recovery, .result { margin-bottom: 12px; }
.recovery .actions { margin-top: 12px; }
.reference { font-family: ui-monospace, monospace; font-size: .8rem; color: var(--muted); margin-top: 7px; }
.compact-list, .work-list { list-style: none; padding: 0; margin: 10px 0 0; }
.compact-list:empty, .work-list:empty { display: none; }
.compact-list li { display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); }
.compact-list li > div:first-child { flex: 1; min-width: 120px; }
.compact-list li p { overflow-wrap: anywhere; }
.work-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 265px), 1fr)); gap: 10px; }
.work-list li { padding: 13px; border: 1px solid var(--line); border-radius: 11px; overflow-wrap: anywhere; }
.work-list .actions, #action-form .actions { margin-top: 10px; }
.work-title { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 10px; }
.status { color: var(--accent-dark); font-size: .875rem; font-weight: 650; }
.order-value { font-weight: 700; font-variant-numeric: tabular-nums; margin-block: 5px; }
.section-header { margin-bottom: 10px; }
.section-header h2 { margin: 0; }
details { margin-top: 12px; }
summary { cursor: pointer; font-weight: 650; min-height: 44px; padding-block: 8px; }
details .muted { margin-bottom: 6px; }
.code-card { margin-top: 0; }
.code-card button, .code-card img { display: block; margin-top: 8px; }
.code-card img { background: white; border: 1px solid var(--line); border-radius: 8px; }
#order-submit { width: 100%; margin-top: 13px; }

dialog { width: min(420px, calc(100% - 28px)); color: var(--ink); }
dialog::backdrop { background: #1b15386b; }
#action-order { margin-top: 6px; }
#action-notice { margin-top: 8px; }

.stage5-detail { margin-top: 16px; padding-top: 15px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.stage5-detail form { margin-top: 15px; }
.stage5-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 5px 12px; margin-bottom: 12px; }
.stage5-fields label { min-width: 0; }
.stage5-fields input, .stage5-fields select { margin-top: 4px; }
.stage5-check { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.stage5-check input { width: 18px; min-height: 18px; accent-color: var(--accent); }
.stage5-results { display: grid; gap: 10px; margin-top: 12px; overflow-wrap: anywhere; }
.stage5-results:empty { display: none; }
.stage5-result, .stage5-policy-card { background: #fbfaff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.stage5-result p + p, .stage5-copy p + p { margin-top: 4px; }
.stage5-copy { margin-bottom: 8px; }
.stage5-copy p { white-space: pre-wrap; overflow-wrap: anywhere; }
.stage5-images { display: flex; flex-wrap: wrap; gap: 8px; }
.stage5-images:not(:empty) { margin-block: 9px; }
.stage5-images img { width: min(176px, 100%); aspect-ratio: 1; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.stage5-detail > .notice, .stage5-detail form > button, .stage5-detail > button,
#directory-more, #rank-more, #history-more, #appeals-more,
#stage5-merchants > .notice, #stage5-performance > .notice, #stage5-history > .notice, #admin-appeal > .notice { margin-top: 10px; }
.stage5-policy-card h2 { margin: 0; }
.stage5-policy-card .stage5-fields { gap: 0 12px; }
.stage5-policy-card .stage5-check { margin: 0; }
#stage5-admin .card + .card { margin-top: 12px; }


/* Shared phone shell */
:root {
  --phone-width: 448px;
  --gutter: clamp(14px, 4.8vw, 22px);
}
body { color: var(--ink); }
.app {
  width: min(100%, var(--phone-width));
  min-height: 100vh;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) max(var(--gutter), env(safe-area-inset-right))
    calc(104px + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  background: var(--surface);
}
.review-bar, .phone-top { margin-inline: calc(-1 * var(--gutter)); }
.review-bar {
  position: sticky; z-index: 19; top: 0; display: flex; align-items: center; justify-content: space-between;
  gap: 9px; min-height: 53px; padding: 3px var(--gutter); background: var(--surface); border-bottom: 1px solid var(--line);
}
.review-bar strong { color: var(--muted); font-size: 13px; font-weight: 550; }
.review-bar button { color: var(--accent-dark); background: transparent; padding-inline: 6px; font-size: 13px; }
.demo-roles { display: flex; align-items: center; gap: 7px; min-width: 0; }
.demo-roles label { margin: 0; color: var(--muted); font-size: 13px; white-space: nowrap; }
.demo-roles select { width: auto; max-width: 100%; min-width: 108px; padding: 6px 10px; background: #fff; font-size: 14px; }
html[data-demo="true"] #login-brand { display: none; }
.cc-topsoft { padding: 0 var(--gutter); }
.app:has(#workspace[hidden]) .phone-top { display: none; }
.cc-chrome { min-height: 74px; margin: 0; padding: 16px 0 15px; flex-wrap: nowrap; gap: 10px; }
.cc-chrome h1 { order: -1; font-size: clamp(25px, 7.6vw, 33px); font-weight: 740; line-height: 1.18; letter-spacing: -.025em; overflow-wrap: anywhere; }
.cc-chrome h1:focus { outline: none; }
.cc-chrome:has(.back-button:not([hidden])) { justify-content: flex-start; gap: 11px; }
.cc-chrome:has(.back-button:not([hidden])) h1 { order: 0; font-size: 22px; }
.cc-chrome .back-button {
  flex: 0 0 auto; min-width: 54px; padding: 5px; font-size: .88rem; color: var(--accent-dark);
}
.cc-location { display: flex; align-items: center; gap: 5px; padding: 6px 8px; color: var(--muted); font-size: 12px; max-width: 32%; }
.cc-location span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-location svg { flex: 0 0 13px; width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.card, dialog { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 16px; box-shadow: none; }
.card h2 { font-size: 1.06rem; }

.login-brand { display: grid; justify-items: start; gap: 7px; padding: 57px 5px 22px; }
.login-brand > h1 { margin-top: 9px; font-size: clamp(32px, 9vw, 38px); font-weight: 740; }
.login-brand > p { color: var(--muted); }
.brand-mark {
  display: grid; place-items: center; width: 64px; height: 64px; flex: 0 0 auto;
  border-radius: 19px; background: linear-gradient(145deg, #2049b4, #2f65db);
  color: #fff; font-size: 1.9rem; font-weight: 720;
}
.cc-avatar { width: 44px; height: 44px; border-radius: 13px; font-size: 21px; }
.cc-idrow {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 12px; margin: 0 0 14px; padding: 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 19px;
}
.cc-idtext { flex: 1; min-width: 0; }
.account-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; }
.cc-idrow h2 { margin: 0 0 3px; font-size: 19px; }
.cc-tag {
  display: block; max-width: 100%; overflow-wrap: anywhere;
  color: var(--muted); font-size: 12px; line-height: 1.45;
}
.account-rights { margin: 3px 0 0; color: var(--accent-dark); font-size: .75rem; font-weight: 550; }
.account-rights:empty { display: none; }
.cc-qrbtn {
  display: grid; place-items: center; width: 44px; min-height: 44px; flex: 0 0 44px;
  padding: 0; background: var(--tint); color: var(--accent-dark); border-radius: 13px;
}
.cc-qrbtn svg, .cc-quickicon svg, .cc-nav svg, .cc-link svg, .cc-tool svg, .scan-frame svg {
  width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.login { width: 100%; max-width: none; padding: 20px; }
.login h2 { margin-bottom: 18px; }
.login label { color: var(--muted); font-size: .88rem; }
.login button { margin-top: 16px; min-height: 48px; }

/* The four primary destinations stay above the safe area. */
.cc-nav {
  position: fixed; z-index: 20; bottom: calc(10px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  width: calc(min(100%, var(--phone-width)) - 2 * var(--gutter));
  gap: 3px; padding: 5px; background: #fff; border: 1px solid #dce3f0;
  border-radius: 23px; box-shadow: 0 6px 22px rgba(25, 48, 87, .13);
}
@supports (backdrop-filter: blur(16px)) {
  .cc-nav { background: rgba(255, 255, 255, .92); backdrop-filter: blur(16px); }
}
.cc-nav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 47px; padding: 3px 0; border: 0; border-radius: 17px; color: var(--muted);
  background: transparent; font-size: 11px; font-weight: 550;
}
.cc-nav svg { width: 20px; height: 20px; stroke-width: 1.7; }
.cc-nav [aria-current="page"] { color: var(--accent-dark); background: var(--tint); font-weight: 700; }
.cc-nav [aria-current="page"] svg { stroke-width: 2.2; }

.cc-stat {
  position: relative; isolation: isolate; overflow: hidden;
  border-radius: 23px; padding: 15px 18px 17px; color: #fff;
  background: linear-gradient(140deg, #18284c, #214da8);
  box-shadow: 0 8px 18px rgba(25, 48, 87, .14);
}
.cc-stat::before {
  content: ""; position: absolute; z-index: -1; top: -72px; right: -32px;
  width: 173px; height: 173px; border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 50%; box-shadow: 0 0 0 22px rgba(255, 255, 255, .04), 0 0 0 44px rgba(255, 255, 255, .04);
}
.cc-stathead { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #dfebff; font-size: 12px; }
.cc-stathead h2 { color: #fff; font-size: 18px; font-weight: 680; }
#home-period { display: block; margin-top: 4px; }
.cc-period {
  flex: 0 0 auto; background: rgba(255, 255, 255, .14); color: #fff; border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 12px; padding: 4px 9px; font-size: 12px; font-weight: 600;
}
.cc-period:not(.primary):not(:disabled):hover { background: rgba(255, 255, 255, .22); }
.cc-period:focus-visible { outline-color: #fff; }
.cc-period::after, .feed-more::after {
  content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 2px 2px 6px;
  border-right: 1px solid; border-bottom: 1px solid; transform: rotate(45deg);
}
.cc-period[aria-expanded="true"]::after { transform: rotate(225deg); }
.cc-statnums { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); margin-top: 17px; gap: 12px; }
.cc-statnums > div + div { border-left: 1px solid rgba(255, 255, 255, .24); padding-left: 12px; }
.cc-statnums b {
  display: block; font-size: clamp(23px, 7.5vw, 34px); line-height: 1.12; font-weight: 720;
  letter-spacing: -.035em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.cc-statnums em { margin-left: 4px; font-size: 12px; font-weight: 400; font-style: normal; letter-spacing: 0; }
.stat-label { display: block; margin-bottom: 5px; color: #dfebff; font-size: 12px; }
.overview-secondary {
  display: flex; flex-wrap: wrap; gap: 2px 8px; margin-top: 13px; padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, .24); color: #dfebff; font-size: 12px; font-variant-numeric: tabular-nums;
}
.overview-secondary strong { color: #fff; overflow-wrap: anywhere; }
.overview-restricted { margin-top: 8px; color: #dfebff; font-size: 13px; }
#home-dates { margin-top: 12px; padding: 12px; color: var(--ink); background: #fff; border-radius: 13px; }
.cc-stat .notice { margin: 8px 0 0; }

.cc-quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 13px; }
.cc-quick button {
  min-width: 0; min-height: 90px; padding: 12px; display: grid; justify-items: start; align-content: start; gap: 7px;
  border: 1px solid var(--line); border-radius: 19px; background: #fff; text-align: left;
}
.cc-quick button.primary { border-color: transparent; background: var(--accent); }
.cc-quick button.primary:not(:disabled):hover { background: var(--accent-dark); }
.cc-quickicon {
  width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: 10px; background: var(--tint); color: var(--accent-dark);
}
.cc-quick .primary .cc-quickicon { background: rgba(255, 255, 255, .16); color: #fff; }
.cc-quick strong, .cc-quick small { display: block; }
.cc-quick strong { font-size: 16px; line-height: 1.3; font-weight: 690; }
.cc-quick small { margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 500; }
.cc-quick .primary small { color: #e7eeff; }

.cc-panel { border-radius: 20px; padding: 16px; }
#home .cc-panel { margin-top: 14px; }
.cc-paneltitle { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cc-paneltitle h2 { margin: 0; }
.cc-link { display: inline-flex; align-items: center; gap: 3px; padding: 5px 0; color: var(--accent-dark); font-size: 12px; }
.cc-link svg { width: 13px; height: 13px; }
.cc-panel .cc-feedtitle { font-size: 18px; font-weight: 700; margin: 0 0 12px; }
.cc-feedhead, .cc-feedrow {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(66px, 25%) 46px;
  gap: 6px; align-items: center;
}
.cc-feedhead { padding-bottom: 10px; border-bottom: 1px solid #f1f1f5; color: var(--muted); font-size: 11px; }
.cc-feedhead > span:nth-child(n+2), .cc-money, .cc-feedrow time { text-align: right; }
.feed-list, .home-rank-list { margin: 0; padding: 0; list-style: none; }
.feed-list > li + li, .home-rank-list > li + li { border-top: 1px solid #f0f0f6; }
.cc-feedrow, .cc-rankrow { border: 0; border-radius: 0; padding: 11px 0; width: 100%; background: transparent; text-align: left; }
.home-feed-route { min-width: 0; }
.home-feed-route strong, .home-feed-route small { display: block; overflow-wrap: anywhere; }
.home-feed-route strong { font-size: 12px; font-weight: 500; }
.home-feed-route small, .cc-feedrow time { margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 500; }
.cc-money { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.feed-more { display: flex; justify-content: center; width: 100%; margin-top: 12px; }
.home-empty { padding: 10px 0; color: var(--muted); font-size: .82rem; }

/* Ranking controls and rows */
#stage5-performance { padding: 0; border: 0; background: transparent; }
.cc-rankcontent { padding: 2px 0 12px; }
.cc-leveltabs {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px;
  padding: 4px; border-radius: 15px; background: #e4e9f3;
}
.rank-levels button {
  background: transparent; color: var(--muted);
  min-height: 44px; padding: 6px; border-radius: 12px; font-size: 15px;
}
.rank-levels button[aria-pressed="true"], .rank-levels button[aria-pressed="true"]:not(:disabled):hover {
  color: var(--accent-dark); background: #fff; box-shadow: 0 2px 6px rgba(24, 35, 59, .11);
}
.rank-directions {
  display: inline-flex; gap: 3px; margin-top: 10px; padding: 3px;
  border-radius: 12px; background: #e4e9f3;
}
.rank-directions button {
  min-height: 44px; padding: 6px 9px; border-radius: 9px;
  background: transparent; color: var(--muted); font-size: 12px;
}
.rank-directions button[aria-pressed="true"],
.rank-directions button[aria-pressed="true"]:not(:disabled):hover { background: var(--accent); color: #fff; }
.rank-filters .stage5-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rank-filters label { font-size: .8rem; color: var(--muted); }
.rank-filters button[type="submit"] { font-size: .82rem; }
.ranking-empty > p { margin-top: 12px; }
#dashboard-results { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 0 0 12px; }
#dashboard-results > p { grid-column: 1 / -1; }
#dashboard-results .stage5-result { padding: 8px 10px; border: 0; border-radius: 12px; }
#dashboard-results .stage5-result strong { font-size: .8rem; }
#dashboard-results .stage5-result p { color: var(--accent-dark); font-size: .82rem; }
.rank-list {
  border-radius: 20px; border: 1px solid var(--line); background: #fff; padding: 0 16px; margin: 0;
}
.rank-list > li { min-height: 65px; color: var(--ink); }
.rank-list > li:first-child { border-top: 0; }
.cc-rankrow {
  display: grid; grid-template-columns: 27px minmax(0, 1fr); gap: 8px; align-items: start;
}
.cc-rankline { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cc-rankline .rank-value { flex: 0 1 auto; }
.cc-rankmeta { display: block; text-align: right; color: var(--muted); font-size: 10px; }
.home-rank-figures { min-width: 0; }
.rank-medal {
  display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%;
  color: #666a7d; font-size: .75rem; font-weight: 700;
}
.rank-medal[data-rank="1"] { color: #805e13; background: #fff0cb; border: 1px solid #ebd294; }
.rank-medal[data-rank="2"] { color: #4e6383; background: #eaedf7; border: 1px solid #cfd8e8; }
.rank-medal[data-rank="3"] { color: #8c4f28; background: #fae6d7; border: 1px solid #e9b698; }
.rank-name, .rank-value { min-width: 0; font-size: .82rem; overflow-wrap: anywhere; }
.rank-name strong, .rank-name small, .rank-value strong, .rank-value small { display: block; }
.rank-value { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.rank-name small, .rank-value small { color: var(--muted); font-size: .69rem; font-weight: 500; }
.rank-progress { width: 100%; height: 5px; margin-top: 4px; border: 0; border-radius: 6px; overflow: hidden; accent-color: var(--accent); }
.rank-progress::-webkit-progress-bar { background: var(--tint); }
.rank-progress::-webkit-progress-value { background: linear-gradient(90deg, #7596ec, var(--accent)); border-radius: 6px; }
.rank-progress::-moz-progress-bar { background: var(--accent); border-radius: 6px; }
#stage5-performance:has(#rank-level-group[aria-pressed="true"]) .rank-list { background: transparent; border: 0; padding: 0; }
#stage5-performance:has(#rank-level-group[aria-pressed="true"]) .rank-list > li {
  margin-bottom: 9px; padding: 13px; border: 1px solid var(--line); border-radius: 19px; background: #fff;
}

/* Merchants and account menus */
#stage5-merchants:has(#directory-pane:not([hidden])) { border: 0; background: transparent; padding: 0; }
#directory-form label { font-size: .88rem; color: var(--muted); margin-top: 0; }
#directory-form input { background: #fff; border-color: #d1d9e9; }
#directory-form button { border-radius: 12px; font-size: .85rem; }
.merchant-list { display: grid; gap: 10px; }
.merchant-list > li {
  position: relative; display: grid; grid-template-columns: clamp(60px, 20vw, 82px) minmax(0, 1fr) 44px;
  gap: 12px; align-items: center; min-height: 105px; padding: 14px; border: 1px solid var(--line);
  border-radius: 20px; background: #fff;
}
.merchant-list > li:not(:has(.merchant-thumb))::before, .merchant-thumb {
  content: ""; display: grid; place-items: center; width: 100%; min-width: 0; aspect-ratio: 1; border-radius: 12px;
  background: var(--tint);
  overflow: hidden; color: var(--accent-dark); font-size: .94rem; text-align: center; overflow-wrap: anywhere;
}
.merchant-thumb img { width: 100%; height: 100%; object-fit: cover; }
.merchant-list > li > div:first-child, .merchant-list > li > div { min-width: 0; }
.merchant-list > li > div p:first-child { font-weight: 650; font-size: .88rem; }
.merchant-list > li > div .muted { margin-top: 4px; font-size: .74rem; }
.merchant-list > li > button { width: 44px; min-height: 44px; padding: 0; background: transparent; font-size: 0; }
.merchant-list > li > button::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-top: 1.5px solid #77708c;
  border-right: 1.5px solid #77708c; transform: rotate(45deg);
}
.merchant-list > li > button::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.merchant-list > li > button:focus-visible::after { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 16px; }

.cc-mybody { gap: 14px; }
.cc-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 3px 0 2px; }
.cc-tools:not(:has(button:not([hidden]))), .profile-links:not(:has(button:not([hidden]))) { display: none; }
.cc-tool {
  display: flex; align-items: center; flex-direction: column; gap: 8px;
  padding: 5px 0; font-size: 12px; background: transparent;
}
.cc-tool > span {
  display: grid; place-items: center; width: 41px; height: 41px; border-radius: 11px;
  color: var(--accent-dark); background: var(--tint);
}
.account-id { overflow-wrap: anywhere; }
.menu-card { padding-top: 11px; padding-bottom: 11px; }
.menu-card h2 { margin: 4px 0 8px; }
.menu-card button {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; min-height: 48px; padding: 8px 0; gap: 8px; border: 0; border-radius: 0;
  border-bottom: 1px solid var(--line); background: transparent; text-align: left; font-size: .94rem; font-weight: 520;
}
.menu-card button::after { content: ""; flex: 0 0 6px; height: 6px; margin-right: 4px; border-top: 1px solid #868096; border-right: 1px solid #868096; transform: rotate(45deg); }
.menu-card button:last-child { border-bottom: 0; }
#profile > .cc-panel:not(:has(button:not([hidden]))) { display: none; }
.profile-links { padding-bottom: 0; }

/* Task pages */
.report-steps {
  display: none; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px;
  padding: 0 1px; margin: 0 0 12px; list-style: none; color: var(--muted); font-size: .73rem;
}
#report:has(#compose:not([hidden]) #scan-step:not([hidden])) .report-steps,
#report:has(#compose:not([hidden]) #order-step:not([hidden])) .report-steps,
#report:has(#receipt:not([hidden])) .report-steps { display: grid; }
.report-steps li:nth-child(2) { text-align: center; }
.report-steps li:last-child { text-align: right; }
#report:has(#compose:not([hidden]) #scan-step:not([hidden])) .report-steps li:first-child,
#report:has(#compose:not([hidden]) #order-step:not([hidden])) .report-steps li:nth-child(2),
#report:has(#receipt:not([hidden])) .report-steps li:last-child { color: var(--accent-dark); font-weight: 700; }
.report-layout { display: block; }
.report-layout .column + .column:has(> :not([hidden])) { margin-top: 12px; }
#directory-pane, #history-pane { min-width: 0; }
#merchant-profile, #history-detail { margin: 0; border: 0; padding: 0; }
#amount { min-height: 52px; border-radius: 0; border-width: 0 0 1px; background: #fff; font-size: 1.68rem; font-variant-numeric: tabular-nums; }
#selection { margin: 0 0 13px; padding: 12px; background: var(--tint); border-radius: 14px; }
.form-action { position: sticky; bottom: env(safe-area-inset-bottom); margin-top: 12px; padding: 6px 0; background: #fff; border-radius: 16px; z-index: 1; }
.form-action .primary { width: 100%; min-height: 48px; margin: 0; border-radius: 14px; }
.code-card { text-align: center; }
.code-card img { display: block; width: min(100%, 208px); height: auto; margin: 14px auto; }
.code-card .actions { justify-content: center; }
.scan-actions { display: grid; gap: 8px; margin: 8px 0; }
.file-label {
  display: flex; align-items: center; justify-content: center; min-height: 44px;
  margin: 0; padding: 7px 11px; border-radius: 12px; background: var(--tint);
  color: var(--accent-dark); cursor: pointer; text-align: center;
}
.scan-launch {
  display: grid; place-items: center; align-content: center; gap: 14px; min-height: 200px; aspect-ratio: 1.2;
  padding: 12px; border-radius: 18px; color: #fff; background: linear-gradient(145deg, #18284c, #214375);
}
.scan-launch:not(.primary):not(:disabled):hover { background: #213e6e; }
.scan-frame { display: grid; place-items: center; width: 42%; aspect-ratio: 1; border: 2px solid #a7c3fa; border-radius: 14px; color: #dfebff; }
.scan-frame svg { width: 52%; height: 52%; stroke-width: 1.5; }
#scan-form:has(#scan-preview:not([hidden])) .scan-launch { display: none; }
.scan-file { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; overflow: hidden; clip-path: inset(50%); }
#scan-form:has(.scan-file:focus-visible) #scan-image-label { outline: 2px solid var(--accent); outline-offset: 3px; }
.camera-view { display: grid; gap: 8px; padding: 8px 0; }
.camera-view video { width: 100%; max-height: 270px; background: #18284c; border-radius: 15px; object-fit: cover; }
#scan-feedback { margin-bottom: 8px; }

@media (max-width: 355px) {
  .cc-panel { padding: 13px; }
  .cc-quick button { padding: 10px; }
  .cc-quick strong { font-size: 14px; }
  .cc-feedhead, .cc-feedrow { grid-template-columns: minmax(0, 1fr) minmax(57px, 25%) 36px; }
  .merchant-list > li { padding: 10px; gap: 8px; }
}
@media (min-width: 600px) {
  body { padding: 20px 0 0; }
  .cc-shell { min-height: calc(100dvh - 20px); border-radius: 24px 24px 0 0; box-shadow: 0 10px 40px rgba(24, 35, 59, .08); }
  .review-bar { border-radius: 20px 20px 0 0; }
  .review-bar[hidden] + .phone-top { border-radius: 20px 20px 0 0; }
}


/* Collapsible filters keep the first rank card within the phone viewport. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.rank-filters { padding-bottom: 7px; }
.cc-filterbar, .cc-ranksub {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.cc-filterbar { margin-top: 7px; }
.rank-directions { margin-top: 0; padding: 3px; }
.rank-period { flex: 0 0 auto; margin-left: auto; padding: 5px 0 5px 8px; font-size: .8rem; }
.rank-period::after {
  content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 3px 2px 6px;
  border-right: 1px solid; border-bottom: 1px solid; transform: rotate(45deg);
}
.rank-period[aria-expanded="true"]::after { transform: rotate(225deg); }
.cc-ranksub { min-height: 42px; }
#rank-range-label { color: var(--muted); font-size: .7rem; overflow-wrap: anywhere; }
.rank-filters .rank-sort { flex: 0 0 auto; margin: 0; }
.rank-sort select {
  margin: 0; min-height: 44px; padding: 5px 2px 5px 6px; width: auto;
  border: 0; color: #484666; background: transparent; font-size: .77rem;
}
.rank-date-panel { padding: 12px; margin-bottom: 7px; border-radius: 14px; background: #fff; }
.rank-date-panel .stage5-fields label { margin-top: 6px; }
.rank-date-panel button[type="submit"] { width: 100%; }
#dashboard-results:not(:empty) { margin: 12px 0 0; }
.rank-list > .rank-row:not([data-level="group"]) {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(64px, auto);
  align-items: center; gap: 10px;
}
.rank-row:not([data-level="group"]) > .rank-row-title {
  display: flex; align-items: center; gap: 8px; min-width: 0;
}
.rank-row:not([data-level="group"]) .rank-medal { flex: 0 0 25px; }
.rank-row-figures { display: grid; gap: 1px; min-width: 0; max-width: min(148px, 41vw); text-align: right; }
.rank-count { color: var(--muted); font-size: .7rem; }
.rank-row:not([data-level="group"]) > button {
  position: absolute; inset: 0; width: 100%; padding: 0; border: 0; border-radius: 8px; font-size: 0;
}
.rank-list .rank-row:not([data-level="group"]) > button:not(:disabled):hover { background: #ece8ff2e; }
.rank-list > .rank-row[data-level="group"] { display: block; padding: 14px 16px; }
.rank-row[data-level="group"] .rank-row-title {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.rank-row[data-level="group"] .rank-row-title > strong { font-size: 1.05rem; font-weight: 700; }
.rank-row[data-level="group"] .rank-row-title > .rank-medal { order: 1; flex: 0 0 auto; }
.rank-metrics {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start;
  gap: 4px; margin-top: 10px; text-align: center;
}
.rank-metric { min-width: 0; }
.rank-metric + .rank-metric { border-left: 1px solid var(--line); }
.rank-metric strong, .rank-metric small { display: block; overflow-wrap: anywhere; }
.rank-metric strong { font-size: 1.18rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.rank-metric small { color: var(--muted); font-size: .68rem; }


.site-filing { padding: 6px 0 2px; text-align: center; font-size: .75rem; }
.site-filing a { color: var(--muted); }
