/* Admin Console Styles
 * Copyright (c) 2025-2026 Cindy's World LLC and contributors
 */

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 8px;
    background-color: #f5f5f5;
    max-width: 100vw;
    overflow-x: hidden;
}
.main-container {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}
body.auth-locked {
    overflow: hidden;
}
.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(44, 62, 80, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 1000;
}
.auth-overlay.hidden {
    display: none;
}
.auth-card {
    background: #ffffff;
    border-radius: 8px;
    padding: 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    text-align: center;
}
.auth-card h2 {
    margin-top: 0;
    color: #2c3e50;
}
.auth-card p {
    font-size: 14px;
    color: #4a5765;
    margin-bottom: 16px;
}
.auth-actions {
    margin: 16px 0 8px 0;
}
.auth-actions button {
    padding: 10px 18px;
    font-size: 14px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: #007bff;
    color: #ffffff;
}
.auth-actions button:disabled {
    background: #9bb8e4;
    cursor: not-allowed;
}
.auth-code-entry {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.auth-code-entry input {
    flex: 1;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ccd2da;
    border-radius: 4px;
    text-align: center;
    letter-spacing: 4px;
}
.auth-code-entry button {
    padding: 10px 16px;
    font-size: 14px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: #28a745;
    color: #ffffff;
}
.auth-code-entry button:disabled {
    background: #8dd3a4;
    cursor: not-allowed;
}
.auth-message {
    font-size: 14px;
    margin-top: 12px;
}
.auth-message.error {
    color: #c0392b;
}
.auth-message.info {
    color: #2c3e50;
}
.auth-message.hidden {
    display: none;
}
.console-no-access {
    margin: 16px;
    padding: 16px;
    background: #fff;
    border-radius: 4px;
    color: #2c3e50;
}
.console-no-access.hidden {
    display: none;
}
#main-tab-bar.hidden,
#tab-panels.hidden {
    display: none !important;
}
.header {
    background: #2c3e50;
    color: white;
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.header h1 {
    margin: 0;
    font-size: 24px;
    flex: 1;
}
.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}
.header-avatar-btn {
    padding: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
}
.header-avatar-btn:hover {
    opacity: 0.9;
}
.header-avatar-btn:focus {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}
.header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.2);
    display: block;
}
.header-avatar-initials {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.header-name {
    font-size: 14px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Issue 797: impersonation controls to the left of avatar */
.header-impersonate-wrap {
    display: flex;
    align-items: center;
}
.header-impersonate-btn,
.header-stop-impersonate-btn {
    font-size: 13px;
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
}
.header-impersonate-btn:hover,
.header-stop-impersonate-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}
.header-impersonate-btn:focus,
.header-stop-impersonate-btn:focus {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}
.header-impersonate-dropdown-wrap {
    position: relative;
}
.header-impersonate-panel {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 6px;
    min-width: 220px;
    max-height: 280px;
    overflow-y: auto;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    padding: 6px 0;
    z-index: 1000;
}
.header-impersonate-panel.hidden {
    display: none !important;
}
.header-impersonate-panel button {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: none;
    color: #2c3e50;
    font-size: 14px;
    padding: 8px 14px;
    cursor: pointer;
}
.header-impersonate-panel button:hover {
    background: #e8ecf0;
}
.header-user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    min-width: 160px;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    padding: 6px 0;
    z-index: 1000;
}
.header-user-dropdown.hidden {
    display: none !important;
}
.header-user-dropdown a {
    display: block;
    color: #2c3e50;
    text-decoration: none;
    font-size: 14px;
    padding: 8px 14px;
    border-radius: 0;
}
.header-user-dropdown a:hover {
    background: #e8ecf0;
}
.header-user-dropdown a:focus {
    background: #e8ecf0;
}
.auth-actions .button-link {
    display: inline-block;
    padding: 10px 20px;
    background: #4285f4;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    border: none;
    cursor: pointer;
}
.auth-actions .button-link:hover {
    background: #3367d6;
}
.tab-bar {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    visibility: visible !important;
    opacity: 1 !important;
}
/* Ensure subtab bars inside tab panels are always visible when panel is active */
.tab-panel.active .tab-bar {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}
/* Ensure subtab buttons are visible */
.tab-panel.active .tab-bar .tab-button {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}
.tab-button {
    border: none;
    background: #e0e6ed;
    color: #2c3e50;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease, color 0.2s ease;
}
.tab-button.active {
    background: #2c3e50;
    color: #fff;
}
/* Alerts tab when any console alerts exist (superuser); see updateAlertsTabPendingState (issue #936) */
#main-tab-bar .tab-button[data-tab="alerts"].tab-alerts-pending {
    background: #fecaca;
    color: #7f1d1d;
}
#main-tab-bar .tab-button[data-tab="alerts"].tab-alerts-pending:hover {
    background: #fca5a5;
    color: #450a0a;
}
#main-tab-bar .tab-button[data-tab="alerts"].tab-alerts-pending.active {
    background: #991b1b;
    color: #fff;
}
#main-tab-bar .tab-button[data-tab="alerts"].tab-alerts-pending.active:hover {
    background: #7f1d1d;
    color: #fff;
}
/* :not(.active) so touch “sticky hover” cannot override the selected tab’s dark
   background while keeping white text from .active (issue #977). */
