/**
 * Developed by Mohammad Rameez Imdad (Rameez Scripts)
 * WhatsApp: https://whatsapp.rameezscripts.com/ (For Custom Projects)
 * YouTube: https://www.youtube.com/@rameezimdad (Subscribe for more!)
 */
:root { --navy-primary: #001f3f; --navy-dark: #001529; --navy-light: #003366; --navy-accent: #0074D9; --navy-hover: #002a52; --success: #34a853; --warning: #fbbc04; --danger: #ea4335; --text: #1f2937; --muted: #6b7280; --line: #e6e9ef; }
* { margin: 0; padding: 0; box-sizing: border-box; }
:where(button, input, select, textarea) { font: inherit; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f5f5; color: var(--text); -webkit-tap-highlight-color: transparent; touch-action: manipulation; min-height: 100vh; }
input, select, textarea { font-size: 16px !important; touch-action: manipulation; }
[hidden] { display: none !important; }

/* top bar */
.top-loadbar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 10001; overflow: hidden; pointer-events: none; }
.top-loadbar > span { display: block; height: 100%; width: 38%; border-radius: 0 3px 3px 0; background: linear-gradient(90deg, rgba(0,116,217,0), var(--navy-accent), var(--navy-primary)); box-shadow: 0 0 8px rgba(0,116,217,.5); animation: topLoadSlide 1.05s ease-in-out infinite; }
@keyframes topLoadSlide { 0% { transform: translateX(-105%); } 100% { transform: translateX(320%); } }

