/*
 * Kinlytix — Genealogy Research & DNA Collaboration Platform
 *
 * Phone app shell — bottom tab bar, More sheet, compact in-page nav.
 * Desktop chrome is unchanged; rules apply with body.kinlytix-nav-phone.
 *
 * Copyright (c) 2026 Z-Factor PM, LLC. All rights reserved.
 * Unauthorized copying of this file, via any medium, is strictly prohibited.
 *
 * @author     Suzanne St. John <suzanne@kinlytix.com>
 * @copyright  2026 Z-Factor PM, LLC
 * @license    Proprietary — All Rights Reserved
 */

.kin-phone-tabbar,
.kin-phone-more,
.kin-phone-more-overlay {
    display: none;
}

.kin-drawer-close {
    display: none;
}

.kin-drawer-heading {
    display: contents;
}

html.kinlytix-nav-phone .kin-drawer-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 12px;
}

html.kinlytix-nav-phone .kin-drawer-heading h3,
html.kinlytix-nav-phone .kin-drawer-heading .left-nav-title,
html.kinlytix-nav-phone .kin-drawer-heading .community-subnav-title {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
}

html.kinlytix-nav-phone .kin-drawer-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 1px solid #d5decd;
    border-radius: 8px;
    background: #fafcf8;
    color: #1a1a1a;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

html.kinlytix-nav-phone .member-privacy-heading-row .kin-drawer-close {
    margin-left: auto;
}

