/**
 * Kyla Social layer: design tokens, the top bar, and everything the social
 * feed adds. Loaded after style.css, chat.css and feed.css, so it wins ties.
 *
 * The approved reference is docs/superpowers/mockups/social-feed.html.
 */

:root {
    --canvas: #eef0f3;
    --surface: #ffffff;
    --ink: #1a1c21;
    --ink-2: #5b6270;
    --ink-3: #8a909c;
    --line: #e2e5ea;
    /* The one brand colour. It marks what to act on and what is official —
       primary buttons, the current tab, news, your own vote — so it keeps its
       meaning by never being decoration. */
    --brand: #fbbf24;
    --brand-ink: #5c3d00;
    --brand-wash: #fff6dc;
    --hover: #f3f4f6;
    --online: #22c55e;
    --alert: #e5484d;
    --card-radius: 14px;
    --header-height: 60px;
    --tabbar-height: 0px;
}

/* ── Top bar ────────────────────────────────────────────── */

.kk-top {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-height);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.kk-top-inner {
    height: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
}

.kk-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-weight: 700;
    font-size: 16px;
    color: var(--ink);
    text-decoration: none;
}

.kk-brand img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    flex: none;
}

.kk-brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kk-tabs {
    display: flex;
    height: var(--header-height);
}

.kk-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 20px;
    color: var(--ink-2);
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    border-top: 3px solid transparent;
}

.kk-tab:hover {
    color: var(--ink);
    background: var(--hover);
}

.kk-tab.is-on {
    color: var(--ink);
    border-bottom-color: var(--brand);
}

.kk-top-right {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 8px;
}

.kk-admin-link {
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 8px;
    text-decoration: none;
}

.kk-admin-link:hover {
    background: var(--hover);
    color: var(--ink);
}

.kk-round-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 0;
    background: var(--hover);
    color: var(--ink);
    display: inline-grid;
    place-items: center;
    cursor: pointer;
}

.kk-round-btn:hover {
    background: #e7e9ed;
}

.kk-badge-count {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--alert);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 14px;
    text-align: center;
    border: 2px solid var(--surface);
}

.kk-badge-count[hidden] {
    display: none;
}

.kk-me {
    position: relative;
}

.kk-me-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: 22px;
    border: 0;
    background: var(--hover);
    color: var(--ink);
    font: inherit;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
}

.kk-me-chip:hover {
    background: #e7e9ed;
}

.kk-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(20, 24, 33, 0.14);
    padding: 6px;
    z-index: 60;
}

.kk-menu[hidden] {
    display: none;
}

.kk-menu a,
.kk-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.kk-menu a:hover,
.kk-menu button:hover,
.kk-menu a:focus-visible {
    background: var(--hover);
}

.kk-menu-sep {
    height: 1px;
    background: var(--line);
    margin: 6px 4px;
}

.kk-menu-head {
    padding: 8px 10px 10px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 6px;
}

.kk-menu-head strong {
    display: block;
    font-size: 14px;
}

.kk-menu-head span {
    display: block;
    color: var(--ink-3);
    font-size: 12.5px;
}

/* ── Base ───────────────────────────────────────────────── */

body {
    background: var(--canvas);
    color: var(--ink);
}

/* The feed used to own the viewport and scroll inside a box; a social feed
   scrolls the page, with both side columns pinned beside it. */
body.chat-body {
    overflow: visible;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.kk-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--card-radius);
}

.kk-page-title {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

/* ── Buttons ────────────────────────────────────────────── */

.kk-btn-brand,
.kk-btn.kk-btn-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--brand);
    color: var(--ink);
    border: 0;
    border-radius: 20px;
    padding: 8px 18px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.kk-btn-brand:hover:not(:disabled) {
    background: #f5b40f;
}

.kk-btn-brand:disabled,
.kk-btn.kk-btn-brand:disabled {
    opacity: 1;
    background: var(--hover);
    color: var(--ink-3);
    cursor: default;
}

.kk-btn-quiet {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 20px;
    background: var(--hover);
    color: var(--ink);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: 0;
    cursor: pointer;
}

.kk-btn-quiet:hover {
    background: #e7e9ed;
}

.kk-mini-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--hover);
    color: var(--ink);
    display: inline-grid;
    place-items: center;
}

.kk-mini-btn:hover {
    background: #e7e9ed;
}

.kk-chip-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

/* ── Avatars ────────────────────────────────────────────── */

.kk-avatar {
    font-weight: 600;
    letter-spacing: 0;
}

.kk-avatar-xs { width: 24px; height: 24px; font-size: 10px; }
.kk-avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.kk-avatar-md { width: 40px; height: 40px; font-size: 14px; }
.kk-avatar-lg { width: 48px; height: 48px; font-size: 16px; }

.kk-stack {
    display: inline-flex;
}

.kk-stack .kk-avatar {
    border: 2px solid var(--surface);
    margin-left: -8px;
}

.kk-stack .kk-avatar:first-child {
    margin-left: 0;
}

