.chat-top-actions{display:flex;align-items:center;gap:12px}.chat-block{border:1px solid var(--border);border-radius:8px;background:var(--surface);color:#b42318;padding:7px 10px;font-size:10px;cursor:pointer}
@media(max-width:850px){.chat-wrap{grid-template-columns:220px minmax(0,1fr);max-height:none;min-height:70vh}.chat-rail{padding:10px}.chat-topline{padding:13px}.chat-messages{padding:13px}}
@media(max-width:600px){.chat-wrap{display:flex;flex-direction:column;min-height:78vh;margin-left:-2px;margin-right:-2px}.chat-rail{max-height:230px;border-right:0;border-bottom:1px solid var(--border)}.chat-identity{padding-bottom:9px;margin-bottom:6px}.chat-channel{width:auto;display:inline-flex;vertical-align:top;padding:8px 10px}.chat-rail{display:block}.chat-contacts,.chat-inbox{display:flex;overflow-x:auto}.chat-person,.chat-thread-item{flex:none;max-width:150px}.chat-list-heading{margin:9px 3px 5px}.chat-main{min-height:510px}.chat-messages{min-height:300px}.chat-message{max-width:91%}.chat-encryption-label{display:none}.chat-report{grid-template-columns:1fr}.chat-composer{gap:7px;padding:10px}.chat-attach,.chat-send{width:40px;height:40px}}

/* Community welcome, conversation shell and visitor feedback */
.chat-hero{position:relative;isolation:isolate;display:grid;grid-template-columns:minmax(0,1.2fr) minmax(230px,.8fr);align-items:center;gap:20px;min-height:245px;margin:8px 0 24px;padding:36px 42px;overflow:hidden;border:1px solid #244b80;border-radius:25px;color:#f5f9ff;background:radial-gradient(circle at 83% 10%,rgba(65,139,240,.34),transparent 30%),radial-gradient(circle at 6% 100%,rgba(19,194,184,.18),transparent 36%),linear-gradient(120deg,#071a36 0%,#102d56 54%,#193f70 100%);box-shadow:0 22px 55px rgba(8,31,64,.18)}
.chat-hero:after{position:absolute;z-index:-1;inset:0;content:"";opacity:.17;background-image:radial-gradient(rgba(199,222,255,.7) .7px,transparent .7px);background-size:19px 19px;mask-image:linear-gradient(90deg,transparent 15%,#000 100%)}
.chat-hero-copy{position:relative;z-index:2;max-width:630px}.chat-hero-kicker{display:inline-flex;align-items:center;gap:8px;color:#91dff0;font-size:10px;font-weight:850;letter-spacing:1.7px}.chat-hero-kicker i{color:#f6ce7c}.chat-hero h1{margin:11px 0 9px;color:#fff;font-size:clamp(31px,4vw,45px);letter-spacing:-1.7px;line-height:1.1}.chat-wave{display:inline-block;transform-origin:75% 75%;font-size:.78em;animation:chatWave 2.8s ease-in-out infinite}.chat-hero-copy>p{max-width:590px;color:#d0def1;font-size:13px;line-height:1.8}.chat-hero-pills{display:flex;flex-wrap:wrap;gap:8px;margin-top:20px}.chat-hero-pills span,.chat-hero-pills a{display:inline-flex;align-items:center;gap:7px;padding:7px 10px;border:1px solid rgba(199,222,255,.2);border-radius:99px;background:rgba(230,241,255,.08);color:#e5effd;font-size:10px;font-weight:650;backdrop-filter:blur(8px)}.chat-hero-pills a:hover{background:rgba(230,241,255,.16);transform:translateY(-1px)}.chat-hero-pills i{color:#74dcc7}
.admin-chat-back{display:inline-flex;align-items:center;gap:7px;margin-top:15px;color:#b8d8ff;font-size:11px;font-weight:750}.admin-chat-back:hover{color:#fff}.chat-admin .topbar-login,.chat-admin .topbar-register{display:none}
.chat-hero-art{position:relative;justify-self:center;width:260px;height:185px;display:grid;place-items:center}.chat-orbit{position:absolute;inset:14px 25px;border:1px solid rgba(168,205,255,.28);border-radius:50%;transform:rotate(-18deg)}.chat-orbit-two{inset:32px 5px;transform:rotate(24deg);border-color:rgba(110,222,213,.3)}.chat-person-node{position:absolute;z-index:2;display:grid;width:40px;height:40px;place-items:center;border:1px solid rgba(255,255,255,.45);border-radius:50%;background:linear-gradient(145deg,#78abff,#416fe4);color:#fff;box-shadow:0 8px 22px rgba(0,0,0,.22)}.chat-node-one{top:7px;left:45px}.chat-node-two{right:22px;top:69px;background:linear-gradient(145deg,#61d3ca,#178f9d)}.chat-node-three{bottom:3px;left:52px;background:linear-gradient(145deg,#be9cff,#7654cd)}.chat-connection{position:relative;z-index:3;display:grid;width:74px;height:74px;place-items:center;border:1px solid rgba(255,255,255,.25);border-radius:23px;background:linear-gradient(145deg,rgba(252,255,255,.22),rgba(177,214,255,.12));color:#e8f7ff;font-size:28px;box-shadow:0 14px 35px rgba(0,0,0,.22);backdrop-filter:blur(10px)}.chat-sparkle{position:absolute;color:#ffe19d;font-size:22px}.chat-sparkle-one{top:10px;right:45px}.chat-sparkle-two{bottom:24px;right:8px;color:#9ff2e0;font-size:28px}
.chat-wrap{min-height:640px;max-height:calc(100vh - 310px);border-color:rgba(114,145,183,.24);border-radius:22px;box-shadow:0 18px 55px rgba(23,49,83,.1)}.chat-rail{padding:18px;background:linear-gradient(180deg,var(--surface-soft),var(--surface))}.chat-identity{padding:8px 5px 18px;margin-bottom:15px}.chat-avatar{width:42px;height:42px;border:1px solid rgba(55,121,213,.17);background:linear-gradient(145deg,#e5f1ff,#dce8ff);color:#2866b8}.chat-channel{min-height:58px;gap:13px;margin:4px 0;padding:12px 13px;border:1px solid transparent;transition:transform .18s,border-color .18s,background .18s}.chat-channel:hover{transform:translateX(2px);border-color:var(--border)}.chat-channel.active{border-color:rgba(51,111,198,.14);background:linear-gradient(110deg,rgba(37,99,235,.1),rgba(37,99,235,.03));box-shadow:inset 3px 0 var(--primary)}.chat-channel>i{font-size:16px}.chat-channel strong{font-size:12px}.chat-channel small{margin-top:2px}.chat-list-heading{margin:21px 4px 8px;font-size:9px}.chat-person,.chat-thread-item{min-height:39px}.chat-person:hover,.chat-thread-item:hover,.chat-thread-item.active{box-shadow:0 2px 9px rgba(24,49,83,.06)}.chat-main{background:var(--surface)}.chat-topline{min-height:77px;padding:18px 23px;background:linear-gradient(110deg,var(--surface),var(--surface-soft));}.chat-topline h2{font-size:16px;letter-spacing:-.2px}.chat-topline p{font-size:11px}.chat-encryption-label{padding:7px 9px;border:1px solid var(--border);border-radius:99px;background:var(--surface);font-size:9px}.chat-messages{padding:23px;background:radial-gradient(circle at 50% 0%,rgba(37,99,235,.035),transparent 38%)}.chat-empty{padding:27px}.chat-empty>i{width:58px;height:58px;display:grid;place-items:center;border-radius:19px;background:linear-gradient(145deg,#e9f2ff,#f0ecff);font-size:22px}.chat-empty strong{font-size:16px}.chat-empty span{line-height:1.7}.chat-message{padding:12px 14px;border-color:rgba(86,118,157,.17);box-shadow:0 5px 14px rgba(21,49,85,.04)}.chat-message.mine{background:linear-gradient(140deg,rgba(37,99,235,.09),rgba(8,145,178,.055));border-color:rgba(37,99,235,.17)}.chat-message-meta{font-size:10px}.chat-message-text{font-size:13px;line-height:1.7}.chat-attachment{transition:border-color .18s,transform .18s}.chat-attachment:hover{transform:translateY(-1px);border-color:var(--primary)}.chat-composer{padding:16px 18px;background:linear-gradient(0deg,var(--surface),var(--surface-soft))}.chat-attach,.chat-send{width:45px;height:45px;border-radius:14px;transition:transform .18s,filter .18s}.chat-attach:hover,.chat-send:hover{transform:translateY(-2px);filter:brightness(1.04)}.chat-attach{color:var(--primary)}.chat-send{background:linear-gradient(145deg,#347feb,#225ec2);box-shadow:0 8px 18px rgba(37,99,235,.23)}.chat-compose-fields textarea{min-height:45px;border-radius:13px;box-shadow:0 2px 7px rgba(21,49,85,.035)}.chat-compose-fields small{font-size:9px}
.visitor-feedback-card{display:grid;grid-template-columns:minmax(240px,.74fr) minmax(0,1.26fr);gap:30px;margin:0 0 36px;padding:28px;border:1px solid var(--border);border-radius:22px;background:linear-gradient(130deg,var(--surface),var(--surface-soft));box-shadow:var(--shadow)}.feedback-intro{position:relative;display:flex;align-items:flex-start;gap:14px}.feedback-icon{flex:none;display:grid;width:49px;height:49px;place-items:center;border-radius:15px;background:linear-gradient(145deg,#e8f3ff,#e4fbf8);color:#1988a3;font-size:19px}.feedback-intro h2{margin:6px 0 7px;color:var(--text);font-size:21px;letter-spacing:-.5px}.feedback-intro p{max-width:310px;color:var(--muted);font-size:12px;line-height:1.7}.feedback-people{position:absolute;left:64px;bottom:0;display:flex;align-items:center;gap:9px;color:var(--primary);opacity:.18;font-size:24px}.feedback-people i:nth-child(2){font-size:15px;color:var(--cyan)}.visitor-feedback-form{display:grid;grid-template-columns:1fr 1fr;gap:12px}.visitor-feedback-form label{display:grid;gap:6px;color:var(--text);font-size:11px;font-weight:750}.visitor-feedback-form input,.visitor-feedback-form select,.visitor-feedback-form textarea{width:100%;min-height:43px;padding:10px 12px;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--text);font:inherit;font-size:12px;outline:none;transition:border-color .2s,box-shadow .2s}.visitor-feedback-form input:focus,.visitor-feedback-form select:focus,.visitor-feedback-form textarea:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(37,99,235,.1)}.visitor-feedback-form textarea{min-height:105px;resize:vertical;line-height:1.6}.feedback-message-field,.feedback-submit-row,.feedback-status{grid-column:1/-1}.feedback-submit-row{display:flex;align-items:center;justify-content:space-between;gap:12px}.feedback-submit-row>span{color:var(--muted);font-size:10px}.feedback-submit-row>span i{color:#1a9c78;margin-right:4px}.feedback-submit{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:10px 16px;border:0;border-radius:11px;background:linear-gradient(120deg,#2879df,#1763b6);color:#fff;font:inherit;font-size:12px;font-weight:800;cursor:pointer;box-shadow:0 8px 18px rgba(37,99,235,.19);transition:transform .18s,filter .18s}.feedback-submit:hover{transform:translateY(-2px);filter:brightness(1.05)}.feedback-submit:disabled{opacity:.65;cursor:wait;transform:none}.feedback-status{min-height:0;margin:0;color:var(--muted);font-size:11px}.feedback-status.success{color:#087443}.feedback-status.error{color:#b42318}.feedback-inbox{padding:24px}.feedback-entry{display:grid;grid-template-columns:1fr auto;gap:15px;align-items:start;padding:15px;border:1px solid var(--border);border-radius:13px;background:var(--surface)}.feedback-entry+.feedback-entry{margin-top:9px}.feedback-entry-meta{display:flex;flex-wrap:wrap;gap:8px;align-items:center;color:var(--muted);font-size:10px}.feedback-category{padding:4px 8px;border-radius:99px;background:rgba(37,99,235,.09);color:var(--primary);font-weight:800;text-transform:capitalize}.feedback-entry h3{margin:8px 0 4px;color:var(--text);font-size:13px}.feedback-entry p{white-space:pre-wrap;color:var(--muted);font-size:12px;line-height:1.7}.feedback-entry-actions{display:flex;gap:7px}.feedback-entry-actions button{padding:7px 10px;border:1px solid var(--border);border-radius:8px;background:var(--surface-soft);color:var(--text);font-size:10px;font-weight:700;cursor:pointer}.feedback-entry-actions button:hover{border-color:var(--primary);color:var(--primary)}
html[data-theme=dark] .chat-hero{border-color:#223f66;background:radial-gradient(circle at 83% 10%,rgba(65,139,240,.28),transparent 30%),radial-gradient(circle at 6% 100%,rgba(19,194,184,.12),transparent 36%),linear-gradient(120deg,#070e1a 0%,#101f34 54%,#172c46 100%)}html[data-theme=dark] .chat-avatar{background:linear-gradient(145deg,#213957,#20344f);color:#9dc4ff}html[data-theme=dark] .chat-empty>i{background:linear-gradient(145deg,#1b3155,#30264d);color:#9ec2ff}html[data-theme=dark] .feedback-icon{background:linear-gradient(145deg,#203653,#153b43);color:#77d9df}html[data-theme=dark] .chat-hero-pills span,html[data-theme=dark] .chat-hero-pills a{background:rgba(10,21,36,.48)}
@keyframes chatWave{0%,60%,100%{transform:rotate(0)}10%,30%{transform:rotate(18deg)}20%,40%{transform:rotate(-8deg)}}
@media(max-width:900px){.chat-hero{grid-template-columns:1fr .55fr;padding:30px}.chat-hero-art{transform:scale(.85)}.visitor-feedback-card{grid-template-columns:1fr;gap:20px}.feedback-people{left:auto;right:8px;bottom:0}}
@media(max-width:600px){.chat-hero{grid-template-columns:1fr;min-height:0;gap:4px;margin:5px 0 17px;padding:25px 21px 14px;border-radius:20px}.chat-hero h1{font-size:34px}.chat-hero-copy>p{font-size:13px}.chat-hero-pills{gap:6px;margin-top:15px}.chat-hero-pills span,.chat-hero-pills a{padding:6px 8px;font-size:9px}.chat-hero-art{width:220px;height:130px;transform:scale(.78);transform-origin:top center;margin:10px auto -14px}.chat-wrap{margin-bottom:22px}.chat-rail{padding:12px}.chat-channel{min-height:43px}.chat-topline{min-height:65px;padding:11px}.chat-topline h2{font-size:14px}.chat-topline p{font-size:10px}.chat-messages{padding:12px}.chat-message{padding:10px 11px}.chat-composer{padding:10px}.visitor-feedback-card{gap:17px;padding:20px 16px;border-radius:18px}.feedback-intro h2{font-size:19px}.feedback-intro p{font-size:11px}.feedback-people{display:none}.visitor-feedback-form{grid-template-columns:1fr}.feedback-message-field,.feedback-submit-row,.feedback-status{grid-column:auto}.feedback-submit-row{align-items:stretch;flex-direction:column}.feedback-submit{width:100%}.feedback-entry{grid-template-columns:1fr}.feedback-entry-actions{justify-content:flex-start}}
@media(prefers-reduced-motion:reduce){.chat-wave{animation:none}.chat-channel,.chat-attach,.chat-send,.feedback-submit{transition:none}}

/* Keep the conversation, people list and composer in separate flow on phones. */
.chat-wrap{height:640px;max-height:none;min-height:600px}
.chat-channels{display:grid;grid-template-columns:1fr;gap:5px}
.chat-channel{width:100%;min-width:0}
.chat-channel>span{min-width:0;flex:1;line-height:1.35}
.chat-channel strong,.chat-channel small{white-space:normal;overflow-wrap:anywhere}
.chat-main{min-width:0;min-height:0}
.chat-topline>div:first-child{min-width:0;flex:1}
.chat-topline h2{overflow-wrap:anywhere}
.chat-message-meta{align-items:flex-start;flex-wrap:wrap}
.chat-message-meta strong{min-width:0;overflow-wrap:anywhere}
.chat-message-meta span{flex:none}
.chat-message-text{overflow-wrap:anywhere;word-break:break-word}
.chat-composer{flex:none;min-width:0}
.chat-compose-fields{min-width:0}
.chat-compose-fields textarea{overflow-wrap:anywhere}
@media(max-width:850px){.chat-wrap{height:auto;min-height:0;max-height:none}.chat-rail{min-width:0}.chat-main{min-height:0}}
@media(max-width:600px){
  .chat-wrap{display:flex;flex-direction:column;height:auto;min-height:0;max-height:none;overflow:visible}
  .chat-rail{display:block;max-height:none;min-width:0;padding:13px;border-right:0;border-bottom:1px solid var(--border)}
  .chat-identity{max-width:100%;min-width:0;gap:9px;padding:5px 2px 12px;margin:0 0 10px}
  .chat-identity>div{flex:1;min-width:0}
  .chat-channels{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .chat-channel{display:flex;width:100%;min-height:70px;align-items:flex-start;gap:8px;margin:0;padding:10px;border:1px solid var(--border);border-radius:12px;text-align:left;white-space:normal}
  .chat-channel>i{flex:none;width:18px;padding-top:2px}
  .chat-channel strong{font-size:11px;line-height:1.35}
  .chat-channel small{margin-top:4px;font-size:9px;line-height:1.35}
  .chat-list-heading{margin:13px 3px 6px}
  .chat-contacts,.chat-inbox{display:flex;min-width:0;gap:7px;overflow-x:auto;overflow-y:hidden;padding:1px 0 7px;scroll-snap-type:x proximity}
  .chat-person,.chat-thread-item{flex:0 0 145px;width:145px;max-width:145px;min-width:0;min-height:42px;border:1px solid var(--border);background:var(--surface);scroll-snap-align:start}
  .chat-person span{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .chat-thread-item{display:block;white-space:normal;overflow:hidden}
  .chat-thread-item>span,.chat-thread-item small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .chat-main{display:flex;flex:none;flex-direction:column;width:100%;height:auto;min-height:0;overflow:visible}
  .chat-topline{display:flex;flex-wrap:wrap;align-items:flex-start;min-height:0;gap:8px;padding:12px}
  .chat-topline h2{font-size:14px}
  .chat-topline p{margin-left:18px;line-height:1.45;overflow-wrap:anywhere}
  .chat-top-actions{max-width:100%;flex-wrap:wrap}
  .chat-messages{display:flex;flex:0 1 auto;width:100%;height:min(430px,52dvh);min-height:280px;max-height:52dvh;padding:12px;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain}
  .chat-message{width:fit-content;max-width:92%;min-width:0}
  .chat-message-meta{gap:6px 10px}
  .chat-message-text{font-size:13px;line-height:1.6}
  .chat-composer{position:relative;display:flex;flex:none;align-items:flex-end;width:100%;min-width:0;gap:7px;padding:10px;border-top:1px solid var(--border)}
  .chat-compose-fields{flex:1 1 0;width:0;min-width:0}
  .chat-compose-fields textarea{width:100%;min-width:0;min-height:44px;max-height:120px;resize:vertical;overflow-wrap:anywhere}
  .chat-compose-fields small{font-size:9px;line-height:1.4;overflow-wrap:anywhere}
  .chat-attach,.chat-send{flex:0 0 40px;width:40px;height:40px}
  .chat-alert{overflow-wrap:anywhere}
}
/* Final phone spacing: controls and conversation are never positioned over each other. */
@media(max-width:600px){.chat-wrap{display:flex;flex-direction:column;height:auto;max-height:none;min-height:0;overflow:visible}.chat-rail{display:flex;flex-direction:column;max-height:none;overflow:visible}.chat-channels{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.chat-channel{display:flex;min-width:0;width:100%;min-height:70px;align-items:flex-start;white-space:normal}.chat-channel>span{min-width:0;white-space:normal;overflow-wrap:anywhere}.chat-channel strong,.chat-channel small{display:block;white-space:normal;overflow-wrap:anywhere;line-height:1.4}.chat-contacts,.chat-inbox{display:flex;min-width:0;gap:7px;overflow-x:auto;overflow-y:hidden}.chat-person,.chat-thread-item{flex:0 0 145px;width:145px;max-width:145px;min-width:0}.chat-main{display:flex;flex:none;flex-direction:column;width:100%;height:auto;min-height:0;overflow:visible}.chat-topline{display:flex;flex-wrap:wrap;min-height:0;gap:8px}.chat-topline>div:first-child{min-width:0}.chat-topline h2,.chat-topline p{white-space:normal;overflow-wrap:anywhere;line-height:1.45}.chat-messages{display:flex;flex:0 1 auto;width:100%;height:min(430px,52dvh);min-height:260px;max-height:52dvh;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain}.chat-message{width:fit-content;max-width:92%;min-width:0}.chat-message-meta{display:flex;flex-wrap:wrap;gap:5px 9px}.chat-message-meta strong,.chat-message-text{min-width:0;overflow-wrap:anywhere;word-break:break-word}.chat-message-text{line-height:1.6}.chat-composer{position:relative;display:flex;flex:none;align-items:flex-end;width:100%;min-width:0;gap:7px}.chat-compose-fields{flex:1 1 0;width:0;min-width:0}.chat-compose-fields textarea{width:100%;min-width:0;max-height:120px;overflow-wrap:anywhere}.chat-attach,.chat-send{flex:0 0 40px;width:40px;height:40px}}

/* Desktop chat shell: fixed conversation column with an independent scrolling history. */
@media (min-width: 851px) {
  .chat-wrap {
    display: grid;
    grid-template-columns: minmax(260px, 310px) minmax(0, 1fr);
    align-items: stretch;
    width: 100%;
    height: min(700px, calc(100vh - 285px));
    min-height: 620px;
    max-height: none;
    overflow: hidden;
  }
  .chat-rail {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    border-right: 1px solid var(--border);
  }
  .chat-channels { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; }
  .chat-channel { display: flex; width: 100%; min-width: 0; align-items: flex-start; }
  .chat-channel > span { flex: 1 1 auto; min-width: 0; }
  .chat-channel strong, .chat-channel small { display: block; white-space: normal; overflow-wrap: anywhere; line-height: 1.45; }
  .chat-contacts, .chat-inbox { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; min-width: 0; }
  .chat-person, .chat-thread-item { display: flex; width: 100%; min-width: 0; max-width: none; align-items: flex-start; }
  .chat-person span, .chat-thread-item > span, .chat-thread-item small { min-width: 0; overflow-wrap: anywhere; white-space: normal; line-height: 1.4; }
  .chat-main { display: flex; flex-direction: column; width: 100%; height: 100%; min-width: 0; min-height: 0; overflow: hidden; }
  .chat-topline { flex: 0 0 auto; min-width: 0; }
  .chat-topline > div:first-child { min-width: 0; }
  .chat-topline h2, .chat-topline p { overflow-wrap: anywhere; line-height: 1.45; }
  .chat-messages { display: flex; flex: 1 1 auto; flex-direction: column; width: 100%; min-width: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
  .chat-message { max-width: min(82%, 760px); min-width: 0; overflow-wrap: anywhere; }
  .chat-message-meta { display: flex; flex-wrap: wrap; gap: 5px 10px; }
  .chat-message-meta strong, .chat-message-text { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
  .chat-composer { position: static; display: flex; flex: 0 0 auto; align-items: flex-end; width: 100%; min-width: 0; gap: 10px; }
  .chat-compose-fields { flex: 1 1 auto; min-width: 0; }
  .chat-compose-fields textarea { display: block; width: 100%; min-width: 0; max-height: 150px; overflow-wrap: anywhere; }
  .chat-alert { flex: 0 0 auto; min-width: 0; overflow-wrap: anywhere; }
}
.chat-recovery-dialog{width:min(520px,calc(100% - 28px));padding:0;border:1px solid #d6e2f1;border-radius:18px;background:#fff;color:#192a42;box-shadow:0 24px 90px #071a3650}.chat-recovery-dialog::backdrop{background:#071528a8;backdrop-filter:blur(4px)}.chat-recovery-card{display:grid;gap:14px;padding:24px}.chat-recovery-card h2{margin:0;font-size:22px}.chat-recovery-card p{margin:0;color:#5b6b82;line-height:1.6}.chat-recovery-card>input{width:100%;padding:13px;border:1px solid #cbd8e8;border-radius:10px;background:#f5f8fc;color:#163d72;font:700 15px ui-monospace,monospace;letter-spacing:.04em}.chat-recovery-card button{min-height:42px;padding:9px 13px;border:1px solid #d6e2f1;border-radius:9px;background:#f4f7fb;color:#1a477d;font-weight:750;cursor:pointer}.chat-recovery-card label{display:flex;align-items:flex-start;gap:8px;color:#33445a;font-size:13px}.chat-recovery-card label input{margin-top:4px}.chat-recovery-actions{display:flex;justify-content:flex-end;gap:9px}.chat-recovery-actions button[type=submit]{border:0;background:#2469c8;color:#fff}.chat-recovery-actions button:disabled{opacity:.5;cursor:not-allowed}
.chat-legacy-badge{border-radius:99px;padding:2px 7px;background:#fff0db;color:#895716;font-size:9px;font-weight:800}

/* Refined message composer and attachment control */
.chat-composer {
    gap: 12px;
    padding: 15px 18px;
    align-items: flex-end;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.chat-attach {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    color: var(--primary);
    cursor: pointer;
    transition: background .2s, border-color .2s, transform .2s;
}

.chat-attach i {
    font-size: 17px;
}

.chat-attach-text {
    display: none;
}

.chat-attach:hover {
    border-color: var(--primary);
    background: var(--surface-soft);
    transform: translateY(-2px);
}

.chat-compose-fields {
    flex: 1 1 auto;
    min-width: 0;
    padding: 7px 12px 8px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: var(--surface);
    transition: border-color .2s, box-shadow .2s;
}

.chat-compose-fields:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .09);
}

.chat-compose-fields textarea {
    display: block;
    width: 100%;
    min-height: 32px;
    max-height: 150px;
    padding: 7px 2px;
    border: 0;
    outline: 0;
    resize: none;
    overflow-y: hidden;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    line-height: 1.6;
    box-shadow: none;
}

.chat-compose-fields textarea:focus {
    border: 0;
    outline: 0;
    box-shadow: none;
}

.chat-compose-fields textarea::placeholder {
    color: var(--muted);
    opacity: .85;
}

.chat-compose-fields small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.45;
}

.chat-file-names {
    display: block;
    max-width: 100%;
    margin-top: 5px;
    color: var(--primary);
    font-size: 10px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.chat-send {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: 15px;
    color: #fff;
    cursor: pointer;
}

.chat-send i {
    font-size: 17px;
}

.chat-send:disabled {
    cursor: wait;
    opacity: .6;
    transform: none;
}

@media (min-width: 601px) {
    .chat-attach {
        flex-basis: 88px;
        width: 88px;
    }

    .chat-attach-text {
        display: inline;
        font-size: 11px;
        font-weight: 750;
    }
}

@media (max-width: 600px) {
    .chat-composer {
        gap: 7px;
        padding: 10px;
    }

    .chat-attach,
    .chat-send {
        flex: 0 0 42px;
        width: 42px;
        height: 42px;
        border-radius: 13px;
    }

    .chat-compose-fields {
        padding: 5px 9px 7px;
        border-radius: 13px;
    }

    .chat-compose-fields textarea {
        min-height: 30px;
        max-height: 120px;
        font-size: 13px;
    }

    .chat-compose-fields small {
        font-size: 8px;
    }

    .chat-file-names {
        font-size: 9px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chat-attach,
    .chat-compose-fields {
        transition: none;
    }
}