.tab-button:hover:not(.active) {
    background: #cfd8e3;
}
.tab-panel {
    display: none;
}
.tab-panel.active {
    display: block;
}
/* Ensure subtab bars are visible when their parent tab panel is active */
.tab-panel.active .tab-bar {
    display: flex;
}
.subtab-panel {
    display: none;
}
.subtab-panel.active {
    display: block;
}

/* Agent Parameters styling */
.agent-param-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}
.agent-status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
    gap: 16px;
}
.agent-status-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.agent-status-info {
    text-align: right;
    min-width: 150px;
}
@media (max-width: 600px) {
    .agent-status-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .agent-status-info {
        text-align: left;
        width: 100%;
        border-top: 1px solid #f0f0f0;
        padding-top: 8px;
    }
    .agent-param-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}
.agent-param-section {
    margin-bottom: 24px;
}
.agent-param-section h3 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 16px;
    color: #2c3e50;
}
/* Heading on same row as controls (e.g. Character LLM + combobox) */
.agent-param-heading-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
}
.agent-param-heading-inline > h3 {
    margin-bottom: 0;
}
.agent-param-heading-inline .agent-param-heading-inline-controls {
    flex: 1 1 220px;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.role-prompt-tag {
    display: flex;
    align-items: center;
    background: #f0f2f5;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 14px;
}
.role-prompt-tag button {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-weight: bold;
    padding: 0 4px;
    margin-left: 8px;
}
.agent-param-textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
}
.agent-param-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}
.agent-param-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
}
.agent-param-checkbox-label input {
    margin-right: 8px;
}
.role-prompts-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}
/* Role prompts: Option A chip cloud (Characters → Parameters) */
.role-prompts-chip-cloud {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}
button.role-prompt-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px 8px 14px;
    margin: 0;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.2;
    cursor: pointer;
    border: 1px solid #dee2e6;
    background: #fff;
    color: #2c3e50;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.role-prompt-chip-label {
    min-width: 0;
}
button.role-prompt-chip:hover:not(:disabled) {
    border-color: #adb5bd;
    background: #f8f9fa;
}
button.role-prompt-chip.role-prompt-chip--on {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}
button.role-prompt-chip.role-prompt-chip--on:hover:not(:disabled) {
    background: #0b5ed7;
    border-color: #0b5ed7;
}
button.role-prompt-chip:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}
/* Allow help (i) clicks while chip is disabled; bubble is fixed to body (opaque). */
button.role-prompt-chip:disabled .info-icon.role-prompt-chip-info {
    pointer-events: auto;
    cursor: help;
}
button.role-prompt-chip .info-icon.role-prompt-chip-info {
    flex-shrink: 0;
    margin-left: 0;
    cursor: help;
}
button.role-prompt-chip.role-prompt-chip--on .info-icon.role-prompt-chip-info {
    background: rgba(255, 255, 255, 0.28);
    color: #fff;
}
button.role-prompt-chip.role-prompt-chip--on .info-icon.role-prompt-chip-info:hover {
    background: rgba(255, 255, 255, 0.4);
}
.placeholder-card {
    background: white;
    border-radius: 8px;
    padding: 40px;
    border: 1px dashed #c3c8d1;
    color: #6c757d;
    font-size: 16px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.controls {
    padding: 12px 0;
    margin-bottom: 16px;
}
.directory-selector {
    margin-bottom: 12px;
}
.directory-selector select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 300px;
}
.import-section {
    padding: 10px 0;
    margin-bottom: 12px;
}
.import-section input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-right: 10px;
}
.import-section button {
    padding: 8px 16px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.import-section button:hover {
    background: #0056b3;
}
.media-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    margin-bottom: 16px;
    width: 100%;
}
@media (max-width: 600px) {
    .directory-selector select {
        min-width: 0;
        width: 100%;
    }
    .import-section input {
        width: 100%;
        margin-right: 0;
        margin-bottom: 8px;
    }
    .import-section button {
        width: 100%;
    }
    .auth-card {
        padding: 20px;
        max-width: 90%;
    }
    .header h1 {
        font-size: 20px;
    }
    .tab-button {
        padding: 6px 12px;
        font-size: 13px;
    }
}
.media-item {
    display: flex;
    flex-direction: row;
    gap: 12px;
    margin-bottom: 16px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
@media (max-width: 768px) {
    .media-item {
        flex-direction: column;
    }
    .media-preview {
        flex: none;
        max-width: 100%;
    }
}
/* Shared larger frame for Global Media Editor and Agents->Media */
.media-preview {
    flex: 0 0 65%;
    max-width: 65%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 4px;
}
.media-preview img {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
}
.media-preview video {
    width: 100%;
    height: auto;
    object-fit: contain;
    cursor: pointer;
}
.media-preview audio {
    width: 100%;
    height: auto;
    min-height: 48px;
    display: block;
}
.media-info {
    flex: 1;
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.media-info h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #333;
}
.media-info p {
    margin: 5px 0;
    font-size: 14px;
    color: #666;
}
.description-edit {
    margin-top: 10px;
}
.description-edit textarea {
    width: 100%;
    min-height: 180px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    resize: vertical;
    background: #fafafa;
    box-sizing: border-box;
}
.description-edit button {
    margin-top: 8px;
    padding: 6px 12px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}
.description-edit button:hover {
    background: #1e7e34;
}
.error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
}
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}
.tgs-animation-container {
    background: transparent;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    overflow: hidden;
}
.tgs-animation-container svg {
    max-width: 100%;
    max-height: 100%;
}

