:root{font-family:system-ui,-apple-system,"Tahoma",sans-serif;color:#16343a;background:#eef2f3;line-height:1.55;--nav:#0d3137;--green:#087a61;--line:#dbe3e5;--muted:#667a80}*{box-sizing:border-box}body{margin:0}button,input,textarea{font:inherit}button{border:0;cursor:pointer}button:focus-visible,input:focus-visible,textarea:focus-visible{outline:3px solid #1c9bb2;outline-offset:2px}.hidden{display:none!important}.login{min-height:100dvh;display:grid;place-items:center;padding:20px;background:radial-gradient(circle at 10% 10%,#1c5961,var(--nav) 58%)}.login-card{background:#fff;width:min(420px,100%);padding:40px;border-radius:18px;box-shadow:0 25px 70px #061d2266}.logo{width:54px;height:54px;border-radius:15px;background:#a9efd3;display:grid;place-items:center;font-weight:900;font-size:1.25rem}.overline{margin:18px 0 4px;font-size:.72rem;letter-spacing:.16em;font-weight:800;color:#688087}.login h1{margin:0;font-size:1.75rem}.login p{color:var(--muted)}label{display:grid;gap:8px;margin:26px 0 14px;font-weight:650}.login input,.composer textarea{border:1px solid #cbd7da;border-radius:9px;padding:12px;background:#f9fbfb}.login button,.composer button{background:var(--green);color:#fff;padding:12px 18px;border-radius:9px;font-weight:700}.login button{width:100%}.error{color:#b3261e;margin-top:12px}.app{min-height:100dvh}header{height:94px;background:var(--nav);color:white;padding:18px 30px;display:flex;align-items:center;justify-content:space-between;gap:15px}header .overline{color:#a7c2c6;margin:0}header h1{font-size:1.4rem;margin:2px 0}.header-actions{display:flex;gap:9px;align-items:center}.badge{background:#244b51;padding:6px 9px;border-radius:6px;font-size:.75rem}.ghost{color:#d7e3e5;background:#1a4148;border:1px solid #3d5c61;padding:8px 11px;border-radius:7px}main{display:grid;grid-template-columns:320px 1fr;height:calc(100dvh - 94px)}.list{background:#fff;border-right:1px solid var(--line);overflow:auto}.section-title{padding:20px;display:flex;justify-content:space-between;border-bottom:1px solid var(--line)}.section-title h2{font-size:1rem;margin:0}.section-title span{color:var(--muted);font-size:.85rem}.conversation{width:100%;padding:16px 20px;background:#fff;border-bottom:1px solid #edf1f2;text-align:left}.conversation.active{background:#e6f2ef;border-left:4px solid var(--green);padding-left:16px}.conversation-top{display:flex;justify-content:space-between;gap:10px}.conversation strong{overflow:hidden;text-overflow:ellipsis}.conversation p{color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:6px 0 0}.status{font-size:.72rem;padding:2px 6px;border-radius:5px;background:#e5edf0;color:#47636c}.status.human,.status.needs_attention{background:#fff0d2;color:#80510e}.empty{display:grid;place-items:center;text-align:center;color:var(--muted)}.empty h2{color:#294950}.detail{min-width:0;display:flex;flex-direction:column;height:100%}.contact{padding:16px 22px;background:#fff;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center;gap:16px}.contact h2{margin:0;font-size:1.05rem}.contact p{margin:3px 0;color:var(--muted);font-size:.84rem}.actions{display:flex;gap:8px}.secondary{background:#fff;border:1px solid #c9d6d9;border-radius:7px;padding:8px 10px}.detail-grid{display:grid;grid-template-columns:minmax(0,1fr) 280px;min-height:0;flex:1}.messages{padding:24px;overflow:auto;display:flex;flex-direction:column;gap:13px;background:#f5f7f8}.message{max-width:78%;align-self:flex-start}.message.inbound{align-self:flex-end}.bubble{padding:10px 13px;background:#fff;border:1px solid var(--line);border-radius:4px 13px 13px 13px;white-space:pre-wrap;overflow-wrap:anywhere}.inbound .bubble{background:#173f47;color:#fff;border:0;border-radius:13px 4px 13px 13px}.draft .bubble{border-style:dashed;background:#fff9e9}.message small{color:var(--muted);font-size:.72rem;display:block;margin-top:4px}.lead{background:#fff;border-left:1px solid var(--line);padding:20px;overflow:auto}.lead .overline{margin:0 0 12px}.lead dl{margin:0}.lead dl div{padding:9px 0;border-bottom:1px solid #edf1f2}.lead dt{color:var(--muted);font-size:.75rem}.lead dd{margin:2px 0;font-size:.88rem;font-weight:600}.summary{font-size:.84rem;color:#486168;background:#eef4f4;padding:11px;border-radius:7px}.composer{display:flex;gap:10px;background:#fff;border-top:1px solid var(--line);padding:14px 20px}.composer textarea{resize:none;flex:1}.composer button{align-self:stretch}.toast{position:fixed;left:50%;bottom:20px;transform:translateX(-50%);background:#102f35;color:white;padding:10px 18px;border-radius:8px;box-shadow:0 10px 30px #0002}
@media(max-width:850px){header{height:auto;padding:14px 16px;align-items:flex-start}header h1{font-size:1.15rem}.badge{display:none}main{height:calc(100dvh - 83px);grid-template-columns:1fr}.list{border-right:0}.detail,.empty{position:fixed;inset:83px 0 0;background:#eef2f3;z-index:2}.detail-grid{grid-template-columns:1fr}.lead{display:none}.contact{padding:12px 14px}.messages{padding:16px}.composer{padding:10px}.message{max-width:88%}.conversation-list{padding-bottom:30px}.detail.open{}.header-actions{gap:5px}.ghost{padding:7px 8px}.contact .actions{flex-direction:column}.secondary{padding:6px 8px;font-size:.78rem}}
.mobile-only{display:none}
@media(max-width:850px){
  .app{height:100dvh;min-height:0;display:flex;flex-direction:column;overflow:hidden}
  .app>header{height:auto;flex-shrink:0;flex-wrap:wrap;padding-top:max(12px,env(safe-area-inset-top))}
  main{height:auto;min-height:0;flex:1;display:block;overflow:hidden}
  main>.empty{display:none!important}
  .list{height:100%;overflow:auto}
  .app.chat-open .list{display:none}
  .detail{position:static;inset:auto;height:100%;min-height:0;z-index:auto}
  .mobile-only{display:inline-flex;align-items:center;justify-content:center;min-height:44px}
  .contact{flex-wrap:wrap;gap:8px;flex-shrink:0}
  .contact .actions{width:100%;flex-direction:row;flex-wrap:wrap}
  .contact .secondary{min-height:44px}
  .detail-grid{min-height:0;position:relative}
  .lead{display:none;min-height:0}
  .detail.show-lead .lead{display:block;border:0;overflow:auto}
  .detail.show-lead .messages{display:none}
  .composer{flex-shrink:0;padding-bottom:max(10px,env(safe-area-inset-bottom));gap:6px}
  .composer textarea{min-width:0;font-size:16px}
  .composer button{padding:10px}
  .messages{min-width:0;min-height:0;overscroll-behavior:contain}
}
