:root {
  color-scheme: light;
  --bg: #f4f7fc;
  --surface: #ffffff;
  --surface-soft: #f7f9fd;
  --surface-tint: #f2f5ff;
  --border: #e3e8f2;
  --border-strong: #d5ddef;
  --text: #172033;
  --muted: #748096;
  --muted-2: #9aa5b7;
  --violet: #635bdf;
  --violet-2: #9a56dd;
  --cyan: #0ea5c8;
  --green: #12a878;
  --orange: #e98b2a;
  --red: #dc4e64;
  --shadow: 0 24px 70px rgba(63, 79, 115, .16);
  --shadow-soft: 0 10px 30px rgba(51, 65, 96, .08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; color: var(--text); background: var(--bg); }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { width: 1em; height: 1em; stroke-width: 2; }
.is-hidden { display: none !important; }
.eyebrow { color: #6978ca; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.align-right { text-align: right !important; }

.btn {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 750;
  color: var(--text);
  background: var(--surface);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, opacity .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { cursor: wait; opacity: .65; transform: none; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-primary { color: #fff; background: linear-gradient(110deg, #5569df 0%, #765bdf 58%, #a252dc 100%); box-shadow: 0 11px 24px rgba(99, 91, 223, .22); }
.btn-secondary { color: #555fcd; border-color: #dce1fb; background: #f7f8ff; }
.btn-danger { color: var(--red); border-color: #f5cdd5; background: #fff7f8; }
.btn-large { min-height: 54px; font-size: 16px; }
.icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  display: inline-grid;
  place-items: center;
  color: #647087;
  background: #fff;
}
.text-button { border: 0; background: transparent; color: var(--violet); font-weight: 750; display: inline-flex; gap: 6px; align-items: center; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  color: var(--text);
  background: #fff;
  outline: 0;
  transition: border-color .18s ease, box-shadow .18s ease;
}
input, select { min-height: 44px; padding: 0 13px; }
textarea { padding: 12px 13px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #8b91ed; box-shadow: 0 0 0 3px rgba(99, 91, 223, .11); }
label { font-size: 13px; font-weight: 750; color: #556076; }
.input-with-icon, .search-field { position: relative; }
.input-with-icon > svg, .input-with-icon > i, .search-field > svg, .search-field > i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: #8a95aa; pointer-events: none; }
.input-with-icon input { padding-left: 45px; }
.search-field input { padding-left: 39px; }
.search-field { flex: 1 1 320px; max-width: 460px; }
.search-field .search-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border: 0; border-radius: 6px; display: grid; place-items: center; color: #8a95aa; background: transparent; cursor: pointer; padding: 0; }
.search-field .search-clear:hover { color: #303b50; background: #edf0f5; }
.search-field .search-clear svg, .search-field .search-clear i { position: static; transform: none; color: inherit; pointer-events: none; }

.toast {
  position: fixed;
  z-index: 200;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 18px);
  max-width: min(92vw, 520px);
  padding: 12px 18px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 7px;
  color: #fff;
  background: #182034;
  box-shadow: 0 18px 50px rgba(19, 27, 44, .25);
  opacity: 0;
  pointer-events: none;
  transition: .22s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #b63a50; }
.toast.success { background: #087b5d; }

/* Redeem */
.redeem-body {
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(225, 229, 255, .8), rgba(244, 248, 255, .94) 48%, rgba(220, 244, 250, .78)),
    #eef4fc;
  overflow-x: hidden;
}
.ambient-grid { position: fixed; inset: 0; pointer-events: none; opacity: .32; background-image: linear-gradient(rgba(102, 118, 162, .04) 1px, transparent 1px), linear-gradient(90deg, rgba(102, 118, 162, .04) 1px, transparent 1px); background-size: 42px 42px; mask-image: linear-gradient(to bottom, black, transparent 72%); }
.redeem-page { position: relative; width: min(1440px, calc(100% - 48px)); min-height: 100vh; margin: 0 auto; padding: clamp(58px, 9vh, 112px) 0 32px; }
.redeem-header { display: flex; align-items: center; justify-content: space-between; margin: 0 12px 32px; }
.brand-lockup, .admin-brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 52px; height: 52px; flex: 0 0 auto; border-radius: 15px; display: grid; place-items: center; color: #fff; font-size: 26px; background: linear-gradient(140deg, #5668df, #a452db); box-shadow: 0 12px 28px rgba(104, 84, 220, .24); }
.brand-lockup strong { display: block; color: transparent; background: linear-gradient(105deg, #5263d8, #ad4cda); background-clip: text; font-size: clamp(26px, 2.5vw, 37px); line-height: 1.16; font-weight: 900; }
.brand-lockup small { display: block; color: #798398; margin-top: 5px; font-size: 14px; }
.online-pill, .live-chip { display: inline-flex; align-items: center; gap: 9px; padding: 9px 14px; border: 1px solid rgba(255,255,255,.82); border-radius: 999px; color: #667186; background: rgba(255,255,255,.78); box-shadow: var(--shadow-soft); font-size: 13px; }
.online-pill span, .live-chip span, .system-state > span { width: 9px; height: 9px; border-radius: 50%; background: #16ae7a; box-shadow: 0 0 0 5px rgba(22, 174, 122, .1); }
.redeem-shell { min-height: 690px; padding: 34px; border: 1px solid rgba(255,255,255,.9); border-radius: 26px; display: grid; grid-template-columns: minmax(330px, 405px) minmax(0, 1fr); gap: 34px; background: rgba(255,255,255,.93); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.redeem-form-panel { padding: 18px 10px 12px; }
.section-title-row { display: flex; align-items: center; gap: 14px; }
.section-title-row h1 { margin: 0 0 5px; font-size: 23px; }
.section-title-row p { margin: 0; color: var(--muted); font-size: 13px; }
.soft-icon { width: 46px; height: 46px; flex: 0 0 auto; border: 1px solid #dbe0ff; border-radius: 13px; display: grid; place-items: center; color: #6070e2; background: #f0f2ff; font-size: 22px; }
.notice-line { min-height: 52px; margin: 30px 0; padding: 0 15px; border: 1px solid #e6e9f1; border-radius: 10px; display: flex; align-items: center; gap: 11px; color: #747f92; background: #f7f8fb; font-size: 13px; }
.redeem-form { display: grid; gap: 12px; }
.redeem-form .input-with-icon input { height: 56px; font-size: 15px; border-color: #ced6fb; }
.redeem-form .btn { margin-top: 10px; width: 100%; }
.redeem-progress { margin-top: 2px; padding: 12px 14px; border: 1px solid #dfe3f5; border-radius: 10px; display: grid; gap: 8px; background: #f7f8ff; }
.redeem-progress-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #667187; font-size: 11px; }
.redeem-progress-head strong { color: #5f5bd6; font-size: 12px; }
.redeem-progress-track { height: 8px; overflow: hidden; border-radius: 99px; background: #e6e8f3; }
.redeem-progress-track span { width: 0; height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, #5b6ce1, #a34dde); transition: width .2s ease; }
.redeem-progress small { min-height: 16px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.redeem-progress.has-error { border-color: #efd2d8; background: #fff5f6; }
.redeem-progress.has-error .redeem-progress-head strong, .redeem-progress.has-error .redeem-progress-head { color: var(--red); }
.redeem-progress.has-error .redeem-progress-track span { background: var(--red); }
.trust-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 24px; margin: 22px 0 30px; color: #7d88a0; font-size: 12px; }
.trust-row span { display: inline-flex; align-items: center; gap: 7px; }
.trust-row svg { color: #7180e7; }
.verify-setting { padding: 22px 4px 17px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.verify-setting strong { display: block; font-size: 14px; }
.verify-setting p, .setting-note { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.setting-note { padding: 12px 4px 0; }
.switch { position: relative; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { width: 54px; height: 30px; border-radius: 18px; display: block; background: #cbd2df; box-shadow: inset 0 1px 3px rgba(25, 35, 55, .15); transition: .2s ease; }
.switch span::after { content: ""; width: 24px; height: 24px; position: absolute; top: 3px; left: 3px; border-radius: 50%; background: #fff; box-shadow: 0 2px 7px rgba(30, 39, 62, .25); transition: .2s ease; }
.switch input:checked + span { background: #625edf; }
.switch input:checked + span::after { transform: translateX(24px); }
.credential-console { min-width: 0; padding: 28px; border: 1px solid #e2e6f2; border-radius: 20px; background: linear-gradient(145deg, #f7f9fe, #f0f5fc); }
.console-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 20px; }
.console-heading h2 { margin: 7px 0 0; font-size: 22px; }
.format-pill { flex: 0 0 auto; padding: 7px 13px; border: 1px solid #dbe1ff; border-radius: 999px; color: #6170d3; background: #f0f2ff; font-size: 12px; font-weight: 800; }
.console-stage { min-height: 525px; border: 1px dashed #d8dfef; border-radius: 16px; display: flex; align-items: stretch; justify-content: center; background: rgba(255,255,255,.58); overflow: hidden; }
.empty-console { margin: auto; text-align: center; color: var(--muted); }
.empty-icon { width: 68px; height: 68px; margin: 0 auto 17px; border: 1px solid #dfe4ff; border-radius: 20px; display: grid; place-items: center; color: #7a85dc; background: #f1f3ff; font-size: 31px; }
.empty-console strong { display: block; color: #5d687e; font-size: 16px; }
.empty-console p { margin: 8px 0; color: #9aa5b7; font-size: 13px; }
.result-view { width: 100%; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.result-view-compact { justify-content: center; }
.success-line { min-height: 48px; padding: 0 15px; border: 1px solid #bee9d8; border-radius: 10px; display: flex; align-items: center; justify-content: space-between; color: #147558; background: #ebfaf4; font-size: 13px; }
.success-line > span { display: flex; align-items: center; gap: 8px; }
.success-line i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.package-hero { padding: 22px; border: 1px solid #dfe4f1; border-radius: 16px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; background: #fff; box-shadow: var(--shadow-soft); }
.package-icon { width: 62px; height: 62px; border-radius: 16px; display: grid; place-items: center; color: #fff; background: #655cdf; box-shadow: 0 10px 24px rgba(99, 91, 223, .24); font-size: 28px; }
.package-copy .eyebrow { font-size: 9px; }
.package-copy h3 { margin: 5px 0; font-size: 18px; }
.package-copy p { margin: 0; color: var(--muted); font-size: 12px; }
.json-tile { width: 112px; min-height: 110px; border-radius: 15px; padding: 17px; color: #fff; background: linear-gradient(145deg, #5866dd, #9754d9); display: flex; flex-direction: column; justify-content: center; }
.json-tile small { font-size: 8px; font-weight: 800; opacity: .75; }
.json-tile strong { margin: 6px 0; font-size: 25px; }
.json-tile span { width: max-content; padding: 4px 7px; border-radius: 6px; background: rgba(255,255,255,.17); font-size: 8px; }
.credential-list { display: grid; gap: 10px; max-height: 270px; overflow-y: auto; padding-right: 4px; }
.credential-item { padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.credential-item-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 11px; }
.credential-item-head strong { min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.credential-item-head span { flex: 0 0 auto; color: var(--green); font-size: 11px; font-weight: 800; }
.credential-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.credential-field { min-width: 0; padding: 9px 10px; border-radius: 7px; background: #f7f8fc; }
.credential-field small { display: block; margin-bottom: 4px; color: var(--muted-2); font-size: 9px; text-transform: uppercase; }
.credential-field code { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #4d5770; font-size: 11px; }
.snapshot-ready { min-height: 150px; padding: 24px; border: 1px solid #dfe4f1; border-radius: 14px; display: flex; align-items: center; justify-content: center; gap: 16px; color: #43506a; background: #fff; text-align: left; }
.snapshot-ready-icon { width: 58px; height: 58px; flex: 0 0 auto; border-radius: 16px; display: grid; place-items: center; color: #fff; background: #18aa7b; box-shadow: 0 10px 24px rgba(24,170,123,.2); }
.snapshot-ready-icon svg { width: 29px; height: 29px; }
.snapshot-ready strong { display: block; font-size: 18px; }
.snapshot-ready p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.result-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.summary-cell { min-width: 0; padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: #fff; }
.summary-cell small { display: block; color: var(--muted-2); font-size: 10px; }
.summary-cell strong { display: block; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: auto; }
.result-actions-download { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.result-actions .btn { padding: 0 10px; }
.download-status { padding: 12px 14px; border: 1px solid #dfe3f5; border-radius: 10px; display: grid; gap: 8px; background: #f7f8ff; }
.download-status-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #667187; font-size: 11px; }
.download-status-head strong { color: #5f5bd6; font-size: 12px; }
.download-status-track { height: 8px; overflow: hidden; border-radius: 99px; background: #e6e8f3; }
.download-status-track span { width: 0; height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, #5b6ce1, #a34dde); transition: width .2s ease; }
.download-status small { color: var(--muted); font-size: 10px; }
.download-status.is-complete { border-color: #bee9d8; background: #ebfaf4; }
.download-status.is-complete .download-status-head, .download-status.is-complete .download-status-head strong { color: #147558; }
.download-status.is-complete .download-status-track span { background: #18aa7b; }
.download-status.has-error { border-color: #efd2d8; background: #fff5f6; }
.download-status.has-error .download-status-head, .download-status.has-error .download-status-head strong { color: var(--red); }
.download-status.has-error .download-status-track span { background: var(--red); }
.redeem-footer { display: flex; justify-content: space-between; padding: 18px 12px 0; color: rgba(100, 111, 134, .7); font-size: 11px; }

/* Admin */
.admin-body { min-height: 100vh; background: #f4f6fa; }
.login-view { min-height: 100vh; padding: 24px; display: grid; place-items: center; background: linear-gradient(135deg, #111827 0 50%, #18243a 50%); }
.login-panel { width: min(420px, 100%); padding: 38px; border: 1px solid rgba(255,255,255,.09); border-radius: 8px; color: #fff; background: rgba(27, 36, 55, .92); box-shadow: 0 28px 80px rgba(0,0,0,.34); }
.login-mark { width: 56px; height: 56px; margin-bottom: 28px; }
.login-panel h1 { margin: 8px 0; font-size: 29px; }
.login-panel > p { margin: 0 0 28px; color: #9eabc1; line-height: 1.65; font-size: 13px; }
.login-panel label { display: block; color: #c8d0de; margin-bottom: 9px; }
.login-panel .dark-input input { border-color: #36425a; color: #fff; background: #151e30; }
.login-panel .dark-input + label { margin-top: 16px; }
.login-panel .btn { width: 100%; margin-top: 16px; }
.login-back { margin-top: 20px; display: flex; justify-content: center; align-items: center; gap: 7px; color: #91a0b8; font-size: 12px; }
.admin-app { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { position: sticky; z-index: 40; top: 0; height: 100vh; padding: 22px 16px; display: flex; flex-direction: column; color: #d7dfec; background: #151d2c; }
.admin-brand { padding: 0 9px 24px; border-bottom: 1px solid rgba(255,255,255,.07); }
.admin-brand .brand-mark { width: 41px; height: 41px; border-radius: 11px; font-size: 20px; }
.admin-brand strong, .admin-brand small { display: block; }
.admin-brand strong { color: #fff; font-size: 17px; }
.admin-brand small { margin-top: 3px; color: #7f8ba1; font-size: 10px; }
.admin-nav { display: grid; gap: 5px; margin-top: 24px; }
.nav-item { width: 100%; min-height: 46px; padding: 0 12px; border: 0; border-radius: 7px; display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 10px; text-align: left; color: #9da9bd; background: transparent; }
.nav-item:hover { color: #e2e7f0; background: rgba(255,255,255,.045); }
.nav-item.active { color: #fff; background: #5f5bd6; box-shadow: 0 8px 24px rgba(80, 73, 196, .25); }
.nav-item b { min-width: 23px; padding: 3px 6px; border-radius: 10px; text-align: center; color: #aeb8ca; background: rgba(255,255,255,.08); font-size: 9px; }
.nav-item.active b { color: #fff; }
.sidebar-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.07); }
.system-state { padding: 10px; display: flex; align-items: center; gap: 11px; }
.system-state > span { width: 8px; height: 8px; flex: 0 0 auto; }
.system-state strong, .system-state small { display: block; }
.system-state strong { color: #d6deea; font-size: 11px; }
.system-state small { margin-top: 4px; color: #77849a; font-size: 9px; }
.sidebar-foot > a { margin-top: 7px; padding: 10px; display: flex; align-items: center; gap: 9px; color: #8d99ad; font-size: 11px; }
.admin-main { min-width: 0; }
.admin-topbar { height: 76px; position: sticky; z-index: 30; top: 0; padding: 0 30px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 20px; background: rgba(255,255,255,.92); backdrop-filter: blur(15px); }
.admin-topbar h1 { margin: 3px 0 0; font-size: 20px; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.live-chip { box-shadow: none; border-color: var(--border); background: #fff; }
.live-chip span { width: 7px; height: 7px; }
.mobile-only { display: none; }
.admin-content { width: min(1540px, 100%); margin: 0 auto; padding: 28px 30px 50px; }
.admin-section { display: none; }
.admin-section.active { display: block; }
.section-toolbar { min-height: 58px; margin-bottom: 21px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.section-toolbar h2 { margin: 0 0 6px; font-size: 22px; }
.section-toolbar p { margin: 0; color: var(--muted); font-size: 12px; }
.sales-period-switch { padding: 3px; border: 1px solid var(--border); border-radius: 8px; display: inline-flex; align-items: center; gap: 2px; background: #f6f7fa; }
.sales-period-button { min-width: 52px; height: 30px; padding: 0 11px; border: 0; border-radius: 6px; color: #7c879a; background: transparent; font-size: 10px; font-weight: 750; cursor: pointer; transition: color .18s ease, background .18s ease, box-shadow .18s ease; }
.sales-period-button:hover { color: #5459c9; }
.sales-period-button.active { color: #5559c9; background: #fff; box-shadow: 0 2px 8px rgba(35, 43, 69, .1); }
.sales-period-button:focus-visible { outline: 2px solid rgba(98, 91, 215, .28); outline-offset: 1px; }
.toolbar-actions { display: flex; gap: 10px; }
.action-menu { position: relative; }
.action-menu > .btn { height: 100%; }
.menu-chevron { width: 14px; height: 14px; margin-left: 1px; transition: transform .18s ease; }
.action-menu > .btn[aria-expanded="true"] .menu-chevron { transform: rotate(180deg); }
.action-dropdown { width: 260px; position: absolute; z-index: 45; top: calc(100% + 8px); right: 0; padding: 7px; border: 1px solid var(--border); border-radius: 8px; display: grid; gap: 3px; background: #fff; box-shadow: 0 18px 45px rgba(22, 31, 50, .16); }
.action-dropdown button { min-height: 42px; padding: 0 11px; border: 0; border-radius: 6px; display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: center; gap: 8px; color: #3d4659; background: transparent; text-align: left; font-size: 11px; font-weight: 650; }
.action-dropdown button:hover, .action-dropdown button:focus-visible { color: #5459c9; background: #f2f3ff; outline: 0; }
.action-dropdown button svg { width: 17px; height: 17px; color: #667085; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.stat-card { min-width: 0; min-height: 132px; padding: 20px; border: 1px solid var(--border); border-radius: 8px; display: flex; align-items: flex-start; gap: 15px; background: #fff; box-shadow: 0 7px 20px rgba(30, 44, 73, .045); }
.stat-icon { width: 42px; height: 42px; flex: 0 0 auto; border-radius: 8px; display: grid; place-items: center; }
.accent-violet .stat-icon { color: var(--violet); background: #efefff; }
.accent-green .stat-icon { color: var(--green); background: #e8f8f2; }
.accent-cyan .stat-icon { color: var(--cyan); background: #e7f7fa; }
.accent-orange .stat-icon { color: var(--orange); background: #fff4e7; }
.stat-card p { margin: 1px 0 7px; color: var(--muted); font-size: 11px; }
.stat-card strong { display: block; font-size: 28px; line-height: 1; }
.stat-card small { display: block; margin-top: 12px; color: var(--muted-2); font-size: 10px; }
.stat-card small b { color: #47536a; }
.dashboard-grid { margin-top: 16px; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .75fr); gap: 16px; }
.data-panel, .table-panel { border: 1px solid var(--border); border-radius: 8px; background: #fff; box-shadow: 0 7px 20px rgba(30, 44, 73, .04); }
.data-panel { padding: 20px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.panel-heading h3 { margin: 0 0 5px; font-size: 15px; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 10px; }
.metric-chip { padding: 6px 9px; border-radius: 6px; color: #5a5dcc; background: #f0f1ff; font-size: 10px; font-weight: 800; }
.trend-chart { height: 230px; margin-top: 20px; padding: 15px 3px 2px; border-bottom: 1px solid #edf0f5; display: grid; grid-template-columns: repeat(7, 1fr); gap: 15px; align-items: end; }
.trend-column { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 7px; }
.trend-value { color: #68738a; font-size: 9px; }
.trend-bar { width: min(32px, 70%); min-height: 4px; border-radius: 5px 5px 2px 2px; background: linear-gradient(#675fdf, #28a8c5); transition: height .4s ease; }
.trend-label { color: #8e99ac; font-size: 9px; }
.health-meter { min-height: 190px; display: flex; align-items: center; justify-content: center; gap: 25px; }
.health-ring { --score: 0deg; width: 118px; height: 118px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--green) var(--score), #edf0f5 0); position: relative; }
.health-ring::after { content: ""; width: 88px; height: 88px; position: absolute; border-radius: 50%; background: #fff; }
.health-ring span { position: relative; z-index: 1; font-size: 19px; font-weight: 850; }
.health-copy { max-width: 155px; }
.health-copy strong { font-size: 14px; }
.health-copy p { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.health-legend { padding-top: 14px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 10px; }
.health-legend span { display: flex; align-items: center; gap: 7px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }.dot.violet { background: var(--violet); }.dot.orange { background: var(--orange); }
.recent-panel { margin-top: 16px; }
.activity-list { margin-top: 14px; }
.activity-row { min-height: 56px; padding: 9px 4px; border-top: 1px solid #edf0f5; display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 12px; }
.activity-icon { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: var(--green); background: #e9f8f2; }
.activity-copy strong, .activity-copy small { display: block; }
.activity-copy strong { font-size: 11px; }.activity-copy small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.activity-time { color: var(--muted-2); font-size: 9px; }
.empty-inline { padding: 35px 10px; text-align: center; color: var(--muted-2); font-size: 11px; }
.filter-bar { min-height: 62px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; display: flex; align-items: center; gap: 10px; background: #fff; }
.filter-bar select { width: 150px; }
.mobile-group-filter { display: none; position: relative; }
.mobile-group-filter-button { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 7px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text); background: #fff; text-align: left; }
.mobile-group-filter-button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-group-filter-button svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--muted); transition: transform .16s ease; }
.mobile-group-filter-button[aria-expanded="true"] svg { transform: rotate(180deg); }
.mobile-group-filter-menu { width: 50vw; max-height: 33vh; max-height: 33dvh; position: absolute; z-index: 80; top: calc(100% + 6px); right: 0; padding: 5px; border: 1px solid var(--border); border-radius: 9px; overflow-y: auto; overscroll-behavior: contain; background: #fff; box-shadow: 0 16px 38px rgba(20, 29, 48, .2); -webkit-overflow-scrolling: touch; }
.mobile-group-filter-menu[hidden] { display: none; }
.mobile-group-filter-option { width: 100%; min-height: 40px; padding: 8px 10px; border: 0; border-radius: 6px; display: grid; grid-template-columns: minmax(0, 1fr) 16px; align-items: center; gap: 8px; color: #354056; background: transparent; text-align: left; font-size: 11px; }
.mobile-group-filter-option + .mobile-group-filter-option { border-top: 1px solid #eef0f4; }
.mobile-group-filter-option span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-group-filter-option .mobile-group-filter-check { width: 14px; height: 14px; border: 1.5px solid #9aa3b3; border-radius: 50%; display: block; }
.mobile-group-filter-option[aria-selected="true"] { color: #4f59c9; background: #f3f4ff; font-weight: 750; }
.mobile-group-filter-option[aria-selected="true"] .mobile-group-filter-check { border: 4px solid #5963d5; }
.compact-group-select { position: relative; }
.compact-group-select-button { width: 100%; height: 34px; min-height: 34px; padding: 0 9px; border: 1px solid #dfe3eb; border-radius: 7px; display: flex; align-items: center; justify-content: space-between; gap: 7px; color: #354056; background: #f8f9fc; text-align: left; font-size: 11px; }
.compact-group-select-button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-group-select-button svg { width: 14px; height: 14px; flex: 0 0 auto; color: #7d8798; transition: transform .16s ease; }
.compact-group-select-button[aria-expanded="true"] svg { transform: rotate(180deg); }
.compact-group-select-menu { width: 100%; max-height: 33vh; max-height: 33dvh; position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; padding: 4px; border: 1px solid var(--border); border-radius: 7px; overflow-y: auto; overscroll-behavior: contain; background: #fff; box-shadow: 0 14px 32px rgba(20,29,48,.2); -webkit-overflow-scrolling: touch; }
.compact-group-select-menu[hidden] { display: none; }
.compact-group-select-option { width: 100%; min-height: 34px; padding: 6px 7px; border: 0; border-radius: 5px; display: grid; grid-template-columns: minmax(0, 1fr) 13px; align-items: center; gap: 6px; color: #354056; background: transparent; text-align: left; font-size: 10px; }
.compact-group-select-option + .compact-group-select-option { border-top: 1px solid #eef0f4; }
.compact-group-select-option span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-group-select-check { width: 12px; height: 12px; border: 1.5px solid #9aa3b3; border-radius: 50%; }
.compact-group-select-option[aria-selected="true"] { color: #4f59c9; background: #f3f4ff; font-weight: 750; }
.compact-group-select-option[aria-selected="true"] .compact-group-select-check { border: 3.5px solid #5963d5; }
.result-count { margin-left: auto; padding-right: 5px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.table-panel { overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 860px; border-collapse: collapse; }
#section-accounts table { min-width: 1220px; }
th, td { padding: 13px 17px; border-bottom: 1px solid #edf0f5; text-align: left; vertical-align: middle; }
th { height: 43px; color: #8792a5; background: #fafbfc; font-size: 10px; font-weight: 750; }
td { color: #4b566c; font-size: 11px; }
tbody tr:hover { background: #fcfcff; }
tbody tr:last-child td { border-bottom: 0; }
.cell-main { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.cell-avatar { width: 31px; height: 31px; flex: 0 0 auto; border-radius: 7px; display: grid; place-items: center; color: #5f67ce; background: #eff0ff; font-weight: 800; }
.cell-main strong, .cell-main small { display: block; max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-main strong { color: #313c52; font-size: 11px; }.cell-main small { margin-top: 3px; color: var(--muted-2); font-size: 9px; }
.status-badge { width: max-content; padding: 5px 8px; border-radius: 5px; display: inline-flex; align-items: center; gap: 6px; font-size: 9px; font-weight: 800; }
.status-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-available { color: #07835f; background: #e9f8f2; }
.status-delivered, .status-redeemed { color: #5962cf; background: #eff0ff; }
.status-disabled { color: #9a5360; background: #fceef1; }
.select-cell { width: 42px; padding-left: 14px; padding-right: 6px; text-align: center; }
.row-checkbox { width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; accent-color: var(--violet); cursor: pointer; }
.health-cell, .subscription-cell { min-width: 135px; }
.health-cell small, .subscription-cell small { display: block; max-width: 190px; margin-top: 5px; overflow: hidden; color: var(--muted-2); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.subscription-cell strong { color: #354056; font-size: 10px; }
.health-badge { width: max-content; padding: 5px 8px; border-radius: 5px; display: inline-flex; align-items: center; gap: 6px; font-size: 9px; font-weight: 800; }
.health-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.health-unchecked { color: #778397; background: #f0f2f5; }
.health-alive { color: #087e5e; background: #e8f8f2; }
.health-invalid { color: #b06c16; background: #fff4e5; }
.health-suspended { color: #bd3850; background: #fdecef; }
.health-error { color: #7653b7; background: #f2edfb; }
.group-badge { width: max-content; max-width: 180px; padding: 5px 8px; border-radius: 5px; display: inline-flex; align-items: center; gap: 6px; overflow: hidden; color: #56637a; background: #eef2f7; font-size: 9px; font-weight: 750; white-space: nowrap; text-overflow: ellipsis; }
.group-badge svg { flex: 0 0 auto; color: #6b70cf; }
.credential-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.mini-tag { padding: 3px 6px; border-radius: 4px; color: #6f7a90; background: #f1f3f7; font-size: 8px; }
.table-actions { display: flex; justify-content: flex-end; gap: 4px; }
.table-action { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px; display: grid; place-items: center; color: #7c879a; background: transparent; }
.table-action:hover { color: var(--violet); background: #f0f1ff; }
.table-action.danger:hover { color: var(--red); background: #fff0f2; }
.code-text { font-family: "Cascadia Code", Consolas, monospace; color: #37425a; font-size: 10px; }
.cards-mobile-list { display: none; }
.table-empty { padding: 70px 20px; text-align: center; color: var(--muted-2); }
.table-empty svg { width: 32px; height: 32px; margin-bottom: 11px; }.table-empty strong { display: block; color: #697489; font-size: 13px; }.table-empty p { margin: 7px 0 0; font-size: 10px; }

/* Modal */
.modal-backdrop { position: fixed; z-index: 100; inset: 0; padding: 20px; display: grid; place-items: center; background: rgba(10, 16, 29, .55); backdrop-filter: blur(5px); }
.modal { width: min(600px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; background: #fff; box-shadow: 0 30px 90px rgba(13, 20, 34, .3); }
.modal-wide { width: min(760px, 100%); }
.ledger-modal { width: min(66vw, 480px); height: min(520px, 74vh); display: flex; flex-direction: column; overflow: hidden; }
.compact-modal { width: min(380px, 92%); }
.compact-modal-head { min-height: 54px; padding: 12px 16px; }
.compact-modal-head h3 { font-size: 15px; }
.compact-modal-head p { margin: 0; }
.compact-modal-body { padding: 14px 16px; }
.compact-delete-note { min-height: 0; padding: 13px 14px; }
.compact-modal-actions { padding: 11px 16px; }
.compact-modal-actions .btn { min-height: 36px; padding: 0 14px; font-size: 11px; }
.ledger-modal .modal-head { flex: 0 0 auto; }
.ledger-modal .ledger-modal-head h3 { margin: 0; }
.ledger-modal .ledger-modal-sub { margin: 4px 0 0; max-width: 60vw; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.ledger-modal .ledger-modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.ledger-modal .modal-actions { flex: 0 0 auto; }
.modal-head { min-height: 68px; padding: 15px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.modal-head h3 { margin: 0 0 4px; font-size: 17px; }.modal-head p { margin: 0; color: var(--muted); font-size: 10px; }
.modal-body { padding: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-group { min-width: 0; display: grid; gap: 7px; }.form-group.full { grid-column: 1 / -1; }
.form-hint { color: var(--muted); font-size: 9px; line-height: 1.55; }
.modal-actions { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 9px; background: #fafbfc; }
.integration-config { display: grid; gap: 18px; }
.integration-status { min-height: 64px; padding: 13px 15px; border: 1px solid var(--border); border-radius: 8px; display: flex; align-items: center; gap: 12px; background: var(--surface-soft); }
.integration-status > svg { width: 22px; height: 22px; flex: 0 0 auto; }
.integration-status strong, .integration-status span { display: block; }
.integration-status strong { font-size: 12px; }.integration-status span { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.integration-status.enabled { border-color: #cdebdc; color: #087b5d; background: #f1fbf6; }
.integration-status.disabled { border-color: #f0d9de; color: var(--red); background: #fff7f8; }
.integration-copy-row, .integration-secret-row { display: grid; gap: 8px; align-items: center; }
.integration-copy-row { grid-template-columns: minmax(0, 1fr) 40px; }
.integration-secret-row { grid-template-columns: minmax(0, 1fr) 40px 40px; }
.integration-copy-row .icon-btn, .integration-secret-row .icon-btn { width: 40px; height: 44px; }
.integration-secret-row .icon-btn:disabled { cursor: not-allowed; opacity: .45; }
.code-input { min-width: 0; font-family: "Cascadia Code", Consolas, monospace; font-size: 11px; }
.settings-layout { display: grid; grid-template-columns: minmax(280px, .85fr) minmax(0, 1.4fr); gap: 18px; align-items: stretch; }
.redeem-verification-panel { grid-column: 1 / -1; }
.auto-validation-panel { grid-column: 1 / -1; }
.auto-validation-panel .redeem-verification-form { grid-template-columns: minmax(170px, 220px) minmax(170px, 220px) minmax(170px, 220px) 1fr; }
.auto-validation-panel .settings-form-footer { grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.auto-validation-panel .settings-form-footer .verification-settings-note { grid-column: 1 / -1; }
.auto-validation-panel .settings-form-footer > .btn { grid-column: 1 / -1; justify-self: start; }
.redeem-verification-form { margin-top: 20px; display: grid; grid-template-columns: minmax(170px, 220px) minmax(170px, 220px) minmax(210px, .85fr) minmax(240px, 1fr) auto; align-items: end; gap: 12px; }
.verification-settings-note { min-height: 68px; box-sizing: border-box; padding: 12px 14px; border: 1px solid #d9eee5; border-radius: 7px; display: flex; align-items: center; gap: 10px; color: #31745f; background: #f2fbf7; font-size: 10px; line-height: 1.6; }
.verification-settings-note svg { width: 18px; height: 18px; flex: 0 0 auto; color: #16a879; }
.redeem-verification-form > .btn { min-height: 44px; white-space: nowrap; }
.setting-switch-card { min-height: 68px; box-sizing: border-box; padding: 10px 14px; border: 1px solid var(--border); border-radius: 7px; display: flex; align-items: center; gap: 14px; color: var(--text); background: var(--surface-soft); cursor: pointer; }
.setting-switch-card > span:first-child { min-width: 0; flex: 1; }
.setting-switch-card strong, .setting-switch-card small { display: block; }
.setting-switch-card strong { font-size: 11px; }
.setting-switch-card small { margin-top: 5px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.setting-switch-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
.setting-switch-card input:focus-visible + .capsule-switch { outline: 2px solid rgba(95,91,214,.22); outline-offset: 2px; }
.setting-switch-card input:checked + .capsule-switch { background: var(--violet); }
.setting-switch-card input:checked + .capsule-switch span { transform: translateX(18px); }
.integration-panel, .token-panel { min-height: 100%; }
@media (min-width: 821px) {
  .redeem-verification-form { align-items: start; }
  .redeem-verification-form .form-group input,
  .redeem-verification-form > .btn,
  .redeem-verification-form .setting-switch-card,
  .redeem-verification-form .verification-settings-note { height: 68px; min-height: 68px; }
  .redeem-verification-form > .btn,
  .redeem-verification-form .setting-switch-card,
  .redeem-verification-form .verification-settings-note { margin-top: 24px; }
}
.settings-fields { display: grid; gap: 18px; margin-top: 22px; }
.settings-summary { padding: 13px 14px; border: 1px solid var(--border); border-radius: 7px; display: flex; align-items: center; gap: 9px; color: var(--muted); background: var(--surface-soft); font-size: 10px; }
.settings-summary svg { width: 15px; height: 15px; color: var(--violet); }
.settings-summary strong { color: var(--text); font-size: 20px; }
.settings-summary-note { margin-left: auto; font-size: 9px; text-align: right; }
.token-panel { min-width: 0; }
.token-list { margin-top: 18px; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.token-item { padding: 13px 14px; border-bottom: 1px solid var(--border); display: grid; gap: 11px; }
.token-item:last-child { border-bottom: 0; }
.token-item-heading { display: flex; align-items: center; gap: 10px; min-width: 0; }
.token-icon { width: 30px; height: 30px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 7px; color: var(--violet); background: #f0f1ff; }
.token-icon svg { width: 15px; height: 15px; }
.token-item-heading strong, .token-item-heading small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.token-item-heading strong { color: var(--text); font-size: 11px; }.token-item-heading small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.token-secret { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.token-secret .code-input { height: 36px; padding: 0 10px; background: #f8f9fc; }
.token-empty { min-height: 150px; padding: 28px 18px; display: grid; place-items: center; gap: 7px; color: var(--muted-2); text-align: center; }
.token-empty svg { width: 28px; height: 28px; color: #a3a9d8; }.token-empty strong { color: #697489; font-size: 12px; }.token-empty span { font-size: 9px; }
.btn-quiet { color: #697489; background: #f5f6fa; border-color: #e8eaf1; }
.select-filtered-button { margin-left: auto; padding: 5px 8px; color: var(--violet); font-size: 10px; }
.accounts-pagination { min-height: 48px; padding: 10px 14px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 9px; }
.accounts-pagination > div { display: flex; align-items: center; gap: 4px; }
.page-button { min-width: 28px; height: 28px; padding: 0 7px; border: 1px solid transparent; border-radius: 6px; color: #6d7890; background: transparent; font-size: 10px; }
.page-button:hover, .page-button.active { border-color: #d9daf7; color: var(--violet); background: #f1f1ff; }
.accounts-mobile-list { display: none; }
.mobile-account-item { min-width: 0; padding: 13px 14px; border: 1px solid #e2e6ee; border-radius: 12px; background: #fff; box-shadow: 0 6px 18px rgba(30,44,73,.055); }
.mobile-account-item.selected { border-color: #c6c9f0; box-shadow: 0 0 0 1px #c6c9f0, 0 8px 20px rgba(79,83,181,.1); }
.mobile-account-head { display: flex; align-items: flex-start; gap: 9px; }
.mobile-account-check { flex: 0 0 auto; margin-top: 2px; }
.mobile-account-check input { width: 17px; height: 17px; accent-color: #5f63d6; cursor: pointer; }
.mobile-account-avatar { width: 34px; height: 34px; border-radius: 9px; flex: 0 0 auto; display: grid; place-items: center; color: #5b63c7; background: #eff0ff; font-size: 14px; font-weight: 800; }
.mobile-account-main { min-width: 0; flex: 1 1 auto; }
.mobile-account-main strong, .mobile-account-main small { display: block; overflow-wrap: anywhere; }
.mobile-account-main strong { color: #303b50; font-size: 12px; line-height: 1.45; }
.mobile-account-main small { margin-top: 4px; color: #939daf; font-size: 9px; line-height: 1.45; }
.mobile-account-badges { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.mobile-account-badges .status-badge, .mobile-account-badges .health-badge { max-width: 88px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-account-details { margin-top: 11px; padding: 11px 0; border-top: 1px solid #eef0f4; border-bottom: 1px solid #eef0f4; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.mobile-account-details > div { min-width: 0; }
.mobile-account-details small { display: block; color: #929caf; font-size: 8px; font-weight: 700; }
.mobile-account-details strong { display: block; margin-top: 4px; overflow-wrap: anywhere; color: #4c586c; font-size: 10px; line-height: 1.4; }
.mobile-account-tags-col { grid-column: 1 / -1; }
.mobile-account-tags-col .credential-tags { margin-top: 5px; }
.mobile-account-actions { padding-top: 10px; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 7px; }
.mobile-account-actions button { min-width: 0; height: 36px; padding: 0 8px; border: 1px solid #e2e5ed; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; color: #647086; background: #f8f9fb; font-size: 10px; font-weight: 750; }
.mobile-account-actions button svg { width: 14px; height: 14px; }
.mobile-account-actions button:first-child { color: #575dcb; border-color: #dddef8; background: #f3f3ff; }
.mobile-account-actions button.danger { color: #a94b5c; border-color: #f0dce1; background: #fff5f6; }
.compact-transfer-form { width: min(520px, 100%); }
.modal:has(.compact-transfer-form) { width: min(520px, 100%); }

@media (min-width: 821px) {
  .modal:has(> .generate-card-form) {
    width: min(460px, calc(100vw - 40px));
    height: min(720px, calc(100vh - 40px));
    overflow: hidden;
  }
  .generate-card-form {
    height: 100%;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }
  .generate-card-form .modal-head { min-height: 82px; padding: 18px 22px; }
  .generate-card-form .modal-head h3 { font-size: 19px; }
  .generate-card-form .modal-head p { font-size: 11px; }
  .generate-card-form .modal-body {
    min-height: 0;
    padding: 22px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .generate-card-form .form-grid { grid-template-columns: 1fr; gap: 17px; }
  .generate-card-form .form-group,
  .generate-card-form .form-group.full { grid-column: auto; gap: 7px; }
  .generate-card-form label { font-size: 12px; }
  .generate-card-form input,
  .generate-card-form select,
  .generate-card-form .compact-group-select-button {
    height: 46px;
    min-height: 46px;
    padding: 0 13px;
    font-size: 13px;
  }
  .generate-card-form .compact-group-select-menu {
    position: absolute;
    max-height: 33vh;
    max-height: 33dvh;
    margin-top: 0;
    padding: 4px;
  }
  .generate-card-form .compact-group-select-option {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 12px;
  }
  .generate-card-form .modal-actions { padding: 16px 22px; }
  .generate-card-form .modal-actions .btn { min-height: 42px; font-size: 12px; }
}

.switch-row { min-height: 38px; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.capsule-switch { width: 42px; height: 24px; margin-left: auto; padding: 3px; border-radius: 99px; display: flex; align-items: center; background: #d7dbe5; transition: background .18s ease; }
.capsule-switch span { width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(26,35,55,.2); transition: transform .18s ease; }
.switch-row input:checked + .capsule-switch { background: var(--violet); }.switch-row input:checked + .capsule-switch span { transform: translateX(18px); }
.import-sample { margin-top: 10px; padding: 11px; border-radius: 7px; color: #667087; background: #f4f6fa; overflow-x: auto; font: 10px/1.6 "Cascadia Code", Consolas, monospace; }
.import-preview-list { max-height: 390px; border: 1px solid var(--border); border-radius: 8px; overflow-y: auto; }
.import-preview-item { min-height: 58px; padding: 9px 12px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 11px; }
.import-preview-item:last-child { border-bottom: 0; }
.import-preview-item strong, .import-preview-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-preview-item strong { color: #354056; font-size: 10px; }.import-preview-item small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.import-preview-more { padding: 11px; color: var(--muted); text-align: center; font-size: 9px; }
.import-progress-body { display: grid; gap: 15px; }
.import-progress-summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 10px; }
.import-progress-summary strong { color: var(--text); font-size: 13px; }
.import-progress-track { height: 10px; border: 1px solid #e1e3f2; border-radius: 99px; overflow: hidden; background: #f0f2f7; }
.import-progress-track span { width: 0; height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, #596de8, #9b4ce2); transition: width .22s ease; }
.import-complete-summary { padding: 12px 14px; border: 1px solid #d9eee5; border-radius: 7px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; color: #4d6e63; background: #f2fbf7; font-size: 10px; }
.import-complete-summary span { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.import-complete-summary b { color: #087e5e; font-size: 16px; }
.validation-note-error { margin-top: 0; border-left-color: var(--red); color: #8f3d4c; background: #fff4f6; }
.generated-list { max-height: 330px; overflow-y: auto; border: 1px solid var(--border); border-radius: 7px; }
.generated-item { padding: 10px 12px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 15px; font-family: "Cascadia Code", Consolas, monospace; font-size: 11px; }.generated-item:last-child { border-bottom: 0; }
.group-manager-body { display: grid; gap: 20px; }
.group-create-form { padding: 15px; border: 1px solid #e2e5f4; border-radius: 8px; display: grid; grid-template-columns: minmax(150px, .8fr) minmax(220px, 1.35fr) auto; align-items: end; gap: 12px; background: #f8f9ff; }
.group-create-form .btn { min-height: 38px; white-space: nowrap; }
.group-manager-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.group-manager-heading strong { font-size: 12px; }.group-manager-heading span { color: var(--muted); font-size: 9px; }
.group-manager-list { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.group-manager-item { min-height: 66px; padding: 11px 13px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 36px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; }
.group-manager-item:last-child { border-bottom: 0; }
.group-manager-item:hover { background: #fbfbff; }
.group-manager-icon { width: 34px; height: 34px; border-radius: 7px; display: grid; place-items: center; color: #6265cd; background: #eff0ff; }
.group-manager-copy { min-width: 0; }
.group-manager-copy strong, .group-manager-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-manager-copy strong { color: #354056; font-size: 11px; }.group-manager-copy small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.group-manager-count { padding: 5px 8px; border-radius: 5px; color: #667187; background: #f0f2f6; font-size: 9px; font-weight: 750; white-space: nowrap; }
.group-manager-empty { min-height: 150px; display: grid; place-items: center; align-content: center; gap: 7px; color: var(--muted-2); text-align: center; }
.group-manager-empty svg { width: 29px; height: 29px; }.group-manager-empty strong { color: #657087; font-size: 11px; }.group-manager-empty span { font-size: 9px; }
.group-delete-note { min-height: 90px; padding: 16px; border: 1px solid #f0d9de; border-radius: 8px; display: flex; align-items: flex-start; gap: 13px; color: #a33d50; background: #fff7f8; }
.group-delete-note > svg { flex: 0 0 auto; }.group-delete-note strong { color: #45333a; font-size: 12px; }.group-delete-note p { margin: 7px 0 0; color: #8b6670; font-size: 10px; line-height: 1.55; }
.validation-flow { margin-bottom: 20px; padding: 13px; border: 1px solid #e1e5f5; border-radius: 7px; display: flex; align-items: center; justify-content: center; gap: 12px; color: #677187; background: #f7f8ff; font-size: 10px; }
.validation-flow span { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.validation-flow b { width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--violet); font-size: 9px; }
.validation-flow > svg { color: #a1a9b9; }
.validation-note { margin-top: 18px; padding: 14px; border-left: 3px solid var(--cyan); display: flex; gap: 11px; color: #526076; background: #f0f9fb; }
.validation-note > svg { flex: 0 0 auto; color: var(--cyan); }
.validation-note strong { font-size: 11px; }.validation-note p { margin: 5px 0 0; color: var(--muted); font-size: 9px; line-height: 1.6; }
.validation-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.validation-summary > div { padding: 13px; border: 1px solid var(--border); border-radius: 7px; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff; }
.validation-summary strong { font-size: 20px; }
.validation-suffix-breakdown { margin-top: 14px; padding: 14px; border: 1px solid #f0d9de; border-radius: 8px; display: grid; gap: 11px; background: #fff7f8; }
.validation-suffix-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #9b4052; }
.validation-suffix-heading strong { font-size: 11px; }.validation-suffix-heading span { font-size: 9px; }
.validation-suffix-breakdown > div:last-child { display: flex; flex-wrap: wrap; gap: 8px; }
.validation-suffix-breakdown > div:last-child > span { min-width: 145px; padding: 8px 10px; border: 1px solid #efd4da; border-radius: 6px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #8f4352; background: #fff; font-size: 9px; }
.validation-suffix-breakdown b { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.validation-suffix-breakdown span strong { color: #bd3850; font-size: 11px; white-space: nowrap; }
.redemption-health-summary { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.redemption-health-summary span { padding: 5px 7px; border-radius: 5px; font-size: 9px; font-weight: 750; }
.redemption-health-summary .normal { color: #188260; background: #e9f8f1; }.redemption-health-summary .suspended { color: #bd3850; background: #fdecef; }
.validation-progress-body { display: grid; gap: 18px; }
.validation-progress-body .validation-flow { margin-bottom: 0; }
.validation-progress-panel { padding: 18px; border: 1px solid #dde2f4; border-radius: 9px; display: grid; gap: 13px; background: #f8f9ff; }
.validation-progress-panel .form-hint { min-height: 18px; margin: 0; }
.validation-progress-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.validation-progress-stats > div { padding: 13px; border: 1px solid var(--border); border-radius: 7px; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff; }
.validation-progress-stats strong { font-size: 20px; }
.validation-result-list { max-height: 360px; margin-top: 15px; overflow-y: auto; border: 1px solid var(--border); border-radius: 7px; }
.validation-result-item { min-height: 58px; padding: 10px 12px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; }
.validation-result-item:last-child { border-bottom: 0; }
.validation-result-item strong, .validation-result-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.validation-result-item strong { font-size: 10px; }.validation-result-item small { max-width: 390px; margin-top: 4px; color: var(--muted); font-size: 8px; }
.cleanup-summary { display: grid; gap: 10px; }
.cleanup-summary span { padding: 13px; border: 1px solid var(--border); border-radius: 7px; color: #59657a; background: #f8f9fb; font-size: 11px; }
.cleanup-summary b { color: var(--text); font-size: 16px; }
.cleanup-note { margin: 14px 0 0; color: var(--muted); font-size: 9px; line-height: 1.6; }

@media (max-width: 1120px) {
  .redeem-page { width: min(960px, calc(100% - 32px)); padding-top: 48px; }
  .redeem-shell { grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); gap: 22px; padding: 22px; }
  .credential-console { padding: 22px; }
  .package-hero { grid-template-columns: auto 1fr; }.json-tile { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .redeem-page { width: min(640px, calc(100% - 24px)); padding: 26px 0; }
  .redeem-header { margin: 0 4px 22px; }
  .brand-lockup .brand-mark { width: 44px; height: 44px; border-radius: 12px; }
  .brand-lockup strong { font-size: 22px; }.brand-lockup small { font-size: 11px; }
  .online-pill { padding: 8px 10px; font-size: 11px; }
  .redeem-shell { grid-template-columns: 1fr; border-radius: 18px; padding: 15px; gap: 16px; }
  .redeem-form-panel { padding: 14px 8px 4px; }
  .notice-line { margin: 22px 0; }
  .credential-console { padding: 17px; border-radius: 15px; }
  .console-stage { min-height: 430px; }
  .credential-fields { grid-template-columns: 1fr; }
  .result-actions { grid-template-columns: 1fr; }
  .redeem-footer { display: none; }

  .admin-app { display: block; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .sidebar { width: 100%; height: calc(66px + env(safe-area-inset-bottom)); position: fixed; z-index: 70; left: 0; right: 0; top: auto; bottom: 0; padding: 5px 8px env(safe-area-inset-bottom); color: #68738a; background: rgba(255,255,255,.97); border-top: 1px solid var(--border); box-shadow: 0 -10px 30px rgba(24,34,55,.08); backdrop-filter: blur(16px); }
  .admin-brand, .sidebar-foot { display: none; }
  .admin-nav { width: 100%; height: 100%; margin: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; }
  .nav-item { min-width: 0; min-height: 56px; padding: 5px 2px; border-radius: 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; position: relative; color: #7b8699; background: transparent; text-align: center; }
  .nav-item:hover { color: #5963c8; background: transparent; }
  .nav-item.active { color: var(--violet); background: transparent; box-shadow: none; }
  .nav-item svg { width: 20px; height: 20px; flex: 0 0 auto; }
  .nav-item span { width: 100%; overflow: hidden; font-size: 9px; line-height: 1; text-overflow: ellipsis; white-space: nowrap; }
  .nav-item b { min-width: 16px; position: absolute; top: 3px; left: calc(50% + 8px); padding: 2px 4px; border-radius: 9px; color: #fff; background: #6265d6; font-size: 8px; line-height: 1.2; }
  .nav-item.active b { color: #fff; }
  .mobile-only { display: inline-grid; }
  .mobile-brand-mark { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 9px; place-items: center; color: #fff; background: #625bd7; box-shadow: 0 6px 16px rgba(82,76,195,.2); }
  .mobile-brand-mark svg { width: 18px; height: 18px; }
  .admin-topbar { height: 60px; padding: 0 14px; justify-content: flex-start; gap: 10px; }
  .admin-topbar > div:nth-child(2) { min-width: 0; flex: 1; }
  .admin-topbar h1 { margin-top: 1px; overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
  .admin-topbar .eyebrow { font-size: 8px; }
  .topbar-actions { gap: 5px; }
  .topbar-actions .icon-btn { width: 36px; height: 36px; }
  .live-chip { display: none; }
  .admin-content { padding: 18px 14px calc(92px + env(safe-area-inset-bottom)); }
  .section-toolbar { align-items: flex-start; }
  .welcome-row, .section-toolbar { flex-direction: column; }
  .sales-period-switch { max-width: 100%; align-self: stretch; }
  .sales-period-button { min-width: 0; flex: 1; }
  .toolbar-actions { width: 100%; }.toolbar-actions .btn { flex: 1; }
  .account-toolbar { flex-wrap: wrap; }.account-toolbar > .btn, .account-toolbar > .action-menu { flex: 1 1 140px; }.account-toolbar .action-menu > .btn { width: 100%; }
  .card-toolbar { flex-wrap: wrap; }.card-toolbar .btn { flex: 1 1 145px; }
  .settings-layout { grid-template-columns: 1fr; }
  .redeem-verification-form { grid-template-columns: 1fr; }
  .redeem-verification-form > .btn { width: 100%; }
  .settings-summary-note { max-width: 150px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card { min-height: 120px; padding: 15px; gap: 11px; }.stat-card strong { font-size: 24px; }
  .filter-bar { flex-wrap: wrap; }.filter-bar .search-field { max-width: none; flex-basis: 100%; }.result-count { margin-left: 0; }
}

@media (max-width: 520px) {
  .redeem-header { align-items: flex-start; }
  .online-pill { font-size: 0; gap: 0; padding: 10px; }.online-pill span { width: 9px; height: 9px; }
  .redeem-shell { padding: 10px; }
  .section-title-row h1 { font-size: 20px; }
  .credential-console { padding: 13px; }
  .console-heading h2 { font-size: 19px; }.format-pill { display: none; }
  .package-hero { padding: 15px; gap: 12px; }.package-icon { width: 50px; height: 50px; border-radius: 12px; }.package-copy h3 { font-size: 15px; }
  .snapshot-ready { min-height: 125px; padding: 18px; }.snapshot-ready-icon { width: 50px; height: 50px; border-radius: 13px; }.snapshot-ready strong { font-size: 16px; }
  .result-view { padding: 8px; }.result-summary { grid-template-columns: 1fr; }.summary-cell { display: flex; justify-content: space-between; align-items: center; }.summary-cell strong { margin: 0; }
  .claim-summary-hero { min-height: 145px; padding: 20px 14px; }
  .claim-summary-hero strong { font-size: 25px; }
  .claim-summary-meta { align-items: flex-start; flex-direction: column; gap: 7px; }
  .refill-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { min-height: 125px; padding: 12px; gap: 8px; }
  .stat-icon { width: 34px; height: 34px; }
  .stat-icon svg { width: 17px; height: 17px; }
  .stat-card p { margin-bottom: 5px; font-size: 10px; }
  .stat-card strong { font-size: 22px; }
  .stat-card small { margin-top: 9px; font-size: 9px; line-height: 1.35; }
  .section-toolbar h2 { font-size: 20px; }
  .welcome-row { min-height: 0; margin-bottom: 16px; }
  .data-panel { padding: 16px; }
  .trend-chart { height: 180px; margin-top: 14px; padding-top: 10px; gap: 8px; }
  .health-meter { flex-direction: column; gap: 15px; text-align: center; }
  .health-copy { max-width: 240px; }
  .health-legend { flex-direction: column; }
  .filter-bar select { width: 100%; }
  #section-cards .filter-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #section-cards .filter-bar .search-field { width: 100%; grid-column: 1 / -1; }
  #section-cards .filter-bar select { width: 100%; min-width: 0; }
  #section-cards .filter-bar #card-group-filter { display: none; }
  #section-cards .mobile-group-filter { min-width: 0; display: block; }
  #section-cards .filter-bar .result-count { grid-column: 1 / -1; }
  .cards-panel { overflow: visible; border: 0; background: transparent; box-shadow: none; }
  .cards-table-scroll { display: none; }
  .cards-mobile-list { display: grid; gap: 11px; }
  .mobile-card-item { min-width: 0; padding: 14px; border: 1px solid #e3e6ee; border-radius: 12px; background: #fff; box-shadow: 0 6px 18px rgba(30,44,73,.055); }
  .mobile-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
  .mobile-card-code { min-width: 0; display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 9px; }
  .mobile-card-code > span { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: #5f67ce; background: #eff0ff; }
  .mobile-card-code > span svg { width: 16px; height: 16px; }
  .mobile-card-code small, .mobile-card-details small { display: block; color: #929caf; font-size: 8px; font-weight: 700; }
  .mobile-card-code strong { display: block; margin-top: 3px; overflow-wrap: anywhere; color: #303b50; font-family: "Cascadia Code", Consolas, monospace; font-size: 12px; line-height: 1.45; }
  .mobile-card-head > .status-badge { flex: 0 0 auto; margin-top: 1px; }
  .mobile-card-note { margin: 10px 0 0 43px; overflow-wrap: anywhere; color: #9aa3b3; font-size: 8px; line-height: 1.45; }
  .mobile-card-details { margin-top: 12px; padding: 11px 0; border-top: 1px solid #eef0f4; border-bottom: 1px solid #eef0f4; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
  .mobile-card-details > div { min-width: 0; }
  .mobile-card-details strong { display: block; margin-top: 5px; overflow-wrap: anywhere; color: #4c586c; font-size: 10px; line-height: 1.4; }
  .mobile-card-details .group-badge { max-width: 100%; margin-top: 4px; }
  .mobile-card-actions { padding-top: 10px; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 7px; }
  .mobile-card-actions button { min-width: 0; height: 34px; padding: 0 8px; border: 1px solid #e2e5ed; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; color: #647086; background: #f8f9fb; font-size: 9px; font-weight: 750; }
  .mobile-card-actions button:first-child { color: #575dcb; border-color: #dddef8; background: #f3f3ff; }
  .mobile-card-actions button.danger { color: #a94b5c; border-color: #f0dce1; background: #fff5f6; }
  .mobile-card-actions svg { width: 14px; height: 14px; }
  .cards-panel .table-empty { border: 1px solid var(--border); border-radius: 10px; background: #fff; }
  .generated-cards-modal { width: min(75%, 330px); }
  .generated-cards-modal .modal-head { min-height: 54px; padding: 11px 13px; }
  .generated-cards-modal .modal-head h3 { font-size: 14px; }
  .generated-cards-modal .modal-head p { font-size: 8px; line-height: 1.4; }
  .generated-cards-modal .modal-body { padding: 12px; }
  .generated-cards-modal .generated-item { padding: 9px 10px; gap: 8px; font-size: 9px; }
  .generated-cards-modal .generated-item span { min-width: 0; overflow-wrap: anywhere; }
  .generated-cards-modal .modal-actions { padding: 10px 12px; gap: 7px; }
  .generated-cards-modal .modal-actions .btn { min-height: 34px; padding: 0 10px; font-size: 9px; }
  .settings-summary { align-items: flex-start; flex-wrap: wrap; }.settings-summary-note { width: 100%; max-width: none; margin-left: 24px; text-align: left; }
  .token-secret { grid-template-columns: 1fr; }.token-secret .table-actions { justify-content: flex-start; }
  .form-grid { grid-template-columns: 1fr; }.form-group.full { grid-column: auto; }
  .group-create-form { grid-template-columns: 1fr; }.group-create-form .btn { width: 100%; }
  .group-manager-item { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 9px; }
  .group-manager-item .group-manager-count { grid-column: 2; width: max-content; }
  .group-manager-item .table-actions { grid-column: 3; grid-row: 1 / span 2; }
  .action-dropdown { width: min(280px, calc(100vw - 32px)); left: auto; right: 0; }
  .validation-flow { justify-content: flex-start; overflow-x: auto; }
  .validation-summary { grid-template-columns: repeat(2, 1fr); }
  .validation-progress-stats { grid-template-columns: repeat(2, 1fr); }
  .validation-result-list { max-height: 40vh; }
  .validation-result-item { min-height: 74px; padding: 10px; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 10px; }
  .validation-result-item > div:first-child { grid-column: 1 / -1; }
  .validation-result-item > .status-badge { justify-self: start; }
  .validation-result-item > .health-badge { justify-self: end; }
  .modal-backdrop { padding: 14px 12px calc(14px + env(safe-area-inset-bottom)); align-items: center; }
  .modal { width: min(100%, 440px); max-height: calc(100vh - 28px - env(safe-area-inset-bottom)); border-radius: 10px; box-shadow: 0 24px 70px rgba(13, 20, 34, .28); }
  .modal-head { min-height: 60px; padding: 13px 16px; }
  .modal-head h3 { font-size: 16px; }
  .modal-body { padding: 16px; }
  .modal-actions { padding: 12px 16px; }
  .compact-modal { width: min(340px, 90%); }
  .compact-modal-head { min-height: 50px; padding: 10px 14px; }
  .compact-modal-body { padding: 12px 14px; }
  .compact-modal-actions { padding: 10px 14px; }
  .ledger-modal { width: min(66vw, 440px); height: min(62vh, 480px); display: flex; flex-direction: column; overflow: hidden; }
  .ledger-modal .modal-head { flex: 0 0 auto; }
  .ledger-modal .ledger-modal-sub { max-width: 76vw; font-size: 8px; }
  .ledger-modal .ledger-modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  .ledger-modal .modal-actions { flex: 0 0 auto; }
  .compact-card-form .modal-body { padding: 14px 16px; }
  .compact-card-form .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
  .compact-card-form .form-group { gap: 5px; }
  .compact-card-form .form-group.full { grid-column: 1 / -1; }
  .compact-card-form input, .compact-card-form select { min-width: 0; min-height: 40px; padding: 0 10px; }
  .compact-card-form label { font-size: 10px; }
  .compact-card-form .form-hint { font-size: 8px; line-height: 1.35; }
  .modal:has(> .compact-card-form) { width: min(88%, 400px); max-height: 66vh; max-height: 66dvh; overflow: hidden; }
  .compact-card-form { max-height: 66vh; max-height: 66dvh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
  .compact-card-form .modal-head { min-height: 52px; padding: 10px 14px; }
  .compact-card-form .modal-head p { display: none; }
  .compact-card-form .modal-body { min-height: 0; padding: 10px 14px; overflow-y: auto; overscroll-behavior: contain; }
  .compact-card-form .form-grid { grid-template-columns: 1fr; gap: 9px; }
  .compact-card-form .form-group.full { grid-column: auto; }
  .compact-card-form .form-group { gap: 3px; }
  .compact-card-form label { color: #596579; font-size: 9px; font-weight: 750; }
  .compact-card-form input, .compact-card-form select {
    width: 100%; height: 34px; min-height: 34px; padding: 0 9px;
    border-color: #dfe3eb; border-radius: 7px; color: #354056;
    background-color: #f8f9fc; font-size: 11px; line-height: 34px;
  }
  .compact-card-form input:focus, .compact-card-form select:focus { border-color: #8583e4; background-color: #fff; box-shadow: 0 0 0 2px rgba(95,91,214,.1); }
  .compact-card-form input[type="number"] { font-variant-numeric: tabular-nums; }
  .compact-card-form input[type="datetime-local"] { padding-right: 6px; font-size: 11px; }
  .compact-card-form .form-hint { font-size: 7px; line-height: 1.25; }
  .compact-card-form .modal-actions { padding: 9px 14px; }
  .compact-card-form .modal-actions .btn { min-height: 34px; padding: 0 12px; border-radius: 7px; font-size: 10px; }
  .login-view { padding: 14px; }.login-panel { padding: 28px 22px; }
}

@media (max-width: 360px) {
  .compact-card-form .form-grid { grid-template-columns: 1fr; }
  .compact-card-form .form-group.full { grid-column: auto; }
}

@media (max-width: 820px) {
  .modal:has(> .compact-card-form) { width: min(78vw, 370px); max-height: 50vh; max-height: 50dvh; }
  .compact-card-form { max-height: 50vh; max-height: 50dvh; }
  .compact-card-form .modal-head { min-height: 48px; padding: 8px 12px; }
  .compact-card-form .modal-head h3 { font-size: 15px; }
  .compact-card-form .modal-head .icon-btn { width: 34px; height: 34px; }
  .compact-card-form .modal-body { padding: 9px 12px; }
  .compact-card-form .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 8px; }
  .compact-card-form .form-group.full { grid-column: 1 / -1; }
  .compact-card-form .form-group { gap: 3px; }
  .compact-card-form .form-hint { display: none; }
  .compact-card-form label { font-size: 10px; }
  .compact-card-form input, .compact-card-form select { height: 34px; min-height: 34px; padding: 0 9px; border-radius: 6px; font-size: 12px; line-height: 34px; }
  .compact-card-form input::placeholder { color: #a1a9b7; font-size: 10px; }
  .compact-card-form input[type="datetime-local"] { padding-right: 4px; font-size: 10px; }
  .compact-card-form .modal-actions { padding: 8px 12px; }
  .compact-card-form .modal-actions .btn { min-height: 34px; padding: 0 11px; font-size: 10px; }
  .generated-cards-modal { width: min(72vw, 340px); max-height: 50vh; max-height: 50dvh; }
  .generated-cards-modal .modal-head h3 { font-size: 15px; }
  .generated-cards-modal .modal-head p { font-size: 9px; }
  .generated-cards-modal .generated-item { font-size: 11px; }
  .generated-cards-modal .modal-actions .btn { font-size: 10px; }
  .modal:has(> .generate-card-form) { width: min(62vw, 300px); max-height: none; overflow: visible; }
  .generate-card-form { max-height: none; grid-template-rows: auto auto auto; }
  .generate-card-form .modal-head { min-height: 54px; padding: 9px 12px; }
  .generate-card-form .modal-head h3 { font-size: 15px; white-space: nowrap; }
  .generate-card-form .modal-head .icon-btn { width: 34px; height: 34px; flex: 0 0 auto; }
  .generate-card-form .modal-body { min-height: auto; padding: 12px; overflow: visible; }
  .generate-card-form .form-grid { grid-template-columns: 1fr; gap: 10px; }
  .generate-card-form .form-group, .generate-card-form .form-group.full { min-width: 0; grid-column: auto; gap: 2px; }
  .generate-card-form label { font-size: 11px; }
  .generate-card-form input, .generate-card-form select, .generate-card-form .compact-group-select-button { height: 40px; min-height: 40px; padding: 0 11px; font-size: 13px; line-height: 40px; }
  .generate-card-form .form-hint { display: none; }
  .generate-card-form .modal-actions { padding: 10px 12px; gap: 7px; }
  .generate-card-form .modal-actions .btn { min-width: 0; min-height: 38px; padding: 0 12px; font-size: 11px; }
  .generate-card-form .modal-actions .btn svg { width: 15px; height: 15px; }
}

/* Wallet Cards Display */
.wallet-cards-cell {
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Wallet Actions */
.wallet-actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.wallet-actions .table-action {
  white-space: nowrap;
  min-width: auto;
  padding: 6px 10px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  transition: all 0.2s ease;
}

.wallet-actions .table-action:hover {
  background: var(--surface-soft);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.wallet-actions .table-action.danger {
  color: var(--red);
  border-color: rgba(220, 78, 100, 0.2);
}

.wallet-actions .table-action.danger:hover {
  background: rgba(220, 78, 100, 0.05);
  border-color: var(--red);
}

.wallet-actions .table-action svg {
  width: 14px;
  height: 14px;
}

/* Customer section toolbar: title left, search centered, action right. */
.customer-section-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(240px, 1.2fr) max-content;
  align-items: center;
  gap: 18px;
}
.customer-section-toolbar > div:first-child { min-width: 0; }
.customer-section-toolbar .search-field { width: 100%; max-width: none; justify-self: center; }
.customer-section-toolbar .toolbar-actions { justify-self: end; }
.customer-section-toolbar .toolbar-actions .btn { white-space: nowrap; }
.customer-toolbar-actions { align-items: center; justify-content: flex-end; min-width: 0; }
.customer-sort-control { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 650; white-space: nowrap; }
.customer-sort-control select { width: 158px; min-height: 40px; padding: 0 10px; background: #fff; }

.customer-summary-bar {
  min-height: 52px;
  margin-bottom: 14px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  background: #fff;
  font-size: 11px;
}
.customer-summary-left { display: inline-flex; align-items: center; gap: 18px; min-width: 0; }
.customer-summary-left > span { display: inline-flex; align-items: center; gap: 8px; }
.customer-summary-left > span + span { padding-left: 18px; border-left: 1px solid #e6eaf1; }
.customer-summary-bar svg { width: 16px; height: 16px; color: #5f67ce; }
.customer-summary-bar strong { color: var(--text); font-size: 17px; }
.customer-count-summary strong { font-size: 13px; }
.customer-claim-selector { display: inline-flex; align-items: center; gap: 9px; }
.customer-claim-label { color: var(--muted); font-size: 11px; font-weight: 750; white-space: nowrap; }
.customer-claim-tabs { display: inline-flex; align-items: center; gap: 3px; padding: 3px; border: 1px solid #e1e6ef; border-radius: 8px; background: #f5f7fb; }
.customer-claim-tab { min-width: 46px; min-height: 30px; padding: 0 9px; border: 0; border-radius: 6px; color: #788398; background: transparent; font-size: 10px; font-weight: 750; cursor: pointer; transition: color .16s ease, background .16s ease, box-shadow .16s ease; }
.customer-claim-tab:hover { color: #555fc9; background: #eef0ff; }
.customer-claim-tab.active { color: #fff; background: #6066d6; box-shadow: 0 3px 8px rgba(96,102,214,.22); }
.customer-pool-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.customer-pool-item { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; box-shadow: 0 7px 22px rgba(30,44,73,.045); }
.customer-pool-item.expanded { border-color: #cfd2f4; }
.customer-pool-main { min-height: 0; padding: 10px 12px; display: grid; grid-template-columns: 1fr; gap: 8px; align-items: center; }
.customer-pool-heading { min-width: 0; display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 9px; color: inherit; text-align: left; }
.customer-pool-heading-copy { min-width: 0; }
.customer-email-line { min-width: 0; display: flex; align-items: center; gap: 5px; }
.customer-email-line strong { min-width: 0; flex: 1 1 auto; }
.customer-pool-heading strong, .customer-pool-heading small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-pool-heading strong { color: var(--text); font-size: 12px; }
.customer-pool-heading small { margin-top: 3px; color: var(--muted); font-family: "Cascadia Code", Consolas, monospace; font-size: 8px; }
.customer-email-line .customer-note-inline {
  min-width: 0;
  max-width: 38%;
  flex: 0 1 auto;
  overflow: hidden;
  padding: 3px 8px;
  border: 1px solid #e0e3f7;
  border-radius: 6px;
  color: #6973c9;
  background: #f4f5ff;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.customer-copy-email { width: 24px; height: 24px; flex: 0 0 24px; }
.customer-pool-icon { width: 34px; height: 34px; border-radius: 7px; display: grid; place-items: center; color: #5b63c7; background: #eff0ff; }
.customer-pool-icon svg { width: 19px; height: 19px; }
.customer-details-toggle { width: 24px; height: 30px; padding: 0; border: 0; display: grid; place-items: center; color: #919bad; background: transparent; }
.customer-details-toggle:focus-visible, .customer-copy-email:focus-visible, .customer-action-btn:focus-visible { outline: 2px solid rgba(98, 91, 215, .28); outline-offset: 1px; }
.customer-chevron { width: 16px; height: 16px; color: #919bad; transition: transform .18s ease; }
.customer-pool-item.expanded .customer-chevron { transform: rotate(180deg); }
.customer-pool-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border: 1px solid #edf0f5; border-radius: 8px; overflow: hidden; background: #fafbfd; }
.customer-pool-metrics span { min-width: 0; padding: 7px 10px; }
.customer-pool-metrics span + span { border-left: 1px solid #edf0f5; }
.customer-pool-metrics small, .customer-pool-metrics strong { display: block; }
.customer-pool-metrics small { color: var(--muted); font-size: 8px; }
.customer-pool-metrics strong { margin-top: 3px; color: var(--text); font-size: 14px; }
.customer-pool-metrics .customer-metric-label { display: flex; align-items: center; gap: 4px; }
.customer-metric-reset { width: 18px; height: 18px; padding: 0; border: 0; display: inline-grid; place-items: center; color: #8b96aa; background: transparent; cursor: pointer; }
.customer-metric-reset:hover { color: #5b5fc7; }
.customer-metric-reset:disabled { opacity: .35; cursor: not-allowed; }
.customer-metric-reset svg { width: 12px; height: 12px; }
.customer-metric-reset:focus-visible { outline: 2px solid rgba(98, 91, 215, .28); outline-offset: 1px; border-radius: 4px; }
.customer-pool-actions { display: flex; align-items: center; justify-content: flex-start; gap: 7px; }
.customer-action-btn { min-height: 40px; padding: 0 10px; border: 1px solid var(--border); border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: #647087; background: #fff; font-size: 18px; font-weight: 700; white-space: nowrap; }
.customer-action-btn:hover { color: #5559c9; border-color: #cfd3f4; background: #f8f8ff; }
.customer-action-btn:disabled { cursor: not-allowed; opacity: .55; }
.customer-action-btn svg { width: 18px; height: 18px; }
.customer-action-btn.danger { color: #b64d60; border-color: #f1d1d8; background: #fff8f9; }
.customer-action-btn.danger:hover { color: #9e354c; border-color: #e7b8c2; background: #fff2f4; }
.customer-switch { width: 84px; height: 34px; padding: 0 9px; border: 1px solid #e0e4eb; border-radius: 7px; display: inline-flex; align-items: center; gap: 7px; color: #818b9c; background: #f7f8fa; cursor: pointer; }
.customer-switch span { width: 26px; height: 14px; padding: 2px; border-radius: 8px; background: #bdc4cf; transition: background .18s ease; }
.customer-switch span::after { content: ""; width: 10px; height: 10px; border-radius: 50%; display: block; background: #fff; transition: transform .18s ease; }
.customer-switch b { font-size: 9px; white-space: nowrap; }
.customer-switch.active { color: #177b5c; border-color: #cdeadd; background: #effaf5; }
.customer-switch.active span { background: #37a87d; }
.customer-switch.active span::after { transform: translateX(12px); }
.customer-pool-detail { padding: 14px 16px 16px; border-top: 1px solid var(--border); background: #fafbfc; }
.customer-detail-grid { display: grid; gap: 16px; }
.customer-detail-head { margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.customer-detail-head strong, .customer-detail-head small { display: block; }
.customer-detail-head strong { color: var(--text); font-size: 12px; }
.customer-detail-head small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.btn-compact { min-height: 34px; padding: 0 11px; font-size: 9px; }
.customer-pool-detail .table-scroll { max-height: 330px; border: 1px solid var(--border); border-radius: 7px; background: #fff; }
.customer-pool-detail .customer-ledger-scroll { max-height: min(300px, 38vh); overflow: auto; }
.customer-ledger-scroll th { position: sticky; top: 0; z-index: 1; }
.customer-ledger-mobile { display: none; }
.customer-pool-detail table { min-width: 760px; }
.customer-log-error { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 9px; }
.customer-log-empty { padding: 22px; color: var(--muted); text-align: center; }
.customer-ledger-amount { font-weight: 800; }
.customer-ledger-amount.positive { color: #168261; }
.customer-ledger-amount.negative { color: #b54d60; }
.claim-history-body { padding: 16px 18px; }
.claim-history-loading { min-height: 220px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 12px; }
.claim-history-loading .spinner { width: 18px; height: 18px; border-width: 2px; border-color: rgba(96, 102, 214, .22); border-top-color: #6066d6; }
.claim-summary-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 13px; margin-bottom: 14px; border: 1px solid #e0e4f0; border-radius: 7px; background: #fafbfc; }
.claim-summary-row span { color: var(--muted); font-size: 11px; }
.claim-summary-row strong { color: var(--text); font-size: 16px; font-weight: 800; }
.claim-period-tabs { display: flex; gap: 5px; margin-bottom: 12px; padding: 4px; border-radius: 8px; background: #f5f7fa; }
.claim-tab { flex: 1; min-height: 32px; padding: 0 8px; border: 0; border-radius: 6px; color: #6d788c; background: transparent; font-size: 10px; font-weight: 700; cursor: pointer; transition: all .15s ease; }
.claim-tab:hover { color: #5963c8; background: rgba(96, 102, 214, .08); }
.claim-tab.active { color: #fff; background: #6066d6; box-shadow: 0 2px 6px rgba(96, 102, 214, .25); }
.claim-period-content { position: relative; }
.claim-period-pane { display: none; }
.claim-period-pane.active { display: block; }
.claim-summary-stat { padding: 10px 12px; margin-bottom: 10px; border: 1px solid #e0e4f0; border-radius: 7px; background: #fafbfc; display: flex; align-items: center; justify-content: space-between; }
.claim-summary-stat span { color: var(--muted); font-size: 10px; }
.claim-summary-stat div { text-align: right; }
.claim-summary-stat strong { color: var(--text); font-size: 18px; font-weight: 800; }
.claim-detail-table { height: 280px; overflow-y: auto; border: 1px solid #e0e4f0; border-radius: 7px; background: #fff; }
.claim-detail-table table { width: 100%; min-width: 100%; table-layout: fixed; }
.claim-detail-table th { position: sticky; top: 0; padding: 7px 6px; color: var(--muted); background: #fafbfc; font-size: 9px; font-weight: 750; text-align: center; border-bottom: 1px solid #e0e4f0; }
.claim-detail-table th:first-child { text-align: left; width: 40%; }
.claim-detail-table th:nth-child(2) { width: 30%; }
.claim-detail-table th:nth-child(3) { width: 30%; }
.claim-detail-table td { padding: 7px 6px; color: var(--text); font-size: 10px; border-bottom: 1px solid #f5f7fa; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.claim-detail-table td:first-child { text-align: left; }
.claim-detail-table tr:last-child td { border-bottom: 0; }
.claim-detail-table tr:hover { background: #fafbfc; }
.claim-clear-section { margin-top: 14px; padding-top: 14px; border-top: 1px solid #e0e4f0; }
.claim-clear-option { padding: 9px 11px; margin-bottom: 7px; border: 1px solid #e0e4f0; border-radius: 6px; display: flex; align-items: center; gap: 9px; cursor: pointer; transition: all .15s ease; }
.claim-clear-option:hover { border-color: #b8bfe4; background: #fafbff; }
.claim-clear-option input[type="radio"] { width: 16px; height: 16px; flex: 0 0 auto; cursor: pointer; margin: 0; }
.claim-clear-option span { color: var(--text); font-size: 11px; }
.claim-clear-option:has(input:checked) { border-color: #6670d6; background: #f5f6ff; }
.claim-clear-input { width: 100%; margin-top: 7px; padding: 9px 11px; border: 1px solid #e0e4f0; border-radius: 6px; font-size: 12px; }
.customer-ledger-modal-table { max-height: min(62vh, 560px); border: 1px solid var(--border); border-radius: 7px; }
.customer-ledger-modal-table table { min-width: 780px; }

.redeem-mode-switch { margin: 0 0 18px; padding: 3px; border: 1px solid #dfe4ed; border-radius: 8px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; background: #f5f7fa; }
.redeem-mode-switch button { min-width: 0; min-height: 36px; padding: 0 8px; border: 0; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: #6d788c; background: transparent; font: inherit; font-size: 10px; font-weight: 750; cursor: pointer; }
.redeem-mode-switch button.active { color: #fff; background: #5f5bd6; box-shadow: 0 4px 12px rgba(77,72,190,.2); }
.redeem-mode-switch svg { width: 15px; height: 15px; }
.refill-mode-panel { min-width: 0; }
.account-result-hero { min-height: 230px; padding: 30px 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.account-result-hero .empty-icon { margin-bottom: 18px; }
.account-result-hero small { color: #8b95a7; font-size: 9px; }
.account-result-hero strong { max-width: 100%; margin-top: 8px; overflow-wrap: anywhere; color: #303b50; font-size: 20px; }
.account-result-hero p { margin: 8px 0 0; color: #7d8799; font-size: 10px; }
.refill-overview { margin: 12px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.refill-overview > div { min-width: 0; min-height: 0; padding: 10px 12px; border: 1px solid #e3e7ee; border-radius: 7px; background: #f8f9fb; }
.refill-overview small, .refill-overview strong { display: block; }
.refill-overview small { color: #8b95a7; font-size: 8px; }
.refill-overview strong { margin-top: 6px; overflow-wrap: anywhere; color: #303b50; font-size: 18px; }
.refill-quantity-row { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 8px; }
.refill-quantity-row .icon-btn { width: 44px; height: 44px; }
#refill-quantity::-webkit-outer-spin-button,
#refill-quantity::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; }
#refill-quantity { -moz-appearance: textfield; appearance: textfield; }
.refill-account-list { max-height: 390px; overflow-y: auto; display: grid; gap: 8px; }
.refill-account-item { padding: 11px 12px; border: 1px solid #e2e6ed; border-radius: 7px; background: #fff; }
.refill-account-item strong, .refill-account-item small { display: block; overflow-wrap: anywhere; }
.refill-account-item strong { color: #303b50; font-size: 11px; }
.refill-account-item small { margin-top: 5px; color: #7d8799; font-family: "Cascadia Code", Consolas, monospace; font-size: 8px; line-height: 1.55; }
.refill-result-actions { margin-top: 13px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

/* Keep delivered credentials out of the result view; the download action
   remains the deliberate path for receiving the complete JSON payload. */
.claim-summary-view { min-height: 100%; gap: 16px; }
.claim-summary-hero { min-height: 166px; padding: 24px 18px; border: 1px solid #dce4f2; border-radius: 12px; background: #fff; }
.claim-summary-hero .empty-icon { margin-bottom: 12px; }
.claim-summary-hero strong { font-size: 29px; }
.claim-summary-hero p { margin-top: 7px; }
.claim-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.claim-summary-grid .summary-cell { min-height: 70px; padding: 13px 14px; border-color: #dfe5f0; border-radius: 10px; background: #fff; }
.claim-summary-grid .summary-cell strong { font-size: 22px; }
.claim-summary-meta { padding: 11px 13px; border: 1px solid #dfe5f0; border-radius: 10px; display: flex; justify-content: space-between; gap: 12px; color: #8994a8; background: #f8faff; font-size: 10px; }
.claim-summary-meta span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.claim-summary-meta strong { margin-left: 5px; color: #4d5970; font-family: "Cascadia Code", Consolas, monospace; font-weight: 650; }
.claim-summary-view .refill-result-actions { margin-top: auto; }

/* Settings form: keep the four primary controls scannable and move secondary
   actions into a dedicated footer instead of forcing everything into one row. */
.settings-layout { gap: 22px; }
.redeem-verification-panel { padding: 26px 28px 24px; }
.redeem-verification-panel .panel-heading { align-items: flex-start; }
.redeem-verification-panel .panel-heading p { max-width: 680px; line-height: 1.55; }
.redeem-verification-form {
  margin-top: 24px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
  gap: 18px 16px;
}
.redeem-verification-form > .form-group { min-width: 0; }
.redeem-verification-form > .form-group label { min-height: 18px; }
.redeem-verification-form > .form-group input,
.redeem-verification-form > .form-group select {
  height: 48px;
  min-height: 48px;
  border-radius: 9px;
  background: #fbfcff;
}
.redeem-verification-form > .form-group select { padding-right: 34px; }
.redeem-verification-form > .form-group .form-hint {
  min-height: 32px;
  margin-top: 8px;
  font-size: 10px;
  line-height: 1.55;
}
.settings-form-footer {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(300px, 1.05fr) minmax(360px, 1.55fr) auto;
  gap: 16px;
  align-items: stretch;
  padding-top: 2px;
  border-top: 1px solid #edf0f6;
}
.settings-form-footer .setting-switch-card,
.settings-form-footer .verification-settings-note {
  min-height: 76px;
  margin-top: 16px;
}
.settings-form-footer .setting-switch-card { padding: 13px 16px; border-radius: 9px; }
.settings-form-footer .setting-switch-card strong { font-size: 12px; }
.settings-form-footer .setting-switch-card small { font-size: 10px; }
.settings-form-footer .verification-settings-note {
  padding: 13px 16px;
  border-radius: 9px;
  font-size: 10px;
  line-height: 1.6;
}
.settings-form-footer > .btn {
  min-width: 142px;
  min-height: 46px;
  margin-top: 16px;
  align-self: center;
  justify-self: end;
}
.integration-panel, .token-panel { min-height: 0; }
.integration-panel .panel-heading,
.token-panel .panel-heading { align-items: flex-start; }
.integration-panel .settings-fields { gap: 14px; margin-top: 20px; }
.token-panel .token-list { margin-top: 20px; }

@media (max-width: 1200px) and (min-width: 821px) {
  .redeem-verification-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-form-footer { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .settings-form-footer .verification-settings-note { grid-column: 1 / -1; }
  .settings-form-footer > .btn { justify-self: start; }
}

@media (max-width: 640px) {
  .wallet-cards-cell {
    max-width: 150px;
  }
  
  .wallet-actions {
    flex-direction: column;
    gap: 4px;
  }
  
  .wallet-actions .table-action {
    width: 100%;
    justify-content: center;
    font-size: 11px;
    padding: 5px 8px;
  }

  .customer-pool-main { grid-template-columns: 1fr; gap: 10px; padding: 12px 13px; }
  .customer-pool-heading { grid-template-columns: 30px minmax(0, 1fr); gap: 8px; }
  .customer-pool-icon { width: 30px; height: 30px; }
  .customer-pool-icon svg { width: 17px; height: 17px; }
  .customer-pool-heading strong { font-size: 13px; }
  .customer-pool-heading small { margin-top: 4px; font-size: 9px; }
  .customer-email-line { gap: 7px; }
  .customer-email-line .customer-note-inline { max-width: 32%; font-size: 12px; padding: 3px 9px; }
  .customer-copy-email { width: 26px; height: 26px; flex-basis: 26px; }
  .customer-pool-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border: 1px solid #edf0f5; border-radius: 9px; overflow: hidden; background: #fafbfd; }
  .customer-pool-metrics span { padding: 9px 10px; text-align: center; }
  .customer-pool-metrics span + span { border-left: 1px solid #edf0f5; }
  .customer-pool-metrics small { font-size: 9px; }
  .customer-pool-metrics strong { margin-top: 4px; font-size: 16px; }
  .customer-pool-metrics .customer-metric-label { justify-content: center; }
  .customer-pool-actions { grid-column: auto; justify-content: stretch; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .customer-pool-actions .customer-action-btn { width: 100%; min-height: 38px; padding: 0 12px; font-size: 10px; border-radius: 8px; }
  .customer-pool-actions .customer-action-btn svg { width: 15px; height: 15px; }
  .customer-pool-actions .customer-switch { display: none; }
  .customer-summary-bar { align-items: center; flex-direction: row; justify-content: space-between; gap: 10px; padding: 11px 14px; flex-wrap: wrap; }
  .customer-summary-bar span { font-size: 12px; }
  .customer-pool-detail { padding: 12px 13px 14px; }
  .customer-detail-head { align-items: flex-start; flex-direction: column; gap: 8px; }
  .customer-detail-head .btn-compact { align-self: stretch; }
  .accounts-table-scroll { display: none; }
  .accounts-mobile-list { display: grid; gap: 11px; }
  .accounts-panel { padding: 0; border: 0; background: transparent; box-shadow: none; }
  .accounts-panel .accounts-pagination { border: 1px solid var(--border); border-radius: 10px; background: #fff; }
  .customer-pool-detail .customer-ledger-scroll { display: none; }
  .customer-ledger-modal-table { display: none; }
  .customer-ledger-mobile { display: grid; gap: 8px; }
  .claim-history-body { padding: 14px 15px; }
  .claim-summary-row { padding: 9px 11px; }
  .claim-summary-row strong { font-size: 15px; }
  .claim-tab { min-height: 34px; font-size: 10px; }
  .claim-summary-stat { padding: 9px 10px; }
  .claim-summary-stat strong { font-size: 16px; }
  .claim-detail-table { height: 240px; }
  .claim-detail-table th { padding: 6px 5px; font-size: 8px; }
  .claim-detail-table th:first-child { width: 35%; }
  .claim-detail-table th:nth-child(2), .claim-detail-table th:nth-child(3) { width: 32.5%; }
  .claim-detail-table td { padding: 6px 5px; font-size: 10px; }
  .mobile-ledger-item { padding: 8px 10px; border: 1px solid #e3e7ef; border-radius: 8px; background: #fff; }
  .mobile-ledger-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .mobile-ledger-type { color: #4c586c; font-size: 10px; font-weight: 750; }
  .mobile-ledger-amount { font-size: 13px; font-weight: 800; }
  .mobile-ledger-amount.positive { color: #168261; }
  .mobile-ledger-amount.negative { color: #b54d60; }
  .mobile-ledger-meta { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 12px; color: #8b96aa; font-size: 8px; }
  .mobile-ledger-meta span { display: inline-flex; align-items: center; gap: 3px; }
  .mobile-ledger-meta strong { color: #56627a; font-weight: 700; }
  .mobile-ledger-empty { padding: 20px; color: #9aa3b3; font-size: 10px; text-align: center; border: 1px dashed #e3e7ef; border-radius: 10px; }
  .refill-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .refill-overview > div { padding: 10px 8px; }
  .refill-overview strong { font-size: 15px; }
  .refill-result-actions { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .redeem-verification-panel { padding: 20px 18px; }
  .redeem-verification-form { grid-template-columns: 1fr; gap: 14px; }
  .redeem-verification-form > .form-group .form-hint { min-height: 0; }
  .settings-form-footer {
    grid-column: 1;
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .settings-form-footer .setting-switch-card,
  .settings-form-footer .verification-settings-note,
  .settings-form-footer > .btn { margin-top: 0; }
  .settings-form-footer > .btn { width: 100%; justify-self: stretch; }
}

@media (max-width: 820px) {
  .admin-nav { grid-template-columns: repeat(5, minmax(0, 1fr)); overflow: hidden; }
  .admin-nav::-webkit-scrollbar { display: none; }
}

/* Admin visual refresh: clearer hierarchy for long-running operations. */
.admin-body {
  position: relative;
  overflow-x: hidden;
  background: #eef2f8;
}
.login-view {
  background: linear-gradient(132deg, #0c1526 0%, #142238 54%, #1d314b 100%);
}
.login-panel {
  padding: 42px;
  border-radius: 18px;
  border-color: rgba(151, 169, 207, .18);
  background: rgba(25, 36, 57, .84);
  box-shadow: 0 30px 90px rgba(4, 10, 22, .42), inset 0 1px 0 rgba(255,255,255,.06);
  backdrop-filter: blur(18px);
}
.login-mark { border-radius: 16px; box-shadow: 0 14px 30px rgba(102, 82, 220, .32); }
.login-panel h1 { letter-spacing: -.03em; }
.login-panel .dark-input input { border-radius: 10px; background: rgba(13, 24, 42, .78); }
.login-panel .btn-primary { border-radius: 10px; }
.admin-body::before {
  content: "";
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  opacity: .52;
  background-image: linear-gradient(rgba(103, 119, 158, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(103, 119, 158, .035) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, #000 0, rgba(0,0,0,.72) 46%, transparent 100%);
}
.admin-app { position: relative; z-index: 1; grid-template-columns: 256px minmax(0, 1fr); }
.sidebar {
  padding: 24px 17px;
  border-right: 1px solid rgba(255,255,255,.07);
  background: linear-gradient(180deg, #101a2c 0%, #17243a 58%, #1b2b42 100%);
  box-shadow: 15px 0 42px rgba(25, 38, 66, .14);
}
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #4f78e5, #9e55dc, #16b3a0);
}
.admin-brand { padding: 2px 10px 26px; border-bottom-color: rgba(255,255,255,.1); }
.admin-brand .brand-mark { width: 43px; height: 43px; border-radius: 13px; box-shadow: 0 10px 24px rgba(96, 86, 218, .3); }
.admin-brand strong { font-size: 18px; letter-spacing: .01em; }
.admin-brand small { color: #8d9bb2; }
.admin-nav { gap: 8px; margin-top: 28px; }
.nav-item {
  min-height: 50px;
  padding: 0 13px;
  border-radius: 11px;
  gap: 11px;
  transition: color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.nav-item:hover { transform: translateX(2px); color: #f1f4fb; background: rgba(255,255,255,.07); }
.nav-item.active {
  transform: translateX(2px);
  background: linear-gradient(110deg, #5369df, #7657d9 68%, #8b53d7);
  box-shadow: 0 12px 28px rgba(77, 81, 196, .34), inset 0 1px 0 rgba(255,255,255,.16);
}
.nav-item svg { width: 19px; height: 19px; }
.nav-item b { background: rgba(255,255,255,.12); }
.sidebar-foot { border-top-color: rgba(255,255,255,.1); }
.sidebar-foot > a { border-radius: 9px; transition: color .18s ease, background .18s ease; }
.sidebar-foot > a:hover { color: #fff; background: rgba(255,255,255,.06); }
.admin-topbar {
  height: 82px;
  padding: 0 40px;
  border-bottom-color: rgba(218, 225, 238, .92);
  background: rgba(255,255,255,.86);
  box-shadow: 0 6px 24px rgba(45, 61, 93, .055);
}
.admin-topbar h1 { font-size: 22px; letter-spacing: -.01em; }
.admin-topbar .eyebrow { color: #5f6ed1; font-size: 10px; }
.topbar-actions { gap: 8px; }
.topbar-actions .icon-btn { border-color: #dce3ef; box-shadow: 0 4px 12px rgba(42, 57, 91, .05); transition: transform .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease; }
.topbar-actions .icon-btn:hover { transform: translateY(-2px); color: #555dce; border-color: #c9d0f1; box-shadow: 0 8px 18px rgba(61, 71, 143, .12); }
.live-chip { padding: 9px 14px; color: #5e6e83; border-color: #dbe6e5; background: #fbfffe; box-shadow: 0 5px 15px rgba(35, 103, 91, .06); }
.live-chip span { animation: admin-live-pulse 2.4s ease-in-out infinite; }
@keyframes admin-live-pulse { 0%, 100% { box-shadow: 0 0 0 4px rgba(22,174,122,.08); } 50% { box-shadow: 0 0 0 7px rgba(22,174,122,.16); } }
.admin-content { width: min(1600px, 100%); padding: 36px 40px 64px; }
.section-toolbar { min-height: 66px; margin-bottom: 24px; }
.section-toolbar > div:first-child { position: relative; padding-left: 16px; }
.section-toolbar > div:first-child::before {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 4px;
  border-radius: 9px;
  background: linear-gradient(180deg, #5a6fe1, #9c54dc);
}
.section-toolbar h2 { margin-bottom: 7px; font-size: 25px; letter-spacing: -.02em; }
.section-toolbar p { font-size: 12px; color: #74839a; }
.toolbar-actions { gap: 8px; }
.btn { min-height: 43px; border-radius: 9px; box-shadow: 0 4px 12px rgba(43, 55, 89, .045); }
.btn-primary { box-shadow: 0 12px 24px rgba(96, 83, 215, .25), inset 0 1px 0 rgba(255,255,255,.16); }
.btn-secondary { background: #fbfcff; }
.stat-grid { gap: 18px; }
.stat-card {
  min-height: 144px;
  padding: 22px;
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  border-color: #dfe6f1;
  box-shadow: 0 10px 28px rgba(45, 62, 97, .065);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.stat-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: #6670de; }
.stat-card.accent-green::before { background: #19ab7d; }
.stat-card.accent-cyan::before { background: #1ba7c3; }
.stat-card.accent-orange::before { background: #e9993b; }
.stat-card:hover { transform: translateY(-3px); border-color: #d0d9eb; box-shadow: 0 17px 34px rgba(45, 62, 97, .11); }
.stat-icon { width: 46px; height: 46px; border-radius: 13px; }
.stat-card strong { font-size: 30px; letter-spacing: -.025em; }
.stat-card small { margin-top: 13px; }
.dashboard-grid { gap: 18px; }
.data-panel, .table-panel {
  border-radius: 14px;
  border-color: #dfe6f1;
  box-shadow: 0 10px 28px rgba(45, 62, 97, .055);
}
.data-panel { padding: 22px; }
.panel-heading h3 { font-size: 16px; letter-spacing: -.01em; }
.metric-chip { padding: 7px 10px; border: 1px solid #e0e2fa; border-radius: 8px; background: #f5f5ff; }
.trend-chart { margin-top: 23px; border-bottom-color: #e3e8f1; }
.trend-bar { box-shadow: 0 6px 14px rgba(85, 93, 211, .15); }
.recent-panel { margin-top: 18px; }
.filter-bar {
  min-height: 66px;
  margin-bottom: 14px;
  padding: 11px 14px;
  border-radius: 12px;
  border-color: #dfe6f1;
  background: rgba(255,255,255,.88);
  box-shadow: 0 7px 20px rgba(45, 62, 97, .04);
}
.filter-bar input, .filter-bar select { background: #fbfcfe; }
.customer-summary-bar {
  min-height: 58px;
  margin-bottom: 16px;
  border-radius: 13px;
  border-color: #dce4f2;
  background: linear-gradient(100deg, rgba(255,255,255,.96), rgba(246,249,255,.94));
  box-shadow: 0 8px 23px rgba(45, 62, 97, .045);
}
.customer-pool-list { gap: 14px; }
.customer-pool-item {
  border-radius: 14px;
  border-color: #dce4f0;
  box-shadow: 0 9px 24px rgba(45, 62, 97, .06);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.customer-pool-item:hover { transform: translateY(-2px); border-color: #cbd6ea; box-shadow: 0 15px 30px rgba(45, 62, 97, .095); }
.customer-pool-item.expanded { border-color: #afb9ed; box-shadow: 0 14px 32px rgba(79, 83, 181, .12); }
.customer-pool-main { min-height: 0; padding: 12px 14px; gap: 10px; }
/* Desktop card mirrors the mobile card layout: heading, metrics strip, then a
   two-column action grid at the bottom. */
.customer-pool-main { grid-template-columns: 1fr; }
.customer-pool-heading { grid-column: auto; }
.customer-pool-icon { width: 34px; height: 34px; border-radius: 10px; background: #eef0ff; box-shadow: none; }
.customer-pool-icon svg { width: 19px; height: 19px; }
.customer-pool-heading strong { font-size: 13px; }
.customer-pool-heading small { color: #8692a6; }
.customer-pool-metrics { grid-column: auto; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid #edf0f5; border-radius: 9px; background: #fafbfd; }
.customer-pool-metrics span { padding: 9px 10px; text-align: center; }
.customer-pool-metrics small { font-size: 9px; }
.customer-pool-metrics strong { font-size: 16px; }
.customer-pool-actions { grid-column: auto; justify-content: stretch; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.customer-pool-actions .customer-action-btn { width: 100%; min-height: 38px; padding: 0 12px; font-size: 10px; border-radius: 8px; }
.customer-pool-actions .customer-action-btn svg { width: 15px; height: 15px; }
.customer-pool-actions .customer-switch { display: none; }
.customer-pool-detail { padding: 17px 18px 19px; background: #f8faff; }
.customer-pool-detail .table-scroll { border-color: #e0e7f1; box-shadow: 0 5px 15px rgba(45, 62, 97, .035); }

@media (max-width: 1180px) and (min-width: 821px) {
  .admin-app { grid-template-columns: 224px minmax(0, 1fr); }
  .admin-topbar { padding: 0 28px; }
  .admin-content { padding: 30px 28px 56px; }
  .customer-section-toolbar { grid-template-columns: minmax(0, 1fr) minmax(260px, 460px); }
  .customer-section-toolbar .toolbar-actions { grid-column: 1 / -1; justify-self: end; }
  .customer-pool-main { grid-template-columns: 1fr; gap: 10px; }
  .customer-pool-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .admin-body::before { opacity: .26; background-size: 30px 30px; }
  .admin-topbar { height: 64px; padding: 0 16px; box-shadow: 0 5px 18px rgba(45, 61, 93, .07); }
  .admin-content { padding: 22px 16px calc(92px + env(safe-area-inset-bottom)); }
  .section-toolbar { min-height: 0; margin-bottom: 19px; gap: 14px; }
  .section-toolbar h2 { font-size: 22px; }
  .stat-card { border-radius: 12px; }
  .data-panel, .table-panel { border-radius: 12px; }
  .customer-summary-bar { border-radius: 11px; }
  .customer-pool-list { grid-template-columns: 1fr; }
  .customer-pool-item { border-radius: 12px; }
  .customer-pool-item:hover { transform: none; }
  .customer-pool-main { min-height: 0; padding: 13px 14px; }
  .customer-action-btn { min-height: 48px; }
  .customer-section-toolbar { grid-template-columns: 1fr; gap: 12px; }
  .customer-section-toolbar .search-field { justify-self: stretch; }
  .customer-section-toolbar .toolbar-actions { justify-self: stretch; }
  .customer-section-toolbar .toolbar-actions .btn { width: 100%; }
  .customer-toolbar-actions { align-items: stretch; flex-direction: column; }
  .customer-sort-control { justify-content: space-between; }
  .customer-sort-control select { flex: 1; width: auto; }
  .customer-summary-bar { align-items: stretch; flex-direction: column; gap: 12px; padding: 12px 14px; }
  .customer-summary-left { justify-content: space-between; gap: 10px; }
  .customer-summary-left > span + span { padding-left: 10px; }
  .customer-summary-left strong { font-size: 15px; }
  .customer-claim-selector { justify-content: space-between; gap: 8px; }
  .customer-claim-tabs { flex: 1; justify-content: stretch; }
  .customer-claim-tab { flex: 1; }
  /* Re-assert the mobile bottom navigation over the desktop-only polish
     block below (which is written without a media query and would otherwise
     override the fixed bottom bar). */
  .admin-app { display: block; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .sidebar {
    width: 100%;
    height: calc(66px + env(safe-area-inset-bottom));
    position: fixed;
    z-index: 70;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    padding: 5px 8px env(safe-area-inset-bottom);
    border-right: 0;
    color: #68738a;
    background: rgba(255,255,255,.97);
    border-top: 1px solid var(--border);
    box-shadow: 0 -10px 30px rgba(24,34,55,.08);
    backdrop-filter: blur(16px);
  }
  .sidebar::before { display: none; }
  .admin-brand, .sidebar-foot { display: none; }
  .admin-nav { width: 100%; height: 100%; margin: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; }
  .nav-item {
    min-width: 0;
    min-height: 56px;
    padding: 5px 2px;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    position: relative;
    color: #7b8699;
    background: transparent;
    text-align: center;
    transform: none;
    transition: none;
  }
  .nav-item:hover { transform: none; color: #5963c8; background: transparent; }
  .nav-item.active {
    transform: none;
    color: var(--violet);
    background: transparent;
    box-shadow: none;
  }
  .nav-item svg { width: 20px; height: 20px; flex: 0 0 auto; }
  .nav-item span { width: 100%; overflow: hidden; font-size: 9px; line-height: 1; text-overflow: ellipsis; white-space: nowrap; }
  .nav-item b { min-width: 16px; position: absolute; top: 3px; left: calc(50% + 8px); padding: 2px 4px; border-radius: 9px; color: #fff; background: #6265d6; font-size: 8px; line-height: 1.2; }
  .nav-item.active b { color: #fff; }
}

@media (max-width: 520px) {
  .admin-content { padding-left: 12px; padding-right: 12px; }
  .section-toolbar h2 { font-size: 20px; }
  .section-toolbar > div:first-child { padding-left: 12px; }
  .section-toolbar > div:first-child::before { width: 3px; }
  .stat-card { min-height: 122px; padding: 15px; }
  .stat-card strong { font-size: 24px; }
  .customer-pool-main { padding: 11px 12px; }
  .customer-pool-metrics strong { font-size: 15px; }
  .customer-pool-metrics span { padding: 8px 8px; }
  .customer-pool-actions { gap: 6px; }
  .customer-pool-actions .customer-action-btn { min-height: 50px; }
}