/* Media Page Styles */
.media-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 8px 0;
}

.media-item {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.media-item-content {
    flex: 1;
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

@media (max-width: 768px) {
    .media-item {
        flex-direction: column;
    }
    .media-preview {
        flex: none;
        max-width: 100%;
    }
}

.media-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.media-actions button {
    padding: 6px 12px;
    font-size: 13px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: #6c757d;
    color: white;
    transition: background 0.2s;
}

.media-actions button:hover {
    background: #5a6268;
}

.media-actions button.delete {
    background: #dc3545;
}

.media-actions button.delete:hover {
    background: #c82333;
}

.media-actions button.primary {
    background: #007bff;
}

.media-actions button.primary:hover {
    background: #0056b3;
}

.drop-zone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #fafafa;
    color: #666;
}

.drop-zone:hover {
    border-color: #999;
    background: #f5f5f5;
}

.drop-zone.drag-over {
    border-color: #007bff;
    background-color: #e7f3ff;
    color: #007bff;
}

.save-media-btn {
    padding: 3px 6px;
    font-size: 11px;
    background: #d4edda;
    color: #000;
    border: 1px solid #c3e6cb;
    border-radius: 3px;
    cursor: pointer;
    margin-top: 4px;
    transition: background 0.2s;
}

.save-media-btn:hover:not(:disabled) {
    background: #c3e6cb;
}

.save-media-btn:disabled {
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    border-color: #dee2e6;
}

/* Info (i) icons: content in #help-text-bubble (help_text_english or role prompt description). */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 4px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #6c757d;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    line-height: 1;
    cursor: help;
    vertical-align: middle;
}
.info-icon:hover {
    background: #5a6268;
}

.llm-delete-btn:hover {
    color: #666;
}

.llm-delete-btn:focus {
    outline: 1px dotted #999;
}

.schedule-delete-btn:hover {
    color: #666;
}

/* Schedule: on narrow viewports put activity name on its own line */
.schedule-activity-header {
    flex-wrap: wrap;
}
@media (max-width: 480px) {
    .schedule-activity-header .schedule-field-name {
        flex: 1 1 100%;
        min-width: 100%;
    }
}

