
/* V74 Advanced Connections */
.connection-card{
  background:#fff;
  border:1px solid rgba(18,22,26,.08);
  border-radius:1rem;
  box-shadow:0 14px 42px rgba(18,22,26,.06);
}
.connection-score{
  display:inline-flex;
  align-items:center;
  gap:.35rem;
  padding:.35rem .72rem;
  border-radius:999px;
  background:rgba(36,75,37,.08);
  color:#244b25;
  font-size:.78rem;
  font-weight:700;
}


/* V74.2 operational connections + chat polish */
.connection-card .btn {
  border-radius: 999px;
}
.connection-card a.fw-semibold:hover {
  text-decoration: underline !important;
}
.chat-shell .conversation-list-item,
.chat-thread-card,
.chat-pane {
  border-radius: 1rem;
}
.chat-composer textarea,
.chat-composer input,
.chat-pane .form-control {
  border-radius: .9rem;
}


/* V74.3 simplify follow flow and fix chat overlap */
.connection-card .btn {
  white-space: nowrap;
}

.chat-shell,
.chat-layout,
.chat-page-grid {
  align-items: stretch;
}

.chat-sidebar,
.chat-list-panel,
.chat-conversation-list {
  min-width: 0 !important;
}

.chat-main,
.chat-thread-panel,
.chat-pane,
.chat-thread-card {
  min-width: 0 !important;
  overflow: hidden !important;
}

.chat-pane .empty-state,
.chat-thread-card .empty-state {
  max-width: 100% !important;
}

.chat-conversation-item,
.conversation-list-item,
.chat-list-item {
  display: flex !important;
  align-items: center !important;
  gap: .9rem !important;
  min-width: 0 !important;
}