html.kinlytix-nav-phone .right-online > .member-privacy-heading-row {
    flex-wrap: nowrap;
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) and (max-width: 1366px) {
    body:has(#kin-phone-tabbar) {
        --kin-phone-tabbar-height: 64px;
        padding-bottom: calc(var(--kin-phone-tabbar-height, 64px) + env(safe-area-inset-bottom, 0px));
    }

    body:has(#kin-phone-tabbar) #kin-phone-tabbar {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1300;
        align-items: stretch;
        justify-content: space-around;
        gap: 0;
        margin: 0;
        padding: 8px 2px calc(12px + env(safe-area-inset-bottom, 0px));
        list-style: none;
        background: #fff;
        border-top: 1px solid var(--border-gray, #e0e0e0);
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    }

    body:has(#kin-phone-tabbar) .nav-menu-toggle {
        display: none !important;
    }
}

body.kinlytix-nav-phone.kin-has-phone-tabbar {
    padding-bottom: calc(var(--kin-phone-tabbar-height, 64px) + env(safe-area-inset-bottom, 0px));
}

body.kinlytix-nav-phone.kin-has-phone-tabbar .kin-phone-tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1300;
    align-items: stretch;
    justify-content: space-around;
    gap: 0;
    margin: 0;
    padding: 8px 2px calc(12px + env(safe-area-inset-bottom, 0px));
    list-style: none;
    background: #fff;
    border-top: 1px solid var(--border-gray, #e0e0e0);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
}

.kin-phone-tab {
    position: relative;
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    min-height: 52px;
    padding: 6px 2px;
    border: 0;
    background: transparent;
    color: #4a5f42;
    text-decoration: none;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.15;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

#kin-phone-tab-chat .unread-badge,
#kin-phone-chat-badge {
    position: absolute;
    top: 2px;
    right: 50%;
    margin-right: -18px;
    background: #e24b4a;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-sizing: border-box;
    line-height: 1;
}

.kin-phone-tab svg {
    display: block;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

.kin-phone-tab-avatar,
.kin-phone-tab img.kin-phone-tab-avatar {
    display: block;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
    background: #e8f0e4;
}

.kin-phone-tab[aria-current="page"],
.kin-phone-tab.is-active {
    color: #2e4a22;
}

.kin-phone-tab[aria-current="page"] svg,
.kin-phone-tab.is-active svg {
    color: #3a5a2c;
}

.kin-phone-tab[aria-current="page"] .kin-phone-tab-avatar,
.kin-phone-tab.is-active .kin-phone-tab-avatar {
    box-shadow: 0 0 0 2px #3a5a2c;
}

.kin-phone-tab-label {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

body.kinlytix-nav-phone.kin-has-phone-tabbar .kin-phone-more-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1390;
    margin: 0;
    border: 0;
    padding: 0;
    background: rgba(17, 24, 39, 0.45);
    cursor: pointer;
}

body.kinlytix-nav-phone.kin-has-phone-tabbar .kin-phone-more {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1400;
    max-height: min(88vh, 640px);
    padding: 0 0 calc(var(--kin-phone-tabbar-height, 64px) + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
    transform: translateY(110%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.22s ease, visibility 0.22s ease;
}

body.kinlytix-nav-phone.kin-has-phone-tabbar.kin-phone-more-open {
    overflow: hidden;
}

body.kinlytix-nav-phone.kin-has-phone-tabbar.kin-phone-more-open .kin-phone-more-overlay {
    display: block;
}

body.kinlytix-nav-phone.kin-has-phone-tabbar.kin-phone-more-open .kin-phone-more {
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
}

.kin-phone-more-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    padding: 14px 16px 10px;
    border-bottom: 1px solid #e8eee4;
}

.kin-phone-more-header h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #2e4a22;
}

.kin-phone-more-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: #f0f4eb;
    color: #2e4a22;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.kin-phone-more-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 16px 20px;
}

.kin-phone-more-section {
    margin: 14px 0 0;
}

.kin-phone-more-section:first-child {
    margin-top: 4px;
}

.kin-phone-more-section h3 {
    margin: 0 0 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6d8659;
}

.kin-phone-more-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kin-phone-more-list a,
.kin-phone-more-list button.kin-phone-more-btn {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: #f7faf4;
    color: #2e4a22;
    font-size: 15px;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
}

.kin-phone-more-list a:hover,
.kin-phone-more-list button.kin-phone-more-btn:hover,
.kin-phone-more-list a.is-active,
.kin-phone-more-list a.active {
    background: #e8f0e2;
}

.kin-phone-more-list .nav-logout-form {
    display: flex;
    margin: 0;
}

.kin-phone-more-list .nav-logout-form .kin-phone-more-btn {
    width: 100%;
}

.kin-phone-more-list a.danger-link {
    color: #b42318;
}

.kin-pwa-install-help {
    margin: 4px 0 8px;
    padding: 10px 12px;
    background: #f5f8f4;
    border: 1px solid #e2e8df;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.45;
    color: #2a2a2a;
}

.kin-pwa-install-help p {
    margin: 0;
}

#kin-phone-more-area .profile-nav,
#kin-phone-more-area .community-subnav-links,
#kin-phone-more-area .community-nav-rooms,
#kin-phone-more-area .left-nav-inner {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#kin-phone-more-area .profile-nav-link,
#kin-phone-more-area .community-subnav-link,
#kin-phone-more-area .left-nav-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: #f7faf4;
    color: #2e4a22;
    font-size: 15px;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
}

#kin-phone-more-area .left-nav-btn .text,
#kin-phone-more-area .left-nav-btn .count-pill {
    display: inline !important;
}

#kin-phone-more-area .left-label {
    gap: 6px;
}

#kin-phone-more-area .profile-nav-link-meta,
#kin-phone-more-area .nav-drag-hint,
#kin-phone-more-area .profile-nav-kinny-pose {
    display: none;
}

#kin-phone-more-area .kin-livingtrees-wordmark--nav {
    height: 22px;
    width: auto;
}

body.kinlytix-nav-phone.kin-has-phone-tabbar .nav-menu-toggle {
    display: none !important;
}

body.kinlytix-nav-phone.kin-has-phone-tabbar .kin-help-assist-header-pin {
    display: none !important;
}