/* Shared profile form layout (Agents->Profile and Conversations->Profile) */
.profile-form {
    box-sizing: border-box;
}
.profile-form input,
.profile-form select,
.profile-form textarea {
    box-sizing: border-box;
    max-width: 100%;
}
.profile-form-name-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.profile-form-photo {
    flex: 0 0 auto;
    text-align: center;
}
.profile-form-photo img,
.profile-form-photo video {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid #e0e0e0;
    object-fit: cover;
    background: #f5f5f5;
    cursor: pointer;
}
.profile-form-name-fields {
    flex: 1;
    min-width: 200px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.profile-form-name-fields--inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.profile-form-name-fields--inline .profile-form-name-input {
    flex: 1 1 140px;
    min-width: 0;
    max-width: 100%;
}
.profile-form-main-col {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.profile-form-username-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.profile-form-username-row .profile-form-inline-label {
    margin: 0;
    font-weight: 500;
    color: #2c3e50;
    flex: 0 0 auto;
}
.profile-form-username-input {
    flex: 1;
    min-width: 160px;
    max-width: 100%;
}
.profile-form-inline-label {
    margin: 0;
    font-weight: 500;
    color: #2c3e50;
    flex: 0 0 auto;
}
.profile-form-inline-field {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}
.profile-form-inline-field .profile-form-bio-input {
    flex: 1;
    min-width: 200px;
    max-width: 100%;
}
.profile-form-birthday-controls {
    display: grid;
    grid-template-columns: auto auto auto;
    gap: 8px;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
}
.profile-form-bio-block .profile-form-bio-status {
    margin-top: 4px;
    font-size: 12px;
}
.characters-parameters-panel {
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 0;
}
.agent-profile-panel-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
    padding-bottom: 0;
    border-bottom: none;
}
.agent-profile-panel-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 16px;
    flex-wrap: wrap;
}
.agent-profile-panel-heading-column {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}
.agent-profile-panel-heading-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
}
.agent-no-telegram-linked-notice {
    margin: 0;
    max-width: 42rem;
    font-size: 13px;
    line-height: 1.4;
    color: #666;
}
.agent-profile-panel-heading {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.3;
}
.agent-profile-panel-heading-id {
    font-size: 0.72em;
    font-weight: 500;
    color: #5a6c7d;
}
.agent-connection-state-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin-right: auto;
    flex: 0 1 auto;
}
.agent-connection-state-label {
    margin: 0;
    font-weight: 500;
    color: #2c3e50;
    font-size: 14px;
    white-space: nowrap;
}
.agent-connection-state-select {
    min-width: 7.5rem;
    max-width: 10.5rem;
    width: auto;
    flex: 0 1 auto;
}
/* Override .agent-param-input { width: 100% } for compact header pulldown */
select.agent-connection-state-select.agent-param-input {
    width: auto;
    max-width: 10.5rem;
}
.agent-connection-state-disconnecting {
    font-size: 14px;
    color: #856404;
}
.agent-profile-panel-actions {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 6px;
    flex: 1 1 280px;
    min-width: 0;
    max-width: 100%;
}
.agent-profile-panel-actions-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    justify-content: flex-end;
    min-width: 0;
}
.agent-profile-panel-header-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    flex: 1 1 auto;
    min-width: 0;
}
.character-parameters-dirty-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.character-parameters-save-status {
    font-size: 13px;
    min-height: 1em;
    line-height: 1.35;
    color: #666;
}
.character-ownership-superuser-row {
    display: none;
    margin-top: 2px;
    padding-top: 0;
    font-size: 14px;
    line-height: 1.45;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.agent-profile-section-inner {
    margin-bottom: 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
}
.characters-parameters-config {
    padding-top: 16px;
    margin-top: 4px;
    border-top: 1px solid #eee;
}
.profile-form-fields {
    margin-top: 16px;
    display: grid;
    gap: 16px;
    min-width: 0;
}
@media (max-width: 480px) {
    .profile-form-name-fields:not(.profile-form-name-fields--inline) {
        grid-template-columns: 1fr;
    }
    .profile-form-name-fields--inline .profile-form-name-input {
        flex: 1 1 100%;
    }
}

/* Characters tab: import zip beside pulldown when default option (issue #785) */
.agents-character-selector-row {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
}
.agents-character-select-block {
    min-width: 0;
}
.agents-import-zip-pulldown-wrap {
    display: none;
    flex-direction: row;
    align-items: center;
}

/* Character cards (Characters tab, issue #869) */
.characters-cards-view {
    margin-top: 8px;
}
.characters-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.characters-cards-empty {
    color: #666;
    padding: 16px 0;
}
.character-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
    align-items: stretch;
}
.character-card-id {
    font-size: 11px;
    line-height: 1.2;
    color: #888;
    font-family: ui-monospace, "Cascadia Code", "Source Code Pro", monospace;
    word-break: break-all;
}
.character-card-main {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.character-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #c5d4e8;
}
.character-card:focus {
    outline: 2px solid #4a90d9;
    outline-offset: 2px;
}
.character-card-avatar-wrap {
    flex-shrink: 0;
}
.character-card-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    background: #eee;
    display: block;
}
.character-card-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 22px;
    color: #5a6a7a;
    background: linear-gradient(145deg, #e8eef5, #dce4ee);
}
.character-card-body {
    flex: 1;
    min-width: 0;
}
.character-card-name {
    font-weight: 600;
    font-size: 16px;
    color: #2c3e50;
    margin-bottom: 4px;
}
.character-card-username {
    font-size: 14px;
    color: #0d6efd;
    margin-bottom: 6px;
}
.character-card-username-mismatch {
    background-color: #fecaca;
    color: #991b1b;
    padding: 2px 6px;
    border-radius: 4px;
}
.agent-profile-username-mismatch {
    background-color: #fecaca;
    color: #991b1b;
    border: 1px solid #991b1b !important;
    padding: 8px 12px;
    border-radius: 4px;
}
.character-card-bio {
    font-size: 13px;
    color: #555;
    line-height: 1.4;
    max-height: 4.2em;
    overflow: hidden;
    margin-bottom: 8px;
    word-break: break-word;
}
.character-card-state {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 4px 10px;
    border-radius: 999px;
}
.character-card-state-running {
    background: #e6f4ea;
    color: #1e6b2f;
}
.character-card-state-paused {
    background: #fef9c3;
    color: #854d0e;
}
.character-card-state-disconnected {
    background: #e5e7eb;
    color: #4b5563;
}

