.secondary-link { font-family: inherit; background: transparent; cursor: pointer; }
.secondary-link:focus-visible { outline: 3px solid #baddc3; outline-offset: 3px; }

.message-gadget { position: fixed; z-index: 1200; inset: 0; font-family: inherit; pointer-events: none; }
.message-gadget-panel { position: absolute; right: 24px; bottom: 96px; display: grid; grid-template-rows: auto minmax(0, 1fr); width: min(390px, calc(100vw - 32px)); height: min(470px, calc(100dvh - 126px)); min-height: min(320px, calc(100dvh - 126px)); overflow: hidden; border: 1px solid #dce7df; border-radius: 19px; background: #fff; box-shadow: 0 18px 56px #08130d30; opacity: 0; visibility: hidden; transform: translateY(14px) scale(.98); transform-origin: bottom right; transition: opacity 180ms ease, transform 180ms ease, visibility 180ms; pointer-events: none; }
.message-gadget-panel.is-open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); pointer-events: auto; }
.message-gadget-header { display: grid; grid-template-columns: 38px minmax(0, 1fr) 38px; align-items: center; gap: 11px; min-height: 72px; padding: 11px 15px; border-bottom: 1px solid #e4ebe6; background: #fff; }
.message-gadget-header > div { grid-column: 2; min-width: 0; }
.message-gadget-header p { margin: 0 0 3px; color: #146740; font-size: .62rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.message-gadget-header h2 { margin: 0; color: #192b24; font-size: .99rem; font-weight: 750; letter-spacing: -.025em; line-height: 1.25; overflow-wrap: anywhere; }
.message-gadget-back, .message-gadget-close { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid #e0e8e2; border-radius: 11px; background: #fff; color: #405147; cursor: pointer; }
.message-gadget-back { grid-column: 1; }
.message-gadget-back[hidden] { display: none; }
.message-gadget-close { grid-column: 3; justify-self: end; }
.message-gadget-back:hover, .message-gadget-close:hover { border-color: #b9d2c0; background: #f3f8f4; }
.message-gadget-back svg, .message-gadget-close svg { width: 19px; height: 19px; }
.message-gadget-content { min-height: 0; overflow: hidden; background: #f8faf8; }
.message-gadget-home { height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 14px; }
.message-gadget-sign-in { display: grid; gap: 11px; margin-bottom: 15px; padding: 13px; border: 1px solid #d9e9dd; border-radius: 12px; background: #eff8f1; }
.message-gadget-sign-in > p { margin: 0; color: #405147; font-size: .78rem; line-height: 1.45; }
.message-gadget-auth-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.message-gadget-primary, .message-gadget-secondary { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 40px; padding: 8px 12px; border: 0; border-radius: 9px; font: inherit; font-size: .76rem; font-weight: 750; text-decoration: none; cursor: pointer; }
.message-gadget-primary { background: #146740; color: #fff; }
.message-gadget-primary:hover { background: #0d5131; }
.message-gadget-secondary { border: 1px solid #cfddd2; background: #fff; color: #146740; }
.message-gadget-secondary:hover { border-color: #a9cbb3; background: #f4faf5; }
.message-gadget-section { margin-bottom: 13px; }
.message-gadget-section h3 { margin: 0 0 9px; color: #506157; font-size: .69rem; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; }
.message-gadget-conversation-list { display: grid; gap: 6px; }
.message-gadget-conversation { display: grid; width: 100%; min-width: 0; align-items: center; gap: 10px; padding: 10px; border: 1px solid #e4ebe6; border-radius: 12px; background: #fff; color: #192b24; text-align: left; cursor: pointer; transition: border-color 140ms ease, background 140ms ease; }
.message-gadget-conversation { grid-template-columns: 37px minmax(0, 1fr) auto; }
.message-gadget-conversation:hover { border-color: #a9cbb3; background: #f8fcf9; }
.message-gadget-avatar { display: grid; width: 37px; height: 37px; place-items: center; border-radius: 12px; background: #e6f6ec; color: #146740; font-size: .8rem; font-weight: 800; }
.message-gadget-conversation-copy { display: grid; min-width: 0; gap: 3px; }
.message-gadget-conversation-copy strong { overflow: hidden; color: #26382e; font-size: .77rem; text-overflow: ellipsis; white-space: nowrap; }
.message-gadget-conversation-copy > span { overflow: hidden; color: #748178; font-size: .68rem; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.message-gadget-conversation time { color: #87938a; font-size: .62rem; white-space: nowrap; }
.message-gadget-empty { margin: 0; padding: 12px; border: 1px dashed #d2ded5; border-radius: 10px; color: #748178; font-size: .76rem; line-height: 1.5; }
.message-gadget-auth { display: grid; justify-items: center; align-content: center; height: 100%; padding: 22px; text-align: center; }
.message-gadget-auth-icon { display: grid; width: 48px; height: 48px; place-items: center; margin-bottom: 14px; border-radius: 15px; background: #e6f6ec; color: #146740; }
.message-gadget-auth-icon svg { width: 24px; height: 24px; }
.message-gadget-auth h3 { max-width: 30ch; margin: 0; color: #192b24; font-size: 1rem; letter-spacing: -.025em; line-height: 1.35; }
.message-gadget-auth p { max-width: 32ch; margin: 8px 0 18px; color: #63736a; font-size: .77rem; line-height: 1.55; }
.message-gadget-auth .message-gadget-auth-actions { width: 100%; max-width: 280px; }
.message-gadget-loading { display: grid; height: 100%; place-items: center; margin: 0; color: #63736a; font-size: .82rem; }
.gadget-thread { display: grid; grid-template-rows: minmax(0, 1fr) auto; width: 100%; height: 100%; min-height: 0; }
.gadget-message-list { display: flex; min-height: 0; flex-direction: column; align-items: flex-start; gap: 10px; overflow-y: auto; overscroll-behavior: contain; padding: 15px 13px; scroll-behavior: smooth; }
.gadget-empty-thread { align-self: center; max-width: 32ch; margin: auto; padding: 18px; color: #63736a; font-size: .78rem; line-height: 1.55; text-align: center; }
.gadget-message { width: fit-content; max-width: 88%; padding: 9px 11px 7px; border: 1px solid #dfe7e1; border-radius: 13px 13px 13px 4px; background: #fff; box-shadow: 0 3px 12px #193d2406; }
.gadget-message-own { align-self: flex-end; border-color: #c9e6d1; border-radius: 13px 13px 4px 13px; background: #eef9f0; }
.gadget-message > span { display: block; margin-bottom: 4px; color: #146740; font-size: .64rem; font-weight: 800; }
.gadget-message p { margin: 0; color: #26382e; font-size: .77rem; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
.gadget-message time { display: block; margin-top: 5px; color: #7b887f; font-size: .59rem; text-align: right; }
.gadget-form-error { margin: 0 0 8px; padding: 8px 10px; border: 1px solid #f0c7c4; border-radius: 9px; background: #fff4f2; color: #9b2c22; font-size: .72rem; line-height: 1.4; }
.gadget-compose { padding: 11px 12px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid #e0e8e2; background: #fff; }
.gadget-compose textarea { display: block; width: 100%; min-height: 64px; max-height: 25dvh; padding: 9px 10px; resize: vertical; border: 1px solid #d6e0d8; border-radius: 9px; background: #fcfdfc; color: #192b24; font: inherit; font-size: .78rem; line-height: 1.45; }
.gadget-compose textarea:focus { border-color: #146740; outline: 3px solid #1467401b; }
.gadget-compose textarea::placeholder { color: #89978e; }
.gadget-compose-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 7px; }
.gadget-compose-footer > span { color: #63736a; font-size: .62rem; }
.gadget-compose-footer .message-gadget-primary { min-height: 38px; padding: 7px 12px; }
.message-gadget-launcher { position: fixed; right: 22px; bottom: calc(20px + env(safe-area-inset-bottom)); display: grid; width: 58px; height: 58px; place-items: center; border: 0; border-radius: 50%; background: #146740; color: #fff; box-shadow: 0 8px 24px #0d513147; cursor: pointer; pointer-events: auto; transition: transform 160ms ease, background 160ms ease; }
.message-gadget-launcher:hover { transform: translateY(-2px); background: #0d5131; }
.message-gadget-launcher svg { width: 25px; height: 25px; }
.message-gadget-launcher-close { display: none; }
.message-gadget-launcher.is-open .message-gadget-launcher-icon { display: none; }
.message-gadget-launcher.is-open .message-gadget-launcher-close { display: block; }
.message-gadget button:focus-visible, .message-gadget a:focus-visible, .message-gadget textarea:focus-visible, .secondary-link:focus-visible { outline: 3px solid #319c62; outline-offset: 3px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }

@media (max-width: 600px) {
    .message-gadget-panel { right: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); width: calc(100vw - 24px); height: min(560px, calc(100dvh - 112px)); min-height: min(260px, calc(100dvh - 112px)); border-radius: 17px; }
    .message-gadget-launcher { right: 16px; width: 54px; height: 54px; }
    .message-gadget-home { padding: 11px; }
    .gadget-compose { padding-right: 10px; padding-left: 10px; }
    .gadget-compose textarea { min-height: 60px; font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .message-gadget-panel, .message-gadget-launcher { transition: none; }
    .gadget-message-list { scroll-behavior: auto; }
}