body.kinlytix-nav-phone.kin-has-phone-tabbar .nav-panel {
    display: block !important;
    position: static !important;
    max-height: none !important;
    overflow: visible !important;
    margin: 0 0 0 auto !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

body.kinlytix-nav-phone.kin-has-phone-tabbar .nav-links,
body.kinlytix-nav-phone.kin-has-phone-tabbar .nav-links-right {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 4px !important;
    width: auto !important;
}

body.kinlytix-nav-phone.kin-has-phone-tabbar .nav-links > li {
    display: none !important;
}

body.kinlytix-nav-phone.kin-has-phone-tabbar .nav-notify-item {
    display: flex !important;
    width: auto !important;
}

body.kinlytix-nav-phone.kin-has-phone-tabbar .nav-chat-item {
    display: none !important;
}

body.kinlytix-nav-phone.kin-has-phone-tabbar .nav-notify-item > a {
    padding: 6px !important;
}

body.kinlytix-nav-phone.kin-has-phone-tabbar #chat-toggle-btn {
    display: none !important;
}

body.kinlytix-nav-phone.kin-has-phone-tabbar #kinlytix-chat-widget {
    width: 0;
    height: 0;
    overflow: visible;
    bottom: 0;
    right: 0;
    pointer-events: none;
}

body.kinlytix-nav-phone.kin-has-phone-tabbar #kinlytix-chat-panel {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    z-index: 2147483001;
    pointer-events: auto;
}

body.kinlytix-nav-phone.kin-has-phone-tabbar .community-subnav-wrap {
    display: block;
    background: transparent;
    border-bottom: 0;
}

html.kinlytix-nav-phone .community-mobile-nav {
    display: flex;
    gap: 8px;
    padding: 8px 12px 10px;
    background: #fff;
    border-bottom: 1px solid #e2e8df;
}

html.kinlytix-nav-phone .community-nav-toggle {
    display: inline-flex;
    flex: 1 1 0;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--sage-green);
    color: #fff;
    border-radius: 8px;
    padding: 10px 8px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
}

html.kinlytix-nav-phone .community-subnav {
    display: none;
}

html.kinlytix-nav-phone .community-subnav-wrap.community-nav-open .community-subnav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 8px;
    position: fixed;
    top: 0;
    left: 0;
    width: min(300px, 92vw);
    height: calc(100dvh - var(--kin-phone-tabbar-height, 56px) - env(safe-area-inset-bottom, 0px));
    z-index: 1500;
    margin: 0;
    padding: 16px 12px;
    overflow-x: hidden;
    overflow-y: auto;
    background: #fff;
    box-shadow: 0 8px 28px rgba(17, 24, 39, 0.18);
}

html.kinlytix-nav-phone .community-subnav-wrap.community-nav-open .community-subnav-title {
    flex: 0 0 auto;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

html.kinlytix-nav-phone .community-subnav-wrap.community-nav-open .community-subnav-links {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 6px;
    min-width: 0;
    overflow: visible;
}

html.kinlytix-nav-phone .community-subnav-wrap.community-nav-open .community-subnav-link {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8df;
    background: #f7faf4;
    color: #2e4a22;
    white-space: normal;
    box-sizing: border-box;
}

html.kinlytix-nav-phone .community-nav-phone-only {
    display: flex;
}

html.kinlytix-nav-phone .community-nav-rooms {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    width: 100%;
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px solid #e2e8df;
}

html.kinlytix-nav-phone .chatrooms-bar {
    display: none !important;
}

html.kinlytix-nav-phone .community-subnav-wrap.community-nav-open .community-drawer-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: calc(var(--kin-phone-tabbar-height, 56px) + env(safe-area-inset-bottom, 0px));
    background: rgba(17, 24, 39, 0.45);
    z-index: 1400;
    border: 0;
    padding: 0;
    cursor: pointer;
}

body.kinlytix-nav-phone.kin-has-phone-tabbar .workspace-toolbar-wrap {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(var(--kin-phone-tabbar-height, 64px) + 8px);
    z-index: 1260;
    width: auto;
    max-width: none;
    background: transparent;
    box-shadow: none;
    pointer-events: none;
}

