/* ==========================================================================
   ivri-ui.css — payment & support modals, help button
   Everything is prefixed .iv- so it never clashes with page styles.
   ========================================================================== */
.iv-root {
  --iv-bg: #0a0d1c; --iv-panel: #121834; --iv-panel-2: #182046; --iv-line: rgba(201,160,78,.22);
  --iv-gold: #c9a04e; --iv-gold-2: #e3c27a; --iv-ink: #f8fafc; --iv-soft: #9aa6c4;
  --iv-green: #16a34a; --iv-green-2: #22c55e; --iv-red: #f43f5e; --iv-blue: #4d6bff;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--iv-ink); -webkit-font-smoothing: antialiased;
}
.iv-root *, .iv-root *::before, .iv-root *::after { box-sizing: border-box; }

/* ---------------------------------------------------------------- help FAB */
.iv-fab {
  position: fixed; z-index: 250; right: max(16px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 18px 0 14px;
  border-radius: 999px; border: 1px solid rgba(255,255,255,.18); cursor: pointer;
  background: linear-gradient(135deg, #2b44c7, var(--iv-blue)); color: #fff;
  font: 600 .92rem/1 'Inter', system-ui, sans-serif; box-shadow: 0 8px 24px rgba(10,13,28,.55);
  transition: transform .2s ease, box-shadow .2s ease;
}
.iv-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(10,13,28,.65); }
.iv-fab svg { width: 20px; height: 20px; }
.iv-fab .iv-dot {
  position: absolute; top: -4px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--iv-red); color: #fff; font-size: .72rem; display: none; align-items: center; justify-content: center;
  border: 2px solid var(--iv-bg);
}
.iv-fab .iv-dot.on { display: inline-flex; }
@media (max-width: 360px) { .iv-fab .iv-fab-label { display: none; } .iv-fab { padding: 0 14px; } }

/* ------------------------------------------------------------------- modal */
.iv-overlay {
  position: fixed; inset: 0; z-index: 1000; background: rgba(4,6,16,.78); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .2s ease;
}
.iv-overlay.on { opacity: 1; }
@media (min-width: 600px) { .iv-overlay { align-items: center; padding: 20px; } }
.iv-modal {
  position: relative; width: 100%; max-width: 460px; max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  background: linear-gradient(180deg, var(--iv-panel-2), var(--iv-panel) 140px); border: 1px solid var(--iv-line);
  border-radius: 20px 20px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(0,0,0,.5); transform: translateY(24px); transition: transform .25s cubic-bezier(.2,.9,.3,1.1);
}
@media (min-width: 600px) { .iv-modal { border-radius: 20px; padding: 26px 26px 24px; } }
.iv-overlay.on .iv-modal { transform: none; }
.iv-modal::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; border-radius: 20px 20px 0 0;
  background: linear-gradient(90deg, var(--iv-gold), var(--iv-blue)); }
