/* ─────────────────────────────────────────────────────────────
   Hearing Center dashboard — layout and theme
   Dark by default, light with <html data-theme="light">.
   Chat-app shaped (rail · list · conversation) but our own marks,
   colours and icons; nothing is copied from WhatsApp.
   ───────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:#0d1117; --pane:#161b22; --pane-2:#1c2333; --raise:#21262d;
  --line:#30363d; --text:#e6edf3; --muted:#7d8590;
  --brand:#25d366; --brand-dark:#128c7e; --blue:#58a6ff; --orange:#f0883e;
  --red:#f85149; --purple:#bc8cff;
  --bubble-in:#1c2333; --bubble-out:#12694f; --bubble-out-text:#ffffff;
  --r:10px; --rail:68px; --list:320px; --drawer:300px;
  --shadow:0 6px 20px rgba(0,0,0,.35);
}
html[data-theme="light"] {
  --bg:#f2f4f7; --pane:#ffffff; --pane-2:#f6f8fa; --raise:#eaeef2;
  --line:#d7dce2; --text:#1b2027; --muted:#5b6672;
  --bubble-in:#ffffff; --bubble-out:#d6f5e3; --bubble-out-text:#10331f;
  --shadow:0 6px 20px rgba(16,25,40,.12);
}

html, body { height:100%; }
body {
  font-family:'Inter', system-ui, sans-serif; background:var(--bg); color:var(--text);
  overflow:hidden; -webkit-font-smoothing:antialiased;
}
button, input, select, textarea { font:inherit; color:inherit; }
.muted { color:var(--muted); }
.small { font-size:11px; }
[hidden] { display:none !important; }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  background:var(--raise); border:1px solid var(--line); border-radius:8px;
  padding:6px 12px; font-size:12px; cursor:pointer; white-space:nowrap;
}
.btn:hover { border-color:var(--brand); color:var(--brand); }
.btn.primary { background:var(--brand); border-color:var(--brand); color:#04160c; font-weight:700; }
.btn.primary:hover { opacity:.88; color:#04160c; }
.btn.danger { color:var(--red); border-color:var(--red); }
.btn.on { color:var(--brand); border-color:var(--brand); }
.icon-btn { background:none; border:none; cursor:pointer; color:var(--muted); font-size:18px; padding:4px 8px; border-radius:8px; }
.icon-btn:hover { background:var(--raise); color:var(--text); }

/* ── Login ────────────────────────────────────────────── */
.login { position:fixed; inset:0; z-index:100; display:flex; align-items:center; justify-content:center; background:var(--bg); }
.login-box {
  width:330px; background:var(--pane); border:1px solid var(--line); border-radius:16px;
  padding:34px 28px; display:flex; flex-direction:column; gap:12px; align-items:center; box-shadow:var(--shadow);
}
.login-box h2 { font-size:18px; }
.login-box p { font-size:11px; margin-top:-8px; }
.login-box input {
  width:100%; background:var(--pane-2); border:1px solid var(--line); border-radius:8px;
  padding:10px 13px; font-size:14px; outline:none;
}
.login-box input:focus { border-color:var(--brand); }
.login-box .btn { width:100%; padding:10px; }
.login-mark, .rail-mark, .chat-none-mark {
  display:grid; place-items:center; font-weight:700; color:#fff;
  background:linear-gradient(135deg, var(--brand-dark), var(--brand));
}
.login-mark { width:54px; height:54px; border-radius:16px; font-size:19px; }
.err { color:var(--red); font-size:12px; min-height:16px; text-align:center; }

/* ── App shell ────────────────────────────────────────── */
.app { display:grid; grid-template-columns:var(--rail) var(--list) 1fr; height:100vh; }