body.kinlytix-nav-phone.kin-has-phone-tabbar .workspace-toolbar-brand,
body.kinlytix-nav-phone.kin-has-phone-tabbar .workspace-toolbar-collapse,
body.kinlytix-nav-phone.kin-has-phone-tabbar .workspace-toolbar-directories,
body.kinlytix-nav-phone.kin-has-phone-tabbar .kn-tray-main {
    display: none !important;
}

body.kinlytix-nav-phone.kin-has-phone-tabbar .kn-tray-panel {
    pointer-events: auto;
    max-height: 50vh;
    overflow: auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

body.kinlytix-nav-phone .pa-view-tabs,
body.kinlytix-nav-phone .mm-section-tabs,
body.kinlytix-nav-phone .kinny-lists-detail-tabs,
body.kinlytix-nav-phone .tab-nav,
body.kinlytix-nav-phone .top-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

body.kinlytix-nav-phone .floating-online-btn {
    bottom: calc(18px + var(--kin-phone-tabbar-height, 64px)) !important;
}

/*
 * Embed iframe documents do not inherit body.kinlytix-nav-phone from the parent.
 * These rules use viewport width so members, PA, research, financials, etc. collapse.
 */
@media (max-width: 768px) {
    html.embed-root,
    body.embed-mode {
        max-width: 100%;
        overflow-x: hidden;
    }

    .container {
        max-width: 100%;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .module-embed,
    .profile-main,
    .profile-layout,
    .pa-unified-frame,
    .tasks-module-shell,
    .tasks-view-panel {
        min-width: 0;
        max-width: 100%;
    }

    .grid,
    .form-row,
    .kin-entity-merge-grid,
    .pm-phase2-split-layout,
    .kkb-modal-body.pm-phase2-form-grid,
    .blog-option-row {
        grid-template-columns: 1fr !important;
    }

    .grid-4 {
        grid-template-columns: 1fr 1fr !important;
    }

    .page-header,
    .page-header-title-row,
    .page-head-row,
    .ledger-head,
    .entry-head,
    .section-header,
    .section-header--members,
    .page-header-title-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header h1 {
        flex-wrap: wrap;
        font-size: 22px;
    }

    .filters-bar,
    .view-toggle,
    .pa-inline-actions,
    .panel-toolbar,
    .member-actions {
        max-width: 100%;
    }

    .view-toggle,
    .pa-view-tabs,
    .mm-section-tabs,
    .kinny-lists-detail-tabs,
    .tab-nav,
    .top-tabs,
    .fin-section-tabs,
    .kkb-view-toggle {
        display: flex;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        max-width: 100%;
    }

    table {
        max-width: 100%;
    }

    .members-roster-scroll,
    .tasks-table-scroll,
    .kin-treasury-table-wrap,
    .gantt-scroll,
    .kkb-board,
    .kit-board-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    .entities-grid {
        grid-template-columns: 1fr !important;
    }

    .links-row,
    .links-row-ledger {
        grid-template-columns: 1fr !important;
    }

    .kit-board-workspace {
        max-height: none;
        flex-direction: column;
    }

    body.pm-tasks-shell-content.embed-mode {
        overflow: visible;
    }
}

/*
 * iPad / tablet: JS sets html.kinlytix-nav-phone (viewport is often 769–1366px,
 * so the 768px profile/embed rules never fire). Match the phone layout.
 */
html.kinlytix-nav-phone .overview-grid,
html.kinlytix-nav-phone .card-grid,
html.kinlytix-nav-phone .kin-form-row {
    grid-template-columns: 1fr;
}

html.kinlytix-nav-phone .kin-profile-stats {
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

html.kinlytix-nav-phone .kin-profile-banner {
    height: 120px;
}

html.kinlytix-nav-phone .kin-profile-identity {
    display: flex;
    align-items: center;
    gap: 12px;
}

html.kinlytix-nav-phone .kin-profile-picture-container {
    position: static;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    margin: 0;
    transform: none;
    z-index: 1;
    flex: 0 0 auto;
}

html.kinlytix-nav-phone .kin-profile-header .kin-profile-picture,
html.kinlytix-nav-phone .kin-profile-header .kin-profile-picture.kin-profile-badge,
html.kinlytix-nav-phone .kin-profile-picture-container .kin-profile-badge,
html.kinlytix-nav-phone .kin-profile-picture-container img,
html.kinlytix-nav-phone .kin-profile-picture-placeholder {
    width: 72px !important;
    height: 72px !important;
    max-width: 72px !important;
    max-height: 72px !important;
    border-width: 3px;
    font-size: 28px;
    box-sizing: border-box;
}

html.kinlytix-nav-phone .kin-profile-header {
    padding: 12px 16px 10px;
    min-height: 0;
    overflow: visible;
}

html.kinlytix-nav-phone .kin-profile-identity-text {
    flex: 1 1 auto;
    min-width: 0;
}

html.kinlytix-nav-phone .kin-profile-info {
    min-width: 0;
    padding-top: 10px;
}

html.kinlytix-nav-phone .kin-notification-icons {
    display: none;
}

html.kinlytix-nav-phone .kin-profile-header h1 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    line-height: 1.25;
    margin-bottom: 2px;
    overflow: hidden;
}

html.kinlytix-nav-phone .kin-profile-header .kin-username {
    font-size: 13px;
    margin-bottom: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

html.kinlytix-nav-phone .kin-header-settings-btn {
    flex-shrink: 0;
    width: auto;
    height: 32px;
    margin-left: auto;
    padding: 0 10px;
    border-radius: 8px;
    gap: 4px;
    font-size: 13px;
    font-weight: 700;
}

html.kinlytix-nav-phone .kin-tab-content {
    padding: 16px;
}

html.kinlytix-nav-phone .kin-profile-container {
    padding: 0 10px;
}

html.kinlytix-nav-phone .entry-row {
    flex-direction: column;
    gap: 6px;
}

html.kinlytix-nav-phone .entry-row input {
    width: 100% !important;
}

html.kinlytix-nav-phone .profile-shell {
    margin: 0 0 16px;
    padding: 0;
    overflow-x: hidden;
}

html.kinlytix-nav-phone .profile-shell > .section-card {
    margin-left: 12px;
    margin-right: 12px;
}

html.kinlytix-nav-phone .profile-grid {
    grid-template-columns: minmax(0, 1fr);
    padding: 0 12px;
    gap: 0;
}

html.kinlytix-nav-phone .profile-left,
html.kinlytix-nav-phone .profile-right {
    display: none;
}

html.kinlytix-nav-phone .profile-center {
    min-width: 0;
    max-width: 100%;
    min-height: 0;
    overflow-x: hidden;
}

html.kinlytix-nav-phone .profile-tab-panels {
    padding: 10px;
    min-width: 0;
}

html.kinlytix-nav-phone .profile-shell .profile-center .top-tabs {
    display: none !important;
}

html.kinlytix-nav-phone .left-nav-mobile-tabs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 0 12px;
    padding: 0 0 12px;
    border-bottom: 1px solid #e2e8df;
}

html.kinlytix-nav-phone .left-nav-mobile-tabs .left-nav-btn {
    cursor: pointer;
}

html.kinlytix-nav-phone #leftNavSortable .left-nav-btn[data-left-target="left-newsfeed"] {
    display: none !important;
}

html.kinlytix-nav-phone .kin-banner-edit-controls {
    display: none !important;
}

html.kinlytix-nav-phone .sub-tabs {
    display: flex;
    flex-wrap: nowrap;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

html.kinlytix-nav-phone .sub-tab-btn {
    flex: 0 0 auto;
}

html.kinlytix-nav-phone .profile-mobile-nav {
    display: flex;
    gap: 8px;
    padding: 8px 12px 10px;
    background: #fff;
    border-bottom: 1px solid #e2e8df;
}

html.kinlytix-nav-phone .mobile-left-toggle,
html.kinlytix-nav-phone .mobile-online-toggle {
    display: inline-flex;
    flex: 1 1 0;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--sage-green);
    color: #fff;
    border-radius: 8px;
    padding: 10px 8px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
}

html.kinlytix-nav-phone .profile-shell.left-drawer-open .profile-left,
html.kinlytix-nav-phone .profile-shell.mobile-online-open .profile-right {
    display: block;
    position: fixed;
    top: 0;
    width: min(300px, 92vw);
    height: calc(100dvh - var(--kin-phone-tabbar-height, 56px) - env(safe-area-inset-bottom, 0px));
    z-index: 1500;
    margin: 0;
    border-radius: 0;
    overflow-y: auto;
}

html.kinlytix-nav-phone .profile-shell.left-drawer-open .profile-left {
    left: 0;
    right: auto;
}

html.kinlytix-nav-phone .profile-shell.mobile-online-open .profile-right {
    right: 0;
    left: auto;
}

html.kinlytix-nav-phone .profile-shell.left-drawer-open .profile-left .left-nav,
html.kinlytix-nav-phone .profile-shell.mobile-online-open .profile-right .right-online {
    position: static;
    min-height: 100%;
}

html.kinlytix-nav-phone .profile-shell.left-drawer-open .left-nav-btn {
    justify-content: space-between;
    padding: 10px 12px;
}

html.kinlytix-nav-phone .profile-shell.left-drawer-open .left-nav-btn .text,
html.kinlytix-nav-phone .profile-shell.left-drawer-open .left-nav-btn .count-pill {
    display: inline !important;
}

html.kinlytix-nav-phone .profile-shell.left-drawer-open .left-label {
    gap: 6px;
}

html.kinlytix-nav-phone .floating-online-btn {
    display: none;
}

html.kinlytix-nav-phone .profile-header-action-row {
    display: flex;
    gap: 8px;
    margin: 8px 0 0;
    flex-wrap: wrap;
}

html.kinlytix-nav-phone.embed-root,
html.kinlytix-nav-phone body.embed-mode {
    max-width: 100%;
    overflow-x: hidden;
}

html.kinlytix-nav-phone .container {
    max-width: 100%;
    padding-left: 12px !important;
    padding-right: 12px !important;
}

html.kinlytix-nav-phone .module-embed,
html.kinlytix-nav-phone .profile-main,
html.kinlytix-nav-phone .profile-layout,
html.kinlytix-nav-phone .pa-unified-frame,
html.kinlytix-nav-phone .tasks-module-shell,
html.kinlytix-nav-phone .tasks-view-panel {
    min-width: 0;
    max-width: 100%;
}

html.kinlytix-nav-phone .grid,
html.kinlytix-nav-phone .form-row,
html.kinlytix-nav-phone .kin-entity-merge-grid,
html.kinlytix-nav-phone .pm-phase2-split-layout,
html.kinlytix-nav-phone .kkb-modal-body.pm-phase2-form-grid,
html.kinlytix-nav-phone .blog-option-row {
    grid-template-columns: 1fr !important;
}

html.kinlytix-nav-phone .grid-4 {
    grid-template-columns: 1fr 1fr !important;
}

html.kinlytix-nav-phone .page-header,
html.kinlytix-nav-phone .page-header-title-row,
html.kinlytix-nav-phone .page-head-row,
html.kinlytix-nav-phone .ledger-head,
html.kinlytix-nav-phone .entry-head,
html.kinlytix-nav-phone .section-header,
html.kinlytix-nav-phone .section-header--members,
html.kinlytix-nav-phone .page-header-title-actions {
    flex-direction: column;
    align-items: stretch;
}

html.kinlytix-nav-phone .entities-grid,
html.kinlytix-nav-phone .links-row,
html.kinlytix-nav-phone .links-row-ledger {
    grid-template-columns: 1fr !important;
}

html.kinlytix-nav-phone .kit-board-workspace {
    max-height: none;
    flex-direction: column;
}

html.kinlytix-nav-phone body.pm-tasks-shell-content.embed-mode {
    overflow: visible;
}

html.kinlytix-nav-phone #tab-dna {
    max-width: 100%;
    overflow-x: hidden;
}

