/* A class that sets `display` outranks the UA's [hidden] rule, which silently broke
   the client chat popup and the nav drawer (both stayed on screen and ate clicks).
   Hidden means hidden, everywhere. */
[hidden] { display: none !important; }

/* Client portal — tenant-themed via CSS custom properties (--p primary, --a accent). */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; line-height: 1.5; color: #1c2733;
  background: #f2f5f9;
}
a { color: var(--p, #0e6ba8); text-decoration: none; }
img { max-width: 100%; }
button { font: inherit; }
svg { width: 22px; height: 22px; flex: 0 0 auto; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 40; background: var(--p); color: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.18); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; max-width: 1100px; margin: 0 auto; padding: 10px 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 17px; min-width: 0; }
.brand-logo { height: 30px; width: auto; border-radius: 6px; background: #fff; padding: 2px; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; gap: 6px; }
.icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; color: #fff; background: rgba(255,255,255,.12); }
.badge-dot { position: absolute; top: -2px; right: -2px; background: var(--a); color: #182230; font-size: 11px; font-weight: 700; border-radius: 10px; min-width: 17px; height: 17px; line-height: 17px; text-align: center; padding: 0 3px; }

/* ---------- Shell / side navigation ---------- */
.shell { display: flex; max-width: 1100px; margin: 0 auto; gap: 20px; padding: 18px 16px 90px; }
.sidenav { display: none; }
.main { flex: 1; min-width: 0; }
@media (min-width: 900px) {
  .shell { padding-bottom: 24px; }
  .sidenav { display: block; width: 230px; flex: 0 0 230px; }
  .tabbar { display: none !important; }
}
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: #33455a; font-weight: 500; margin-bottom: 2px; }
.nav-item svg { color: #7d92a8; }
.nav-item.active, .nav-item:hover { background: #fff; color: var(--p); box-shadow: 0 1px 4px rgba(20,40,70,.07); }
.nav-item.active svg { color: var(--p); }
.nav-sep { font-size: 11px; letter-spacing: .08em; color: #8ba0b5; margin: 14px 12px 6px; font-weight: 700; }
.nav-badge { margin-left: auto; background: var(--a); color: #182230; border-radius: 10px; font-size: 11px; font-weight: 700; padding: 1px 7px; }

/* ---------- Bottom tab bar (mobile) ---------- */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; display: flex; background: #fff; border-top: 1px solid #e3e9f0; padding-bottom: env(safe-area-inset-bottom); }
.tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 6px; font-size: 10.5px; color: #6a7f95; background: none; border: 0; }
.tabbar a.active { color: var(--p); font-weight: 600; }
.tabbar .tab-pay svg { color: var(--a); }
.drawer { position: fixed; inset: 0; z-index: 60; background: rgba(10,20,35,.45); display: flex; align-items: flex-end; }
/* `display:flex` above outranks the UA's [hidden] rule, so the closed drawer stayed on
   screen — covering the dashboard and swallowing every click. Keep hidden meaning hidden. */
.drawer[hidden] { display: none; }
.drawer-card { background: #fff; width: 100%; border-radius: 16px 16px 0 0; padding: 14px 16px calc(20px + env(safe-area-inset-bottom)); max-height: 70vh; overflow: auto; }
.drawer-item { display: flex; align-items: center; gap: 12px; padding: 12px 6px; color: #2a3a4d; font-weight: 500; border-bottom: 1px solid #f0f3f7; }
.drawer-item svg { color: var(--p); }

/* ---------- Cards / layout primitives ---------- */
.card { background: #fff; border-radius: 14px; box-shadow: 0 1px 4px rgba(20,40,70,.07); margin-bottom: 16px; overflow: hidden; }
.card .card-h { padding: 13px 16px 0; font-weight: 700; font-size: 15px; color: #24344a; }
.pad { padding: 16px; }
.center { text-align: center; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 720px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.muted { color: #6a7f95; font-size: 13px; }
.small { font-size: 12.5px; }
.mt { margin-top: 12px; }
.mb0 { margin-bottom: 0; }

/* ---------- Balance hero ---------- */
.hero { background: linear-gradient(135deg, var(--p), color-mix(in srgb, var(--p) 70%, #001a33)); color: #fff; border-radius: 16px; padding: 22px 18px; margin-bottom: 16px; box-shadow: 0 4px 16px rgba(10,40,80,.18); }
@supports not (background: color-mix(in srgb, red 50%, blue)) { .hero { background: var(--p); } }
.hero .hero-label { font-size: 13px; opacity: .85; }
.hero .hero-amount { font-size: 38px; font-weight: 800; letter-spacing: -1px; margin: 2px 0 4px; }
.hero .hero-sub { font-size: 13.5px; opacity: .92; }
.hero .hero-warn { margin-top: 8px; background: rgba(255,255,255,.16); border-left: 3px solid var(--a); border-radius: 6px; padding: 7px 10px; font-size: 13px; }
.hero .hero-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0; border-radius: 10px; padding: 10px 18px; font-weight: 600; font-size: 14px; cursor: pointer; transition: filter .15s; text-align: center; }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-p { background: var(--p); color: #fff; }
.btn-a { background: var(--a); color: #182230; }
.btn-o { background: #fff; color: var(--p); border: 1.5px solid var(--p); }
.btn-light { background: #eef2f7; color: #33455a; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn svg { width: 18px; height: 18px; }

/* ---------- Forms ---------- */
label.f { display: block; font-size: 13px; font-weight: 600; color: #40566d; margin: 12px 0 4px; }
.in, select.in, textarea.in { width: 100%; border: 1.5px solid #d5dee8; border-radius: 10px; padding: 10px 12px; font-size: 15px; background: #fff; color: #1c2733; }
.in:focus { outline: none; border-color: var(--p); box-shadow: 0 0 0 3px color-mix(in srgb, var(--p) 18%, transparent); }
textarea.in { min-height: 90px; resize: vertical; }
.in-row { display: flex; gap: 10px; }
.in-row > * { flex: 1; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 10px; }
.hint { font-size: 12px; color: #8ba0b5; margin-top: 4px; }

/* ---------- Definition rows ---------- */
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid #f0f3f7; font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: #6a7f95; }
.kv .v { font-weight: 600; text-align: right; color: #24344a; overflow-wrap: anywhere; }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: #7d92a8; padding: 10px 10px 6px; border-bottom: 1px solid #e3e9f0; white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid #f0f3f7; vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.amt-c { color: #178a4c; font-weight: 700; white-space: nowrap; }
.amt-d { color: #c0392b; font-weight: 700; white-space: nowrap; }

/* ---------- Chips ---------- */
.chip { display: inline-block; border-radius: 20px; font-size: 11.5px; font-weight: 700; padding: 2px 10px; }
.chip-g { background: #e2f6ea; color: #178a4c; }
.chip-r { background: #fdeaea; color: #c0392b; }
.chip-y { background: #fdf3dd; color: #9a6b00; }
.chip-b { background: #e6f0fa; color: #1e6bb0; }
.chip-gray { background: #eef2f7; color: #5c7188; }

/* ---------- Flash / toast ---------- */
.flash { border-radius: 10px; padding: 11px 14px; font-size: 14px; margin-bottom: 14px; }
.flash-success { background: #e2f6ea; color: #14683a; }
.flash-error { background: #fdeaea; color: #a02c20; }
.flash-info { background: #e6f0fa; color: #1e5d97; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: #24344a; color: #fff; border-radius: 10px; padding: 10px 18px; font-size: 14px; z-index: 100; box-shadow: 0 4px 14px rgba(0,0,0,.25); max-width: 92vw; }
.toast.err { background: #a02c20; }

/* ---------- Auth screens ---------- */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; background: linear-gradient(160deg, var(--p), #10202f); padding: 24px 16px; }
.auth-main { width: 100%; max-width: 400px; }
.auth-card { background: #fff; border-radius: 16px; padding: 26px 22px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.auth-logo { text-align: center; margin-bottom: 14px; }
.auth-logo img { max-height: 64px; border-radius: 10px; }
.auth-title { text-align: center; font-size: 19px; font-weight: 800; color: #182838; margin: 0 0 2px; }
.auth-note { text-align: center; font-size: 13px; color: #6a7f95; margin: 0 0 10px; }
.auth-links { text-align: center; margin-top: 14px; font-size: 13.5px; display: flex; flex-direction: column; gap: 6px; }
.auth-wrap .foot { color: rgba(255,255,255,.75); }
.auth-wrap .foot a { color: rgba(255,255,255,.9); }
.otp-in { letter-spacing: 8px; text-align: center; font-size: 22px; font-weight: 700; }

/* ---------- Footer ---------- */
.foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 26px 2px 10px; font-size: 12.5px; color: #8ba0b5; flex-wrap: wrap; }
.lang-toggle a { color: inherit; padding: 2px 4px; }
.lang-toggle a.on { color: var(--p); font-weight: 700; }
.auth-wrap .lang-toggle a.on { color: #fff; }

/* ---------- Pay page ---------- */
.chan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 10px; }
.chan { border: 1.5px solid #d5dee8; border-radius: 12px; padding: 12px 8px; text-align: center; font-size: 13px; font-weight: 600; color: #33455a; background: #fff; }
.chan svg { display: block; margin: 0 auto 6px; color: var(--p); width: 26px; height: 26px; }
.fee-line { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.fee-total { font-weight: 800; font-size: 16px; border-top: 1px solid #e3e9f0; margin-top: 4px; padding-top: 8px; }
.proof-status { border-left: 3px solid #d5dee8; padding: 8px 12px; margin: 8px 0; font-size: 13.5px; background: #f8fafc; border-radius: 0 8px 8px 0; }

/* ---------- Tickets ---------- */
.thread { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 85%; border-radius: 14px; padding: 10px 14px; font-size: 14px; }
.bubble.me { align-self: flex-end; background: var(--p); color: #fff; border-bottom-right-radius: 4px; }
.bubble.them { align-self: flex-start; background: #eef2f7; color: #24344a; border-bottom-left-radius: 4px; }
.bubble .b-meta { font-size: 11px; opacity: .75; margin-top: 4px; }
.bubble a { color: inherit; text-decoration: underline; }

/* ---------- Announcements ---------- */
.ann { border-left: 4px solid var(--p); }
.ann.pinned { border-left-color: var(--a); }
.ann .ann-date { font-size: 12px; color: #8ba0b5; }
.ann .ann-body { font-size: 14px; margin-top: 6px; overflow-wrap: anywhere; }

/* ---------- Speed test ---------- */
.gauge-wrap { text-align: center; padding: 8px 0 4px; }
#gauge { max-width: 280px; width: 100%; }
.st-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.st-stat { background: #f8fafc; border-radius: 10px; padding: 10px 4px; text-align: center; }
.st-stat .v { font-size: 17px; font-weight: 800; color: var(--p); }
.st-stat .l { font-size: 11px; color: #7d92a8; }
.plan-bar { height: 10px; border-radius: 6px; background: #e3e9f0; overflow: hidden; margin-top: 6px; }
.plan-bar > div { height: 100%; background: var(--a); border-radius: 6px; transition: width .5s; }

/* ---------- WiFi ---------- */
.band-cards { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 720px) { .band-cards { grid-template-columns: 1fr 1fr; } }

/* ---------- Plans ---------- */
.plan-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 720px) { .plan-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .plan-grid { grid-template-columns: 1fr 1fr 1fr; } }
.plan-card { border: 1.5px solid #e3e9f0; border-radius: 14px; padding: 16px; background: #fff; position: relative; }
.plan-card.current { border-color: var(--p); box-shadow: 0 0 0 3px color-mix(in srgb, var(--p) 15%, transparent); }
.plan-price { font-size: 24px; font-weight: 800; color: var(--p); }
.plan-price small { font-size: 13px; color: #7d92a8; font-weight: 500; }
.plan-tag { position: absolute; top: -9px; right: 12px; background: var(--p); color: #fff; border-radius: 12px; font-size: 11px; font-weight: 700; padding: 2px 10px; }

/* ---------- Modal (lite) ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 70; background: rgba(10,20,35,.5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { background: #fff; border-radius: 14px; max-width: 440px; width: 100%; max-height: 88vh; overflow: auto; padding: 18px; }
.modal-card h3 { margin: 0 0 6px; font-size: 17px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* ---------- Banner strip ---------- */
.banner-strip { background: color-mix(in srgb, var(--a) 18%, #fff); border: 1px solid color-mix(in srgb, var(--a) 45%, #fff); color: #5c4a00; border-radius: 12px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 14px; }
@supports not (background: color-mix(in srgb, red 50%, blue)) { .banner-strip { background: #fdf3dd; border-color: #f0dfae; } }
.banner-img { border-radius: 12px; margin-bottom: 14px; width: 100%; }

/* ---------- Misc ---------- */
.chat-fab { position: fixed; right: 16px; bottom: 84px; z-index: 55; width: 52px; height: 52px; border-radius: 50%; background: var(--p); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(0,0,0,.28); }
@media (min-width: 900px) { .chat-fab { bottom: 22px; } }
.preview-strip { background: #24344a; color: #ffd76b; text-align: center; font-size: 12px; padding: 4px; position: sticky; top: 0; z-index: 90; }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: sp 0.8s linear infinite; }
.btn-o .spin, .btn-light .spin { border-color: rgba(0,0,0,.15); border-top-color: var(--p); }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- Print (receipts / SOA fallback) ---------- */
@media print {
  .topbar, .sidenav, .tabbar, .foot, .chat-fab, .drawer, .flash, .no-print { display: none !important; }
  body { background: #fff; }
  .shell { padding: 0; display: block; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}
