:root {
    --bg: #edf3f8;
    --surface: #ffffff;
    --surface-soft: #f7f9fc;
    --line: #d8e1ea;
    --text: #0f172a;
    --muted: #61758a;
    --brand: #1d9bf0;
    --brand-strong: #0c7ecb;
    --danger: #b02a37;
    --danger-soft: #ffeff1;
    --ok: #1f8f5f;
    --ok-soft: #e9f8f1;
    --shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background:
        radial-gradient(circle at 15% -10%, rgba(29, 155, 240, 0.22), transparent 34%),
        radial-gradient(circle at 100% 0%, rgba(20, 80, 190, 0.1), transparent 32%),
        var(--bg);
}

.wrap {
    width: min(1280px, calc(100% - 2rem));
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(237, 243, 248, 0.9);
}

.site-header .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 70px;
}

.logo {
    text-decoration: none;
    color: var(--text);
    font-size: 1.35rem;
    letter-spacing: 0.02em;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.logo-img {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    object-fit: cover;
}

.nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page {
    padding: 1.15rem 0 2.5rem;
}

.app-grid {
    display: grid;
    grid-template-columns: 260px minmax(0, 640px) 320px;
    gap: 1rem;
}

.app-grid-public {
    grid-template-columns: minmax(0, 640px) 320px;
    justify-content: center;
}

.menu-column {
    position: sticky;
    top: 86px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.15) transparent;
}
.menu-column::-webkit-scrollbar {
    width: 4px;
}
.menu-column::-webkit-scrollbar-track {
    background: transparent;
}
.menu-column::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.18);
    border-radius: 4px;
}