/* Alerts management tab (issue #936) */
.admin-alerts-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding: 12px 14px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}
.admin-alerts-select-all-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    user-select: none;
}
.admin-alerts-delete-btn {
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    background: #dc3545;
    color: #fff;
}
.admin-alerts-delete-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.admin-alerts-test-btn {
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    background: #5a6268;
    color: #fff;
}
.admin-alerts-test-btn:hover {
    background: #4a5157;
}
.admin-alerts-test-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.admin-alerts-status {
    font-size: 14px;
    color: #555;
    flex: 1;
    min-width: 120px;
}
.admin-alerts-empty {
    margin: 12px 0;
    font-size: 14px;
    color: #666;
}
.admin-alerts-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    font-size: 13px;
}
.admin-alerts-table th,
.admin-alerts-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e8e8e8;
    vertical-align: top;
}
.admin-alerts-table th {
    background: #f4f4f5;
    font-weight: 600;
    color: #333;
}
.admin-alerts-col-check {
    width: 44px;
}
.admin-alerts-cell-body {
    max-width: 28em;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 8em;
    overflow: auto;
    font-family: inherit;
    color: #444;
}
#admin-alerts-loading.hidden,
#admin-alerts-empty.hidden,
.admin-alerts-table.hidden {
    display: none !important;
}

/* English UI help bubble: white on dark (issue #942, #976) */
.help-text-bubble {
    display: none;
    z-index: 10001;
    max-width: calc(100vw - 16px);
    opacity: 1;
    isolation: isolate;
    pointer-events: auto;
}
.help-text-bubble.help-text-bubble--open {
    display: block;
}
.help-text-bubble-inner {
    background: #2c3e50;
    color: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: column;
    max-height: min(90vh, calc(100vh - 24px));
    min-height: 0;
    overflow: hidden;
}
.help-text-bubble-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    flex-shrink: 0;
}
.help-text-bubble-edit {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 2px 6px;
    color: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
}
.help-text-bubble-edit:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}
.help-text-bubble-body {
    font-size: 12px;
    font-weight: normal;
    line-height: 1.45;
    color: #fff;
    white-space: pre-wrap;
    word-break: break-word;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}
.help-text-bubble-textarea {
    width: 100%;
    box-sizing: border-box;
    font-size: 12px;
    font-family: inherit;
    margin-top: 4px;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.25);
    color: #fff;
    resize: none;
    flex: 1 1 0;
    min-height: 100px;
    overflow-y: auto;
}
.help-text-bubble-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    justify-content: flex-end;
    flex-shrink: 0;
}
.help-text-bubble-actions button {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}
.help-text-bubble-actions .help-text-bubble-save {
    background: #3498db;
    border-color: #2980b9;
    color: #fff;
}
.help-text-bubble-actions .help-text-bubble-save:hover {
    background: #2980b9;
}
.help-text-bubble-actions .help-text-bubble-cancel:hover {
    background: rgba(255, 255, 255, 0.2);
}

