:root {
    --primary: #1677ff;
    --primary-dark: #0958d9;
    --bg: #f5f7fa;
    --card: #ffffff;
    --text: #1f2329;
    --muted: #8a919f;
    --border: #e5e6eb;
    --danger: #ff4d4f;
    --radius: 14px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
    padding: 16px 16px calc(88px + var(--safe-bottom));
}

body.has-tab-nav {
    padding-bottom: calc(56px + var(--safe-bottom));
}

body.has-tab-nav.has-pay-bar {
    padding-bottom: calc(144px + var(--safe-bottom));
}

.page {
    max-width: 480px;
    margin: 0 auto;
}

.header {
    padding: 8px 4px 20px;
}

.header h1 {
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 700;
}

.header p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.section-title {
    margin: 16px 0 12px;
    font-size: 15px;
    font-weight: 600;
}

.section-title:first-child {
    margin-top: 0;
}

.channel-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 4px;
}

.channel-tab {
    flex: 1;
    appearance: none;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    border-radius: 12px;
    min-height: 44px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.channel-tab.active {
    border-color: var(--primary);
    background: rgba(22, 119, 255, 0.08);
    color: var(--primary);
}

.channel-tab[data-channel="wechat"].active {
    border-color: #07c160;
    background: rgba(7, 193, 96, 0.1);
    color: #07c160;
}

.staff-panel {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
}

.openid-row {
    margin: 8px 0 12px;
}

.openid-code {
    display: block;
    margin-top: 6px;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 10px;
    font-size: 12px;
    word-break: break-all;
}

.oauth-btn {
    display: inline-block;
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(7, 193, 96, 0.12);
    color: #078a4a;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    line-height: 1.5;
    margin: 8px 0;
}

.checkbox-row input {
    margin-top: 3px;
}

.success {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(82, 196, 26, 0.1);
    color: #389e0d;
    font-size: 13px;
}

.merchant-select-wrap {
    margin-bottom: 4px;
}

.merchant-select {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0 14px;
    font-size: 16px;
    background: #fff;
    color: var(--text);
    outline: none;
}

.merchant-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.12);
}

.amount-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

.amount-btn {
    appearance: none;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    border-radius: 12px;
    min-height: 52px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.amount-btn.active {
    border-color: var(--primary);
    background: rgba(22, 119, 255, 0.08);
    color: var(--primary);
}

.input-wrap {
    margin-bottom: 8px;
}

.input-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--muted);
}

.amount-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    min-height: 52px;
    padding: 0 14px;
    font-size: 20px;
    font-weight: 600;
    outline: none;
}

.amount-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.12);
}

.hint {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
}

.error {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 77, 79, 0.08);
    color: var(--danger);
    font-size: 13px;
    line-height: 1.5;
}

.tab-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    max-width: 480px;
    margin: 0 auto;
    background: #fff;
    border-top: 1px solid var(--border);
    padding-bottom: var(--safe-bottom);
}

.tab-nav-item {
    flex: 1;
    text-align: center;
    padding: 10px 0 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
}

.tab-nav-item.active {
    color: var(--primary);
}

.pay-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    padding: 12px 16px calc(12px + var(--safe-bottom));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

.pay-bar-inner {
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.pay-summary {
    flex: 1;
    min-width: 0;
}

.pay-summary .label {
    font-size: 12px;
    color: var(--muted);
}

.pay-summary .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.pay-btn {
    appearance: none;
    border: 0;
    border-radius: 999px;
    min-width: 132px;
    min-height: 48px;
    padding: 0 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.pay-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.pay-bar.above-tab-nav {
    bottom: calc(56px + var(--safe-bottom));
}

.list-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.list-item {
    padding: 12px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
}

.list-item-title {
    font-size: 13px;
    font-weight: 600;
    word-break: break-all;
}

.list-item-meta {
    margin-top: 6px;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.5;
}

.list-item-err {
    margin-top: 6px;
    font-size: 12px;
    color: var(--danger);
    word-break: break-all;
}

.list-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.mini-btn {
    flex: 1;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 8px;
    padding: 8px;
    font-size: 13px;
    cursor: pointer;
}

.mini-btn.primary {
    border-color: var(--primary);
    color: var(--primary);
}

.tag-ok {
    color: #52c41a;
    font-size: 12px;
    font-weight: 500;
}

.tag-fail {
    color: var(--danger);
    font-size: 12px;
    font-weight: 500;
}

.share-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0));
}

.share-modal[hidden] {
    display: none;
}

.share-modal-inner {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 12px 12px 12px 12px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.share-modal-inner--tall {
    max-height: min(85vh, 640px);
    display: flex;
    flex-direction: column;
}

.share-receiver-rows {
    overflow-y: auto;
    flex: 1;
    min-height: 120px;
    max-height: 42vh;
    margin: 0 -4px;
    padding: 0 4px;
}

.share-receiver-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.share-receiver-row:last-child {
    border-bottom: none;
}

.share-staff-cb {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.share-staff-name {
    flex: 1;
    font-size: 15px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.share-amount-input {
    width: 96px;
    flex-shrink: 0;
    margin: 0 !important;
    padding: 8px 10px !important;
    font-size: 16px;
    text-align: right;
}

.share-total-line {
    margin-top: 10px;
    text-align: right;
}

.mine-form .input-label {
    margin-top: 10px;
}

.result-card {
    text-align: center;
    padding: 32px 20px;
}

.result-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
}

.result-icon.success {
    background: rgba(82, 196, 26, 0.12);
    color: #52c41a;
}

.result-icon.pending {
    background: rgba(22, 119, 255, 0.12);
    color: var(--primary);
}

.result-icon.fail {
    background: rgba(255, 77, 79, 0.12);
    color: var(--danger);
}

.result-title {
    margin: 0 0 8px;
    font-size: 22px;
}

.result-desc {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.meta {
    text-align: left;
    background: #f8fafc;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.8;
    word-break: break-all;
}

.back-link {
    display: inline-block;
    margin-top: 20px;
    color: var(--primary);
    text-decoration: none;
    font-size: 15px;
}
