.alex-llm-chat-wrapper {
    font-family: Arial, sans-serif;
    width: 100%;
}

.alex-llm-chat-title {
    text-align: center;
}

#alex-llm-chat {
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 10px;
    padding: 20px;

    height: 400px;
    width: 90%;
    max-width: 1000px;

    margin-left: auto;
    margin-right: auto;

    display: flex;
    flex-direction: column;
    box-sizing: border-box;

    font-size: 12px;
}

#alex-llm-chat * {
    box-sizing: border-box;
}

.alex-llm-model-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    font-size: 12px;
}

.alex-llm-left-options {
    display: flex;
    align-items: center;
    gap: 20px;
}

.alex-llm-option-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.alex-llm-option-group select {
    height: 32px;
    padding: 0 8px;
    margin: 0;
    font-size: 12px;
}

#alex-llm-messages {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    font-size: 12px;
}

.alex-llm-message {
    padding: 8px 12px;
    margin: 8px 0;
    border-radius: 10px;
    width: fit-content;
    max-width: 80%;
    overflow-wrap: anywhere;
}

.alex-llm-message p {
    margin: 0;
}

.alex-llm-user {
    background-color: #d9eaff;
    margin-left: auto;
    text-align: right;
}

.alex-llm-assistant {
    background-color: #e8e8e8;
    margin-right: auto;
}

.alex-llm-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}

#alex-llm-prompt {
    flex: 1;
    min-width: 0;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 12px;
}

#alex-llm-send {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
}

@media (max-width: 700px) {
    #alex-llm-chat {
        width: 100%;
        height: 450px;
        padding: 12px;
    }

    .alex-llm-credit {
        width: 100%;
        max-width: none;
    }

    .alex-llm-model-options,
    .alex-llm-left-options {
        flex-wrap: wrap;
        gap: 10px;
    }
}

.alex-llm-credit {
    width: 90%;
    max-width: 1000px;
    margin: 8px auto 0 auto;
    text-align: left;
    font-size: 11px;
    box-sizing: border-box;
}

.alex-llm-credit a {
    color: blue;
    font-weight: bold;
    text-decoration: none;
}

.alex-llm-model-stats {
    margin: -2px 0 8px 8px;
    font-size: 11px;
    color: #666;
}


/* v1.2.8 revised: readable status and credit following status alignment */
.alex-live-status {
    width: 90%;
    max-width: 1000px;
    margin: 6px auto 0 auto;
    padding: 0;
    text-align: left;
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px 12px;
    font-size: 11px;
    line-height: 1.4;
    color: #555;
}

.alex-status-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
    font-size: 11px;
}

.alex-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 2px;
}

/* Credit follows the live-status left edge and width exactly. */
.alex-llm-credit {
    width: 90%;
    max-width: 1000px;
    margin: 4px auto 0 auto;
    padding: 0;
    text-align: left;
    box-sizing: border-box;
    font-size: 11px;
    line-height: 1.4;
}

@media (max-width: 700px) {
    .alex-live-status,
    .alex-llm-credit {
        width: 100%;
        max-width: none;
    }

    .alex-live-status,
    .alex-status-item,
    .alex-llm-credit {
        font-size: 11px;
    }

    .alex-live-status {
        gap: 4px 8px;
    }
}


/* Standalone v2: refined credit/status typography */
.alex-llm-credit {
    font-family: Arial, sans-serif;
    font-size: 12px;
    line-height: 1.5;
    color: #333;
    margin: 0 auto 6px auto;
}

.alex-live-status {
    font-family: Arial, sans-serif;
    font-size: 12px;
    line-height: 1.5;
    color: #444;
    margin: 7px auto 0 auto;
}

.alex-status-item {
    font-size: 12px;
}

.alex-live-status strong {
    font-weight: 600;
}


/* Standalone v3: reliable chat bubbles */
#alex-llm-messages .alex-llm-message {
    display: block;
    width: fit-content;
    max-width: 80%;
    padding: 8px 12px;
    margin-top: 8px;
    margin-bottom: 8px;
    border-radius: 10px;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    line-height: 1.45;
}

#alex-llm-messages .alex-llm-user {
    background-color: #d9eaff;
    margin-left: auto;
    margin-right: 0;
    text-align: left;
}

#alex-llm-messages .alex-llm-assistant {
    background-color: #e8e8e8;
    margin-left: 0;
    margin-right: auto;
    text-align: left;
}

#alex-llm-messages .alex-llm-model-stats {
    margin: -2px 0 8px 8px;
    font-size: 11px;
    color: #666;
}


/* v1.2.9: status word colours only */
#alex-status-backend.alex-status-online {
    color: green;
}

#alex-status-backend.alex-status-loading {
    color: orange;
}

#alex-status-backend.alex-status-generating {
    color: blue;
}

#alex-status-backend.alex-status-offline {
    color: red;
}


/* v1.2.9.1: compact live PC status */
.alex-live-status {
    font-size: 8px;
    line-height: 1.2;
    gap: 3px 6px;
}

.alex-status-item {
    font-size: 8px;
    gap: 2px;
}

.alex-status-dot {
    width: 6px;
    height: 6px;
    margin-right: 1px;
}

.alex-live-status strong {
    font-size: 8px;
}

@media (max-width: 700px) {
    .alex-live-status,
    .alex-status-item,
    .alex-live-status strong {
        font-size: 8px;
    }

    .alex-live-status {
        gap: 3px 6px;
        line-height: 1.2;
    }
}


/* v1.2.9.2: live PC status adjusted to 9px */
.alex-live-status,
.alex-status-item,
.alex-live-status strong {
    font-size: 9px;
}

.alex-live-status {
    line-height: 1.2;
    gap: 3px 6px;
}

.alex-status-item {
    gap: 2px;
}

.alex-status-dot {
    width: 6px;
    height: 6px;
    margin-right: 1px;
}

@media (max-width: 700px) {
    .alex-live-status,
    .alex-status-item,
    .alex-live-status strong {
        font-size: 9px;
    }
}

/* v1.4.0: browser-local chat history controls */
.alex-chat-history-controls {
    width: 90%; max-width: 1000px; margin: 0 auto 8px;
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
    font-family: Arial, sans-serif; font-size: 12px; box-sizing: border-box;
}
.alex-chat-history-controls input, .alex-chat-history-controls select,
.alex-chat-history-controls button {
    height: 30px; padding: 0 8px; font-size: 12px;
    border: 1px solid #ccc; border-radius: 6px; box-sizing: border-box;
}
.alex-chat-history-controls input { width: 130px; }
.alex-chat-history-controls select { min-width: 150px; max-width: 240px; }
.alex-chat-history-controls button { cursor: pointer; }
.alex-chat-history-controls button:disabled { cursor: wait; opacity: .55; }
@media (max-width: 700px) {
  .alex-chat-history-controls { width: 100%; }
  .alex-chat-history-controls input, .alex-chat-history-controls select { flex: 1 1 130px; min-width: 0; }
}

/* v1.4.0 layout refinement: equally sized Save and Load name fields */
@media (min-width: 701px) {
  .alex-chat-history-controls { flex-wrap: nowrap; }
  .alex-chat-history-controls input,
  .alex-chat-history-controls select {
    flex: 1 1 0; width: 0; min-width: 0; max-width: none;
  }
  .alex-chat-history-controls button { flex: 0 0 auto; }
}
@media (max-width: 700px) {
  .alex-chat-history-controls input,
  .alex-chat-history-controls select { flex: 1 1 130px; width: auto; max-width: none; }
}
