:root {
  --bg: #f3f5f9; --card: #fff; --text: #172033; --muted: #66708a; --line: #e2e6ef;
  --primary: #0f5fd7; --primary-text: #fff; --brand: #2f4f93; --red: #d92d20; --amber: #c27803; --green: #138a4b;
  --bubble: #fff; --mine: #d9fdd3; --chatbg: #efeae2; --sysbg: #e9edef; --systxt: #54656f;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1420; --card: #182033; --text: #e8ecf5; --muted: #95a0b8; --line: #2a3550;
    --primary: #3d82f0; --brand: #8fb0ee; --bubble: #202c33; --mine: #005c4b; --chatbg: #0b141a; --sysbg: #182229; --systxt: #8696a0; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 13px; } .err { color: var(--red); min-height: 1.2em; }
input, textarea, select { font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card); color: var(--text); margin-top: 4px; }
label { display: block; margin: 10px 0; font-size: 14px; color: var(--muted); }
label.row { display: flex; gap: 8px; align-items: center; } label.row input { width: auto; margin: 0; }
.btn { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 9px 14px; border-radius: 10px; cursor: pointer; }
.btn.primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.btn.big { width: 100%; padding: 13px; font-size: 17px; font-weight: 600; }
.btn.green { background: var(--green); color: #fff; border-color: var(--green); }
.btn.red { color: var(--red); border-color: var(--red); }
.btn:disabled { opacity: .5; }
.icon-btn { background: none; border: 0; font-size: 22px; padding: 6px 8px; cursor: pointer; color: var(--text); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }

.screen { height: 100%; }
#login { display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; text-align: center; }
.login-card label { text-align: left; }
.login-logo { width: min(240px, 80%); height: auto; display: block; margin: 4px auto 8px; background: #fff; border-radius: 12px; padding: 6px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 46px; height: auto; background: #fff; border-radius: 8px; padding: 3px; flex-shrink: 0; }
.brand-text { min-width: 0; }
.brand-name { font-weight: 800; letter-spacing: .04em; color: var(--brand); font-size: 17px; line-height: 1.1; }
.brand-text .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#app { display: flex; flex-direction: column; max-width: 900px; margin: 0 auto; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top)); background: var(--card); border-bottom: 1px solid var(--line); }
.top-actions { display: flex; align-items: center; gap: 4px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); display: inline-block; }
.dot.on { background: var(--green); }
.menu { position: fixed; right: 12px; top: 56px; z-index: 20; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 8px 24px #0003; display: flex; flex-direction: column; overflow: hidden; }
.menu button { background: none; border: 0; padding: 12px 18px; text-align: left; font: inherit; color: var(--text); cursor: pointer; }
.menu button:hover { background: var(--bg); }

.tab { flex: 1; overflow-y: auto; padding: 12px 16px 16px; position: relative; }
.search { margin: 0 0 10px; }
.calls:not(:empty) { margin-bottom: 12px; }
.call { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--primary); border-radius: 12px; padding: 10px 12px; }
.call.pritje { border-left-color: var(--red); }
.call.pranuar { border-left-color: var(--green); }
.call .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.call p { margin: 4px 0; white-space: pre-wrap; }
.alarm-btns { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.hist { font-size: 14px; border-left: 3px solid var(--line); padding: 4px 0 8px 10px; white-space: pre-wrap; }
.hist .muted { font-size: 12px; }
.close-photo { max-width: 100%; max-height: 220px; border-radius: 10px; margin-top: 6px; display: block; }
#histDlg .dlg { max-height: 80vh; overflow-y: auto; }
.filters { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 20px;
  padding: 6px 12px; font: inherit; font-size: 14px; white-space: nowrap; cursor: pointer; }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.list { display: flex; flex-direction: column; gap: 10px; }
.fault { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--amber); border-radius: 12px; padding: 12px; }
.fault.hapur { border-left-color: var(--red); } .fault.mbyllur { border-left-color: var(--green); opacity: .9; }
.fault .head { display: flex; justify-content: space-between; gap: 8px; }
.fault h4 { margin: 0; font-size: 17px; }
.fault p { margin: 6px 0; white-space: pre-wrap; }
.fault .meta { font-size: 13px; color: var(--muted); }
.fault .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--bg); white-space: nowrap; align-self: start; }
.tag.red { background: var(--red); color: #fff; } .tag.green { background: var(--green); color: #fff; } .tag.amber { background: var(--amber); color: #fff; }
.fab { position: fixed; right: max(20px, calc(50% - 430px)); bottom: 84px; width: 58px; height: 58px; border-radius: 50%;
  border: 0; background: var(--primary); color: #fff; font-size: 30px; box-shadow: 0 6px 16px #0004; cursor: pointer; z-index: 5; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

#tab-chat { display: flex; flex-direction: column; padding: 0; }
.chat { flex: 1; overflow-y: auto; padding: 10px 10px; display: flex; flex-direction: column; gap: 4px; background: var(--chatbg); }
/* Biseda si WhatsApp: flluska të vogla, të tjerët majtas, të mitë djathtas në jeshile; njoftimet automatike si rresht gri në mes */
.msg { max-width: 80%; background: var(--bubble); border-radius: 8px; padding: 5px 8px 4px; align-self: flex-start; font-size: 15px;
  box-shadow: 0 1px 0.5px rgba(0,0,0,.13); position: relative; }
.msg.mine { align-self: flex-end; background: var(--mine); }
.msg .who { font-size: 12.5px; font-weight: 600; color: var(--primary); margin-bottom: 1px; }
/* Te Biseda secili person me ngjyrën e vet (si te WhatsApp): emri me ngjyrë (--nc, sipas id % 12)
   dhe kutia e mesazhit e ngjyrosur lehtë me të njëjtën ngjyrë */
.msg.nc0 { --nc: #0f5fd7; }
.msg.nc1 { --nc: #c0392b; }
.msg.nc2 { --nc: #138a4b; }
.msg.nc3 { --nc: #8e44ad; }
.msg.nc4 { --nc: #d35400; }
.msg.nc5 { --nc: #00838f; }
.msg.nc6 { --nc: #ad1457; }
.msg.nc7 { --nc: #6d4c41; }
.msg.nc8 { --nc: #2e7d32; }
.msg.nc9 { --nc: #3949ab; }
.msg.nc10 { --nc: #b7791f; }
.msg.nc11 { --nc: #546e7a; }
@media (prefers-color-scheme: dark) {
  .msg.nc0 { --nc: #6ea8ff; }
  .msg.nc1 { --nc: #ff7b72; }
  .msg.nc2 { --nc: #4cd38a; }
  .msg.nc3 { --nc: #c99bf0; }
  .msg.nc4 { --nc: #ffa65c; }
  .msg.nc5 { --nc: #4dd0e1; }
  .msg.nc6 { --nc: #f48fb1; }
  .msg.nc7 { --nc: #d7b29d; }
  .msg.nc8 { --nc: #9ccc65; }
  .msg.nc9 { --nc: #9fa8ff; }
  .msg.nc10 { --nc: #ffd54f; }
  .msg.nc11 { --nc: #b0bec5; }
}
.msg[class*=" nc"] .who { color: var(--nc); }
.msg[class*=" nc"] { background: color-mix(in srgb, var(--nc) 9%, var(--bubble)); }
@media (prefers-color-scheme: dark) { .msg[class*=" nc"] { background: color-mix(in srgb, var(--nc) 14%, var(--bubble)); } }
.msg .txt { white-space: pre-wrap; word-wrap: break-word; line-height: 1.3; }
.msg .time { font-size: 10.5px; color: var(--muted); text-align: right; margin-top: 1px; }
.msg img, .msg video { max-width: 100%; max-height: 320px; border-radius: 6px; display: block; margin-top: 3px; }
.msg.sys { align-self: center; max-width: 92%; background: var(--sysbg); box-shadow: none; border-radius: 8px; padding: 4px 10px;
  font-size: 12.5px; color: var(--systxt); text-align: center; }
.msg.sys .who { display: none; }
.msg.sys.cmim { background: #fff4cc; color: #5a4300; font-weight: 600; padding: 8px 12px; }
.msg.sys .txt { line-height: 1.3; }
.msg.sys .time { display: inline; margin-left: 6px; font-size: 10.5px; }
.msg.sys .txt + .time { display: block; text-align: center; margin: 0; }
.composer { display: flex; gap: 2px; align-items: center; padding: 8px; background: var(--card); border-top: 1px solid var(--line); }
.composer input#chatText { margin: 0; flex: 1; }
.composer .icon-btn { font-size: 20px; padding: 6px 4px; }
.upload-info { padding: 6px 12px; font-size: 13px; background: var(--card); }

.report-head { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; } .report-head .rbtn { position: relative; flex: 1 1 150px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font: inherit; color: var(--text); cursor: pointer; }
.report-head .rbtn.on { border: 2px solid var(--primary); }
.report-head .rb-t { font-weight: 600; font-size: 14px; } .report-head .rb-v { font-size: 13px; color: var(--muted); }
.report-head #monthPick { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; -webkit-appearance: none; appearance: none; }
.report-head .date-panel { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 12px; }
.report-head .date-panel label { flex: 1 1 140px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.report-head .date-panel input { width: 100%; min-height: 46px; display: block; -webkit-appearance: none; appearance: none; color: var(--text); margin: 0; }
.report-head .date-panel input::-webkit-date-and-time-value { text-align: left; }
.report-head .date-actions { flex-basis: 100%; display: flex; gap: 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.stat b { display: block; font-size: 24px; }
.rep-list .cl-link { color: var(--primary); font-weight: 600; text-decoration: underline; }
.rep-list .rep-q { width: 100%; margin: 4px 0 8px; }
button.stat { font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.stat .more { display: block; font-size: 12px; color: var(--primary); margin-top: 2px; }
.stat.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary) inset; }
.rep-list { margin-bottom: 12px; } .rep-list h3 { margin: 0; font-size: 16px; }
.tech { margin-bottom: 10px; }
.tech summary { cursor: pointer; display: flex; justify-content: space-between; gap: 8px; align-items: center; list-style: none; }
.tech summary::-webkit-details-marker { display: none; }
table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 14px; margin-top: 10px; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; }
.table-wrap { overflow-x: auto; }

.rank-box { margin-bottom: 12px; } .rank-box h3 { margin: 0; }
.rank-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.rank { margin: 8px 0 0; } .rank .pts { font-size: 15px; font-weight: 600; } .bad { color: var(--red); }
.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 6px 10px; margin: 8px 0; }
#teamBox { margin: 12px 0; } #teamBox h3 { margin-top: 0; }
.team-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.team-form { display: grid; grid-template-columns: 1fr; gap: 6px; margin-top: 10px; }
.devs { margin-top: 6px; } .dev { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; padding: 3px 0; }
.btn.small { padding: 3px 10px; font-size: 13px; }
.user { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

nav.bottom { display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
nav.bottom button { flex: 1; background: none; border: 0; padding: 8px 0 6px; font: inherit; font-size: 12px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; position: relative; cursor: pointer; }
nav.bottom button span { font-size: 22px; }
nav.bottom button.active { color: var(--primary); font-weight: 600; }
.badge { position: absolute; top: 4px; left: 55%; background: var(--red); color: #fff; font-size: 11px; border-radius: 10px; padding: 0 6px; }

dialog { border: 0; border-radius: 16px; padding: 0; width: min(94vw, 440px); background: var(--card); color: var(--text); }
dialog::backdrop { background: #0008; }
.dlg { padding: 16px; } .dlg h3 { margin-top: 0; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

.alarm { position: fixed; inset: 0; background: #d92d20ee; z-index: 100; display: grid; place-items: center; padding: 16px; }
.alarm-box { background: var(--card); border-radius: 18px; padding: 24px; text-align: center; max-width: 380px; width: 100%; }
.alarm-box p { white-space: pre-wrap; }
.bell { font-size: 64px; animation: ring .5s infinite alternate; }
@keyframes ring { from { transform: rotate(-18deg); } to { transform: rotate(18deg); } }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: #172033; color: #fff;
  padding: 10px 16px; border-radius: 10px; z-index: 200; max-width: 90vw; }

@media print {
  .top, nav.bottom, .report-head, .fab, .tab:not(#tab-reports) { display: none !important; }
  .tab { overflow: visible; } details { display: block; } details > * { display: block; }
  body { background: #fff; color: #000; }
}

/* Lista e klientëve nga Radius Manager */
.sugg-list { display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow-y: auto; }
.sugg { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 8px 10px;
  border: 1px solid var(--line, #ddd); border-radius: 8px; background: var(--card, #fff); color: inherit; font: inherit; cursor: pointer; }
.sugg:hover, .sugg:focus { border-color: var(--primary); }

.sort-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -4px 0 10px; }
.small-chip { font-size: 13px; padding: 5px 10px; }
.sort-bar select { padding: 5px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
.top-row { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.top-rank { font-weight: 800; font-size: 18px; min-width: 2em; color: var(--muted); }
.top-count { margin-left: auto; text-align: right; font-weight: 800; font-size: 20px; }
.top-count small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }

.chat-search { display: flex; gap: 6px; padding: 8px 12px 0; }
.chat-search input { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; }
.chat-search input[type=search] { flex: 1 1 auto; width: auto; }
.chat-search input[type=date] { flex: 0 0 140px; width: 140px; }
.chat-note { text-align: center; color: var(--muted); font-size: 13px; padding: 4px; }

/* Butoni + te biseda (si WhatsApp): hap galerinë, kamerën ose videon */
.composer { position: relative; }
.plus-btn { background: none; border: 0; font-size: 28px; line-height: 1; width: 40px; height: 40px; border-radius: 50%; color: var(--muted); cursor: pointer; }
.plus-btn.open { transform: rotate(45deg); color: var(--primary); }
.attach-menu { position: absolute; left: 0; right: 0; bottom: 100%; background: var(--sheet, #e9e9ee); border-radius: 22px 22px 0 0;
  box-shadow: 0 -4px 16px rgba(0,0,0,.12); padding: 22px 12px 18px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 6px; z-index: 20; }
.attach-menu label { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 0; padding: 0; cursor: pointer; font-size: 14px; color: var(--text); text-align: center; }
.attach-menu .ico { width: 64px; height: 64px; border-radius: 50%; background: var(--card); display: grid; place-items: center; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.attach-menu label:active .ico { filter: brightness(.9); }
.attach-menu small { font-size: 11px; color: var(--muted); margin-top: -6px; }
@media (prefers-color-scheme: dark) { .attach-menu { --sheet: #1f2c33; } }

/* Shikuesi i fotove/videove te biseda */
.viewable { cursor: pointer; }
.vthumb { position: relative; margin-top: 3px; }
.vthumb video { pointer-events: none; }
.vthumb .play { position: absolute; inset: 0; margin: auto; width: 52px; height: 52px; border-radius: 50%; background: #0009; color: #fff; display: grid; place-items: center; font-size: 22px; padding-left: 4px; }
.viewer { position: fixed; inset: 0; background: #000; z-index: 200; display: flex; align-items: center; justify-content: center; }
.viewer img, .viewer video { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-close { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 12px; z-index: 1; width: 44px; height: 44px; border-radius: 50%; border: 0; background: #000a; color: #fff; font-size: 22px; box-shadow: 0 0 0 2px #fff6; }

/* Vendndodhja e teknikëve */
.loc-note { font-size: 12px; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; margin-bottom: 8px; }
.loc-note.warn { color: #b42318; border-color: #f3b3ac; }
dialog.wide { width: min(96vw, 640px); }
.loc-map { height: 50vh; min-height: 260px; border-radius: 12px; overflow: hidden; margin-bottom: 10px; background: var(--bg); }
.loc-row { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.loc-row > div, .loc-row > a { flex-basis: 100%; }
.loc-row.old b { color: var(--muted); }

/* Stafi: kush e përdor programin */
.user .seen { font-size: 12px; color: var(--muted); margin-top: 3px; }
.user .seen.on { color: #12813f; font-weight: 600; }

/* Linjë kryesore: kartelë e kuqe që bie në sy */
article.fault.mainline { border: 2px solid #d92d20; background: #fff1f0; box-shadow: 0 0 0 3px #d92d2033; }
@media (prefers-color-scheme: dark) { article.fault.mainline { background: #3a1513; } }
.mainline-opt { align-items: flex-start; color: #b42318; }

/* Përgjigje mesazhit (si WhatsApp) */
.msg .quote, .reply-bar .quote { border-left: 4px solid var(--primary); background: #0000000d; border-radius: 6px; padding: 4px 8px; margin: 2px 0 4px; font-size: 13px; display: flex; flex-direction: column; overflow: hidden; }
.msg .quote { cursor: pointer; }
.msg .quote b, .reply-bar .quote b { color: var(--primary); font-size: 12.5px; }
.msg .quote span, .reply-bar .quote span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px 0; background: var(--card); border-top: 1px solid var(--line); }
.reply-bar .quote { flex: 1; margin: 0; min-width: 0; }
.reply-bar button { border: 0; background: none; font-size: 20px; color: var(--muted); width: 36px; height: 36px; }
.reply-bar + .composer { border-top: 0; }
.msg.swiping { transition: none; }
.msg { transition: transform .15s ease; -webkit-touch-callout: none; }
.msg .txt { -webkit-user-select: text; user-select: text; }
.msg-menu { position: fixed; z-index: 60; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.22); padding: 4px; display: flex; flex-direction: column; min-width: 190px; }
.msg-menu button { font: inherit; text-align: left; border: 0; background: none; color: var(--text); padding: 11px 12px; border-radius: 8px; }
.msg-menu button:hover, .msg-menu button:active { background: var(--line); }
.msg.flash { animation: msgflash 1.4s ease; }
@keyframes msgflash { 0%, 40% { box-shadow: 0 0 0 4px #f5c84ccc; } 100% { box-shadow: 0 0 0 0 #f5c84c00; } }
@media (prefers-color-scheme: dark) { .msg .quote, .reply-bar .quote { background: #ffffff14; } }

/* Mesazhet me zë */
.mic-btn, .send-btn { width: 44px; height: 44px; border-radius: 50%; padding: 0; display: grid; place-items: center; flex: none; }
.composer.recording > :not(.rec-bar) { display: none !important; }
.rec-bar { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 44px; }
.rec-bar.hidden { display: none; }
.rec-cancel { background: none; border: 0; font-size: 22px; padding: 6px; cursor: pointer; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #e5484d; animation: recblink 1s infinite; }
.rec-hint { flex: 1; color: var(--muted); font-size: 14px; }
#recTime { font-variant-numeric: tabular-nums; font-weight: 600; }
#recSend { width: 44px; height: 44px; border-radius: 50%; padding: 0; }
@keyframes recblink { 50% { opacity: .2; } }
.voice { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.voice audio { height: 40px; width: 240px; max-width: 62vw; }

/* Regjistrimi i videos */
.camrec { position: fixed; inset: 0; background: #000; z-index: 210; display: flex; align-items: center; justify-content: center; }
.camrec video { width: 100%; height: 100%; object-fit: contain; }
.camrec video.mirror { transform: scaleX(-1); }
.cam-time { position: absolute; top: calc(18px + env(safe-area-inset-top)); left: 0; right: 0; text-align: center; color: #fff; font-weight: 600; text-shadow: 0 1px 3px #000; font-variant-numeric: tabular-nums; pointer-events: none; }
.cam-bar { position: absolute; left: 0; right: 0; bottom: calc(24px + env(safe-area-inset-bottom)); display: flex; justify-content: space-around; align-items: center; gap: 12px; padding: 0 16px; }
.cam-bar.hidden { display: none; }
.cam-side { width: 52px; height: 52px; border-radius: 50%; border: 0; background: #0008; color: #fff; font-size: 24px; }
span.cam-side { background: none; }
.cam-side:disabled { opacity: .3; }
.cam-shot { width: 76px; height: 76px; border-radius: 50%; border: 4px solid #fff; background: transparent; display: grid; place-items: center; padding: 0; }
.cam-shot span { width: 58px; height: 58px; border-radius: 50%; background: #e5484d; transition: all .2s; }
.cam-shot.on span { width: 30px; height: 30px; border-radius: 6px; }
#camDone .btn { flex: 1; max-width: 200px; font-size: 17px; padding: 14px; }

/* Shkarkimi i videos para luajtjes */
.viewer-load { display: flex; flex-direction: column; align-items: center; gap: 14px; color: #fff; font-size: 16px; }
.viewer-load .spin { width: 44px; height: 44px; border-radius: 50%; border: 4px solid #fff3; border-top-color: #fff; animation: vspin 1s linear infinite; }
@keyframes vspin { to { transform: rotate(360deg); } }
.sec-log { padding-left: 18px; max-height: 200px; overflow: auto; font-size: 13px; }
.sec-log li { margin-bottom: 6px; }

/* 📦 Magazina */
.inv-pick-wrap { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.inv-pick { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; }
.inv-row { display: flex; align-items: center; gap: 6px; }
.inv-row > span:first-child { flex: 1; }
.inv-row button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 18px; }
.inv-row input { width: 58px; text-align: center; margin: 0; padding: 6px 2px; }
.inv-row .unit { width: 30px; }
.inv-t { min-width: 0; }
.inv-t td:not(:first-child), .inv-t th:not(:first-child) { white-space: nowrap; }
.inv-red { color: #c0392b; }
.inv-low { border-color: #e0a100; background: color-mix(in srgb, #f5c84c 18%, var(--card)); }
.inv-more summary { cursor: pointer; padding: 6px 0; color: var(--primary); font-size: 14px; }
.inv-more .inv-row { margin-top: 4px; }
.inv-t td:first-child { min-width: 150px; }
.inv-act { white-space: nowrap; }
.inv-act input { width: 56px; padding: 5px 4px; margin: 0 4px 0 0; text-align: center; display: inline-block; }
.inv-act .btn { padding: 5px 8px; margin-left: 2px; }
.inv-name { color: inherit; text-decoration: none; border-bottom: 1px dashed var(--muted); }

/* 🎉 Asnjë defekt aktiv */
.happy { position: relative; overflow: hidden; text-align: center; padding: 48px 16px 40px; }
/* logoja KORABI-NET si hije e lehtë në mes (pas figurës dhe tekstit) */
.happy::before { content: ''; position: absolute; inset: 0; background: url(/logo-wm.png) center 42% / min(78%, 380px) auto no-repeat; opacity: .09; pointer-events: none; }
.happy > :not(.happy-conf) { position: relative; }
@media (prefers-color-scheme: dark) { .happy::before { opacity: .16; filter: brightness(1.8); } }
.happy-fig { font-size: 84px; line-height: 1; display: inline-block; animation: happy-bounce 1.6s ease-in-out infinite; }
.happy-txt { font-size: 21px; font-weight: 700; margin: 18px auto 6px; max-width: 460px; animation: happy-in .6s ease-out both; }
.happy-conf { position: absolute; inset: 0; pointer-events: none; }
.happy-conf i { position: absolute; top: -14px; left: var(--x); width: 8px; height: 13px; border-radius: 2px; background: var(--c); opacity: .85;
  animation: happy-fall 3.2s linear var(--d) infinite; }
@keyframes happy-bounce { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-14px) rotate(4deg); } }
@keyframes happy-in { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
@keyframes happy-fall { to { transform: translateY(340px) rotate(540deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .happy-fig, .happy-conf i, .happy-txt { animation: none; } .happy-conf { display: none; } }

/* 🎮 Lojërat */
.games { margin: 0 auto 90px; max-width: 520px; }
.game-h { text-align: center; margin: 4px 0 12px; }
.game-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.game-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; border-radius: 14px; border: 1px solid var(--line, #e2e8f0);
  background: var(--card, #fff); color: inherit; font: inherit; cursor: pointer; transition: transform .12s; }
.game-card:active { transform: scale(.96); }
.game-ic { font-size: 38px; }
.center { text-align: center; }
.game-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.game-area { display: flex; flex-direction: column; align-items: center; gap: 10px; touch-action: none; }
.game-canvas { width: min(100%, 340px); aspect-ratio: 1; border-radius: 12px; touch-action: none; }
.game-pad { display: grid; grid-template-columns: repeat(3, 56px); grid-template-rows: 48px 48px; gap: 6px; }
.game-pad button { font-size: 20px; border-radius: 10px; border: 1px solid var(--line, #cbd5e1); background: var(--card, #fff); color: inherit; }
.game-pad [data-dir=U] { grid-column: 2; } .game-pad [data-dir=L] { grid-column: 1; grid-row: 2; }
.game-pad [data-dir=D] { grid-column: 2; grid-row: 2; } .game-pad [data-dir=R] { grid-column: 3; grid-row: 2; }
.game-over { text-align: center; margin-top: 14px; padding: 14px; border-radius: 14px; background: var(--card, #fff); }
.game-big { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.game-top { text-align: left; max-width: 260px; margin: 6px auto; } .game-top li { display: flex; justify-content: space-between; }
.mem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: min(100%, 340px); }
.mem-card { aspect-ratio: 1; border-radius: 12px; border: none; background: #2563eb; font-size: 30px; cursor: pointer; }
.mem-card span { visibility: hidden; } .mem-card.up { background: var(--card, #fff); outline: 2px solid #93c5fd; } .mem-card.up span { visibility: visible; }
.mem-card.ok { background: #dcfce7; outline-color: #22c55e; }
.g48 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 8px; border-radius: 12px; background: #bbada0; width: min(100%, 340px); touch-action: none; }
.t48 { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 8px; font-weight: 800; font-size: 26px; background: #cdc1b4; color: #776e65; }
.t48.v2 { background: #eee4da; } .t48.v4 { background: #ede0c8; } .t48.v8 { background: #f2b179; color: #fff; } .t48.v16 { background: #f59563; color: #fff; }
.t48.v32 { background: #f67c5f; color: #fff; } .t48.v64 { background: #f65e3b; color: #fff; } .t48.v128, .t48.v256, .t48.v512 { background: #edcf72; color: #fff; font-size: 22px; }
.t48.v1024, .t48.v2048, .t48.v4096 { background: #edc22e; color: #fff; font-size: 19px; }
.quiz-q { font-size: 19px; font-weight: 700; text-align: center; margin: 8px 0 12px; }
.quiz-opts { display: grid; gap: 8px; width: min(100%, 420px); } .quiz-o { padding: 12px; font-size: 16px; }
.horo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: min(100%, 420px); }
.horo-s { padding: 8px 4px; font-size: 14px; } .horo p { margin: 6px 0; } .horo-luck { font-size: 22px; }
.game-menu .game-card:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* 🎂 🌦️ 📊 🏅 😂 */
.bday { margin: 8px 0; padding: 12px 14px; border-radius: 14px; text-align: center; font-size: 17px;
  background: linear-gradient(90deg, #fde68a, #fbcfe8, #bfdbfe); color: #1e293b; animation: happy-in .6s ease-out both; }
.fun { max-width: 520px; margin: 0 auto 14px; display: grid; gap: 10px; }
.fun h4 { margin: 0 0 8px; }
.fun-now { display: flex; align-items: center; gap: 10px; font-size: 26px; } .fun-big { font-size: 40px; }
.fun-days { display: grid; gap: 4px; margin-top: 6px; }
.fun-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.fun-stats b { display: block; font-size: 22px; color: #2563eb; } .fun-stats span { font-size: 12px; color: var(--muted); }
.fun-medals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.medal { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 8px 4px; border-radius: 12px;
  border: 1px solid var(--line); filter: grayscale(1); opacity: .6; }
.medal.won { filter: none; opacity: 1; background: color-mix(in srgb, #facc15 14%, var(--card)); border-color: #facc15; }
.medal-ic { font-size: 30px; } .medal b { font-size: 13px; } .medal .small { font-size: 11px; }
.medal-ok { font-size: 11px; color: #16a34a; font-weight: 700; }
.medal-bar { width: 80%; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; } .medal-bar i { display: block; height: 100%; background: #2563eb; }
.fun-joke p { margin: 0; font-size: 16px; }
@media (max-width: 380px) { .fun-stats { grid-template-columns: repeat(2, 1fr); } .fun-medals { grid-template-columns: repeat(2, 1fr); } }
/* Biseda si WhatsApp (15.10): ditët, reagimet, ✓✓, duke shkruar, ⬇, @përmendje */
.chat-wrap { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-wrap .chat { flex: 1; }
.day-sep { align-self: center; margin: 8px 0 4px; }
.day-sep span { background: var(--sysbg); color: var(--muted); font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 8px; box-shadow: 0 1px 1px #0000001a; }
.msg.cont { margin-top: -2px; }
.msg .time i { font-style: italic; margin-right: 2px; }
.msg .ticks { margin-left: 4px; font-size: 11px; letter-spacing: -3px; color: var(--muted); font-weight: 700; }
.msg .ticks.read { color: #34b7f1; }
.msg .txt a { color: #027eb5; text-decoration: underline; overflow-wrap: anywhere; }
@media (prefers-color-scheme: dark) { .msg .txt a { color: #53bdeb; } }
.mention { color: #027eb5; font-weight: 600; }
.mention.me { background: #fff3a0; color: #5a4300; border-radius: 4px; padding: 0 2px; }
.msg.at-me { box-shadow: 0 0 0 2px #f5c518; }
.msg.has-reacts { margin-bottom: 14px; position: relative; }
.reacts { position: absolute; bottom: -16px; right: 8px; display: flex; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1px 5px; font-size: 14px; box-shadow: 0 1px 2px #0002; }
.msg:not(.mine) .reacts { right: auto; left: 8px; }
.reacts span.mine { filter: drop-shadow(0 0 1px #34b7f1); }
.reacts small { font-size: 11px; color: var(--muted); margin-left: 1px; }
.react-row { display: flex; gap: 2px; padding: 2px 2px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.msg-menu .react-row button { font-size: 22px; padding: 6px 5px; border-radius: 50%; }
.typing-bar { font-size: 13px; color: var(--primary); padding: 3px 14px; background: var(--chatbg); font-style: italic; }
.down-btn { position: absolute; right: 12px; bottom: 12px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--card); color: var(--muted); font-size: 26px; line-height: 30px; box-shadow: 0 2px 6px #0003; z-index: 5; cursor: pointer; }
.down-btn b { position: absolute; top: -6px; right: -4px; background: #25d366; color: #fff; font-size: 11px; min-width: 20px; height: 20px; line-height: 20px; border-radius: 10px; padding: 0 5px; }
.mention-box { display: flex; flex-direction: column; background: var(--card); border-top: 1px solid var(--line); max-height: 220px; overflow-y: auto; }
.mention-box button { text-align: left; font: inherit; border: 0; background: none; color: var(--text); padding: 10px 14px; border-bottom: 1px solid var(--line); }
.reply-bar.editing .quote { border-left-color: #f59e0b; }
.reply-bar.editing .quote b { color: #b45309; }
