@view-transition { navigation: auto; }
html{-webkit-tap-highlight-color:transparent}
body{padding-bottom:calc(58px + env(safe-area-inset-bottom));box-sizing:border-box}
header{padding-top:calc(14px + env(safe-area-inset-top))}
#userbadge{max-width:9em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.85rem;margin-right:6px}
#tabbar{position:fixed;left:0;right:0;bottom:0;z-index:1000;display:flex;background:#fff;border-top:1px solid #ddd;padding-bottom:env(safe-area-inset-bottom)}
#tabbar a,#tabbar button{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;height:58px;border:0;border-radius:0;background:none;color:#777;font-size:.75rem;text-decoration:none;font-family:inherit}
#tabbar .ico{font-size:1.3rem;line-height:1}
#tabbar .on{color:#1565c0;font-weight:600}
#chat-widget{position:fixed;right:16px;bottom:calc(74px + env(safe-area-inset-bottom));z-index:1100;font-family:system-ui,sans-serif}
#chat-toggle{width:54px;height:54px;border:0;border-radius:50%;background:#1565c0;color:#fff;box-shadow:0 3px 12px #0003;font-size:1.45rem;cursor:pointer}
#chat-toggle:focus-visible,#chat-panel button:focus-visible,#chat-panel input:focus-visible{outline:3px solid #90caf9;outline-offset:2px}
#chat-panel{position:absolute;right:0;bottom:66px;width:min(360px,calc(100vw - 28px));height:min(440px,calc(100dvh - 160px));min-height:220px;display:grid;grid-template-rows:auto 1fr auto auto;overflow:hidden;border:1px solid #d9e0e7;border-radius:14px;background:#fff;box-shadow:0 8px 32px #0003}
#chat-panel[hidden]{display:none}
.chat-heading{display:flex;align-items:center;justify-content:space-between;padding:13px 15px;background:#1565c0;color:#fff;font-weight:600}
.chat-heading button{border:0;background:transparent;color:#fff;font-size:1.35rem;cursor:pointer}
#chat-messages{display:flex;flex-direction:column;gap:9px;overflow-y:auto;padding:14px}
.chat-message{max-width:88%;padding:9px 11px;border-radius:12px;font-size:.88rem;line-height:1.45;overflow-wrap:anywhere}
.chat-message.assistant{align-self:flex-start;background:#f0f3f7;color:#263238}
.chat-message.user{align-self:flex-end;background:#1565c0;color:#fff}
#chat-topics{display:flex;flex-wrap:wrap;gap:6px;padding:0 12px 10px}
#chat-topics button{border:1px solid #c9d8e8;border-radius:16px;background:#fff;color:#1565c0;font-size:.78rem;cursor:pointer}
#chat-form{display:flex;gap:8px;padding:10px 12px;border-top:1px solid #e6eaf0}
#chat-form input{flex:1;min-width:0;padding:9px 10px;border:1px solid #ccd4dd;border-radius:8px;font:inherit;font-size:.9rem}
#chat-form button{padding:8px 12px;border:0;border-radius:8px;background:#1565c0;color:#fff;font:inherit;font-size:.85rem;cursor:pointer}
@media(max-width:680px){#chat-widget{right:12px;bottom:calc(70px + env(safe-area-inset-bottom))}#chat-panel{height:min(440px,calc(100dvh - 150px))}}