html.kinlytix-nav-phone .dna-kit-toolbar {
    display: none !important;
}

html.kinlytix-nav-phone #tab-dna > .section-card[data-kin-tour="dna-intro"] {
    flex-direction: column;
    align-items: stretch;
}

html.kinlytix-nav-phone .profile-card.dna-match-row {
    flex-wrap: wrap;
    align-items: flex-start;
    max-width: 100%;
    min-width: 0;
}

html.kinlytix-nav-phone .dna-match-row__person,
html.kinlytix-nav-phone .dna-match-row__metrics,
html.kinlytix-nav-phone .dna-match-row__group,
html.kinlytix-nav-phone .dna-match-row__actions {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

html.kinlytix-nav-phone .dna-match-row__metrics,
html.kinlytix-nav-phone .dna-match-row__actions {
    text-align: left;
    justify-content: stretch;
}

html.kinlytix-nav-phone .dna-match-row__identity {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}

html.kinlytix-nav-phone .dna-match-relationships {
    flex-direction: column;
    align-items: stretch;
    max-width: 100%;
}

html.kinlytix-nav-phone .badge-relationship-predicted,
html.kinlytix-nav-phone .badge-relationship-actual {
    white-space: normal;
    max-width: 100%;
}

html.kinlytix-nav-phone .dna-match-actual-rel-label {
    display: flex;
    width: 100%;
    min-width: 0;
}

html.kinlytix-nav-phone .dna-match-actual-rel-input {
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
    min-width: 0;
}

html.kinlytix-nav-phone .dna-match-row__actions .btn-message,
html.kinlytix-nav-phone .dna-match-row__tree-only {
    display: flex;
    width: 100%;
    text-align: center;
    justify-content: center;
    box-sizing: border-box;
}

/*
 * Project dashboard: center-only + drawers (same pattern as Profile).
 * Applies whenever phone chrome is on, including iPad landscape >1024px.
 */
html.kinlytix-nav-phone #projectPageHeader {
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
    box-sizing: border-box;
    padding: 8px 12px;
    margin-bottom: 6px;
}

