*{box-sizing:border-box}html,body{margin:0;min-height:100%;font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;background:#eef3f6;color:#17222b}button,input{font:inherit}.screen{min-height:100vh;display:grid;place-items:center;padding:24px}.card{width:min(100%,420px);background:#fff;border:1px solid #dde6ea;border-radius:18px;padding:28px;box-shadow:0 18px 50px rgba(24,46,58,.08)}.logo{width:48px;height:48px;border-radius:14px;background:#173b48;color:#fff;display:grid;place-items:center;font-weight:800;font-size:22px;margin-bottom:18px}.card h1{font-size:24px;margin:0 0 8px}.muted{color:#73848c;font-size:14px;line-height:1.45}.field{display:grid;gap:7px;margin-top:16px}.field label{font-size:13px;font-weight:700}.field input{width:100%;padding:12px 13px;border:1px solid #cfdde2;border-radius:10px;outline:none}.field input:focus{border-color:#278b79;box-shadow:0 0 0 3px rgba(39,139,121,.1)}.btn{width:100%;margin-top:18px;border:0;border-radius:10px;background:#177b6b;color:#fff;padding:12px 16px;font-weight:700;cursor:pointer}.btn:hover{background:#126859}.error{margin-top:14px;color:#b33b3b;font-size:13px}.shell{min-height:100vh;display:grid;grid-template-columns:240px 1fr}.side{background:#102c37;color:#dbe7eb;padding:22px 16px;display:flex;flex-direction:column}.brand{font-weight:800;font-size:19px;margin-bottom:26px}.nav{display:grid;gap:8px}.nav button{border:0;background:transparent;color:#abc0c7;text-align:left;padding:11px 12px;border-radius:9px}.nav button.active{background:#193f4c;color:#fff}.userbox{margin-top:auto;border-top:1px solid rgba(255,255,255,.1);padding-top:15px;font-size:13px}.main{padding:28px}.top{display:flex;justify-content:space-between;align-items:center;gap:20px}.top h1{margin:0;font-size:25px}.logout{border:1px solid #cddadf;background:#fff;border-radius:9px;padding:8px 12px;cursor:pointer}.welcome{margin-top:24px;background:#fff;border:1px solid #dfe8eb;border-radius:16px;padding:24px}.welcome h2{margin-top:0}.ok{display:inline-flex;align-items:center;gap:8px;background:#e7f5ef;color:#236f5e;padding:8px 11px;border-radius:999px;font-size:13px;font-weight:700}@media(max-width:700px){.shell{grid-template-columns:1fr}.side{display:none}.main{padding:18px}.card{padding:22px}}
.users-toolbar{display:flex;justify-content:flex-end;margin:24px 0 14px}.primary-action{border:0;border-radius:10px;background:#177b6b;color:#fff;padding:11px 16px;font-weight:700;cursor:pointer}.primary-action:hover{background:#126859}.panel{background:#fff;border:1px solid #dfe8eb;border-radius:16px;overflow:hidden}.panel-title{padding:20px 22px;border-bottom:1px solid #e8eef0}.panel-title h2{margin:0;font-size:19px}.panel-title p{margin:5px 0 0;color:#7a8b92;font-size:13px}.users-table{width:100%}.table-head,.table-row{display:grid;grid-template-columns:1.6fr 1.2fr .9fr .9fr .8fr;gap:14px;align-items:center;padding:12px 18px}.table-head{background:#f7fafb;color:#789099;font-size:12px;font-weight:700;border-bottom:1px solid #e7edef}.table-row{border-bottom:1px solid #edf1f3;font-size:14px}.table-row:last-child{border-bottom:0}.table-row small{display:block;color:#92a0a6;margin-top:4px;font-size:11px}.role-badge,.status-badge{display:inline-block;border-radius:999px;padding:5px 9px;font-size:12px}.role-badge{background:#eef3f5;color:#50656d}.status-badge.on{background:#e7f6ef;color:#24735e}.status-badge.off{background:#f3eded;color:#8b5555}.row-action{text-align:right}.row-action button{border:1px solid #d6e0e4;background:#fff;border-radius:8px;padding:7px 10px;cursor:pointer;font-size:12px}.table-loading{padding:24px;color:#7f9097}.modal-backdrop{position:fixed;inset:0;background:rgba(11,29,37,.48);display:grid;place-items:center;padding:18px;z-index:50}.modal{width:min(100%,500px);background:#fff;border-radius:16px;padding:22px;box-shadow:0 24px 60px rgba(0,0,0,.2)}.modal-head{display:flex;justify-content:space-between;gap:16px;align-items:flex-start}.modal-head h2{margin:0;font-size:21px}.modal-head p{margin:5px 0 0;color:#7c8c93;font-size:13px}.modal-head button{border:0;background:transparent;font-size:28px;line-height:1;cursor:pointer;color:#70828a}.field select{width:100%;padding:12px 13px;border:1px solid #cfdde2;border-radius:10px;background:#fff}.notice{margin-top:16px;padding:12px 13px;border-radius:10px;background:#f1f7f5;color:#355e55;font-size:13px}.notice span{color:#6f827c}.modal-actions{display:flex;justify-content:flex-end;gap:9px;margin-top:18px}.secondary{border:1px solid #d1dde1;background:#fff;border-radius:10px;padding:10px 14px;cursor:pointer}@media(max-width:900px){.table-head{display:none}.table-row{grid-template-columns:1fr 1fr;padding:16px}.row-action{text-align:left}}@media(max-width:560px){.table-row{grid-template-columns:1fr}.users-toolbar{justify-content:stretch}.primary-action{width:100%}.main{padding:14px}.top{align-items:flex-start}.modal{padding:18px}}
.chat-toolbar{display:flex;justify-content:flex-end;margin:24px 0 14px}.chat-list{display:grid}.chat-card{width:100%;border:0;border-bottom:1px solid #eaf0f2;background:#fff;padding:17px 20px;display:flex;justify-content:space-between;gap:18px;text-align:left;cursor:pointer}.chat-card:last-child{border-bottom:0}.chat-card:hover{background:#f7fbfa}.chat-title{font-size:16px;font-weight:800;color:#19313a}.chat-preview{margin-top:6px;color:#65777f;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:700px}.chat-meta{margin-top:8px;color:#8a9aa1;font-size:11px}.chat-card-side{display:flex;align-items:center;gap:12px;color:#8fa0a7;font-size:11px;white-space:nowrap}.chat-card-side b{font-size:24px;font-weight:400;color:#72858d}.empty-list{padding:28px;color:#82949c;text-align:center}.large-modal{width:min(100%,620px)}.field textarea{width:100%;padding:12px 13px;border:1px solid #cfdde2;border-radius:10px;resize:vertical;font:inherit}.member-picker{border:1px solid #d9e4e8;border-radius:10px;max-height:230px;overflow:auto;background:#fbfcfd}.member-check{display:flex;gap:11px;align-items:center;padding:11px 12px;border-bottom:1px solid #edf2f4;cursor:pointer}.member-check:last-child{border-bottom:0}.member-check input{width:18px;height:18px}.member-check span{display:grid}.member-check small{color:#8b9aa1;margin-top:2px}.chat-room{margin-top:24px;background:#fff;border:1px solid #dde7ea;border-radius:16px;overflow:hidden;display:grid;grid-template-rows:auto auto minmax(300px,1fr) auto auto;min-height:calc(100vh - 145px)}.room-head{display:flex;justify-content:space-between;gap:18px;align-items:flex-start;padding:16px 18px;border-bottom:1px solid #e7edef}.back-link{border:0;background:transparent;padding:0;color:#187565;font-weight:700;cursor:pointer}.room-members{margin-top:8px;color:#778a92;font-size:12px}.room-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}.danger-action{border:1px solid #e2caca;background:#fff5f5;color:#9b3b3b;border-radius:10px;padding:10px 13px;cursor:pointer}.room-description{padding:12px 18px;background:#f7faf9;color:#5e737b;font-size:13px;border-bottom:1px solid #e7edef}.room-description:empty{display:none}.message-list{padding:20px;overflow:auto;display:flex;flex-direction:column;gap:10px;background:#f5f8f9;max-height:calc(100vh - 365px)}.msg{max-width:min(78%,720px);align-self:flex-start;background:#fff;border:1px solid #e0e8eb;border-radius:13px;padding:10px 12px;box-shadow:0 1px 2px rgba(10,30,40,.03)}.msg.mine{align-self:flex-end;background:#e3f4ef;border-color:#cbe6de}.msg-author{font-size:11px;font-weight:800;color:#347061;margin-bottom:5px}.msg-body{white-space:pre-wrap;word-break:break-word;font-size:14px;line-height:1.4}.msg-foot{display:flex;justify-content:flex-end;gap:10px;align-items:center;margin-top:6px}.msg-foot span{font-size:10px;color:#8c9aa0}.msg-foot button{border:0;background:transparent;color:#337d70;font-size:11px;padding:0;cursor:pointer}.quoted{display:grid;gap:2px;margin-bottom:7px;padding:7px 8px;border-left:3px solid #5aa999;background:rgba(238,247,245,.8);border-radius:6px}.quoted b{font-size:11px}.quoted span{font-size:11px;color:#687a81;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.message-form{display:flex;gap:10px;padding:13px 16px;border-top:1px solid #e4ecef;background:#fff}.message-form textarea{flex:1;resize:none;border:1px solid #d2dfe3;border-radius:10px;padding:10px 12px;font:inherit}.message-form .primary-action{width:auto;align-self:stretch}.reply-bar{display:flex;justify-content:space-between;align-items:center;gap:15px;padding:8px 16px;background:#edf7f4;border-top:1px solid #d9eae5}.reply-bar.hidden{display:none}.reply-bar div{display:grid;min-width:0}.reply-bar b{font-size:11px;color:#267262}.reply-bar span{font-size:11px;color:#6d7d83;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.reply-bar button{border:0;background:transparent;font-size:22px;color:#74878e;cursor:pointer}.closed-note{padding:16px;text-align:center;color:#7b8d94;background:#f5f7f8;border-top:1px solid #e3eaed}.invite-list{display:grid;gap:7px;margin-top:18px;max-height:360px;overflow:auto}.invite-list button{border:1px solid #dce6e9;background:#fff;border-radius:10px;padding:11px 12px;text-align:left;cursor:pointer;display:grid}.invite-list button:hover{background:#f2f8f6}.invite-list span{color:#819198;font-size:12px;margin-top:3px}@media(max-width:700px){.chat-toolbar{margin-top:18px}.chat-card{padding:15px}.chat-preview{max-width:230px}.chat-card-side span{display:none}.chat-room{margin-top:18px;min-height:calc(100vh - 110px);border-radius:12px}.room-head{display:grid}.room-actions{justify-content:flex-start}.message-list{max-height:calc(100vh - 390px);padding:12px}.msg{max-width:88%}.message-form{padding:10px}.message-form .primary-action{padding:10px}.large-modal{width:100%}}
.msg-foot{align-items:flex-end}
.msg-status{display:flex;flex-wrap:wrap;gap:6px 9px;align-items:center;min-width:0}
.msg-status>span:first-child{font-size:10px;color:#8c9aa0}
.delivery-state{font-size:10px;line-height:1.2;white-space:nowrap}
.delivery-state.sent{color:#8a9aa1}
.delivery-state.delivered{color:#527b8a}
.delivery-state.read{color:#187c69;font-weight:700}
.delivery-state.group{color:#456e7a}
.reply-icon{width:40px;height:40px;min-width:40px;border:0!important;border-radius:50%;display:grid;place-items:center;background:transparent!important;color:#377c70!important;cursor:pointer;touch-action:manipulation}
.reply-icon:hover,.reply-icon:active{background:#dceee9!important}
.reply-icon svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}
@media(max-width:700px){.reply-icon{width:46px;height:46px;min-width:46px}.reply-icon svg{width:25px;height:25px}.msg-foot{margin-top:8px}.delivery-state{font-size:10.5px}}

.hidden{display:none!important}
.nav button{display:flex;align-items:center;gap:8px}
.nav-unread{margin-left:auto;min-width:22px;height:22px;padding:0 6px;border-radius:999px;background:#e24c4c;color:#fff;display:inline-grid;place-items:center;font-size:11px;font-weight:800}
.top-actions{display:flex;align-items:center;gap:9px}
.app-update-button{font-size:18px;position:relative}
.app-update-button:not(.hidden)::after{content:'';position:absolute;right:5px;top:5px;width:8px;height:8px;border-radius:50%;background:#e24c4c;border:2px solid #fff}
.app-update-backdrop{z-index:1400}
.app-update-modal{width:min(92vw,400px);text-align:center}
.app-update-icon{width:62px;height:62px;margin:0 auto 14px;border-radius:18px;background:#e8f6f1;display:grid;place-items:center;font-size:30px}
.app-update-modal h2{margin:0;font-size:22px}
.app-update-modal p{margin:8px 0 0;color:#72868d;font-size:14px}
.app-update-actions{justify-content:center;margin-top:22px}
.app-update-actions .primary-action,.app-update-actions .secondary{min-width:120px}
html[data-theme="dark"] .app-update-icon{background:#1d3b36}
html[data-theme="dark"] .app-update-modal p{color:#9eb0b7}
html[data-theme="dark"] .app-update-button:not(.hidden)::after{border-color:#182830}

.notification-bell{position:relative;width:40px;height:40px;border:1px solid #cddadf;background:#fff;border-radius:10px;display:grid;place-items:center;cursor:pointer}
.bell-icon{font-size:18px;line-height:1}
.top-unread{position:absolute;right:-6px;top:-6px;min-width:20px;height:20px;padding:0 5px;border-radius:999px;background:#e24c4c;color:#fff;display:grid;place-items:center;font-size:10px;font-weight:800;border:2px solid #eef3f6}
.chat-unread{min-width:25px;height:25px;padding:0 7px;border-radius:999px;background:#e24c4c;color:#fff;display:inline-grid;place-items:center;font-size:11px;font-weight:800}
@media(max-width:700px){.notification-bell{width:44px;height:44px}.chat-unread{min-width:28px;height:28px;font-size:12px}.top-unread{min-width:21px;height:21px}}

.composer-tools{display:flex;gap:6px;align-self:stretch;align-items:flex-end}
.composer-icon{width:44px;height:44px;min-width:44px;border:1px solid #d3dfe3;background:#fff;border-radius:11px;display:grid;place-items:center;font-size:20px;cursor:pointer;touch-action:manipulation}
.composer-icon:hover{background:#f0f7f5}.composer-icon.recording{background:#ffe7e7;border-color:#e69a9a;animation:pulseRec 1s infinite}
@keyframes pulseRec{50%{transform:scale(1.06);box-shadow:0 0 0 5px rgba(210,67,67,.12)}}
.attachments{display:grid;gap:8px;margin-top:8px}
.image-attachment{display:block;max-width:320px;border-radius:10px;overflow:hidden;border:1px solid #d9e5e8;background:#fff}
.image-attachment img{display:block;width:100%;max-height:320px;object-fit:cover}
.file-attachment{display:flex;align-items:center;gap:10px;min-width:230px;padding:10px;border:1px solid #d8e4e7;border-radius:10px;background:#fff;color:#24424c;text-decoration:none}
.file-attachment>span:nth-child(2){display:grid;min-width:0;flex:1}.file-attachment b{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:12px}.file-attachment small{color:#809198;margin-top:3px;font-size:10px}.file-icon{font-size:24px}.download-icon{font-size:20px;color:#47756b}
.voice-attachment{display:grid;gap:6px;min-width:min(300px,72vw)}.voice-label{font-size:11px;color:#60757d;font-weight:700}.voice-attachment audio{width:100%;height:38px}
@media(max-width:700px){.message-form{align-items:flex-end}.composer-tools{gap:4px}.composer-icon{width:46px;height:46px;min-width:46px}.send-action{min-height:46px}.image-attachment{max-width:72vw}.file-attachment{min-width:0;width:72vw}}

/* Compact message layout */
.message-list{gap:5px;padding:12px 14px}
.msg{padding:7px 9px;border-radius:11px;max-width:min(78%,720px)}
.msg-author{font-size:10px;margin-bottom:2px;line-height:1.2}
.msg-body{font-size:14px;line-height:1.3}
.msg-foot{margin-top:2px;min-height:24px;gap:5px;align-items:center}
.msg-status{gap:5px;line-height:1}
.msg-status>span:first-child{font-size:9px}
.delivery-state{font-size:9.5px;line-height:1}
.quoted{margin-bottom:4px;padding:5px 7px;gap:1px}
.quoted b,.quoted span{font-size:10px}
.attachments{margin-top:5px;gap:5px}
.reply-icon{width:32px;height:32px;min-width:32px}
.reply-icon svg{width:19px;height:19px}
@media(max-width:700px){.message-list{gap:4px;padding:9px}.msg{padding:6px 8px;max-width:90%}.msg-foot{margin-top:1px;min-height:32px}.reply-icon{width:38px;height:38px;min-width:38px}.reply-icon svg{width:22px;height:22px}.msg-author{margin-bottom:1px}}

/* Media thumbnails and viewer */
.image-attachment{width:112px;height:82px;max-width:none;border:0;padding:0;border-radius:9px;overflow:hidden;background:#e8eef0;cursor:pointer;display:block}
.image-attachment img{width:100%;height:100%;max-height:none;object-fit:cover;display:block}
.media-tab-btn{white-space:nowrap}
.media-panel{width:min(92vw,860px);max-height:86vh;display:flex;flex-direction:column}
.media-tabs{display:flex;gap:7px;margin:18px 0 14px;border-bottom:1px solid #e4ecef;padding-bottom:10px}
.media-tabs button{border:0;background:#eef3f5;color:#60747c;border-radius:999px;padding:8px 12px;font-weight:700;cursor:pointer}
.media-tabs button.active{background:#177b6b;color:#fff}
.media-tabs span{font-size:11px;opacity:.8;margin-left:4px}
#mediaPanelContent{overflow:auto;min-height:180px}
.media-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:8px}
.media-grid-item{aspect-ratio:1;border:0;padding:0;border-radius:10px;overflow:hidden;background:#e8eef0;cursor:pointer}
.media-grid-item img{width:100%;height:100%;object-fit:cover;display:block}
.media-file-list{display:grid;gap:8px}
.media-voice-item{display:grid;grid-template-columns:minmax(130px,1fr) minmax(220px,360px);gap:12px;align-items:center;padding:10px;border:1px solid #dfe7ea;border-radius:10px}
.media-voice-item>div{display:grid;gap:3px}.media-voice-item small{color:#84959c;font-size:11px}.media-voice-item audio{width:100%}
.media-viewer-backdrop{position:fixed;inset:0;background:rgba(6,17,22,.88);z-index:100;display:grid;place-items:center;padding:16px}
.media-viewer{width:min(96vw,1100px);height:min(92vh,900px);display:flex;flex-direction:column}
.media-viewer-head{display:flex;justify-content:space-between;align-items:center;color:#fff;padding:8px 2px}
.media-viewer-head b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.media-close{width:42px;height:42px;border:0;border-radius:50%;background:rgba(255,255,255,.14);color:#fff;font-size:28px;cursor:pointer}
.media-viewer-body{flex:1;display:grid;place-items:center;min-height:0}.media-viewer-body img{max-width:100%;max-height:100%;object-fit:contain;border-radius:8px}
@media(max-width:700px){.image-attachment{width:92px;height:68px}.media-panel{width:100%;max-height:92vh}.media-tabs{overflow:auto}.media-grid{grid-template-columns:repeat(3,1fr);gap:5px}.media-voice-item{grid-template-columns:1fr}.media-viewer-backdrop{padding:8px}.media-viewer{width:100%;height:96vh}}

.chat-room{position:relative}
.new-messages-jump{position:absolute;right:18px;bottom:82px;z-index:12;border:0;border-radius:999px;background:#177b6b;color:#fff;padding:9px 13px;font-weight:800;font-size:12px;box-shadow:0 5px 16px rgba(20,70,65,.2);cursor:pointer}
@media(max-width:700px){.new-messages-jump{right:12px;bottom:78px;font-size:12px;padding:10px 13px}}

/* Full-screen mobile chat */
@media(max-width:700px){
  html,body,#app{width:100%;height:100%;min-height:100%;overflow:hidden}
  body{overscroll-behavior:none}
  .shell{width:100%;height:100dvh;min-height:100dvh;display:block;overflow:hidden}
  .main{width:100%;height:100dvh;min-height:100dvh;padding:0;display:flex;flex-direction:column;overflow:hidden}
  .top{flex:0 0 auto;padding:10px 12px calc(8px + env(safe-area-inset-top));background:#eef3f6;border-bottom:1px solid #dfe7ea;min-width:0}
  .top h1{font-size:18px;line-height:1.15;max-width:62vw;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .top .muted{display:none}
  .top-actions{gap:6px}
  .notification-bell,.logout{height:40px}
  .logout{padding:7px 10px;font-size:12px}
  #content{flex:1;min-height:0;width:100%;overflow:hidden}
  .chat-room{margin:0;border:0;border-radius:0;width:100%;height:100%;min-height:0;display:grid;grid-template-rows:auto auto minmax(0,1fr) auto auto;overflow:hidden;background:#fff}
  .room-head{padding:9px 10px;gap:8px;display:flex;align-items:flex-start;background:rgba(255,255,255,.96);backdrop-filter:blur(8px)}
  .room-head>div:first-child{min-width:0;flex:1}
  .back-link{font-size:13px}
  .room-members{margin-top:3px;font-size:10.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
  .room-actions{gap:5px;flex:0 0 auto}
  .room-actions .secondary,.room-actions .danger-action,.room-actions .primary-action{padding:7px 9px;font-size:11px;border-radius:8px}
  .room-description{padding:7px 10px;font-size:11.5px;line-height:1.3;max-height:54px;overflow:auto}
  .message-list{
    min-height:0;
    max-height:none;
    width:100%;
    overflow-y:auto;
    overflow-x:hidden;
    -webkit-overflow-scrolling:touch;
    padding:10px 8px 14px;
    gap:4px;
    background-color:#eaf3f1;
    background-image:
      radial-gradient(circle at 12px 12px, rgba(23,123,107,.055) 1.5px, transparent 1.5px),
      radial-gradient(circle at 36px 30px, rgba(23,123,107,.035) 1px, transparent 1px),
      linear-gradient(135deg, transparent 46%, rgba(23,123,107,.028) 47%, rgba(23,123,107,.028) 49%, transparent 50%);
    background-size:48px 48px,48px 48px,72px 72px;
  }
  .msg{max-width:88%;width:auto;margin:0}
  .msg.mine{max-width:88%}
  .reply-bar{flex:0 0 auto;padding:6px 10px}
  .message-form{
    flex:0 0 auto;
    width:100%;
    padding:7px 8px calc(7px + env(safe-area-inset-bottom));
    gap:5px;
    background:rgba(255,255,255,.98);
    border-top:1px solid #dfe8eb;
    align-items:flex-end;
  }
  .message-form textarea{
    min-width:0;
    width:100%;
    min-height:42px;
    max-height:110px;
    padding:9px 10px;
    border-radius:11px;
    font-size:16px;
    line-height:1.25;
  }
  .composer-tools{flex:0 0 auto;gap:3px}
  .composer-icon{width:42px;height:42px;min-width:42px;border-radius:10px}
  .send-action{flex:0 0 auto;min-height:42px;padding:8px 10px;font-size:12px;border-radius:10px}
  .closed-note{padding:10px calc(10px + env(safe-area-inset-bottom))}
  .new-messages-jump{right:10px;bottom:calc(66px + env(safe-area-inset-bottom))}
}

/* Desktop chat background */
@media(min-width:701px){
  .message-list{
    background-color:#edf5f3;
    background-image:
      radial-gradient(circle at 14px 14px, rgba(23,123,107,.045) 1.5px, transparent 1.5px),
      radial-gradient(circle at 42px 34px, rgba(23,123,107,.028) 1px, transparent 1px),
      linear-gradient(135deg, transparent 46%, rgba(23,123,107,.022) 47%, rgba(23,123,107,.022) 49%, transparent 50%);
    background-size:56px 56px,56px 56px,84px 84px;
  }
}

/* Message depth */
.msg{
  box-shadow:0 3px 10px rgba(18,48,58,.10),0 1px 2px rgba(18,48,58,.06);
  transition:box-shadow .18s ease,transform .18s ease;
}
@media(hover:hover){
  .msg:hover{
    box-shadow:0 6px 18px rgba(18,48,58,.14),0 2px 5px rgba(18,48,58,.08);
  }
}
@media(max-width:700px){
  .msg{
    box-shadow:0 2px 8px rgba(18,48,58,.11),0 1px 2px rgba(18,48,58,.06);
  }
}

@media(max-width:700px){
  .msg{
    box-shadow:0 5px 16px rgba(18,48,58,.16),0 2px 5px rgba(18,48,58,.09);
  }
}

.media-tab-btn{display:grid!important;place-items:center!important;padding:0!important;width:42px!important;height:42px!important;min-width:42px!important;border-radius:10px!important}
.media-tab-btn svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
@media(max-width:700px){.media-tab-btn{width:42px!important;height:42px!important;min-width:42px!important}.media-tab-btn svg{width:23px;height:23px}}

/* Quick message reactions */
.msg{position:relative}
.msg-quick-actions{display:flex;align-items:center;gap:2px}
.reaction-open{width:32px;height:32px;min-width:32px!important;border:0!important;border-radius:50%;display:grid!important;place-items:center;background:transparent!important;color:#53747c!important;font-size:18px!important;line-height:1;cursor:pointer;padding:0!important}
.reaction-open:hover,.reaction-open:active{background:#dceee9!important}
.reaction-picker{position:absolute;right:8px;bottom:38px;z-index:8;display:flex;gap:3px;padding:5px 6px;border:1px solid #d8e3e6;border-radius:999px;background:#fff;box-shadow:0 7px 22px rgba(17,48,58,.18)}
.reaction-picker button{width:34px;height:34px;border:0;background:transparent;border-radius:50%;display:grid;place-items:center;font-size:20px;cursor:pointer;padding:0}
.reaction-picker button:hover,.reaction-picker button:active{background:#edf5f3;transform:scale(1.08)}
.reaction-list{display:flex;flex-wrap:wrap;gap:3px;margin-top:4px;min-height:0}
.reaction-list-empty{display:none}
.reaction-chip{height:24px;min-width:31px;border:1px solid #d7e2e5;background:#f7fafb;border-radius:999px;padding:1px 6px;display:inline-flex;align-items:center;justify-content:center;gap:3px;font-size:15px;cursor:pointer}
.reaction-chip span{font-size:10px;font-weight:800;color:#61777f}
.reaction-chip.mine{background:#dff2ec;border-color:#9bcfc1}
@media(max-width:700px){
  .reaction-open{width:38px;height:38px;min-width:38px!important;font-size:20px!important}
  .reaction-picker{right:4px;bottom:42px;gap:2px;padding:5px}
  .reaction-picker button{width:38px;height:38px;font-size:22px}
  .reaction-chip{height:26px;min-width:33px;font-size:16px}
}

/* Center reaction picker on mobile */
@media(max-width:700px){
  .reaction-picker{
    position:fixed!important;
    left:50%!important;
    right:auto!important;
    bottom:calc(74px + env(safe-area-inset-bottom))!important;
    transform:translateX(-50%)!important;
    width:max-content;
    max-width:calc(100vw - 16px);
    justify-content:center;
    align-items:center;
    flex-wrap:nowrap;
    z-index:120;
    padding:6px 8px;
    border-radius:999px;
  }
  .reaction-picker button{
    flex:0 0 38px;
    width:38px;
    height:38px;
    margin:0;
  }
}

/* Compact send button + larger editor */
.send-action{
  width:42px!important;
  height:42px!important;
  min-width:42px!important;
  padding:0!important;
  border-radius:11px!important;
  display:grid!important;
  place-items:center!important;
}
.send-action svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.message-form textarea{flex:1;min-width:0}
#attachBtn{position:relative;overflow:visible}
#attachBtn.uploading::before{
  content:"";
  position:absolute;
  inset:-3px;
  border-radius:50%;
  background:conic-gradient(#177b6b var(--upload-progress),#dfe8eb 0);
  -webkit-mask:radial-gradient(farthest-side,transparent calc(100% - 3px),#000 0);
  mask:radial-gradient(farthest-side,transparent calc(100% - 3px),#000 0);
  pointer-events:none;
}
#attachBtn.uploading::after{
  content:attr(data-progress) "%";
  position:absolute;
  left:50%;
  top:-15px;
  transform:translateX(-50%);
  padding:2px 5px;
  border-radius:999px;
  background:#173b48;
  color:#fff;
  font-size:9px;
  font-weight:800;
  line-height:1.2;
  pointer-events:none;
  white-space:nowrap;
}
#attachBtn:disabled{opacity:1;cursor:wait}
@media(max-width:700px){
  .message-form textarea{min-height:52px;max-height:132px}
  .send-action{width:40px!important;height:40px!important;min-width:40px!important;border-radius:10px!important}
  .send-action svg{width:20px;height:20px}
}

/* Dashboard background + day/night theme */
:root{
  color-scheme:light;
  --page-bg:#eef3f6;
  --surface:#ffffff;
  --surface-soft:#f7fafb;
  --surface-chat:#edf5f3;
  --text:#17222b;
  --text-soft:#73848c;
  --border:#dfe8eb;
  --accent:#177b6b;
  --accent-soft:#e3f4ef;
  --sidebar:#102c37;
}
html[data-theme="dark"]{
  color-scheme:dark;
  --page-bg:#0d171d;
  --surface:#152229;
  --surface-soft:#1a2931;
  --surface-chat:#111e24;
  --text:#e6eef1;
  --text-soft:#92a5ad;
  --border:#2a3c44;
  --accent:#38a995;
  --accent-soft:#173b36;
  --sidebar:#091219;
}
body{background:var(--page-bg);color:var(--text);transition:background .2s ease,color .2s ease}
.theme-toggle{
  width:40px;height:40px;min-width:40px;border:1px solid #cddadf;background:#fff;color:#25454f;
  border-radius:10px;display:grid;place-items:center;cursor:pointer;padding:0
}
.theme-toggle span{font-size:18px;line-height:1}

/* Background for chat list/history */
.chat-home{
  position:relative;
  min-height:calc(100vh - 95px);
  padding:1px 18px 28px;
  margin:8px -18px -28px;
  overflow:hidden;
}
.chat-home::before{
  content:"";
  position:absolute;inset:0;pointer-events:none;z-index:0;
  background:
    radial-gradient(circle at 12% 16%,rgba(23,123,107,.11) 0 2px,transparent 3px),
    radial-gradient(circle at 78% 22%,rgba(48,111,143,.08) 0 3px,transparent 4px),
    radial-gradient(circle at 62% 78%,rgba(23,123,107,.07) 0 2px,transparent 3px),
    linear-gradient(120deg,transparent 0 47%,rgba(23,123,107,.035) 48% 49%,transparent 50%),
    linear-gradient(25deg,transparent 0 47%,rgba(48,111,143,.026) 48% 49%,transparent 50%);
  background-size:94px 94px,140px 140px,118px 118px,180px 180px,220px 220px;
}
.chat-home::after{
  content:"";
  position:absolute;inset:0;pointer-events:none;z-index:0;
  background:
    radial-gradient(circle at 14% 18%,rgba(54,171,151,.10),transparent 18%),
    radial-gradient(circle at 88% 72%,rgba(70,132,168,.08),transparent 22%);
}
.chat-home>*{position:relative;z-index:1}
.chat-home .panel{box-shadow:0 12px 34px rgba(24,46,58,.08)}
.chat-home .chat-toolbar{padding-top:10px}

/* Dark surfaces */
html[data-theme="dark"] .main{background:var(--page-bg)}
html[data-theme="dark"] .top{background:#101c22;border-color:var(--border)}
html[data-theme="dark"] .top h1,
html[data-theme="dark"] .panel-title h2,
html[data-theme="dark"] .chat-title,
html[data-theme="dark"] .modal-head h2,
html[data-theme="dark"] .welcome h2{color:var(--text)}
html[data-theme="dark"] .muted,
html[data-theme="dark"] .panel-title p,
html[data-theme="dark"] .chat-preview,
html[data-theme="dark"] .chat-meta,
html[data-theme="dark"] .room-members{color:var(--text-soft)}
html[data-theme="dark"] .panel,
html[data-theme="dark"] .welcome,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .card{background:var(--surface);border-color:var(--border)}
html[data-theme="dark"] .panel-title,
html[data-theme="dark"] .chat-card,
html[data-theme="dark"] .table-row{border-color:var(--border)}
html[data-theme="dark"] .chat-card{background:rgba(21,34,41,.94);color:var(--text)}
html[data-theme="dark"] .chat-card:hover{background:#1c3038}
html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .notification-bell,
html[data-theme="dark"] .logout,
html[data-theme="dark"] .secondary,
html[data-theme="dark"] .row-action button,
html[data-theme="dark"] .composer-icon{background:#182830;color:#dbe8ec;border-color:#31454e}
html[data-theme="dark"] .primary-action,
html[data-theme="dark"] .btn{background:#278f7d}
html[data-theme="dark"] .field input,
html[data-theme="dark"] .field textarea,
html[data-theme="dark"] .field select,
html[data-theme="dark"] .message-form textarea{background:#101d23;color:var(--text);border-color:#33464e}
html[data-theme="dark"] .member-picker,
html[data-theme="dark"] .member-check{background:#14242b;border-color:#2c3f47;color:var(--text)}
html[data-theme="dark"] .room-head,
html[data-theme="dark"] .message-form{background:#142229;border-color:#2a3c44}
html[data-theme="dark"] .room-description{background:#17262d;color:#a5b5bb;border-color:#2a3c44}
html[data-theme="dark"] .message-list{
  background-color:#101c22;
  background-image:
    radial-gradient(circle at 12px 12px,rgba(56,169,149,.08) 1.5px,transparent 1.5px),
    radial-gradient(circle at 36px 30px,rgba(89,145,175,.06) 1px,transparent 1px),
    linear-gradient(135deg,transparent 46%,rgba(56,169,149,.035) 47%,rgba(56,169,149,.035) 49%,transparent 50%);
}
html[data-theme="dark"] .msg{background:#1b2b32;border-color:#30434b;color:#edf4f6;box-shadow:0 5px 16px rgba(0,0,0,.28),0 2px 5px rgba(0,0,0,.18)}
html[data-theme="dark"] .msg.mine{background:#173a35;border-color:#285a51}
html[data-theme="dark"] .msg-author{color:#62c3af}
html[data-theme="dark"] .quoted{background:rgba(42,83,76,.35);border-color:#4ba591}
html[data-theme="dark"] .quoted span{color:#a6b6bc}
html[data-theme="dark"] .file-attachment,
html[data-theme="dark"] .media-voice-item{background:#14242b;color:#dce8eb;border-color:#30434b}
html[data-theme="dark"] .reaction-picker{background:#1a2931;border-color:#344750}
html[data-theme="dark"] .reaction-picker button:hover,
html[data-theme="dark"] .reaction-picker button:active{background:#263b43}
html[data-theme="dark"] .reaction-chip{background:#1a2a31;border-color:#354850}
html[data-theme="dark"] .reaction-chip.mine{background:#21463f;border-color:#3d8b7c}
html[data-theme="dark"] .reply-bar{background:#18302d;border-color:#29443f}
html[data-theme="dark"] .closed-note{background:#17242a;color:#91a4ab;border-color:#2a3c44}
html[data-theme="dark"] .modal-backdrop{background:rgba(2,8,11,.72)}
html[data-theme="dark"] .top-unread{border-color:#101c22}

/* Dark dashboard artwork */
html[data-theme="dark"] .chat-home::before{
  background:
    radial-gradient(circle at 12% 16%,rgba(57,177,157,.15) 0 2px,transparent 3px),
    radial-gradient(circle at 78% 22%,rgba(71,139,178,.13) 0 3px,transparent 4px),
    radial-gradient(circle at 62% 78%,rgba(57,177,157,.10) 0 2px,transparent 3px),
    linear-gradient(120deg,transparent 0 47%,rgba(57,177,157,.045) 48% 49%,transparent 50%),
    linear-gradient(25deg,transparent 0 47%,rgba(71,139,178,.04) 48% 49%,transparent 50%);
  background-size:94px 94px,140px 140px,118px 118px,180px 180px,220px 220px;
}
html[data-theme="dark"] .chat-home::after{
  background:
    radial-gradient(circle at 12% 15%,rgba(40,132,117,.16),transparent 20%),
    radial-gradient(circle at 88% 76%,rgba(46,91,120,.16),transparent 25%);
}
html[data-theme="dark"] .chat-home .panel{box-shadow:0 16px 38px rgba(0,0,0,.22)}

@media(max-width:700px){
  .theme-toggle{width:40px;height:40px;min-width:40px}
  .chat-home{min-height:100%;margin:0;padding:8px 10px 18px;overflow-y:auto}
  .chat-home .chat-toolbar{margin:5px 0 10px;padding-top:0}
  html[data-theme="dark"] .top{background:#101c22}
}

/* Hard fix: compact send icon button */
.message-form .send-action{
  flex:0 0 38px!important;
  width:38px!important;
  height:38px!important;
  min-width:38px!important;
  min-height:38px!important;
  max-width:38px!important;
  max-height:38px!important;
  align-self:flex-end!important;
  padding:0!important;
  margin:0!important;
  border-radius:10px!important;
  display:grid!important;
  place-items:center!important;
  line-height:1!important;
  overflow:hidden!important;
}
.message-form .send-action svg{
  width:18px!important;
  height:18px!important;
  min-width:18px!important;
  min-height:18px!important;
  display:block!important;
}
@media(max-width:700px){
  .message-form .send-action{
    flex-basis:38px!important;
    width:38px!important;
    height:38px!important;
    min-width:38px!important;
    min-height:38px!important;
    max-width:38px!important;
    max-height:38px!important;
    align-self:flex-end!important;
  }
}

/* Mobile composer: equal controls + auto-growing textarea */
@media(max-width:700px){
  .message-form{
    align-items:flex-end;
    gap:5px;
  }
  .composer-tools{
    align-items:flex-end;
    gap:4px;
  }
  .message-form .composer-icon,
  .message-form .send-action{
    flex:0 0 38px!important;
    width:38px!important;
    height:38px!important;
    min-width:38px!important;
    min-height:38px!important;
    max-width:38px!important;
    max-height:38px!important;
    border-radius:10px!important;
  }
  .message-form textarea{
    min-height:38px!important;
    height:38px;
    max-height:108px!important;
    padding:8px 10px;
    line-height:1.25;
    overflow-y:auto;
    resize:none;
  }
}

/* Desktop composer repair */
@media(min-width:701px){
  .message-form{
    display:flex!important;
    align-items:flex-end!important;
    gap:8px!important;
    padding:10px 12px!important;
    min-height:58px!important;
  }
  .composer-tools{
    flex:0 0 auto!important;
    align-self:flex-end!important;
    align-items:flex-end!important;
    gap:6px!important;
    height:auto!important;
  }
  .message-form .composer-icon{
    flex:0 0 38px!important;
    width:38px!important;
    height:38px!important;
    min-width:38px!important;
    min-height:38px!important;
    max-width:38px!important;
    max-height:38px!important;
    border-radius:10px!important;
  }
  .message-form textarea{
    flex:1 1 auto!important;
    width:auto!important;
    min-width:0!important;
    min-height:42px!important;
    height:42px;
    max-height:108px!important;
    padding:9px 11px!important;
    line-height:1.3!important;
    overflow-y:auto!important;
    resize:none!important;
  }
  .message-form .send-action{
    flex:0 0 38px!important;
    width:38px!important;
    height:38px!important;
    min-width:38px!important;
    min-height:38px!important;
    max-width:38px!important;
    max-height:38px!important;
    align-self:flex-end!important;
  }
}

/* Remove empty gap between messages and composer */
.chat-room{
  grid-template-rows:auto auto minmax(0,1fr) auto auto!important;
}
.message-list{
  min-height:0!important;
  height:auto!important;
  max-height:none!important;
  align-self:stretch!important;
}
@media(min-width:701px){
  .chat-room{
    height:calc(100vh - 145px)!important;
    min-height:520px!important;
    max-height:calc(100vh - 145px)!important;
  }
  .message-list{
    max-height:none!important;
    overflow-y:auto!important;
  }
}
@media(max-width:700px){
  .chat-room{
    height:100%!important;
    min-height:0!important;
    max-height:none!important;
  }
  .message-list{
    max-height:none!important;
    min-height:0!important;
    overflow-y:auto!important;
  }
}

/* Stable chat grid: hidden optional rows must not shift composer */
.chat-room{
  grid-template-rows:auto auto minmax(0,1fr) auto auto!important;
}
.room-head{grid-row:1!important}
.room-description{grid-row:2!important}
.message-list{grid-row:3!important}
.reply-bar{grid-row:4!important}
.message-form,.closed-note{grid-row:5!important}

/* Notification center */
.notification-panel{
  position:fixed;
  top:74px;
  right:24px;
  z-index:140;
  width:min(390px,calc(100vw - 24px));
  max-height:min(70vh,620px);
  background:#fff;
  border:1px solid #dbe5e8;
  border-radius:16px;
  box-shadow:0 18px 48px rgba(16,44,55,.22);
  overflow:hidden;
}
.notification-panel-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:14px 15px;
  border-bottom:1px solid #e7edef;
  background:#f8fbfb;
}
.notification-panel-head>div{display:grid;gap:2px}
.notification-panel-head b{font-size:15px}
.notification-panel-head small{font-size:11px;color:#7c8e95}
.notification-panel-head button{
  border:0;
  background:transparent;
  color:#177b6b;
  font-size:11px;
  font-weight:800;
  cursor:pointer;
}
.notification-panel-head button:disabled{opacity:.45;cursor:default}
.notification-panel-list{max-height:calc(min(70vh,620px) - 62px);overflow-y:auto}
.notification-item{
  width:100%;
  border:0;
  border-bottom:1px solid #edf2f3;
  background:#fff;
  padding:11px 13px;
  display:flex;
  gap:10px;
  text-align:left;
  cursor:pointer;
}
.notification-item:last-child{border-bottom:0}
.notification-item:hover{background:#f5faf8}
.notification-item.unread{background:#edf8f5}
.notification-item-icon{
  width:34px;height:34px;min-width:34px;border-radius:50%;
  display:grid;place-items:center;background:#e8f3f0;font-size:17px
}
.notification-item-main{display:grid;gap:3px;min-width:0;flex:1}
.notification-item-main b{font-size:12px;color:#213840;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.notification-item-main>span{font-size:11px;color:#60757d;line-height:1.35;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.notification-item-main small{font-size:9px;color:#91a0a6}
.notification-empty{padding:24px;text-align:center;color:#81949b;font-size:12px}

.toast-root{
  position:fixed;
  top:78px;
  right:20px;
  z-index:160;
  display:grid;
  gap:8px;
  width:min(360px,calc(100vw - 24px));
  pointer-events:none;
}
.notification-toast{
  width:100%;
  border:1px solid #d5e4e1;
  background:rgba(255,255,255,.97);
  border-radius:14px;
  box-shadow:0 12px 32px rgba(14,46,56,.22);
  padding:10px 12px;
  display:flex;
  align-items:center;
  gap:10px;
  text-align:left;
  cursor:pointer;
  opacity:0;
  transform:translateY(-10px);
  transition:opacity .2s ease,transform .2s ease;
  pointer-events:auto;
}
.notification-toast.show{opacity:1;transform:translateY(0)}
.notification-toast-icon{
  width:34px;height:34px;min-width:34px;border-radius:50%;
  display:grid;place-items:center;background:#e8f3f0;font-size:17px
}
.notification-toast>span:last-child{display:grid;gap:3px;min-width:0}
.notification-toast b{font-size:12px;color:#1e3740;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.notification-toast small{font-size:11px;color:#60757d;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

html[data-theme="dark"] .notification-panel{
  background:#152229;border-color:#31434b;box-shadow:0 18px 48px rgba(0,0,0,.38)
}
html[data-theme="dark"] .notification-panel-head{background:#18282f;border-color:#2c3f47}
html[data-theme="dark"] .notification-item{background:#152229;border-color:#263942}
html[data-theme="dark"] .notification-item:hover{background:#1b3037}
html[data-theme="dark"] .notification-item.unread{background:#18332f}
html[data-theme="dark"] .notification-item-icon,
html[data-theme="dark"] .notification-toast-icon{background:#203a35}
html[data-theme="dark"] .notification-item-main b,
html[data-theme="dark"] .notification-toast b{color:#e7eff1}
html[data-theme="dark"] .notification-item-main>span,
html[data-theme="dark"] .notification-toast small{color:#9db0b7}
html[data-theme="dark"] .notification-toast{
  background:rgba(21,34,41,.98);border-color:#33474f;box-shadow:0 14px 34px rgba(0,0,0,.4)
}

@media(max-width:700px){
  .notification-panel{
    top:66px;
    right:8px;
    width:calc(100vw - 16px);
    max-height:72vh;
    border-radius:14px;
  }
  .notification-panel-list{max-height:calc(72vh - 62px)}
  .toast-root{top:72px;right:8px;width:calc(100vw - 16px)}
  .notification-item{padding:12px}
}

.android-install{
  margin-top:12px;
  width:100%;
  min-height:52px;
  border:1px solid #cfe2de;
  border-radius:12px;
  background:#f2faf7;
  color:#1f5f54;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding:10px 12px;
  text-decoration:none;
  cursor:pointer;
}
.android-install:hover{background:#e8f6f1;border-color:#b8d8d0}
.android-install-icon{font-size:22px;line-height:1}
.android-install>span:last-child{display:grid;gap:2px;text-align:left}
.android-install b{font-size:13px;line-height:1.2}
.android-install small{font-size:10px;color:#728b84;font-weight:600}
html[data-theme="dark"] .android-install{
  background:#18312d;
  border-color:#315149;
  color:#d9f0e9;
}
html[data-theme="dark"] .android-install:hover{background:#1d3b36}
html[data-theme="dark"] .android-install small{color:#91aaa3}

.nav-install-app{
  margin-top:8px;
  min-height:44px;
  border:1px solid rgba(255,255,255,.14);
  border-radius:10px;
  padding:10px 12px;
  display:flex;
  align-items:center;
  gap:8px;
  text-decoration:none;
  font-weight:700;
  font-size:13px;
  color:inherit;
  background:rgba(255,255,255,.06);
}
.nav-install-app:hover{background:rgba(255,255,255,.12)}

.settings-stack{display:grid;gap:18px}
.settings-card{background:var(--panel,#fff);border:1px solid rgba(127,127,127,.18);border-radius:16px;padding:18px}
.settings-card h3{margin:0 0 12px}
.push-status{display:grid;gap:8px;padding:14px;border-radius:12px}
.push-status b{font-size:14px}
.push-status span{font-size:13px;line-height:1.45}
.push-status.info{background:rgba(42,143,131,.08);border:1px solid rgba(42,143,131,.22)}
.push-status.ok{background:rgba(45,150,90,.09);border:1px solid rgba(45,150,90,.22)}
.push-status.warn{background:rgba(190,130,40,.09);border:1px solid rgba(190,130,40,.25)}
.push-status button{justify-self:start;margin-top:4px}

.chat-title-row{display:flex;align-items:center;gap:8px;min-width:0}
.chat-title-row .chat-title{min-width:0}
.chat-title-row .chat-unread{flex:0 0 auto;min-width:22px;height:22px;padding:0 6px;border-radius:999px;background:#e24c4c;color:#fff;display:inline-grid;place-items:center;font-size:11px;font-weight:800;line-height:1}
.chat-title-row .chat-unread.hidden{display:none}
@media(max-width:700px){
  .chat-title-row{gap:7px}
  .chat-title-row .chat-unread{min-width:23px;height:23px;font-size:11px}
}

.settings-password-form{display:grid;gap:12px;max-width:520px}
.settings-password-form .field{margin:0}
.settings-password-note{font-size:12px;color:#7f9198}
.settings-password-form .success{min-height:18px;color:#2f8b63;font-size:13px}
.settings-password-form .error{min-height:18px}
.settings-password-form .primary-action{justify-self:start}

.message-action-icon{width:32px;height:32px;min-width:32px;border:0!important;border-radius:50%;display:grid!important;place-items:center;background:transparent!important;color:#53747c!important;font-size:17px!important;line-height:1;cursor:pointer;padding:0!important}
.message-action-icon:hover,.message-action-icon:active{background:#dceee9!important}
.message-action-icon.delete{color:#a34b4b!important}
.message-action-icon.delete:hover,.message-action-icon.delete:active{background:#f6e4e4!important}
.edited-mark{font-style:italic;color:#8c9aa0!important}
#editMessageBody{width:100%;padding:12px 13px;border:1px solid #cfdde2;border-radius:10px;resize:vertical;font:inherit;min-height:110px}
@media(max-width:700px){
  .message-action-icon{width:38px;height:38px;min-width:38px;font-size:18px!important}
}

.message-action-icon{width:36px;height:36px;min-width:36px}
.message-action-icon svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}
.message-action-icon.edit{color:#2f746a!important}
.message-action-icon.edit:hover,.message-action-icon.edit:active{background:#dceee9!important}
.message-action-icon.delete{color:#a34b4b!important}
.delete-message-modal{width:min(100%,460px)}
.delete-message-preview{margin-top:16px;padding:13px 14px;border:1px solid #e0e7ea;border-radius:10px;background:#f7f9fa;color:#32454d;font-size:14px;line-height:1.45;white-space:pre-wrap;word-break:break-word}
.delete-message-warning{margin-top:12px;color:#8f4a4a;font-size:13px}
.danger-confirm-action{border:0;border-radius:10px;background:#b94747;color:#fff;padding:10px 15px;font-weight:700;cursor:pointer}
.danger-confirm-action:hover{background:#9f3c3c}
.danger-confirm-action:disabled{opacity:.6;cursor:default}
@media(max-width:700px){
  .message-action-icon{width:44px;height:44px;min-width:44px}
  .message-action-icon svg{width:25px;height:25px}
  .delete-message-modal .modal-actions{display:grid;grid-template-columns:1fr 1fr}
  .delete-message-modal .modal-actions button{width:100%}
}

@media(max-width:700px){
  input, textarea, select{
    font-size:16px!important;
  }
  .message-form textarea{
    font-size:16px!important;
  }
}

.chat-card{align-items:center}
.chat-avatar{
  flex:0 0 44px;
  width:44px;
  height:44px;
  border-radius:50%;
  display:grid;
  place-items:center;
  overflow:hidden;
  background:var(--chat-color,#627D86);
  color:#fff;
  font-size:18px;
  font-weight:800;
  letter-spacing:.01em;
  box-shadow:0 1px 3px rgba(20,40,50,.14);
}
.chat-avatar img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.chat-card-main{flex:1 1 auto;min-width:0}
.chat-icon-create{
  display:flex;
  align-items:center;
  gap:14px;
  margin:16px 0 4px;
  padding:14px;
  border:1px solid #dfe8eb;
  border-radius:12px;
  background:#f8fbfb;
}
.chat-icon-preview{
  flex:0 0 64px;
  width:64px;
  height:64px;
  border-radius:50%;
  overflow:hidden;
  display:grid;
  place-items:center;
  background:#627D86;
  color:#fff;
  font-size:26px;
  font-weight:800;
}
.chat-icon-preview img{
  width:100%;
  height:100%;
  object-fit:cover;
}
.chat-icon-create-text{display:grid;gap:5px;min-width:0}
.chat-icon-create-text>b{font-size:14px}
.chat-icon-create-text>span{font-size:12px;color:#73848c;line-height:1.4}
.chat-icon-pick{justify-self:start;margin-top:4px;display:inline-flex;align-items:center}
@media(max-width:700px){
  .chat-card{gap:10px}
  .chat-avatar{flex-basis:40px;width:40px;height:40px;font-size:16px}
  .chat-icon-create{align-items:flex-start}
  .chat-icon-preview{flex-basis:58px;width:58px;height:58px;font-size:23px}
}

.msg.user-colored{
  background:var(--msg-color,#fff)!important;
  color:#17222b!important;
  border-color:#d6e0e4!important;
}
.msg.user-colored.mine{
  background:var(--msg-color,#e3f4ef)!important;
  border-color:#cbd8dc!important;
}
html[data-theme="dark"] .msg.user-colored,
html[data-theme="dark"] .msg.user-colored.mine{
  background:var(--msg-color,#e3f4ef)!important;
  color:#17222b!important;
  border-color:#81939a!important;
}
.user-color-current{display:flex;gap:14px;align-items:center;flex-wrap:wrap;margin-bottom:12px}
.name-color-preview{font-weight:800;color:var(--name-color,#455A64);font-size:15px}
.message-color-preview{display:inline-flex;align-items:center;min-height:38px;padding:9px 13px;border-radius:12px;background:var(--preview-color,#EEF2F4);border:1px solid #d7e0e3;color:#17222b;font-size:13px}
.color-settings-note{font-size:12px;color:#73848c;line-height:1.45;margin-bottom:12px}
.message-color-palette{display:flex;flex-wrap:wrap;gap:9px}
.message-color-swatch{position:relative;width:40px;height:40px;border-radius:50%;border:2px solid transparent;background:var(--swatch-color);cursor:pointer;box-shadow:0 0 0 1px rgba(70,90,100,.18)}
.message-color-swatch:hover{transform:scale(1.06)}
.message-color-swatch.selected{border-color:#173b48;box-shadow:0 0 0 2px #fff,0 0 0 4px #173b48}
.message-color-swatch span{font-size:17px;font-weight:900;color:#173b48}
.message-color-swatch.occupied::after{content:"";position:absolute;left:7px;right:7px;top:18px;height:2px;background:#a44343;transform:rotate(-42deg);border-radius:2px}
.color-settings-status{margin-top:12px;font-size:12px;color:#2f7b63}
.color-settings-status.locked{color:#8a6660}
#messageColorError,#messageColorSuccess{min-height:18px}
#messageColorSuccess{color:#2f8b63;font-size:13px;margin-top:8px}
@media(max-width:700px){
  .message-color-swatch{width:44px;height:44px}
  .message-color-swatch.occupied::after{top:20px}
}

html[data-theme="dark"] .msg.user-colored,
html[data-theme="dark"] .msg.user-colored.mine{
  background:var(--msg-color-dark,#26363d)!important;
  color:#edf4f6!important;
  border-color:rgba(255,255,255,.10)!important;
}
html[data-theme="dark"] .msg.user-colored .msg-body{
  color:#edf4f6!important;
}
html[data-theme="dark"] .msg.user-colored .msg-foot span{
  color:#aebdc3!important;
}
html[data-theme="dark"] .msg.user-colored .quoted{
  background:rgba(255,255,255,.06)!important;
  border-left-color:rgba(255,255,255,.28)!important;
}
html[data-theme="dark"] .msg.user-colored .quoted span{
  color:#c4d0d5!important;
}
html[data-theme="dark"] .message-color-preview{
  background:var(--preview-color-dark,#26363d)!important;
  color:#edf4f6!important;
  border-color:rgba(255,255,255,.12)!important;
}
html[data-theme="dark"] .message-color-swatch{
  background:var(--swatch-color-dark,var(--swatch-color))!important;
  box-shadow:0 0 0 1px rgba(255,255,255,.22);
}
html[data-theme="dark"] .message-color-swatch.selected{
  border-color:#dce7eb;
  box-shadow:0 0 0 2px #14242b,0 0 0 4px #dce7eb;
}
html[data-theme="dark"] .message-color-swatch span{
  color:#fff;
}
.color-save-action{
  margin-top:10px;
  width:auto;
}
.color-save-action:disabled{
  opacity:.5;
  cursor:default;
}
@media(max-width:700px){
  .color-save-action{
    width:100%;
  }
}

/* Mobile settings must scroll independently from full-screen chat layout */
@media(max-width:700px){
  #content > .settings-stack{
    width:100%;
    height:100%;
    min-height:0;
    margin:0;
    padding:12px 12px calc(92px + env(safe-area-inset-bottom));
    border:0;
    border-radius:0;
    overflow-y:auto;
    overflow-x:hidden;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior-y:contain;
  }
  .settings-stack .settings-card{
    padding:14px;
    border-radius:13px;
  }
  .settings-stack .message-color-palette{
    gap:7px;
  }
  .settings-stack .message-color-swatch{
    width:40px;
    height:40px;
  }
  .settings-stack .message-color-swatch.occupied::after{
    top:18px;
  }
  .settings-stack .color-save-action{
    position:sticky;
    bottom:calc(10px + env(safe-area-inset-bottom));
    z-index:8;
    width:100%;
    min-height:48px;
    margin-top:12px;
    box-shadow:0 8px 24px rgba(17,45,55,.18);
  }
}

/* Hard fix for Android WebView settings scrolling */
@media(max-width:700px){
  #content:has(> .settings-stack){
    overflow-y:auto!important;
    overflow-x:hidden!important;
    -webkit-overflow-scrolling:touch!important;
    overscroll-behavior-y:contain;
  }
  #content:has(> .settings-stack) > .settings-stack{
    height:auto!important;
    min-height:100%!important;
    overflow:visible!important;
    padding-bottom:calc(110px + env(safe-area-inset-bottom))!important;
  }
  #content:has(> .settings-stack) .color-save-action{
    position:sticky!important;
    bottom:calc(12px + env(safe-area-inset-bottom))!important;
    z-index:20!important;
    display:block!important;
    width:100%!important;
    min-height:52px!important;
  }
}

/* Android: keep color save action above palette */
@media(max-width:700px){
  #userColorSettings{
    display:flex!important;
    flex-direction:column!important;
  }
  #userColorSettings .user-color-current{order:1}
  #userColorSettings .color-settings-note{order:2}
  #userColorSettings .color-save-action{
    order:3;
    position:sticky!important;
    top:8px!important;
    bottom:auto!important;
    z-index:30!important;
    width:100%!important;
    min-height:52px!important;
    margin:4px 0 12px!important;
  }
  #userColorSettings .message-color-palette{order:4}
  #userColorSettings .color-settings-status{order:5}
  #userColorSettings #messageColorError{order:6}
  #userColorSettings #messageColorSuccess{order:7}
}

/* Full color picker */
.msg.user-colored{
  color:var(--msg-text,#17222b)!important;
}
.msg.user-colored .msg-body{
  color:inherit!important;
}
.msg.user-colored .msg-foot span{
  color:var(--msg-text,#17222b)!important;
  opacity:.62;
}
.message-color-preview{
  color:var(--preview-text,#17222b)!important;
}
.paint-color-picker{
  position:relative;
  display:flex;
  align-items:center;
  gap:12px;
  min-height:62px;
  padding:10px 12px;
  border:1px solid #d7e1e4;
  border-radius:13px;
  background:rgba(127,127,127,.045);
  cursor:pointer;
  overflow:hidden;
}
.paint-color-picker input[type="color"]{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  opacity:0;
  cursor:pointer;
}
.paint-color-chip{
  flex:0 0 42px;
  width:42px;
  height:42px;
  border-radius:10px;
  background:var(--picker-color,#EEF2F4);
  border:1px solid rgba(0,0,0,.16);
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.28);
  pointer-events:none;
}
.paint-color-copy{
  display:grid;
  gap:3px;
  pointer-events:none;
}
.paint-color-copy b{font-size:14px}
.paint-color-copy small{font-size:12px;color:#73848c}
.message-color-picker-wrap{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:10px;
  align-items:center;
  margin:10px 0 12px;
}
.paint-color-code{
  min-width:82px;
  padding:11px 10px;
  border:1px solid #d7e1e4;
  border-radius:10px;
  font:700 12px/1 monospace;
  text-align:center;
  background:rgba(127,127,127,.045);
}
html[data-theme="dark"] .paint-color-picker,
html[data-theme="dark"] .paint-color-code{
  border-color:rgba(255,255,255,.12);
  background:rgba(255,255,255,.045);
}
html[data-theme="dark"] .paint-color-copy small{color:#9fb0b7}
html[data-theme="dark"] .message-color-preview{
  color:#edf4f6!important;
}
@media(max-width:700px){
  #userColorSettings .user-color-current{order:1}
  #userColorSettings .color-settings-note{order:2}
  #userColorSettings .message-color-picker-wrap{order:3}
  #userColorSettings .color-save-action{order:4!important}
  #userColorSettings .color-settings-status{order:5}
  #userColorSettings #messageColorError{order:6}
  #userColorSettings #messageColorSuccess{order:7}
  .message-color-picker-wrap{
    grid-template-columns:1fr;
  }
  .paint-color-code{
    justify-self:start;
  }
}

.profile-avatar,
.message-author-avatar{
  display:grid;
  place-items:center;
  overflow:hidden;
  border-radius:50%;
  background:var(--avatar-color,#455A64);
  color:#fff;
  font-weight:800;
  flex:0 0 auto;
}
.profile-avatar img,
.message-author-avatar img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.profile-avatar.settings-avatar{
  width:84px;
  height:84px;
  font-size:30px;
}
.profile-avatar-settings{
  display:flex;
  align-items:center;
  gap:16px;
}
.profile-avatar-actions{
  display:grid;
  gap:9px;
  min-width:0;
  flex:1;
}
.profile-avatar-actions>div:first-child{
  display:grid;
  gap:4px;
}
.profile-avatar-actions>div:first-child b{
  font-size:15px;
}
.profile-avatar-actions>div:first-child span{
  color:#73848c;
  font-size:12px;
}
.profile-avatar-buttons{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.avatar-pick-btn{
  display:inline-flex;
  align-items:center;
  cursor:pointer;
}
.avatar-delete-btn{
  color:#9b3b3b;
  border-color:#e1caca;
}
.profile-avatar-actions .error,
.profile-avatar-actions .success{
  min-height:18px;
  margin:0;
  font-size:13px;
}
.profile-avatar-actions .success{
  color:#2f8b63;
}
.msg-author-row{
  display:flex;
  align-items:center;
  gap:7px;
  margin-bottom:4px;
}
.msg-author-row .msg-author{
  margin:0;
}
.message-author-avatar{
  width:26px;
  height:26px;
  font-size:11px;
  box-shadow:0 1px 2px rgba(0,0,0,.12);
}
@media(max-width:700px){
  .profile-avatar-settings{
    align-items:flex-start;
  }
  .profile-avatar.settings-avatar{
    width:70px;
    height:70px;
    font-size:26px;
  }
  .profile-avatar-buttons{
    display:grid;
    grid-template-columns:1fr;
  }
  .profile-avatar-buttons .secondary,
  .avatar-pick-btn{
    width:100%;
    justify-content:center;
    text-align:center;
  }
  .message-author-avatar{
    width:24px;
    height:24px;
    font-size:10px;
  }
}

/* Larger author identity in chat messages */
.msg-author-row{
  gap:9px;
  margin-bottom:6px;
}
.message-author-avatar{
  width:34px;
  height:34px;
  min-width:34px;
  flex-basis:34px;
  font-size:14px;
}
.msg-author-row .msg-author{
  font-size:13.5px!important;
  line-height:1.2!important;
  font-weight:800!important;
  margin:0!important;
}
@media(max-width:700px){
  .msg-author-row{
    gap:8px;
    margin-bottom:5px;
  }
  .message-author-avatar{
    width:32px;
    height:32px;
    min-width:32px;
    flex-basis:32px;
    font-size:13px;
  }
  .msg-author-row .msg-author{
    font-size:13px!important;
  }
}

/* Audio calls */
.call-start-btn{
  color:#177b6b;
}
.call-start-btn svg{
  width:23px;
  height:23px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.call-overlay{
  position:fixed;
  inset:0;
  z-index:1000;
  display:grid;
  place-items:center;
  padding:20px;
  background:rgba(7,20,26,.74);
  backdrop-filter:blur(8px);
}
.call-card{
  width:min(92vw,380px);
  min-height:430px;
  border-radius:28px;
  padding:34px 24px 28px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  background:linear-gradient(180deg,#163843 0%,#0d252e 100%);
  color:#fff;
  box-shadow:0 28px 80px rgba(0,0,0,.38);
}
.call-card.compact{
  min-height:300px;
}
.call-avatar{
  width:104px;
  height:104px;
  border-radius:50%;
  display:grid;
  place-items:center;
  margin-bottom:20px;
  background:#2f7f71;
  color:#fff;
  font-size:42px;
  font-weight:900;
  box-shadow:0 0 0 6px rgba(255,255,255,.08);
}
.call-peer{
  max-width:100%;
  text-align:center;
  font-size:25px;
  line-height:1.2;
  font-weight:800;
  overflow-wrap:anywhere;
}
.call-status{
  margin-top:9px;
  color:#b7c9cf;
  font-size:14px;
}
.call-duration{
  min-height:25px;
  margin-top:7px;
  font-size:19px;
  font-variant-numeric:tabular-nums;
  letter-spacing:.04em;
}
.call-actions{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:22px;
  margin-top:42px;
}
.call-round{
  width:66px;
  height:66px;
  border:0;
  border-radius:50%;
  display:grid;
  place-items:center;
  cursor:pointer;
  color:#fff;
  font-size:25px;
  box-shadow:0 8px 22px rgba(0,0,0,.22);
}
.call-round:disabled{
  opacity:.55;
  cursor:default;
}
.call-accept{
  background:#27a56f;
  font-size:30px;
}
.call-reject{
  background:#d84a4a;
}
.call-control{
  background:rgba(255,255,255,.14);
}
.call-control:hover{
  background:rgba(255,255,255,.21);
}
#callRemoteAudio{
  width:1px;
  height:1px;
  position:absolute;
  opacity:.001;
  pointer-events:none;
}
html[data-theme="dark"] .call-card{
  background:linear-gradient(180deg,#163843 0%,#091c23 100%);
}
@media(max-width:700px){
  .call-overlay{
    padding:0;
  }
  .call-card{
    width:100%;
    height:100%;
    min-height:100dvh;
    border-radius:0;
    padding:calc(30px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
  }
  .call-card.compact{
    min-height:100dvh;
  }
  .call-avatar{
    width:116px;
    height:116px;
    font-size:46px;
  }
  .call-peer{
    font-size:27px;
  }
  .call-actions{
    margin-top:48px;
  }
  .call-round{
    width:70px;
    height:70px;
  }
}

/* User profile modal / call entry point */
.room-member-link{
  border:0;
  padding:0;
  margin:0;
  background:transparent;
  color:inherit;
  font:inherit;
  cursor:pointer;
  text-decoration:underline;
  text-decoration-color:rgba(39,139,121,.35);
  text-underline-offset:2px;
}
.room-member-link:hover{
  color:#177b6b;
  text-decoration-color:currentColor;
}
.room-member-sep{
  opacity:.65;
}
.msg-author-trigger{
  border:0;
  padding:0;
  background:transparent;
  width:auto;
  cursor:pointer;
  text-align:left;
  font:inherit;
}
.msg-author-trigger:hover .msg-author{
  text-decoration:underline;
  text-underline-offset:2px;
}
.member-profile-modal{
  width:min(100%,420px);
}
.member-profile-body{
  display:flex;
  align-items:center;
  gap:16px;
  margin-top:18px;
  padding:16px;
  border:1px solid rgba(127,127,127,.18);
  border-radius:16px;
  background:rgba(127,127,127,.04);
}
.profile-avatar.member-profile-avatar{
  width:76px;
  height:76px;
  font-size:28px;
}
.member-profile-info{
  display:grid;
  gap:4px;
  min-width:0;
}
.member-profile-name{
  font-size:19px;
  line-height:1.2;
  font-weight:800;
  overflow-wrap:anywhere;
}
.member-profile-role{
  font-size:12px;
  color:#73848c;
}
.member-profile-phone{
  margin-top:3px;
  font-size:13px;
  color:#52676f;
}
.member-profile-actions{
  margin-top:16px;
}
.member-call-action{
  width:100%;
  min-height:48px;
  font-size:15px;
}
.member-call-note{
  margin-top:16px;
  padding:11px 12px;
  border-radius:10px;
  background:rgba(127,127,127,.07);
  color:#73848c;
  font-size:12px;
  line-height:1.4;
}
html[data-theme="dark"] .member-profile-body{
  background:rgba(255,255,255,.04);
  border-color:rgba(255,255,255,.10);
}
html[data-theme="dark"] .member-profile-role,
html[data-theme="dark"] .member-call-note{
  color:#9fb0b7;
}
html[data-theme="dark"] .member-profile-phone{
  color:#c1cdd1;
}
@media(max-width:700px){
  .member-profile-modal{
    width:100%;
  }
  .profile-avatar.member-profile-avatar{
    width:82px;
    height:82px;
    font-size:30px;
  }
  .member-profile-name{
    font-size:20px;
  }
}

/* Video circle messages */
.video-circle-backdrop{z-index:1200}
.video-circle-recording-hud{position:fixed;left:50%;bottom:92px;transform:translateX(-50%);z-index:1190;display:flex;align-items:center;gap:12px;padding:10px 16px 10px 10px;border-radius:999px;background:rgba(19,28,33,.92);color:#fff;box-shadow:0 10px 32px rgba(0,0,0,.28);backdrop-filter:blur(10px);pointer-events:none;min-width:190px}
.video-circle-recording-hud-ring{--record-progress:0deg;width:54px;height:54px;flex:0 0 54px;border-radius:50%;padding:4px;background:conic-gradient(#ef5350 var(--record-progress),rgba(255,255,255,.2) 0)}
.video-circle-recording-hud.preparing .video-circle-recording-hud-ring{background:conic-gradient(#ef5350 0 90deg,rgba(255,255,255,.2) 90deg 360deg);animation:videoCirclePrepareSpin .9s linear infinite}
.video-circle-recording-hud-inner{width:100%;height:100%;border-radius:50%;display:grid;place-items:center;background:#202c32;font-size:20px}
.video-circle-recording-hud-copy{display:grid;gap:2px;line-height:1.15}
.video-circle-recording-hud-copy b{font-size:14px;font-weight:800}
.video-circle-recording-hud.recording .video-circle-recording-hud-copy b{color:#ff817e}
.video-circle-recording-hud-copy span{font-size:12px;color:#cad5d8;font-variant-numeric:tabular-nums}
@keyframes videoCirclePrepareSpin{to{transform:rotate(360deg)}}
@media(max-width:700px){.video-circle-recording-hud{bottom:82px}}
#videoCircleBtn{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;--record-progress:0deg}
#videoCircleBtn.video-circle-holding{border-color:transparent;background:conic-gradient(#ef5350 var(--record-progress),#dce5e8 0);color:#fff;box-shadow:0 0 0 2px rgba(239,83,80,.18)}
#videoCircleBtn.video-circle-holding::after{content:"🎥";position:absolute;inset:4px;border-radius:8px;background:#fff;display:grid;place-items:center;font-size:18px}
html[data-theme="dark"] #videoCircleBtn.video-circle-holding::after{background:#182830}
.video-circle-modal{width:min(94vw,460px)}
.video-circle-stage{display:grid;place-items:center;gap:10px;padding:8px 0 4px}
.video-circle-progress-ring{--record-progress:0deg;width:min(72vw,310px);aspect-ratio:1;border-radius:50%;padding:5px;background:conic-gradient(#d9e5e7 0 360deg);box-shadow:0 14px 34px rgba(15,35,45,.18);transition:background .12s linear}
.video-circle-progress-ring.recording{background:conic-gradient(#ef5350 var(--record-progress),#d9e5e7 0)}
.video-circle-preview-ring{width:100%;height:100%;border-radius:50%;overflow:hidden;background:#0d171c;box-shadow:inset 0 0 0 1px rgba(255,255,255,.18)}
.video-circle-preview-ring video{width:100%;height:100%;display:block;object-fit:cover;background:#10191d}
.video-circle-time{font-size:13px;font-weight:800;color:#60757d;letter-spacing:.04em}
.video-circle-hold-hint{min-height:20px;font-size:12px;font-weight:700;color:#73878e;text-align:center}
.video-circle-review-actions{display:flex;justify-content:center;gap:10px;margin-top:10px}
.video-circle-review-actions .primary-action,.video-circle-review-actions .secondary{min-width:145px;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
.video-circle-review-actions #videoCircleRetake{border-color:#d6e1e4}
.video-circle-review-actions #videoCircleRetake:active{transform:scale(.97)}
.video-circle-review-actions #videoCircleRetake.video-circle-holding{background:conic-gradient(#ef5350 var(--record-progress),#dce5e8 0);border-color:#ef5350;color:#8b2525}

.video-circle-message{position:relative;width:220px;height:220px;border-radius:50%;overflow:hidden;border:0;padding:0;background:#111;display:block;cursor:pointer;box-shadow:0 3px 12px rgba(20,40,48,.16)}
.video-circle-message video{width:100%;height:100%;object-fit:cover;display:block;background:#111;pointer-events:none}
.video-circle-sound{position:absolute;right:10px;bottom:10px;width:34px;height:34px;border-radius:50%;display:grid;place-items:center;background:rgba(0,0,0,.48);color:#fff;font-size:16px;backdrop-filter:blur(4px);transition:.18s ease;pointer-events:none}
.video-circle-message.sound-on .video-circle-sound{background:rgba(18,92,77,.78);transform:scale(1.06)}

.media-video-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:14px;padding:4px}
.media-video-item{display:grid;gap:7px;justify-items:center}
.media-video-item video{width:180px;height:180px;border-radius:50%;object-fit:cover;background:#111}
.media-video-item small{font-size:11px;color:#778a92;text-align:center}

html[data-theme="dark"] .video-circle-progress-ring{background:conic-gradient(#31464f 0 360deg);box-shadow:0 14px 34px rgba(0,0,0,.28)}
html[data-theme="dark"] .video-circle-progress-ring.recording{background:conic-gradient(#ef5350 var(--record-progress),#31464f 0)}
html[data-theme="dark"] .video-circle-hold-hint{color:#9eb0b7}
html[data-theme="dark"] .video-circle-time{color:#a9bbc2}

@media(max-width:700px){
  .video-circle-modal{width:100%}
  .video-circle-progress-ring{width:min(78vw,320px)}
  .video-circle-message{width:188px;height:188px}
  .media-video-grid{grid-template-columns:repeat(2,1fr);gap:10px}
  .media-video-item video{width:min(38vw,160px);height:min(38vw,160px)}
}

/* Mobile composer containment: attachments/messages must never push Send off-screen */
@media(max-width:700px){
  .chat-room,
  .message-list,
  .message-form{
    min-width:0!important;
    max-width:100%!important;
    width:100%!important;
  }

  .message-list{
    overflow-x:hidden!important;
  }

  .message-list .msg,
  .message-list .attachments,
  .message-list .image-attachment,
  .message-list .image-attachment img{
    min-width:0!important;
    max-width:100%!important;
  }

  .message-form{
    display:grid!important;
    grid-template-columns:auto minmax(0,1fr) 38px!important;
    align-items:end!important;
    column-gap:5px!important;
    overflow:hidden!important;
    position:relative!important;
    z-index:25!important;
  }

  .message-form .composer-tools{
    min-width:0!important;
    max-width:122px!important;
  }

  .message-form textarea{
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    flex:none!important;
  }

  .message-form .send-action{
    grid-column:3!important;
    justify-self:end!important;
    visibility:visible!important;
    opacity:1!important;
  }
}

/* 2026-10-15: hard mobile width containment for any chat content */
@media(max-width:700px){
  #content,
  .chat-room,
  .room-head,
  .room-description,
  .message-list,
  .reply-bar,
  .message-form{
    box-sizing:border-box!important;
    min-width:0!important;
    max-width:100%!important;
    width:100%!important;
  }

  .message-list>*,
  .message-list .msg,
  .message-list .msg-body,
  .message-list .quoted,
  .message-list .attachments,
  .message-list .image-attachment,
  .message-list .file-attachment,
  .message-list .voice-attachment,
  .message-list .video-circle-message,
  .message-list audio,
  .message-list video,
  .message-list img{
    box-sizing:border-box!important;
    min-width:0!important;
    max-width:100%!important;
  }

  .message-list .file-attachment,
  .message-list .voice-attachment{
    width:100%!important;
  }

  .message-list .msg-body{
    overflow-wrap:anywhere!important;
    word-break:break-word!important;
  }

  .message-form{
    grid-template-columns:minmax(0,auto) minmax(0,1fr) 38px!important;
    overflow:visible!important;
  }

  .message-form .send-action{
    display:grid!important;
    grid-column:3!important;
    position:relative!important;
    right:auto!important;
    flex:0 0 38px!important;
    width:38px!important;
    min-width:38px!important;
    max-width:38px!important;
    visibility:visible!important;
    opacity:1!important;
    z-index:30!important;
  }
}


/* Desktop photo viewer: fit within the screen, wheel zoom and drag. Mobile unchanged. */
@media (min-width:701px){
  .media-viewer-backdrop{padding:12px}
  .media-viewer{width:100%;height:100%;max-width:100%;max-height:100%}
  .media-viewer-head{flex:0 0 auto;gap:12px;min-height:48px}
  .media-viewer-head b{min-width:0;flex:1}
  .media-viewer-body{display:flex;align-items:center;justify-content:center;min-width:0;min-height:0;overflow:hidden}
  .media-viewer-body img{display:block;width:auto;height:auto;max-width:100%;max-height:100%;object-fit:contain}
  .media-viewer-controls{display:flex;align-items:center;gap:6px;flex:0 0 auto;color:#fff}
  .media-viewer-controls button{border:1px solid rgba(255,255,255,.22);background:rgba(255,255,255,.12);color:#fff;min-width:34px;height:34px;padding:0 10px;border-radius:8px;cursor:pointer;font-size:16px}
  .media-viewer-controls button:hover{background:rgba(255,255,255,.24)}
  .media-zoom-label{font-size:13px;min-width:43px;text-align:center;font-variant-numeric:tabular-nums}
}


/* Personal notification quiet mode: desktop and mobile */
.quiet-mode-status{display:grid;gap:6px;padding:12px 14px;background:rgba(42,143,131,.07);border:1px solid rgba(42,143,131,.18);border-radius:12px;font-size:13px}
.quiet-mode-status.active{background:rgba(90,110,160,.09);border-color:rgba(90,110,160,.26)}
.quiet-mode-status strong{font-size:14px}
.quiet-mode-status span{line-height:1.5}
.quiet-section{display:grid;gap:12px;margin-top:18px}
.quiet-section-title{font-weight:750;font-size:14px}
.quiet-duration-options{display:flex;gap:7px;flex-wrap:wrap}
.quiet-duration-options button{padding:10px 12px;background:rgba(42,143,131,.10);border:1px solid rgba(42,143,131,.23);border-radius:9px;color:inherit;cursor:pointer;font-weight:650}
.quiet-duration-options button:hover{background:rgba(42,143,131,.20)}
.quiet-section>button{justify-self:start}
.quiet-section button:disabled{opacity:.5;cursor:wait}
.quiet-schedule-toggle{display:flex;align-items:center;gap:10px;font-weight:750;font-size:14px}
.quiet-schedule-toggle input{width:18px;height:18px;accent-color:#177b6b}
.quiet-time-grid{display:grid;grid-template-columns:repeat(2,minmax(0,175px));gap:14px}
.quiet-time-grid label{display:grid;gap:6px;font-size:13px;font-weight:650}
.quiet-time-grid input{box-sizing:border-box;width:100%;font-size:16px;color:inherit;border:1px solid rgba(127,127,127,.34);background:var(--panel,#fff);border-radius:9px;padding:8px 9px}
.quiet-hint{font-size:12px;line-height:1.55;opacity:.75;margin:0}
.quiet-push-divider{height:1px;background:rgba(127,127,127,.18);margin:22px 0}
.notification-panel-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
@media(max-width:700px){.quiet-duration-options button{min-width:calc(33.333% - 5px)}.quiet-time-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:700px){.notification-panel-head{flex-wrap:wrap}.notification-panel-actions{width:100%;justify-content:space-between}}

/* Personal chat pins: pinned conversations stay at the top with a visible outline. */
.chat-list-entry{
  position:relative;
  display:flex;
  align-items:stretch;
  min-width:0;
  background:#fff;
  border-bottom:1px solid #eaf0f2;
}
.chat-list-entry>.chat-card{
  flex:1 1 auto;
  min-width:0;
  border-bottom:0;
  padding-right:66px;
}
.chat-list-entry.pinned{
  margin:6px 9px;
  border:2px solid #359985;
  border-radius:12px;
  overflow:hidden;
  background:#f3faf8;
  box-shadow:0 1px 4px rgba(30,100,88,.08);
}
.chat-list-entry.pinned>.chat-card{background:#f3faf8}
.chat-list-entry.pinned>.chat-card:hover{background:#eaf6f2}
.chat-pin-button{
  position:absolute;
  right:11px;
  top:50%;
  transform:translateY(-50%);
  z-index:2;
  width:44px;
  height:44px;
  padding:0;
  display:grid;
  place-items:center;
  background:transparent;
  border:0;
  border-radius:9px;
  font-size:19px;
  cursor:pointer;
  opacity:.42;
}
.chat-pin-button:hover,.chat-pin-button:focus-visible{opacity:1;background:rgba(53,153,133,.12)}
.chat-pin-button.pinned{opacity:1;background:rgba(53,153,133,.18)}
.chat-pin-button:disabled{cursor:wait;opacity:.45}
.chat-pin-button:focus-visible{outline:2px solid #177b6b;outline-offset:-2px}
.room-pin-button.pinned{background:rgba(53,153,133,.12);border-color:#359985}
html[data-theme="dark"] .chat-list-entry{background:#152229;border-color:var(--border)}
html[data-theme="dark"] .chat-list-entry.pinned{
  background:#19332f;
  border-color:#56ac98;
  box-shadow:0 2px 10px rgba(0,0,0,.16);
}
html[data-theme="dark"] .chat-list-entry.pinned>.chat-card{background:#19332f}
html[data-theme="dark"] .chat-list-entry.pinned>.chat-card:hover{background:#20413b}
html[data-theme="dark"] .chat-pin-button.pinned{background:rgba(86,172,152,.25)}
@media(max-width:700px){
  .chat-list-entry>.chat-card{padding-right:58px}
  .chat-list-entry.pinned{margin:5px 6px;border-radius:10px}
  .chat-pin-button{right:5px;width:44px;height:44px}
  .room-pin-button{padding:8px 10px;font-size:12px}
}