.chat-conversation-item .name,
.conversation-list-item .name,
.chat-list-item .name,
.chat-conversation-item .preview,
.conversation-list-item .preview,
.chat-list-item .preview {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.chat-thread-card,
.chat-pane,
.chat-main {
  display: flex;
  flex-direction: column;
}

.chat-messages,
.chat-thread-messages {
  min-height: 360px;
  max-height: 62vh;
  overflow-y: auto !important;
}

.chat-composer,
.chat-reply-box,
.chat-pane form {
  margin-top: auto;
}

.chat-composer textarea,
.chat-composer input,
.chat-reply-box textarea,
.chat-reply-box input {
  width: 100% !important;
}

@media (max-width: 991.98px) {
  .chat-shell,
  .chat-layout,
  .chat-page-grid {
    display: block !important;
  }

  .chat-sidebar,
  .chat-list-panel,
  .chat-main,
  .chat-thread-panel {
    width: 100% !important;
    max-width: 100% !important;
  }

  .chat-messages,
  .chat-thread-messages {
    max-height: none !important;
  }
}


/* V74.4 complete chat review and layout fix */
.chat-layout-grid{
  display:grid;
  grid-template-columns:minmax(320px, 380px) minmax(0, 1fr);
  gap:1.5rem;
  align-items:start;
}
.chat-left-column,
.chat-right-column{min-width:0}
.chat-search-result{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:.85rem;
  border:1px solid rgba(18,22,26,.08);
  border-radius:1rem;
  padding:.9rem 1rem;
  background:#fff;
}
.chat-person-main{
  display:flex;
  align-items:center;
  gap:.75rem;
  min-width:0;
  flex:1 1 auto;
}
.chat-person-copy{min-width:0}
.conversation-list-premium{
  display:flex;
  flex-direction:column;
  gap:.85rem;
}
.chat-convo-card{
  display:flex;
  align-items:center;
  gap:.9rem;
  padding:1rem;
  border:1px solid rgba(18,22,26,.08);
  border-radius:1rem;
  background:#fff;
  color:inherit;
  min-width:0;
}
.chat-convo-card:hover{
  border-color:rgba(36,75,37,.18);
  box-shadow:0 10px 28px rgba(18,22,26,.05);
}
.chat-convo-card.active{
  background:linear-gradient(135deg,#244b25,#2e5a30);
  color:#fff;
  border-color:transparent;
}
.chat-convo-avatar-wrap{flex:0 0 auto}
.chat-convo-body{
  min-width:0;
  flex:1 1 auto;
}
.chat-convo-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:.75rem;
  min-width:0;
}
.chat-thread-card{
  min-height:720px;
  display:flex;
  flex-direction:column;
}
.chat-header-premium{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:1rem;
  flex-wrap:wrap;
  padding-bottom:1rem;
  margin-bottom:1rem;
  border-bottom:1px solid rgba(18,22,26,.08);
}
.chat-box{
  flex:1 1 auto;
  min-height:420px;
  max-height:62vh;
  overflow-y:auto;
  overflow-x:hidden;
  border:1px solid rgba(18,22,26,.08);
  border-radius:1rem;
  background:#f9fbf9;
  padding:1rem;
  margin-bottom:1rem;
}
.chat-message-row{
  display:flex;
  flex-direction:column;
  margin-bottom:1rem;
}
.chat-message-row.mine{align-items:flex-end}
.chat-message-row.other{align-items:flex-start}
.chat-bubble-wrap{
  width:100%;
  display:flex;
}
.chat-message-row.mine .chat-bubble-wrap{justify-content:flex-end}
.chat-message-row.other .chat-bubble-wrap{justify-content:flex-start}
.chat-bubble-me,
.chat-bubble-other{
  max-width:min(82%, 760px);
  padding:.9rem 1rem;
  border-radius:1rem;
  word-break:break-word;
  overflow-wrap:anywhere;
}
.chat-bubble-me{
  background:#244b25;
  color:#fff;
  border-top-right-radius:.35rem;
}
.chat-bubble-other{
  background:#fff;
  color:#111;
  border:1px solid rgba(18,22,26,.08);
  border-top-left-radius:.35rem;
}
.chat-compose-premium{
  margin-top:auto;
}
.chat-compose-premium textarea{
  resize:vertical;
  min-height:110px;
}
.chat-empty-state{
  min-height:420px;
  display:grid;
  place-items:center;
}
@media (max-width: 1199.98px){
  .chat-layout-grid{
    grid-template-columns:1fr;
  }
  .chat-thread-card{
    min-height:auto;
  }
  .chat-box{
    max-height:none;
  }
}


/* V75 engagement layer */
.engage-check{
  display:flex;
  align-items:center;
  gap:.65rem;
  padding:.9rem 1rem;
  border:1px solid rgba(18,22,26,.08);
  border-radius:1rem;
  background:#fff;
}
.engage-steps{
  display:grid;
  gap:.85rem;
}
.engage-step{
  padding:.9rem 1rem;
  border-radius:1rem;
  background:#f8faf8;
  border:1px solid rgba(36,75,37,.08);
  font-weight:600;
}
.engage-community-card{
  padding:1rem;
  border-radius:1rem;
  border:1px solid rgba(18,22,26,.08);
  background:#fff;
}
.engage-activity-list{
  display:grid;
  gap:1rem;
}
.engage-activity-item{
  display:flex;
  align-items:flex-start;
  gap:1rem;
  padding:1rem;
  border-radius:1rem;
  border:1px solid rgba(18,22,26,.08);
  background:#fff;
}
.engage-activity-badge{
  width:2.2rem;
  height:2.2rem;
  border-radius:999px;
  display:grid;
  place-items:center;
  background:rgba(36,75,37,.1);
  color:#244b25;
  font-weight:800;
  flex:0 0 auto;
}


/* V76 compact spacing + mobile optimization + non-sticky dashboard refinement */

/* Core spacing rhythm */
.section-block,
.public-section,
.dashboard-section,
.portal-section {
  padding-top: 2.25rem;
  padding-bottom: 2.25rem;
}

.dash-card,
.panel-card,
.card {
  padding: 1rem 1.15rem;
  border-radius: 1rem;
}

/* Keep menu/topbar non-sticky and compact */
.portal-sidebar,
.sidebar,
.left-sidebar,
.dashboard-topbar,
.portal-topbar,
.page-topbar {
  position: relative !important;
  top: auto !important;
  z-index: auto !important;
}

.dashboard-topbar {
  padding: .9rem 1.15rem !important;
  margin-bottom: .9rem !important;
  border-bottom: 1px solid rgba(18,22,26,.06);
  background: #fff;
}

.dashboard-title-block h1,
.dashboard-topbar h1,
.dashboard-topbar .h3 {
  font-size: clamp(1.55rem, 2vw, 2.2rem) !important;
  line-height: 1.08 !important;
  margin-bottom: .2rem !important;
}

.dashboard-title-block .small-muted,
.dashboard-topbar .small-muted {
  max-width: 760px;
  margin-bottom: 0 !important;
  font-size: .98rem;
}

/* Hero tightening */
.hero-shell {
  min-height: 70vh !important;
}

.hero-title {
  margin-bottom: .9rem !important;
}

.hero-copy {
  margin-bottom: 1rem !important;
}

/* Buttons */
.btn {
  border-radius: 999px;
}

.dashboard-actions .btn,
.hero-shell .btn {
  padding: .55rem .95rem;
}

/* Cards and grids */
.profile-stat-grid,
.metric-grid,
.report-grid,
.dashboard-grid {
  gap: 1rem !important;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}
.table > :not(caption) > * > * {
  padding: .75rem .8rem;
}

/* Forms */
.form-control,
.form-select,
textarea {
  border-radius: .85rem;
}

/* Empty states */
.empty-state,
.empty-state-premium {
  padding: 1.1rem 1.2rem;
  min-height: auto !important;
}

/* Images and logos */
img {
  max-width: 100%;
  height: auto;
}
.partner-logo,
.product-logo {
  width: 72px !important;
  height: 72px !important;
  object-fit: contain !important;
}
.product-cover,
.story-cover,
.portfolio-cover,
.hero-media img {
  width: 100%;
  object-fit: cover;
  border-radius: 1rem;
}

/* Member dashboard engagement cards */
.engage-check {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .8rem .9rem;
  border: 1px solid rgba(18,22,26,.08);
  border-radius: .95rem;
  background: #fff;
}
.engage-step {
  padding: .85rem .95rem;
  border-radius: .95rem;
  background: #f8faf8;
  border: 1px solid rgba(36,75,37,.08);
}
.engage-community-card,
.engage-activity-item {
  border-radius: .95rem;
}

/* Connections cards tidy */
.connection-card .btn {
  white-space: nowrap;
}

/* Chat mobile hardening */
.chat-layout-grid {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}
.chat-left-column,
.chat-right-column {
  min-width: 0;
}
.chat-box {
  max-height: 60vh;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Mobile optimization */
@media (max-width: 1199.98px) {
  .chat-layout-grid {
    grid-template-columns: 1fr;
  }
  .chat-box {
    max-height: none;
  }
}

@media (max-width: 991.98px) {
  html {
    font-size: 15px;
  }

  .section-block,
  .public-section,
  .dashboard-section,
  .portal-section {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
  }

  .dashboard-topbar {
    padding: .85rem 1rem !important;
  }

  .dashboard-actions {
    width: 100%;
    margin-top: .6rem;
    gap: .55rem !important;
  }

  .dashboard-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .hero-shell {
    min-height: auto !important;
    padding-top: 1.35rem !important;
    padding-bottom: 1.35rem !important;
    background-position: 64% center !important;
  }

  .hero-title {
    font-size: clamp(2rem, 9vw, 3.4rem) !important;
    line-height: 1.02 !important;
  }

  .hero-mini-pills {
    flex-wrap: wrap;
    width: 100%;
  }

  .hero-mini-pills span {
    min-width: auto;
    flex: 1 1 30%;
  }

  .dash-card,
  .panel-card,
  .card {
    padding: .95rem 1rem;
  }

  .table > :not(caption) > * > * {
    padding: .6rem .65rem;
  }

  .portal-shell .row.g-0 {
    --bs-gutter-x: 0;
  }
}

@media (max-width: 767.98px) {
  .container,
  .container-fluid {
    padding-left: .9rem;
    padding-right: .9rem;
  }

  .dashboard-title-block h1,
  .dashboard-topbar h1,
  .dashboard-topbar .h3 {
    font-size: 1.45rem !important;
  }

  .engage-check,
  .engage-step,
  .engage-community-card,
  .engage-activity-item,
  .connection-card,
  .chat-search-result,
  .chat-convo-card {
    padding: .85rem .9rem;
  }

  .btn-lg {
    padding: .65rem 1rem;
    font-size: 1rem;
  }
}


/* V77 dashboard content strategy */
.dashboard-priority-grid,
.dashboard-opportunity-grid {
  display:grid;
  gap:1rem;
}
.dashboard-kicker-badge {
  display:inline-flex;
  align-items:center;
  padding:.35rem .75rem;
  border-radius:999px;
  background:rgba(36,75,37,.08);
  color:#244b25;
  font-weight:700;
  font-size:.78rem;
}


/* V79 retention nudges */
.engage-link-card{
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.engage-link-card:hover{
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(18,22,26,.08);
  border-color: rgba(36,75,37,.16);
}


/* V80 notifications and re-engagement */
.engage-link-card .badge{
  flex: 0 0 auto;
}


/* V81.4 portal mobile menu fix */
.portal-mobile-toggle{
  appearance:none;
  -webkit-appearance:none;
  border:1px solid rgba(255,255,255,.16);
  background:rgba(255,255,255,.12);
  color:#fff;
  border-radius:999px;
  padding:.75rem 1rem;
  line-height:1;
}
.portal-sidebar-backdrop{
  display:none;
}
@media (max-width: 991.98px){
  .portal-shell{
    overflow-x:hidden;
  }
  .portal-sidebar{
    position:fixed !important;
    top:0;
    left:0;
    width:min(86vw, 340px);
    height:100vh;
    z-index:1060;
    transform:translateX(-104%);
    transition:transform .22s ease;
    overflow-y:auto;
    -webkit-overflow-scrolling:touch;
    box-shadow:0 18px 40px rgba(0,0,0,.2);
  }
  .portal-sidebar.is-open{
    transform:translateX(0);
  }
  .portal-sidebar-backdrop{
    position:fixed;
    inset:0;
    background:rgba(7,12,9,.35);
    z-index:1050;
    opacity:0;
    visibility:hidden;
    transition:opacity .18s ease, visibility .18s ease;
  }
  .portal-sidebar-backdrop.is-open{
    display:block;
    opacity:1;
    visibility:visible;
  }
  body.portal-menu-open{
    overflow:hidden;
    touch-action:none;
  }
  .portal-mobile-toggle{
    pointer-events:auto;
    touch-action:manipulation;
  }
}


/* V81.5 portal menu restore + SMS sender ID support */
.portal-mobile-shell-header{
  display:none;
}
@media (max-width: 991.98px){
  .portal-mobile-shell-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:1rem;
    margin:1rem 1rem 0;
    padding:1rem 1rem;
    border-radius:1.25rem;
    background:linear-gradient(135deg,#123f1a,#2f6b35);
    position:relative;
    z-index:1041;
  }
  .portal-mobile-brand{
    display:flex;
    align-items:center;
    gap:.75rem;
    min-width:0;
  }
  .portal-mobile-brand-copy{
    min-width:0;
  }
  .portal-mobile-toggle{
    display:inline-flex!important;
    align-items:center;
    gap:.45rem;
    justify-content:center;
    background:rgba(255,255,255,.14)!important;
    color:#fff!important;
    border:1px solid rgba(255,255,255,.14)!important;
    min-height:46px;
    padding:.8rem 1rem!important;
    border-radius:999px!important;
    font-weight:700;
    flex:0 0 auto;
  }
  .portal-shell .dashboard-topbar{
    margin-top:0.85rem;
  }
  .portal-sidebar{
    position:fixed !important;
    top:0;
    left:0;
    width:min(86vw,340px);
    height:100vh;
    z-index:1060;
    transform:translateX(-104%);
    transition:transform .22s ease;
    overflow-y:auto;
    -webkit-overflow-scrolling:touch;
    box-shadow:0 18px 40px rgba(0,0,0,.2);
  }
  .portal-sidebar.is-open{
    transform:translateX(0);
  }
  .portal-sidebar-backdrop{
    position:fixed;
    inset:0;
    background:rgba(7,12,9,.35);
    z-index:1050;
    opacity:0;
    visibility:hidden;
    display:block;
    transition:opacity .18s ease, visibility .18s ease;
  }
  .portal-sidebar-backdrop.is-open{
    opacity:1;
    visibility:visible;
  }
}


/* V81.6B safe portal mobile menu fix */
@media (max-width: 991.98px){
  #portalMobilePanel.portal-sidebar{
    position:fixed !important;
    top:0 !important;
    left:0 !important;
    width:min(86vw,340px) !important;
    max-width:340px !important;
    height:100vh !important;
    z-index:1100 !important;
    transform:translateX(-104%);
    transition:transform .22s ease;
    overflow-y:auto !important;
    -webkit-overflow-scrolling:touch;
    box-shadow:0 18px 40px rgba(0,0,0,.2);
  }
  #portalMobilePanel.portal-sidebar.is-open{
    transform:translateX(0) !important;
  }
  #portalSidebarBackdrop{
    position:fixed;
    inset:0;
    display:block;
    background:rgba(7,12,9,.35);
    z-index:1090;
    opacity:0;
    visibility:hidden;
    transition:opacity .18s ease, visibility .18s ease;
  }
  #portalSidebarBackdrop.is-open{
    opacity:1;
    visibility:visible;
  }
  body.portal-menu-open{
    overflow:hidden !important;
    touch-action:none;
  }
}