.menu-card {
    background: var(--surface);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 20px;
    padding: 1rem;
    box-shadow: var(--shadow);
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(130deg, #17a2ff, #005bd1);
    margin-bottom: 0.8rem;
    overflow: hidden;
    position: relative;
}

.brand-mark-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-mark-fallback {
    position: absolute;
    inset: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.menu-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.menu-link {
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    border-radius: 999px;
    padding: 0.7rem 0.8rem;
}

.menu-link:hover {
    background: #eef4fb;
}

.menu-link.active {
    background: #dff0fd;
    color: #0c5a96;
}

.menu-logout {
    margin-top: 1rem;
    width: 100%;
    text-align: center;
}

.menu-search {
    margin-top: 0.9rem;
}

.menu-search input {
    margin-bottom: 0.55rem;
}

.menu-search .btn {
    width: 100%;
}

.menu-profile {
    margin-top: 1rem;
    border-top: 1px solid var(--line);
    padding-top: 0.8rem;
    display: flex;
    flex-direction: column;
}

.menu-profile small {
    color: var(--muted);
}

.menu-avatar {
    margin-bottom: 0.55rem;
}

.content-column {
    min-width: 0;
}

.info-column .sticky {
    position: sticky;
    top: 86px;
}

.card {
    background: var(--surface);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 20px;
    padding: 1rem;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

h1,
h2 {
    margin: 0 0 0.35rem;
}

h1 {
    font-size: 1.32rem;
}

h2 {
    font-size: 1.08rem;
}

p {
    margin: 0;
    line-height: 1.5;
}

.hint,
time,
.switch-link {
    color: var(--muted);
}

.btn {
    border: none;
    border-radius: 999px;
    padding: 0.62rem 1rem;
    text-decoration: none;
    display: inline-block;
    font-weight: 700;
    color: #fff;
    background: var(--brand);
    cursor: pointer;
}

.btn:hover {
    background: var(--brand-strong);
}

.btn-ghost {
    border: 1px solid rgba(15, 23, 42, 0.15);
    color: var(--text);
    background: transparent;
}

.js-notification-bell {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.js-notification-count,
.js-admin-alert-count,
.js-chat-count {
    min-width: 1.4rem;
    height: 1.4rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
    background: #e7eef7;
    color: #223043;
}

.js-notification-count[data-count]:not([data-count="0"]),
.js-chat-count[data-count]:not([data-count="0"]) {
    background: #d93025;
    color: #fff;
}

.js-admin-alert-count[data-count]:not([data-count="0"]) {
    background: #1a73e8;
    color: #fff;
}

.user-chip {
    font-size: 0.92rem;
    font-weight: 700;
    padding-right: 0.2rem;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    background: #f4f8fc;
}

.nav-icon-btn .nav-btn-icon {
    display: none;
}

.nav-icon-btn .nav-btn-icon svg {
    display: block;
}

.lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.lang-flag {
    width: 16px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid rgba(15, 23, 42, 0.18);
    object-fit: cover;
}

textarea,
input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.78rem 0.9rem;
    background: var(--surface-soft);
    font: inherit;
    margin: 0.28rem 0 0.9rem;
}

textarea:focus,
input:focus {
    outline: none;
    border-color: #70c2ff;
    box-shadow: 0 0 0 4px rgba(29, 155, 240, 0.2);
}

.composer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.composer-toolbar {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0.1rem 0 0.7rem;
}

.tool-btn {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--brand-strong);
    border-radius: 999px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0;
}

.tool-btn:hover {
    background: #eef7ff;
    border-color: #9fd1f4;
}

.tool-panel {
    margin-bottom: 0.7rem;
}

.hidden-file-input {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.file-name {
    margin-top: -0.5rem;
    margin-bottom: 0.65rem;
}

.talk {
    animation: fade-up 0.2s ease;
}

.talk-clickable {
    cursor: pointer;
}

.talk-clickable:focus-visible {
    outline: 3px solid rgba(29, 155, 240, 0.45);
    outline-offset: 2px;
}

.talk-head {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.65rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.talk-author {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.avatar-fallback {
    background: linear-gradient(130deg, #17a2ff, #005bd1);
    color: #fff;
    font-weight: 700;
}

.talk-content {
    margin-bottom: 0.85rem;
    word-break: break-word;
}

.talk-translation {
    margin-top: -0.2rem;
    margin-bottom: 0.8rem;
    border-left: 3px solid #bcdaf5;
    padding-left: 0.65rem;
}

.talk-content a {
    color: var(--brand-strong);
    text-decoration: none;
}

.talk-content a:hover {
    text-decoration: underline;
}

.quote-ref-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    border: 1px solid #c5d4e3;
    border-radius: 999px;
    padding: 0.12rem 0.5rem;
    margin: 0 0.18rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: #1f486a;
    background: #f3f8fd;
    text-decoration: none;
    vertical-align: baseline;
}

.quote-ref-btn:hover {
    border-color: #9ac6ec;
    background: #e9f4ff;
    text-decoration: none;
}

.talk-media {
    margin-bottom: 0.8rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
}

.talk-media img {
    width: 100%;
    display: block;
    max-height: 520px;
    object-fit: cover;
    cursor: zoom-in;
}

.video-wrap {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
}

.video-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.talk-meta {
    margin-bottom: 0.7rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.meta-link {
    text-decoration: none;
    color: var(--muted);
    font-weight: 600;
}

.meta-link:hover {
    color: var(--brand-strong);
}

.ip-tag {
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: #eef4fb;
    border: 1px solid var(--line);
}

.profile-link {
    color: inherit;
    text-decoration: none;
}

.profile-link:hover {
    text-decoration: underline;
}

.handle {
    display: inline-flex;
    align-items: center;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: #234056;
    text-decoration: none;
}

.handle:hover {
    color: #0c7ecb;
    text-decoration: none;
}

.mention-link {
    color: #0c7ecb;
    font-weight: 700;
    text-decoration: none;
}

.mention-link:hover {
    text-decoration: underline;
}

.talk-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.talk-reactions form {
    margin: 0;
    display: inline-flex;
    align-items: center;
}

.reaction {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    padding: 0.45rem 0.76rem;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    line-height: 1;
}

.reactor-panels {
    margin-top: 0.55rem;
    display: grid;
    gap: 0.45rem;
}

.talk-stats-panel {
    border-top: 1px dashed var(--line);
    padding-top: 0.55rem;
}

.reactor-box {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 0.45rem 0.6rem;
}

.reactor-box summary {
    cursor: pointer;
    font-weight: 700;
}

.reactor-list {
    margin-top: 0.45rem;
    display: grid;
    gap: 0.35rem;
}

.reactor-item {
    text-decoration: none;
    color: inherit;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.reactor-item .avatar {
    width: 24px;
    height: 24px;
}

.link-btn {
    text-decoration: none;
    color: var(--text);
    vertical-align: middle;
}

.reaction span {
    margin-left: 0.3rem;
    color: var(--muted);
}

.active-like {
    border-color: #a6ddc6;
    color: var(--ok);
    background: var(--ok-soft);
}

.active-dislike {
    border-color: #efbac0;
    color: var(--danger);
    background: var(--danger-soft);
}

.danger {
    color: var(--danger);
    border-color: #efc0c5;
    background: #fff6f7;
}

.search-form input {
    margin-bottom: 0;
}

.hashtag-link {
    color: var(--brand);
    font-weight: 700;
}

.hashtag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.mini-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    margin-top: 0.9rem;
}

.mini-stats strong {
    display: block;
    margin-top: 0.2rem;
    font-size: 1.12rem;
}

.stat-label {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
    margin-top: 0.9rem;
}

.profile-stats > div {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.65rem;
    background: #fff;
}

.profile-stats strong {
    display: block;
    margin-top: 0.2rem;
    font-size: 1.1rem;
}

.profile-friends-area {
    margin-top: 1rem;
    padding-top: 0.25rem;
}

.profile-section-title {
    margin: 0 0 0.55rem;
    font-size: 1.1rem;
}

.profile-friends-card {
    border-top: 3px solid #c6def2;
}

.profile-header {
    display: flex;
    gap: 0.9rem;
    align-items: center;
    margin-bottom: 0.7rem;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    font-size: 1.5rem;
}

.profile-form {
    margin-top: 0.9rem;
}

.profile-form label {
    display: block;
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.profile-action-grid {
    margin-top: 0.75rem;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    align-items: stretch;
}

.profile-action-item {
    margin: 0;
    display: flex;
}

.profile-action-item .reaction,
.profile-action-item.reaction {
    width: 100%;
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.profile-action-grid .friend-actions {
    margin-top: 0;
}

.right-rail-actions {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.right-rail-actions .admin-link {
    display: block;
    width: 100%;
    text-align: center;
}

.right-rail-actions .admin-link + .admin-link {
    margin-top: 0.55rem;
}

.bot-metrics {
    margin-top: 0.9rem;
    display: grid;
    gap: 0.55rem;
}

.bot-metrics h3 {
    margin: 0 0 0.1rem;
    font-size: 0.98rem;
}

.bot-metric {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 0.55rem 0.65rem;
}

.bot-metric strong {
    display: block;
    margin-top: 0.2rem;
    font-size: 1.02rem;
}

.bot-metric-bar {
    margin-top: 0.45rem;
    height: 10px;
    border-radius: 999px;
    border: 1px solid #d9e4ef;
    background: linear-gradient(90deg, #ffffff 0%, #d8f2e1 50%, #ffd7d7 100%);
    overflow: hidden;
}

.bot-metric-bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #9ad4ff 0%, #1fbb67 50%, #cf3f45 100%);
}

.bot-metric-bar.positive span {
    background: linear-gradient(90deg, #cf3f45 0%, #f2c24a 50%, #1fbb67 100%);
}

.bot-metric-bar.negative span {
    background: linear-gradient(90deg, #1fbb67 0%, #f2c24a 50%, #cf3f45 100%);
}

.mood-gauge-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.7rem;
}

.mood-gauge-scale {
    display: flex;
    justify-content: space-between;
    margin-top: -0.3rem;
    margin-bottom: 0.65rem;
}

.mood-note-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
    margin-top: 0.7rem;
}

.mood-note-box {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.62rem 0.7rem;
    background: #fff;
}

.mood-note-box .hint {
    margin: 0;
}

.mood-note-box .hint + .hint {
    margin-top: 0.35rem;
}

.mood-legend-box {
    margin-top: 0.7rem;
}

.mood-gauge {
    width: 220px;
    height: 112px;
    border-radius: 220px 220px 0 0;
    border: 1px solid #d8e2ec;
    border-bottom: 0;
    background: linear-gradient(90deg, #de4e4e 0%, #f2c24a 50%, #2abf6d 100%);
    position: relative;
    overflow: hidden;
}

.mood-gauge-core {
    position: absolute;
    left: 26px;
    right: 26px;
    bottom: -62px;
    height: 124px;
    border-radius: 124px 124px 0 0;
    background: #fff;
    border: 1px solid #d8e2ec;
}

.mood-gauge-needle {
    position: absolute;
    left: 50%;
    bottom: 8px;
    width: 3px;
    height: 92px;
    background: #1d2f40;
    transform-origin: 50% calc(100% - 4px);
    border-radius: 999px;
    z-index: 2;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    align-items: center;
}

.admin-ai-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 0.65rem;
}

.admin-ai-grid textarea {
    min-height: 72px;
}

.admin-ai-grid select[multiple] {
    width: 100%;
    min-height: 140px;
}

.admin-ai-provider-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: end;
    margin-bottom: 0.7rem;
}

.admin-ai-panels {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 0.7rem;
}

.admin-ai-panel {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.7rem;
    background: #fff;
}

.admin-ai-panel h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.admin-ai-panel .hint {
    margin-bottom: 0.55rem;
}

.admin-ai-panel textarea,
.admin-ai-panel input[type="text"],
.admin-ai-panel select {
    width: 100%;
}

.admin-ai-panel textarea {
    min-height: 92px;
}

.admin-ai-panel select[multiple] {
    min-height: 220px;
    font-size: 0.95rem;
}

@media (max-width: 980px) {
    .admin-ai-grid {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }
}

@media (max-width: 680px) {
    .admin-ai-grid {
        grid-template-columns: 1fr;
    }
    .admin-ai-panels {
        grid-template-columns: 1fr;
    }
}

.auth {
    max-width: 520px;
    margin: 2.6rem auto 0;
}

.auth p {
    margin-bottom: 1rem;
}

.auth-form label {
    display: block;
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.switch-link a {
    color: var(--brand-strong);
    font-weight: 700;
}

.alert {
    border-radius: 12px;
    padding: 0.72rem 0.9rem;
    margin-bottom: 1rem;
}

.alert-success {
    color: var(--ok);
    border: 1px solid #b5e6d0;
    background: var(--ok-soft);
}

.alert-error {
    color: var(--danger);
    border: 1px solid #f0c7cc;
    background: var(--danger-soft);
}

.empty {
    text-align: center;
    color: var(--muted);
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.followed-list {
    display: grid;
    gap: 0.7rem;
}

.followed-item {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.75rem;
    background: #fff;
}

.followed-head {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
}

.followed-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.followed-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.followed-actions form {
    margin: 0;
}

.replies .talk {
    border-left: 3px solid #d8e1ea;
}

.admin-stats {
    margin-top: 0.6rem;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
}

.admin-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
}

.stat {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.7rem;
}

.stat strong {
    display: block;
    margin-top: 0.3rem;
    font-size: 1.2rem;
}

.admin-table-wrap {
    overflow-x: auto;
}

.admin-controls-form {
    display: grid;
    gap: 0.75rem;
}

.admin-subtabs {
    align-items: center;
}

.admin-subpanel {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.75rem;
    background: #fff;
}

.admin-subpanel h3 {
    margin: 0 0 0.55rem;
    font-size: 1rem;
}

.admin-control-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(170px, 1fr));
    gap: 0.55rem 0.65rem;
}

.admin-control-grid .hint {
    display: block;
}

.admin-control-grid .hint input[type="checkbox"] {
    width: auto;
    margin: 0 0.35rem 0 0;
}

.admin-keys-area {
    grid-column: span 2;
}

.admin-keys-area textarea {
    min-height: 82px;
}

.admin-controls-footer {
    justify-content: flex-start;
    align-items: center;
}

.admin-controls-header {
    justify-content: space-between;
    align-items: center;
}

.admin-status-pill {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f7fbff;
    color: #28435c;
    padding: 0.45rem 0.76rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    line-height: 1;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    border-bottom: 1px solid var(--line);
    text-align: left;
    padding: 0.7rem 0.4rem;
    vertical-align: middle;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.row-actions form {
    margin: 0;
}

.admin-list .admin-talk {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.85rem;
    margin-bottom: 0.7rem;
}

.admin-collapsible > summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    display: inline-flex;
}

.admin-collapsible > summary::-webkit-details-marker {
    display: none;
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1180px) {
    .app-grid {
        grid-template-columns: 220px minmax(0, 1fr);
    }

    .app-grid-public {
        grid-template-columns: minmax(0, 1fr);
    }

    .info-column {
        display: none;
    }
}

@media (max-width: 1100px) {
    .app-grid {
        grid-template-columns: 1fr;
    }

    .menu-column {
        display: none;
    }

    .mobile-tabbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 120;
        display: flex;
        align-items: center;
        gap: 0.35rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0.45rem 0.5rem calc(0.45rem + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, 0.97);
        border-top: 1px solid var(--line);
        backdrop-filter: blur(8px);
    }

    .mobile-tab {
        text-decoration: none;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 42px;
        min-width: 44px;
        border-radius: 12px;
        color: #36506a;
        font-size: 1.15rem;
        border: 1px solid transparent;
        background: transparent;
        flex: 0 0 auto;
    }

    .mobile-tab.active {
        color: #0c7ecb;
        background: #eef7ff;
        border-color: #c9e3f8;
    }

    .mobile-more-menu {
        position: fixed;
        right: 0.55rem;
        bottom: calc(4.2rem + env(safe-area-inset-bottom));
        z-index: 130;
        display: grid;
        gap: 0.35rem;
        padding: 0.5rem;
        border: 1px solid var(--line);
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.98);
        box-shadow: var(--shadow);
        min-width: 220px;
    }

    .mobile-more-link {
        text-decoration: none;
        color: #203549;
        border: 1px solid #d4e1ee;
        border-radius: 11px;
        background: #f7fbff;
        padding: 0.5rem 0.6rem;
        font-weight: 700;
    }

    .mobile-more-link.active {
        border-color: #a9d1ef;
        background: #e8f4ff;
        color: #0c7ecb;
    }

    .talk-reactions {
        gap: 0.4rem;
    }

    .reaction {
        min-height: 42px;
        padding: 0.5rem 0.7rem;
    }

    .composer-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.55rem;
    }

    .composer-actions .btn {
        width: 100%;
        text-align: center;
    }

    .page {
        padding-bottom: 5.7rem;
    }
}

@media (max-width: 620px) {
    .site-header .wrap {
        min-height: 64px;
        flex-direction: column;
        justify-content: center;
        align-items: flex-start;
        gap: 0.4rem;
        padding: 0.45rem 0;
    }

    .nav {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .nav-icon-btn {
        min-width: 52px;
        padding-left: 0.6rem;
        padding-right: 0.6rem;
        gap: 0.35rem;
    }

    .nav-icon-btn .nav-btn-label {
        display: none;
    }

    .nav-icon-btn .nav-btn-icon {
        display: inline-flex;
        font-size: 1.05rem;
        line-height: 1;
    }

    .menu-nav {
        grid-template-columns: 1fr;
    }

    .wrap {
        width: min(1280px, calc(100% - 1rem));
    }

    .card {
        padding: 0.8rem;
        border-radius: 16px;
    }

    .talk-content {
        font-size: 0.98rem;
    }

    .talk-media img {
        max-height: 380px;
    }

    .messages-layout {
        gap: 0.6rem;
    }

    .profile-action-grid {
        grid-template-columns: 1fr;
    }

    .mood-note-grid {
        grid-template-columns: 1fr;
    }

    .admin-control-grid {
        grid-template-columns: 1fr;
    }

    .admin-keys-area {
        grid-column: auto;
    }

    .admin-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 621px) and (max-width: 860px) {
    .profile-action-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-control-grid {
        grid-template-columns: repeat(2, minmax(170px, 1fr));
    }

    .admin-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.banned-name {
    color: #b02a37;
}

.ban-note {
    color: #b02a37;
    font-weight: 600;
    margin-left: 0.3rem;
    font-size: 0.85rem;
}

.gif-tools {
    margin-top: 0.2rem;
    margin-bottom: 0.8rem;
}

.poll-builder {
    margin: 0.25rem 0 0.8rem;
    border: 1px dashed var(--line);
    border-radius: 12px;
    padding: 0.6rem;
    background: #fff;
}

.poll-builder summary {
    cursor: pointer;
    font-weight: 700;
    margin-bottom: 0.45rem;
}

.poll-box {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.7rem;
    background: #fff;
    margin-bottom: 0.75rem;
}

.poll-box h4 {
    margin: 0 0 0.55rem;
}

.poll-options {
    display: grid;
    gap: 0.4rem;
}

.poll-vote-form {
    margin: 0;
}

.poll-option {
    width: 100%;
    justify-content: space-between;
    text-align: left;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(
            90deg,
            var(--poll-fill, transparent) 0%,
            var(--poll-fill, transparent) var(--poll-pct, 0%),
            #fff var(--poll-pct, 0%),
            #fff 100%
        );
}

.gif-panel {
    margin-top: 0.5rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.6rem;
    background: #fff;
}

.gif-panel.hidden {
    display: none;
}

.gif-results {
    margin-top: 0.55rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 0.45rem;
}

.gif-item {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0;
    overflow: hidden;
    background: #fff;
    cursor: pointer;
}

.gif-item img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    display: block;
}

.talk-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.ip-tag {
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: #eef4fb;
    border: 1px solid var(--line);
}

.talk-reactions {
    align-items: center;
}

.talk-reactions form {
    display: inline-flex;
    align-items: center;
}

.reaction {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    line-height: 1;
}

.link-btn {
    vertical-align: middle;
}

.ban-form {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.ban-days {
    width: 72px;
    margin: 0;
    padding: 0.35rem 0.45rem;
}

.private-lock {
    margin-left: 0.3rem;
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid #d7dde5;
    background: #f3f6fa;
    color: #304255;
}

.private-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.private-toggle input {
    width: auto;
    margin: 0;
}

.private-info {
    margin-top: 0.75rem;
}

.friend-actions {
    margin-top: 0.75rem;
}

.upload-preview {
    margin-bottom: 0.7rem;
}

.upload-preview-img {
    width: 100%;
    max-height: 260px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--line);
}

.upload-progress {
    margin-bottom: 0.8rem;
}

.progress-track {
    height: 10px;
    border-radius: 999px;
    background: #e9eef5;
    border: 1px solid var(--line);
    overflow: hidden;
    margin-top: 0.3rem;
    margin-bottom: 0.3rem;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #1d9bf0, #0c7ecb);
}

.hidden {
    display: none;
}

select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.78rem 0.9rem;
    background: var(--surface-soft);
    font: inherit;
    margin: 0.28rem 0 0.9rem;
}

.notification-list {
    display: grid;
    gap: 0.6rem;
}

.notification-item {
    display: grid;
    gap: 0.15rem;
    text-decoration: none;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.7rem;
    background: #fff;
}

.notification-item.unread {
    border-color: #9ecff5;
    background: #f2f9ff;
}

.messages-layout {
    display: grid;
    gap: 0.8rem;
    grid-template-columns: 220px minmax(0, 1fr);
}

.messages-view-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.messages-partners {
    border-right: 1px solid var(--line);
    padding-right: 0.6rem;
}

.message-user {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    align-items: center;
    gap: 0.45rem;
    text-decoration: none;
    color: var(--text);
    border-radius: 10px;
    padding: 0.45rem 0.55rem;
}

.message-user-meta {
    min-width: 0;
    display: grid;
    gap: 0.1rem;
}

.message-user-meta strong {
    display: block;
}

.message-user-meta small {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-user:hover,
.message-user.active {
    background: #eef4fb;
}

.messages-items {
    display: grid;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
    max-height: 460px;
    overflow-y: auto;
}

.messages-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.7rem;
}

.messages-thread {
    min-width: 0;
}

.message-form {
    margin-bottom: 0.8rem;
}

.chat-tools {
    margin: 0.1rem 0 0.55rem;
}

.chat-tools > summary {
    display: inline-flex;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.chat-tools > summary::-webkit-details-marker {
    display: none;
}

.message-bubble {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.6rem;
    background: #fff;
}

.message-bubble.own {
    border-color: #b8dff9;
    background: #eef7ff;
}

.message-bubble p {
    margin-top: 0.2rem;
}

.friend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.55rem 0.7rem;
    margin-bottom: 0.5rem;
}

.friend-user {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    text-decoration: none;
    color: inherit;
}

.chat-upload-preview {
    margin-bottom: 0.7rem;
}

.chat-upload-preview-img {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--line);
}

.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 220;
    background: rgba(8, 14, 24, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.image-lightbox.hidden {
    display: none;
}

.image-lightbox img {
    max-width: 96vw;
    max-height: 92vh;
    border-radius: 10px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

.mention-suggest {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow);
    margin-top: -0.55rem;
    margin-bottom: 0.9rem;
    padding: 0.35rem;
    display: grid;
    gap: 0.2rem;
}

.mention-item {
    border: 0;
    background: transparent;
    text-align: left;
    padding: 0.5rem 0.55rem;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
}

.mention-item:hover,
.mention-item.active {
    background: #eef4fb;
}

.twofa-qr-wrap {
    margin: 0.6rem 0;
}

.twofa-qr {
    width: 220px;
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 0.25rem;
}

@media (min-width: 1101px) {
    .mobile-tabbar,
    .mobile-more-menu {
        display: none !important;
    }
}

@media (max-width: 860px) {
    .messages-layout {
        grid-template-columns: 1fr;
    }

    .messages-partners {
        border-right: 0;
        border-bottom: 1px solid var(--line);
        padding-right: 0;
        padding-bottom: 0.6rem;
    }

    .messages-thread {
        display: flex;
        flex-direction: column;
    }

    .message-form.chat-form {
        position: sticky;
        bottom: calc(4.1rem + env(safe-area-inset-bottom));
        z-index: 6;
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: 12px;
        padding: 0.45rem;
        margin-bottom: 0;
    }

    .messages-items {
        max-height: calc(100vh - 320px);
        min-height: 220px;
    }

    .message-form.chat-form textarea {
        margin: 0.2rem 0 0.5rem;
        min-height: 72px;
    }
}
.infinite-sentinel {
  text-align: center;
  padding: 0.9rem 0.2rem 0.2rem;
}

/* Impersonation Banner */
.impersonate-banner {
    background: #7c3aed;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.45rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border-top: 1px solid rgba(255,255,255,0.15);
}
.impersonate-banner__stop {
    color: #fff;
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 6px;
    padding: 0.2rem 0.65rem;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    transition: background 0.15s;
}
.impersonate-banner__stop:hover {
    background: rgba(255,255,255,0.3);
}

/* Guest Promo Bar – scrolling ticker */
@keyframes promo-ticker {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}
.guest-promo-bar {
    background: linear-gradient(90deg, #eef4ff 0%, #f0fdf4 100%);
    border-bottom: 1px solid #c7d9f8;
    overflow: hidden;
    white-space: nowrap;
    padding: .42rem 0;
    font-size: .82rem;
    line-height: 1.4;
}
.guest-promo-bar__inner {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    animation: promo-ticker 22s linear infinite;
    will-change: transform;
}
.guest-promo-bar__icon {
    font-size: 1.05rem;
    flex-shrink: 0;
}
.guest-promo-bar__text {
    color: #374151;
}
.guest-promo-bar__text strong {
    color: #1d4ed8;
}

/* Guest nav – compact label+emoji, no separate icon */
.nav-guest {
    gap: 0.2rem;
    margin-left: 0.5rem;
    flex-wrap: wrap;
}
.nav-guest .nav-icon-btn .nav-btn-label {
    display: inline;
    font-size: 0.8rem;
    white-space: nowrap;
}
.nav-guest .nav-icon-btn .nav-btn-icon {
    display: none;
}
.nav-guest .nav-icon-btn {
    padding-left: 0.45rem;
    padding-right: 0.45rem;
    font-size: 0.8rem;
}
@media (max-width: 620px) {
    .nav-guest {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        max-width: calc(100vw - 1rem);
        margin-left: 0;
        gap: 0.1rem;
    }
    .nav-guest::-webkit-scrollbar {
        display: none;
    }
    .nav-guest .nav-icon-btn .nav-btn-label {
        display: none;
    }
    .nav-guest .nav-icon-btn .nav-btn-icon {
        display: inline;
        font-size: 1.1rem;
        line-height: 1;
    }
    .nav-guest .nav-icon-btn {
        padding: 0.25rem 0.45rem;
        flex-shrink: 0;
        min-width: unset;
    }
}

/* Profile Admin Zone */
.profile-admin-zone {
    border: 2px dashed #7c3aed;
    border-radius: 12px;
    padding: 0.65rem 1rem;
    margin-top: 0.9rem;
}
.profile-admin-zone-label {
    color: #7c3aed;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.45rem;
}

/* Profile delete button spacing */
.profile-delete-gap {
    margin-top: 1.2rem;
}

/* Emoji Picker */
.emoji-picker-wrap {
    position: relative;
    display: inline-block;
}
.emoji-picker {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 0.5rem;
    width: 292px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 1px;
}
.emoji-picker.hidden {
    display: none;
}
.emoji-search-input {
    grid-column: 1 / -1;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 0.35rem;
    padding: 0.28rem 0.5rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 0.82rem;
    outline: none;
    background: var(--surface-soft);
}
.emoji-search-input:focus {
    border-color: var(--brand);
}
.emoji-picker .emoji-btn {
    background: none;
    border: none;
    border-radius: 6px;
    font-size: 1.25rem;
    padding: 0.22rem;
    cursor: pointer;
    line-height: 1;
    text-align: center;
    transition: background 0.1s;
}
.emoji-picker .emoji-btn:hover {
    background: var(--surface-soft);
}
/* Chat unread badge */
.js-chat-count[data-count="0"] {
    display: none;
}
.js-chat-count:not([data-count="0"]) {
    background: var(--brand);
    color: #fff;
    border-radius: 999px;
    min-width: 1.3rem;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    display: inline-block;
}
