.chat-messages {
    flex: 1;
    overflow-y: auto;
    width: 100%;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-height: 0;
}

.chat-message {
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 70%;
}

.chat-message .timestamp {
    font-size: 0.75rem;
    color: var(--text-muted, #999);
    margin-top: 4px;
    text-align: right;
}

.chat-message.sent {
    align-self: flex-end;
    background: var(--chatsend_color);
}

.chat-message.received {
    align-self: flex-start;
    background: var(--chatrec-color);
}

.chat-message.received .timestamp {
    text-align: left;
}


.chat-input {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.5rem;
    border-top: 1px solid #ccc;
    gap: 0.5rem;
}


#chatInput {
    resize: none;
    overflow-y: auto;
    min-height: 38px;
    max-height: 100px;
    flex: 1;
}

.dashboard-boxes {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    align-items: center;
}

.dashboard-box {
    width: 90%;
    cursor: pointer;
    border: 2px solid var(--text-color);
    border-radius: 12px;
    padding: 0.4rem;
    display: flex;
    gap: 0.8rem;
    align-items: center;
    background-color: var(--bg-app-color);
    font-Size: 1.2rem;
}

.box-icon {
    height: 60px;
    width: 80px;
    object-fit: contain;
    flex-shrink: 0;
    padding-left: 12px;
}

#div-labvalues {
    background-color: var(--bg-app-color);
    color: var(--text-color);
}

.lab-toolbar {
    background-color: var(--bg-app-color);
    position: sticky;
    top: 0;
    z-index: 20;
}






.chat-message .chat-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* PDF view: toolbar fixed, only the pages scroll and pan (also sideways when zoomed) */
#div-pdfview {
    overflow: hidden;
}

.pdf-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

/* As wide as the widest page, at least the visible width - smaller pages stay centered */
.pdf-pages {
    width: max-content;
    min-width: 100%;
}

.pdf-pages canvas {
    display: block;
    margin: 0 auto 12px auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    background: #fff;
}

#docList .list-group-item {
    background-color: var(--bg-app-color);
    color: var(--text-color);
    border-color: var(--border-color);
}

/* Scanner: pages taken so far as a flat strip with page number and delete button */
.scan-gallery {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 8px 4px 4px 4px;
    margin-bottom: 6px;
}

.scan-gallery:empty {
    display: none;
}

.scan-thumb {
    position: relative;
    flex: 0 0 auto;
    height: 84px;
}

.scan-thumb img {
    height: 100%;
    width: auto;
    display: block;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.scan-thumb .scan-thumb-nr {
    position: absolute;
    left: 3px;
    bottom: 3px;
    min-width: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 0.75rem;
    text-align: center;
}

.scan-thumb .scan-thumb-del {
    position: absolute;
    top: -7px;
    right: -7px;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #dc3545;
    color: #fff;
    font-size: 0.9rem;
    line-height: 1;
}

/* No browser zoom in the app (pinch, double tap) - only scrolling. The PDF view zooms itself
   (emil.js, pdfPinch*). iOS ignores user-scalable=no, see the gesturestart handler in app.js. */
html, body {
    touch-action: pan-x pan-y;
}