/* ── Space tiles and covers ─────────────────────────────── */

.kk-space-tile {
    position: relative;
    flex: none;
    display: inline-grid;
    place-items: center;
    overflow: hidden;
    color: #fff;
    font-weight: 700;
}

.kk-space-tile svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.kk-space-tile b {
    position: relative;
}

.kk-space-tile-sm { width: 20px; height: 20px; border-radius: 6px; font-size: 10px; }
.kk-space-tile-md { width: 32px; height: 32px; border-radius: 9px; font-size: 13px; }
.kk-space-tile-lg { width: 64px; height: 64px; border-radius: 16px; font-size: 26px; border: 3px solid var(--surface); }

.kk-cover {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--card-radius);
    overflow: hidden;
}

.kk-cover-art {
    position: relative;
    height: 120px;
    background: var(--space-color);
}

.kk-cover-art > svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.kk-cover-art .kk-space-tile {
    position: absolute;
    left: 20px;
    bottom: -28px;
    background: var(--space-color) !important;
}

.kk-cover-body {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 36px 20px 18px;
}

.kk-cover-name {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.kk-cover-lock {
    color: var(--ink-3);
    display: inline-flex;
}

.kk-cover-desc {
    color: var(--ink-2);
    margin-top: 4px;
    max-width: 60ch;
}

.kk-cover-members {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    color: var(--ink-2);
    font-size: 13px;
}

.kk-cover-actions {
    display: flex;
    gap: 8px;
}

.kk-cover-actions form {
    margin: 0;
}

/* ── Feed shell ─────────────────────────────────────────── */

.kk-shell {
    max-width: 1240px;
    margin: 0 auto;
    padding: 20px 20px 64px;
    display: grid;
    grid-template-columns: 250px minmax(0, 600px) 320px;
    gap: 24px;
    justify-content: center;
    align-items: start;
}

.kk-left,
.kk-side {
    position: sticky;
    top: calc(var(--header-height) + 20px);
    max-height: calc(100vh - var(--header-height) - 40px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
}

.kk-center {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.kk-center > .alert {
    margin: 0;
}

.kk-drawer-bar {
    display: none;
    gap: 8px;
}

.kk-feed {
    gap: 16px;
}

.kk-feed-more {
    padding: 0;
}

/* ── Left column ────────────────────────────────────────── */

.kk-profile-mini {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    color: var(--ink);
    text-decoration: none;
}

.kk-profile-mini:hover {
    border-color: #cfd3da;
}

.kk-profile-mini strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

.kk-profile-mini span span {
    display: block;
    color: var(--ink-2);
    font-size: 12.5px;
}

.kk-space-nav {
    padding: 8px;
}

.kk-space-nav-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 8px 6px;
}

.kk-space-nav-head h2 {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-2);
    text-transform: none;
    letter-spacing: 0;
}

.kk-space-nav-sub {
    margin-top: 6px;
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.kk-space-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.chat-space-link.kk-space-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 10px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.chat-space-link.kk-space-link:hover {
    background: var(--hover);
}

.chat-space-link.kk-space-link.active {
    background: var(--brand-wash);
    color: var(--ink);
}

.kk-space-link .chat-space-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kk-space-link .chat-space-lock {
    color: var(--ink-3);
    display: inline-flex;
}

.kk-unread-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: inset 0 0 0 2px var(--brand-ink);
    flex: none;
}

.kk-space-more summary {
    cursor: pointer;
    list-style: none;
    padding: 7px 8px 7px 50px;
    border-radius: 10px;
    color: var(--ink-2);
    font-size: 13.5px;
    font-weight: 500;
}

.kk-space-more summary::-webkit-details-marker {
    display: none;
}

.kk-space-more summary:hover {
    background: var(--hover);
}

.kk-space-more[open] summary {
    display: none;
}

.kk-discover {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 8px 4px 4px;
    padding: 9px;
    border-radius: 10px;
    background: var(--hover);
    color: var(--ink-2);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
}

.kk-discover:hover {
    background: #e7e9ed;
    color: var(--ink);
}

/* ── Right column ───────────────────────────────────────── */

.kk-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 14px 14px 8px;
}

.kk-card-head h2 {
    font-size: 15px;
    font-weight: 600;
}

.kk-card-head span {
    color: var(--ink-3);
    font-size: 12.5px;
}

.kk-people {
    list-style: none;
    margin: 0;
    padding: 0 6px 8px;
}

.kk-person {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 10px;
    width: 100%;
    text-align: left;
}

.kk-person-text {
    min-width: 0;
}

.kk-person-text strong {
    display: block;
    font-weight: 500;
    font-size: 13.5px;
    line-height: 1.35;
}