/* header */
.app-head { display: flex; align-items: center; gap: 12px; padding: 20px 16px 60px; color: #fff; background: linear-gradient(135deg, var(--navy-primary) 0%, var(--navy-light) 100%); }
.app-logo { width: 50px; height: 50px; border-radius: 50%; border: 2px solid rgba(255,255,255,.7); object-fit: cover; flex: 0 0 50px; }
.head-txt { flex: 1; min-width: 0; }
.app-head h1 { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.app-head p { font-size: 13px; color: rgba(255,255,255,.8); margin-top: 3px; }
.nfc-ico { transform: rotate(90deg); display: inline-block; }
.hdr-menu { position: relative; align-self: flex-start; }
.hdr-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 17px; cursor: pointer; }
.hdr-btn:hover { background: rgba(255,255,255,.22); }
.hdr-drop { position: absolute; right: 0; top: 46px; z-index: 50; min-width: 190px; background: #fff; border-radius: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.2); padding: 6px; }
.hdr-drop button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; background: none; color: var(--navy-primary); font-size: 14px; font-weight: 500; text-align: left; border-radius: 4px; cursor: pointer; }
.hdr-drop button i { width: 18px; text-align: center; color: var(--navy-accent); }
.hdr-drop button:hover { background: #f0f5fb; }
.hdr-drop .danger, .hdr-drop .danger i { color: var(--danger); }

.wrap { max-width: 680px; margin: -42px auto 0; padding: 0 16px 30px; display: grid; gap: 14px; }
.wrap > * { min-width: 0; }
.card { background: #fff; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.08); padding: 18px; }
.card h3 { font-size: 16px; color: var(--navy-primary); display: flex; align-items: center; gap: 8px; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 12px; line-height: 1.5; }

/* notice */
.notice { padding: 12px 14px; border-radius: 4px; font-size: 14px; line-height: 1.5; background: #fff8e1; border-left: 4px solid var(--warning); color: #5f4b00; }
.notice.err { background: #fdecea; border-left-color: var(--danger); color: #8a1c13; }

/* buttons */
.btn { border: 0; border-radius: 4px; padding: 12px 20px; font-size: 15px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: background .2s, transform .1s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--navy-accent); color: #fff; box-shadow: 0 4px 12px rgba(0,116,217,.3); }
.btn-primary:hover { background: #0063b8; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: #eef3f9; color: var(--navy-primary); }
.btn-ghost:hover { background: #e1e9f3; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.icon-btn { border: 0; background: transparent; color: var(--navy-accent); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 34px; }
.icon-btn:hover { background: rgba(0,116,217,.12); }
.icon-btn.del { color: var(--danger); }
.icon-btn.del:hover { background: rgba(234,67,53,.12); }
.icon-btn.out { color: var(--success); }

/* setup */
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.mode { text-align: left; border: 2px solid var(--line); background: #fff; border-radius: 6px; padding: 12px; cursor: pointer; display: grid; gap: 4px; color: var(--text); transition: border-color .2s, background .2s; }
.mode i { font-size: 20px; color: var(--navy-accent); }
.mode b { font-size: 14px; color: var(--navy-primary); }
.mode small { font-size: 12px; color: var(--muted); line-height: 1.4; }
.mode.active { border-color: var(--navy-accent); background: #f0f7ff; box-shadow: 0 0 0 3px rgba(0,116,217,.12); }
.fld { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--navy-primary); margin-bottom: 8px; }
.fld input, .modal input { width: 100%; padding: 11px 12px; border: 1px solid #d6dde8; border-radius: 4px; outline: none; color: var(--text); }
.fld input:focus, .modal input:focus { border-color: var(--navy-accent); box-shadow: 0 0 0 3px rgba(0,116,217,.15); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f1f3f7; font-size: 14px; }
.toggle-row span i { width: 20px; color: var(--navy-accent); }
.form-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* toggle */
.toggle { appearance: none; -webkit-appearance: none; width: 44px; height: 24px; border-radius: 24px; background: #ccc; position: relative; cursor: pointer; transition: background .3s; border: none; outline: none; vertical-align: middle; }
.toggle:checked { background: #0074D9; }
.toggle::before { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .3s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle:checked::before { transform: translateX(20px); }
.form-group .toggle, .toggle-row .toggle { width: 44px; min-width: 44px; max-width: 44px; height: 24px; flex: 0 0 44px; padding: 0; }

/* scan card */
.scan-card { text-align: center; padding: 24px 18px; }
.who { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; margin-bottom: 16px; border: 0; border-radius: 999px; background: #eef3f9; color: var(--navy-primary); font-size: 14px; font-weight: 600; cursor: pointer; max-width: 100%; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .fa-gear { color: var(--muted); font-size: 12px; }
.scan-card h2 { font-size: 19px; color: var(--navy-primary); margin: 16px 0 6px; }
.scan-card > p { font-size: 14px; color: var(--muted); margin-bottom: 18px; line-height: 1.5; }
.scan-card .btn { min-width: 180px; }
.scan-ring { width: 104px; height: 104px; margin: 0 auto; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 40px; color: #fff; background: linear-gradient(135deg, var(--navy-primary), var(--navy-light)); position: relative; transition: background .3s; }
.scan-ring.on { background: linear-gradient(135deg, var(--navy-accent), var(--navy-light)); }
.scan-ring.on::before, .scan-ring.on::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--navy-accent); animation: ringPulse 1.8s ease-out infinite; }
.scan-ring.on::after { animation-delay: .9s; }
.scan-ring.hit { background: linear-gradient(135deg, var(--success), #1e7e34); }
.scan-ring.out { background: linear-gradient(135deg, var(--navy-light), var(--navy-dark)); }
.scan-ring.bad { background: linear-gradient(135deg, var(--danger), #b3261e); }
@keyframes ringPulse { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(1.7); opacity: 0; } }

/* inside now */
.inside { margin-top: 20px; text-align: left; border-top: 1px solid var(--line); padding-top: 14px; }
.inside h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 8px; display: flex; gap: 6px; align-items: center; }
.inside ul { list-style: none; display: grid; gap: 8px; }
.inside li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 4px; background: #effaf2; border-left: 4px solid var(--success); }
.inside li.stale { background: #fff8e1; border-left-color: var(--warning); }
.inside li > span { flex: 1; min-width: 0; }
.inside b, .inside small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inside b { font-size: 15px; color: var(--navy-primary); }
.inside small { font-size: 12px; color: var(--muted); }
.inside .btn { min-width: 0; }
.live { font-style: normal; font-variant-numeric: tabular-nums; font-weight: 700; color: #1e7e34; font-size: 15px; }
.inside li.stale .live { color: #8a6d00; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.info-box { background: #fff; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.08); padding: 10px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.info-box > div { min-width: 0; }
.ib-ico { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 4px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 17px; }
.bg-blue { background: var(--navy-accent); } .bg-green { background: var(--success); } .bg-navy { background: var(--navy-primary); }
.info-box small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: var(--muted); }
.info-box b { display: block; font-size: 17px; color: var(--navy-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin: -4px 0 14px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 10px 14px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; display: inline-flex; gap: 7px; align-items: center; white-space: nowrap; }
.tab.active { color: var(--navy-accent); border-bottom-color: var(--navy-accent); }

/* toolbar */
.tb-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.tb-search { position: relative; display: flex; align-items: center; flex: 1 1 160px; min-width: 0; }
.tb-search > i { position: absolute; left: 12px; font-size: 13px; color: #9aa6b2; pointer-events: none; }
.tb-search input { width: 100%; height: 40px; padding: 0 10px 0 34px; border: 1px solid #e2e8f1; border-radius: 4px; background: #fff; color: var(--text); outline: none; }
.tb-search input:focus { border-color: var(--navy-accent); }

/* tabulator navy skin */
.tabulator { background: transparent; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; overflow: hidden; }
.tabulator .tabulator-header { background: var(--navy-primary); border-bottom: 0; color: #fff; font-weight: 600; }
.tabulator .tabulator-header .tabulator-col { background: transparent; border-right: 1px solid rgba(255,255,255,.10); }
.tabulator .tabulator-header .tabulator-col-title { font-size: 12.5px; letter-spacing: .3px; padding: 10px 8px; }
.tabulator .tabulator-header .tabulator-col .tabulator-arrow { border-bottom-color: rgba(255,255,255,.6) !important; }
.tabulator .tabulator-row { border-bottom: 1px solid #f1f3f7; background: #fff; }
.tabulator .tabulator-row.tabulator-row-even { background: #fcfdff; }
.tabulator .tabulator-cell { border-right: 0; padding: 10px 8px; color: var(--text); }
.tabulator .tabulator-footer { background: #f8fafc; border-top: 1px solid #eceff4; padding: 8px; }
.tabulator .tabulator-footer .tabulator-page { border: 1px solid #e2e8f1; background: #fff; color: var(--navy-primary); font-size: 12.5px; padding: 5px 10px; border-radius: 4px; }
.tabulator .tabulator-footer .tabulator-page.active { background: var(--navy-primary); color: #fff; border-color: var(--navy-primary); }
.tabulator .tabulator-placeholder .tabulator-placeholder-contents { color: #98a2b3; font-size: 13px; }
.tb-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.tb-pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tb-pill.ok { background: rgba(52,168,83,.14); color: #1e7e34; }
.tb-pill.role { background: rgba(0,116,217,.12); color: var(--navy-accent); }
.tb-pill.off { background: rgba(234,67,53,.13); color: #c5221f; }
.tb-pill.warn { background: rgba(251,188,4,.18); color: #8a6d00; }

/* summary table */
.about-table-wrapper { overflow-x: auto; margin: 4px 0; }
.about-roles-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.about-roles-table th, .about-roles-table td { padding: 10px 12px; text-align: center; border: 1px solid #e0e0e0; white-space: nowrap; }
.about-roles-table th { background: var(--navy-primary); color: #fff; font-weight: 600; }
.about-roles-table th:first-child { text-align: left; }
.about-roles-table td:first-child { text-align: left; font-weight: 500; background: #f8f9fa; }
.about-roles-table tfoot td { background: #eef3f9 !important; font-weight: 700; color: var(--navy-primary); }

/* sticker list */
.tag-list { list-style: none; }
.tag-list li { display: flex; align-items: center; gap: 6px; padding: 10px 2px; border-bottom: 1px solid #f1f3f7; }
.tag-list li:last-child { border-bottom: 0; }
.h-ico { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(0,116,217,.12); color: var(--navy-accent); margin-right: 4px; }
.h-txt { min-width: 0; flex: 1; }
.h-txt b, .h-txt small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-txt b { font-size: 14px; color: var(--navy-primary); }
.h-txt small { font-size: 12px; color: var(--muted); }
.empty { text-align: center; padding: 20px 8px; color: var(--muted); font-size: 14px; justify-content: center; flex-direction: column; }
.empty i { display: block; font-size: 26px; margin-bottom: 8px; color: #c3cbd6; }

/* scan flash */
.flash { position: fixed; inset: 0; z-index: 10003; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(0,21,41,.55); backdrop-filter: blur(3px); animation: fadeIn .15s ease-out; }
.flash-box { width: 100%; max-width: 340px; border-radius: 10px; padding: 30px 20px; text-align: center; color: #fff; display: grid; gap: 8px; justify-items: center; box-shadow: 0 20px 50px rgba(0,0,0,.35); animation: pop .28s cubic-bezier(.2,1.4,.4,1); }
.flash.in .flash-box { background: linear-gradient(135deg, var(--success), #1e7e34); }
.flash.out .flash-box { background: linear-gradient(135deg, var(--navy-accent), var(--navy-primary)); }
.flash-box i { font-size: 54px; margin-bottom: 4px; }
.flash-box b { font-size: 24px; letter-spacing: 1px; }
.flash-box span { font-size: 20px; font-weight: 600; word-break: break-word; }
.flash-box small { font-size: 14px; opacity: .85; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }

/* modal */
.modal-overlay { position: fixed; inset: 0; z-index: 10004; background: rgba(0,21,41,.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { width: 100%; max-width: 400px; background: #fff; border-radius: 6px; padding: 18px; box-shadow: 0 20px 50px rgba(0,0,0,.3); animation: pop .22s ease-out; }
.modal-head { display: flex; align-items: center; justify-content: space-between; }

/* contact */
.contact { display: grid; gap: 10px; }
.contact a { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--navy-primary); text-decoration: none; padding: 10px 12px; background: #f7f9fc; border: 1px solid var(--line); border-radius: 4px; word-break: break-all; }
.contact .fa-whatsapp { color: #25d366; font-size: 18px; }
.contact .fa-envelope { color: var(--navy-accent); font-size: 16px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; background: var(--navy-primary); color: #fff; padding: 10px 12px 10px 16px; border-radius: 6px; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.25); z-index: 10005; width: max-content; max-width: calc(100% - 32px); }
.toast button { border: 0; background: rgba(255,255,255,.15); color: #fff; font-weight: 700; padding: 6px 10px; border-radius: 4px; cursor: pointer; white-space: nowrap; }

@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr; }
  .modes { grid-template-columns: 1fr; }
  .app-head h1 { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
