:root {
  color-scheme: light;
  --mobile-ink: #173640;
  --mobile-muted: #71848c;
  --mobile-line: #d7e3e7;
  --mobile-bg: #edf4f6;
  --mobile-card: #fff;
  --mobile-accent: #0a91a0;
  --mobile-accent-dark: #087b88;
  --mobile-warning: #c77b12;
  --mobile-danger: #c44d54;
  --mobile-success: #26865b;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--mobile-bg); color: var(--mobile-ink); }
body { font-size: 15px; }
button, input, select, textarea { font: inherit; }
button, input, select { min-height: 44px; }
textarea { resize: vertical; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
[hidden] { display: none !important; }
.mobile-app { min-height: 100vh; }
.mobile-header { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(10px, env(safe-area-inset-top)) 14px 10px; background: #0d303b; color: #fff; box-shadow: 0 2px 12px rgb(8 41 51 / 18%); }
.mobile-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.mobile-brand img { width: 42px; height: 42px; object-fit: contain; }
.mobile-brand div { display: grid; gap: 2px; min-width: 0; }
.mobile-brand strong { font-size: 17px; letter-spacing: .02em; white-space: nowrap; }
.mobile-brand span { color: #b8d7dc; font-size: 12px; }
.mobile-header-actions { display: flex; align-items: center; gap: 7px; }
.mobile-user-badge { max-width: 102px; overflow: hidden; color: #d7eef1; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.icon-button { width: 42px; min-height: 40px; padding: 0; border: 1px solid #46717a; border-radius: 9px; background: transparent; color: #fff; font-size: 22px; line-height: 1; }
.icon-button:active { background: #1b4c56; }
.mobile-main { width: min(100%, 760px); margin: 0 auto; padding: 14px 12px calc(28px + env(safe-area-inset-bottom)); }
.mobile-card { margin-bottom: 12px; padding: 14px; border: 1px solid var(--mobile-line); border-radius: 14px; background: var(--mobile-card); box-shadow: 0 2px 9px rgb(20 66 77 / 5%); }
.section-heading, .dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.section-heading h1, .dialog-heading h2 { margin: 0; font-size: 19px; }
.section-heading p, .dialog-hint { margin: 4px 0 0; color: var(--mobile-muted); font-size: 12px; line-height: 1.5; }
.mobile-form { margin-top: 14px; }
.mobile-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mobile-form label, .mobile-filter-row label, .mobile-edit-field { display: grid; gap: 5px; color: #5d737b; font-size: 12px; }
.mobile-field-wide { grid-column: 1 / -1; }
input, select, textarea { width: 100%; border: 1px solid #bfd3d9; border-radius: 9px; background: #fff; color: var(--mobile-ink); outline: none; padding: 9px 10px; }
textarea { min-height: 78px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--mobile-accent); box-shadow: 0 0 0 3px rgb(10 145 160 / 13%); }
.mobile-form-actions { display: flex; justify-content: flex-end; margin-top: 12px; }
.primary, .secondary, .small-button, .text-button, .filter-chip { border-radius: 9px; border: 1px solid transparent; }
.primary { min-height: 44px; padding: 0 15px; background: var(--mobile-accent); color: #fff; font-weight: 700; }
.primary:active { background: var(--mobile-accent-dark); }
.secondary { min-height: 42px; padding: 0 14px; border-color: #bfd3d9; background: #fff; color: var(--mobile-ink); }
.text-button { min-height: 34px; padding: 3px 8px; border-color: transparent; background: transparent; color: var(--mobile-accent-dark); }
.text-button:active { background: #e5f4f5; }
.mobile-submit { width: 100%; }
.automation-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-block: 11px; }
.automation-main { display: flex; align-items: center; gap: 8px; min-width: 0; color: #46616a; font-size: 13px; }
.automation-main span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.automation-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: #9caeb3; }
.automation-card.is-running .automation-dot { background: var(--mobile-accent); box-shadow: 0 0 0 5px rgb(10 145 160 / 12%); }
.automation-card.is-error .automation-dot { background: var(--mobile-danger); }
.automation-card.is-done .automation-dot { background: var(--mobile-success); }
.small-button { min-height: 36px; padding: 0 11px; border-color: #bcd7dc; background: #f7fcfd; color: var(--mobile-accent-dark); white-space: nowrap; }
.mobile-xt-card { padding-bottom: 12px; }
.mobile-xt-list { display: grid; gap: 8px; max-height: 360px; margin-top: 12px; overflow-y: auto; overscroll-behavior: contain; }
.mobile-xt-option { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; width: 100%; padding: 11px 12px; border: 1px solid var(--mobile-line); border-radius: 11px; background: #fff; color: var(--mobile-ink); text-align: left; }
.mobile-xt-option:active { border-color: var(--mobile-accent); background: #f5fbfc; }
.mobile-xt-option-main { display: grid; gap: 3px; min-width: 0; }
.mobile-xt-option-main strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.mobile-xt-option-main span, .mobile-xt-option-main small { overflow: hidden; color: var(--mobile-muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.mobile-xt-option-actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px; align-self: center; flex-wrap: wrap; }
.mobile-xt-option-actions button { min-height: 32px; padding: 0 8px; border: 1px solid #bfd7dc; border-radius: 7px; background: #fff; color: var(--mobile-accent-dark); font-size: 11px; font-weight: 700; white-space: nowrap; }
.mobile-xt-option-actions .mobile-xt-delete-action { border-color: #efc5c5; color: #b44b4b; }
.mobile-xt-option-actions .mobile-xt-select-action { border-color: #a7dce2; }
.mobile-xt-empty { padding: 22px 10px; color: var(--mobile-muted); font-size: 12px; text-align: center; }
.mobile-filter-card { padding-bottom: 11px; }
.mobile-filter-row { display: flex; align-items: end; gap: 8px; }
.mobile-filter-row + .mobile-filter-row { margin-top: 9px; }
.mobile-search { flex: 1 1 auto; }
.mobile-search input { min-height: 44px; }
.filter-chip { min-height: 44px; padding: 0 12px; border-color: #c6d8dc; background: #fff; color: #516970; white-space: nowrap; }
.filter-chip.active { border-color: var(--mobile-accent); background: #e5f6f7; color: var(--mobile-accent-dark); font-weight: 700; }
.mobile-filter-secondary label { flex: 1 1 0; }
.mobile-date-row { align-items: end; flex-wrap: wrap; }
.mobile-date-row label { flex: 1 1 140px; }
.date-shortcuts { display: flex; gap: 2px; margin-left: auto; }
.mobile-summary { margin-top: 10px; color: var(--mobile-muted); font-size: 12px; }
.mobile-payment-list { display: grid; gap: 10px; }
.payment-empty { padding: 28px 14px; border: 1px dashed #c7d9de; border-radius: 14px; background: #fff; color: var(--mobile-muted); text-align: center; }
.payment-card { padding: 13px; border: 1px solid var(--mobile-line); border-left: 4px solid var(--mobile-accent); border-radius: 13px; background: #fff; box-shadow: 0 2px 9px rgb(20 66 77 / 5%); }
.payment-card.status-done { border-left-color: var(--mobile-success); }
.payment-card.status-error { border-left-color: var(--mobile-danger); }
.payment-card.status-pending { border-left-color: var(--mobile-warning); }
.payment-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.payment-card-title { display: grid; gap: 3px; min-width: 0; }
.payment-card-title strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.payment-card-title small { color: var(--mobile-muted); font-size: 11px; }
.payment-status-badge { flex: 0 0 auto; padding: 5px 8px; border-radius: 999px; background: #edf1f2; color: #5f7379; font-size: 11px; white-space: nowrap; }
.payment-status-badge.pending { background: #fff2d8; color: #9a620e; }
.payment-status-badge.progress { background: #e5f3fb; color: #28709a; }
.payment-status-badge.done { background: #e3f5eb; color: #22734e; }
.payment-status-badge.error { background: #fde8e9; color: #a83d45; }
.payment-edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.payment-edit-wide { grid-column: 1 / -1; }
.payment-edit-grid .mobile-edit-field input, .payment-edit-grid .mobile-edit-field select { min-height: 42px; padding: 8px 9px; }
.payment-edit-grid .mobile-edit-field textarea { min-height: 64px; }
.payment-link-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; padding: 8px 10px; border: 1px solid #bfe0e5; border-radius: 9px; background: #f4fbfc; color: var(--mobile-accent-dark); font-size: 12px; }
.payment-link-row button { min-height: 34px; padding: 0 10px; border: 1px solid #8acbd4; border-radius: 7px; background: #fff; color: var(--mobile-accent-dark); font-size: 12px; font-weight: 700; }
.payment-meta { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-top: 9px; color: var(--mobile-muted); font-size: 11px; }
.payment-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; padding-top: 10px; border-top: 1px solid #edf1f2; }
.payment-actions button { min-height: 40px; flex: 1 1 30%; padding: 0 8px; border: 1px solid #c3d8dc; border-radius: 8px; background: #fff; color: #42616a; font-size: 13px; }
.payment-actions button.primary-action { border-color: var(--mobile-accent); background: var(--mobile-accent); color: #fff; }
.payment-actions button.danger-action { border-color: #efc5c8; color: var(--mobile-danger); }
.mobile-pagination { display: flex; align-items: center; justify-content: space-between; gap: 9px; margin: 12px 0; padding: 3px 0; color: var(--mobile-muted); font-size: 12px; }
.mobile-pagination > div { display: flex; align-items: center; gap: 7px; }
.mobile-pagination button { min-height: 38px; padding: 0 11px; border: 1px solid #c3d8dc; border-radius: 8px; background: #fff; color: var(--mobile-ink); }
.mobile-pagination strong { min-width: 55px; text-align: center; }
.mobile-login-screen { display: grid; min-height: 100vh; place-items: center; padding: 22px 14px; background: radial-gradient(circle at 50% 0%, #fff 0, #edf4f6 58%); }
.mobile-login-card { width: min(100%, 390px); padding: 28px 20px 22px; border: 1px solid #d5e2e5; border-radius: 18px; background: #fff; box-shadow: 0 10px 32px rgb(21 70 81 / 12%); }
.mobile-login-logo { display: block; width: 190px; height: 82px; margin: 0 auto 3px; object-fit: contain; }
.mobile-login-card h1 { margin: 0; color: var(--mobile-ink); text-align: center; font-size: 21px; }
.mobile-login-card > p:not(.mobile-login-error) { margin: 5px 0 20px; color: var(--mobile-muted); text-align: center; font-size: 13px; }
.mobile-login-card label, .mobile-dialog-card label { display: grid; gap: 6px; margin-top: 12px; color: #5d737b; font-size: 13px; }
.mobile-login-error { min-height: 20px; margin: 12px 0 0; color: var(--mobile-danger); font-size: 12px; }
.mobile-login-button { width: 100%; margin-top: 7px; }
.mobile-toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 20; max-width: min(92vw, 430px); padding: 10px 14px; border-radius: 10px; background: rgb(13 48 59 / 94%); color: #fff; font-size: 13px; opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: opacity .2s, transform .2s; }
.mobile-toast.error { background: rgb(161 54 62 / 96%); }
.mobile-toast.visible { opacity: 1; transform: translate(-50%, 0); }
.mobile-dialog { width: min(94vw, 520px); max-height: min(92vh, 720px); padding: 0; border: 0; border-radius: 16px; background: transparent; }
.mobile-dialog::backdrop { background: rgb(13 48 59 / 52%); }
.mobile-dialog-card { padding: 17px; border: 1px solid var(--mobile-line); border-radius: 16px; background: #fff; }
.dialog-heading { align-items: center; }
.dialog-close { min-height: 38px; width: 38px; padding: 0; border: 0; background: transparent; color: #6d8389; font-size: 26px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.challenge-dialog-card { max-height: 90vh; overflow: auto; }
.mobile-challenge-stage { position: relative; width: 100%; min-height: 220px; margin-top: 12px; overflow: hidden; border: 1px solid #c4d5da; border-radius: 10px; background: #f5f8f9; touch-action: none; }
.mobile-challenge-stage img { display: block; width: 100%; height: auto; min-height: 220px; object-fit: contain; user-select: none; }
.mobile-challenge-markers { position: absolute; inset: 0; pointer-events: none; }
.mobile-challenge-marker { position: absolute; display: grid; width: 27px; height: 27px; place-items: center; border: 2px solid #fff; border-radius: 50%; background: #e55361; color: #fff; font-size: 12px; font-weight: 700; transform: translate(-50%, -50%); box-shadow: 0 1px 5px rgb(0 0 0 / 24%); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
@media (max-width: 520px) {
  .mobile-main { padding-inline: 9px; }
  .mobile-card { padding: 12px; border-radius: 12px; }
  .mobile-form-grid, .payment-edit-grid { grid-template-columns: 1fr; }
  .mobile-field-wide, .payment-edit-wide { grid-column: auto; }
  .mobile-filter-secondary { gap: 7px; }
  .mobile-filter-secondary label { min-width: 0; }
  .date-shortcuts { width: 100%; justify-content: flex-end; }
  .payment-actions button { flex-basis: calc(50% - 4px); }
  .payment-actions button:last-child:nth-child(3) { flex-basis: 100%; }
}
@media (min-width: 521px) {
  .mobile-submit { width: auto; min-width: 190px; }
}

/* iPhone-style visual polish: grouped surfaces, translucent chrome and touch-first controls. */
:root {
  --mobile-ink: #1c1c1e;
  --mobile-muted: #8e8e93;
  --mobile-line: rgba(60, 60, 67, .12);
  --mobile-bg: #f2f2f7;
  --mobile-card: #fff;
  --mobile-accent: #007aff;
  --mobile-accent-dark: #0068d8;
  --mobile-warning: #b86a00;
  --mobile-danger: #d2434d;
  --mobile-success: #198754;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", "Microsoft YaHei", sans-serif;
}
html, body {
  background: var(--mobile-bg);
  color: var(--mobile-ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
body { font-size: 15px; }
.mobile-header {
  padding-top: max(10px, env(safe-area-inset-top));
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(60, 60, 67, .12);
  background: rgba(255, 255, 255, .82);
  color: var(--mobile-ink);
  box-shadow: 0 .5px 0 rgba(60, 60, 67, .08), 0 8px 26px rgba(60, 60, 67, .06);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
}
.mobile-brand img { width: 40px; height: 40px; }
.mobile-brand strong { font-size: 17px; letter-spacing: -.01em; }
.mobile-brand span { color: #8e8e93; }
.mobile-user-badge {
  max-width: 124px;
  padding: 6px 9px;
  border-radius: 999px;
  background: #f2f2f7;
  color: #6e6e73;
}
.icon-button {
  width: 40px;
  min-height: 40px;
  border: 0;
  border-radius: 12px;
  background: #f2f2f7;
  color: #1c1c1e;
  font-size: 21px;
  transition: transform .15s ease, background .15s ease;
}
.icon-button:active { background: #e5e5ea; transform: scale(.94); }
.mobile-main { width: min(100%, 720px); padding: 16px 12px calc(32px + env(safe-area-inset-bottom)); }
.mobile-card {
  margin-bottom: 13px;
  padding: 16px;
  border: 0;
  border-radius: 20px;
  background: var(--mobile-card);
  box-shadow: 0 1px 2px rgba(60, 60, 67, .06), 0 8px 22px rgba(60, 60, 67, .045);
}
.mobile-create-card { padding: 18px 16px 16px; }
.section-heading h1, .dialog-heading h2 { font-size: 21px; letter-spacing: -.025em; }
.section-heading p, .dialog-hint { color: #8e8e93; }
.mobile-form { margin-top: 17px; }
.mobile-form-grid { gap: 12px 10px; }
.mobile-form label, .mobile-filter-row label, .mobile-edit-field { color: #8e8e93; font-size: 12px; font-weight: 600; }
input, select, textarea {
  border: 0;
  border-radius: 12px;
  background: #f2f2f7;
  color: #1c1c1e;
  font-size: 16px;
  padding: 10px 12px;
  box-shadow: inset 0 0 0 1px rgba(60, 60, 67, .035);
  transition: background .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: #aeaeb2; }
input:focus, select:focus, textarea:focus {
  border-color: transparent;
  background: #fff;
  box-shadow: inset 0 0 0 2px rgba(0, 122, 255, .52), 0 2px 8px rgba(0, 122, 255, .08);
}
.primary {
  min-height: 46px;
  border: 0;
  border-radius: 13px;
  background: var(--mobile-accent);
  box-shadow: 0 5px 12px rgba(0, 122, 255, .2);
  letter-spacing: .01em;
  transition: transform .15s ease, background .15s ease;
}
.primary:active { background: var(--mobile-accent-dark); transform: scale(.985); }
.secondary { border: 0; border-radius: 12px; background: #f2f2f7; color: #1c1c1e; }
.text-button { border-radius: 10px; color: var(--mobile-accent); }
.text-button:active { background: #e5f1ff; }
.mobile-submit { min-height: 48px; }
.automation-card {
  border: 1px solid rgba(60, 60, 67, .08);
  background: rgba(255, 255, 255, .76);
  box-shadow: none;
}
.automation-main { color: #636366; }
.automation-card.is-running .automation-dot { background: var(--mobile-accent); box-shadow: 0 0 0 5px rgba(0, 122, 255, .12); }
.small-button { border: 0; border-radius: 10px; background: #eaf3ff; color: #0068d8; font-weight: 600; }
.mobile-filter-card { padding: 2px 0 8px; background: transparent; box-shadow: none; }
.mobile-filter-row + .mobile-filter-row { margin-top: 10px; }
.mobile-search input, .filter-chip { background: #fff; box-shadow: 0 1px 2px rgba(60, 60, 67, .06); }
.filter-chip { border: 0; color: #636366; font-weight: 600; }
.filter-chip.active { background: var(--mobile-accent); color: #fff; box-shadow: 0 4px 12px rgba(0, 122, 255, .2); }
.mobile-summary { color: #8e8e93; }
.payment-empty {
  padding: 36px 16px;
  border: 1px dashed #c7c7cc;
  border-radius: 18px;
  background: rgba(255, 255, 255, .7);
  color: #8e8e93;
}
.payment-card {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border: 0;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(60, 60, 67, .07), 0 8px 20px rgba(60, 60, 67, .05);
}
.payment-card::before {
  position: absolute;
  inset: 17px auto 17px 0;
  width: 4px;
  border-radius: 0 5px 5px 0;
  background: var(--mobile-accent);
  content: "";
}
.payment-card.status-done::before { background: var(--mobile-success); }
.payment-card.status-error::before { background: var(--mobile-danger); }
.payment-card.status-pending::before { background: #ff9f0a; }
.payment-card.status-done, .payment-card.status-error, .payment-card.status-pending { border-left: 0; }
.payment-card-title strong { font-size: 16px; letter-spacing: -.01em; }
.payment-card-title small { color: #8e8e93; }
.payment-status-badge { padding: 6px 9px; background: #f2f2f7; color: #636366; font-weight: 600; }
.payment-status-badge.pending { background: #fff4df; color: #9a5e00; }
.payment-status-badge.progress { background: #e7f2ff; color: #0068d8; }
.payment-status-badge.done { background: #e5f8ec; color: #18794e; }
.payment-status-badge.error { background: #ffeaec; color: #b22c39; }
.payment-edit-grid { gap: 10px; }
.payment-edit-grid .mobile-edit-field input, .payment-edit-grid .mobile-edit-field select, .payment-edit-grid .mobile-edit-field textarea { background: #f2f2f7; }
.payment-meta { color: #8e8e93; }
.payment-actions { border-top-color: #f2f2f7; }
.payment-actions button {
  min-height: 42px;
  border: 0;
  border-radius: 11px;
  background: #f2f2f7;
  color: #3a3a3c;
  font-weight: 600;
  transition: transform .15s ease, background .15s ease;
}
.payment-actions button:active { background: #e5e5ea; transform: scale(.98); }
.payment-actions button.primary-action { background: var(--mobile-accent); box-shadow: 0 4px 10px rgba(0, 122, 255, .17); }
.payment-actions button.danger-action { background: #fff0f1; color: #b22c39; }
.mobile-pagination { color: #8e8e93; }
.mobile-pagination button { border: 0; border-radius: 11px; background: #fff; box-shadow: 0 1px 2px rgba(60, 60, 67, .06); font-weight: 600; }
.mobile-login-screen { background: #f2f2f7; }
.mobile-login-card {
  padding: 30px 20px 22px;
  border: 0;
  border-radius: 24px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 16px 40px rgba(60, 60, 67, .13);
}
.mobile-login-card h1 { letter-spacing: -.025em; }
.mobile-login-card > p:not(.mobile-login-error) { color: #8e8e93; }
.mobile-dialog { border-radius: 22px; }
.mobile-dialog-card { border: 0; border-radius: 22px; box-shadow: 0 14px 40px rgba(0, 0, 0, .15); }
.dialog-close { border-radius: 50%; background: #f2f2f7; color: #636366; font-size: 22px; }
.mobile-xt-card { background: rgba(255, 255, 255, .86); }
.mobile-xt-list { max-height: 340px; }
.mobile-xt-option { border: 0; border-radius: 14px; background: #f2f2f7; box-shadow: inset 0 0 0 1px rgba(60, 60, 67, .035); }
.mobile-xt-option:active { background: #e5f1ff; }
.mobile-xt-option-actions button { border-color: rgba(0, 122, 255, .18); background: #fff; color: var(--mobile-accent); }
.mobile-xt-option-actions .mobile-xt-delete-action { border-color: rgba(180, 75, 75, .22); color: #b44b4b; }
.mobile-toast { border-radius: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
@media (max-width: 520px) {
  .mobile-main { padding-top: 12px; }
  .mobile-card { border-radius: 18px; }
  .payment-card { border-radius: 18px; }
  .section-heading h1 { font-size: 20px; }
}