.kk-person-text span {
    display: block;
    color: var(--ink-3);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Widgets ────────────────────────────────────────────── */

.kk-w-tabs {
    display: flex;
    gap: 4px;
    padding: 6px;
    border-bottom: 1px solid var(--line);
}

.kk-w-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 4px;
    border: 0;
    border-radius: 9px;
    background: none;
    color: var(--ink-2);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.kk-w-tab:hover {
    background: var(--hover);
    color: var(--ink);
}

.kk-w-tab.is-on {
    background: var(--ink);
    color: #fff;
}

.kk-w-tab small {
    font-size: 11px;
    opacity: 0.75;
}

.kk-w-list {
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
    scrollbar-width: thin;
}

.kk-w-list[hidden] {
    display: none;
}

.kk-w-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 10px;
    color: var(--ink);
    text-decoration: none;
}

.kk-w-item:hover,
.kk-w-item:focus-visible {
    background: var(--hover);
}

.kk-w-date {
    width: 42px;
    flex: none;
    text-align: center;
    line-height: 1.1;
}

.kk-w-date small {
    display: block;
    color: var(--alert);
    font-size: 11px;
    font-weight: 600;
}

.kk-w-date b {
    font-size: 18px;
}

.kk-w-ico {
    width: 36px;
    height: 36px;
    flex: none;
    border-radius: 10px;
    display: grid;
    place-items: center;
    margin: 0 3px;
}

.kk-w-ico-news {
    background: var(--brand-wash);
    color: var(--brand-ink);
}

.kk-w-text {
    min-width: 0;
}

.kk-w-text strong {
    display: block;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.kk-w-text > span {
    display: block;
    color: var(--ink-3);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kk-w-empty {
    padding: 14px 10px;
    color: var(--ink-3);
    font-size: 13px;
    text-align: center;
}

/* ── Directory ──────────────────────────────────────────── */

.kk-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 14px 8px;
    height: 38px;
    padding: 0 14px;
    border-radius: 19px;
    background: var(--hover);
    color: var(--ink-3);
}

.kk-search:focus-within {
    background: var(--surface);
    box-shadow: 0 0 0 2px var(--ink);
}

.kk-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 13.5px;
    outline: none;
}

.kk-dir-card .kk-people {
    max-height: 340px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.kk-people li[hidden] {
    display: none;
}

.kk-dir-row {
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.kk-dir-row:hover,
.kk-dir-row:focus-visible {
    background: var(--hover);
}

.kk-person-text em {
    font-style: normal;
    color: var(--ink-3);
    font-weight: 400;
}

.kk-person-msg {
    margin-left: auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--ink-3);
    flex: none;
}

.kk-dir-row:hover .kk-person-msg {
    color: var(--ink);
    background: var(--surface);
}

.kk-presence {
    position: relative;
    display: inline-flex;
    flex: none;
}

.kk-presence.is-online::after {
    content: '';
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--online);
    border: 2px solid var(--surface);
}

/* A card brought into view from a widget glows briefly so the eye finds it. */
.kk-post.is-flash {
    animation: kk-flash 1.6s ease-out;
}

@keyframes kk-flash {
    0%, 30% { box-shadow: 0 0 0 4px var(--brand); }
    100% { box-shadow: 0 0 0 0 transparent; }
}

.kk-feed-focus[hidden] {
    display: none;
}

.kk-post {
    scroll-margin-top: calc(var(--header-height) + 16px);
}

/* ── Composer ───────────────────────────────────────────── */

.kk-composer.kk-card {
    padding: 14px 16px 10px;
    border-radius: var(--card-radius);
    border-color: var(--line);
    box-shadow: none;
}

.kk-composer-top {
    align-items: center;
    gap: 10px;
}

.kk-composer-pill {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 4px 6px 4px 18px;
    border-radius: 22px;
    background: var(--hover);
}

.kk-composer .kk-composer-pill textarea {
    flex: 1;
    border: 0;
    background: transparent;
    padding: 8px 0;
    font-size: 15px;
    min-height: 0;
    box-shadow: none;
}

.kk-composer .kk-composer-pill textarea:focus {
    outline: none;
    box-shadow: none;
}

.kk-composer-pill:focus-within {
    box-shadow: 0 0 0 2px var(--ink);
    background: var(--surface);
}

.kk-composer-foot {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
    /* On a phone the tools and "Skelbti naujieną" do not fit one line; the
       button drops to its own line instead of running off the screen. */
    flex-wrap: wrap;
    row-gap: 8px;
}

.kk-composer-foot .kk-btn-brand,
.kk-attach {
    white-space: nowrap;
}

.kk-comment-tools {
    flex-wrap: wrap;
    row-gap: 2px;
}

.kk-composer-foot .kk-btn-brand {
    margin-left: auto;
}

.kk-readonly.kk-card {
    margin: 0;
    padding: 14px 16px;
}

.kk-new-posts {
    position: sticky;
    top: calc(var(--header-height) + 12px);
    z-index: 5;
    align-self: center;
    background: var(--ink);
    color: #fff;
    border-radius: 20px;
}

/* ── Post cards ─────────────────────────────────────────── */

.kk-post {
    border-color: var(--line);
    border-radius: var(--card-radius);
    padding: 14px 16px 4px;
}

.kk-post-head {
    gap: 10px;
}

