/* HeyGiriraj HQ — navy #0A1940 + gold #FCB707, phone first */
:root { --navy: #0A1940; --navy-2: #13265C; --gold: #FCB707; --gold-soft: #FFF5D6; --bg: #F4F6FA; --line: #E1E6F0; --text: #1B2333;
  --muted: #667085; --green: #1E9E5A; --green-soft: #EAF3DE; --red: #C0392B; --red-soft: #FCEBEB; --amber-soft: #FFF5D6;
  --safe-b: env(safe-area-inset-bottom, 0px); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--text); background: var(--bg); -webkit-text-size-adjust: 100%; }
a { color: var(--navy-2); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.spin { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--navy); border-radius: 50%; animation: sp .8s linear infinite; margin: 30px auto; }
@keyframes sp { to { transform: rotate(360deg); } }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .hidden { display: none !important; }
.i { width: 20px; height: 20px; flex: none; display: block; }

/* Shell */
.frame { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.side { display: none; }
.col { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; }
.top { flex: none; background: var(--navy); color: #fff; padding: max(10px, env(safe-area-inset-top)) 14px 12px; display: flex; align-items: center; gap: 10px; min-height: 60px; }
.top .back { width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--navy-2); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.top .tt { flex: 1; min-width: 0; }
.top .t1 { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .t2 { font-size: 12px; color: #AEB8D6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hqlogo { width: 36px; height: 36px; border-radius: 11px; background: var(--gold); color: var(--navy); display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
main { padding: 14px 14px 100px; max-width: 1240px; }
.bnav { flex: none; display: flex; background: #fff; border-top: 1px solid var(--line); padding: 0 4px var(--safe-b); }
.bnav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 60px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; position: relative; }
.bnav a.on { color: var(--navy); }
.bnav a.on::after { content: ''; width: 18px; height: 3px; border-radius: 2px; background: var(--gold); }
.bnav .dot { position: absolute; top: 8px; left: calc(50% + 6px); width: 9px; height: 9px; border-radius: 50%; background: #E5484D; box-shadow: 0 0 0 2px #fff; }

/* Cards and bits */
.card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 12px; min-width: 0; }
.card h3 { margin: 0 0 10px; font-size: 15px; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.card h3 .r { margin-left: auto; font-size: 12.5px; font-weight: 600; }
h2.sec { font-size: 16px; color: var(--navy); margin: 18px 2px 10px; display: flex; align-items: center; gap: 8px; }
h2.sec .r { margin-left: auto; font-size: 13px; font-weight: 600; }
.hello { margin: 2px 2px 14px; } .hello h1 { margin: 0; font-size: 22px; color: var(--navy); letter-spacing: -.01em; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px; min-width: 0; text-decoration: none; color: inherit; display: block; }
.kpi .l { font-size: 12.5px; color: var(--muted); }
.kpi .v { font-size: 24px; font-weight: 800; color: var(--navy); line-height: 1.2; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .s { font-size: 12px; color: var(--muted); }
.kpi.navy { background: var(--navy); border-color: var(--navy); } .kpi.navy .v, .kpi.navy .l { color: #fff; } .kpi.navy .s { color: #AEB8D6; }
.pill { display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 99px; padding: 2px 8px; white-space: nowrap; background: #EEF1F6; color: var(--navy); }
.pill.g { background: var(--green-soft); color: #27500A; } .pill.r { background: var(--red-soft); color: #791F1F; } .pill.a { background: var(--amber-soft); color: #6B4E00; }
.pill.n { background: var(--navy); color: var(--gold); } .pill.gold { background: var(--gold); color: var(--navy); }
.grade { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.grade.A { background: #1E9E5A; color: #fff; } .grade.B { background: #97C459; color: #173404; } .grade.C { background: var(--gold); color: var(--navy); }
.grade.D { background: #E24B4A; color: #fff; } .grade.x { background: #EEF1F6; color: var(--muted); }
.sdot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.sdot.ok { background: #1E9E5A; } .sdot.watch { background: #EF9F27; } .sdot.urgent { background: #E24B4A; }
.clogo { width: 38px; height: 38px; border-radius: 11px; background: var(--gold); color: var(--navy); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; overflow: hidden; }
.clogo img { width: 100%; height: 100%; object-fit: cover; background: #fff; display: block; }
.clogo.sm { width: 30px; height: 30px; border-radius: 9px; font-size: 11px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 42px; padding: 0 16px; border-radius: 12px; border: 0; background: var(--navy); color: #fff; font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn.gold { background: var(--gold); color: var(--navy); } .btn.green { background: #1E9E5A; color: #fff; }
.btn.ghost { background: #fff; color: var(--navy); border: 1.5px solid var(--line); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.danger { background: #fff; color: var(--red); border: 1.5px solid #F7C1C1; }
.btn .i { width: 17px; height: 17px; } .btn:disabled { opacity: .55; cursor: default; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1.5px solid var(--line); background: #fff; color: var(--navy); border-radius: 99px; padding: 6px 12px; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip .x { margin-left: 6px; opacity: .6; }
.inp, select.inp, textarea.inp { width: 100%; height: 44px; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 12px; background: #fff; font-size: 16px; outline: 0; }
textarea.inp { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.inp:focus { border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(19, 38, 92, .12); }
label.f { display: block; font-size: 13px; font-weight: 700; color: var(--navy); margin: 12px 0 5px; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
.row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); min-width: 0; }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row b { color: var(--navy); }
.ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { text-align: center; padding: 26px 10px; color: var(--muted); font-size: 14px; }

/* Overview */
.att { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.att:first-of-type { border-top: 0; }
.att .fl { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.cgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ccard { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 11px; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ccard:hover { border-color: #C9D2E6; }
.ccard .t { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ccard .t b { flex: 1; min-width: 0; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.ccard .s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Clients list */
.tools { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.search { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--muted); }
.search input { border: 0; outline: 0; flex: 1; min-width: 0; font-size: 16px; background: transparent; color: var(--text); }
.filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.filters select { height: 38px; font-size: 14px; border-radius: 10px; }
.tbl { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.tr { display: grid; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; min-width: 0; }
.tr:first-child { border-top: 0; }
.tr.h { background: #F7F9FD; color: var(--muted); font-size: 12px; font-weight: 700; }
a.tr:hover { background: #F9FAFD; }
.tr .c { text-align: center; } .tr .num { font-weight: 800; color: var(--navy); }
.tbl .tr { grid-template-columns: minmax(0, 1fr) auto; }
.tbl .lap { display: none; }
.pin { border: 0; background: none; color: #C3CAD8; cursor: pointer; padding: 2px; font-size: 17px; line-height: 1; }
.pin.on { color: var(--gold); }

/* Client page */
.chead { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.chead .nm { flex: 1; min-width: 160px; } .chead h1 { margin: 0; font-size: 21px; color: var(--navy); }
.chead .clogo { width: 48px; height: 48px; border-radius: 14px; font-size: 16px; }
.rng { margin-bottom: 12px; }
.custom { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.custom input { width: auto; flex: 1; min-width: 130px; height: 40px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.bars .b { flex: 1; display: flex; align-items: flex-end; gap: 1px; height: 100%; min-width: 0; }
.bars .b i { flex: 1; display: block; border-radius: 3px 3px 0 0; background: var(--navy); min-height: 2px; }
.bars .b i.p { background: #D5DBE8; }
.blab { display: flex; gap: 3px; font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.blab span { flex: 1; text-align: center; min-width: 0; overflow: hidden; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.hbar { height: 10px; border-radius: 99px; background: #EEF1F6; overflow: hidden; }
.hbar > div { height: 100%; background: var(--navy); border-radius: 99px; }
.hbar.gold > div { background: var(--gold); } .hbar.green > div { background: #1E9E5A; } .hbar.red > div { background: #E24B4A; }
.part { padding: 8px 0; border-top: 1px solid var(--line); }
.part:first-of-type { border-top: 0; }
.part .ph { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; gap: 8px; }
.part .ph b { color: var(--navy); }
.score { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.score .big { font-size: 30px; font-weight: 800; color: var(--navy); }
.fun { display: grid; grid-template-columns: 92px 1fr 44px; gap: 8px; align-items: center; font-size: 13px; padding: 5px 0; }
.fun b { text-align: right; color: var(--navy); }
.ob { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.ob:first-of-type { border-top: 0; }
.ob .bx { width: 22px; height: 22px; border-radius: 7px; border: 2px solid #C3CAD8; display: grid; place-items: center; flex: none; background: #fff; color: #fff; font-size: 13px; }
.ob.done .bx { background: #1E9E5A; border-color: #1E9E5A; }
.ob button.bx { cursor: pointer; padding: 0; }
.ob .k { margin-left: auto; font-size: 11px; color: var(--muted); }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.kv:first-of-type { border-top: 0; } .kv span { color: var(--muted); } .kv b { color: var(--navy); text-align: right; min-width: 0; overflow-wrap: anywhere; }
.tl { border-left: 3px solid var(--gold); padding: 3px 0 9px 11px; margin-left: 2px; font-size: 14px; }
.tl.event, .tl.report { border-left-color: #C3CAD8; } .tl.ads { border-left-color: var(--navy-2); }
.tl .m { font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.tl .del { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; text-decoration: underline; padding: 0; }
.tl .tx { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Reports */
.wa { background: #E7F7E1; border-radius: 14px; padding: 12px 14px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; border: 1px solid #CDEBC2; }
.wa b { font-weight: 800; }
.mprog { height: 8px; border-radius: 99px; background: #EEF1F6; overflow: hidden; margin: 6px 0 12px; } .mprog > div { height: 100%; background: var(--gold); }

/* Modal + toast */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 25, 64, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: #fff; width: 100%; max-width: 520px; border-radius: 18px 18px 0 0; padding: 18px 16px calc(16px + var(--safe-b)); max-height: 92vh; overflow: auto; }
.modal h3 { margin: 0 0 6px; color: var(--navy); font-size: 18px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
#toast { position: fixed; left: 0; right: 0; bottom: calc(80px + var(--safe-b)); display: flex; justify-content: center; z-index: 60; pointer-events: none; padding: 0 16px; }
#toast div { background: var(--navy); color: #fff; padding: 11px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); text-align: center; }
#toast div.err { background: var(--red); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--navy); }
.login form { background: #fff; border-radius: 20px; padding: 26px 22px; width: 100%; max-width: 380px; }
.login h1 { margin: 12px 0 2px; font-size: 22px; color: var(--navy); }
.login .hqlogo { width: 52px; height: 52px; border-radius: 15px; font-size: 18px; }
.soon { text-align: center; padding: 34px 18px; }
.soon .hqlogo { margin: 0 auto 12px; }
.soon ul { text-align: left; display: inline-block; margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; }

@media (min-width: 640px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid2 { grid-template-columns: 1fr 1fr; }
  .filters { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .modal-bg { align-items: center; } .modal { border-radius: 18px; }
  .cgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .frame { flex-direction: row; }
  .side { display: flex; flex-direction: column; gap: 2px; width: 236px; flex: none; background: var(--navy); color: #fff; padding: 18px 12px; overflow-y: auto; }
  .side .brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 16px; }
  .side .brand b { font-size: 15px; } .side .brand span { display: block; font-size: 12px; color: #AEB8D6; }
  .side a { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: 10px; color: #DDE3F3; text-decoration: none; font-size: 14px; font-weight: 500; }
  .side a:hover { background: var(--navy-2); color: #fff; }
  .side a.on { background: var(--gold); color: var(--navy); font-weight: 700; }
  .side a .tag { margin-left: auto; font-size: 10px; font-weight: 700; background: #2A3B70; color: #AEB8D6; border-radius: 6px; padding: 2px 6px; }
  .side a.on .tag { background: var(--navy); color: var(--gold); }
  .side a .cnt { margin-left: auto; font-size: 11px; font-weight: 800; background: #E5484D; color: #fff; border-radius: 99px; padding: 1px 7px; }
  .side .foot { margin-top: auto; padding: 10px; border-radius: 12px; background: var(--navy-2); display: flex; align-items: center; gap: 10px; }
  .side .foot .u { flex: 1; min-width: 0; font-size: 13px; } .side .foot .u span { display: block; font-size: 11px; color: #AEB8D6; }
  .side .foot button { width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; color: #AEB8D6; cursor: pointer; display: grid; place-items: center; }
  .side .foot button:hover { background: #2A3B70; color: #fff; }
  .top { background: transparent; color: var(--navy); padding: 20px 28px 4px; min-height: 0; }
  .top .hqlogo.ph { display: none; }
  .top .t1 { font-size: 24px; font-weight: 800; color: var(--navy); letter-spacing: -.02em; } .top .t2 { color: var(--muted); font-size: 13px; }
  .top .back { background: #fff; color: var(--navy); border: 1px solid var(--line); width: 44px; height: 44px; }
  .bnav { display: none; }
  main { padding: 12px 28px 40px; }
  .kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .two { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 12px; align-items: start; }
  .tools { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .tools .search { flex: 1; min-width: 240px; }
  .tools .filters { flex: 2; }
  .tbl .tr { grid-template-columns: 28px minmax(0, 2fr) 44px 92px 56px 56px 110px 70px 92px; }
  .tbl .lap { display: block; } .tbl .ph { display: none; }
  #toast { bottom: 30px; }
}
