.membership-codes-admin,.membership-redeem{color:var(--ink);min-width:0}
.membership-redeem{max-width:1080px;margin:auto}
.code-toolbar,.code-heading,.code-actions,.code-generated,.code-selection,.code-active-batch{display:flex;align-items:center;flex-wrap:wrap;gap:10px}
.code-toolbar{justify-content:space-between;margin-bottom:20px}
.code-heading{justify-content:space-between;margin-bottom:18px}
.code-heading h2,.code-heading h3{margin:0;font-weight:600;letter-spacing:-.02em;font-size:20px}
.code-heading h3{font-size:16px}
.code-heading p,.code-help{color:var(--muted);font-size:13px;line-height:1.7;max-width:72ch;margin:8px 0 0}
.code-total,.code-pagination{color:var(--muted);font-size:13px;font-variant-numeric:tabular-nums}
.code-actions .btn,.membership-codes-admin .btn,.code-own-history .btn{min-height:36px;font-size:12px;gap:6px}
.code-create{background:var(--surface);border-radius:16px;padding:22px;margin:0 0 22px}
.code-create fieldset,.code-redeem-form fieldset{border:0;margin:0;padding:0;min-width:0}
.code-form-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
.code-create .field,.code-filters .field,.code-redeem-form .field{margin:0;min-width:0}
.code-create .field>span,.code-filters .field>span,.code-redeem-form .field>span{font-size:12px;font-weight:500}
.code-create .field input,.code-create .field select,.code-filters .field input,.code-filters .field select{width:100%;min-width:0;min-height:40px;font-size:13px}
.code-create .code-actions{margin-top:14px}
.code-error{color:var(--danger,#c53541);font-size:13px;line-height:1.65;margin:10px 0}
.code-error:empty{display:none}
.code-generated{justify-content:space-between;padding:12px 16px;background:var(--hover);border-radius:12px;margin-bottom:18px;font-size:13px}
.code-generated>span{display:flex;align-items:center;gap:8px}
.code-filters{display:flex;align-items:flex-end;flex-wrap:wrap;gap:12px;margin-bottom:16px}
.code-filters .field{flex:0 1 155px}
.code-filters .code-search{flex:1 1 240px;max-width:420px}
.code-filters .code-actions{padding-bottom:2px}
.code-active-batch{font-size:12px;color:var(--muted);margin-bottom:12px}
.code-selection{font-size:12px;margin:14px 0}
.code-selection label{display:flex;align-items:center;gap:8px;margin-right:8px;cursor:pointer}
.code-selection input,.code-table input[type=checkbox]{width:16px;height:16px;min-width:16px;min-height:16px;margin:0;padding:0}
.code-table{width:100%;overflow:auto;border-radius:12px;background:var(--surface)}
.code-table table{width:100%;border-collapse:collapse;font-size:13px;text-align:left}
.membership-codes-admin .code-table table{min-width:920px}
.code-table th{font-size:12px;font-weight:500;color:var(--muted);padding:13px 15px;background:var(--hover);white-space:nowrap;border:0}
.code-table td{padding:14px 15px;vertical-align:middle;line-height:1.55;border:0;border-bottom:1px solid color-mix(in srgb,var(--ink) 5%,transparent);font-variant-numeric:tabular-nums}
.code-table tr:last-child td{border-bottom:0}
.code-table tbody tr:hover{background:color-mix(in srgb,var(--ink) 2%,transparent)}
.code-table strong{font-size:13px;font-weight:550}
.code-table code{display:block;padding:0;background:transparent;color:var(--ink);font-size:12px;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;white-space:nowrap}
.code-copy{display:flex;align-items:center;gap:7px;padding:5px 0;border:0;border-radius:4px;background:transparent;color:var(--muted);cursor:pointer;text-align:left}
.code-copy:hover{color:var(--ink)}
.code-secondary{display:block;margin-top:4px;font-size:12px;color:var(--muted);max-width:260px;overflow-wrap:anywhere}
.code-note{max-width:220px;min-width:110px;overflow-wrap:anywhere}
.code-state{display:inline-flex;align-items:center;padding:4px 9px;border-radius:7px;background:var(--hover);color:var(--muted);font-size:12px;white-space:nowrap}
.code-state--unused{color:var(--ink);background:color-mix(in srgb,var(--ink) 8%,transparent)}
.code-state--redeemed{color:light-dark(#207052,#83c7ab);background:light-dark(#edf6f1,#21352e)}
.code-pagination{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:10px;padding:18px 0}
.code-empty{padding:38px 18px;text-align:center;color:var(--muted);font-size:13px}
.code-empty strong{color:var(--ink);font-weight:500}
.code-empty p{margin:8px 0 0}
.code-redeem-form{max-width:740px;padding:24px;background:var(--surface);border-radius:16px}
.code-redeem-form fieldset{display:flex;align-items:flex-end;gap:12px}
.code-redeem-form .field{flex:1}
.code-redeem-form input{width:100%;min-height:46px;font-size:15px;letter-spacing:.03em;font-family:ui-monospace,SFMono-Regular,Consolas,monospace}
.code-redeem-form [type=submit]{min-height:46px;white-space:nowrap}
.code-redeem-form .code-help{font-size:12px;margin-top:14px}
.code-success{display:flex;gap:12px;align-items:flex-start;margin:18px 0;padding:18px 22px;border-radius:14px;background:var(--hover);max-width:740px}
.code-success>svg{flex-shrink:0;margin-top:2px}
.code-success strong{font-size:15px;font-weight:600}
.code-success p{font-size:13px;color:var(--muted);margin:6px 0;line-height:1.7}
.code-success a{font-size:13px;text-underline-offset:4px;color:var(--ink)}
.code-own-history{margin-top:38px}
.code-own-history .code-table{min-width:0}
.code-own-history .code-table table{min-width:640px}
.membership-codes-admin [hidden],.membership-redeem [hidden]{display:none!important}
@media(max-width:1000px){.code-form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){.code-form-grid{grid-template-columns:minmax(0,1fr)}.code-create{padding:18px}.code-filters .field{flex:1 1 135px}.code-filters .code-search{flex-basis:100%;max-width:none}.code-redeem-form{padding:18px}.code-redeem-form fieldset{flex-wrap:wrap}.code-redeem-form .field{flex-basis:100%}.code-redeem-form [type=submit]{width:100%}.code-generated{align-items:flex-start}.code-heading h2{font-size:18px}.code-toolbar{align-items:flex-start}.code-table td,.code-table th{padding:12px}.code-own-history{margin-top:28px}}
@media(max-width:600px){.code-own-history .code-table table{min-width:0}.code-own-history thead{display:none}.code-own-history tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;padding:16px}.code-own-history td{border:0;padding:0;font-size:12px;overflow-wrap:anywhere}.code-own-history td:first-child,.code-own-history td:nth-child(2){grid-column:1/-1}.code-own-history td:nth-child(2){color:var(--muted)}.code-own-history td:nth-child(3)::before,.code-own-history td:nth-child(4)::before{display:block;color:var(--muted);font-size:11px;margin-bottom:5px}.code-own-history td:nth-child(3)::before{content:'兑换时间'}.code-own-history td:nth-child(4)::before{content:'会员到期'}.code-own-history .code-table code{white-space:normal;overflow-wrap:anywhere;margin-top:6px;font-size:11px}.code-own-history tr+tr{border-top:1px solid var(--line)}}

/* Batch results keep every issued code together, independently of pagination. */
body.admin-mode dialog.code-result-dialog {width:min(620px,calc(100vw - 32px));padding:24px;max-height:calc(100dvh - 32px);overflow:hidden}
body.admin-mode dialog.code-result-dialog[open] {display:flex;flex-direction:column}
body.admin-mode dialog.code-result-dialog .dialog-head {flex:none;margin-bottom:16px;gap:16px}
body.admin-mode dialog.code-result-dialog .dialog-head h2 {display:flex;align-items:center;gap:10px;margin:0;font-size:20px;line-height:1.5}
.code-result-success {display:inline-flex;align-items:center;justify-content:center;flex:none;width:30px;height:30px;border-radius:50%;color:var(--success,var(--accent));background:var(--success-soft,var(--hover))}
body.admin-mode dialog.code-result-dialog .code-result-summary {flex:none;margin:0 0 14px;color:var(--muted);font-size:13px;line-height:1.7}
body.admin-mode dialog.code-result-dialog .code-result-summary strong {color:var(--ink);font-weight:600;font-variant-numeric:tabular-nums}
body.admin-mode dialog.code-result-dialog .code-result-list {display:block;flex:0 1 auto;width:100%;min-height:90px;max-height:45dvh;padding:14px 16px;border:0;border-radius:12px;background:var(--surface);color:var(--ink);font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:14px;line-height:1.9;resize:none;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--line-strong) transparent}
body.admin-mode dialog.code-result-dialog .code-result-status {flex:none;min-height:20px;margin:10px 0 0;font-size:12px;line-height:1.6;color:var(--muted);overflow-wrap:anywhere}
body.admin-mode dialog.code-result-dialog .code-result-status.is-error {color:var(--danger)}
body.admin-mode dialog.code-result-dialog .code-result-actions {display:flex;flex:none;justify-content:flex-end;flex-wrap:wrap;gap:8px;margin-top:12px}
body.admin-mode dialog.code-result-dialog .code-result-actions .btn {min-height:40px}
@media(max-width:600px) {
 body.admin-mode dialog.code-result-dialog {padding:20px 18px max(20px,env(safe-area-inset-bottom))}
 body.admin-mode dialog.code-result-dialog .dialog-head h2 {font-size:18px}
 body.admin-mode dialog.code-result-dialog .code-result-list {padding:12px;font-size:13px}
 body.admin-mode dialog.code-result-dialog .code-result-actions .btn {min-height:44px}
}