.kk-name {
    font-weight: 600;
    color: var(--ink);
}

.kk-post-title,
.kk-post-when,
.kk-time {
    color: var(--ink-3);
}

.kk-badge {
    text-transform: none;
    letter-spacing: 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--brand-ink);
    background: var(--brand-wash);
    border: 0;
    border-radius: 6px;
    padding: 1px 6px;
}

.kk-post-body {
    font-size: 14.5px;
    line-height: 1.55;
}

.kk-post .kk-shots {
    margin-left: -16px;
    margin-right: -16px;
    border-radius: 0;
}

.kk-post .kk-shots .kk-shot {
    border-radius: 0;
}

.kk-post-tally {
    color: var(--ink-2);
}

.kk-post-actions {
    border-top-color: var(--line);
}

.kk-act {
    font-weight: 500;
    color: var(--ink-2);
    border-radius: 10px;
}

.kk-act:hover,
.kk-act-sm:hover {
    background: var(--hover);
    color: var(--ink);
}

.kk-act.is-on,
.kk-act-sm.is-on {
    color: #b45309;
    font-weight: 600;
}

.kk-bubble {
    background: var(--hover);
    border-radius: 16px;
}

.kk-comment-form textarea {
    border-radius: 18px;
    background: var(--hover);
    border-color: transparent;
}

.kk-comment-form textarea:focus {
    background: var(--surface);
    border-color: var(--ink);
}

.kk-in-space {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--ink-2);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
}

.kk-in-space:hover {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.kk-in-space i {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    display: inline-block;
}

.kk-post.kk-post-news {
    border: 2px solid var(--brand);
    box-shadow: 0 0 0 4px var(--brand-wash);
    padding-top: 0;
    overflow: hidden;
}

.kk-news-band {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 -16px 12px;
    padding: 8px 16px;
    background: var(--brand);
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
}

.kk-news-pin {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
}

.kk-news-title {
    margin: 12px 0 0;
    font-size: 21px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.kk-news-sub {
    margin: 4px 0 0;
    color: var(--ink-2);
    font-size: 15px;
    line-height: 1.45;
}

.kk-post-news .kk-post-body {
    margin-top: 10px;
}

.kk-feed-pinned {
    gap: 16px;
}

.kk-feed-pinned[hidden] {
    display: none;
}

.kk-news-fields {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.kk-news-fields[hidden] {
    display: none;
}

.kk-news-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: var(--brand-ink);
    font-size: 12.5px;
    font-weight: 500;
}

.kk-news-fields input[type="text"],
.kk-field {
    width: 100%;
    height: 40px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 14px;
}

.kk-news-fields input[type="text"]:first-of-type {
    font-weight: 600;
}

.kk-news-fields input[type="text"]:focus,
.kk-field:focus {
    outline: none;
    border-color: var(--ink);
    box-shadow: 0 0 0 1px var(--ink);
}

.kk-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: var(--ink);
    cursor: pointer;
}

.kk-check input {
    width: 16px;
    height: 16px;
    accent-color: var(--ink);
}

/* The ••• menu holding a post's own actions (delete, later pin). */
.kk-post-menu {
    position: relative;
    flex: none;
}

.kk-post-menu-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 0;
    background: none;
    color: var(--ink-3);
    display: inline-grid;
    place-items: center;
    cursor: pointer;
}

.kk-post-menu-btn:hover,
.kk-post-menu.is-open .kk-post-menu-btn {
    background: var(--hover);
    color: var(--ink);
}

.kk-post-menu .kk-menu {
    min-width: 190px;
    top: calc(100% + 4px);
}

.kk-menu .kk-menu-danger {
    color: #b3261e;
}

.kk-empty.kk-card {
    border-style: solid;
}

/* ── The + menu ─────────────────────────────────────────── */

.kk-plus {
    position: relative;
    flex: none;
    align-self: center;
}

.kk-plus-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 0;
    background: var(--brand);
    color: var(--ink);
    display: grid;
    place-items: center;
    cursor: pointer;
}

.kk-plus-btn:hover {
    background: #f5b40f;
}

.kk-plus-btn[aria-expanded="true"] {
    box-shadow: 0 0 0 3px var(--brand-wash);
}

.kk-plus-menu {
    width: 250px;
    top: calc(100% + 10px);
}

.kk-plus-menu button {
    align-items: center;
    padding: 10px;
}

.kk-plus-menu small {
    display: block;
    color: var(--ink-3);
    font-size: 12px;
}

.kk-plus-ico {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    flex: none;
}

.kk-plus-ico-event { background: #fdecea; color: #c2272d; }
.kk-plus-ico-poll { background: #eeedfe; color: #534ab7; }

/* ── Event cards ────────────────────────────────────────── */

.kk-event {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 14px;
    margin: 6px 0 12px;
    padding: 14px;
    border-radius: 12px;
    background: #f6f7f9;
    border: 1px solid var(--line);
}

.kk-event.is-past {
    opacity: 0.75;
}

.kk-date-tile {
    height: 66px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    overflow: hidden;
    text-align: center;
}

.kk-date-tile span {
    display: block;
    padding: 2px 0;
    background: var(--alert);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}

.kk-date-tile b {
    display: block;
    font-size: 24px;
    line-height: 1.6;
}

.kk-event-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
}

.kk-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    color: var(--ink-2);
    font-size: 13px;
}

