/* SD Topup Vouchers — Poppins + green, matching sdtopup.com.ng */
:root {
  --bg: #f4f8f5;
  --surface: #ffffff;
  --ink: #16261c;
  --muted: #5b6f63;
  --line: #d7e5dc;
  --green: #0f7a43;
  --green-dark: #0a5230;
  --green-soft: #e6f3ea;
  --amber: #8a5d00;
  --amber-soft: #fdf1d6;
  --red: #a8321f;
  --red-soft: #fbe9e5;
  --slate: #2f5d73;
  --slate-soft: #e4eef3;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(10, 82, 48, .06), 0 6px 18px rgba(10, 82, 48, .05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: var(--green); }
a:hover { color: var(--green-dark); }
h1, h2 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.35rem; font-weight: 600; }
h2 { font-size: 1.1rem; font-weight: 600; }
.muted { color: var(--muted); }
.inline { display: inline; margin: 0; }
.wrap { width: 100%; max-width: 980px; margin: 0 auto; padding: 0 18px; }

:focus-visible { outline: 3px solid #7cc39a; outline-offset: 2px; border-radius: 6px; }

/* ---------- Buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 500; font-size: .92rem;
  padding: 10px 18px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--green-dark); color: #fff; }
.btn-block { width: 100%; padding: 12px 18px; font-size: 1rem; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); padding: 7px 12px; font-size: .85rem; }
.btn-ghost:hover:not(:disabled) { border-color: var(--green); color: var(--green-dark); }
.btn-whatsapp { background: #1fa855; color: #fff; padding: 7px 12px; font-size: .85rem; }
.btn-whatsapp:hover:not(:disabled) { background: #178a45; color: #fff; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.35); background: transparent; color: #fff; cursor: pointer;
}
.icon-btn:hover { background: rgba(255,255,255,.12); }

.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; }
.field > span { font-size: .85rem; font-weight: 500; }
input[type=text], input[type=password], input[type=number], select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 12px; width: 100%;
}
input:focus, select:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px var(--green-soft); }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); padding: 8px; cursor: pointer; }

.alert { padding: 11px 14px; border-radius: var(--radius-sm); margin: 0 0 16px; font-size: .9rem; border: 1px solid; }
.alert-error { background: var(--red-soft); border-color: #f1c4ba; color: var(--red); }
.alert-success { background: var(--green-soft); border-color: #bddcc8; color: var(--green-dark); }
.alert-info { background: var(--amber-soft); border-color: #f0d9a4; color: var(--amber); }
.alert a { color: inherit; font-weight: 600; }

/* ---------- Top bar ---------- */
.topbar { background: var(--green-dark); color: #fff; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 62px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: #fff; color: var(--green);
}
.brand-text { font-size: 1rem; font-weight: 400; }
.brand-text strong { font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.wallet {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.12); padding: 6px 12px; border-radius: 999px;
  font-weight: 600; font-variant-numeric: tabular-nums;
}
.user-menu { display: flex; align-items: center; gap: 10px; }
.user-name { font-size: .88rem; }
.level { font-size: .7rem; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.18); margin-left: 4px; }

