:root{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#22362a;background:#f5f7f2;font-size:17px;line-height:1.6}*{box-sizing:border-box}body{margin:0}button,input,textarea{font:inherit}button,.attach{cursor:pointer}button{border:0;border-radius:12px;background:#356c49;color:white;padding:10px 20px;font-weight:650}button:disabled{opacity:.6;cursor:wait}button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible{outline:3px solid #e5b847;outline-offset:3px}.ghost{background:#edf2ec;color:#356c49}a{color:#356c49}header{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:18px max(20px,calc((100% - 920px)/2));background:white;border-bottom:1px solid #e2e9df}header strong{font-size:21px}header small{display:block;color:#748072}.nav{display:flex;gap:16px;align-items:center}.nav form{margin:0}.chat{max-width:820px;margin:auto;padding:24px 20px 50px}.intro h1{font-size:27px;margin:8px 0}.intro p{color:#6b7869;margin:0 0 24px}.message,.card,.compose{background:white;border:1px solid #e0e7dc;border-radius:20px;padding:22px;margin:16px 0;box-shadow:0 5px 18px #22362a05}.message .meta{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;font-size:14px;color:#70806e;margin-bottom:12px}.body{white-space:pre-wrap;overflow-wrap:anywhere;font-size:19px;line-height:1.75}.gallery{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:16px}.gallery:has(.picture:only-child){grid-template-columns:1fr}.picture{padding:0;background:#f2f4ef;overflow:hidden;border:1px solid #e0e7dc}.picture img{width:100%;max-height:420px;object-fit:contain;display:block}.reads{display:flex;gap:10px;flex-wrap:wrap;border-top:1px solid #edf1e9;padding-top:12px;margin-top:18px;font-size:13px;color:#6b8467}.reads span{background:#edf5e9;padding:3px 9px;border-radius:7px}.compose label{font-weight:600}textarea,input{border:1px solid #ccd7c6;border-radius:12px;padding:12px;background:#fcfdfb;width:100%;color:inherit}textarea{resize:vertical;margin:12px 0}.sendbar{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.sendbar small{color:#77816f;font-size:12px}.sendbar button{margin-left:auto}.attach{border-radius:10px;padding:9px 12px;background:#edf2ec;color:#356c49;font-size:15px}#previews{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:12px}#previews div{position:relative}#previews img{width:100px;height:100px;object-fit:cover;border-radius:12px}#previews button{position:absolute;top:2px;right:2px;padding:0;width:28px;height:28px;background:#22362a}.viewerhint{font-size:14px;color:#71816c;text-align:center}.login{width:min(440px,calc(100% - 32px));margin:7vh auto;padding:30px;background:white;border-radius:24px;border:1px solid #e0e7dc;box-shadow:0 20px 60px #22362a0a}.login h1{margin:12px 0;font-size:28px}.login p{color:#71816c}.brand{font-size:48px}.login label,.card label{display:block;margin:16px 0}.login button{width:100%;margin:8px 0 18px}.login small{display:block;color:#71816c;font-size:13px}.error{color:#a5372e!important}dialog{padding:48px 16px 16px;border:0;background:#17201b;border-radius:16px;max-width:96vw;max-height:96dvh}dialog::backdrop{background:#101812df}dialog img{max-width:90vw;max-height:80dvh;object-fit:contain;display:block}#closeImage{position:absolute;right:8px;top:8px;padding:2px;width:36px;height:36px;background:#ffffff25}#status{font-size:14px;color:#8a562b;overflow-wrap:anywhere}h2{font-size:22px}#older{display:block;margin:0 auto}#older[hidden]{display:none}@media(max-width:560px){header{padding:14px;align-items:flex-start}header strong{font-size:17px}.nav{gap:8px;flex-wrap:wrap;justify-content:flex-end;font-size:13px}.nav button{font-size:13px;padding:6px 10px}.chat{padding:16px 12px 30px}.message,.compose,.card{padding:16px;border-radius:16px}.body{font-size:18px}.sendbar small{flex-basis:100%;order:3}.gallery{gap:8px}.login{padding:24px}.intro h1{font-size:24px}}

.notifications{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin:16px 0}.notifications small{font-size:13px;color:#71816c}#unreadCount{background:#b64d39;color:#fff;border-radius:8px;padding:3px 8px;font-size:12px}

/* v1.2: thumbnail và trình xem theo tin */
.gallery,.gallery:has(.picture:only-child){display:flex;flex-wrap:wrap;gap:10px}
.picture{width:128px;height:128px;flex:0 0 128px;border-radius:12px}
.picture img{width:100%;height:100%;max-height:none;object-fit:cover}
.delete-message{background:#fff1ed;color:#a43b2c;padding:4px 10px;font-size:13px;line-height:1.4}
.meta time{margin-left:auto}.compose-disabled{background:#f1f3ef}.compose-disabled textarea{background:#e9ede6;color:#7a8375;cursor:not-allowed}.compose-disabled button{cursor:not-allowed}
#lightbox{width:min(1000px,96vw);max-height:96dvh;padding:48px 16px 12px}
.lightbox-stage{display:flex;align-items:center;justify-content:center;height:min(74dvh,800px)}
#lightbox img{max-width:100%;max-height:100%;width:auto;height:auto;object-fit:contain}
.lightbox-nav{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:12px;color:#fff;font-size:15px}
.lightbox-nav button{background:#ffffff25;font-size:15px;padding:8px 14px}
@media(max-width:560px){.picture{width:96px;height:96px;flex-basis:96px}.lightbox-stage{height:70dvh}.lightbox-nav button{font-size:14px;padding:8px 10px}#lightbox{padding:48px 10px 10px}}

/* v1.2: khung chat */
body:has(.chat-room){height:100dvh;display:flex;flex-direction:column;overflow:hidden}
body:has(.chat-room)>header{flex:none;padding-top:12px;padding-bottom:12px}
.chat-room{width:min(960px,100%);max-width:960px;flex:1;min-height:0;display:flex;flex-direction:column;padding:10px 16px 14px;margin:0 auto}
.chat-room .intro{flex:none;padding:4px 6px 8px}.chat-room .intro h1{font-size:19px;margin:0}.chat-room .intro p{font-size:13px;margin:2px 0 0}
.history{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;border:1px solid #dfe7da;border-radius:18px 18px 0 0;background:#edf2e9;padding:18px 16px;scrollbar-width:thin}
#messages{display:flex;flex-direction:column;gap:14px}
.chat-room .message{max-width:84%;margin:0;padding:12px 15px;border:0;border-radius:16px;box-shadow:0 1px 3px #2030200c;align-self:flex-start;overflow-wrap:anywhere}
.chat-room .message.incoming{background:#fff;border-bottom-left-radius:4px}
.chat-room .message.outgoing{background:#dbedce;align-self:flex-end;border-bottom-right-radius:4px}
.chat-room .message .body{font-size:17px;line-height:1.6}.chat-room .message .meta{font-size:12px;margin-bottom:6px;gap:10px}.chat-room .message .meta strong{color:#436643}
.chat-room .reads{font-size:11px;border:0;padding:0;margin-top:8px;justify-content:flex-end;gap:5px}.chat-room .reads span{background:transparent;padding:0;color:#607958}
.chat-room .gallery{margin-top:10px;gap:8px}.chat-room .picture{width:112px;height:112px;flex-basis:112px}
.chat-room .compose{flex:none;margin:0;border-radius:0 0 18px 18px;padding:10px 14px;border:1px solid #dfe7da;border-top:0;box-shadow:none}
.chat-room .compose>label{font-size:13px}.chat-room textarea{font-size:16px;line-height:1.4;margin:5px 0 8px;padding:8px 10px;max-height:130px;min-height:58px;resize:none}
.chat-room .sendbar button,.chat-room .attach{font-size:14px;padding:7px 12px}.chat-room .sendbar small{font-size:11px}.chat-room .viewerhint{font-size:11px;margin:4px 0 0;text-align:left}
.chat-room #previews{margin-bottom:4px}.chat-room #previews img{width:62px;height:62px}.chat-room #older{margin-bottom:14px;font-size:13px;padding:6px 12px}
.chat-room #status:empty{display:none}.chat-room #status{margin-bottom:0}
@media(max-width:560px){.chat-room{padding:6px 6px max(6px,env(safe-area-inset-bottom))}.history{padding:12px 8px}.chat-room .message{max-width:94%;padding:10px 12px}.chat-room .message .body{font-size:16px}.chat-room .picture{width:88px;height:88px;flex-basis:88px}.chat-room .intro p{display:none}.chat-room .sendbar small{display:none}.chat-room .compose{padding:8px 10px}body:has(.chat-room)>header{padding:8px 12px}.chat-room .message .meta{font-size:11px}}

.login .remember-option{display:flex;align-items:center;gap:9px;font-size:15px}.remember-option input{width:18px;height:18px;accent-color:#356c49;padding:0}

.message-footer{display:flex;align-items:center;gap:12px;margin-top:8px}.chat-room .message-footer .reads{flex:1;margin:0;justify-content:flex-start}.heart-button{min-width:40px;min-height:40px;padding:4px 9px;flex:none;border:1px solid #dbcfc8;background:#ffffff80;color:#887a72;border-radius:20px;font-size:23px;line-height:1.2;font-weight:500}.heart-button.liked{color:#d44265;background:#fff0f4;border-color:#f4bbc9}.heart-button:hover{background:#fff0f4;color:#d44265}
