/* ════════════════════════════════════════════════════════════════════════════
   css/icms-pay.css — the payment dialogs (2026-10-03).

   §1  The "Top up" dialog (partials/_topup-modal.html, js/icms-topup.js)
   §2  The "Top up" button in the top bar, beside "Support ticket"
   §3  The All-Access Bundle and the waiting-for-M-Pesa dialogs
       (partials/shared-modals.html), restyled to match §1

   Brief: stylish, a comfortable width, and short enough to fit a laptop
   screen with NO scrolling. Sizes step down on short screens (§1.9) rather
   than letting the card scroll.

   ⚠️  css/responsive.css forces bare p/li/td/th to 16px !important and every
   label to 14px bold — the markup uses <div>/<span>, and label rules here
   restate their size with !important where it matters.
   Loaded last from partials/_head.html so it wins without a fight.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── §1 Top-up dialog ──────────────────────────────────────────────────── */
.icms-pay {
	--pay-ink: #0f172a;
	--pay-muted: #64748b;
	--pay-line: #e2e8f0;
	--pay-soft: #f8fafc;
	--pay-gold: #f5b70a;
	--pay-gold-soft: #fff8e1;
	--pay-green: #16a34a;
	--pay-green-dark: #15803d;
	position: fixed;
	inset: 0;
	z-index: 10060;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(15, 23, 42, 0.55);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
	animation: icmsPayFade 0.18s ease-out;
}
.icms-pay[hidden] { display: none !important; }
@keyframes icmsPayFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes icmsPayRise { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }

.icms-pay__card {
	position: relative;
	width: min(480px, 100%);
	max-height: calc(100dvh - 32px);
	overflow-y: auto;
	overscroll-behavior: contain;
	background: #fff;
	border-radius: 22px;
	padding: 20px 22px 18px;
	box-shadow: 0 30px 80px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(15, 23, 42, 0.04);
	animation: icmsPayRise 0.22s cubic-bezier(.2, .8, .2, 1);
	color: var(--pay-ink);
	box-sizing: border-box;
}
.icms-pay__card::before {
	/* gold hairline across the top — the brand accent, nothing heavier */
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	height: 4px;
	border-radius: 22px 22px 0 0;
	background: linear-gradient(90deg, #f5b70a, #fbbf24 45%, #16a34a);
}
.icms-pay__view[hidden] { display: none !important; }

.icms-pay__x {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 50%;
	background: #f1f5f9;
	color: #475569;
	font-size: 15px;
	cursor: pointer;
	display: grid;
	place-items: center;
	transition: background 0.15s, color 0.15s;
	z-index: 1;
}
.icms-pay__x:hover { background: #e2e8f0; color: var(--pay-ink); }

/* §1.1 Header */
.icms-pay__head { display: flex; align-items: center; gap: 12px; margin: 2px 36px 12px 0; }
.icms-pay__badge {
	flex: none;
	width: 44px;
	height: 44px;
	border-radius: 14px;
	display: grid;
	place-items: center;
	color: #fff;
	font-size: 19px;
	background: linear-gradient(135deg, #0f172a, #334155);
	box-shadow: 0 8px 18px rgba(15, 23, 42, 0.25), inset 0 0 0 2px rgba(245, 183, 10, 0.55);
}
.icms-pay__badge i { color: #fbbf24; }
.icms-pay__title { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; color: var(--pay-ink); }
.icms-pay__sub { font-size: 13px; line-height: 1.45; color: var(--pay-muted); margin-top: 2px; }
.icms-pay__center { text-align: center; }

.icms-pay__note {
	font-size: 12.5px;
	line-height: 1.45;
	color: #92400e;
	background: var(--pay-gold-soft);
	border: 1px solid #fde68a;
	border-radius: 12px;
	padding: 8px 11px;
	margin: 0 0 10px;
}
.icms-pay__offer { margin: 0 0 10px; }

/* §1.2 Section labels */
.icms-pay .icms-pay__label {
	display: flex;
	align-items: center;
	gap: 7px;
	margin: 12px 0 6px;
	font-size: 12.5px !important;
	font-weight: 700 !important;
	letter-spacing: 0.02em;
	color: #334155 !important;
	text-transform: none;
}
.icms-pay__num {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--pay-ink);
	color: #fbbf24;
	font-size: 10.5px;
	font-weight: 800;
	display: inline-grid;
	place-items: center;
}

/* §1.3 Module tiles — 2 × 2 */
.icms-pay__mods { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.icms-pay__mod {
	display: grid;
	grid-template-columns: 30px 1fr;
	grid-template-rows: auto auto;
	column-gap: 9px;
	align-items: center;
	text-align: left;
	padding: 9px 10px;
	border: 1.5px solid var(--pay-line);
	border-radius: 14px;
	background: #fff;
	cursor: pointer;
	transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.1s;
	min-width: 0;
	font: inherit;
	color: inherit;
}
.icms-pay__mod:hover { border-color: #cbd5e1; background: var(--pay-soft); }
.icms-pay__mod:active { transform: scale(0.985); }
.icms-pay__mod > i {
	grid-row: 1 / span 2;
	width: 30px;
	height: 30px;
	border-radius: 9px;
	display: grid;
	place-items: center;
	background: #f1f5f9;
	color: #475569;
	font-size: 13px;
	transition: background 0.15s, color 0.15s;
}
.icms-pay__modname { font-size: 12.5px; font-weight: 700; line-height: 1.2; color: var(--pay-ink); min-width: 0; }
.icms-pay__modbal { font-size: 11.5px; color: var(--pay-muted); line-height: 1.3; }
.icms-pay__modbal b { color: var(--pay-ink); font-weight: 800; }
.icms-pay__mod[aria-checked="true"] {
	border-color: var(--pay-gold);
	background: var(--pay-gold-soft);
	box-shadow: 0 0 0 3px rgba(245, 183, 10, 0.18);
}
.icms-pay__mod[aria-checked="true"] > i { background: var(--pay-ink); color: #fbbf24; }
.icms-pay__mod:focus-visible, .icms-pay__chip:focus-visible, .icms-pay__go:focus-visible,
.icms-pay__ghost:focus-visible, .icms-pay__link:focus-visible, .icms-pay__x:focus-visible {
	outline: 3px solid rgba(245, 183, 10, 0.55);
	outline-offset: 2px;
}

/* §1.4 Inputs */
.icms-pay__field {
	display: flex;
	align-items: stretch;
	border: 1.5px solid var(--pay-line);
	border-radius: 14px;
	overflow: hidden;
	background: #fff;
	transition: border-color 0.15s, box-shadow 0.15s;
}
.icms-pay__field:focus-within { border-color: var(--pay-gold); box-shadow: 0 0 0 3px rgba(245, 183, 10, 0.18); }
.icms-pay__field.is-bad { border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14); }
.icms-pay__affix {
	display: flex;
	align-items: center;
	padding: 0 12px;
	background: var(--pay-soft);
	border-right: 1px solid var(--pay-line);
	color: #475569;
	font-size: 13px;
	font-weight: 700;
}
.icms-pay .icms-pay__input {
	flex: 1;
	min-width: 0;
	height: 44px;
	border: 0 !important;
	outline: 0 !important;
	box-shadow: none !important;
	background: transparent !important;
	margin: 0 !important;
	padding: 0 12px !important;
	font-size: 17px !important;
	font-weight: 700;
	color: var(--pay-ink);
	letter-spacing: 0.01em;
	border-radius: 0 !important;
}
.icms-pay .icms-pay__input::placeholder { color: #94a3b8; font-weight: 500; }

/* §1.5 Amount chips */
.icms-pay__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.icms-pay__chip {
	position: relative;
	padding: 6px 12px;
	border: 1.5px solid var(--pay-line);
	border-radius: 999px;
	background: #fff;
	font: inherit;
	font-size: 12.5px;
	font-weight: 700;
	color: #334155;
	cursor: pointer;
	transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.icms-pay__chip:hover { border-color: #cbd5e1; background: var(--pay-soft); }
.icms-pay__chip.is-on { border-color: var(--pay-ink); background: var(--pay-ink); color: #fff; }
.icms-pay__chip small {
	font-size: 10px;
	font-weight: 800;
	color: #15803d;
	margin-left: 4px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}
.icms-pay__chip.is-on small { color: #86efac; }

/* §1.6 Result — what the money buys */
.icms-pay__result {
	margin-top: 12px;
	padding: 11px 14px;
	border-radius: 16px;
	color: #fff;
	background:
		radial-gradient(120% 140% at 100% 0%, rgba(245, 183, 10, 0.28), transparent 55%),
		linear-gradient(135deg, #0f172a, #1e293b);
}
.icms-pay__get { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.icms-pay__getlbl { font-size: 12px; font-weight: 700; color: #cbd5e1; text-transform: uppercase; letter-spacing: 0.06em; }
.icms-pay__getval { font-size: 17px; font-weight: 800; text-align: right; line-height: 1.25; }
.icms-pay__getval em { font-style: normal; color: #fbbf24; }
.icms-pay__rate { font-size: 11.5px; color: #94a3b8; margin-top: 3px; line-height: 1.4; }

.icms-pay__err {
	margin-top: 10px;
	font-size: 12.5px;
	line-height: 1.45;
	color: #b91c1c;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 12px;
	padding: 8px 11px;
}

/* §1.7 Buttons */
.icms-pay__go {
	width: 100%;
	height: 48px;
	margin-top: 14px;
	border: 0;
	border-radius: 14px;
	background: linear-gradient(180deg, #22c55e, var(--pay-green));
	color: #fff;
	font: inherit;
	font-size: 15.5px;
	font-weight: 800;
	letter-spacing: 0.01em;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 9px;
	cursor: pointer;
	box-shadow: 0 10px 22px rgba(22, 163, 74, 0.3), inset 0 -2px 0 rgba(0, 0, 0, 0.12);
	transition: transform 0.1s, box-shadow 0.15s, filter 0.15s;
}
.icms-pay__go:hover { filter: brightness(1.04); box-shadow: 0 12px 26px rgba(22, 163, 74, 0.36), inset 0 -2px 0 rgba(0, 0, 0, 0.12); }
.icms-pay__go:active { transform: translateY(1px); }
.icms-pay__go[disabled] { opacity: 0.6; cursor: not-allowed; filter: grayscale(0.3); }
.icms-pay__go--slim { margin-top: 0; height: 44px; font-size: 14px; flex: 1.4; }
.icms-pay__ghost {
	flex: 1;
	height: 44px;
	border: 1.5px solid var(--pay-line);
	border-radius: 14px;
	background: #fff;
	color: #334155;
	font: inherit;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
}
.icms-pay__ghost:hover { background: var(--pay-soft); }
.icms-pay__row { display: flex; gap: 8px; margin-top: 14px; }
.icms-pay__link {
	border: 0;
	background: none;
	padding: 0;
	font: inherit;
	font-size: 12.5px;
	font-weight: 700;
	color: #b45309;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 3px;
}
.icms-pay__center-block { display: block; margin: 10px auto 0; }
.icms-pay__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	flex-wrap: wrap;
	margin-top: 11px;
	font-size: 12.5px;
	color: var(--pay-muted);
}
.icms-pay__foot b { color: var(--pay-ink); }
.icms-pay__foot i { color: var(--pay-gold); }

/* §1.8 Waiting + done */
.icms-pay__phone {
	position: relative;
	width: 72px;
	height: 72px;
	margin: 6px auto 12px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background: #ecfdf5;
	color: var(--pay-green);
	font-size: 30px;
}
.icms-pay__ring {
	position: absolute;
	inset: -6px;
	border-radius: 50%;
	border: 3px solid rgba(22, 163, 74, 0.25);
	border-top-color: var(--pay-green);
	animation: icmsPaySpin 1.1s linear infinite;
}
@keyframes icmsPaySpin { to { transform: rotate(360deg); } }
.icms-pay__steps { margin: 14px 0 0; display: grid; gap: 7px; }
.icms-pay__steps > div {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 8px 11px;
	background: var(--pay-soft);
	border: 1px solid var(--pay-line);
	border-radius: 12px;
	font-size: 13px;
	line-height: 1.45;
	color: #334155;
}
.icms-pay__steptx { flex: 1 1 auto; min-width: 0; }
.icms-pay__steps b { color: var(--pay-ink); }
.icms-pay__steps span {
	flex: none;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--pay-ink);
	color: #fbbf24;
	font-size: 11px;
	font-weight: 800;
	display: grid;
	place-items: center;
	margin-top: 1px;
}
.icms-pay__tick {
	width: 72px;
	height: 72px;
	margin: 8px auto 12px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background: linear-gradient(180deg, #22c55e, var(--pay-green));
	color: #fff;
	font-size: 32px;
	box-shadow: 0 12px 28px rgba(22, 163, 74, 0.35), 0 0 0 8px #ecfdf5;
	animation: icmsPayRise 0.3s cubic-bezier(.2, .8, .2, 1);
}
.icms-pay__summary {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	margin-top: 14px;
}
.icms-pay__summary > div {
	padding: 10px 12px;
	border-radius: 14px;
	background: var(--pay-soft);
	border: 1px solid var(--pay-line);
	text-align: center;
}
.icms-pay__summary span { display: block; font-size: 11.5px; font-weight: 700; color: var(--pay-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.icms-pay__summary b { display: block; font-size: 20px; font-weight: 800; color: var(--pay-ink); margin-top: 2px; }

/* §1.9 Short and narrow screens — tighten, never scroll if avoidable */
@media (max-height: 720px) {
	.icms-pay__card { padding: 16px 18px 14px; }
	.icms-pay__head { margin-bottom: 8px; }
	.icms-pay__badge { width: 38px; height: 38px; font-size: 16px; border-radius: 12px; }
	.icms-pay .icms-pay__label { margin: 9px 0 5px; }
	.icms-pay__mod { padding: 7px 9px; }
	.icms-pay .icms-pay__input { height: 40px; }
	.icms-pay__result { padding: 9px 12px; margin-top: 9px; }
	.icms-pay__go { height: 44px; margin-top: 11px; }
	.icms-pay__chips { margin-top: 6px; }
}
@media (max-height: 620px) {
	.icms-pay__sub, .icms-pay__rate { display: none; }
	.icms-pay__steps > div { padding: 6px 10px; }
}
@media (max-width: 420px) {
	.icms-pay { padding: 10px; align-items: flex-end; }
	.icms-pay__card { border-radius: 20px; padding: 16px 14px 14px; max-height: calc(100dvh - 20px); }
	.icms-pay__mods { gap: 6px; }
	.icms-pay__mod { grid-template-columns: 26px 1fr; column-gap: 7px; padding: 7px 8px; }
	.icms-pay__mod > i { width: 26px; height: 26px; font-size: 12px; }
	.icms-pay__modname { font-size: 11.5px; }
	.icms-pay__title { font-size: 17px; }
	/* The four amounts stay on one row; "best value" sits under its amount. */
	.icms-pay__chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
	.icms-pay__chip { padding: 6px 2px; font-size: 12px; border-radius: 12px; line-height: 1.15; }
	.icms-pay__chip small { display: block; margin: 1px 0 0; font-size: 8.5px; }
}

/* ── §2 Top-bar "Top up" button ────────────────────────────────────────── */
.icms-topupbtn {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 7px;
	height: 36px;
	padding: 0 12px 0 10px;
	border: 1px solid #bbf7d0;
	border-radius: 999px;
	background: #f0fdf4;
	color: #14532d;
	font: inherit;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.icms-topupbtn:hover { background: #dcfce7; border-color: #86efac; box-shadow: 0 4px 12px rgba(22, 163, 74, 0.15); }
.icms-topupbtn > i { color: #16a34a; font-size: 14px; }
.icms-topupbtn__wallet {
	padding: 2px 7px;
	border-radius: 999px;
	background: #fff;
	border: 1px solid #bbf7d0;
	font-size: 11.5px;
	font-weight: 800;
	color: #166534;
}
.icms-topupbtn__wallet[hidden] { display: none; }
/* Tablets keep the words "Top up" (clearer than an icon for every trainer);
   the wallet amount moves into the dialog. Phones show the wallet icon with
   a small plus badge so it still reads as "add money". */
@media (max-width: 1100px) {
	.icms-topupbtn__wallet { display: none; }
	.icms-topupbtn { padding: 0 11px 0 10px; }
}
@media (max-width: 600px) {
	.icms-topupbtn__label { display: none; }
	.icms-topupbtn { width: 36px; padding: 0; justify-content: center; }
	.icms-topupbtn::after {
		content: "+";
		position: absolute;
		top: -3px;
		right: -3px;
		width: 15px;
		height: 15px;
		border-radius: 50%;
		background: #16a34a;
		color: #fff;
		font-size: 12px;
		font-weight: 800;
		line-height: 15px;
		text-align: center;
		box-shadow: 0 0 0 2px #fff;
	}
}

/* ── §3 Bundle + waiting dialogs, matched to §1 ────────────────────────── */
#bundleModal .modal-box,
#stkModal .modal-box {
	border-radius: 22px !important;
	padding: 20px 22px 18px !important;
	max-width: 480px !important;
	width: min(480px, calc(100vw - 32px)) !important;
	max-height: calc(100dvh - 32px) !important;
	box-shadow: 0 30px 80px rgba(15, 23, 42, 0.35) !important;
	overflow-y: auto;
	position: relative;
}
#bundleModal .modal-box::before,
#stkModal .modal-box::before {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	height: 4px;
	border-radius: 22px 22px 0 0;
	background: linear-gradient(90deg, #f5b70a, #fbbf24 45%, #16a34a);
}
#bundleModal .modal-logo .icon,
#stkModal .modal-logo .icon { font-size: 30px !important; }
#bundleModal .modal-logo h2,
#stkModal .modal-logo h2 { font-size: 19px !important; font-weight: 800 !important; margin: 8px 0 2px !important; }
#bundleModal #bundleTiers { gap: 8px !important; margin: 12px 0 !important; }
#bundleModal .bundle-option {
	border-radius: 14px !important;
	padding: 10px 14px !important;
	transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
#bundleModal .bundle-option:hover { background: #f8fafc !important; }
#bundleModal .btn-gold,
#bundleModal #bundleProceedBtn {
	height: 48px;
	border-radius: 14px !important;
	background: linear-gradient(180deg, #22c55e, #16a34a) !important;
	color: #fff !important;
	border: 0 !important;
	box-shadow: 0 10px 22px rgba(22, 163, 74, 0.3) !important;
}
#bundleModal .btn-ghost { height: 48px; border-radius: 14px !important; }
#stkModal .modal-box > div[style*="f0fdf4"] { margin: 14px 0 !important; padding: 16px !important; border-radius: 16px !important; }
#stkModal .mbtn { border-radius: 14px !important; }
@media (max-height: 720px) {
	#bundleModal .modal-logo .icon { display: none; }
	#bundleModal .modal-box { padding: 16px 18px 14px !important; }
}

/* §1.5b Plans — a tool's fixed packages, or the bundle tiers (2026-10-04).
   Same tile language as the tool picker above: gold when chosen. Four plans
   sit 2 × 2, the three bundle tiers in one row. The blocks the dialog swaps
   between modes are hidden with the attribute, which must beat any display. */
#icmsTopupModBlock[hidden], #icmsTopupAmountBlock[hidden], #icmsTopupPlanBlock[hidden],
.icms-pay__link[hidden] { display: none !important; }
.icms-pay__plans { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.icms-pay__plans.is-three { grid-template-columns: repeat(3, 1fr); }
.icms-pay__plan {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 1px;
	padding: 9px 11px;
	border: 1.5px solid var(--pay-line);
	border-radius: 14px;
	background: #fff;
	font: inherit;
	text-align: left;
	cursor: pointer;
	min-width: 0;
	transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.icms-pay__plan:hover { border-color: #cbd5e1; background: var(--pay-soft); }
.icms-pay__plan:active { transform: scale(0.985); }
.icms-pay__plan:focus-visible { outline: 3px solid rgba(245, 183, 10, 0.45); outline-offset: 2px; }
.icms-pay__plan[aria-checked="true"] { border-color: var(--pay-gold); background: var(--pay-gold-soft); }
.icms-pay__planname { font-size: 10.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--pay-muted); }
.icms-pay__plancr { font-size: 14px; font-weight: 800; color: var(--pay-ink); line-height: 1.25; }
.icms-pay__planprice { font-size: 12.5px; font-weight: 700; color: #334155; }
.icms-pay__plantag { font-size: 10px; font-weight: 800; color: #15803d; text-transform: uppercase; letter-spacing: 0.03em; }
.icms-pay__links { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; justify-content: flex-end; }
@media (max-width: 420px) { .icms-pay__plans.is-three { grid-template-columns: 1fr 1fr; } }