html.kinlytix-nav-phone #projectPageHeader.page-header--summary-open {
    padding: 10px 12px;
    margin-bottom: 18px;
}

html.kinlytix-nav-phone #projectPageHeader.page-header--summary-collapsed {
    padding: 8px 12px;
}

html.kinlytix-nav-phone #projectPageHeader .page-header-title-row,
html.kinlytix-nav-phone #projectPageHeader .page-header-title-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    gap: 8px;
}

html.kinlytix-nav-phone #projectPageHeader h1 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    font-size: 18px;
    overflow-wrap: anywhere;
}

html.kinlytix-nav-phone #projectPageHeader .header-project-select {
    grid-column: 1;
    width: 100%;
    max-width: 100% !important;
    min-width: 0;
    font-size: 18px;
    box-sizing: border-box;
}

html.kinlytix-nav-phone #projectPageHeader .settings-icon {
    grid-column: 2;
    flex-shrink: 0;
}

html.kinlytix-nav-phone #projectPageHeader .make-default-btn {
    grid-column: 1 / -1;
    width: 100%;
    white-space: normal;
    text-align: center;
    box-sizing: border-box;
}

html.kinlytix-nav-phone #projectPageHeader .project-summary-body {
    display: none !important;
}

html.kinlytix-nav-phone #projectPageHeader.page-header--summary-open .project-summary-body {
    display: block !important;
}