.kk-meta svg {
    flex: none;
}

.kk-meta a {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.kk-event-over {
    color: var(--ink-3);
}

.kk-rsvp {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-top: 12px;
}

.kk-rsvp.is-busy {
    opacity: 0.6;
    pointer-events: none;
}

.kk-rsvp-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.kk-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.kk-pill:hover {
    border-color: #cfd3da;
}

.kk-pill.is-on {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

.kk-going {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    color: var(--ink-2);
    font-size: 13px;
}

.kk-going .kk-stack .kk-avatar {
    border-color: #f6f7f9;
}

/* ── Polls ──────────────────────────────────────────────── */

.kk-poll {
    margin: 4px 0 12px;
}

.kk-poll.is-busy {
    opacity: 0.6;
    pointer-events: none;
}

.kk-poll-q {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
}

.kk-poll-hint {
    margin: 2px 0 10px;
    color: var(--ink-3);
    font-size: 12.5px;
}

.kk-opt {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 9px 12px;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    background: var(--surface);
}

.kk-opt > *:not(.kk-opt-bar) {
    position: relative;
}

.kk-opt-bar {
    position: absolute;
    inset: 0 auto 0 0;
    background: #fde9b0;
}

.kk-opt.is-mine .kk-opt-bar {
    background: var(--brand);
}

.kk-opt-box {
    width: 20px;
    height: 20px;
    flex: none;
    border-radius: 6px;
    border: 2px solid var(--ink);
    background: var(--surface);
    display: grid;
    place-items: center;
    color: var(--ink);
}

.kk-poll-results .kk-opt-box:empty {
    border-color: var(--ink-3);
}

.kk-opt-label {
    flex: 1;
    min-width: 0;
    font-weight: 500;
}

.kk-opt-pct {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.kk-opt-voters .kk-avatar {
    border-color: var(--surface);
}

.kk-opt-choice {
    cursor: pointer;
}

.kk-opt-choice:hover {
    border-color: #cfd3da;
    background: var(--hover);
}

.kk-opt-choice input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.kk-opt-choice .kk-opt-box svg {
    opacity: 0;
}

.kk-opt-choice input[type="radio"] + .kk-opt-box {
    border-radius: 50%;
}

.kk-opt-choice input:checked + .kk-opt-box {
    background: var(--ink);
    color: #fff;
}

.kk-opt-choice input:checked + .kk-opt-box svg {
    opacity: 1;
}

.kk-opt-choice input:focus-visible + .kk-opt-box {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

.kk-poll-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 4px;
    color: var(--ink-2);
    font-size: 13px;
}

.kk-poll-form .kk-poll-foot .kk-btn-brand {
    margin-left: auto;
}

.kk-btn-small {
    padding: 7px 16px;
    font-size: 13.5px;
}

.kk-link-btn {
    border: 0;
    background: none;
    padding: 0;
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.kk-link-btn[hidden] {
    display: none;
}

.kk-poll-form + .kk-poll-results {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--line);
}

.kk-options {
    border: 0;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
}

.kk-options legend {
    margin-bottom: 6px;
}

.kk-option-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.kk-option-row .kk-mini-btn {
    border: 0;
    cursor: pointer;
}

.kk-option-row .kk-mini-btn[hidden] {
    display: none;
}

.kk-options .kk-link-btn {
    justify-self: start;
}

.kk-toggles {
    display: grid;
    gap: 8px;
}

/* ── Dialogs ────────────────────────────────────────────── */

.kk-dialog {
    width: min(520px, calc(100vw - 24px));
    max-height: calc(100vh - 48px);
    padding: 0;
    border: 0;
    border-radius: 16px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 24px 64px rgba(20, 24, 33, 0.28);
}

.kk-dialog::backdrop {
    background: rgba(20, 24, 33, 0.45);
}

.kk-dialog-form {
    display: grid;
    gap: 14px;
    padding: 18px 20px 20px;
}

.kk-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.kk-dialog-head h2 {
    font-size: 18px;
    font-weight: 600;
}

.kk-label {
    display: grid;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
}

.kk-label > span {
    color: var(--ink-3);
    font-weight: 400;
}

.kk-row2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
}

/* Form controls in grid and flex rows may shrink below their built-in width
   (20 columns, or a date picker's full width); WebKit otherwise keeps that
   width as a minimum and pushes the control out of a narrow dialog. */
.kk-label > .kk-field,
.kk-news-fields > input,
.kk-option-row > input {
    min-width: 0;
}

.kk-option-row > input {
    flex: 1;
}

.kk-option-row > .kk-mini-btn {
    flex: none;
}

.kk-field-area {
    height: auto;
    min-height: 96px;
    padding: 10px 14px;
    resize: vertical;
    line-height: 1.5;
}

.kk-dialog-tools {
    margin-top: -6px;
}

.kk-dialog-tools .kk-fmt-group {
    border-left: 0;
    padding-left: 0;
    margin-left: 0;
}

.kk-dialog-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.kk-dialog .kk-form-error:empty {
    display: none;
}

@media (max-width: 520px) {
    .kk-row2 {
        grid-template-columns: 1fr;
    }

    .kk-event {
        grid-template-columns: 52px minmax(0, 1fr);
        gap: 10px;
        padding: 12px;
    }

    .kk-going {
        margin-left: 0;
    }
}

/* ── Formatting buttons, files ──────────────────────────── */

.kk-fmt-group {
    display: inline-flex;
    gap: 2px;
    padding-left: 6px;
    margin-left: 2px;
    border-left: 1px solid var(--line);
}

.kk-fmt {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--ink-2);
    display: inline-grid;
    place-items: center;
    cursor: pointer;
}

.kk-fmt:hover {
    background: var(--hover);
    color: var(--ink);
}

.kk-post-body strong,
.kk-bubble-body strong {
    font-weight: 600;
}

.kk-post-body ul,
.kk-bubble-body ul {
    margin: 6px 0;
    padding-left: 22px;
}

.kk-post-body li,
.kk-bubble-body li {
    margin: 2px 0;
}

.kk-tile.kk-tile-file {
    width: auto;
    min-width: 170px;
    max-width: 240px;
    height: 64px;
    padding: 0 30px 0 12px;
    display: flex;
    align-items: center;
    background: var(--hover);
}

.kk-tile-doc {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.kk-tile-doc strong {
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kk-tile-doc small {
    font-size: 11.5px;
    color: var(--ink-3);
}

.kk-files {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 10px 0 6px;
}

.kk-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--ink);
    text-decoration: none;
}

.kk-file:hover {
    background: var(--hover);
}

.kk-file-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #e6f1fb;
    color: #185fa5;
    display: grid;
    place-items: center;
    flex: none;
}

