*{box-sizing:border-box}body{margin:0;font-family:Arial,Helvetica,sans-serif;background:#0b141a;color:#e9edef}
button,input,textarea,select{font:inherit}
.hidden{display:none!important}
#app{height:100vh}
.auth-wrap{display:flex;align-items:center;justify-content:center;height:100vh;background:linear-gradient(180deg,#00a884 0 22%,#111b21 22%)}
.auth-card{width:100%;max-width:420px;background:#202c33;border-radius:16px;padding:28px;box-shadow:0 20px 70px rgba(0,0,0,.35)}
.auth-card h1{margin:0 0 8px}.muted{color:#8696a0}.field{margin-top:14px}.field label{display:block;margin-bottom:6px;color:#cfd6da}.field input,.field select,.field textarea{width:100%;padding:12px 14px;border-radius:10px;border:1px solid #2a3942;background:#111b21;color:#fff;outline:0}
.primary-btn,.ghost-btn,.danger-btn{border:0;border-radius:10px;padding:12px 16px;cursor:pointer}.primary-btn{background:#00a884;color:#fff}.ghost-btn{background:#2a3942;color:#fff}.danger-btn{background:#b42318;color:#fff}
.topbar{height:64px;background:#202c33;border-bottom:1px solid #2a3942;display:flex;align-items:center;justify-content:space-between;padding:0 16px}
.badge{display:inline-flex;padding:4px 8px;border-radius:999px;font-size:12px;background:#2a3942;color:#d5dde0}
.online{background:#053d33;color:#7ce1c0}.offline{background:#3f1d1d;color:#ffb4b4}
.app-shell{display:grid;grid-template-columns:300px 420px 1fr;height:calc(100vh - 64px)}
.panel-left{background:#111b21;border-right:1px solid #2a3942;overflow:auto}.panel-middle{background:#111b21;border-right:1px solid #2a3942;display:flex;flex-direction:column}.panel-right{background:#0b141a;display:flex;flex-direction:column}
.side-section{padding:16px;border-bottom:1px solid #202c33}.side-title{margin:0 0 12px;font-size:14px;color:#aebac1;text-transform:uppercase;letter-spacing:.06em}
.list{display:flex;flex-direction:column;gap:8px}.instance-item,.chat-item,.user-item{border:1px solid #2a3942;border-radius:12px;padding:12px;cursor:pointer;background:#111b21}.instance-item.active,.chat-item.active{border-color:#00a884;background:#1f2c34}.row{display:flex;align-items:center;gap:10px}.row-between{display:flex;justify-content:space-between;align-items:center;gap:10px}
.avatar{width:46px;height:46px;border-radius:50%;object-fit:cover;background:#2a3942;display:flex;align-items:center;justify-content:center;font-weight:bold}
.small{font-size:12px;color:#8696a0}.ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-toolbar{padding:12px 16px;background:#202c33;display:flex;align-items:center;justify-content:space-between;gap:10px}
.messages{flex:1;overflow:auto;padding:18px;background-image:radial-gradient(rgba(255,255,255,.03) 1px, transparent 1px);background-size:16px 16px}
.msg{max-width:72%;padding:10px 12px;border-radius:10px;margin-bottom:10px;position:relative;line-height:1.45;box-shadow:0 1px 1px rgba(0,0,0,.14)}
.msg.in{background:#202c33}.msg.out{background:#005c4b;margin-left:auto}.msg .meta{display:block;margin-top:6px;font-size:11px;color:#b6c6ce;text-align:right}.deleted{opacity:.65;font-style:italic}.typing{padding:8px 18px;color:#95a9b5;font-size:13px;min-height:34px}
.composer{padding:12px;background:#202c33;display:grid;grid-template-columns:auto 1fr auto auto;gap:10px;align-items:center}
.composer textarea{width:100%;min-height:48px;max-height:130px;padding:12px;border-radius:12px;border:0;background:#2a3942;color:#fff;resize:vertical;outline:0}
.chat-search{padding:12px 16px;border-bottom:1px solid #202c33}.chat-search input{width:100%;padding:12px;border-radius:10px;border:1px solid #2a3942;background:#111b21;color:#fff}
.media-thumb{max-width:240px;border-radius:8px;display:block}.toolbar-group{display:flex;gap:8px;flex-wrap:wrap}.link-btn{color:#53bdeb;cursor:pointer;text-decoration:underline}
.modal-form{display:grid;gap:10px}.stats{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}.stat{background:#111b21;border:1px solid #2a3942;border-radius:12px;padding:12px}
@media (max-width:1200px){.app-shell{grid-template-columns:280px 340px 1fr}}@media (max-width:900px){.app-shell{grid-template-columns:1fr}.panel-left{display:none}.panel-middle{display:none}.mobile-show-list .panel-middle{display:flex}.mobile-show-chat .panel-right{display:flex}}



/* ===== Ajuste de tela fixa ===== */
html, body {
  height: 100%;
  overflow: hidden !important;
}

#app {
  height: 100vh;
  overflow: hidden;
}

.topbar {
  height: 64px;
  min-height: 64px;
}

.app-shell {
  height: calc(100vh - 64px) !important;
  min-height: calc(100vh - 64px) !important;
  max-height: calc(100vh - 64px) !important;
  overflow: hidden !important;
}

.panel-left,
.panel-middle,
.panel-right {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.panel-left {
  overflow-y: auto;
}

.panel-middle {
  min-height: 0;
}

#chatList,
.chat-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto !important;
  overflow-x: hidden;
}

.messages {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-bottom: 16px;
}

.composer,
.message-box {
  flex: 0 0 auto;
  position: relative;
  bottom: 0;
}

.composer textarea,
.message-box textarea,
.message-box input {
  max-height: 120px;
}

.side-section {
  min-height: 0;
}

.stats {
  overflow: hidden;
}

@media (max-width: 900px) {
  html, body, #app {
    height: 100dvh;
  }

  .topbar {
    height: 58px;
    min-height: 58px;
  }

  .app-shell {
    height: calc(100dvh - 58px) !important;
    min-height: calc(100dvh - 58px) !important;
    max-height: calc(100dvh - 58px) !important;
  }

  .panel-right,
  .panel-middle {
    height: 100%;
  }

  .messages {
    padding: 12px;
  }

  .composer {
    padding: 10px;
    grid-template-columns: auto 1fr auto;
  }
}