/* Rail */
.rail {
  background:var(--pane); border-right:1px solid var(--line);
  display:flex; flex-direction:column; align-items:center; gap:4px; padding:10px 0; overflow-y:auto;
}
.rail-mark { width:38px; height:38px; border-radius:11px; font-size:13px; margin-bottom:8px; }
.rail-gap { flex:1; }
.rail-btn {
  width:56px; padding:8px 0 6px; background:none; border:none; cursor:pointer; color:var(--muted);
  display:flex; flex-direction:column; align-items:center; gap:3px; border-radius:10px; font-size:9px;
}
.rail-btn svg { width:21px; height:21px; fill:currentColor; }
.rail-btn:hover { background:var(--raise); color:var(--text); }
.rail-btn.active { color:var(--brand); background:var(--raise); }

/* ── Chat list ────────────────────────────────────────── */
.list-pane { background:var(--pane); border-right:1px solid var(--line); display:flex; flex-direction:column; overflow:hidden; }
.list-head { padding:12px 12px 6px; border-bottom:1px solid var(--line); display:flex; flex-direction:column; gap:9px; }
.list-title { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.list-title h1 { font-size:16px; font-weight:700; }
.status { display:flex; align-items:center; gap:6px; font-size:10px; color:var(--muted); }
.dot { width:8px; height:8px; border-radius:50%; background:var(--muted); }
.dot.online { background:var(--brand); } .dot.warn { background:var(--orange); } .dot.off { background:var(--red); }
.search { position:relative; }
.search input {
  width:100%; background:var(--pane-2); border:1px solid var(--line); border-radius:9px;
  padding:7px 28px 7px 11px; font-size:12px; outline:none;
}
.search input:focus { border-color:var(--brand); }
.search .x { position:absolute; right:4px; top:3px; background:none; border:none; color:var(--muted); cursor:pointer; padding:3px 6px; }
.chips { display:flex; flex-wrap:wrap; gap:5px; padding-bottom:6px; }
.chip {
  background:var(--pane-2); border:1px solid var(--line); border-radius:999px;
  padding:3px 9px; font-size:10px; cursor:pointer; display:flex; align-items:center; gap:5px;
}
.chip:hover { border-color:var(--brand); }
.chip.active { background:var(--brand); border-color:var(--brand); color:#04160c; font-weight:700; }
.chip b { font-weight:700; }
.chip.active b { color:#04160c; }
.chip .n { color:var(--muted); font-weight:700; }
.chip.active .n { color:#04160c; }

.list { flex:1; overflow-y:auto; }
.list::-webkit-scrollbar, .messages::-webkit-scrollbar, .drawer-body::-webkit-scrollbar, .view-body::-webkit-scrollbar { width:6px; }
.list::-webkit-scrollbar-thumb, .messages::-webkit-scrollbar-thumb,
.drawer-body::-webkit-scrollbar-thumb, .view-body::-webkit-scrollbar-thumb { background:var(--line); border-radius:99px; }
.row { display:flex; gap:10px; padding:9px 12px; cursor:pointer; border-left:3px solid transparent; align-items:center; }
.row:hover { background:var(--pane-2); }
.row.active { background:var(--pane-2); border-left-color:var(--brand); }
.row-main { flex:1; min-width:0; }
.row-top { display:flex; align-items:baseline; gap:6px; }
.row-name { font-size:12px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.row-time { font-size:9px; color:var(--muted); margin-left:auto; white-space:nowrap; }
.row-prev { font-size:11px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:2px; }
.row-tags { display:flex; gap:4px; align-items:center; margin-top:3px; flex-wrap:wrap; }
.mini { font-size:9px; border-radius:999px; padding:1px 6px; border:1px solid var(--line); color:var(--muted); }
.mini.reg { color:var(--brand); border-color:rgba(37,211,102,.4); }
.mini.need { color:var(--orange); border-color:rgba(240,136,62,.4); }
.mini.stop { color:var(--red); border-color:rgba(248,81,73,.4); }
.mini.child { color:var(--purple); border-color:rgba(188,140,255,.4); }
.unread { background:var(--brand); color:#04160c; font-size:9px; font-weight:700; border-radius:999px; padding:1px 6px; }
.avatar {
  position:relative; width:38px; height:38px; border-radius:50%; flex-shrink:0; color:#fff;
  display:grid; place-items:center; font-size:14px; font-weight:700;
  background:linear-gradient(135deg, var(--brand-dark), var(--brand));
}
.avatar img { position:absolute; inset:0; width:100%; height:100%; border-radius:50%; object-fit:cover; }
.empty { padding:26px 16px; text-align:center; color:var(--muted); font-size:12px; }
.list-foot { padding:8px; text-align:center; font-size:10px; color:var(--muted); min-height:10px; }

/* ── Chat pane ────────────────────────────────────────── */
.chat-pane { display:flex; overflow:hidden; background:var(--bg); }
.chat { flex:1; display:flex; flex-direction:column; overflow:hidden; }
.chat-none { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px; color:var(--muted); }
.chat-none-mark { width:64px; height:64px; border-radius:20px; font-size:22px; opacity:.5; }
.chat-head { display:flex; align-items:center; gap:10px; padding:9px 14px; background:var(--pane); border-bottom:1px solid var(--line); }
.chat-head .who { min-width:0; flex:1; }
.chat-head .name, .chat-head .sub { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chat-head .name { font-size:13px; font-weight:600; }
.chat-head .sub { font-size:10px; color:var(--muted); }
.head-actions { margin-left:auto; display:flex; gap:6px; }
.back { display:none; }

.messages { flex:1; overflow-y:auto; padding:14px 18px; display:flex; flex-direction:column; gap:8px; }
.day { align-self:center; background:var(--raise); border:1px solid var(--line); border-radius:999px; padding:2px 10px; font-size:10px; color:var(--muted); margin:6px 0; }
.msg { max-width:min(72%, 560px); display:flex; flex-direction:column; }
.msg.in { align-self:flex-start; }
.msg.out { align-self:flex-end; align-items:flex-end; }
.bubble { padding:8px 11px; border-radius:12px; font-size:13px; line-height:1.55; white-space:pre-wrap; word-break:break-word; }
.msg.in .bubble { background:var(--bubble-in); border:1px solid var(--line); border-bottom-left-radius:3px; }
.msg.out .bubble { background:var(--bubble-out); color:var(--bubble-out-text); border-bottom-right-radius:3px; }
.msg.shadow .bubble { background:transparent; border:1px dashed var(--orange); color:var(--muted); }
.meta { font-size:9px; color:var(--muted); margin-top:3px; }
.bubble audio { display:block; width:232px; max-width:100%; height:32px; margin-bottom:5px; }
.transcript { font-size:9px; color:var(--muted); margin-bottom:2px; }
.card { background:var(--pane); border:1px solid var(--line); border-radius:10px; padding:10px 12px; font-size:12px; align-self:center; width:min(100%, 560px); }
.card h4 { font-size:11px; color:var(--brand); margin-bottom:6px; }
.card table { width:100%; border-collapse:collapse; }
.card td { padding:2px 4px; } .card td:first-child { color:var(--muted); width:86px; }
.ad { display:flex; gap:10px; }
.ad img { width:52px; height:52px; border-radius:7px; object-fit:cover; flex-shrink:0; }
.banner { align-self:center; width:min(100%, 560px); border-radius:9px; padding:6px 10px; font-size:11px; border:1px solid var(--line); }

.composer { display:flex; gap:8px; padding:10px 14px; background:var(--pane); border-top:1px solid var(--line); }
.composer input { flex:1; background:var(--pane-2); border:1px solid var(--line); border-radius:9px; padding:8px 12px; font-size:13px; outline:none; }
.composer input:focus { border-color:var(--brand); }

/* ── Drawer ───────────────────────────────────────────── */
.drawer { width:var(--drawer); flex-shrink:0; background:var(--pane); border-left:1px solid var(--line); display:flex; flex-direction:column; }
.drawer-head { display:flex; align-items:center; justify-content:space-between; padding:11px 14px; border-bottom:1px solid var(--line); }
.drawer-head h2 { font-size:13px; }
.drawer-body { flex:1; overflow-y:auto; padding:12px 14px; display:flex; flex-direction:column; gap:14px; font-size:12px; }
.field { display:flex; justify-content:space-between; gap:10px; padding:3px 0; border-bottom:1px solid var(--pane-2); }
.field span:first-child { color:var(--muted); }
.drawer h3 { font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.4px; margin-bottom:6px; }
.tag { background:var(--pane-2); border:1px solid var(--line); border-radius:999px; padding:2px 9px; font-size:10px; display:inline-flex; gap:5px; align-items:center; }
.tag .x { color:var(--red); cursor:pointer; }
.note { border-bottom:1px solid var(--pane-2); padding:5px 0; font-size:11px; }
.note .when { color:var(--muted); font-size:9px; }
.row-input { display:flex; gap:6px; }
.row-input input { flex:1; background:var(--pane-2); border:1px solid var(--line); border-radius:8px; padding:6px 9px; font-size:12px; outline:none; }
.drawer select { width:100%; background:var(--pane-2); border:1px solid var(--line); border-radius:8px; padding:6px 9px; font-size:12px; }
.camp-mini { border:1px solid var(--line); border-radius:9px; padding:8px 10px; margin-bottom:8px; }
.camp-mini a { color:var(--brand); }
.icon-btn.copy { font-size:12px; padding:0 4px; }

/* ── Camps view ───────────────────────────────────────── */
.view { grid-column:2 / -1; display:flex; flex-direction:column; overflow:hidden; background:var(--bg); }
.view-head { padding:14px 18px; border-bottom:1px solid var(--line); background:var(--pane); }
.view-head h1 { font-size:16px; }
.view-tools { display:flex; align-items:center; gap:10px; margin-top:8px; flex-wrap:wrap; }
.view-tools select { background:var(--pane-2); border:1px solid var(--line); border-radius:8px; padding:6px 10px; font-size:12px; }
.view-body { flex:1; overflow-y:auto; padding:16px 18px; }
table.grid { width:100%; border-collapse:collapse; font-size:12px; background:var(--pane); border:1px solid var(--line); border-radius:10px; overflow:hidden; }
table.grid th { text-align:left; padding:9px 12px; background:var(--pane-2); color:var(--muted); font-weight:500; }
table.grid td { padding:9px 12px; border-top:1px solid var(--line); }
.pill { border-radius:999px; padding:2px 8px; font-size:10px; font-weight:600; border:1px solid var(--line); }
.pill.ok { color:var(--brand); border-color:rgba(37,211,102,.4); }
.pill.no { color:var(--red); border-color:rgba(248,81,73,.4); }

/* ── Toast ────────────────────────────────────────────── */
.toast {
  position:fixed; bottom:18px; left:50%; transform:translateX(-50%); z-index:60;
  background:var(--pane); border:1px solid var(--line); border-radius:10px;
  padding:9px 16px; font-size:12px; box-shadow:var(--shadow);
}
.toast.bad { border-color:var(--red); color:var(--red); }

/* ── Phone / tablet ───────────────────────────────────── */
@media (max-width: 900px) {
  .app { grid-template-columns:var(--rail) 1fr; }
  .list-pane { grid-column:2; }
  .chat-pane, .view { position:fixed; inset:0 0 0 var(--rail); z-index:20; background:var(--bg); }
  .chat-pane { display:none; }
  body.chat-open .chat-pane { display:flex; }
  body.chat-open .list-pane { display:none; }
  .back { display:block; }
  .drawer { position:absolute; inset:0 0 0 auto; width:min(320px, 100%); box-shadow:var(--shadow); }
  .msg { max-width:86%; }
  .rail-btn span { display:none; }
}

/* ── Reports and Settings ─────────────────────────────── */
.card-box { background:var(--pane); border:1px solid var(--line); border-radius:12px; padding:14px 16px; margin-bottom:14px; }
.card-box h3 { font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:.4px; margin-bottom:10px; }
.stats { display:grid; grid-template-columns:repeat(auto-fit, minmax(160px, 1fr)); gap:12px; margin-bottom:14px; }
.stat { background:var(--pane); border:1px solid var(--line); border-radius:12px; padding:14px; display:flex; flex-direction:column; gap:3px; }
.stat b { font-size:22px; color:var(--brand); }
.two { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.chart { position:relative; height:190px; }
.bar { display:inline-block; vertical-align:middle; width:90px; height:6px; background:var(--raise); border-radius:99px; overflow:hidden; margin-right:6px; }
.bar > span { display:block; height:100%; border-radius:99px; }
.card-box .bar { width:100%; height:8px; }
.rem-log { max-height:150px; overflow-y:auto; font-size:10px; background:var(--pane-2); border:1px solid var(--line); border-radius:8px; padding:7px; margin-top:8px; }
.sf { display:flex; flex-direction:column; gap:4px; margin-bottom:10px; font-size:12px; }
.sf > span { color:var(--muted); font-size:11px; }
.sf input, .sf select, .sf textarea {
  background:var(--pane-2); border:1px solid var(--line); border-radius:8px; padding:8px 10px; font-size:12px; outline:none; width:100%;
}
.sf input:focus, .sf textarea:focus, .sf select:focus { border-color:var(--brand); }
.sf textarea { min-height:52px; resize:vertical; }
.sf.check input { width:auto; accent-color:var(--brand); margin-right:6px; }
.sf.check > span { color:var(--text); font-size:12px; }
.sf-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.faq { display:grid; grid-template-columns:1fr 1fr 30px; gap:8px; margin-bottom:7px; }
.faq input { background:var(--pane-2); border:1px solid var(--line); border-radius:8px; padding:7px 9px; font-size:11px; outline:none; }
.tags { display:flex; flex-wrap:wrap; gap:5px; margin:6px 0; }
.view-tools .btn { text-decoration:none; }
@media (max-width: 900px) { .two, .sf-grid { grid-template-columns:1fr; } }

/* ── Composer: attachment and emoji ───────────────────── */
.attach-bar {
  display:flex; align-items:center; gap:8px; padding:7px 14px; font-size:11px;
  background:var(--pane-2); border-top:1px solid var(--line); color:var(--muted);
}
.attach-bar span { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.emoji-pad {
  display:grid; grid-template-columns:repeat(10, 1fr); gap:2px; padding:8px 14px;
  background:var(--pane-2); border-top:1px solid var(--line);
}
.emoji-pad button { background:none; border:none; cursor:pointer; font-size:18px; padding:3px; border-radius:6px; }
.emoji-pad button:hover { background:var(--raise); }
@media (max-width: 900px) { .emoji-pad { grid-template-columns:repeat(8, 1fr); } }

/* ── Per-city reminder rules and recordings ───────────── */
.city-rule { border:1px solid var(--line); border-radius:10px; padding:10px 12px; margin-top:10px; }
.city-rule-head { display:flex; align-items:center; gap:14px; flex-wrap:wrap; margin-bottom:6px; }
.city-rule textarea {
  width:100%; min-height:44px; background:var(--pane-2); border:1px solid var(--line);
  border-radius:8px; padding:7px 9px; font-size:12px; outline:none; resize:vertical;
}
.city-rule textarea:focus { border-color:var(--brand); }
.city-rule input[type="file"] { flex:1; font-size:11px; }

.warn-line {
  border:1px solid var(--orange); border-radius:9px; padding:8px 10px; margin-bottom:10px;
  font-size:11px; color:var(--orange); line-height:1.5;
}

.sug-actions { display:flex; gap:6px; margin-top:6px; }
.sug-actions .btn { padding:4px 10px; font-size:11px; }

/* ── Super Agent ──────────────────────────────────────── */
.report {
  white-space:pre-wrap; font-family:inherit; font-size:12px; line-height:1.65;
  background:var(--pane-2); border:1px solid var(--line); border-radius:10px;
  padding:12px 14px; margin:10px 0; max-height:420px; overflow:auto;
}
.agent-answer { font-size:12px; color:var(--brand); margin-top:8px; min-height:16px; white-space:pre-wrap; }

/* ── Gujranwala: bhejne ke qawaid ────────────────────── */
.guj-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(210px,1fr)); gap:12px; }
.guj-grid label { display:flex; flex-direction:column; gap:4px; font-size:12px; color:var(--muted); }
.guj-grid input[type=number], .guj-grid input[type=time] {
  width:100%; padding:7px 9px; border-radius:8px; border:1px solid var(--line);
  background:var(--pane-2); color:var(--text); font:inherit; font-size:13px;
}
.guj-grid .pair { display:flex; align-items:center; gap:6px; }
.guj-grid label.tick { flex-direction:row; align-items:center; gap:8px; color:var(--text); font-size:13px; }
.guj-grid label.tick input[type=time] { max-width:120px; }

.guj-grid textarea {
  width:100%; padding:8px 10px; border-radius:8px; border:1px solid var(--line);
  background:var(--pane-2); color:var(--text); font:inherit; font-size:12px; line-height:1.55; resize:vertical;
}

.pill.part-done { border-color:var(--ok,#22c55e); color:var(--ok,#22c55e); }
.pill.part-now  { border-color:var(--brand); color:var(--brand); font-weight:600; }
.pill.part-wait { opacity:.6; }

/* ── Intezar, "ho gaya", aur ready-made jawab ──────────── */
.waiting { font-size:11px; color:var(--muted); }
.waiting.late { color:var(--red,#ef4444); font-weight:600; }
.row-done {
  align-self:center; margin-left:6px; width:26px; height:26px; flex:0 0 26px;
  border-radius:50%; border:1px solid var(--line); background:var(--pane-2);
  color:var(--muted); cursor:pointer; font-size:13px; line-height:1;
}
.row-done:hover { color:var(--ok,#22c55e); border-color:var(--ok,#22c55e); }
.canned-sheet {
  position:absolute; bottom:64px; left:12px; right:12px; z-index:30;
  background:var(--pane); border:1px solid var(--line); border-radius:12px;
  padding:8px; max-height:280px; overflow:auto; box-shadow:0 10px 30px rgba(0,0,0,.25);
}
.canned-sheet button {
  display:block; width:100%; text-align:right; direction:rtl;
  background:none; border:0; border-radius:8px; padding:8px 10px;
  color:var(--text); font:inherit; font-size:13px; cursor:pointer;
}
.canned-sheet button:hover { background:var(--pane-2); }
.canned-sheet .cl { display:block; direction:ltr; text-align:left; font-size:11px; color:var(--muted); }

.tbl td.good { color:var(--ok,#22c55e); font-weight:600; }
.tbl td.bad  { color:var(--red,#ef4444); }

/* Reports ke chhote table aur unwan — ginti parhne mein asaan rahe */
.sec-head { display:flex; justify-content:space-between; align-items:flex-start; gap:10px; flex-wrap:wrap; margin-bottom:6px; }
.sec-head h2 { font-size:14px; }
.tbl { width:100%; border-collapse:collapse; font-size:12px; }
.tbl th { text-align:left; font-size:11px; color:var(--muted); font-weight:600; padding:6px 6px; border-bottom:1px solid var(--line); }
.tbl td { padding:5px 6px; border-bottom:1px solid var(--line); vertical-align:middle; }
.tbl tr:last-child td { border-bottom:0; }