.kk-file-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.kk-file-text strong {
    font-size: 13.5px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kk-file-text small {
    font-size: 12px;
    color: var(--ink-3);
}

.kk-file-get {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ink-2);
}

@media (max-width: 480px) {
    .kk-attach-label,
    .kk-file-get {
        display: none;
    }

    /* The reaction row opens from the Patinka button; on a comment that
       button sits well in from the edge, so the six faces get smaller slots
       to stay inside the card on a small phone. */
    .kk-picker {
        gap: 0;
        padding: 4px 5px;
    }

    .kk-picker-opt {
        font-size: 18px;
        padding: 2px;
    }
}

/* Three tabs and their counts do not fit a phone-width drawer; the names stay. */
@media (max-width: 400px) {
    .kk-w-tab small {
        display: none;
    }
}

/* ── Colour swatches (space settings) ───────────────────── */

.kk-swatches {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.kk-swatch {
    position: relative;
    cursor: pointer;
}

.kk-swatch input {
    position: absolute;
    opacity: 0;
    inset: 0;
    margin: 0;
    cursor: pointer;
}

.kk-swatch span:first-of-type {
    display: block;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.kk-swatch input:checked + span {
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink);
}

.kk-swatch input:focus-visible + span {
    outline: 2px solid var(--ink);
    outline-offset: 3px;
}

/* ── All spaces page ────────────────────────────────────── */

.space-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--card-radius);
    overflow: hidden;
    padding: 0;
}

.space-card-band {
    position: relative;
    height: 56px;
    background: var(--space-color);
}

.space-card-band svg.kk-band-art {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.space-card-band .kk-space-tile {
    position: absolute;
    left: 16px;
    bottom: -18px;
    border: 3px solid var(--surface);
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 17px;
}

.space-card-inner {
    padding: 26px 16px 16px;
}

.kk-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
}

/* ── Database hub ───────────────────────────────────────── */

.kk-hub {
    max-width: 960px;
    padding-top: 32px;
    padding-bottom: 56px;
}

.kk-hub-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.kk-hub-head p {
    margin-top: 4px;
    color: var(--ink-2);
}

.kk-hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.kk-link-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    color: var(--ink);
    text-decoration: none;
    transition: border-color 0.12s, transform 0.12s;
}

.kk-link-card:hover {
    border-color: var(--ink);
}

.kk-link-card:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

.kk-link-ico {
    width: 44px;
    height: 44px;
    flex: none;
    border-radius: 12px;
    background: var(--brand-wash);
    color: var(--brand-ink);
    display: grid;
    place-items: center;
}

.kk-link-text {
    flex: 1;
    min-width: 0;
}

.kk-link-text strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

.kk-link-text span {
    display: block;
    color: var(--ink-3);
    font-size: 12.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kk-link-go {
    color: var(--ink-3);
}

.kk-hub-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--ink-3);
}

.kk-hub-empty p {
    margin-top: 8px;
}