html.kinlytix-nav-phone #projectPageHeader .page-header-edit-link {
    display: none !important;
}

html.kinlytix-nav-phone .dashboard-nav-edit-profile {
    display: flex;
    margin-top: 8px;
    border: 1px solid #d5decd;
    background: #fafcf8;
}

html.kinlytix-nav-phone #projectPageHeader .header-action-btn {
    display: none !important;
}

html.kinlytix-nav-phone #projectPageHeader .project-summary-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    white-space: normal;
    text-align: center;
}

html.kinlytix-nav-phone #projectPageHeader .project-summary-body,
html.kinlytix-nav-phone #projectPageHeader .project-header-subtitle,
html.kinlytix-nav-phone #projectPageHeader .project-header-tags {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}

html.kinlytix-nav-phone #projectPageHeader .project-meta {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    min-width: 0;
}

html.kinlytix-nav-phone #projectPageHeader .project-meta-item {
    flex-wrap: wrap;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}

html.kinlytix-nav-phone .container > .alert {
    max-width: 100%;
    overflow-wrap: anywhere;
}

html.kinlytix-nav-phone .dashboard-mobile-nav {
    display: flex;
    gap: 8px;
    padding: 0 0 10px;
    background: transparent;
}

html.kinlytix-nav-phone .dashboard-nav-toggle,
html.kinlytix-nav-phone .dashboard-members-toggle {
    display: inline-flex;
    flex: 1 1 0;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--sage-green);
    color: #fff;
    border-radius: 8px;
    padding: 10px 8px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
}