.iv-x { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.06); color: var(--iv-soft); font-size: 1.2rem; line-height: 1; }
.iv-x:hover { background: rgba(255,255,255,.12); color: #fff; }
.iv-back { background: none; border: 0; color: var(--iv-soft); cursor: pointer; padding: 4px 0; font-size: .85rem; margin-bottom: 6px; }
.iv-back:hover { color: #fff; }

.iv-h { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 1.75rem; font-weight: 700; color: var(--iv-gold); margin: 2px 40px 4px 0; line-height: 1.15; }
.iv-sub { color: var(--iv-soft); font-size: .9rem; line-height: 1.5; margin: 0 0 18px; }
.iv-label { display: block; font-size: .8rem; color: var(--iv-soft); margin: 16px 0 7px; font-weight: 500; letter-spacing: .2px; }
.iv-small { font-size: .78rem; color: var(--iv-soft); line-height: 1.5; }
.iv-center { text-align: center; }

/* ---------------------------------------------------------------- packages */
.iv-pkgs { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 9px; }
.iv-pkg { position: relative; text-align: left; padding: 13px 12px; border-radius: 12px; cursor: pointer; color: var(--iv-ink);
  background: rgba(0,0,0,.22); border: 1.5px solid var(--iv-line); font: inherit; transition: border-color .15s, background .15s; }
.iv-pkg:hover { border-color: rgba(201,160,78,.55); }
.iv-pkg.on { border-color: var(--iv-gold); background: rgba(201,160,78,.12); }
.iv-pkg.on::after { content: '✓'; position: absolute; top: 8px; right: 10px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--iv-gold); color: var(--iv-bg); font-size: .75rem; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.iv-tag { display: inline-block; font-size: .64rem; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; color: var(--iv-bg);
  background: linear-gradient(135deg, var(--iv-gold), var(--iv-gold-2)); padding: 2px 7px; border-radius: 999px; margin-bottom: 6px; }
.iv-pkg b { display: block; font-size: .92rem; margin-bottom: 4px; padding-right: 20px; }
.iv-pkg .iv-price { font-family: 'Roboto Mono', ui-monospace, monospace; color: var(--iv-gold); font-weight: 700; font-size: 1rem; }
.iv-pkg small { display: block; color: var(--iv-soft); font-size: .72rem; margin-top: 3px; }

/* ------------------------------------------------------------------ inputs */
.iv-phone { display: flex; align-items: stretch; border: 1.5px solid var(--iv-line); border-radius: 12px; overflow: hidden; background: rgba(0,0,0,.25); }
.iv-phone:focus-within { border-color: var(--iv-gold); box-shadow: 0 0 0 3px rgba(201,160,78,.15); }
.iv-phone span { display: flex; align-items: center; gap: 6px; padding: 0 12px; color: var(--iv-soft); border-right: 1px solid var(--iv-line); font-size: .9rem; white-space: nowrap; }
.iv-input, .iv-textarea, .iv-select {
  width: 100%; border: 1.5px solid var(--iv-line); border-radius: 12px; background: rgba(0,0,0,.25); color: var(--iv-ink);
  padding: 13px 14px; font: 500 1rem/1.4 'Inter', system-ui, sans-serif; outline: none;
}
.iv-phone .iv-input { border: 0; border-radius: 0; background: transparent; font-family: 'Roboto Mono', ui-monospace, monospace; letter-spacing: .5px; font-size: 1.08rem; }
.iv-input:focus, .iv-textarea:focus, .iv-select:focus { border-color: var(--iv-gold); box-shadow: 0 0 0 3px rgba(201,160,78,.15); }
.iv-textarea { min-height: 120px; resize: vertical; }
.iv-err { color: #ff8ca0; font-size: .82rem; margin-top: 8px; min-height: 1em; }

/* ----------------------------------------------------------------- buttons */
.iv-btn { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; min-height: 52px; margin-top: 16px;
  border: 0; border-radius: 12px; cursor: pointer; font: 700 1rem/1.2 'Inter', system-ui, sans-serif; text-decoration: none;
  transition: transform .15s ease, filter .15s ease, opacity .15s; }
.iv-btn:hover { filter: brightness(1.07); }
.iv-btn:active { transform: scale(.985); }
.iv-btn[disabled] { opacity: .6; cursor: wait; }
.iv-btn-mpesa { background: linear-gradient(135deg, var(--iv-green), var(--iv-green-2)); color: #fff; box-shadow: 0 6px 18px rgba(22,163,74,.35); }
.iv-btn-gold  { background: linear-gradient(135deg, var(--iv-gold), var(--iv-gold-2)); color: var(--iv-bg); }
.iv-btn-blue  { background: linear-gradient(135deg, #2b44c7, var(--iv-blue)); color: #fff; }
.iv-btn-ghost { background: rgba(255,255,255,.06); color: var(--iv-ink); border: 1px solid rgba(255,255,255,.1); min-height: 46px; font-weight: 600; }
.iv-link { background: none; border: 0; color: var(--iv-gold); cursor: pointer; font: 600 .88rem 'Inter', sans-serif; padding: 10px 4px; text-decoration: underline; text-underline-offset: 3px; }
.iv-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.iv-spin { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: iv-rot .8s linear infinite; }
@keyframes iv-rot { to { transform: rotate(360deg); } }
.iv-secure { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--iv-soft); font-size: .76rem; margin-top: 10px; }

/* ---------------------------------------------------------- waiting screen */
.iv-wait { text-align: center; padding-top: 6px; }
.iv-ring { position: relative; width: 132px; height: 132px; margin: 6px auto 16px; }
.iv-ring svg { width: 132px; height: 132px; transform: rotate(-90deg); }
.iv-ring circle { fill: none; stroke-width: 6; }
.iv-ring .bg { stroke: rgba(255,255,255,.08); }
.iv-ring .fg { stroke: var(--iv-green-2); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.iv-ring .iv-phone-ico { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; }
.iv-ring .iv-phone-ico svg { width: 44px; height: 44px; transform: none; animation: iv-buzz 1.6s ease-in-out infinite; }
.iv-ring .iv-count { font: 700 .85rem 'Roboto Mono', monospace; color: var(--iv-soft); margin-top: 4px; }
@keyframes iv-buzz { 0%,60%,100% { transform: rotate(0); } 65% { transform: rotate(-9deg); } 70% { transform: rotate(9deg); } 75% { transform: rotate(-6deg); } 80% { transform: rotate(6deg); } }
.iv-steps { list-style: none; padding: 0; margin: 16px 0 4px; text-align: left; counter-reset: s; }
.iv-steps li { position: relative; padding: 9px 0 9px 40px; color: var(--iv-soft); font-size: .9rem; line-height: 1.4; counter-increment: s; }
.iv-steps li::before { content: counter(s); position: absolute; left: 0; top: 6px; width: 28px; height: 28px; border-radius: 50%;
  border: 1.5px solid var(--iv-line); color: var(--iv-gold); font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: .82rem; }
.iv-steps li b { color: var(--iv-ink); }
.iv-later { opacity: 0; max-height: 0; overflow: hidden; transition: opacity .3s, max-height .3s; }
.iv-later.on { opacity: 1; max-height: 200px; }

/* ---------------------------------------------------------- success screen */
.iv-ok { text-align: center; }
.iv-check { width: 96px; height: 96px; margin: 8px auto 14px; }
.iv-check circle { fill: rgba(34,197,94,.12); stroke: var(--iv-green-2); stroke-width: 3; stroke-dasharray: 290; stroke-dashoffset: 290; animation: iv-draw .6s ease forwards; }
.iv-check path { fill: none; stroke: var(--iv-green-2); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 60; stroke-dashoffset: 60; animation: iv-draw .35s .5s ease forwards; }
@keyframes iv-draw { to { stroke-dashoffset: 0; } }
.iv-thanks { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 2rem; color: var(--iv-gold); margin: 0 0 6px; font-weight: 700; }
.iv-verse { font-style: italic; color: var(--iv-soft); font-size: .86rem; margin: 14px 4px 0; line-height: 1.5; }
.iv-receipt { margin: 18px 0 4px; border: 1px dashed rgba(201,160,78,.45); border-radius: 12px; padding: 4px 14px; text-align: left; background: rgba(0,0,0,.2); }
.iv-receipt div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.06); font-size: .9rem; }
.iv-receipt div:last-child { border-bottom: 0; }
.iv-receipt span { color: var(--iv-soft); }
.iv-receipt b { font-family: 'Roboto Mono', monospace; font-weight: 600; text-align: right; }
.iv-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 1001; }

.iv-bad { text-align: center; }
.iv-bad .iv-icon { width: 72px; height: 72px; margin: 6px auto 12px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(244,63,94,.12); border: 2px solid rgba(244,63,94,.5); font-size: 2rem; }
.iv-bad .iv-icon.warn { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.55); }

/* ---------------------------------------------------------- paybill steps */
.iv-copy { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 12px 0; }
.iv-copy button { text-align: left; padding: 11px 12px; border-radius: 12px; border: 1.5px solid var(--iv-line); background: rgba(0,0,0,.22);
  color: var(--iv-ink); cursor: pointer; font: inherit; }
.iv-copy button small { display: block; color: var(--iv-soft); font-size: .7rem; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 3px; }
.iv-copy button b { font-family: 'Roboto Mono', monospace; color: var(--iv-gold); font-size: 1.05rem; word-break: break-all; }
.iv-copy button i { font-style: normal; display: block; font-size: .7rem; color: var(--iv-soft); margin-top: 3px; }
.iv-copy button.done i { color: var(--iv-green-2); }
.iv-copy .wide { grid-column: 1 / -1; }
.iv-divider { display: flex; align-items: center; gap: 10px; color: var(--iv-soft); font-size: .78rem; margin: 20px 0 6px; }
.iv-divider::before, .iv-divider::after { content: ''; flex: 1; height: 1px; background: var(--iv-line); }

/* ----------------------------------------------------------------- support */
.iv-tabs { display: flex; gap: 6px; background: rgba(0,0,0,.25); padding: 4px; border-radius: 12px; margin: 4px 0 16px; }
.iv-tabs button { flex: 1; border: 0; border-radius: 9px; padding: 10px; background: transparent; color: var(--iv-soft); cursor: pointer; font: 600 .88rem 'Inter', sans-serif; position: relative; }
.iv-tabs button.on { background: var(--iv-panel-2); color: var(--iv-ink); box-shadow: 0 1px 0 rgba(255,255,255,.06) inset; }
.iv-tabs .iv-badge { display: inline-block; margin-left: 6px; background: var(--iv-red); color: #fff; border-radius: 9px; padding: 1px 7px; font-size: .7rem; }
.iv-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.iv-chip { border: 1.5px solid var(--iv-line); background: rgba(0,0,0,.2); color: var(--iv-ink); border-radius: 999px; padding: 8px 13px; cursor: pointer; font: 500 .84rem 'Inter', sans-serif; }
.iv-chip.on { border-color: var(--iv-gold); background: rgba(201,160,78,.14); color: var(--iv-gold-2); }
.iv-attach { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.iv-attach label { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; color: var(--iv-gold); font-size: .86rem; font-weight: 600;
  padding: 9px 12px; border: 1.5px dashed rgba(201,160,78,.5); border-radius: 10px; }
.iv-attach input { display: none; }
.iv-files { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.iv-file { position: relative; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: rgba(0,0,0,.3); border: 1px solid var(--iv-line);
  display: flex; align-items: center; justify-content: center; font-size: .65rem; color: var(--iv-soft); text-align: center; padding: 4px; }
.iv-file img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.iv-file button { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0,0,0,.7); color: #fff; cursor: pointer; font-size: .75rem; line-height: 1; z-index: 2; }
.iv-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.iv-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.iv-list { display: flex; flex-direction: column; gap: 8px; }
.iv-item { display: block; width: 100%; text-align: left; border: 1px solid var(--iv-line); border-radius: 12px; padding: 12px 14px; background: rgba(0,0,0,.2);
  color: var(--iv-ink); cursor: pointer; font: inherit; }
.iv-item:hover { border-color: rgba(201,160,78,.5); }
.iv-item .t { display: flex; justify-content: space-between; gap: 10px; font-size: .78rem; color: var(--iv-soft); margin-bottom: 4px; }
.iv-item .s { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iv-item.unread { border-color: var(--iv-gold); background: rgba(201,160,78,.08); }
.iv-st { font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .4px; }
.iv-st.open { background: rgba(77,107,255,.2); color: #a5b4ff; }
.iv-st.answered { background: rgba(34,197,94,.18); color: #86efac; }
.iv-st.closed { background: rgba(148,163,184,.18); color: #cbd5e1; }

.iv-thread { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 12px; }
.iv-msg { max-width: 86%; padding: 10px 13px; border-radius: 14px; font-size: .9rem; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.iv-msg.user { align-self: flex-end; background: linear-gradient(135deg, #2b44c7, var(--iv-blue)); border-bottom-right-radius: 4px; }
.iv-msg.admin, .iv-msg.system { align-self: flex-start; background: var(--iv-panel-2); border: 1px solid var(--iv-line); border-bottom-left-radius: 4px; }
.iv-msg .who { display: block; font-size: .7rem; opacity: .75; margin-bottom: 3px; font-weight: 600; }
.iv-msg .at { display: block; font-size: .68rem; opacity: .6; margin-top: 5px; }
.iv-msg a.att { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; color: inherit; font-size: .8rem; text-decoration: underline; }
.iv-msg img { display: block; max-width: 100%; max-height: 200px; border-radius: 8px; margin-top: 6px; }
.iv-empty { text-align: center; color: var(--iv-soft); padding: 26px 10px; font-size: .9rem; }

.iv-toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 1100;
  background: #0f172a; color: #fff; border: 1px solid var(--iv-line); padding: 10px 16px; border-radius: 10px; font-size: .86rem; transition: all .25s; }
.iv-toast.on { opacity: 1; transform: translateX(-50%); }

@media (prefers-reduced-motion: reduce) {
  .iv-root *, .iv-overlay, .iv-modal { animation: none !important; transition: none !important; }
}
body.iv-lock { overflow: hidden; }