/* V81.6C direct mobile menu fix */
@media (max-width: 991.98px){
  .portal-mobile-shell-header{
    position:relative;
    z-index:1200 !important;
    pointer-events:auto !important;
  }
  #portalMobileMenuButton{
    position:relative;
    z-index:1210 !important;
    pointer-events:auto !important;
    touch-action:manipulation !important;
  }
  #portalMobilePanel.portal-sidebar{
    z-index:1250 !important;
  }
  #portalSidebarBackdrop{
    z-index:1240 !important;
  }
}


/* V81.6D portal menu deduplicate fix */
.portal-mobile-shell-header{display:none}
@media (max-width: 991.98px){
  .portal-mobile-shell-header{
    display:flex !important;
    align-items:center;
    justify-content:space-between;
    gap:1rem;
    margin:1rem 1rem 0 !important;
    padding:1rem !important;
    border-radius:1.25rem;
    background:linear-gradient(135deg,#123f1a,#2f6b35);
    position:relative;
    z-index:1200;
  }

  .portal-mobile-toggle{
    display:inline-flex !important;
    align-items:center;
    justify-content:center;
    min-height:46px;
    min-width:96px;
    padding:.8rem 1rem !important;
    border-radius:999px !important;
    background:rgba(255,255,255,.14) !important;
    border:1px solid rgba(255,255,255,.16) !important;
    color:#fff !important;
    cursor:pointer;
  }

  #portalMobilePanel.portal-sidebar{
    position:fixed !important;
    top:0 !important;
    left:0 !important;
    width:min(86vw,340px) !important;
    height:100vh !important;
    z-index:1250 !important;
    transform:translateX(-104%);
    transition:transform .22s ease;
    overflow-y:auto !important;
    -webkit-overflow-scrolling:touch;
    box-shadow:0 18px 40px rgba(0,0,0,.2);
  }

  #portalMobilePanel.portal-sidebar.is-open{
    transform:translateX(0) !important;
  }

  #portalSidebarBackdrop{
    position:fixed;
    inset:0;
    z-index:1240;
    background:rgba(7,12,9,.35);
    opacity:0;
    visibility:hidden;
    transition:opacity .18s ease, visibility .18s ease;
  }

  #portalSidebarBackdrop.is-open{
    opacity:1;
    visibility:visible;
  }

  body.portal-menu-open{
    overflow:hidden !important;
  }
}
