:root {
  font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  color: #172341;
  background: #f3f6fc;
  font-size: 16px;
  line-height: 1.55;
  color-scheme: light;
  --blue: #244bd6;
  --ink: #172341;
  --line: #dfe6f2;
  --muted: #52617f;
  --white: #fff;
  --tint: #f5f7fc;
  --radius: 18px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body, h1, h2, h3, p, figure { margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.23; }
h2 { font-size: 1.2rem; line-height: 1.35; }
h3 { font-size: 1rem; }
p, small { color: var(--muted); }
small { display: block; font-size: .82rem; font-weight: 400; }
a { color: var(--blue); text-underline-offset: .18em; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .61rem .95rem; border: 1px solid transparent; border-radius: 10px;
  background: var(--blue); color: var(--white); cursor: pointer;
  font: inherit; font-weight: 650; line-height: 1.35; text-align: center; text-decoration: none;
}
button:hover, .button:hover { filter: brightness(.94); }
button:disabled { opacity: .6; cursor: wait; }
.secondary { background: var(--white); color: #34486c; border-color: #d6e0f0; }
.secondary:hover { background: #f2f5fd; filter: none; }
:focus-visible { outline: 3px solid #5279ff; outline-offset: 3px; }
input, textarea, select {
  padding: .55rem .7rem; min-width: 0; min-height: 40px;
  border: 1px solid #cbd6e8; border-radius: 9px; background: #fff;
  color: inherit; font: inherit; line-height: 1.35;
}
input::placeholder, textarea::placeholder { color: #667694; }
input[type=radio], input[type=checkbox] { min-height: auto; accent-color: var(--blue); }
input[type=file] { width: 100%; max-width: 100%; font-size: .88rem; }
input[type=file]::file-selector-button {
  border: 0; border-radius: 6px; padding: .36rem .68rem; margin-inline-end: .65rem;
  background: #e9efff; color: #2647a9; font: inherit; font-weight: 650; cursor: pointer;
}
textarea { resize: vertical; }

.dashboard { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.mast {
  position: sticky; top: 0; height: 100dvh; padding: 1.6rem 1rem;
  background: linear-gradient(167deg, #14254b, #11203e 68%);
  color: #fff;
}
.brand { display: flex; align-items: center; gap: .7rem; padding: .18rem .35rem; color: inherit; font-weight: 750; font-size: 1.14rem; text-decoration: none; white-space: nowrap; }
.brand-icon { display: grid; place-items: center; position: relative; width: 36px; height: 36px; border-radius: 11px; background: #486bf4; box-shadow: inset 0 0 0 1px #a3b7ff70; }
.brand-icon i { position: absolute; width: 15px; height: 9px; border: 1.7px solid white; border-radius: 6px; transform: rotate(-42deg); }
.brand-icon i:first-child { translate: -3px 3px; }
.brand-icon i:last-child { translate: 3px -3px; }
.mast nav { display: grid; gap: .28rem; margin-top: 2.2rem; }
.mast nav a {
  display: flex; align-items: center; gap: .65rem; padding: .67rem .72rem;
  border: 1px solid transparent; border-radius: 10px;
  color: #d8e2f9; font-size: .9rem; text-decoration: none; white-space: nowrap;
}
.mast nav a:hover { background: #ffffff0d; color: var(--white); }
.mast nav a[aria-current] { background: #243d79; border-color: #4160a4; color: var(--white); font-weight: 700; }
.nav-icon { display: grid; place-items: center; width: 22px; height: 22px; color: #aabfff; font: 650 1.05rem/1 system-ui, sans-serif; }
.shell { width: 100%; max-width: 1380px; margin-inline: auto; padding: 2rem clamp(1rem, 3vw, 3rem) 3rem; min-width: 0; }
.heading, .panel-title, .filters, .actions { display: flex; align-items: center; gap: .75rem; }
.heading, .panel-title { justify-content: space-between; flex-wrap: wrap; }
.intro {
  position: relative; isolation: isolate; min-height: 164px; overflow: hidden;
  margin-bottom: 1rem; padding: 1.5rem clamp(1.25rem, 3.5vw, 2.5rem);
  border: 1px solid #233e87; border-radius: 22px;
  background: linear-gradient(116deg, #182f66 6%, #243f99 59%, #3558c5);
  color: #fff; box-shadow: 0 13px 28px #253d801a;
}
.intro::before, .intro::after {
  content: ""; position: absolute; z-index: -1; right: 11%; top: -82%;
  width: 340px; height: 340px; border: 1px solid #d4e0ff31; border-radius: 50%;
  box-shadow: 0 0 0 28px #d4e0ff0c, 0 0 0 56px #d4e0ff08;
  pointer-events: none;
}
.intro::after { top: auto; bottom: -140%; right: -11%; width: 430px; height: 430px; }
.intro p { margin-top: .5rem; color: #dce6ff; }
.intro button { background: #fff; color: #1c3eae; box-shadow: 0 5px 16px #10215330; white-space: nowrap; }
.intro button span { font: 1.15rem/1 system-ui, sans-serif; }
.notice, .status { padding: .7rem .9rem; border-radius: 10px; background: #edf2ff; color: #3e5078; }
#local-notice {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  border: 1px solid #d9e4fc; margin-bottom: 1rem; font-size: .89rem;
}
#local-notice strong { color: #25458e; }
#status { margin-bottom: 1rem; }
.panel {
  margin-bottom: 1rem; padding: 1.27rem;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 4px 16px #20396608;
}
.panel[id] { scroll-margin-top: 1rem; }
.panel-title { align-items: center; margin-bottom: .95rem; }
.panel-title .filters { margin-left: auto; }
.filters { gap: .55rem; }
.filters select, .filters input, .panel-title button { font-size: .88rem; }
.link-filters input { width: clamp(160px, 22vw, 235px); }
.empty { padding: .8rem 0; font-size: .9rem; }
.result { background: #f4fbf9; border-color: #b0ded5; }
.campaign { min-width: 0; margin: .7rem 0; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.campaign:last-child { margin-bottom: 0; }
.campaign-head, .campaign-line, .campaign-identity { display: flex; align-items: center; gap: .6rem; }
.campaign-head { justify-content: space-between; flex-wrap: wrap; padding: .85rem .95rem; }
.campaign-identity, .campaign-line { min-width: 0; }
.campaign-line { flex-wrap: wrap; gap: .3rem .48rem; }
.campaign-line strong { overflow-wrap: anywhere; }
.campaign-icon, .metric-icon {
  display: grid; flex: 0 0 auto; place-items: center; width: 38px; height: 38px;
  border-radius: 11px; background: #eaf0ff; color: #244bbf;
  font: 700 1.13rem/1 system-ui, sans-serif;
}
.tag { display: inline-block; border-radius: 6px; padding: .1rem .45rem; background: #edf1f8; color: #3c5075; font-size: .79rem; white-space: nowrap; }
.tag.good { color: #136452; background: #def6ed; }
.tag.kind { color: #345185; background: #edf2ff; }
.channel {
  display: grid; align-items: center; grid-template-columns: minmax(85px, auto) minmax(120px, 1fr) auto auto;
  gap: .6rem; padding: .62rem .95rem; border-top: 1px solid var(--line); background: #f7f9fe;
}
.channel:last-child { border-radius: 0 0 12px 12px; }
.result .channel { border: 1px solid #d4e9e5; border-radius: 10px; background: #fff; margin-top: .45rem; }
.channel-name { font-size: .9rem; font-weight: 650; overflow-wrap: anywhere; }
.channel button, .link-preview { font-size: .86rem; white-space: nowrap; }
.channel button { padding: .45rem .64rem; }
.link-address { width: 100%; background: #fff; color: #344b72; font: .86rem/1.45 "Cascadia Mono", Consolas, monospace; }
.link-preview { padding: .35rem; }

.metrics, .reports { display: grid; gap: .8rem; }
.metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: .65rem; }
.metric {
  display: flex; align-items: center; gap: .8rem; min-width: 0;
  padding: .85rem; border: 1px solid #dce6fe; border-radius: 12px; background: #f6f8ff;
  color: #465b88; font-size: .9rem;
}
.metric:nth-child(2) { background: #f2faf8; border-color: #d5ebe4; color: #3b6860; }
.metric:nth-child(2) .metric-icon { background: #dbf2eb; color: #216e5f; }
.metric:nth-child(3) { background: #faf7ff; border-color: #e9e1fa; color: #61517c; }
.metric:nth-child(3) .metric-icon { background: #eee7fc; color: #62449f; }
.metric strong { display: block; color: var(--ink); font: 700 1.62rem/1.22 system-ui, sans-serif; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-label { min-width: 0; }
.metrics-note { margin-bottom: .95rem; }
.reports { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.reports section { padding: .78rem .88rem; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.reports h3 { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: baseline; gap: .4rem; margin-bottom: .25rem; }
.reports .empty { padding-bottom: .35rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: .45rem .35rem; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 650; white-space: nowrap; }
td:first-child { overflow-wrap: anywhere; }

#editor {
  width: min(1080px, calc(100% - 2rem)); max-height: calc(100dvh - 2rem);
  margin: auto; padding: 0; border: 1px solid #cad7ef; border-radius: 22px;
  background: #fff; color: var(--ink); box-shadow: 0 24px 90px #101d4966;
}
#editor::backdrop { background: #0b173a99; backdrop-filter: blur(3px); }
.editor-head, .actions { display: flex; align-items: center; justify-content: space-between; gap: .7rem; }
.editor-head {
  position: sticky; z-index: 2; top: 0; min-height: 66px; padding: .85rem 1.35rem;
  border-bottom: 1px solid var(--line); background: #fff;
}
.editor-head h2 { font-size: 1.35rem; }
#dismiss { padding: 0; width: 38px; min-height: 38px; font: 1.3rem/1 system-ui, sans-serif; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(260px, 1fr); align-items: start; gap: 1.15rem; padding: 1.15rem 1.35rem; }
.editor-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .82rem; min-width: 0; }
.editor-fields label { display: grid; gap: .3rem; align-content: start; font-size: .9rem; font-weight: 620; }
.editor-fields .toggle { display: flex; align-items: center; font-weight: 400; }
.editor-fields .wide { grid-column: 1/-1; }
.templates { display: flex; flex-wrap: wrap; gap: .5rem; min-width: 0; padding: 0; margin: 0; border: 0; }
.templates legend { font-weight: 700; margin-bottom: .45rem; }
.templates label {
  display: flex; gap: .38rem; align-items: center;
  border: 1px solid var(--line); border-radius: 9px; background: #f8faff; padding: .5rem .64rem; cursor: pointer;
}
.templates label:has(:checked) { border-color: #6a87f2; background: #edf2ff; color: #2040a0; box-shadow: inset 0 0 0 1px #b1c1ff80; }
.templates input { margin: 0; }
.template-hint { margin: 0; font-size: .88rem; border-left: 3px solid #6f92f7; }
#contact-hint { overflow-wrap: anywhere; }
.advanced { min-width: 0; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: 10px; background: #f7f9fe; }
.advanced summary { cursor: pointer; color: #324a75; font-weight: 650; }
.advanced[open] summary { margin-bottom: .7rem; }
.preview {
  position: sticky; top: 76px; min-width: 0; padding: .95rem 1rem 1.1rem; border-radius: 16px;
  border: 1px solid #dbe5f9; background: radial-gradient(ellipse at center, #dce8ff, #eff4fd 74%);
}
.preview > h3 { margin-bottom: .7rem; text-align: center; color: #2b4170; }
.phone {
  position: relative; width: min(100%, 255px); margin-inline: auto; padding: 7px;
  border: 1px solid #425b85; border-radius: 27px;
  background: #15284e; box-shadow: 0 12px 24px #1936692d;
}
.phone::before {
  content: ""; position: absolute; z-index: 1; top: .65rem; left: 50%; translate: -50%;
  width: 46px; height: 6px; border-radius: 8px; background: #182849; pointer-events: none;
}
.phone-screen { display: grid; align-content: center; gap: .45rem; min-height: 325px; padding: 1.35rem .65rem .75rem; border-radius: 20px; background: linear-gradient(158deg, #e8efff, #f6f8fc 70%); }
.preview-empty { padding: 1rem .2rem; text-align: center; font-size: .86rem; }
.phone .landing-card { width: 100%; border-radius: 12px; box-shadow: 0 5px 15px #233d6417; }
.phone .landing-body { padding: .9rem; }
.phone .landing-body h3 { font-size: 1.14rem; line-height: 1.35; }
.phone .merchant { font-size: .81rem; }
.phone .description { font-size: .84rem; }
.phone .button { cursor: default; font-size: .85rem; }
.phone .cover { height: 100px; object-fit: cover; }
.phone figure { margin-top: .75rem; text-align: center; color: var(--muted); font-size: .8rem; }
.phone figure img { display: block; width: min(110px, 100%); margin: 0 auto .25rem; }
.qr-placeholder {
  display: grid; place-items: center; aspect-ratio: 1; width: 105px; max-width: 100%;
  margin: 0 auto .35rem; border: 1px dashed #aabbd8; border-radius: 8px; background: #f3f6fc;
}
.error { margin: 0 1.35rem .75rem; padding: .6rem .8rem; border-radius: 8px; background: #fff1f3; color: #a02035; }
.actions { position: sticky; z-index: 2; bottom: 0; justify-content: flex-end; padding: .72rem 1.35rem; background: #fff; border-top: 1px solid var(--line); }

.landing { min-height: 100vh; display: grid; place-items: center; padding: 1.2rem; background: linear-gradient(158deg, #e8efff, #f6f8fc 67%); }
.landing-card { width: min(100%, 480px); overflow: hidden; border: 1px solid #dde6f6; border-radius: 19px; background: #fff; box-shadow: 0 20px 50px #233d641c; }
.landing-body { padding: clamp(1.15rem, 5vw, 1.7rem); }
.landing-body h1 { font-size: clamp(1.55rem, 4.8vw, 2.15rem); }
.cover { display: block; width: 100%; max-height: 260px; object-fit: cover; }
.merchant { color: #244a9a; font-weight: 650; margin-bottom: .5rem; }
.description { white-space: pre-line; margin: .6rem 0 .88rem; overflow-wrap: anywhere; }
.landing-card :is(h1, h3, .merchant, .button, .contact-text) { max-width: 100%; overflow-wrap: anywhere; }
.landing-body h1 + :is(.contact-text, .button) { margin-top: .75rem; }
.landing figure { margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: .9rem; }
.landing figure img { width: min(200px, 100%); display: block; margin: 0 auto .5rem; }
.contact-text { display: inline-block; padding: .55rem 0; color: var(--blue); font-weight: 650; text-decoration: underline; text-underline-offset: .18em; }
.preview-banner { position: absolute; top: .8rem; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 1.6rem); text-align: center; padding: .32rem .8rem; background: #1c3d84; color: white; border-radius: 20px; font-size: .82rem; }
.landing:has(.preview-banner) { padding-top: 4rem; }
.filing { border-top: 1px solid var(--line); padding: .62rem 1rem; text-align: center; font-size: .82rem; }
.filing a { color: var(--muted); }

@media (max-width: 1000px) {
  .dashboard { grid-template-columns: 180px minmax(0, 1fr); }
  .mast { padding-inline: .75rem; }
  .shell { padding-inline: 1.15rem; }
}
@media (max-width: 800px) {
  .dashboard { display: block; }
  .mast { position: static; height: auto; padding: .75rem 1rem; }
  .mast nav { display: flex; flex-wrap: wrap; margin-top: .65rem; }
  .mast nav a { padding: .42rem .58rem; }
  .shell { padding-top: 1rem; }
  .editor-layout { grid-template-columns: 1fr; }
  .preview { position: static; }
}
@media (max-width: 560px) {
  .shell { padding-inline: .75rem; }
  .intro { min-height: auto; padding: 1.15rem; }
  .intro p { font-size: .88rem; }
  .panel { padding: .85rem; }
  .panel-title .filters { margin-left: 0; flex-wrap: wrap; }
  .link-filters { width: 100%; }
  .link-filters input { flex: 1 1 100%; width: 100%; }
  .campaign-head { padding: .65rem .7rem; }
  .campaign-head .filters button { padding: .43rem .7rem; }
  .channel { grid-template-columns: 1fr auto auto; padding: .55rem .7rem; }
  .link-address { grid-column: 1/-1; grid-row: 2; }
  .reports { grid-template-columns: 1fr; }
  .metrics { gap: .4rem; }
  .metric { flex-direction: column; align-items: flex-start; gap: .38rem; padding: .46rem; font-size: .76rem; }
  .metric-icon { width: 27px; height: 27px; border-radius: 8px; font-size: .9rem; }
  .metric strong { font-size: 1.35rem; }
  #editor { width: calc(100% - 1rem); max-height: calc(100dvh - 1rem); }
  .editor-layout, .editor-head, .actions { padding-inline: .85rem; }
  .editor-fields { grid-template-columns: minmax(0, 1fr); }
}

.mast { display: flex; flex-direction: column; }
.account { margin-top: auto; padding: .75rem .4rem .15rem; display: flex; align-items: center; justify-content: space-between; gap: .45rem; color: #ecf3ff; }
.account > div { min-width: 0; }
.account strong, .account small { display: block; overflow-wrap: anywhere; }
.account small { color: #c4d3f1; }
.account .secondary { flex: 0 0 auto; padding: .38rem .6rem; color: #fff; background: #263d72; border-color: #5470a7; font-size: .84rem; }
#member-usage { margin-bottom: 1rem; }
.pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .7rem; margin-top: 1rem; color: var(--muted); font-size: .88rem; }
.pagination button { font-size: .88rem; }
.pagination button:disabled { cursor: default; }
.subtext { margin-top: .28rem; font-size: .9rem; }
.member-tools { display: flex; justify-content: flex-end; margin-bottom: .65rem; }
.member-tools input { max-width: 100%; }
#member-list td { padding-block: .65rem; }
#member-list .secondary { font-size: .88rem; }
#member-editor {
  width: min(610px, calc(100% - 1.5rem)); max-height: calc(100dvh - 1rem);
  margin: auto; padding: 0; border: 1px solid #cad7ef; border-radius: 20px;
  color: var(--ink); box-shadow: 0 24px 90px #101d4966;
}
#member-editor::backdrop { background: #0b173a99; backdrop-filter: blur(3px); }
#dismiss-member { width: 38px; min-height: 38px; padding: 0; font: 1.3rem/1 system-ui, sans-serif; }
.member-fields { padding: 1rem 1.35rem; }
.login-page {
  display: grid; place-items: center; min-height: 100dvh; padding: 1rem;
  background: radial-gradient(ellipse at 78% 15%, #405fd0, transparent 48%), #142448;
}
.login-card {
  width: min(100%, 440px); padding: clamp(1.2rem, 6vw, 2.25rem);
  border: 1px solid #dce6f9; border-radius: 20px; background: #fff; box-shadow: 0 22px 80px #070e2b70;
}
.login-brand { display: flex; align-items: center; gap: .65rem; font-weight: 750; margin-bottom: 1.25rem; }
.login-card h1 { font-size: clamp(1.6rem, 6vw, 2rem); }
.login-card > p { margin: .4rem 0 1.15rem; font-size: .93rem; }
.login-card form, .login-card label { display: grid; gap: .85rem; }
.login-card label { gap: .3rem; font-weight: 650; font-size: .93rem; }
.login-card #login-error { background: #fff1f3; color: #a02035; border-radius: 8px; padding: .65rem; }
@media (max-width: 800px) { .account { margin-top: .55rem; padding: .45rem .25rem 0; border-top: 1px solid #ffffff24; } }