html.kinlytix-nav-phone #kinDashJump,
html.kinlytix-nav-phone #dashboardRightPanelTab {
    display: none !important;
}

html.kinlytix-nav-phone #profileLayout {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0;
}

html.kinlytix-nav-phone #profileLayout .profile-sidebar,
html.kinlytix-nav-phone #profileLayout .profile-sidebar-right {
    display: none !important;
}

html.kinlytix-nav-phone #dashboardMainPanel {
    min-width: 0;
    max-width: 100%;
}

html.kinlytix-nav-phone #profileLayout.left-drawer-open .profile-sidebar,
html.kinlytix-nav-phone #profileLayout.members-drawer-open .profile-sidebar-right {
    display: flex !important;
    flex-direction: column;
    position: fixed !important;
    top: 0;
    width: min(300px, 92vw);
    height: calc(100dvh - var(--kin-phone-tabbar-height, 56px) - env(safe-area-inset-bottom, 0px));
    z-index: 1500;
    margin: 0;
    overflow-y: auto;
    background: #fff;
    box-shadow: 0 8px 28px rgba(17, 24, 39, 0.18);
}

html.kinlytix-nav-phone #profileLayout.left-drawer-open .profile-sidebar {
    left: 0;
    right: auto;
}

html.kinlytix-nav-phone #profileLayout.members-drawer-open .profile-sidebar-right {
    right: 0;
    left: auto;
}

html.kinlytix-nav-phone #profileLayout.left-drawer-open .profile-sidebar > .sidebar-card,
html.kinlytix-nav-phone #profileLayout.members-drawer-open .profile-sidebar-right > .sidebar-card {
    display: block !important;
    border-radius: 0;
    box-shadow: none;
    min-height: 100%;
}

html.kinlytix-nav-phone #profileLayout.left-drawer-open + .dashboard-drawer-overlay,
html.kinlytix-nav-phone #profileLayout.members-drawer-open + .dashboard-drawer-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: calc(var(--kin-phone-tabbar-height, 56px) + env(safe-area-inset-bottom, 0px));
    background: rgba(17, 24, 39, 0.45);
    z-index: 1400;
    border: 0;
    padding: 0;
    cursor: pointer;
}

html.kinlytix-nav-phone body.kin-dash-embed-grow #profileLayout.left-drawer-open .profile-sidebar,
html.kinlytix-nav-phone body.kin-dash-embed-grow #profileLayout.members-drawer-open .profile-sidebar-right {
    position: fixed !important;
    top: 0 !important;
    overflow-y: auto !important;
    max-height: none !important;
}
