*{box-sizing:border-box}body{margin:0;font:15px system-ui,Arial;background:#eef3f0;color:#1d2932}button,input{font:inherit}button{cursor:pointer;border:0;background:#087d60;color:white;border-radius:9px;padding:11px 15px}button:disabled{opacity:.5;cursor:default}input{padding:12px;border:1px solid #d5dfe0;border-radius:9px;min-width:0}input:focus{outline:2px solid #b4e8d7}.auth{max-width:410px;margin:10vh auto;background:white;padding:32px;border-radius:18px;box-shadow:0 8px 35px #0001}.auth h1{color:#087d60}.auth form{display:grid;gap:12px}.auth input{width:100%}.link{background:none;color:#087d60;padding:0}.auth p{color:#667}.auth #error{color:#c32}.app{display:grid;grid-template-columns:340px minmax(0,1fr);height:100dvh;max-width:1500px;margin:auto;background:white;box-shadow:0 0 30px #0001}aside{border-right:1px solid #e2e7e7;overflow-y:auto}aside header{display:flex;justify-content:space-between;align-items:center;padding:15px;background:#f7faf9}aside header h2{margin:0;color:#087d60}aside>input{display:block;width:calc(100% - 24px);margin:12px}aside h3{font-size:12px;letter-spacing:1px;color:#778;margin:20px 14px 6px;text-transform:uppercase}.person{padding:13px 15px;border-bottom:1px solid #f0f1f1;cursor:pointer}.person:hover,.person.active{background:#e6f5ef}.person strong{display:block}.person small{color:#778}.person .unread{color:#087d60;font-weight:bold}.chat{display:flex;flex-direction:column;min-width:0;background:#f4f7f5}.chat>header{padding:21px;background:white;font-weight:700;border-bottom:1px solid #e3e7e7}#messages{flex:1;overflow-y:auto;padding:20px;display:flex;flex-direction:column;gap:9px}.bubble{max-width:min(75%,560px);background:white;padding:10px 13px;border-radius:13px;white-space:pre-wrap;overflow-wrap:anywhere;box-shadow:0 1px 3px #0001}.bubble.mine{align-self:flex-end;background:#d9f6e8}.bubble.theirs{align-self:flex-start}.bubble small{display:block;text-align:right;color:#667;margin-top:4px;font-size:10px}#sendForm{display:flex;gap:10px;padding:14px;background:white}#messageInput{flex:1}@media(max-width:650px){.app{grid-template-columns:135px minmax(0,1fr)}aside header{display:block}aside header h2{font-size:16px}aside header button{padding:6px;margin-top:6px}aside>input{width:calc(100% - 12px);margin:6px;padding:7px}aside h3{margin:12px 6px 4px}.person{padding:10px 6px;overflow-wrap:anywhere}.chat>header{padding:15px 8px}#messages{padding:8px}.bubble{max-width:95%}#sendForm{padding:6px;gap:4px}#sendForm button{padding:8px}}

.admin-link{color:#087d60;font-weight:700;text-decoration:none}.admin-page{max-width:1150px;margin:24px auto;padding:20px}.admin-page header{display:flex;align-items:center;justify-content:space-between}.admin-card{background:white;border-radius:14px;padding:22px;margin:18px 0;box-shadow:0 2px 14px #0001}.admin-card form{display:flex;flex-wrap:wrap;gap:10px}.admin-card form input{flex:1;min-width:180px}.stats{display:flex;flex-wrap:wrap;gap:12px}.stats>div{background:#dff4eb;padding:15px;border-radius:12px;text-transform:capitalize;font-weight:700}.table-scroll{overflow-x:auto}table{border-collapse:collapse;width:100%}td,th{padding:12px;border-bottom:1px solid #e5e9e8;text-align:left}td button{margin:3px;padding:7px;font-size:12px}#notice{color:#087d60}

/* JITVox voice typing controls */
#voiceLanguage{max-width:100px;min-width:0;border:1px solid #d5dfe0;border-radius:9px;background:#fff;padding:8px;color:#24323b}
#voiceBtn{min-width:43px;padding:8px 10px;background:#edf7f2;color:#087d60;border:1px solid #b9ded0}
#voiceBtn.listening{background:#ffe7e7;color:#b42318;border-color:#e7aaaa}
#voiceBtn:disabled{opacity:.45}
@media(max-width:650px){#voiceLanguage{max-width:73px;padding:4px;font-size:12px}#voiceBtn{min-width:35px;padding:6px}}

#attachBtn{display:flex;align-items:center;justify-content:center;cursor:pointer;border:1px solid #b9ded0;background:#edf7f2;border-radius:9px;padding:8px 11px}
.attachment-link{display:block;margin-top:5px;color:#087d60;font-weight:600;word-break:break-word}
@media(max-width:650px){#attachBtn{padding:7px}}

.chat-error{margin:18px;padding:14px;border-radius:9px;color:#9b2c2c;background:#fff1f1;font-size:13px}

/* JITVox modern messenger layout. Scoped to chat UI, not admin. */
body{background:#e9edef;color:#111b21;font-family:system-ui,-apple-system,'Segoe UI',Arial,sans-serif}
.app{max-width:none;grid-template-columns:minmax(300px,29%) minmax(0,1fr);box-shadow:none;background:#fff}
aside{background:#fff;border-right:1px solid #dce2e4}
aside header{background:#fff;padding:18px 20px;border-bottom:1px solid #f0f2f3;gap:10px}
aside header h2{font-size:24px;color:#008069;letter-spacing:-.5px}
aside header button{background:#008069;padding:9px 13px}
aside .admin-link{font-size:13px;white-space:nowrap}
aside>input{background:#f0f2f5;border:0;border-radius:12px;margin:16px;width:calc(100% - 32px);padding:13px 16px}
aside h3{color:#667781;margin:14px 20px 8px;font-size:11px}
.person{border-bottom:1px solid #f1f3f4;padding:17px 22px;min-height:74px;transition:background .15s}
.person:hover{background:#f5f6f6}.person.active{background:#e7f5ef}.person strong{font-size:15px}.person small{display:block;margin-top:6px;font-size:12px}
.chat{background:#efeae2;position:relative}
.chat:before{content:'';position:absolute;inset:0;pointer-events:none;opacity:.2;background-image:radial-gradient(circle at 15px 15px,#d3c4b0 1px,transparent 1.5px),radial-gradient(circle at 60px 45px,#d3c4b0 1px,transparent 1.5px);background-size:90px 90px}
.chat>header{position:relative;z-index:1;background:#f0f2f5;border-bottom:1px solid #dfe3e4;padding:19px 25px;min-height:70px;font-size:16px}
#messages{position:relative;z-index:1;padding:25px max(25px,7%);gap:7px}
.bubble{border-radius:9px;padding:8px 11px;box-shadow:0 1px 2px #0002;max-width:min(72%,580px);font-size:14px}
.bubble.mine{background:#d9fdd3}.bubble.theirs{background:#fff}.bubble small{font-size:10px;color:#667781}
#sendForm{position:relative;z-index:2;background:#f0f2f5;padding:10px 16px;gap:10px;align-items:center}
#messageInput{border:0;border-radius:11px;background:#fff;padding:14px 16px}
#attachBtn{background:transparent;border:0;color:#54656f;font-size:24px;min-width:44px;padding:7px;cursor:pointer}
#attachBtn:hover{background:#dfe7e5}#attachBtn:disabled{opacity:.45}
#voiceBtn{background:transparent;border:0;color:#54656f;font-size:21px}
#voiceLanguage{border:0;border-radius:10px;background:#fff}
#sendBtn{background:#008069;border-radius:11px;padding:12px 19px}
.chat-image{display:block;max-width:min(280px,100%);max-height:250px;object-fit:contain;border-radius:8px;margin-top:6px}
.attachment-link{color:#007b64;text-decoration:underline}
@media(max-width:700px){.app{grid-template-columns:125px minmax(0,1fr)}aside header{padding:10px 6px}aside header h2{font-size:15px}aside .admin-link{font-size:10px}aside>input{width:calc(100% - 12px);margin:6px;padding:8px;font-size:11px}.person{padding:12px 6px;min-height:64px}.person strong{font-size:12px}.chat>header{padding:15px 10px;min-height:56px}#messages{padding:10px}.bubble{max-width:95%}#sendForm{gap:4px;padding:7px}#messageInput{padding:10px 7px}#attachBtn{min-width:32px;padding:3px;font-size:19px}#sendBtn{padding:9px}#voiceLanguage{max-width:64px}}

/* Chat-only visual restoration: never affect admin.php */
body.jitvox-chat-page .app{grid-template-columns:minmax(300px,29%) minmax(0,1fr);max-width:none;background:#fff}
body.jitvox-chat-page .chat{background:#efeae2}
body.jitvox-chat-page .bubble.mine{background:#d9fdd3}
body.jitvox-chat-page .bubble.theirs{background:#fff}
body.jitvox-chat-page #sendForm{background:#f0f2f5}
body.jitvox-chat-page #attachBtn{pointer-events:auto;cursor:pointer;position:relative;z-index:5}
@media(max-width:700px){body.jitvox-chat-page .app{grid-template-columns:125px minmax(0,1fr)}}

/* Mobile conversation navigation; desktop styling is preserved. */
#chatBack{display:none}
@media(max-width:700px){
 body.jitvox-chat-page:has(.app){overflow:hidden;overscroll-behavior:none}
 body.jitvox-chat-page .app{position:fixed;top:var(--mobile-top,0px);left:0;width:100%;height:var(--mobile-height,100dvh);display:block;overflow:hidden}
 body.jitvox-chat-page .app>aside{display:block;width:100%;height:100%;overflow-y:auto;overscroll-behavior:contain;border:0;padding-bottom:env(safe-area-inset-bottom)}
 body.jitvox-chat-page .app>.chat{display:none;width:100%;height:100%;min-height:0;overflow:hidden}
 body.jitvox-chat-page .app.mobile-chat-open>aside{display:none}
 body.jitvox-chat-page .app.mobile-chat-open>.chat{display:flex}
 body.jitvox-chat-page aside header{display:flex;position:sticky;top:0;z-index:3;background:#008069;color:#fff;padding:14px 16px;min-height:64px;gap:12px}
 body.jitvox-chat-page aside header h2{font-size:25px;color:#fff;flex:1}
 body.jitvox-chat-page aside .admin-link{font-size:12px;color:#fff}
 body.jitvox-chat-page aside header button{margin:0;padding:8px;font-size:12px;background:#ffffff24;min-height:40px}
 body.jitvox-chat-page aside>input{margin:12px 16px;width:calc(100% - 32px);padding:13px 16px;font-size:16px;border-radius:24px}
 body.jitvox-chat-page aside h3{margin:18px 20px 8px;font-size:12px}
 body.jitvox-chat-page .person{position:relative;padding:17px 18px 17px 76px;min-height:78px;overflow-wrap:anywhere}
 body.jitvox-chat-page .person:before{content:'●';position:absolute;left:18px;top:16px;display:grid;place-items:center;width:44px;height:44px;background:#e1eee9;color:#008069;border-radius:50%;font-size:26px}
 body.jitvox-chat-page .person strong{font-size:16px;font-weight:600}
 body.jitvox-chat-page .person small{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 body.jitvox-chat-page .chat>header{display:flex;align-items:center;gap:10px;flex-shrink:0;min-height:62px;padding:8px 12px 8px 4px;background:#008069;color:#fff}
 body.jitvox-chat-page #chatBack{display:grid;place-items:center;flex-shrink:0;width:44px;height:44px;padding:0;background:transparent;color:#fff;font-size:28px;border-radius:50%}
 body.jitvox-chat-page #chatTitle{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:16px}
 body.jitvox-chat-page #messages{min-height:0;padding:14px 12px;overscroll-behavior:contain;gap:8px}
 body.jitvox-chat-page .bubble{max-width:86%;font-size:15px;padding:8px 10px}
 body.jitvox-chat-page #sendForm{flex-shrink:0;display:grid;grid-template-columns:40px minmax(0,1fr) 44px 54px;gap:5px;padding:8px 8px calc(8px + env(safe-area-inset-bottom));align-items:center}
 body.jitvox-chat-page #messageInput{grid-column:2;grid-row:1;font-size:16px;width:100%;padding:12px;border-radius:24px;min-height:46px}
 body.jitvox-chat-page #attachBtn{grid-column:1;grid-row:1;min-width:40px;min-height:44px;font-size:23px}
 body.jitvox-chat-page #voiceBtn{grid-column:3;grid-row:1;min-width:44px;min-height:44px;padding:6px}
 body.jitvox-chat-page #sendBtn{grid-column:4;grid-row:1;min-height:44px;padding:8px 5px;border-radius:22px;font-size:13px}
 body.jitvox-chat-page #voiceLanguage{grid-column:2;grid-row:2;justify-self:end;max-width:90px;padding:3px 6px;font-size:12px;background:transparent;color:#54656f}
 body.jitvox-chat-page .auth{margin:8vh 16px;padding:26px;max-width:410px}
}

/* Reference-inspired mobile chat. All overrides stay below the mobile breakpoint. */
.mobile-avatar{display:none}
@media(max-width:700px){
 body.jitvox-chat-page .chat{background:#e9dfcf}
 body.jitvox-chat-page .chat:before{opacity:1;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22240%22%20height%3D%22240%22%20viewBox%3D%220%200%20240%20240%22%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22%23ad9b80%22%20stroke-width%3D%221.1%22%20opacity%3D%22.22%22%3E%3Cpath%20d%3D%22M16%2014h20v15H25l-6%205v-5h-3zM89%2016l7-5%207%205-2%209H91zM156%2013c-9-9-17%206%200%2015%2017-9%209-24%200-15zM205%2052l9-5%209%205v13l-9%205-9-5zM45%2074l8-8%208%208-8%208zM116%2067h20v15h-20zM119%2067l3-5h8l3%205M14%20128l8-14%208%2014zM68%20119c12-17%2025%201%2010%209l-7%203M147%20122l5-10%205%2010%2011%201-8%207%203%2011-11-6-10%206%202-11-8-7zM201%20146h20v15h-10l-6%205v-5h-4zM40%20186c-8-8-16%205%200%2013%2016-8%208-21%200-13zM100%20196l7-13%207%2013zM167%20200h18v14h-18zM210%20209l7-7%207%207-7%207z%22%2F%3E%3Ccircle%20cx%3D%2263%22%20cy%3D%2235%22%20r%3D%225%22%2F%3E%3Ccircle%20cx%3D%22181%22%20cy%3D%2283%22%20r%3D%227%22%2F%3E%3Ccircle%20cx%3D%2249%22%20cy%3D%22149%22%20r%3D%224%22%2F%3E%3Cpath%20d%3D%22M83%20157l6%206m-6%200%206-6M181%2035l5%205m-5%200%205-5M129%20221l5%205m-5%200%205-5%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E");background-size:240px 240px}
 body.jitvox-chat-page .chat>header{background:#075e54;gap:8px;box-shadow:0 1px 4px #0002;min-height:60px}
 body.jitvox-chat-page .mobile-avatar{display:grid;place-items:center;flex:0 0 36px;height:36px;border-radius:50%;background:#d9e7df;color:#69877b;font-size:23px}
 body.jitvox-chat-page #chatBack{width:34px;font-size:26px}
 body.jitvox-chat-page #chatTitle{font-weight:600;font-size:16px}
 body.jitvox-chat-page #messages{padding:12px 10px;gap:7px}
 body.jitvox-chat-page .bubble{position:relative;border-radius:6px;padding:7px 9px;font-size:14px;max-width:84%;line-height:1.4;box-shadow:0 1px 1px #0002}
 body.jitvox-chat-page .bubble.mine{background:#dcf8c6;border-top-right-radius:0;margin-right:5px}
 body.jitvox-chat-page .bubble.theirs{border-top-left-radius:0;margin-left:5px}
 body.jitvox-chat-page .bubble:before{content:'';position:absolute;top:0;border:5px solid transparent}
 body.jitvox-chat-page .bubble.mine:before{right:-5px;border-top-color:#dcf8c6;border-left-color:#dcf8c6}
 body.jitvox-chat-page .bubble.theirs:before{left:-5px;border-top-color:white;border-right-color:white}
 body.jitvox-chat-page .bubble small{font-size:10px;margin-top:2px}
 body.jitvox-chat-page #sendForm{background:transparent;grid-template-columns:38px minmax(0,1fr) 48px;gap:0 6px;padding:6px 7px calc(5px + env(safe-area-inset-bottom));isolation:isolate}
 body.jitvox-chat-page #sendForm:before{content:'';position:absolute;top:6px;left:7px;right:61px;height:46px;border-radius:26px;background:white;box-shadow:0 1px 3px #0002;z-index:-1}
 body.jitvox-chat-page #messageInput{grid-column:2;padding:11px 8px 11px 0;min-height:46px;border-radius:0 24px 24px 0;background:transparent}
 body.jitvox-chat-page #attachBtn{grid-column:1;min-width:38px;background:transparent;color:#718078;font-size:22px}
 body.jitvox-chat-page #voiceBtn,body.jitvox-chat-page #sendBtn{grid-column:3;grid-row:1;width:46px;height:46px;border-radius:50%;background:#00897b;color:white;padding:0;min-height:46px;box-shadow:0 1px 3px #0002}
 body.jitvox-chat-page #voiceBtn{font-size:21px}
 body.jitvox-chat-page #sendBtn{display:none;font-size:0}
 body.jitvox-chat-page #sendBtn:before{content:'➤';font-size:23px}
 body.jitvox-chat-page #sendForm.has-message #sendBtn{display:block}
 body.jitvox-chat-page #sendForm.has-message #voiceBtn{display:none}
 body.jitvox-chat-page #voiceBtn:disabled{opacity:.55}
 body.jitvox-chat-page #voiceBtn.listening{background:#b42318}
 body.jitvox-chat-page #voiceLanguage{grid-column:2;grid-row:2;padding:2px 4px;font-size:11px;min-height:22px;color:#42554c}
}
