
/* EDIVIC Message + Chat Final Frontend
   Frontend only. Backend/Supabase logic remains in assets/chat.js. */
:root{
  --ed-msg-navy:#0f172a;
  --ed-msg-slate:#1e293b;
  --ed-msg-muted:#64748b;
  --ed-msg-line:#e2e8f0;
  --ed-msg-soft:#f8fafc;
  --ed-msg-panel:#ffffff;
  --ed-msg-blue:#2563eb;
  --ed-msg-teal:#0f766e;
  --ed-msg-orange:#f59e0b;
  --ed-msg-green:#16a34a;
  --ed-msg-red:#ef4444;
  --ed-msg-shadow:0 18px 45px rgba(15,23,42,.08);
  --ed-msg-shadow-soft:0 12px 30px rgba(15,23,42,.06);
  --ed-msg-radius:22px;
}
*{box-sizing:border-box}
html{height:100%;scroll-behavior:smooth}
body.chat-mobile-page,
body.client-message-page,
body.editor-message-page{
  min-height:100%;
  margin:0;
  overflow:hidden;
  background:#eef4fb!important;
  color:var(--ed-msg-navy)!important;
  font-family:Inter,Poppins,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif!important;
}
body.chat-mobile-page .saas-header,
body.chat-mobile-page .sidebar,
body.chat-mobile-page .edivic-page-skeleton,
body.chat-mobile-page .chat-workspace-hero{display:none!important}
body.chat-mobile-page a{text-decoration:none}
.edivic-chat-shell{height:100vh;display:grid;grid-template-columns:370px 1fr;background:#eef4fb;overflow:hidden}
.edivic-chat-sidebar{min-width:0;background:#fff;border-right:1px solid var(--ed-msg-line);display:flex;flex-direction:column;box-shadow:8px 0 35px rgba(15,23,42,.04);z-index:5}
.edivic-chat-sidebar-head{padding:18px;border-bottom:1px solid var(--ed-msg-line);background:radial-gradient(circle at top left,rgba(37,99,235,.11),transparent 36%),linear-gradient(180deg,#fff,#f8fafc)}
.edivic-chat-logo-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}
.edivic-chat-brand{display:flex;align-items:center;gap:10px;color:var(--ed-msg-navy);font-weight:950;letter-spacing:.03em;font-size:19px}
.edivic-chat-brand-mark{width:40px;height:40px;border-radius:15px;background:linear-gradient(135deg,var(--ed-msg-orange),#fbbf24);display:grid;place-items:center;color:#111827;box-shadow:0 12px 25px rgba(245,158,11,.25);font-weight:1000}
.edivic-chat-head-actions{display:flex;align-items:center;gap:8px}
.edivic-chat-icon-btn{border:1px solid var(--ed-msg-line);background:#fff;color:#334155;width:40px;height:40px;border-radius:14px;cursor:pointer;display:grid;place-items:center;font-weight:900;transition:.18s ease}
.edivic-chat-icon-btn:hover{transform:translateY(-1px);border-color:#bfdbfe;color:#1d4ed8;box-shadow:0 12px 26px rgba(37,99,235,.1)}
.edivic-chat-mini-title{margin:0 0 14px;color:#64748b;font-size:13px;line-height:1.5;font-weight:650}
.edivic-chat-search{display:flex;align-items:center;gap:10px;min-height:48px;padding:0 14px;border:1px solid var(--ed-msg-line);border-radius:17px;background:#f8fafc;color:#64748b}
.edivic-chat-search input{width:100%;border:0!important;outline:0!important;background:transparent!important;font-size:14px;color:#0f172a;box-shadow:none!important;padding:0!important;margin:0!important}
.edivic-chat-list{padding:12px;overflow:auto;display:grid;gap:8px;align-content:start;min-height:0;scrollbar-width:thin}
.contact-card.edivic-conversation-item{border:1px solid transparent;background:transparent;border-radius:18px;padding:12px;display:grid;grid-template-columns:auto 1fr auto;gap:12px;align-items:center;text-align:left;cursor:pointer;color:inherit;width:100%;transition:.2s ease;font-family:inherit;min-width:0}
.contact-card.edivic-conversation-item:hover,
.contact-card.edivic-conversation-item.active{background:#f8fafc;border-color:#bfdbfe;box-shadow:0 12px 28px rgba(15,23,42,.06)}
.edivic-chat-avatar,.chat-header-avatar,.avatar-initial{width:48px;height:48px;border-radius:18px;display:grid;place-items:center;background:linear-gradient(135deg,#dbeafe,#ccfbf1);color:#0f172a;font-weight:950;position:relative;flex:0 0 auto;object-fit:cover;overflow:hidden}
.edivic-chat-avatar img,.chat-header-avatar img{width:100%;height:100%;object-fit:cover;border-radius:inherit}
.edivic-chat-avatar.online::after,.edivic-chat-avatar-wrap .edivic-chat-avatar::after{content:"";position:absolute;right:1px;bottom:2px;width:11px;height:11px;background:var(--ed-msg-green);border-radius:50%;border:3px solid #fff}
.edivic-conversation-body{min-width:0}
.edivic-conversation-body h3{margin:0;font-size:14px;letter-spacing:-.01em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#0f172a;font-weight:900;display:flex;align-items:center;gap:6px}
.edivic-conversation-body p{margin:5px 0 0;font-size:12px;color:var(--ed-msg-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.4}
.edivic-conversation-meta{display:grid;justify-items:end;gap:7px;font-size:11px;color:var(--ed-msg-muted);font-weight:850;white-space:nowrap}
.edivic-unread-pill{min-width:22px;height:22px;padding:0 7px;border-radius:999px;background:var(--ed-msg-blue);color:#fff;display:grid;place-items:center;font-size:11px;font-weight:950}
.edivic-chat-room{height:100vh;display:grid;grid-template-rows:auto auto 1fr auto;min-width:0;background:radial-gradient(circle at top right,rgba(15,118,110,.08),transparent 28%),linear-gradient(180deg,#f8fafc,#eef4fb);position:relative}
.edivic-chat-room-head{height:78px;background:rgba(255,255,255,.9);backdrop-filter:blur(18px);border-bottom:1px solid var(--ed-msg-line);padding:0 20px;display:flex;align-items:center;justify-content:space-between;gap:16px;z-index:5}
.edivic-chat-person{display:flex;align-items:center;gap:12px;min-width:0}
.chat-back{display:none}
.edivic-chat-person h3,.edivic-chat-person h1{margin:0;font-size:18px;letter-spacing:-.02em;color:#0f172a;font-weight:950;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:52vw}
.edivic-chat-person .badge,.edivic-chat-person p{margin:3px 0 0!important;color:var(--ed-msg-muted)!important;font-size:12px!important;font-weight:750!important;background:transparent!important;border:0!important;padding:0!important;display:block!important;text-transform:none!important;letter-spacing:0!important}
.edivic-chat-actions{display:flex;align-items:center;gap:9px;flex-wrap:wrap;justify-content:flex-end}
.edivic-chat-action-btn{border:1px solid var(--ed-msg-line);background:#fff;color:#334155;min-height:40px;border-radius:14px;padding:0 13px;font-weight:850;cursor:pointer;display:inline-flex;align-items:center;gap:7px;white-space:nowrap;transition:.18s ease;font-size:13px}
.edivic-chat-action-btn:hover{transform:translateY(-1px);box-shadow:0 12px 26px rgba(15,23,42,.08);border-color:#bfdbfe}.edivic-chat-action-btn.primary{border-color:transparent;background:linear-gradient(135deg,var(--ed-msg-orange),#fbbf24);color:#111827;box-shadow:0 12px 25px rgba(245,158,11,.22)}
.edivic-project-strip{margin:14px 20px 0;background:#fff;border:1px solid var(--ed-msg-line);border-radius:20px;padding:14px;display:flex;align-items:center;justify-content:space-between;gap:14px;box-shadow:0 12px 30px rgba(15,23,42,.05)}
.edivic-project-strip strong{display:block;margin-bottom:4px;font-size:14px}.edivic-project-strip span{color:var(--ed-msg-muted);font-size:12px;font-weight:750}.edivic-project-pill{background:#ecfdf5;color:#047857;border:1px solid #bbf7d0;padding:8px 11px;border-radius:999px;font-size:12px;font-weight:950;white-space:nowrap}
.edivic-no-chat-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:34px 20px;text-align:center;min-height:0;overflow:auto}.edivic-no-chat-state i{font-size:3.8rem;color:#cbd5e1}.edivic-no-chat-state h2{margin:0;color:#0f172a;font-size:24px;letter-spacing:-.03em}.edivic-no-chat-state p{margin:0;color:#64748b;max-width:460px;line-height:1.65}.edivic-no-chat-cta{display:flex;gap:10px;flex-wrap:wrap;justify-content:center;margin-top:8px}.edivic-no-chat-cta a{border-radius:999px;padding:11px 16px;font-weight:850;background:#fff;color:#0f172a;border:1px solid #e2e8f0}.edivic-no-chat-cta a:first-child{background:linear-gradient(135deg,var(--ed-msg-orange),#fbbf24);border:0;color:#111827}
#active-chat-chat-box{min-height:0;display:flex;flex-direction:column}.messages-feed{overflow:auto;padding:18px 20px 22px;min-height:0;flex:1;scrollbar-width:thin}.edv-chat-day-divider{display:flex;align-items:center;gap:12px;color:#94a3b8;font-size:12px;font-weight:850;margin:10px 0 18px}.edv-chat-day-divider::before,.edv-chat-day-divider::after{content:"";height:1px;background:#dbe4ef;flex:1}.message{display:flex;gap:10px;margin:10px 0;align-items:flex-end}.message.outgoing{justify-content:flex-end}.message-content{max-width:min(640px,72%);padding:12px 14px;border-radius:20px;box-shadow:0 10px 24px rgba(15,23,42,.05);position:relative;background:#fff;border:1px solid var(--ed-msg-line);border-bottom-left-radius:7px;color:#0f172a}.message.outgoing .message-content{background:linear-gradient(135deg,#1d4ed8,#0f766e);color:#fff;border:0;border-bottom-left-radius:20px;border-bottom-right-radius:7px}.message-content p{margin:0;line-height:1.55;font-size:14px}.message-content .time{display:block;margin-top:7px;opacity:.72;font-size:11px;font-weight:750}.message-sender-name{display:block;font-size:11px;color:#64748b;font-weight:900;margin-bottom:4px}.message.outgoing .message-sender-name{color:rgba(255,255,255,.82)}.edv-chat-start-card,.chat-empty-note{max-width:520px;margin:45px auto;padding:24px;border:1px dashed #cbd5e1;border-radius:24px;background:#fff;text-align:center;color:#64748b;box-shadow:0 16px 35px rgba(15,23,42,.05)}.edv-chat-start-card h3{margin:8px 0;color:#0f172a}.edv-chat-start-icon{width:56px;height:56px;border-radius:20px;background:#eff6ff;display:grid;place-items:center;color:#1d4ed8;margin:0 auto;font-size:24px}.chat-error-note{border-color:#fecaca;background:#fff5f5;color:#b91c1c}.chat-success-note{border-color:#bbf7d0;background:#f0fdf4;color:#047857}
.chat-footer{background:rgba(255,255,255,.9);backdrop-filter:blur(18px);border-top:1px solid var(--ed-msg-line);padding:14px 20px}#chat-message-send-dock{display:grid!important;grid-template-columns:auto 1fr auto!important;gap:10px!important;align-items:end!important;max-width:1000px;margin:auto;width:100%!important}.edivic-composer-tool{width:46px;height:46px;border-radius:16px;border:1px solid var(--ed-msg-line);background:#fff;cursor:pointer;font-weight:950;color:#334155;display:grid;place-items:center}.chat-footer input#chat-text-input,.chat-footer textarea#chat-text-input{min-height:46px;max-height:120px;resize:none;border:1px solid var(--ed-msg-line)!important;border-radius:18px!important;background:#f8fafc!important;padding:13px 14px!important;outline:0!important;font-family:inherit!important;font-size:14px!important;line-height:1.4!important;width:100%!important;box-shadow:none!important;margin:0!important}.send-btn{height:46px!important;border:0!important;border-radius:16px!important;padding:0 18px!important;background:linear-gradient(135deg,var(--ed-msg-orange),#fbbf24)!important;color:#111827!important;font-weight:950!important;cursor:pointer!important;box-shadow:0 12px 25px rgba(245,158,11,.24)!important;display:inline-grid!important;place-items:center!important;min-width:54px!important}.send-btn:disabled{opacity:.65;cursor:not-allowed}.chat-disclaimer-note{max-width:1000px;margin:10px auto 0;color:#94a3b8;font-size:11px;line-height:1.45;text-align:center}.edivic-chat-bottom-nav{display:none}.edv-dm-empty-state{padding:28px 16px;text-align:center;color:#64748b}.edv-dm-empty-icon{width:58px;height:58px;margin:0 auto 12px;border-radius:22px;background:#eff6ff;color:#2563eb;display:grid;place-items:center;font-size:24px}.edv-dm-empty-state h3{margin:0 0 6px;color:#0f172a}.edv-dm-empty-state p{margin:0 0 14px;line-height:1.55}.edv-dm-empty-state a,.edv-dm-empty-actions a{display:inline-flex;align-items:center;justify-content:center;border-radius:999px;padding:10px 13px;background:#fff;border:1px solid #e2e8f0;color:#0f172a;font-weight:850;margin:4px}.edv-dm-empty-state a:first-of-type{background:linear-gradient(135deg,var(--ed-msg-orange),#fbbf24);border:0;color:#111827}
@media(max-width:860px){body.chat-mobile-page{overflow:hidden}.edivic-chat-shell{grid-template-columns:1fr}.edivic-chat-sidebar{height:100vh}.edivic-chat-sidebar-head{padding:14px}.edivic-chat-brand-mark{width:36px;height:36px;border-radius:13px}.edivic-chat-mini-title{font-size:12px}.edivic-chat-list{padding:10px 10px 16px}.contact-card.edivic-conversation-item{border-radius:17px}.edivic-chat-room{position:fixed;inset:0;transform:translateX(100%);transition:.25s ease;z-index:40}.edv-chat-room-mode .edivic-chat-room{transform:translateX(0)}.edv-chat-list-mode .edivic-chat-room{transform:translateX(100%)}body:not(.edv-chat-list-mode):not(.edv-chat-room-mode) .edivic-chat-room{transform:translateX(100%)}.edivic-chat-room-head{height:68px;padding:0 12px}.chat-back{display:grid;place-items:center;width:40px;height:40px;border-radius:14px;border:1px solid var(--ed-msg-line);background:#fff;font-size:24px;cursor:pointer;color:#0f172a}.edivic-chat-person{gap:9px}.edivic-chat-person h3,.edivic-chat-person h1{font-size:15px;max-width:150px}.edivic-chat-person .badge,.edivic-chat-person p{font-size:11px!important}.edivic-chat-actions .hide-mobile{display:none}.edivic-chat-action-btn{min-height:38px;padding:0 11px;border-radius:13px;font-size:12px}.edivic-project-strip{margin:10px 10px 0;border-radius:17px;padding:11px}.edivic-project-strip span{display:none}.edivic-project-pill{font-size:11px;padding:7px 9px}.messages-feed{padding:14px 10px 16px}.message-content{max-width:82%;border-radius:18px}.message-content p{font-size:13px}.chat-footer{padding:10px}.edivic-composer-tool{width:42px;height:42px;border-radius:14px}.chat-footer input#chat-text-input,.chat-footer textarea#chat-text-input{min-height:42px;padding:11px 12px!important;border-radius:15px!important}.send-btn{width:44px!important;height:42px!important;padding:0!important;border-radius:14px!important;min-width:44px!important;font-size:0!important}.send-btn i{font-size:16px}.edivic-chat-bottom-nav{position:fixed;left:12px;right:12px;bottom:12px;height:68px;background:rgba(15,23,42,.94);color:white;border-radius:24px;display:flex;align-items:center;justify-content:space-around;z-index:30;box-shadow:0 18px 45px rgba(15,23,42,.28);backdrop-filter:blur(18px)}.edivic-chat-bottom-nav a{color:#cbd5e1;text-decoration:none;display:grid;gap:4px;justify-items:center;font-size:11px;font-weight:800}.edivic-chat-bottom-nav a.active{color:#fbbf24}.edivic-chat-bottom-nav i{font-size:17px;line-height:1}.edivic-chat-head-actions .desktop-only{display:none!important}.chat-disclaimer-note{display:none}.edivic-no-chat-state{padding:26px 14px 18px}.edivic-no-chat-state i{font-size:3.2rem}}
@media(min-width:861px){.edivic-chat-sidebar,.edivic-chat-room{height:100vh}.edivic-chat-room{transform:none!important}.edivic-chat-bottom-nav{display:none!important}}


/* =========================================================
   EDIVIC Chat Mobile + Logo Final Fix
   Keeps backend/Supabase logic untouched.
   ========================================================= */
.edivic-chat-brand-mark{
  background:#fff7ed!important;
  border:1px solid rgba(245,158,11,.24)!important;
  overflow:hidden!important;
  padding:4px!important;
}
.edivic-chat-brand-mark img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
}
.edivic-chat-brand-text{
  display:grid;
  gap:1px;
  line-height:1.05;
  min-width:0;
}
.edivic-chat-brand-text strong{
  font-size:18px;
  letter-spacing:.04em;
  color:#0f172a;
}
.edivic-chat-brand-text small{
  font-size:11px;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:#64748b;
  font-weight:900;
}
.chat-header-avatar.edivic-logo-avatar,
.edivic-no-chat-logo{
  background:#fff7ed!important;
  border:1px solid rgba(245,158,11,.24)!important;
  overflow:hidden!important;
  padding:5px!important;
  box-shadow:0 12px 28px rgba(245,158,11,.16)!important;
}
.chat-header-avatar.edivic-logo-avatar img,
.edivic-no-chat-logo img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
  border-radius:inherit;
}
.edivic-no-chat-logo{
  width:76px;
  height:76px;
  border-radius:26px;
  display:grid;
  place-items:center;
  margin-bottom:4px;
}
.edv-verified-badge{
  color:#2563eb;
  display:inline-flex;
  align-items:center;
  font-size:12px;
}

@media(max-width:860px){
  html,body.chat-mobile-page{
    width:100%;
    min-height:100%;
    height:100dvh;
    overflow:hidden!important;
    background:#eef4fb!important;
    overscroll-behavior:none;
  }
  body.chat-mobile-page{
    position:fixed;
    inset:0;
  }
  .edivic-chat-shell{
    width:100%;
    height:100dvh!important;
    min-height:100dvh!important;
    grid-template-columns:1fr!important;
    overflow:hidden!important;
    background:#eef4fb!important;
  }
  .edivic-chat-sidebar{
    width:100%;
    height:100dvh!important;
    min-height:0!important;
    border-right:0!important;
    box-shadow:none!important;
    overflow:hidden!important;
    display:flex!important;
    flex-direction:column!important;
    background:#f8fafc!important;
  }
  .edivic-chat-sidebar-head{
    flex:0 0 auto;
    padding:12px 12px 10px!important;
    border-radius:0 0 22px 22px;
    border-bottom:1px solid #e2e8f0!important;
    background:linear-gradient(180deg,#ffffff,#f8fafc)!important;
    box-shadow:0 10px 28px rgba(15,23,42,.06);
    position:relative;
    z-index:3;
  }
  .edivic-chat-logo-row{
    margin-bottom:10px!important;
    gap:8px!important;
  }
  .edivic-chat-brand{
    gap:9px!important;
    min-width:0;
    flex:1 1 auto;
  }
  .edivic-chat-brand-mark{
    width:38px!important;
    height:38px!important;
    border-radius:14px!important;
    flex:0 0 auto;
  }
  .edivic-chat-brand-text strong{
    font-size:16px!important;
  }
  .edivic-chat-brand-text small{
    font-size:10px!important;
  }
  .edivic-chat-head-actions{
    flex:0 0 auto;
    gap:7px!important;
  }
  .edivic-chat-icon-btn{
    width:38px!important;
    height:38px!important;
    border-radius:13px!important;
    background:#fff!important;
  }
  .edivic-chat-mini-title{
    display:none!important;
  }
  .edivic-chat-search{
    min-height:44px!important;
    border-radius:15px!important;
    background:#fff!important;
    box-shadow:0 10px 22px rgba(15,23,42,.045);
  }
  .edivic-chat-list{
    flex:1 1 auto!important;
    min-height:0!important;
    overflow-y:auto!important;
    -webkit-overflow-scrolling:touch;
    padding:12px 10px calc(92px + env(safe-area-inset-bottom))!important;
    display:flex!important;
    flex-direction:column!important;
    gap:8px!important;
    background:#f8fafc!important;
  }
  .contact-card.edivic-conversation-item{
    width:100%!important;
    min-height:74px!important;
    grid-template-columns:48px minmax(0,1fr) auto!important;
    gap:11px!important;
    padding:12px!important;
    border-radius:18px!important;
    background:#fff!important;
    border:1px solid #e5e7eb!important;
    box-shadow:none!important;
  }
  .contact-card.edivic-conversation-item.active,
  .contact-card.edivic-conversation-item:active{
    border-color:#fed7aa!important;
    background:#fff7ed!important;
  }
  .edivic-chat-avatar,
  .chat-header-avatar,
  .avatar-initial{
    width:46px!important;
    height:46px!important;
    border-radius:16px!important;
  }
  .edivic-conversation-body h3{
    font-size:14px!important;
    max-width:100%;
  }
  .edivic-conversation-body p{
    font-size:12px!important;
    max-width:100%;
  }
  .edivic-conversation-meta{
    font-size:10px!important;
  }
  .edivic-chat-room{
    position:fixed!important;
    inset:0!important;
    width:100%!important;
    height:100dvh!important;
    min-height:100dvh!important;
    display:grid!important;
    grid-template-rows:auto auto minmax(0,1fr)!important;
    background:linear-gradient(180deg,#f8fafc,#eef4fb)!important;
    z-index:60!important;
    transition:transform .24s ease!important;
    overflow:hidden!important;
  }
  body.edv-chat-list-mode .edivic-chat-room{
    transform:translateX(100%)!important;
    pointer-events:none!important;
  }
  body.edv-chat-room-mode .edivic-chat-room{
    transform:translateX(0)!important;
    pointer-events:auto!important;
  }
  .edivic-chat-room-head{
    height:62px!important;
    padding:0 10px!important;
    background:rgba(255,255,255,.96)!important;
    border-bottom:1px solid #e2e8f0!important;
    backdrop-filter:blur(14px);
  }
  .chat-back{
    display:grid!important;
    width:38px!important;
    height:38px!important;
    border-radius:13px!important;
    font-size:24px!important;
    flex:0 0 auto;
  }
  .edivic-chat-person{
    min-width:0!important;
    gap:8px!important;
    flex:1 1 auto!important;
  }
  .edivic-chat-person h3,
  .edivic-chat-person h1{
    max-width:42vw!important;
    font-size:14px!important;
    line-height:1.15!important;
  }
  .edivic-chat-person .badge,
  .edivic-chat-person p{
    max-width:42vw!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
  .edivic-chat-actions{
    flex:0 0 auto!important;
    gap:6px!important;
  }
  .edivic-chat-action-btn.primary{
    min-height:36px!important;
    border-radius:13px!important;
    padding:0 10px!important;
    font-size:0!important;
  }
  .edivic-chat-action-btn.primary i{
    font-size:15px!important;
  }
  .edivic-chat-action-btn.hide-mobile{
    display:none!important;
  }
  .edivic-project-strip{
    display:none!important;
  }
  .edivic-no-chat-state{
    min-height:0!important;
    height:100%!important;
    padding:24px 18px calc(92px + env(safe-area-inset-bottom))!important;
    overflow-y:auto!important;
  }
  .edivic-no-chat-state h2{
    font-size:21px!important;
  }
  .edivic-no-chat-state p{
    font-size:13px!important;
    max-width:310px!important;
  }
  #active-chat-chat-box{
    min-height:0!important;
    height:100%!important;
    overflow:hidden!important;
    display:flex;
    flex-direction:column!important;
  }
  .messages-feed{
    flex:1 1 auto!important;
    min-height:0!important;
    overflow-y:auto!important;
    -webkit-overflow-scrolling:touch;
    padding:14px 10px 12px!important;
    background:linear-gradient(180deg,#f8fafc,#eef4fb)!important;
  }
  .message{
    margin:8px 0!important;
    gap:8px!important;
  }
  .message-content{
    max-width:84%!important;
    padding:10px 12px!important;
    border-radius:17px!important;
  }
  .message:not(.outgoing) .message-content{
    border-bottom-left-radius:6px!important;
  }
  .message.outgoing .message-content{
    border-bottom-right-radius:6px!important;
  }
  .message-content p{
    font-size:13px!important;
    line-height:1.48!important;
  }
  .message-content .time{
    font-size:10px!important;
  }
  .chat-footer{
    flex:0 0 auto!important;
    padding:8px 8px calc(8px + env(safe-area-inset-bottom))!important;
    background:rgba(255,255,255,.98)!important;
    border-top:1px solid #e2e8f0!important;
  }
  #chat-message-send-dock{
    grid-template-columns:40px minmax(0,1fr) 42px!important;
    gap:7px!important;
    align-items:center!important;
  }
  .edivic-composer-tool{
    width:40px!important;
    height:40px!important;
    border-radius:14px!important;
  }
  .chat-footer input#chat-text-input,
  .chat-footer textarea#chat-text-input{
    min-height:40px!important;
    height:40px!important;
    padding:9px 12px!important;
    border-radius:14px!important;
    font-size:13px!important;
  }
  .send-btn{
    width:42px!important;
    height:40px!important;
    min-width:42px!important;
    border-radius:14px!important;
    box-shadow:none!important;
  }
  body.edv-chat-room-mode .edivic-chat-bottom-nav{
    display:none!important;
  }
  body.edv-chat-list-mode .edivic-chat-bottom-nav{
    display:flex!important;
    position:fixed!important;
    left:10px!important;
    right:10px!important;
    bottom:calc(10px + env(safe-area-inset-bottom))!important;
    height:64px!important;
    border-radius:22px!important;
    z-index:55!important;
  }
}

@media(max-width:380px){
  .edivic-chat-person h3,
  .edivic-chat-person h1,
  .edivic-chat-person .badge,
  .edivic-chat-person p{
    max-width:36vw!important;
  }
  .edivic-chat-brand-text strong{font-size:15px!important;}
  .edivic-chat-icon-btn{width:36px!important;height:36px!important;}
  .contact-card.edivic-conversation-item{grid-template-columns:44px minmax(0,1fr) auto!important;}
  .edivic-chat-avatar,.chat-header-avatar,.avatar-initial{width:44px!important;height:44px!important;}
}

/* EDIVIC unified bottom nav for message/chat pages */
@media(max-width:860px){
  body.edv-chat-list-mode .edivic-chat-bottom-nav{
    position:fixed!important;
    left:14px!important;
    right:14px!important;
    bottom:calc(12px + env(safe-area-inset-bottom,0px))!important;
    height:72px!important;
    z-index:9999!important;
    display:grid!important;
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    align-items:center!important;
    justify-content:center!important;
    gap:4px!important;
    padding:8px!important;
    border-radius:28px!important;
    border:1px solid rgba(255,255,255,.16)!important;
    background:linear-gradient(135deg,rgba(15,23,42,.96),rgba(30,41,59,.94))!important;
    box-shadow:0 18px 45px rgba(15,23,42,.34), inset 0 1px 0 rgba(255,255,255,.10)!important;
    backdrop-filter:blur(20px)!important;
    -webkit-backdrop-filter:blur(20px)!important;
    overflow:hidden!important;
  }

  body.edv-chat-list-mode .edivic-chat-bottom-nav a{
    min-width:0!important;
    height:54px!important;
    border-radius:20px!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    gap:4px!important;
    padding:6px 4px!important;
    color:#cbd5e1!important;
    text-decoration:none!important;
    font-size:10.5px!important;
    line-height:1!important;
    font-weight:900!important;
    letter-spacing:.01em!important;
    border:1px solid transparent!important;
    background:transparent!important;
  }

  body.edv-chat-list-mode .edivic-chat-bottom-nav a i{
    font-size:18px!important;
    color:inherit!important;
  }

  body.edv-chat-list-mode .edivic-chat-bottom-nav a.active{
    color:#111827!important;
    background:linear-gradient(135deg,#FEBD69,#ffd47e)!important;
    border-color:rgba(255,255,255,.26)!important;
    box-shadow:0 10px 24px rgba(254,189,105,.25)!important;
  }

  body.edv-chat-room-mode .edivic-chat-bottom-nav{
    display:none!important;
  }
}


/* EDIVIC: mobile bottom/down bar removed */
@media (max-width: 900px){
  body, body.edivic-mtb-nav-ready{ padding-bottom:0!important; }
  .edv-mtb-bottom-nav,
  .edv-mobile-bottom-nav,
  .edivic-chat-bottom-nav,
  .bottom-nav,
  .edv-chat-bottom-nav{
    display:none!important;
    visibility:hidden!important;
    opacity:0!important;
    pointer-events:none!important;
  }
}