/* ── Account settings ───────────────────────────────────── */

.kk-settings {
    max-width: 720px;
    padding-top: 32px;
    padding-bottom: 56px;
}

.kk-settings-lead {
    margin: 6px 0 20px;
    color: var(--ink-2);
}

.kk-settings-card {
    padding: 8px 20px 20px;
}

.kk-settings-card h2 {
    font-size: 16px;
    font-weight: 600;
    padding: 14px 0 6px;
}

.kk-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
    cursor: pointer;
}

.kk-toggle-text strong {
    display: block;
    font-weight: 600;
    font-size: 14.5px;
}

.kk-toggle-text span {
    display: block;
    margin-top: 2px;
    color: var(--ink-2);
    font-size: 13px;
    line-height: 1.45;
}

.kk-switch {
    position: relative;
    flex: none;
    width: 46px;
    height: 26px;
}

.kk-switch input {
    position: absolute;
    inset: 0;
    opacity: 0;
    margin: 0;
    cursor: pointer;
}

.kk-switch span {
    position: absolute;
    inset: 0;
    border-radius: 13px;
    background: #d3d7de;
    transition: background 0.15s;
    pointer-events: none;
}

.kk-switch span::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(20, 24, 33, 0.25);
    transition: transform 0.15s;
}

.kk-switch input:checked + span {
    background: var(--ink);
}

.kk-switch input:checked + span::after {
    transform: translateX(20px);
}

.kk-switch input:focus-visible + span {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

.kk-settings-foot {
    display: flex;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

/* ── Drawers for narrower screens ───────────────────────── */

.kk-side-scrim {
    display: none;
}

@media (max-width: 1100px) {
    .kk-shell {
        grid-template-columns: 240px minmax(0, 1fr);
    }

    .kk-drawer-bar {
        display: flex;
    }

    .kk-drawer-bar #chatDrawerToggle {
        display: none;
    }

    .kk-side {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 70;
        width: min(340px, 88vw);
        max-height: none;
        padding: 16px;
        background: var(--canvas);
        box-shadow: -12px 0 32px rgba(20, 24, 33, 0.16);
        transform: translateX(105%);
        transition: transform 0.2s ease;
    }

    .kk-side.open {
        transform: none;
    }

    .kk-side-scrim.open {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 65;
        background: rgba(20, 24, 33, 0.35);
    }
}

@media (max-width: 900px) {
    .kk-shell {
        grid-template-columns: minmax(0, 1fr);
        max-width: 640px;
        padding: 12px 12px 48px;
    }

    .kk-drawer-bar #chatDrawerToggle {
        display: inline-flex;
    }

    .kk-left {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 70;
        width: min(300px, 86vw);
        max-height: none;
        padding: 16px;
        background: var(--canvas);
        box-shadow: 12px 0 32px rgba(20, 24, 33, 0.16);
        transform: translateX(-105%);
        transition: transform 0.2s ease;
    }

    .kk-left.open {
        transform: none;
    }
}

@media (max-width: 768px) {
    .kk-post .kk-shots {
        margin-left: -16px;
        margin-right: -16px;
    }

    .kk-cover-art {
        height: 96px;
    }
}

/* The account menu carries the admin link too, so the bar drops its copy
   before the workspace name has to give way. */
@media (max-width: 1200px) {
    .kk-admin-link {
        display: none;
    }

    .kk-tab {
        padding: 0 14px;
    }
}

/* ── Profile drawer and messages ─────────────────────────── */

.kk-avatar-xl { width: 72px; height: 72px; font-size: 24px; }

img.kk-avatar-img {
    display: inline-block;
    object-fit: cover;
    background: var(--hover);
    flex: none;
}

.kk-drawer-scrim {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(20, 24, 33, 0.35);
}

.kk-drawer-scrim[hidden] {
    display: none;
}

.kk-profile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    width: min(400px, 100vw);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    box-shadow: -16px 0 40px rgba(20, 24, 33, 0.18);
}

.kk-profile-drawer[hidden] {
    display: none;
}

body.kk-drawer-open {
    overflow: hidden;
}

.kk-pd-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}

.kk-pd-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-2);
}

.kk-pd-who {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--line);
}

.kk-pd-id {
    display: flex;
    align-items: center;
    gap: 16px;
}

.kk-pd-id h2 {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
}

.kk-pd-role {
    margin-top: 2px;
    color: var(--ink-2);
    font-size: 14px;
}

.kk-pd-bio {
    margin-top: 14px;
    color: var(--ink);
    font-size: 14px;
    line-height: 1.55;
}

.kk-pd-loading,
.kk-pd-empty,
.kk-pd-note {
    color: var(--ink-3);
    font-size: 13.5px;
    text-align: center;
    padding: 24px 12px;
}

.kk-pd-note a {
    color: var(--ink);
    font-weight: 500;
}

.kk-pd-thread {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8f9fb;
}

.kk-dm-msg {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 82%;
}

.kk-dm-msg.is-mine {
    align-self: flex-end;
    align-items: flex-end;
}

