.mini-tro, .mini-tro * { box-sizing: border-box; }
.mini-tro { position: fixed; right: 22px; bottom: 22px; z-index: 1600; font-family: 'Roboto', Arial, sans-serif; color: var(--portal-text, #17223b); }
body:has(.mini-tro) .sos-guide-trigger { right: 224px; }
body:has(.mini-tro-panel:not([hidden])) .sos-guide-trigger { visibility: hidden; pointer-events: none; }
.mini-tro-launcher { min-height: 48px; display: inline-flex; align-items: center; gap: 9px; border: 1px solid color-mix(in srgb, var(--portal-primary, #1e40af) 55%, var(--portal-border, #d6e0ef)); border-radius: 999px; padding: 0 16px; background: var(--portal-primary, #1e40af); color: #fff; font: inherit; font-weight: 800; box-shadow: 0 12px 30px rgba(30, 64, 175, .28); cursor: pointer; }
.mini-tro-launcher svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mini-tro-launcher b { min-width: 20px; border-radius: 999px; padding: 2px 6px; background: var(--portal-danger, #b42318); color: #fff; font-size: 11px; line-height: 1.2; }
.mini-tro-panel { position: absolute; right: 0; bottom: 60px; width: min(420px, calc(100vw - 24px)); height: min(620px, calc(100dvh - 100px)); display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto; overflow: hidden; border: 1px solid var(--portal-border, #d6e0ef); border-radius: 18px; background: var(--portal-surface, #fff); box-shadow: 0 24px 70px rgba(23, 34, 59, .24); }
.mini-tro-panel[hidden] { display: none; }
.mini-tro-panel > header { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--portal-border, #d6e0ef); }
.mini-tro-panel strong, .mini-tro-panel small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-tro-panel strong { color: var(--portal-primary-strong, #17347f); font-size: 14px; }
.mini-tro-panel small { margin-top: 2px; color: var(--portal-muted, #5b6982); font-size: 11px; }
.mini-tro-panel nav { display: inline-flex; align-items: center; gap: 8px; }
.mini-tro-panel nav a, .mini-tro-panel nav button { border: 0; background: transparent; color: var(--portal-primary, #1e40af); font: inherit; font-size: 12px; font-weight: 800; text-decoration: none; cursor: pointer; }
.mini-tro-panel nav button { width: 30px; height: 30px; border-radius: 999px; background: var(--portal-surface-soft, #eff6ff); font-size: 18px; line-height: 1; }
.mini-tro-channels { display: grid; gap: 5px; max-height: 148px; padding: 10px; border-bottom: 1px solid var(--portal-border, #d6e0ef); overflow-y: auto; background: color-mix(in srgb, var(--portal-surface-soft, #eff6ff) 52%, var(--portal-surface, #fff)); }
.mini-tro-channel { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; min-height: 44px; padding: 6px 7px; border: 1px solid transparent; border-radius: 11px; background: transparent; color: inherit; text-align: left; font: inherit; cursor: pointer; }
.mini-tro-channel:hover, .mini-tro-channel.is-active { border-color: color-mix(in srgb, var(--portal-primary, #1e40af) 30%, var(--portal-border, #d6e0ef)); background: var(--portal-surface, #fff); }
.mini-tro-avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; overflow: hidden; background: var(--portal-surface-soft, #eff6ff); color: var(--portal-primary-strong, #17347f); font-size: 10px; font-weight: 900; }
.mini-tro-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.mini-tro-avatar.is-group { border-radius: 0; background: transparent; }
.mini-tro-avatar.is-group img { object-fit: contain; border-radius: 0; }
.mini-tro-badge { min-width: 19px; border-radius: 999px; padding: 2px 6px; background: var(--portal-danger, #b42318); color: #fff; font-size: 10px; text-align: center; }
.mini-tro-messages { min-height: 0; padding: 14px; overflow-y: auto; background: linear-gradient(180deg, color-mix(in srgb, var(--portal-surface-soft, #eff6ff) 55%, var(--portal-surface, #fff)), var(--portal-surface, #fff)); }
.mini-tro-message { display: flex; margin: 0 0 9px; }
.mini-tro-message.is-own { justify-content: flex-end; }
.mini-tro-bubble { max-width: 82%; padding: 8px 10px; border: 1px solid var(--portal-border, #d6e0ef); border-radius: 13px 13px 13px 4px; background: var(--portal-surface, #fff); box-shadow: 0 3px 10px rgba(23, 34, 59, .06); }
.mini-tro-message.is-own .mini-tro-bubble { border-color: color-mix(in srgb, var(--portal-primary, #1e40af) 35%, var(--portal-border, #d6e0ef)); border-radius: 13px 13px 4px 13px; background: color-mix(in srgb, var(--portal-primary, #1e40af) 9%, var(--portal-surface, #fff)); }
.mini-tro-bubble strong { font-size: 10px; }
.mini-tro-bubble p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.4; }
.mini-tro-file { display: block; margin-top: 6px; color: var(--portal-primary, #1e40af); font-size: 12px; font-weight: 800; overflow-wrap: anywhere; }
.mini-tro-compose { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px; border-top: 1px solid var(--portal-border, #d6e0ef); background: var(--portal-surface, #fff); }
.mini-tro-compose textarea { min-height: 42px; max-height: 92px; resize: none; border: 1px solid var(--portal-border, #d6e0ef); border-radius: 11px; padding: 10px; color: inherit; background: var(--portal-surface, #fff); font: inherit; }
.mini-tro-compose button { min-width: 62px; border: 0; border-radius: 11px; background: var(--portal-primary, #1e40af); color: #fff; font: inherit; font-weight: 800; cursor: pointer; }
.mini-tro-full-link { padding: 0 12px 12px; color: var(--portal-muted, #5b6982); font-size: 11px; text-align: center; text-decoration: none; }
.mini-tro-empty { padding: 14px; color: var(--portal-muted, #5b6982); text-align: center; font-size: 12px; }
.mini-tro :focus-visible { outline: 3px solid color-mix(in srgb, var(--portal-ring, #2563eb) 65%, transparent); outline-offset: 2px; }
body.theme-dark .mini-tro-panel, body.theme-dark .mini-tro-compose textarea { background: var(--portal-surface); }
body.theme-dark .mini-tro-channel:hover, body.theme-dark .mini-tro-channel.is-active, body.theme-dark .mini-tro-bubble { background: var(--portal-surface-soft); }
@media (max-width: 560px) {
  .mini-tro { right: 12px; bottom: 12px; }
  body:has(.mini-tro) .sos-guide-trigger { right: 12px; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  .mini-tro-panel { position: fixed; inset: 12px; width: auto; height: auto; bottom: 12px; }
  .mini-tro-launcher span { display: none; }
}
