/* OZEL CRM — team chat & calls (add-on styles) */

/* chat button next to the bell */
#chatBtn { position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); left: 62px; z-index: 40; width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center;
  background: #fff; border: 1px solid var(--line); color: var(--olive); box-shadow: var(--shadow); }
#chatBtn i { position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: var(--green); color: #fff; font-size: 11px; font-style: normal; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px #fff; }
@media (min-width: 960px) { #chatBtn { left: 72px; top: 20px; } }
.topbar, .hello { padding-left: 100px; }
.hero-bar { padding-inline-end: 98px; }

/* list */
.chat-list { display: flex; flex-direction: column; }
.chat-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.chat-row-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.chat-row-top small { color: var(--muted); font-size: 11.5px; flex: none; }
.chat-row-sub { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-top: 2px; }
.chat-row-sub > span:first-child { flex: 1; min-width: 0; }
.chat-row.has-unread .chat-row-top small { color: var(--green); font-weight: 700; }
.chat-row.has-unread .chat-row-sub { color: var(--olive); font-weight: 600; }
.chat-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--green); color: #fff; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; flex: none; }
.muted-ic .ic { width: 14px; height: 14px; }
.live-call { color: var(--green); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.live-call .ic { width: 13px; height: 13px; }
.avatar.grp { background: var(--olive); color: var(--sand); }
.avatar.grp .ic { width: 55%; height: 55%; }
.people { display: flex; flex-direction: column; max-height: 60dvh; overflow-y: auto; }
.person { display: flex; align-items: center; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.person small { display: block; color: var(--muted); font-size: 12px; }
.person input { width: 20px; height: 20px; accent-color: var(--olive); }

/* conversation — full screen, no bottom menu */
body.chat-open .nav, body.chat-open #bell, body.chat-open #chatBtn { display: none; }
body.chat-open .view { padding-bottom: 0; }
body.chat-open .page { padding: 0; max-width: none; gap: 0; }
.chat-wrap { display: flex; flex-direction: column; height: 100vh; height: 100dvh; background: #f4f1ea; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 8px; background: #fff; border-bottom: 1px solid var(--line); flex: none; }
.chat-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: start; }
.chat-who b { font-size: 15.5px; }
.chat-who small { display: block; color: var(--muted); font-size: 12px; }
.chat-who .avatar { width: 40px; height: 40px; }
.typing { color: var(--green); font-weight: 600; }
.call-banner { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 9px; background: #e4f6ef; color: #12734f; font-size: 13.5px; }
.call-banner .ic { width: 16px; height: 16px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 10px 10px 14px; display: flex; flex-direction: column; gap: 2px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  background-image: radial-gradient(rgba(191,174,142,.18) 1px, transparent 1px); background-size: 18px 18px; }
.day-sep { text-align: center; margin: 10px 0 6px; }
.day-sep span { font-size: 11.5px; background: #fff; color: var(--olive-3); padding: 3px 12px; border-radius: 99px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.sys-msg { align-self: center; font-size: 12px; color: var(--muted); background: rgba(255,255,255,.8); padding: 4px 12px; border-radius: 10px; margin: 6px 0; text-align: center; max-width: 85%; }
.call-msg { align-self: center; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; background: #fff; padding: 6px 14px; border-radius: 12px; margin: 6px 0; color: var(--olive-3); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.call-msg .ic { width: 15px; height: 15px; color: var(--green); }
.call-msg.missed .ic { color: var(--danger); }
.call-msg small { color: var(--muted); }
.msg { display: flex; flex-direction: column; max-width: 82%; margin-top: 6px; }
.msg.cont { margin-top: 1px; }
.msg.theirs { align-self: flex-start; align-items: flex-start; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg-author { font-size: 12px; font-weight: 700; color: var(--olive-3); margin: 0 10px 2px; }
.bub { position: relative; padding: 7px 10px 6px; border-radius: 16px; background: #fff; box-shadow: 0 1px 1.5px rgba(43,46,33,.12); font-size: 15px; line-height: 1.5; word-break: break-word; min-width: 64px; }
.msg.mine .bub { background: #e9f3dc; }
.msg.theirs:not(.cont) .bub { border-top-right-radius: 4px; }
.msg.mine:not(.cont) .bub { border-top-left-radius: 4px; }
.bub .txt a { color: #2a78d6; text-decoration: underline; }
.bub .meta { display: flex; align-items: center; justify-content: flex-end; gap: 4px; font-size: 10.5px; color: var(--muted); margin-top: 2px; direction: ltr; }
.ticks { font-size: 11px; letter-spacing: -2px; color: var(--muted); }
.ticks.read { color: #2a78d6; }
.bub.has-media { padding: 4px 4px 4px; }
.bub.has-media .txt { padding: 4px 6px 0; }
.bub.has-media .meta { padding: 0 6px; }
.media { display: block; border-radius: 12px; overflow: hidden; background: var(--sand-3); width: min(68vw, 300px); max-height: 380px; }
.media img, .media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media.vid video { object-fit: contain; background: #000; }
.bub audio { width: min(64vw, 260px); height: 40px; }
.file-msg { display: flex; align-items: center; gap: 10px; padding: 6px 4px; min-width: 200px; }
.file-msg > .ic:first-child { width: 30px; height: 30px; color: var(--sand); flex: none; }
.file-msg > .ic:last-child { color: var(--olive-3); flex: none; }
.file-msg small { display: block; color: var(--muted); font-size: 11.5px; }
.bub-reply { border-inline-start: 3px solid var(--green); background: rgba(0,0,0,.04); border-radius: 8px; padding: 4px 8px; margin-bottom: 4px; font-size: 12.5px; display: flex; flex-direction: column; max-width: 260px; }
.bub-reply b { color: var(--green); font-size: 12px; }
.deleted { color: var(--muted); font-style: italic; font-size: 13.5px; }
.uploading { display: flex; flex-direction: column; gap: 6px; min-width: 200px; }
.up-bar { height: 6px; border-radius: 99px; background: var(--sand-3); overflow: hidden; }
.up-bar i { display: block; height: 100%; background: var(--green); transition: width .2s; }

/* composer */
.emoji-panel { flex: none; max-height: 240px; overflow-y: auto; background: #fff; border-top: 1px solid var(--line); padding: 8px 10px; }
.emoji-cat small { display: block; color: var(--muted); font-size: 11.5px; margin: 6px 2px 4px; }
.emoji-cat > div { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }
.emoji-cat button { font-size: 25px; height: 42px; border-radius: 10px; }
.emoji-cat button:active { background: var(--sand-4); }
.reply-bar { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #fff; border-top: 1px solid var(--line); border-inline-start: 4px solid var(--green); }
.reply-bar b { display: block; color: var(--green); font-size: 12.5px; }
.reply-bar span span { font-size: 13px; color: var(--muted); }
.composer2 { flex: none; display: flex; align-items: flex-end; gap: 6px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)); background: #fff; border-top: 1px solid var(--line); }
.composer2 textarea { flex: 1; min-height: 42px; max-height: 140px; resize: none; border: 1.5px solid var(--line); border-radius: 22px; padding: 9px 14px; background: var(--sand-4); outline: none; font-size: 16px; line-height: 1.45; }
.composer2 textarea:focus { border-color: var(--sand); background: #fff; }
.c-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: var(--olive-3); flex: none; }
.c-btn .ic { width: 23px; height: 23px; }
.c-send, .c-btn.mic { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--olive); color: var(--sand); flex: none; }
.c-send .ic { transform: scaleX(-1); }
.act-list { display: flex; flex-direction: column; }
.act-list > * { display: flex; align-items: center; gap: 12px; padding: 14px 6px; border-bottom: 1px solid var(--line); font-size: 15px; text-align: start; }
.danger-txt { color: var(--danger); }
.info-head { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 10px; }
.rec-sheet { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 0; }
.rec-sheet b { font-size: 28px; font-variant-numeric: tabular-nums; }
.rec-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--danger); animation: ping 1.2s infinite; }
.rec-sheet .row { width: 100%; }

/* photo viewer */
.viewer { position: fixed; inset: 0; z-index: 400; background: #000; display: flex; flex-direction: column; }
.viewer-bar { display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px; color: #fff; }
.viewer-bar .icon-btn { background: rgba(255,255,255,.12); color: #fff; }
.viewer-img { flex: 1; display: grid; place-items: center; overflow: auto; touch-action: pinch-zoom; }
.viewer-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-cap { color: rgba(255,255,255,.6); text-align: center; padding: 8px 12px calc(14px + env(safe-area-inset-bottom, 0px)); direction: ltr; }

/* incoming call */
.ring-screen { position: fixed; inset: 0; z-index: 450; display: flex; flex-direction: column; justify-content: space-between; align-items: center;
  padding: calc(80px + env(safe-area-inset-top, 0px)) 24px calc(60px + env(safe-area-inset-bottom, 0px)); color: #fff;
  background: radial-gradient(120% 80% at 50% 0%, var(--olive-3), var(--olive) 70%); animation: rise .25s ease; }
.ring-who { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.ring-who .avatar.xl { width: 110px; height: 110px; font-size: 42px; box-shadow: 0 0 0 10px rgba(191,174,142,.15), 0 0 0 22px rgba(191,174,142,.07); animation: ringPulse 1.6s ease-in-out infinite; }
.ring-who h2 { font-size: 26px; color: #fff; }
.ring-who p { color: var(--sand-2); }
@keyframes ringPulse { 50% { box-shadow: 0 0 0 16px rgba(191,174,142,.2), 0 0 0 32px rgba(191,174,142,.08); } }
.ring-actions { display: flex; justify-content: space-around; width: 100%; max-width: 360px; }
.ring-btn { display: flex; flex-direction: column; align-items: center; gap: 8px; color: #fff; }
.ring-btn .ic { width: 70px; height: 70px; padding: 20px; border-radius: 50%; }
.ring-btn.decline .ic { background: #e5484d; }
.ring-btn.accept .ic { background: #22b357; animation: orbFloat 1.2s ease-in-out infinite; }

/* in-call */
.call-screen { position: fixed; inset: 0; z-index: 420; background: #15170f; color: #fff; display: flex; flex-direction: column; }
.call-top { text-align: center; padding: calc(14px + env(safe-area-inset-top, 0px)) 12px 8px; }
.call-top b { display: block; font-size: 18px; }
.call-top small { color: var(--sand-2); font-variant-numeric: tabular-nums; }
.call-grid { flex: 1; display: grid; gap: 6px; padding: 6px; grid-template-columns: 1fr; grid-auto-rows: 1fr; min-height: 0; }
.call-grid.n2, .call-grid.n3, .call-grid.n4 { grid-template-columns: 1fr 1fr; }
.call-grid.n5, .call-grid.n6 { grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(0, 1fr); }
.tile { position: relative; border-radius: 18px; overflow: hidden; background: #23261b; min-height: 0; }
.tile video { width: 100%; height: 100%; object-fit: cover; }
.tile .tile-av { position: absolute; inset: 0; display: none; place-items: center; }
.tile.audio-only video { opacity: 0; }
.tile.audio-only .tile-av { display: grid; }
.tile .avatar.xl { width: 96px; height: 96px; font-size: 38px; }
.tile-name { position: absolute; bottom: 8px; right: 10px; font-size: 13px; background: rgba(0,0,0,.45); padding: 2px 10px; border-radius: 99px; }
.call-wait { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--sand-2); }
.call-wait .ic { width: 54px; height: 54px; animation: orbFloat 1.6s ease-in-out infinite; }
.call-self { position: absolute; top: calc(70px + env(safe-area-inset-top, 0px)); left: 12px; width: 104px; height: 150px; object-fit: cover; border-radius: 14px; border: 2px solid rgba(255,255,255,.3); transform: scaleX(-1); background: #000; }
.call-ctrls { display: flex; justify-content: center; gap: 18px; padding: 14px 12px calc(22px + env(safe-area-inset-bottom, 0px)); }
.cbtn { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.14); color: #fff; }
.cbtn .ic { width: 26px; height: 26px; }
.cbtn.off { background: #fff; color: var(--olive); }
.cbtn.end { background: #e5484d; }

/* back/close header inside chat sheets */
.sheet-head { display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; gap: 8px; margin: -4px 0 12px; }
.sheet-head h3 { text-align: center; font-size: 17px; font-weight: 700; }

/* OZEL identity: a light watermark logo behind the conversation */
.chat-wrap { position: relative; }
.chat-wrap::before {
  content: ''; position: absolute; inset: 72px 0 70px; pointer-events: none; z-index: 0;
  background: var(--sand);
  -webkit-mask: url(/brand/logo.png) center / min(62%, 300px) auto no-repeat; mask: url(/brand/logo.png) center / min(62%, 300px) auto no-repeat;
  opacity: .11;
}
.chat-msgs { position: relative; z-index: 1; background-color: transparent;
  background-image: radial-gradient(rgba(191,174,142,.16) 1px, transparent 1px); background-size: 20px 20px; }
.chat-head, .composer2, .emoji-panel, .reply-bar, #callBanner { position: relative; z-index: 2; }
