*{box-sizing:border-box}body{margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;background:#efeae2;color:#111}button,input{font:inherit}.hidden{display:none!important}.customer-page{min-height:100vh;background:#d9dbd5}.phone-shell{max-width:760px;margin:auto;min-height:100vh;background:#efeae2;display:flex;flex-direction:column}.chat-header{height:64px;background:#075e54;color:#fff;display:flex;align-items:center;gap:10px;padding:9px 12px;box-shadow:0 1px 3px #0002;z-index:2}.avatar{width:42px;height:42px;border-radius:50%;display:grid;place-items:center;background:#dfe5e7;color:#536066;font-weight:700;flex:0 0 auto}.head-main{flex:1;min-width:0;display:flex;flex-direction:column}.head-main strong,.name-edit{font-weight:650}.head-main small{opacity:.9}.icon-btn{border:0;background:transparent;color:inherit;font-size:22px;min-width:42px;height:42px;border-radius:50%;cursor:pointer}.messages{flex:1;overflow:auto;padding:18px 12px;background-color:#efeae2;background-image:radial-gradient(#00000008 1px,transparent 1px);background-size:14px 14px}.msg{max-width:78%;padding:7px 9px 5px;margin:4px 0;border-radius:8px;box-shadow:0 1px 1px #0002;word-break:break-word}.msg.in{background:#fff;border-top-left-radius:2px}.msg.out{background:#d9fdd3;margin-left:auto;border-top-right-radius:2px}.meta{font-size:11px;color:#667781;text-align:right;margin-top:3px;white-space:nowrap}.ticks{margin-left:3px}.ticks.read{color:#53bdeb}.composer{display:flex;gap:8px;align-items:center;padding:8px;background:#f0f2f5}.composer input{flex:1;min-width:0;border:0;border-radius:22px;padding:12px 14px;outline:0;background:#fff}.composer button{width:44px;height:44px;border-radius:50%;border:0;background:#00a884;color:#fff;font-weight:700;cursor:pointer}.attach{font-size:23px;cursor:pointer;padding:8px}.typing-line{min-height:0;padding:0 14px;font-size:12px;color:#667781}.chat-img{max-width:100%;border-radius:7px;display:block;cursor:pointer}.modal{position:fixed;inset:0;background:#000d;display:grid;place-items:center;z-index:99}.modal img{max-width:92vw;max-height:90vh}.modal button{position:absolute;right:18px;top:18px;border:0;border-radius:50%;width:42px;height:42px}.login-page{min-height:100vh;display:grid;place-items:center;background:#f2f4f5;padding:20px}.login-card{width:min(380px,100%);background:#fff;padding:28px;border-radius:16px;box-shadow:0 12px 40px #0001;display:grid;gap:12px}.login-card input{padding:13px;border:1px solid #ddd;border-radius:9px}.login-card button{padding:13px;border:0;border-radius:9px;background:#008069;color:#fff;font-weight:700}.error{color:#b42318;background:#fee4e2;padding:9px;border-radius:8px}.admin-page{background:#f0f2f5;min-height:100vh}.admin-app{height:100vh;display:grid;grid-template-columns:360px 1fr;max-width:1500px;margin:auto;background:#fff}.sidebar{border-right:1px solid #e5e7e9;min-width:0;display:flex;flex-direction:column}.side-top{height:64px;background:#f0f2f5;display:flex;align-items:center;justify-content:space-between;padding:10px 14px}.side-top small{display:block;color:#667781}.logout{font-size:13px;color:#54656f;text-decoration:none}.search{margin:8px 12px;padding:10px 13px;border:0;background:#f0f2f5;border-radius:9px;outline:0}.chat-list{overflow:auto;flex:1}.chat-row{width:100%;border:0;background:#fff;display:flex;align-items:center;gap:10px;padding:10px 12px;text-align:left;border-bottom:1px solid #f0f2f5;cursor:pointer}.chat-row.active,.chat-row:hover{background:#f0f2f5}.row-main{flex:1;min-width:0}.row-main>div{display:flex;justify-content:space-between;gap:8px}.row-main strong,.row-main small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.row-main span,.row-main small{font-size:12px;color:#667781}.badge{background:#25d366;color:#fff;border-radius:20px;min-width:20px;height:20px;display:grid;place-items:center;font-size:11px}.chat-pane{min-width:0;background:#efeae2}.empty-state{height:100%;display:grid;place-items:center;color:#667781}.chat-view{height:100%;display:flex;flex-direction:column}.name-edit{background:transparent;border:0;color:#fff;width:100%;outline:0;padding:0}.menu-wrap{position:relative}.more-menu{position:absolute;right:0;top:48px;background:#fff;border-radius:8px;box-shadow:0 8px 28px #0002;min-width:170px;padding:6px;z-index:20}.more-menu button{width:100%;border:0;background:#fff;text-align:left;padding:10px;border-radius:6px;cursor:pointer}.more-menu button:hover{background:#f5f6f6}.more-menu .danger{color:#b42318}.toast{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);background:#111;color:#fff;padding:10px 14px;border-radius:8px}@media(max-width:760px){.admin-app{grid-template-columns:1fr}.chat-pane{position:absolute;inset:0;display:none}.admin-page.chat-open .chat-pane{display:block}.sidebar{border:0}.admin-app{height:100vh}.customer-page .phone-shell{max-width:none}.msg{max-width:86%}}


/* Mobile viewport + fast-visible composer fixes */
html,body{height:100%;}
.customer-page{height:100vh;min-height:0;overflow:hidden;}
.phone-shell{height:100vh;min-height:0;max-height:100vh;overflow:hidden;}
.messages{min-height:0;}
.composer{flex:0 0 auto;position:relative;z-index:3;padding-bottom:max(8px,env(safe-area-inset-bottom));}
.chat-header{flex:0 0 64px;}
.typing-line{flex:0 0 auto;}
.admin-page{height:100vh;min-height:0;overflow:hidden;}
.admin-app{height:100vh;min-height:0;max-height:100vh;overflow:hidden;}
.sidebar,.chat-pane,.chat-view{min-height:0;}
@supports (height:100dvh){
  .customer-page,.phone-shell,.admin-page,.admin-app{height:100dvh;max-height:100dvh;}
}
@media(max-width:760px){
  .chat-pane{height:100%;}
  .chat-view{height:100%;min-height:0;}
  .messages{min-height:0;}
}

/* Admin-triggered PWA install prompt */
.install-modal{position:fixed;inset:0;background:#0008;display:flex;align-items:flex-end;justify-content:center;padding:16px;z-index:120}
.install-card{width:min(440px,100%);background:#fff;border-radius:18px;padding:18px;box-shadow:0 18px 60px #0004;display:grid;grid-template-columns:52px 1fr;gap:12px;align-items:center}
.install-icon{width:52px;height:52px;border-radius:14px;background:#075e54;color:#fff;display:grid;place-items:center;font-size:24px;font-weight:800}
.install-copy{display:grid;gap:4px;min-width:0}.install-copy strong{font-size:17px}.install-copy span{font-size:13px;color:#667781;line-height:1.35}
.install-actions{grid-column:1/-1;display:flex;justify-content:flex-end;gap:8px;margin-top:4px}.install-actions button{border:0;border-radius:10px;padding:11px 16px;font-weight:700;cursor:pointer}.later-btn{background:#f0f2f5;color:#374151}.install-btn{background:#008069;color:#fff}
.install-help{grid-column:1/-1;background:#f7f8f8;border-radius:10px;padding:10px;color:#54656f;line-height:1.35}
@media(min-width:700px){.install-modal{align-items:center}}


/* Compact template manager + quick replies */
.quick-template{width:40px!important;height:40px!important;background:#fff!important;color:#54656f!important;font-size:18px!important;flex:0 0 40px}
.chat-view{position:relative}
.quick-template-menu{position:absolute;left:12px;bottom:62px;width:min(360px,calc(100% - 24px));max-height:280px;overflow:auto;background:#fff;border-radius:12px;box-shadow:0 10px 34px #0003;padding:6px;z-index:35}
.quick-template-menu>button{width:100%;border:0;background:#fff;text-align:left;padding:10px;border-radius:8px;display:grid;gap:2px;cursor:pointer}.quick-template-menu>button:hover{background:#f5f6f6}.quick-template-menu small{font-size:12px;color:#667781;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.template-modal{position:fixed;inset:0;background:#0008;display:grid;place-items:center;padding:16px;z-index:140}.template-card{width:min(520px,100%);max-height:min(720px,92vh);overflow:auto;background:#fff;border-radius:16px;padding:16px;box-shadow:0 18px 60px #0004}.template-head{display:flex;align-items:center;justify-content:space-between}.template-head strong{font-size:18px}.template-head button{border:0;background:#f0f2f5;border-radius:50%;width:36px;height:36px;cursor:pointer}.template-note{display:block;color:#667781;margin:3px 0 12px}.template-form{display:grid;gap:8px}.template-form input[type=text],.template-form input:not([type]),.template-form textarea{width:100%;border:1px solid #d7dfe3;border-radius:9px;padding:10px;font:inherit;outline:0}.template-form textarea{min-height:92px;resize:vertical}.auto-check{display:flex;align-items:center;gap:8px;font-size:13px;color:#374151}.template-form-actions{display:flex;justify-content:flex-end;gap:8px}.template-form-actions button{border:0;background:#008069;color:#fff;border-radius:9px;padding:10px 13px;font-weight:700;cursor:pointer}.template-form-actions .secondary{background:#f0f2f5;color:#374151}.template-list{display:grid;gap:8px;margin-top:14px}.template-row{border-top:1px solid #eef0f1;padding-top:10px;display:flex;gap:10px;justify-content:space-between}.template-row>div:first-child{min-width:0;display:grid;gap:2px}.template-row small{color:#667781;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.template-row em{font-style:normal;color:#008069;font-size:11px;font-weight:700}.template-row-actions{display:flex;gap:4px;align-items:flex-start}.template-row-actions button{border:0;background:#f0f2f5;border-radius:7px;padding:7px 9px;cursor:pointer}.template-row-actions .danger{color:#b42318}.template-empty{display:block;padding:10px;color:#667781;font-size:13px}

/* iPhone Add to Home Screen guide */
.ios-install-guide{grid-column:1/-1;border-top:1px solid #eef0f1;padding-top:10px;display:grid;gap:8px}.ios-install-guide>strong{font-size:14px}.ios-install-guide>div{display:flex;align-items:center;gap:9px;color:#54656f;font-size:13px}.ios-install-guide b{width:24px;height:24px;border-radius:50%;display:grid;place-items:center;background:#e7f8f2;color:#008069;flex:0 0 24px}
@media(max-width:760px){.template-modal{align-items:end;padding:0}.template-card{width:100%;max-height:86vh;border-radius:18px 18px 0 0}}

/* ID SUPPORT mobile admin refinements */
.trust-row{display:flex;align-items:center;gap:9px;font-size:14px;color:#374151}.trust-row input{width:18px;height:18px}.login-note{color:#667781;line-height:1.35}.mobile-back{display:none!important;font-size:30px;line-height:1}.admin-page .chat-header{min-width:0}.admin-page .head-main{min-width:0}.admin-page .name-edit{font-size:16px}.admin-page .composer{padding-bottom:max(8px,env(safe-area-inset-bottom))}
@media(max-width:760px){
  .admin-page{width:100%;overflow:hidden}
  .admin-app{display:block;width:100%;max-width:none;overflow:hidden}
  .sidebar{height:100%;width:100%;background:#fff}
  .side-top{padding-top:max(10px,env(safe-area-inset-top));height:auto;min-height:64px}
  .search{font-size:16px}
  .chat-row{min-height:68px;padding:10px 12px}
  .chat-pane{position:absolute;inset:0;width:100%;height:100%;z-index:50;background:#efeae2;display:none}
  .admin-page.chat-open .chat-pane{display:block}
  .admin-page.chat-open .sidebar{visibility:hidden}
  .chat-view{width:100%;height:100%}
  .chat-header{padding-top:max(9px,env(safe-area-inset-top));height:auto;min-height:64px}
  .mobile-back{display:grid!important;place-items:center;flex:0 0 42px}
  .admin-page .avatar{width:38px;height:38px}
  .admin-page .icon-btn{min-width:40px;width:40px}
  .admin-page .messages{padding:12px 8px}
  .admin-page .msg{max-width:88%}
  .admin-page .composer{gap:5px;padding-left:6px;padding-right:6px}
  .admin-page .composer input{font-size:16px;padding-left:12px;padding-right:12px}
  .more-menu{right:2px;top:46px;max-height:70vh;overflow:auto}
  .template-card{padding-bottom:max(16px,env(safe-area-inset-bottom))}
}

/* Auto reply sequence */
.auto-step-label{display:grid;gap:6px;font-size:13px;color:#667781}
.auto-step-label select{width:100%;min-height:44px;border:1px solid #dfe5e7;border-radius:10px;padding:9px 11px;background:#fff;font-size:15px}
@media(max-width:700px){.template-card{width:calc(100% - 20px);max-height:88%;overflow:auto}.template-row{align-items:flex-start}.template-row-actions{flex-shrink:0}}

/* Lightweight push notification opt-in */
.notify-bar,.admin-notify-bar{display:flex;align-items:center;justify-content:space-between;gap:10px;background:#fff8db;color:#4b5563;border-bottom:1px solid #eee4b8;padding:7px 12px;font-size:13px;flex:0 0 auto}
.notify-bar button,.admin-notify-bar button{border:0;background:#008069;color:#fff;border-radius:8px;padding:7px 12px;font-weight:700;cursor:pointer}
.notify-bar.hidden,.admin-notify-bar.hidden{display:none!important}
.admin-notify-bar{margin:7px 10px 0;border:1px solid #eee4b8;border-radius:9px}
@media(max-width:760px){.admin-notify-bar{margin:7px 10px 0}.notify-bar{padding-left:10px;padding-right:10px}}