.kk-dm-bubble {
    padding: 8px 12px;
    border-radius: 16px 16px 16px 4px;
    background: var(--surface);
    border: 1px solid var(--line);
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.kk-dm-msg.is-mine .kk-dm-bubble {
    border-radius: 16px 16px 4px 16px;
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

.kk-dm-msg.is-mine .kk-dm-bubble a {
    color: #fff;
}

.kk-dm-who {
    display: block;
    font-size: 11.5px;
    font-weight: 600;
    opacity: 0.7;
    margin-bottom: 1px;
}

.kk-dm-time {
    margin-top: 3px;
    color: var(--ink-3);
    font-size: 11px;
}

.kk-pd-send {
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--line);
}

.kk-pd-send[hidden] {
    display: none;
}

.kk-pd-send .kk-form-error:empty {
    display: none;
}

.kk-pd-send-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.kk-pd-send textarea {
    flex: 1;
    /* A textarea's built-in width (20 columns) is its minimum in a flex row,
       and WebKit will not shrink it below that: without this the Siųsti
       button is pushed out of the drawer. The composer and comment boxes in
       feed.css carry the same guard. */
    min-width: 0;
    min-height: 42px;
    max-height: 140px;
    padding: 10px 14px;
    border: 1px solid transparent;
    border-radius: 21px;
    background: var(--hover);
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    resize: none;
}

.kk-pd-send textarea:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--ink);
}

.kk-pd-send .kk-btn-brand {
    flex: none;
    height: 42px;
    white-space: nowrap;
}

/* Bell inbox */

.kk-bell-menu {
    width: 340px;
    max-height: 420px;
    overflow-y: auto;
}

.kk-menu-empty {
    padding: 14px 10px;
    color: var(--ink-3);
    font-size: 13px;
}

.kk-menu .kk-inbox-row {
    align-items: center;
    gap: 10px;
}

.kk-inbox-text {
    flex: 1;
    min-width: 0;
}

.kk-inbox-text strong {
    display: block;
    font-weight: 500;
    font-size: 14px;
}

.kk-inbox-text span {
    display: block;
    color: var(--ink-3);
    font-size: 12.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kk-inbox-row.is-unread strong {
    font-weight: 700;
}

.kk-inbox-row.is-unread .kk-inbox-text span {
    color: var(--ink);
}

.kk-inbox-count,
.kk-dir-unread {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--alert);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    display: inline-grid;
    place-items: center;
    flex: none;
}

.kk-dir-row .kk-dir-unread {
    margin-left: 4px;
}

/* Toasts */

.kk-toasts {
    position: fixed;
    right: 20px;
    bottom: calc(20px + var(--tabbar-height));
    z-index: 95;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.kk-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(360px, calc(100vw - 40px));
    padding: 12px 16px;
    border: 0;
    border-radius: 12px;
    background: var(--ink);
    color: #fff;
    font: inherit;
    font-size: 14px;
    text-align: left;
    box-shadow: 0 12px 32px rgba(20, 24, 33, 0.25);
    cursor: pointer;
    animation: kk-toast-in 0.2s ease-out;
    transition: opacity 0.3s, transform 0.3s;
}

.kk-toast::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand);
    flex: none;
}

.kk-toast.is-leaving {
    opacity: 0;
    transform: translateY(6px);
}

@keyframes kk-toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.kk-name[data-user-id] {
    cursor: pointer;
}

.kk-name[data-user-id]:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

@media (max-width: 768px) {
    .kk-bell-menu {
        position: fixed;
        top: var(--header-height);
        left: 8px;
        right: 8px;
        width: auto;
    }
}

/* ── Mobile tab bar ─────────────────────────────────────── */

.kk-tabbar {
    display: none;
}

@media (max-width: 768px) {
    :root {
        --tabbar-height: 60px;
    }

    .kk-top-inner {
        grid-template-columns: 1fr auto;
        padding: 0 16px;
    }

    .kk-tabs,
    .kk-admin-link,
    .kk-me-name {
        display: none;
    }

    .kk-tabbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 50;
        height: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: var(--surface);
        border-top: 1px solid var(--line);
        display: grid;
        grid-template-columns: repeat(5, 1fr);
    }

    .kk-tabbar a,
    .kk-tabbar button {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        border: 0;
        background: none;
        color: var(--ink-2);
        font: inherit;
        font-size: 11px;
        font-weight: 500;
        text-decoration: none;
        cursor: pointer;
    }

    .kk-tabbar .is-on {
        color: var(--ink);
    }

    .kk-tabbar .is-on::before {
        content: '';
        position: absolute;
        top: 0;
        left: 30%;
        right: 30%;
        height: 3px;
        border-radius: 0 0 3px 3px;
        background: var(--brand);
    }

    .kk-tabbar .kk-badge-count {
        top: 6px;
        right: calc(50% - 20px);
    }

    body {
        padding-bottom: var(--tabbar-height);
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        scroll-behavior: auto !important;
    }
}