/* ---------- Login ---------- */
.page-login .login-shell {
  display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 380px);
  gap: 48px; justify-content: center; align-items: center;
  padding: 48px 18px;
}
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow); }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.login-brand .brand-mark { background: var(--green); color: #fff; }
.login-card h1 { margin-bottom: 6px; }
.login-card > p { margin: 0 0 20px; font-size: .9rem; }
.login-links { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; font-size: .85rem; }
.login-aside .how { margin: 26px 0 0; padding-left: 22px; color: var(--muted); }
.login-aside .how li { margin-bottom: 10px; padding-left: 4px; }
.ticket-demo { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transform: rotate(-2deg); }
.ticket-demo .ticket-left { padding: 18px; display: flex; flex-direction: column; gap: 2px; min-width: 130px; }
.ticket-demo .ticket-right { flex: 1; display: grid; place-items: center; padding: 18px; }
.pin-demo { font-weight: 600; letter-spacing: .08em; font-size: 1.05rem; color: var(--green-dark); }

/* ---------- Dashboard ---------- */
.dash { padding-top: 26px; padding-bottom: 40px; }
.create {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
}
.create-head p { margin: 6px 0 20px; font-size: .9rem; max-width: 60ch; }
.create-form {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 0 20px; align-items: end;
}
.networks { grid-column: 1 / -1; border: 0; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 10px; }
.networks legend { font-size: .85rem; font-weight: 500; margin-bottom: 6px; padding: 0; }
.net-choice { position: relative; cursor: pointer; }
.net-choice input { position: absolute; opacity: 0; pointer-events: none; }
.net-choice span {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border: 1px solid var(--line); border-radius: 999px; font-weight: 500; font-size: .9rem;
}
.net-choice span::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--net, #999); }
.net-choice input:checked + span { border-color: var(--green); background: var(--green-soft); color: var(--green-dark); }
.net-choice input:focus-visible + span { outline: 3px solid #7cc39a; outline-offset: 2px; }

.net-mtn { --net: #ffc403; --net-ink: #3b2f00; }
.net-airtel { --net: #e40000; --net-ink: #fff; }
.net-glo { --net: #3aa935; --net-ink: #fff; }
.net-9mobile { --net: #0b3d2e; --net-ink: #fff; }

.qty { display: flex; align-items: stretch; }
.qty input { text-align: center; border-radius: 0; border-left: 0; border-right: 0; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-btn { width: 46px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; color: var(--ink); }
.qty-btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.qty-btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.qty-btn:hover { background: var(--green-soft); }

.create-total { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; }
.create-total strong { font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.create-form .btn-primary { padding: 12px 20px; font-size: 1rem; margin-bottom: 16px; }
.empty-inline { color: var(--muted); padding: 8px 0; }

.summary { display: flex; gap: 32px; flex-wrap: wrap; padding: 22px 4px 8px; }
.summary div { display: flex; flex-direction: column; }
.summary span { font-size: .8rem; }
.summary strong { font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.vouchers { margin-top: 18px; }
.list-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a {
  text-decoration: none; color: var(--muted); font-size: .85rem; font-weight: 500;
  padding: 6px 12px; border-radius: 999px;
}
.tabs a:hover { color: var(--green-dark); background: var(--green-soft); }
.tabs a.active { background: var(--green); color: #fff; }

/* ---------- Voucher tickets (the one bold element) ---------- */
.ticket-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.ticket {
  --notch: 14px;
  position: relative; display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.ticket-left {
  padding: 16px 20px 16px 22px; display: flex; flex-direction: column; gap: 2px;
  border-right: 2px dashed var(--line); position: relative;
}
.ticket-left::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--net, var(--green));
}
/* ticket notches on the perforation */
.ticket-left::after {
  content: ""; position: absolute; right: calc(var(--notch) / -2 - 1px); top: calc(var(--notch) / -2 - 1px);
  width: var(--notch); height: var(--notch); border-radius: 50%;
  background: var(--bg); border: 1px solid var(--line);
}
.ticket-right { position: relative; padding: 14px 20px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ticket-right::before {
  content: ""; position: absolute; left: calc(var(--notch) / -2 - 1px); bottom: calc(var(--notch) / -2 - 1px);
  width: var(--notch); height: var(--notch); border-radius: 50%;
  background: var(--bg); border: 1px solid var(--line);
}
.ticket-plan { font-size: 1rem; font-weight: 600; margin-top: 6px; }
.ticket small { font-size: .78rem; }
.net {
  align-self: flex-start; font-size: .7rem; font-weight: 600; letter-spacing: .03em;
  padding: 2px 9px; border-radius: 999px; background: var(--net, #999); color: var(--net-ink, #fff);
}
.ticket-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pin { min-height: 34px; display: flex; align-items: center; }
.pin-text {
  font-size: 1.3rem; font-weight: 600; letter-spacing: .09em;
  font-variant-numeric: tabular-nums; color: var(--ink); overflow-wrap: anywhere;
}
.ticket.revealed .pin-text { color: var(--green-dark); }
.ticket-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.pill { font-size: .72rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.pill-unused { background: var(--green-soft); color: var(--green-dark); }
.pill-pending { background: var(--amber-soft); color: var(--amber); }
.pill-redeemed { background: var(--slate-soft); color: var(--slate); }
.pill-expired, .pill-void { background: var(--red-soft); color: var(--red); }
.status-redeemed .pin-text, .status-expired .pin-text, .status-void .pin-text { color: var(--muted); }
.status-void .pin-text { text-decoration: line-through; }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty i { font-size: 2rem; color: var(--line); }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 20px; font-size: .88rem; }

/* ---------- SweetAlert result list ---------- */
.pin-results { text-align: left; margin: 6px 0 0; display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow: auto; }
.pin-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; }
.pin-row strong { font-size: 1.02rem; letter-spacing: .07em; color: var(--green-dark); font-variant-numeric: tabular-nums; }
.pin-row small { display: block; color: var(--muted); font-size: .72rem; }
.pin-row-actions { display: flex; gap: 6px; }
.swal2-popup { font-family: "Poppins", system-ui, sans-serif !important; border-radius: var(--radius) !important; }
.swal2-confirm { background: var(--green) !important; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 18px 0; font-size: .8rem; color: var(--muted); }
.footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  .page-login .login-shell { grid-template-columns: 1fr; gap: 28px; padding: 24px 16px; }
  .login-aside { order: 2; }
  .create { padding: 18px; }
  .create-form { grid-template-columns: 1fr; }
  .brand-text { display: none; }
  .user-name { display: none; }
  .ticket { grid-template-columns: 1fr; }
  .ticket-left { border-right: 0; border-bottom: 2px dashed var(--line); padding-bottom: 14px; }
  .ticket-left::after, .ticket-right::before { display: none; }
  .pin-text { font-size: 1.15rem; }
  .summary { gap: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Phase 2 shared additions ---------- */
.small { font-size: .8rem; }
.check { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 16px; font-size: .9rem; cursor: pointer; }
.check input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--green); }
.code-line {
  font-weight: 600; letter-spacing: .03em; background: var(--green-soft); color: var(--green-dark);
  padding: 8px 12px; border-radius: var(--radius-sm); overflow-wrap: anywhere; margin: 6px 0 14px;
}
.login-aside h2 { margin-bottom: 6px; }
.page-redeem .login-aside .btn-whatsapp { padding: 10px 16px; font-size: .92rem; }
textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; width: 100%; resize: vertical; }
textarea:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px var(--green-soft); }
input[type=url], input[type=search], input[type=color] { font: inherit; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; width: 100%; background: var(--surface); }
input[type=color] { padding: 4px; height: 44px; }

/* ---------- Phase 3a: selection, bulk actions, cards ---------- */
.btn-danger { background: var(--red); color: #fff; padding: 7px 12px; font-size: .85rem; }
.btn-danger:hover:not(:disabled) { background: #8a2717; color: #fff; }
.list-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.list-head { row-gap: 10px; }
.list-head .tabs { flex-basis: 100%; }
.menu { position: relative; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 200px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(10, 82, 48, .12); padding: 6px; display: flex; flex-direction: column;
}
.menu-list[hidden] { display: none; }
.menu-list button {
  font: inherit; font-size: .88rem; text-align: left; background: none; border: 0; padding: 9px 10px;
  border-radius: 7px; cursor: pointer; color: var(--ink); display: flex; gap: 10px; align-items: center;
}
.menu-list button:hover { background: var(--green-soft); }

.select-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 12px; margin-bottom: 12px; position: sticky; top: 8px; z-index: 10;
}
.select-bar[hidden] { display: none; }
.select-bar .check { margin: 0; }
.select-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.ticket-pick { position: absolute; top: 12px; right: 12px; }
.ticket-pick input { width: 18px; height: 18px; accent-color: var(--green); cursor: pointer; }
.ticket.selected { border-color: var(--green); box-shadow: 0 0 0 2px var(--green-soft); }
.ticket-actions a.btn { text-decoration: none; }

.result-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 4px 0 12px; }
.result-actions .btn { padding: 8px 14px; }
.swal-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.swal-form label { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; font-weight: 500; }
.swal-form input, .swal-form select { font: inherit; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; width: 100%; }

@media (max-width: 760px) {
  .select-actions { margin-left: 0; }
  .menu-list { right: auto; left: 0; }
}
